From 1be2ecbb62d8e256843da49810ce38f267fb5a3d Mon Sep 17 00:00:00 2001 From: Julien Date: Tue, 9 Apr 2024 08:13:27 +0200 Subject: [PATCH 1/7] add coverage Report to documentation --- doc/coverageReport/amber.png | Bin 0 -> 141 bytes doc/coverageReport/emerald.png | Bin 0 -> 141 bytes doc/coverageReport/gcov.css | 519 +++++ doc/coverageReport/glass.png | Bin 0 -> 167 bytes .../numpy/__multiarray_api.h.func-sort-c.html | 76 + .../numpy/__multiarray_api.h.func.html | 76 + .../numpy/__multiarray_api.h.gcov.html | 1642 +++++++++++++ .../numpy/__ufunc_api.h.func-sort-c.html | 76 + .../include/numpy/__ufunc_api.h.func.html | 76 + .../include/numpy/__ufunc_api.h.gcov.html | 390 ++++ .../core/include/numpy/index-sort-f.html | 113 + .../core/include/numpy/index-sort-l.html | 113 + .../numpy/core/include/numpy/index.html | 113 + .../numpy/ndarraytypes.h.func-sort-c.html | 72 + .../include/numpy/ndarraytypes.h.func.html | 72 + .../include/numpy/ndarraytypes.h.gcov.html | 2021 ++++++++++++++++ .../crpropa/AssocVector.h.func-sort-c.html | 92 + .../include/crpropa/AssocVector.h.func.html | 92 + .../include/crpropa/AssocVector.h.gcov.html | 457 ++++ .../crpropa/Candidate.h.func-sort-c.html | 72 + .../include/crpropa/Candidate.h.func.html | 72 + .../include/crpropa/Candidate.h.gcov.html | 258 ++ .../include/crpropa/Common.h.func-sort-c.html | 80 + .../include/crpropa/Common.h.func.html | 80 + .../include/crpropa/Common.h.gcov.html | 163 ++ .../crpropa/EmissionMap.h.func-sort-c.html | 72 + .../include/crpropa/EmissionMap.h.func.html | 72 + .../include/crpropa/EmissionMap.h.gcov.html | 212 ++ .../crpropa/Geometry.h.func-sort-c.html | 76 + .../include/crpropa/Geometry.h.func.html | 76 + .../include/crpropa/Geometry.h.gcov.html | 165 ++ .../include/crpropa/Grid.h.func-sort-c.html | 296 +++ .../include/crpropa/Grid.h.func.html | 296 +++ .../include/crpropa/Grid.h.gcov.html | 640 +++++ .../crpropa/Logging.h.func-sort-c.html | 96 + .../include/crpropa/Logging.h.func.html | 96 + .../include/crpropa/Logging.h.gcov.html | 111 + .../include/crpropa/Module.h.func-sort-c.html | 72 + .../include/crpropa/Module.h.func.html | 72 + .../include/crpropa/Module.h.gcov.html | 141 ++ .../crpropa/ParticleState.h.func-sort-c.html | 72 + .../include/crpropa/ParticleState.h.func.html | 72 + .../include/crpropa/ParticleState.h.gcov.html | 196 ++ .../PhotonBackground.h.func-sort-c.html | 148 ++ .../crpropa/PhotonBackground.h.func.html | 148 ++ .../crpropa/PhotonBackground.h.gcov.html | 398 ++++ .../include/crpropa/Random.h.func-sort-c.html | 72 + .../include/crpropa/Random.h.func.html | 72 + .../include/crpropa/Random.h.gcov.html | 317 +++ .../crpropa/Referenced.h.func-sort-c.html | 148 ++ .../include/crpropa/Referenced.h.func.html | 148 ++ .../include/crpropa/Referenced.h.gcov.html | 320 +++ .../include/crpropa/Source.h.func-sort-c.html | 76 + .../include/crpropa/Source.h.func.html | 76 + .../include/crpropa/Source.h.gcov.html | 1002 ++++++++ .../crpropa/Variant.h.func-sort-c.html | 136 ++ .../include/crpropa/Variant.h.func.html | 136 ++ .../include/crpropa/Variant.h.gcov.html | 410 ++++ .../crpropa/Vector3.h.func-sort-c.html | 236 ++ .../include/crpropa/Vector3.h.func.html | 236 ++ .../include/crpropa/Vector3.h.gcov.html | 516 ++++ .../AdvectionField.h.func-sort-c.html | 72 + .../advectionField/AdvectionField.h.func.html | 72 + .../advectionField/AdvectionField.h.gcov.html | 367 +++ .../crpropa/advectionField/index-sort-f.html | 93 + .../crpropa/advectionField/index-sort-l.html | 93 + .../include/crpropa/advectionField/index.html | 93 + .../include/crpropa/index-sort-f.html | 233 ++ .../include/crpropa/index-sort-l.html | 233 ++ doc/coverageReport/include/crpropa/index.html | 233 ++ .../GalacticMagneticField.h.func-sort-c.html | 88 + .../GalacticMagneticField.h.func.html | 88 + .../GalacticMagneticField.h.gcov.html | 210 ++ .../MagneticField.h.func-sort-c.html | 100 + .../magneticField/MagneticField.h.func.html | 100 + .../magneticField/MagneticField.h.gcov.html | 248 ++ .../MagneticFieldGrid.h.func-sort-c.html | 72 + .../MagneticFieldGrid.h.func.html | 72 + .../MagneticFieldGrid.h.gcov.html | 139 ++ .../crpropa/magneticField/index-sort-f.html | 113 + .../crpropa/magneticField/index-sort-l.html | 113 + .../include/crpropa/magneticField/index.html | 113 + .../GridTurbulence.h.func-sort-c.html | 72 + .../turbulentField/GridTurbulence.h.func.html | 72 + .../turbulentField/GridTurbulence.h.gcov.html | 151 ++ .../HelicalGridTurbulence.h.func-sort-c.html | 76 + .../HelicalGridTurbulence.h.func.html | 76 + .../HelicalGridTurbulence.h.gcov.html | 147 ++ .../SimpleGridTurbulence.h.func-sort-c.html | 100 + .../SimpleGridTurbulence.h.func.html | 100 + .../SimpleGridTurbulence.h.gcov.html | 192 ++ .../TurbulentField.h.func-sort-c.html | 108 + .../turbulentField/TurbulentField.h.func.html | 108 + .../turbulentField/TurbulentField.h.gcov.html | 195 ++ .../turbulentField/index-sort-f.html | 123 + .../turbulentField/index-sort-l.html | 123 + .../magneticField/turbulentField/index.html | 123 + .../MagneticLens.h.func-sort-c.html | 96 + .../magneticLens/MagneticLens.h.func.html | 96 + .../magneticLens/MagneticLens.h.gcov.html | 352 +++ .../ParticleMapsContainer.h.func-sort-c.html | 80 + .../ParticleMapsContainer.h.func.html | 80 + .../ParticleMapsContainer.h.gcov.html | 221 ++ .../Pixelization.h.func-sort-c.html | 84 + .../magneticLens/Pixelization.h.func.html | 84 + .../magneticLens/Pixelization.h.gcov.html | 217 ++ .../crpropa/magneticLens/index-sort-f.html | 113 + .../crpropa/magneticLens/index-sort-l.html | 113 + .../include/crpropa/magneticLens/index.html | 113 + .../Cordes.h.func-sort-c.html | 72 + .../massDistribution/Cordes.h.func.html | 72 + .../massDistribution/Cordes.h.gcov.html | 121 + .../Density.h.func-sort-c.html | 116 + .../massDistribution/Density.h.func.html | 116 + .../massDistribution/Density.h.gcov.html | 134 ++ .../Ferriere.h.func-sort-c.html | 72 + .../massDistribution/Ferriere.h.func.html | 72 + .../massDistribution/Ferriere.h.gcov.html | 153 ++ .../Massdistribution.h.func-sort-c.html | 72 + .../Massdistribution.h.func.html | 72 + .../Massdistribution.h.gcov.html | 212 ++ .../Nakanishi.h.func-sort-c.html | 72 + .../massDistribution/Nakanishi.h.func.html | 72 + .../massDistribution/Nakanishi.h.gcov.html | 150 ++ .../massDistribution/index-sort-f.html | 133 ++ .../massDistribution/index-sort-l.html | 133 ++ .../crpropa/massDistribution/index.html | 133 ++ .../module/Boundary.h.func-sort-c.html | 72 + .../crpropa/module/Boundary.h.func.html | 72 + .../crpropa/module/Boundary.h.gcov.html | 283 +++ .../module/BreakCondition.h.func-sort-c.html | 72 + .../crpropa/module/BreakCondition.h.func.html | 72 + .../crpropa/module/BreakCondition.h.gcov.html | 221 ++ .../module/HDF5Output.h.func-sort-c.html | 72 + .../crpropa/module/HDF5Output.h.func.html | 72 + .../crpropa/module/HDF5Output.h.gcov.html | 217 ++ .../module/NuclearDecay.h.func-sort-c.html | 72 + .../crpropa/module/NuclearDecay.h.func.html | 72 + .../crpropa/module/NuclearDecay.h.gcov.html | 163 ++ .../module/Observer.h.func-sort-c.html | 72 + .../crpropa/module/Observer.h.func.html | 72 + .../crpropa/module/Observer.h.gcov.html | 351 +++ .../module/OutputShell.h.func-sort-c.html | 72 + .../crpropa/module/OutputShell.h.func.html | 72 + .../crpropa/module/OutputShell.h.gcov.html | 124 + .../PhotoDisintegration.h.func-sort-c.html | 72 + .../module/PhotoDisintegration.h.func.html | 72 + .../module/PhotoDisintegration.h.gcov.html | 167 ++ .../module/PropagationBP.h.func-sort-c.html | 72 + .../crpropa/module/PropagationBP.h.func.html | 72 + .../crpropa/module/PropagationBP.h.gcov.html | 225 ++ .../module/PropagationCK.h.func-sort-c.html | 72 + .../crpropa/module/PropagationCK.h.func.html | 72 + .../crpropa/module/PropagationCK.h.gcov.html | 178 ++ .../module/Redshift.h.func-sort-c.html | 72 + .../crpropa/module/Redshift.h.func.html | 72 + .../crpropa/module/Redshift.h.gcov.html | 111 + .../SimplePropagation.h.func-sort-c.html | 72 + .../module/SimplePropagation.h.func.html | 72 + .../module/SimplePropagation.h.gcov.html | 115 + .../module/TextOutput.h.func-sort-c.html | 72 + .../crpropa/module/TextOutput.h.func.html | 72 + .../crpropa/module/TextOutput.h.gcov.html | 155 ++ .../crpropa/module/Tools.h.func-sort-c.html | 72 + .../include/crpropa/module/Tools.h.func.html | 72 + .../include/crpropa/module/Tools.h.gcov.html | 150 ++ .../include/crpropa/module/index-sort-f.html | 213 ++ .../include/crpropa/module/index-sort-l.html | 213 ++ .../include/crpropa/module/index.html | 213 ++ doc/coverageReport/index-sort-f.html | 293 +++ doc/coverageReport/index-sort-l.html | 293 +++ doc/coverageReport/index.html | 293 +++ .../src/ParticleIDMethods.cc.func-sort-c.html | 200 ++ .../HepPID/src/ParticleIDMethods.cc.func.html | 200 ++ .../HepPID/src/ParticleIDMethods.cc.gcov.html | 641 +++++ .../src/ParticleName.cc.func-sort-c.html | 124 + .../libs/HepPID/src/ParticleName.cc.func.html | 124 + .../libs/HepPID/src/ParticleName.cc.gcov.html | 2075 +++++++++++++++++ .../HepPID/src/Version.cc.func-sort-c.html | 84 + .../libs/HepPID/src/Version.cc.func.html | 84 + .../libs/HepPID/src/Version.cc.gcov.html | 106 + .../libs/HepPID/src/index-sort-f.html | 113 + .../libs/HepPID/src/index-sort-l.html | 113 + doc/coverageReport/libs/HepPID/src/index.html | 113 + .../error_handling.cc.func-sort-c.html | 100 + .../healpix_base/error_handling.cc.func.html | 100 + .../healpix_base/error_handling.cc.gcov.html | 136 ++ .../geom_utils.cc.func-sort-c.html | 84 + .../libs/healpix_base/geom_utils.cc.func.html | 84 + .../libs/healpix_base/geom_utils.cc.gcov.html | 151 ++ .../healpix_base.cc.func-sort-c.html | 436 ++++ .../healpix_base/healpix_base.cc.func.html | 436 ++++ .../healpix_base/healpix_base.cc.gcov.html | 1454 ++++++++++++ .../alloc_utils.h.func-sort-c.html | 96 + .../healpix_base/alloc_utils.h.func.html | 96 + .../healpix_base/alloc_utils.h.gcov.html | 154 ++ .../healpix_base/arr.h.func-sort-c.html | 76 + .../include/healpix_base/arr.h.func.html | 76 + .../include/healpix_base/arr.h.gcov.html | 734 ++++++ .../error_handling.h.func-sort-c.html | 76 + .../healpix_base/error_handling.h.func.html | 76 + .../healpix_base/error_handling.h.gcov.html | 180 ++ .../geom_utils.h.func-sort-c.html | 80 + .../healpix_base/geom_utils.h.func.html | 80 + .../healpix_base/geom_utils.h.gcov.html | 161 ++ .../healpix_base.h.func-sort-c.html | 208 ++ .../healpix_base/healpix_base.h.func.html | 208 ++ .../healpix_base/healpix_base.h.gcov.html | 457 ++++ .../include/healpix_base/index-sort-f.html | 173 ++ .../include/healpix_base/index-sort-l.html | 173 ++ .../include/healpix_base/index.html | 173 ++ .../math_utils.h.func-sort-c.html | 88 + .../healpix_base/math_utils.h.func.html | 88 + .../healpix_base/math_utils.h.gcov.html | 259 ++ .../healpix_base/pointing.h.func-sort-c.html | 72 + .../include/healpix_base/pointing.h.func.html | 72 + .../include/healpix_base/pointing.h.gcov.html | 161 ++ .../healpix_base/rangeset.h.func-sort-c.html | 120 + .../include/healpix_base/rangeset.h.func.html | 120 + .../include/healpix_base/rangeset.h.gcov.html | 363 +++ .../healpix_base/vec3.h.func-sort-c.html | 80 + .../include/healpix_base/vec3.h.func.html | 80 + .../include/healpix_base/vec3.h.gcov.html | 229 ++ .../libs/healpix_base/index-sort-f.html | 123 + .../libs/healpix_base/index-sort-l.html | 123 + .../libs/healpix_base/index.html | 123 + .../healpix_base/pointing.cc.func-sort-c.html | 92 + .../libs/healpix_base/pointing.cc.func.html | 92 + .../libs/healpix_base/pointing.cc.gcov.html | 148 ++ .../include/kiss/convert.h.func-sort-c.html | 76 + .../kiss/include/kiss/convert.h.func.html | 76 + .../kiss/include/kiss/convert.h.gcov.html | 150 ++ .../libs/kiss/include/kiss/index-sort-f.html | 103 + .../libs/kiss/include/kiss/index-sort-l.html | 103 + .../libs/kiss/include/kiss/index.html | 103 + .../include/kiss/logger.h.func-sort-c.html | 336 +++ .../libs/kiss/include/kiss/logger.h.func.html | 336 +++ .../libs/kiss/include/kiss/logger.h.gcov.html | 131 ++ .../libs/kiss/src/index-sort-f.html | 113 + .../libs/kiss/src/index-sort-l.html | 113 + doc/coverageReport/libs/kiss/src/index.html | 113 + .../libs/kiss/src/logger.cpp.func-sort-c.html | 104 + .../libs/kiss/src/logger.cpp.func.html | 104 + .../libs/kiss/src/logger.cpp.gcov.html | 161 ++ .../libs/kiss/src/path.cpp.func-sort-c.html | 104 + .../libs/kiss/src/path.cpp.func.html | 104 + .../libs/kiss/src/path.cpp.gcov.html | 245 ++ .../libs/kiss/src/string.cpp.func-sort-c.html | 100 + .../libs/kiss/src/string.cpp.func.html | 100 + .../libs/kiss/src/string.cpp.gcov.html | 165 ++ doc/coverageReport/ruby.png | Bin 0 -> 141 bytes doc/coverageReport/snow.png | Bin 0 -> 141 bytes .../src/Candidate.cpp.func-sort-c.html | 212 ++ .../src/Candidate.cpp.func.html | 212 ++ .../src/Candidate.cpp.gcov.html | 331 +++ .../src/Clock.cpp.func-sort-c.html | 104 + doc/coverageReport/src/Clock.cpp.func.html | 104 + doc/coverageReport/src/Clock.cpp.gcov.html | 231 ++ .../src/Common.cpp.func-sort-c.html | 96 + doc/coverageReport/src/Common.cpp.func.html | 96 + doc/coverageReport/src/Common.cpp.gcov.html | 212 ++ .../src/Cosmology.cpp.func-sort-c.html | 132 ++ .../src/Cosmology.cpp.func.html | 132 ++ .../src/Cosmology.cpp.gcov.html | 245 ++ .../src/EmissionMap.cpp.func-sort-c.html | 204 ++ .../src/EmissionMap.cpp.func.html | 204 ++ .../src/EmissionMap.cpp.gcov.html | 370 +++ .../src/Geometry.cpp.func-sort-c.html | 124 + doc/coverageReport/src/Geometry.cpp.func.html | 124 + doc/coverageReport/src/Geometry.cpp.gcov.html | 200 ++ .../src/GridTools.cpp.func-sort-c.html | 148 ++ .../src/GridTools.cpp.func.html | 148 ++ .../src/GridTools.cpp.gcov.html | 491 ++++ .../src/Module.cpp.func-sort-c.html | 120 + doc/coverageReport/src/Module.cpp.func.html | 120 + doc/coverageReport/src/Module.cpp.gcov.html | 156 ++ .../src/ParticleID.cpp.func-sort-c.html | 92 + .../src/ParticleID.cpp.func.html | 92 + .../src/ParticleID.cpp.gcov.html | 130 ++ .../src/ParticleMass.cpp.func-sort-c.html | 88 + .../src/ParticleMass.cpp.func.html | 88 + .../src/ParticleMass.cpp.gcov.html | 150 ++ .../src/ParticleState.cpp.func-sort-c.html | 140 ++ .../src/ParticleState.cpp.func.html | 140 ++ .../src/ParticleState.cpp.gcov.html | 178 ++ .../src/PhotonBackground.cpp.func-sort-c.html | 132 ++ .../src/PhotonBackground.cpp.func.html | 132 ++ .../src/PhotonBackground.cpp.gcov.html | 291 +++ .../src/ProgressBar.cpp.func-sort-c.html | 92 + .../src/ProgressBar.cpp.func.html | 92 + .../src/ProgressBar.cpp.gcov.html | 153 ++ .../src/Random.cpp.func-sort-c.html | 256 ++ doc/coverageReport/src/Random.cpp.func.html | 256 ++ doc/coverageReport/src/Random.cpp.gcov.html | 605 +++++ .../src/Source.cpp.func-sort-c.html | 656 ++++++ doc/coverageReport/src/Source.cpp.func.html | 656 ++++++ doc/coverageReport/src/Source.cpp.gcov.html | 1218 ++++++++++ .../src/Variant.cpp.func-sort-c.html | 264 +++ doc/coverageReport/src/Variant.cpp.func.html | 264 +++ doc/coverageReport/src/Variant.cpp.gcov.html | 1200 ++++++++++ .../AdvectionField.cpp.func-sort-c.html | 408 ++++ .../AdvectionField.cpp.func.html | 408 ++++ .../AdvectionField.cpp.gcov.html | 610 +++++ .../src/advectionField/index-sort-f.html | 93 + .../src/advectionField/index-sort-l.html | 93 + .../src/advectionField/index.html | 93 + .../src/base64.cpp.func-sort-c.html | 80 + doc/coverageReport/src/base64.cpp.func.html | 80 + doc/coverageReport/src/base64.cpp.gcov.html | 205 ++ doc/coverageReport/src/index-sort-f.html | 253 ++ doc/coverageReport/src/index-sort-l.html | 253 ++ doc/coverageReport/src/index.html | 253 ++ ...rchimedeanSpiralField.cpp.func-sort-c.html | 112 + .../ArchimedeanSpiralField.cpp.func.html | 112 + .../ArchimedeanSpiralField.cpp.gcov.html | 162 ++ .../CMZField.cpp.func-sort-c.html | 144 ++ .../src/magneticField/CMZField.cpp.func.html | 144 ++ .../src/magneticField/CMZField.cpp.gcov.html | 382 +++ .../JF12Field.cpp.func-sort-c.html | 188 ++ .../src/magneticField/JF12Field.cpp.func.html | 188 ++ .../src/magneticField/JF12Field.cpp.gcov.html | 452 ++++ .../JF12FieldSolenoidal.cpp.func-sort-c.html | 128 + .../JF12FieldSolenoidal.cpp.func.html | 128 + .../JF12FieldSolenoidal.cpp.gcov.html | 378 +++ .../MagneticField.cpp.func-sort-c.html | 136 ++ .../magneticField/MagneticField.cpp.func.html | 136 ++ .../magneticField/MagneticField.cpp.gcov.html | 188 ++ .../MagneticFieldGrid.cpp.func-sort-c.html | 116 + .../MagneticFieldGrid.cpp.func.html | 116 + .../MagneticFieldGrid.cpp.gcov.html | 133 ++ .../PT11Field.cpp.func-sort-c.html | 108 + .../src/magneticField/PT11Field.cpp.func.html | 108 + .../src/magneticField/PT11Field.cpp.gcov.html | 206 ++ ...ngleModeMagneticField.cpp.func-sort-c.html | 80 + ...rizedSingleModeMagneticField.cpp.func.html | 80 + ...rizedSingleModeMagneticField.cpp.gcov.html | 142 ++ .../TF17Field.cpp.func-sort-c.html | 188 ++ .../src/magneticField/TF17Field.cpp.func.html | 188 ++ .../src/magneticField/TF17Field.cpp.gcov.html | 383 +++ .../src/magneticField/index-sort-f.html | 173 ++ .../src/magneticField/index-sort-l.html | 173 ++ .../src/magneticField/index.html | 173 ++ .../GridTurbulence.cpp.func-sort-c.html | 124 + .../GridTurbulence.cpp.func.html | 124 + .../GridTurbulence.cpp.gcov.html | 289 +++ ...HelicalGridTurbulence.cpp.func-sort-c.html | 80 + .../HelicalGridTurbulence.cpp.func.html | 80 + .../HelicalGridTurbulence.cpp.gcov.html | 206 ++ .../PlaneWaveTurbulence.cpp.func-sort-c.html | 80 + .../PlaneWaveTurbulence.cpp.func.html | 80 + .../PlaneWaveTurbulence.cpp.gcov.html | 517 ++++ .../SimpleGridTurbulence.cpp.func-sort-c.html | 80 + .../SimpleGridTurbulence.cpp.func.html | 80 + .../SimpleGridTurbulence.cpp.gcov.html | 193 ++ .../turbulentField/index-sort-f.html | 123 + .../turbulentField/index-sort-l.html | 123 + .../magneticField/turbulentField/index.html | 123 + .../MagneticLens.cpp.func-sort-c.html | 124 + .../magneticLens/MagneticLens.cpp.func.html | 124 + .../magneticLens/MagneticLens.cpp.gcov.html | 353 +++ .../ModelMatrix.cpp.func-sort-c.html | 100 + .../magneticLens/ModelMatrix.cpp.func.html | 100 + .../magneticLens/ModelMatrix.cpp.gcov.html | 237 ++ ...ParticleMapsContainer.cpp.func-sort-c.html | 124 + .../ParticleMapsContainer.cpp.func.html | 124 + .../ParticleMapsContainer.cpp.gcov.html | 275 +++ .../Pixelization.cpp.func-sort-c.html | 104 + .../magneticLens/Pixelization.cpp.func.html | 104 + .../magneticLens/Pixelization.cpp.gcov.html | 205 ++ .../src/magneticLens/index-sort-f.html | 123 + .../src/magneticLens/index-sort-l.html | 123 + .../src/magneticLens/index.html | 123 + .../ConstantDensity.cpp.func-sort-c.html | 148 ++ .../ConstantDensity.cpp.func.html | 148 ++ .../ConstantDensity.cpp.gcov.html | 213 ++ .../Cordes.cpp.func-sort-c.html | 100 + .../src/massDistribution/Cordes.cpp.func.html | 100 + .../src/massDistribution/Cordes.cpp.gcov.html | 122 + .../Ferriere.cpp.func-sort-c.html | 128 + .../massDistribution/Ferriere.cpp.func.html | 128 + .../massDistribution/Ferriere.cpp.gcov.html | 349 +++ .../Massdistribution.cpp.func-sort-c.html | 160 ++ .../Massdistribution.cpp.func.html | 160 ++ .../Massdistribution.cpp.gcov.html | 222 ++ .../Nakanishi.cpp.func-sort-c.html | 128 + .../massDistribution/Nakanishi.cpp.func.html | 128 + .../massDistribution/Nakanishi.cpp.gcov.html | 195 ++ .../src/massDistribution/index-sort-f.html | 133 ++ .../src/massDistribution/index-sort-l.html | 133 ++ .../src/massDistribution/index.html | 133 ++ .../module/Acceleration.cpp.func-sort-c.html | 128 + .../src/module/Acceleration.cpp.func.html | 128 + .../src/module/Acceleration.cpp.gcov.html | 260 +++ .../AdiabaticCooling.cpp.func-sort-c.html | 92 + .../src/module/AdiabaticCooling.cpp.func.html | 92 + .../src/module/AdiabaticCooling.cpp.gcov.html | 130 ++ .../src/module/Boundary.cpp.func-sort-c.html | 252 ++ .../src/module/Boundary.cpp.func.html | 252 ++ .../src/module/Boundary.cpp.gcov.html | 370 +++ .../BreakCondition.cpp.func-sort-c.html | 224 ++ .../src/module/BreakCondition.cpp.func.html | 224 ++ .../src/module/BreakCondition.cpp.gcov.html | 343 +++ .../CandidateSplitting.cpp.func-sort-c.html | 116 + .../module/CandidateSplitting.cpp.func.html | 116 + .../module/CandidateSplitting.cpp.gcov.html | 194 ++ .../module/DiffusionSDE.cpp.func-sort-c.html | 172 ++ .../src/module/DiffusionSDE.cpp.func.html | 172 ++ .../src/module/DiffusionSDE.cpp.gcov.html | 480 ++++ ...MDoublePairProduction.cpp.func-sort-c.html | 112 + .../EMDoublePairProduction.cpp.func.html | 112 + .../EMDoublePairProduction.cpp.gcov.html | 209 ++ ...erseComptonScattering.cpp.func-sort-c.html | 124 + .../EMInverseComptonScattering.cpp.func.html | 124 + .../EMInverseComptonScattering.cpp.gcov.html | 325 +++ .../EMPairProduction.cpp.func-sort-c.html | 124 + .../src/module/EMPairProduction.cpp.func.html | 124 + .../src/module/EMPairProduction.cpp.gcov.html | 340 +++ ...TripletPairProduction.cpp.func-sort-c.html | 116 + .../EMTripletPairProduction.cpp.func.html | 116 + .../EMTripletPairProduction.cpp.gcov.html | 263 +++ .../ElasticScattering.cpp.func-sort-c.html | 100 + .../module/ElasticScattering.cpp.func.html | 100 + .../module/ElasticScattering.cpp.gcov.html | 212 ++ ...lectronPairProduction.cpp.func-sort-c.html | 112 + .../ElectronPairProduction.cpp.func.html | 112 + .../ElectronPairProduction.cpp.gcov.html | 233 ++ .../module/HDF5Output.cpp.func-sort-c.html | 128 + .../src/module/HDF5Output.cpp.func.html | 128 + .../src/module/HDF5Output.cpp.gcov.html | 468 ++++ .../MomentumDiffusion.cpp.func-sort-c.html | 112 + .../module/MomentumDiffusion.cpp.func.html | 112 + .../module/MomentumDiffusion.cpp.gcov.html | 147 ++ .../module/NuclearDecay.cpp.func-sort-c.html | 124 + .../src/module/NuclearDecay.cpp.func.html | 124 + .../src/module/NuclearDecay.cpp.gcov.html | 395 ++++ .../src/module/Observer.cpp.func-sort-c.html | 248 ++ .../src/module/Observer.cpp.func.html | 248 ++ .../src/module/Observer.cpp.gcov.html | 427 ++++ .../src/module/Output.cpp.func-sort-c.html | 136 ++ .../src/module/Output.cpp.func.html | 136 ++ .../src/module/Output.cpp.gcov.html | 210 ++ .../module/OutputShell.cpp.func-sort-c.html | 96 + .../src/module/OutputShell.cpp.func.html | 96 + .../src/module/OutputShell.cpp.gcov.html | 134 ++ .../ParticleCollector.cpp.func-sort-c.html | 168 ++ .../module/ParticleCollector.cpp.func.html | 168 ++ .../module/ParticleCollector.cpp.gcov.html | 194 ++ .../PhotoDisintegration.cpp.func-sort-c.html | 120 + .../module/PhotoDisintegration.cpp.func.html | 120 + .../module/PhotoDisintegration.cpp.gcov.html | 406 ++++ .../PhotoPionProduction.cpp.func-sort-c.html | 232 ++ .../module/PhotoPionProduction.cpp.func.html | 232 ++ .../module/PhotoPionProduction.cpp.gcov.html | 758 ++++++ .../PhotonOutput1D.cpp.func-sort-c.html | 108 + .../src/module/PhotonOutput1D.cpp.func.html | 108 + .../src/module/PhotonOutput1D.cpp.gcov.html | 180 ++ .../module/PropagationBP.cpp.func-sort-c.html | 136 ++ .../src/module/PropagationBP.cpp.func.html | 136 ++ .../src/module/PropagationBP.cpp.gcov.html | 285 +++ .../module/PropagationCK.cpp.func-sort-c.html | 128 + .../src/module/PropagationCK.cpp.func.html | 128 + .../src/module/PropagationCK.cpp.gcov.html | 278 +++ .../src/module/Redshift.cpp.func-sort-c.html | 88 + .../src/module/Redshift.cpp.func.html | 88 + .../src/module/Redshift.cpp.gcov.html | 138 ++ .../RestrictToRegion.cpp.func-sort-c.html | 84 + .../src/module/RestrictToRegion.cpp.func.html | 84 + .../src/module/RestrictToRegion.cpp.gcov.html | 101 + .../SimplePropagation.cpp.func-sort-c.html | 100 + .../module/SimplePropagation.cpp.func.html | 100 + .../module/SimplePropagation.cpp.gcov.html | 128 + .../SynchrotronRadiation.cpp.func-sort-c.html | 156 ++ .../module/SynchrotronRadiation.cpp.func.html | 156 ++ .../module/SynchrotronRadiation.cpp.gcov.html | 306 +++ .../module/TextOutput.cpp.func-sort-c.html | 128 + .../src/module/TextOutput.cpp.func.html | 128 + .../src/module/TextOutput.cpp.gcov.html | 457 ++++ .../src/module/Tools.cpp.func-sort-c.html | 136 ++ .../src/module/Tools.cpp.func.html | 136 ++ .../src/module/Tools.cpp.gcov.html | 199 ++ .../src/module/index-sort-f.html | 383 +++ .../src/module/index-sort-l.html | 383 +++ doc/coverageReport/src/module/index.html | 383 +++ doc/coverageReport/test/index-sort-f.html | 243 ++ doc/coverageReport/test/index-sort-l.html | 243 ++ doc/coverageReport/test/index.html | 243 ++ .../testAdiabaticCooling.cpp.func-sort-c.html | 80 + .../test/testAdiabaticCooling.cpp.func.html | 80 + .../test/testAdiabaticCooling.cpp.gcov.html | 131 ++ .../testAdvectionField.cpp.func-sort-c.html | 92 + .../test/testAdvectionField.cpp.func.html | 92 + .../test/testAdvectionField.cpp.gcov.html | 245 ++ .../testBreakCondition.cpp.func-sort-c.html | 196 ++ .../test/testBreakCondition.cpp.func.html | 196 ++ .../test/testBreakCondition.cpp.gcov.html | 621 +++++ ...estCandidateSplitting.cpp.func-sort-c.html | 80 + .../test/testCandidateSplitting.cpp.func.html | 80 + .../test/testCandidateSplitting.cpp.gcov.html | 166 ++ .../test/testCore.cpp.func-sort-c.html | 308 +++ .../test/testCore.cpp.func.html | 308 +++ .../test/testCore.cpp.gcov.html | 1144 +++++++++ .../test/testDensity.cpp.func-sort-c.html | 100 + .../test/testDensity.cpp.func.html | 100 + .../test/testDensity.cpp.gcov.html | 372 +++ .../testFunctionalGroups.cpp.func-sort-c.html | 80 + .../test/testFunctionalGroups.cpp.func.html | 80 + .../test/testFunctionalGroups.cpp.gcov.html | 126 + .../test/testInteraction.cpp.func-sort-c.html | 284 +++ .../test/testInteraction.cpp.func.html | 284 +++ .../test/testInteraction.cpp.gcov.html | 1229 ++++++++++ .../testMagneticField.cpp.func-sort-c.html | 136 ++ .../test/testMagneticField.cpp.func.html | 136 ++ .../test/testMagneticField.cpp.gcov.html | 292 +++ .../testMagneticLens.cpp.func-sort-c.html | 100 + .../test/testMagneticLens.cpp.func.html | 100 + .../test/testMagneticLens.cpp.gcov.html | 248 ++ .../test/testModuleList.cpp.func-sort-c.html | 100 + .../test/testModuleList.cpp.func.html | 100 + .../test/testModuleList.cpp.gcov.html | 155 ++ .../test/testOutput.cpp.func-sort-c.html | 144 ++ .../test/testOutput.cpp.func.html | 144 ++ .../test/testOutput.cpp.gcov.html | 355 +++ .../test/testPropagation.cpp.func-sort-c.html | 148 ++ .../test/testPropagation.cpp.func.html | 148 ++ .../test/testPropagation.cpp.gcov.html | 632 +++++ .../test/testSource.cpp.func-sort-c.html | 168 ++ .../test/testSource.cpp.func.html | 168 ++ .../test/testSource.cpp.gcov.html | 516 ++++ .../testTurbulentField.cpp.func-sort-c.html | 104 + .../test/testTurbulentField.cpp.func.html | 104 + .../test/testTurbulentField.cpp.gcov.html | 218 ++ .../test/testVector3.cpp.func-sort-c.html | 124 + .../test/testVector3.cpp.func.html | 124 + .../test/testVector3.cpp.gcov.html | 238 ++ doc/coverageReport/updown.png | Bin 0 -> 117 bytes doc/pages/Code-Coverage.md | 7 + 536 files changed, 101307 insertions(+) create mode 100644 doc/coverageReport/amber.png create mode 100644 doc/coverageReport/emerald.png create mode 100644 doc/coverageReport/gcov.css create mode 100644 doc/coverageReport/glass.png create mode 100644 doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h.func-sort-c.html create mode 100644 doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h.func.html create mode 100644 doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h.gcov.html create mode 100644 doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h.func-sort-c.html create mode 100644 doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h.func.html create mode 100644 doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h.gcov.html create mode 100644 doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/index-sort-f.html create mode 100644 doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/index-sort-l.html create mode 100644 doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/index.html create mode 100644 doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h.func-sort-c.html create mode 100644 doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h.func.html create mode 100644 doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/AssocVector.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/AssocVector.h.func.html create mode 100644 doc/coverageReport/include/crpropa/AssocVector.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/Candidate.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/Candidate.h.func.html create mode 100644 doc/coverageReport/include/crpropa/Candidate.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/Common.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/Common.h.func.html create mode 100644 doc/coverageReport/include/crpropa/Common.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/EmissionMap.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/EmissionMap.h.func.html create mode 100644 doc/coverageReport/include/crpropa/EmissionMap.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/Geometry.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/Geometry.h.func.html create mode 100644 doc/coverageReport/include/crpropa/Geometry.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/Grid.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/Grid.h.func.html create mode 100644 doc/coverageReport/include/crpropa/Grid.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/Logging.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/Logging.h.func.html create mode 100644 doc/coverageReport/include/crpropa/Logging.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/Module.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/Module.h.func.html create mode 100644 doc/coverageReport/include/crpropa/Module.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/ParticleState.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/ParticleState.h.func.html create mode 100644 doc/coverageReport/include/crpropa/ParticleState.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/PhotonBackground.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/PhotonBackground.h.func.html create mode 100644 doc/coverageReport/include/crpropa/PhotonBackground.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/Random.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/Random.h.func.html create mode 100644 doc/coverageReport/include/crpropa/Random.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/Referenced.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/Referenced.h.func.html create mode 100644 doc/coverageReport/include/crpropa/Referenced.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/Source.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/Source.h.func.html create mode 100644 doc/coverageReport/include/crpropa/Source.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/Variant.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/Variant.h.func.html create mode 100644 doc/coverageReport/include/crpropa/Variant.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/Vector3.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/Vector3.h.func.html create mode 100644 doc/coverageReport/include/crpropa/Vector3.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/advectionField/AdvectionField.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/advectionField/AdvectionField.h.func.html create mode 100644 doc/coverageReport/include/crpropa/advectionField/AdvectionField.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/advectionField/index-sort-f.html create mode 100644 doc/coverageReport/include/crpropa/advectionField/index-sort-l.html create mode 100644 doc/coverageReport/include/crpropa/advectionField/index.html create mode 100644 doc/coverageReport/include/crpropa/index-sort-f.html create mode 100644 doc/coverageReport/include/crpropa/index-sort-l.html create mode 100644 doc/coverageReport/include/crpropa/index.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/GalacticMagneticField.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/GalacticMagneticField.h.func.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/GalacticMagneticField.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/MagneticField.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/MagneticField.h.func.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/MagneticField.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/MagneticFieldGrid.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/MagneticFieldGrid.h.func.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/MagneticFieldGrid.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/index-sort-f.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/index-sort-l.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/index.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/GridTurbulence.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/GridTurbulence.h.func.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/GridTurbulence.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h.func.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h.func.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/TurbulentField.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/TurbulentField.h.func.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/TurbulentField.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/index-sort-f.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/index-sort-l.html create mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/index.html create mode 100644 doc/coverageReport/include/crpropa/magneticLens/MagneticLens.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/magneticLens/MagneticLens.h.func.html create mode 100644 doc/coverageReport/include/crpropa/magneticLens/MagneticLens.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/magneticLens/ParticleMapsContainer.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/magneticLens/ParticleMapsContainer.h.func.html create mode 100644 doc/coverageReport/include/crpropa/magneticLens/ParticleMapsContainer.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/magneticLens/Pixelization.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/magneticLens/Pixelization.h.func.html create mode 100644 doc/coverageReport/include/crpropa/magneticLens/Pixelization.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/magneticLens/index-sort-f.html create mode 100644 doc/coverageReport/include/crpropa/magneticLens/index-sort-l.html create mode 100644 doc/coverageReport/include/crpropa/magneticLens/index.html create mode 100644 doc/coverageReport/include/crpropa/massDistribution/Cordes.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/massDistribution/Cordes.h.func.html create mode 100644 doc/coverageReport/include/crpropa/massDistribution/Cordes.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/massDistribution/Density.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/massDistribution/Density.h.func.html create mode 100644 doc/coverageReport/include/crpropa/massDistribution/Density.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/massDistribution/Ferriere.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/massDistribution/Ferriere.h.func.html create mode 100644 doc/coverageReport/include/crpropa/massDistribution/Ferriere.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/massDistribution/Massdistribution.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/massDistribution/Massdistribution.h.func.html create mode 100644 doc/coverageReport/include/crpropa/massDistribution/Massdistribution.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/massDistribution/Nakanishi.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/massDistribution/Nakanishi.h.func.html create mode 100644 doc/coverageReport/include/crpropa/massDistribution/Nakanishi.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/massDistribution/index-sort-f.html create mode 100644 doc/coverageReport/include/crpropa/massDistribution/index-sort-l.html create mode 100644 doc/coverageReport/include/crpropa/massDistribution/index.html create mode 100644 doc/coverageReport/include/crpropa/module/Boundary.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/module/Boundary.h.func.html create mode 100644 doc/coverageReport/include/crpropa/module/Boundary.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/module/BreakCondition.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/module/BreakCondition.h.func.html create mode 100644 doc/coverageReport/include/crpropa/module/BreakCondition.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/module/HDF5Output.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/module/HDF5Output.h.func.html create mode 100644 doc/coverageReport/include/crpropa/module/HDF5Output.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/module/NuclearDecay.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/module/NuclearDecay.h.func.html create mode 100644 doc/coverageReport/include/crpropa/module/NuclearDecay.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/module/Observer.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/module/Observer.h.func.html create mode 100644 doc/coverageReport/include/crpropa/module/Observer.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/module/OutputShell.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/module/OutputShell.h.func.html create mode 100644 doc/coverageReport/include/crpropa/module/OutputShell.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/module/PhotoDisintegration.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/module/PhotoDisintegration.h.func.html create mode 100644 doc/coverageReport/include/crpropa/module/PhotoDisintegration.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/module/PropagationBP.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/module/PropagationBP.h.func.html create mode 100644 doc/coverageReport/include/crpropa/module/PropagationBP.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/module/PropagationCK.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/module/PropagationCK.h.func.html create mode 100644 doc/coverageReport/include/crpropa/module/PropagationCK.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/module/Redshift.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/module/Redshift.h.func.html create mode 100644 doc/coverageReport/include/crpropa/module/Redshift.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/module/SimplePropagation.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/module/SimplePropagation.h.func.html create mode 100644 doc/coverageReport/include/crpropa/module/SimplePropagation.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/module/TextOutput.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/module/TextOutput.h.func.html create mode 100644 doc/coverageReport/include/crpropa/module/TextOutput.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/module/Tools.h.func-sort-c.html create mode 100644 doc/coverageReport/include/crpropa/module/Tools.h.func.html create mode 100644 doc/coverageReport/include/crpropa/module/Tools.h.gcov.html create mode 100644 doc/coverageReport/include/crpropa/module/index-sort-f.html create mode 100644 doc/coverageReport/include/crpropa/module/index-sort-l.html create mode 100644 doc/coverageReport/include/crpropa/module/index.html create mode 100644 doc/coverageReport/index-sort-f.html create mode 100644 doc/coverageReport/index-sort-l.html create mode 100644 doc/coverageReport/index.html create mode 100644 doc/coverageReport/libs/HepPID/src/ParticleIDMethods.cc.func-sort-c.html create mode 100644 doc/coverageReport/libs/HepPID/src/ParticleIDMethods.cc.func.html create mode 100644 doc/coverageReport/libs/HepPID/src/ParticleIDMethods.cc.gcov.html create mode 100644 doc/coverageReport/libs/HepPID/src/ParticleName.cc.func-sort-c.html create mode 100644 doc/coverageReport/libs/HepPID/src/ParticleName.cc.func.html create mode 100644 doc/coverageReport/libs/HepPID/src/ParticleName.cc.gcov.html create mode 100644 doc/coverageReport/libs/HepPID/src/Version.cc.func-sort-c.html create mode 100644 doc/coverageReport/libs/HepPID/src/Version.cc.func.html create mode 100644 doc/coverageReport/libs/HepPID/src/Version.cc.gcov.html create mode 100644 doc/coverageReport/libs/HepPID/src/index-sort-f.html create mode 100644 doc/coverageReport/libs/HepPID/src/index-sort-l.html create mode 100644 doc/coverageReport/libs/HepPID/src/index.html create mode 100644 doc/coverageReport/libs/healpix_base/error_handling.cc.func-sort-c.html create mode 100644 doc/coverageReport/libs/healpix_base/error_handling.cc.func.html create mode 100644 doc/coverageReport/libs/healpix_base/error_handling.cc.gcov.html create mode 100644 doc/coverageReport/libs/healpix_base/geom_utils.cc.func-sort-c.html create mode 100644 doc/coverageReport/libs/healpix_base/geom_utils.cc.func.html create mode 100644 doc/coverageReport/libs/healpix_base/geom_utils.cc.gcov.html create mode 100644 doc/coverageReport/libs/healpix_base/healpix_base.cc.func-sort-c.html create mode 100644 doc/coverageReport/libs/healpix_base/healpix_base.cc.func.html create mode 100644 doc/coverageReport/libs/healpix_base/healpix_base.cc.gcov.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/alloc_utils.h.func-sort-c.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/alloc_utils.h.func.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/alloc_utils.h.gcov.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/arr.h.func-sort-c.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/arr.h.func.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/arr.h.gcov.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/error_handling.h.func-sort-c.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/error_handling.h.func.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/error_handling.h.gcov.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/geom_utils.h.func-sort-c.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/geom_utils.h.func.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/geom_utils.h.gcov.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/healpix_base.h.func-sort-c.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/healpix_base.h.func.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/healpix_base.h.gcov.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/index-sort-f.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/index-sort-l.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/index.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/math_utils.h.func-sort-c.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/math_utils.h.func.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/math_utils.h.gcov.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/pointing.h.func-sort-c.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/pointing.h.func.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/pointing.h.gcov.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/rangeset.h.func-sort-c.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/rangeset.h.func.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/rangeset.h.gcov.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/vec3.h.func-sort-c.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/vec3.h.func.html create mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/vec3.h.gcov.html create mode 100644 doc/coverageReport/libs/healpix_base/index-sort-f.html create mode 100644 doc/coverageReport/libs/healpix_base/index-sort-l.html create mode 100644 doc/coverageReport/libs/healpix_base/index.html create mode 100644 doc/coverageReport/libs/healpix_base/pointing.cc.func-sort-c.html create mode 100644 doc/coverageReport/libs/healpix_base/pointing.cc.func.html create mode 100644 doc/coverageReport/libs/healpix_base/pointing.cc.gcov.html create mode 100644 doc/coverageReport/libs/kiss/include/kiss/convert.h.func-sort-c.html create mode 100644 doc/coverageReport/libs/kiss/include/kiss/convert.h.func.html create mode 100644 doc/coverageReport/libs/kiss/include/kiss/convert.h.gcov.html create mode 100644 doc/coverageReport/libs/kiss/include/kiss/index-sort-f.html create mode 100644 doc/coverageReport/libs/kiss/include/kiss/index-sort-l.html create mode 100644 doc/coverageReport/libs/kiss/include/kiss/index.html create mode 100644 doc/coverageReport/libs/kiss/include/kiss/logger.h.func-sort-c.html create mode 100644 doc/coverageReport/libs/kiss/include/kiss/logger.h.func.html create mode 100644 doc/coverageReport/libs/kiss/include/kiss/logger.h.gcov.html create mode 100644 doc/coverageReport/libs/kiss/src/index-sort-f.html create mode 100644 doc/coverageReport/libs/kiss/src/index-sort-l.html create mode 100644 doc/coverageReport/libs/kiss/src/index.html create mode 100644 doc/coverageReport/libs/kiss/src/logger.cpp.func-sort-c.html create mode 100644 doc/coverageReport/libs/kiss/src/logger.cpp.func.html create mode 100644 doc/coverageReport/libs/kiss/src/logger.cpp.gcov.html create mode 100644 doc/coverageReport/libs/kiss/src/path.cpp.func-sort-c.html create mode 100644 doc/coverageReport/libs/kiss/src/path.cpp.func.html create mode 100644 doc/coverageReport/libs/kiss/src/path.cpp.gcov.html create mode 100644 doc/coverageReport/libs/kiss/src/string.cpp.func-sort-c.html create mode 100644 doc/coverageReport/libs/kiss/src/string.cpp.func.html create mode 100644 doc/coverageReport/libs/kiss/src/string.cpp.gcov.html create mode 100644 doc/coverageReport/ruby.png create mode 100644 doc/coverageReport/snow.png create mode 100644 doc/coverageReport/src/Candidate.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/Candidate.cpp.func.html create mode 100644 doc/coverageReport/src/Candidate.cpp.gcov.html create mode 100644 doc/coverageReport/src/Clock.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/Clock.cpp.func.html create mode 100644 doc/coverageReport/src/Clock.cpp.gcov.html create mode 100644 doc/coverageReport/src/Common.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/Common.cpp.func.html create mode 100644 doc/coverageReport/src/Common.cpp.gcov.html create mode 100644 doc/coverageReport/src/Cosmology.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/Cosmology.cpp.func.html create mode 100644 doc/coverageReport/src/Cosmology.cpp.gcov.html create mode 100644 doc/coverageReport/src/EmissionMap.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/EmissionMap.cpp.func.html create mode 100644 doc/coverageReport/src/EmissionMap.cpp.gcov.html create mode 100644 doc/coverageReport/src/Geometry.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/Geometry.cpp.func.html create mode 100644 doc/coverageReport/src/Geometry.cpp.gcov.html create mode 100644 doc/coverageReport/src/GridTools.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/GridTools.cpp.func.html create mode 100644 doc/coverageReport/src/GridTools.cpp.gcov.html create mode 100644 doc/coverageReport/src/Module.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/Module.cpp.func.html create mode 100644 doc/coverageReport/src/Module.cpp.gcov.html create mode 100644 doc/coverageReport/src/ParticleID.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/ParticleID.cpp.func.html create mode 100644 doc/coverageReport/src/ParticleID.cpp.gcov.html create mode 100644 doc/coverageReport/src/ParticleMass.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/ParticleMass.cpp.func.html create mode 100644 doc/coverageReport/src/ParticleMass.cpp.gcov.html create mode 100644 doc/coverageReport/src/ParticleState.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/ParticleState.cpp.func.html create mode 100644 doc/coverageReport/src/ParticleState.cpp.gcov.html create mode 100644 doc/coverageReport/src/PhotonBackground.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/PhotonBackground.cpp.func.html create mode 100644 doc/coverageReport/src/PhotonBackground.cpp.gcov.html create mode 100644 doc/coverageReport/src/ProgressBar.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/ProgressBar.cpp.func.html create mode 100644 doc/coverageReport/src/ProgressBar.cpp.gcov.html create mode 100644 doc/coverageReport/src/Random.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/Random.cpp.func.html create mode 100644 doc/coverageReport/src/Random.cpp.gcov.html create mode 100644 doc/coverageReport/src/Source.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/Source.cpp.func.html create mode 100644 doc/coverageReport/src/Source.cpp.gcov.html create mode 100644 doc/coverageReport/src/Variant.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/Variant.cpp.func.html create mode 100644 doc/coverageReport/src/Variant.cpp.gcov.html create mode 100644 doc/coverageReport/src/advectionField/AdvectionField.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/advectionField/AdvectionField.cpp.func.html create mode 100644 doc/coverageReport/src/advectionField/AdvectionField.cpp.gcov.html create mode 100644 doc/coverageReport/src/advectionField/index-sort-f.html create mode 100644 doc/coverageReport/src/advectionField/index-sort-l.html create mode 100644 doc/coverageReport/src/advectionField/index.html create mode 100644 doc/coverageReport/src/base64.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/base64.cpp.func.html create mode 100644 doc/coverageReport/src/base64.cpp.gcov.html create mode 100644 doc/coverageReport/src/index-sort-f.html create mode 100644 doc/coverageReport/src/index-sort-l.html create mode 100644 doc/coverageReport/src/index.html create mode 100644 doc/coverageReport/src/magneticField/ArchimedeanSpiralField.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/magneticField/ArchimedeanSpiralField.cpp.func.html create mode 100644 doc/coverageReport/src/magneticField/ArchimedeanSpiralField.cpp.gcov.html create mode 100644 doc/coverageReport/src/magneticField/CMZField.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/magneticField/CMZField.cpp.func.html create mode 100644 doc/coverageReport/src/magneticField/CMZField.cpp.gcov.html create mode 100644 doc/coverageReport/src/magneticField/JF12Field.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/magneticField/JF12Field.cpp.func.html create mode 100644 doc/coverageReport/src/magneticField/JF12Field.cpp.gcov.html create mode 100644 doc/coverageReport/src/magneticField/JF12FieldSolenoidal.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/magneticField/JF12FieldSolenoidal.cpp.func.html create mode 100644 doc/coverageReport/src/magneticField/JF12FieldSolenoidal.cpp.gcov.html create mode 100644 doc/coverageReport/src/magneticField/MagneticField.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/magneticField/MagneticField.cpp.func.html create mode 100644 doc/coverageReport/src/magneticField/MagneticField.cpp.gcov.html create mode 100644 doc/coverageReport/src/magneticField/MagneticFieldGrid.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/magneticField/MagneticFieldGrid.cpp.func.html create mode 100644 doc/coverageReport/src/magneticField/MagneticFieldGrid.cpp.gcov.html create mode 100644 doc/coverageReport/src/magneticField/PT11Field.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/magneticField/PT11Field.cpp.func.html create mode 100644 doc/coverageReport/src/magneticField/PT11Field.cpp.gcov.html create mode 100644 doc/coverageReport/src/magneticField/PolarizedSingleModeMagneticField.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/magneticField/PolarizedSingleModeMagneticField.cpp.func.html create mode 100644 doc/coverageReport/src/magneticField/PolarizedSingleModeMagneticField.cpp.gcov.html create mode 100644 doc/coverageReport/src/magneticField/TF17Field.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/magneticField/TF17Field.cpp.func.html create mode 100644 doc/coverageReport/src/magneticField/TF17Field.cpp.gcov.html create mode 100644 doc/coverageReport/src/magneticField/index-sort-f.html create mode 100644 doc/coverageReport/src/magneticField/index-sort-l.html create mode 100644 doc/coverageReport/src/magneticField/index.html create mode 100644 doc/coverageReport/src/magneticField/turbulentField/GridTurbulence.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/magneticField/turbulentField/GridTurbulence.cpp.func.html create mode 100644 doc/coverageReport/src/magneticField/turbulentField/GridTurbulence.cpp.gcov.html create mode 100644 doc/coverageReport/src/magneticField/turbulentField/HelicalGridTurbulence.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/magneticField/turbulentField/HelicalGridTurbulence.cpp.func.html create mode 100644 doc/coverageReport/src/magneticField/turbulentField/HelicalGridTurbulence.cpp.gcov.html create mode 100644 doc/coverageReport/src/magneticField/turbulentField/PlaneWaveTurbulence.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/magneticField/turbulentField/PlaneWaveTurbulence.cpp.func.html create mode 100644 doc/coverageReport/src/magneticField/turbulentField/PlaneWaveTurbulence.cpp.gcov.html create mode 100644 doc/coverageReport/src/magneticField/turbulentField/SimpleGridTurbulence.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/magneticField/turbulentField/SimpleGridTurbulence.cpp.func.html create mode 100644 doc/coverageReport/src/magneticField/turbulentField/SimpleGridTurbulence.cpp.gcov.html create mode 100644 doc/coverageReport/src/magneticField/turbulentField/index-sort-f.html create mode 100644 doc/coverageReport/src/magneticField/turbulentField/index-sort-l.html create mode 100644 doc/coverageReport/src/magneticField/turbulentField/index.html create mode 100644 doc/coverageReport/src/magneticLens/MagneticLens.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/magneticLens/MagneticLens.cpp.func.html create mode 100644 doc/coverageReport/src/magneticLens/MagneticLens.cpp.gcov.html create mode 100644 doc/coverageReport/src/magneticLens/ModelMatrix.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/magneticLens/ModelMatrix.cpp.func.html create mode 100644 doc/coverageReport/src/magneticLens/ModelMatrix.cpp.gcov.html create mode 100644 doc/coverageReport/src/magneticLens/ParticleMapsContainer.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/magneticLens/ParticleMapsContainer.cpp.func.html create mode 100644 doc/coverageReport/src/magneticLens/ParticleMapsContainer.cpp.gcov.html create mode 100644 doc/coverageReport/src/magneticLens/Pixelization.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/magneticLens/Pixelization.cpp.func.html create mode 100644 doc/coverageReport/src/magneticLens/Pixelization.cpp.gcov.html create mode 100644 doc/coverageReport/src/magneticLens/index-sort-f.html create mode 100644 doc/coverageReport/src/magneticLens/index-sort-l.html create mode 100644 doc/coverageReport/src/magneticLens/index.html create mode 100644 doc/coverageReport/src/massDistribution/ConstantDensity.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/massDistribution/ConstantDensity.cpp.func.html create mode 100644 doc/coverageReport/src/massDistribution/ConstantDensity.cpp.gcov.html create mode 100644 doc/coverageReport/src/massDistribution/Cordes.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/massDistribution/Cordes.cpp.func.html create mode 100644 doc/coverageReport/src/massDistribution/Cordes.cpp.gcov.html create mode 100644 doc/coverageReport/src/massDistribution/Ferriere.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/massDistribution/Ferriere.cpp.func.html create mode 100644 doc/coverageReport/src/massDistribution/Ferriere.cpp.gcov.html create mode 100644 doc/coverageReport/src/massDistribution/Massdistribution.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/massDistribution/Massdistribution.cpp.func.html create mode 100644 doc/coverageReport/src/massDistribution/Massdistribution.cpp.gcov.html create mode 100644 doc/coverageReport/src/massDistribution/Nakanishi.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/massDistribution/Nakanishi.cpp.func.html create mode 100644 doc/coverageReport/src/massDistribution/Nakanishi.cpp.gcov.html create mode 100644 doc/coverageReport/src/massDistribution/index-sort-f.html create mode 100644 doc/coverageReport/src/massDistribution/index-sort-l.html create mode 100644 doc/coverageReport/src/massDistribution/index.html create mode 100644 doc/coverageReport/src/module/Acceleration.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/Acceleration.cpp.func.html create mode 100644 doc/coverageReport/src/module/Acceleration.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/AdiabaticCooling.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/AdiabaticCooling.cpp.func.html create mode 100644 doc/coverageReport/src/module/AdiabaticCooling.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/Boundary.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/Boundary.cpp.func.html create mode 100644 doc/coverageReport/src/module/Boundary.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/BreakCondition.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/BreakCondition.cpp.func.html create mode 100644 doc/coverageReport/src/module/BreakCondition.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/CandidateSplitting.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/CandidateSplitting.cpp.func.html create mode 100644 doc/coverageReport/src/module/CandidateSplitting.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/DiffusionSDE.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/DiffusionSDE.cpp.func.html create mode 100644 doc/coverageReport/src/module/DiffusionSDE.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/EMDoublePairProduction.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/EMDoublePairProduction.cpp.func.html create mode 100644 doc/coverageReport/src/module/EMDoublePairProduction.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/EMInverseComptonScattering.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/EMInverseComptonScattering.cpp.func.html create mode 100644 doc/coverageReport/src/module/EMInverseComptonScattering.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/EMPairProduction.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/EMPairProduction.cpp.func.html create mode 100644 doc/coverageReport/src/module/EMPairProduction.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/EMTripletPairProduction.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/EMTripletPairProduction.cpp.func.html create mode 100644 doc/coverageReport/src/module/EMTripletPairProduction.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/ElasticScattering.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/ElasticScattering.cpp.func.html create mode 100644 doc/coverageReport/src/module/ElasticScattering.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/ElectronPairProduction.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/ElectronPairProduction.cpp.func.html create mode 100644 doc/coverageReport/src/module/ElectronPairProduction.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/HDF5Output.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/HDF5Output.cpp.func.html create mode 100644 doc/coverageReport/src/module/HDF5Output.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/MomentumDiffusion.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/MomentumDiffusion.cpp.func.html create mode 100644 doc/coverageReport/src/module/MomentumDiffusion.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/NuclearDecay.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/NuclearDecay.cpp.func.html create mode 100644 doc/coverageReport/src/module/NuclearDecay.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/Observer.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/Observer.cpp.func.html create mode 100644 doc/coverageReport/src/module/Observer.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/Output.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/Output.cpp.func.html create mode 100644 doc/coverageReport/src/module/Output.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/OutputShell.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/OutputShell.cpp.func.html create mode 100644 doc/coverageReport/src/module/OutputShell.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/ParticleCollector.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/ParticleCollector.cpp.func.html create mode 100644 doc/coverageReport/src/module/ParticleCollector.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/PhotoDisintegration.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/PhotoDisintegration.cpp.func.html create mode 100644 doc/coverageReport/src/module/PhotoDisintegration.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/PhotoPionProduction.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/PhotoPionProduction.cpp.func.html create mode 100644 doc/coverageReport/src/module/PhotoPionProduction.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/PhotonOutput1D.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/PhotonOutput1D.cpp.func.html create mode 100644 doc/coverageReport/src/module/PhotonOutput1D.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/PropagationBP.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/PropagationBP.cpp.func.html create mode 100644 doc/coverageReport/src/module/PropagationBP.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/PropagationCK.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/PropagationCK.cpp.func.html create mode 100644 doc/coverageReport/src/module/PropagationCK.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/Redshift.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/Redshift.cpp.func.html create mode 100644 doc/coverageReport/src/module/Redshift.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/RestrictToRegion.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/RestrictToRegion.cpp.func.html create mode 100644 doc/coverageReport/src/module/RestrictToRegion.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/SimplePropagation.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/SimplePropagation.cpp.func.html create mode 100644 doc/coverageReport/src/module/SimplePropagation.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/SynchrotronRadiation.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/SynchrotronRadiation.cpp.func.html create mode 100644 doc/coverageReport/src/module/SynchrotronRadiation.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/TextOutput.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/TextOutput.cpp.func.html create mode 100644 doc/coverageReport/src/module/TextOutput.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/Tools.cpp.func-sort-c.html create mode 100644 doc/coverageReport/src/module/Tools.cpp.func.html create mode 100644 doc/coverageReport/src/module/Tools.cpp.gcov.html create mode 100644 doc/coverageReport/src/module/index-sort-f.html create mode 100644 doc/coverageReport/src/module/index-sort-l.html create mode 100644 doc/coverageReport/src/module/index.html create mode 100644 doc/coverageReport/test/index-sort-f.html create mode 100644 doc/coverageReport/test/index-sort-l.html create mode 100644 doc/coverageReport/test/index.html create mode 100644 doc/coverageReport/test/testAdiabaticCooling.cpp.func-sort-c.html create mode 100644 doc/coverageReport/test/testAdiabaticCooling.cpp.func.html create mode 100644 doc/coverageReport/test/testAdiabaticCooling.cpp.gcov.html create mode 100644 doc/coverageReport/test/testAdvectionField.cpp.func-sort-c.html create mode 100644 doc/coverageReport/test/testAdvectionField.cpp.func.html create mode 100644 doc/coverageReport/test/testAdvectionField.cpp.gcov.html create mode 100644 doc/coverageReport/test/testBreakCondition.cpp.func-sort-c.html create mode 100644 doc/coverageReport/test/testBreakCondition.cpp.func.html create mode 100644 doc/coverageReport/test/testBreakCondition.cpp.gcov.html create mode 100644 doc/coverageReport/test/testCandidateSplitting.cpp.func-sort-c.html create mode 100644 doc/coverageReport/test/testCandidateSplitting.cpp.func.html create mode 100644 doc/coverageReport/test/testCandidateSplitting.cpp.gcov.html create mode 100644 doc/coverageReport/test/testCore.cpp.func-sort-c.html create mode 100644 doc/coverageReport/test/testCore.cpp.func.html create mode 100644 doc/coverageReport/test/testCore.cpp.gcov.html create mode 100644 doc/coverageReport/test/testDensity.cpp.func-sort-c.html create mode 100644 doc/coverageReport/test/testDensity.cpp.func.html create mode 100644 doc/coverageReport/test/testDensity.cpp.gcov.html create mode 100644 doc/coverageReport/test/testFunctionalGroups.cpp.func-sort-c.html create mode 100644 doc/coverageReport/test/testFunctionalGroups.cpp.func.html create mode 100644 doc/coverageReport/test/testFunctionalGroups.cpp.gcov.html create mode 100644 doc/coverageReport/test/testInteraction.cpp.func-sort-c.html create mode 100644 doc/coverageReport/test/testInteraction.cpp.func.html create mode 100644 doc/coverageReport/test/testInteraction.cpp.gcov.html create mode 100644 doc/coverageReport/test/testMagneticField.cpp.func-sort-c.html create mode 100644 doc/coverageReport/test/testMagneticField.cpp.func.html create mode 100644 doc/coverageReport/test/testMagneticField.cpp.gcov.html create mode 100644 doc/coverageReport/test/testMagneticLens.cpp.func-sort-c.html create mode 100644 doc/coverageReport/test/testMagneticLens.cpp.func.html create mode 100644 doc/coverageReport/test/testMagneticLens.cpp.gcov.html create mode 100644 doc/coverageReport/test/testModuleList.cpp.func-sort-c.html create mode 100644 doc/coverageReport/test/testModuleList.cpp.func.html create mode 100644 doc/coverageReport/test/testModuleList.cpp.gcov.html create mode 100644 doc/coverageReport/test/testOutput.cpp.func-sort-c.html create mode 100644 doc/coverageReport/test/testOutput.cpp.func.html create mode 100644 doc/coverageReport/test/testOutput.cpp.gcov.html create mode 100644 doc/coverageReport/test/testPropagation.cpp.func-sort-c.html create mode 100644 doc/coverageReport/test/testPropagation.cpp.func.html create mode 100644 doc/coverageReport/test/testPropagation.cpp.gcov.html create mode 100644 doc/coverageReport/test/testSource.cpp.func-sort-c.html create mode 100644 doc/coverageReport/test/testSource.cpp.func.html create mode 100644 doc/coverageReport/test/testSource.cpp.gcov.html create mode 100644 doc/coverageReport/test/testTurbulentField.cpp.func-sort-c.html create mode 100644 doc/coverageReport/test/testTurbulentField.cpp.func.html create mode 100644 doc/coverageReport/test/testTurbulentField.cpp.gcov.html create mode 100644 doc/coverageReport/test/testVector3.cpp.func-sort-c.html create mode 100644 doc/coverageReport/test/testVector3.cpp.func.html create mode 100644 doc/coverageReport/test/testVector3.cpp.gcov.html create mode 100644 doc/coverageReport/updown.png diff --git a/doc/coverageReport/amber.png b/doc/coverageReport/amber.png new file mode 100644 index 0000000000000000000000000000000000000000..2cab170d8359081983a4e343848dfe06bc490f12 GIT binary patch literal 141 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga>?NMQuI!iC1^G2tW}LqE04T&+ z;1OBOz`!j8!i<;h*8KqrvZOouIx;Y9?C1WI$O`1M1^9%x{(levWG?NMQuI!iC1^Jb!lvI6;R0X`wF(yt=9xVZRt1vCRixIA4P dLn>}1Cji+@42)0J?}79&c)I$ztaD0e0sy@GAL0N2 literal 0 HcmV?d00001 diff --git a/doc/coverageReport/gcov.css b/doc/coverageReport/gcov.css new file mode 100644 index 000000000..bfd0a83e1 --- /dev/null +++ b/doc/coverageReport/gcov.css @@ -0,0 +1,519 @@ +/* All views: initial background and text color */ +body +{ + color: #000000; + background-color: #FFFFFF; +} + +/* All views: standard link format*/ +a:link +{ + color: #284FA8; + text-decoration: underline; +} + +/* All views: standard link - visited format */ +a:visited +{ + color: #00CB40; + text-decoration: underline; +} + +/* All views: standard link - activated format */ +a:active +{ + color: #FF0040; + text-decoration: underline; +} + +/* All views: main title format */ +td.title +{ + text-align: center; + padding-bottom: 10px; + font-family: sans-serif; + font-size: 20pt; + font-style: italic; + font-weight: bold; +} + +/* All views: header item format */ +td.headerItem +{ + text-align: right; + padding-right: 6px; + font-family: sans-serif; + font-weight: bold; + vertical-align: top; + white-space: nowrap; +} + +/* All views: header item value format */ +td.headerValue +{ + text-align: left; + color: #284FA8; + font-family: sans-serif; + font-weight: bold; + white-space: nowrap; +} + +/* All views: header item coverage table heading */ +td.headerCovTableHead +{ + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + font-size: 80%; + white-space: nowrap; +} + +/* All views: header item coverage table entry */ +td.headerCovTableEntry +{ + text-align: right; + color: #284FA8; + font-family: sans-serif; + font-weight: bold; + white-space: nowrap; + padding-left: 12px; + padding-right: 4px; + background-color: #DAE7FE; +} + +/* All views: header item coverage table entry for high coverage rate */ +td.headerCovTableEntryHi +{ + text-align: right; + color: #000000; + font-family: sans-serif; + font-weight: bold; + white-space: nowrap; + padding-left: 12px; + padding-right: 4px; + background-color: #A7FC9D; +} + +/* All views: header item coverage table entry for medium coverage rate */ +td.headerCovTableEntryMed +{ + text-align: right; + color: #000000; + font-family: sans-serif; + font-weight: bold; + white-space: nowrap; + padding-left: 12px; + padding-right: 4px; + background-color: #FFEA20; +} + +/* All views: header item coverage table entry for ow coverage rate */ +td.headerCovTableEntryLo +{ + text-align: right; + color: #000000; + font-family: sans-serif; + font-weight: bold; + white-space: nowrap; + padding-left: 12px; + padding-right: 4px; + background-color: #FF0000; +} + +/* All views: header legend value for legend entry */ +td.headerValueLeg +{ + text-align: left; + color: #000000; + font-family: sans-serif; + font-size: 80%; + white-space: nowrap; + padding-top: 4px; +} + +/* All views: color of horizontal ruler */ +td.ruler +{ + background-color: #6688D4; +} + +/* All views: version string format */ +td.versionInfo +{ + text-align: center; + padding-top: 2px; + font-family: sans-serif; + font-style: italic; +} + +/* Directory view/File view (all)/Test case descriptions: + table headline format */ +td.tableHead +{ + text-align: center; + color: #FFFFFF; + background-color: #6688D4; + font-family: sans-serif; + font-size: 120%; + font-weight: bold; + white-space: nowrap; + padding-left: 4px; + padding-right: 4px; +} + +span.tableHeadSort +{ + padding-right: 4px; +} + +/* Directory view/File view (all): filename entry format */ +td.coverFile +{ + text-align: left; + padding-left: 10px; + padding-right: 20px; + color: #284FA8; + background-color: #DAE7FE; + font-family: monospace; +} + +/* Directory view/File view (all): bar-graph entry format*/ +td.coverBar +{ + padding-left: 10px; + padding-right: 10px; + background-color: #DAE7FE; +} + +/* Directory view/File view (all): bar-graph outline color */ +td.coverBarOutline +{ + background-color: #000000; +} + +/* Directory view/File view (all): percentage entry for files with + high coverage rate */ +td.coverPerHi +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #A7FC9D; + font-weight: bold; + font-family: sans-serif; +} + +/* Directory view/File view (all): line count entry for files with + high coverage rate */ +td.coverNumHi +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #A7FC9D; + white-space: nowrap; + font-family: sans-serif; +} + +/* Directory view/File view (all): percentage entry for files with + medium coverage rate */ +td.coverPerMed +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #FFEA20; + font-weight: bold; + font-family: sans-serif; +} + +/* Directory view/File view (all): line count entry for files with + medium coverage rate */ +td.coverNumMed +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #FFEA20; + white-space: nowrap; + font-family: sans-serif; +} + +/* Directory view/File view (all): percentage entry for files with + low coverage rate */ +td.coverPerLo +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #FF0000; + font-weight: bold; + font-family: sans-serif; +} + +/* Directory view/File view (all): line count entry for files with + low coverage rate */ +td.coverNumLo +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #FF0000; + white-space: nowrap; + font-family: sans-serif; +} + +/* File view (all): "show/hide details" link format */ +a.detail:link +{ + color: #B8D0FF; + font-size:80%; +} + +/* File view (all): "show/hide details" link - visited format */ +a.detail:visited +{ + color: #B8D0FF; + font-size:80%; +} + +/* File view (all): "show/hide details" link - activated format */ +a.detail:active +{ + color: #FFFFFF; + font-size:80%; +} + +/* File view (detail): test name entry */ +td.testName +{ + text-align: right; + padding-right: 10px; + background-color: #DAE7FE; + font-family: sans-serif; +} + +/* File view (detail): test percentage entry */ +td.testPer +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #DAE7FE; + font-family: sans-serif; +} + +/* File view (detail): test lines count entry */ +td.testNum +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #DAE7FE; + font-family: sans-serif; +} + +/* Test case descriptions: test name format*/ +dt +{ + font-family: sans-serif; + font-weight: bold; +} + +/* Test case descriptions: description table body */ +td.testDescription +{ + padding-top: 10px; + padding-left: 30px; + padding-bottom: 10px; + padding-right: 30px; + background-color: #DAE7FE; +} + +/* Source code view: function entry */ +td.coverFn +{ + text-align: left; + padding-left: 10px; + padding-right: 20px; + color: #284FA8; + background-color: #DAE7FE; + font-family: monospace; +} + +/* Source code view: function entry zero count*/ +td.coverFnLo +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #FF0000; + font-weight: bold; + font-family: sans-serif; +} + +/* Source code view: function entry nonzero count*/ +td.coverFnHi +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #DAE7FE; + font-weight: bold; + font-family: sans-serif; +} + +/* Source code view: source code format */ +pre.source +{ + font-family: monospace; + white-space: pre; + margin-top: 2px; +} + +/* Source code view: line number format */ +span.lineNum +{ + background-color: #EFE383; +} + +/* Source code view: format for lines which were executed */ +td.lineCov, +span.lineCov +{ + background-color: #CAD7FE; +} + +/* Source code view: format for Cov legend */ +span.coverLegendCov +{ + padding-left: 10px; + padding-right: 10px; + padding-bottom: 2px; + background-color: #CAD7FE; +} + +/* Source code view: format for lines which were not executed */ +td.lineNoCov, +span.lineNoCov +{ + background-color: #FF6230; +} + +/* Source code view: format for NoCov legend */ +span.coverLegendNoCov +{ + padding-left: 10px; + padding-right: 10px; + padding-bottom: 2px; + background-color: #FF6230; +} + +/* Source code view (function table): standard link - visited format */ +td.lineNoCov > a:visited, +td.lineCov > a:visited +{ + color: black; + text-decoration: underline; +} + +/* Source code view: format for lines which were executed only in a + previous version */ +span.lineDiffCov +{ + background-color: #B5F7AF; +} + +/* Source code view: format for branches which were executed + * and taken */ +span.branchCov +{ + background-color: #CAD7FE; +} + +/* Source code view: format for branches which were executed + * but not taken */ +span.branchNoCov +{ + background-color: #FF6230; +} + +/* Source code view: format for branches which were not executed */ +span.branchNoExec +{ + background-color: #FF6230; +} + +/* Source code view: format for the source code heading line */ +pre.sourceHeading +{ + white-space: pre; + font-family: monospace; + font-weight: bold; + margin: 0px; +} + +/* All views: header legend value for low rate */ +td.headerValueLegL +{ + font-family: sans-serif; + text-align: center; + white-space: nowrap; + padding-left: 4px; + padding-right: 2px; + background-color: #FF0000; + font-size: 80%; +} + +/* All views: header legend value for med rate */ +td.headerValueLegM +{ + font-family: sans-serif; + text-align: center; + white-space: nowrap; + padding-left: 2px; + padding-right: 2px; + background-color: #FFEA20; + font-size: 80%; +} + +/* All views: header legend value for hi rate */ +td.headerValueLegH +{ + font-family: sans-serif; + text-align: center; + white-space: nowrap; + padding-left: 2px; + padding-right: 4px; + background-color: #A7FC9D; + font-size: 80%; +} + +/* All views except source code view: legend format for low coverage */ +span.coverLegendCovLo +{ + padding-left: 10px; + padding-right: 10px; + padding-top: 2px; + background-color: #FF0000; +} + +/* All views except source code view: legend format for med coverage */ +span.coverLegendCovMed +{ + padding-left: 10px; + padding-right: 10px; + padding-top: 2px; + background-color: #FFEA20; +} + +/* All views except source code view: legend format for hi coverage */ +span.coverLegendCovHi +{ + padding-left: 10px; + padding-right: 10px; + padding-top: 2px; + background-color: #A7FC9D; +} diff --git a/doc/coverageReport/glass.png b/doc/coverageReport/glass.png new file mode 100644 index 0000000000000000000000000000000000000000..e1abc00680a3093c49fdb775ae6bdb6764c95af2 GIT binary patch literal 167 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)gaEa{HEjtmSN`?>!lvI6;R0X`wF z|Ns97GD8ntt^-nxB|(0{3=Yq3q=7g|-tI089jvk*Kn`btM`SSr1Gf+eGhVt|_XjA* zUgGKN%6^Gmn4d%Ph(nkFP>9RZ#WAE}PI3Z}&BVayv3^M*kj3EX>gTe~DWM4f=_Dpv literal 0 HcmV?d00001 diff --git a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h.func-sort-c.html b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h.func-sort-c.html new file mode 100644 index 000000000..0de34274a --- /dev/null +++ b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h.func-sort-c.html @@ -0,0 +1,76 @@ + + + + + + + LCOV - coverage.info.cleaned - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy - __multiarray_api.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:132748.1 %
Date:2024-04-08 14:58:22Functions:11100.0 %
+
+ +
+ + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_import_array4
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h.func.html b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h.func.html new file mode 100644 index 000000000..6d2267253 --- /dev/null +++ b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h.func.html @@ -0,0 +1,76 @@ + + + + + + + LCOV - coverage.info.cleaned - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy - __multiarray_api.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:132748.1 %
Date:2024-04-08 14:58:22Functions:11100.0 %
+
+ +
+ + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_import_array4
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h.gcov.html b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h.gcov.html new file mode 100644 index 000000000..5aee35675 --- /dev/null +++ b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h.gcov.html @@ -0,0 +1,1642 @@ + + + + + + + LCOV - coverage.info.cleaned - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy - __multiarray_api.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:132748.1 %
Date:2024-04-08 14:58:22Functions:11100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : 
+       2             : #if defined(_MULTIARRAYMODULE) || defined(WITH_CPYCHECKER_STEALS_REFERENCE_TO_ARG_ATTRIBUTE)
+       3             : 
+       4             : typedef struct {
+       5             :         PyObject_HEAD
+       6             :         npy_bool obval;
+       7             : } PyBoolScalarObject;
+       8             : 
+       9             : extern NPY_NO_EXPORT PyTypeObject PyArrayMapIter_Type;
+      10             : extern NPY_NO_EXPORT PyTypeObject PyArrayNeighborhoodIter_Type;
+      11             : extern NPY_NO_EXPORT PyBoolScalarObject _PyArrayScalar_BoolValues[2];
+      12             : 
+      13             : NPY_NO_EXPORT  unsigned int PyArray_GetNDArrayCVersion \
+      14             :        (void);
+      15             : extern NPY_NO_EXPORT PyTypeObject PyBigArray_Type;
+      16             : 
+      17             : extern NPY_NO_EXPORT PyTypeObject PyArray_Type;
+      18             : 
+      19             : extern NPY_NO_EXPORT PyArray_DTypeMeta PyArrayDescr_TypeFull;
+      20             : #define PyArrayDescr_Type (*(PyTypeObject *)(&PyArrayDescr_TypeFull))
+      21             : 
+      22             : extern NPY_NO_EXPORT PyTypeObject PyArrayFlags_Type;
+      23             : 
+      24             : extern NPY_NO_EXPORT PyTypeObject PyArrayIter_Type;
+      25             : 
+      26             : extern NPY_NO_EXPORT PyTypeObject PyArrayMultiIter_Type;
+      27             : 
+      28             : extern NPY_NO_EXPORT int NPY_NUMUSERTYPES;
+      29             : 
+      30             : extern NPY_NO_EXPORT PyTypeObject PyBoolArrType_Type;
+      31             : 
+      32             : extern NPY_NO_EXPORT PyBoolScalarObject _PyArrayScalar_BoolValues[2];
+      33             : 
+      34             : extern NPY_NO_EXPORT PyTypeObject PyGenericArrType_Type;
+      35             : 
+      36             : extern NPY_NO_EXPORT PyTypeObject PyNumberArrType_Type;
+      37             : 
+      38             : extern NPY_NO_EXPORT PyTypeObject PyIntegerArrType_Type;
+      39             : 
+      40             : extern NPY_NO_EXPORT PyTypeObject PySignedIntegerArrType_Type;
+      41             : 
+      42             : extern NPY_NO_EXPORT PyTypeObject PyUnsignedIntegerArrType_Type;
+      43             : 
+      44             : extern NPY_NO_EXPORT PyTypeObject PyInexactArrType_Type;
+      45             : 
+      46             : extern NPY_NO_EXPORT PyTypeObject PyFloatingArrType_Type;
+      47             : 
+      48             : extern NPY_NO_EXPORT PyTypeObject PyComplexFloatingArrType_Type;
+      49             : 
+      50             : extern NPY_NO_EXPORT PyTypeObject PyFlexibleArrType_Type;
+      51             : 
+      52             : extern NPY_NO_EXPORT PyTypeObject PyCharacterArrType_Type;
+      53             : 
+      54             : extern NPY_NO_EXPORT PyTypeObject PyByteArrType_Type;
+      55             : 
+      56             : extern NPY_NO_EXPORT PyTypeObject PyShortArrType_Type;
+      57             : 
+      58             : extern NPY_NO_EXPORT PyTypeObject PyIntArrType_Type;
+      59             : 
+      60             : extern NPY_NO_EXPORT PyTypeObject PyLongArrType_Type;
+      61             : 
+      62             : extern NPY_NO_EXPORT PyTypeObject PyLongLongArrType_Type;
+      63             : 
+      64             : extern NPY_NO_EXPORT PyTypeObject PyUByteArrType_Type;
+      65             : 
+      66             : extern NPY_NO_EXPORT PyTypeObject PyUShortArrType_Type;
+      67             : 
+      68             : extern NPY_NO_EXPORT PyTypeObject PyUIntArrType_Type;
+      69             : 
+      70             : extern NPY_NO_EXPORT PyTypeObject PyULongArrType_Type;
+      71             : 
+      72             : extern NPY_NO_EXPORT PyTypeObject PyULongLongArrType_Type;
+      73             : 
+      74             : extern NPY_NO_EXPORT PyTypeObject PyFloatArrType_Type;
+      75             : 
+      76             : extern NPY_NO_EXPORT PyTypeObject PyDoubleArrType_Type;
+      77             : 
+      78             : extern NPY_NO_EXPORT PyTypeObject PyLongDoubleArrType_Type;
+      79             : 
+      80             : extern NPY_NO_EXPORT PyTypeObject PyCFloatArrType_Type;
+      81             : 
+      82             : extern NPY_NO_EXPORT PyTypeObject PyCDoubleArrType_Type;
+      83             : 
+      84             : extern NPY_NO_EXPORT PyTypeObject PyCLongDoubleArrType_Type;
+      85             : 
+      86             : extern NPY_NO_EXPORT PyTypeObject PyObjectArrType_Type;
+      87             : 
+      88             : extern NPY_NO_EXPORT PyTypeObject PyStringArrType_Type;
+      89             : 
+      90             : extern NPY_NO_EXPORT PyTypeObject PyUnicodeArrType_Type;
+      91             : 
+      92             : extern NPY_NO_EXPORT PyTypeObject PyVoidArrType_Type;
+      93             : 
+      94             : NPY_NO_EXPORT  int PyArray_SetNumericOps \
+      95             :        (PyObject *);
+      96             : NPY_NO_EXPORT  PyObject * PyArray_GetNumericOps \
+      97             :        (void);
+      98             : NPY_NO_EXPORT  int PyArray_INCREF \
+      99             :        (PyArrayObject *);
+     100             : NPY_NO_EXPORT  int PyArray_XDECREF \
+     101             :        (PyArrayObject *);
+     102             : NPY_NO_EXPORT  void PyArray_SetStringFunction \
+     103             :        (PyObject *, int);
+     104             : NPY_NO_EXPORT  PyArray_Descr * PyArray_DescrFromType \
+     105             :        (int);
+     106             : NPY_NO_EXPORT  PyObject * PyArray_TypeObjectFromType \
+     107             :        (int);
+     108             : NPY_NO_EXPORT  char * PyArray_Zero \
+     109             :        (PyArrayObject *);
+     110             : NPY_NO_EXPORT  char * PyArray_One \
+     111             :        (PyArrayObject *);
+     112             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) PyObject * PyArray_CastToType \
+     113             :        (PyArrayObject *, PyArray_Descr *, int);
+     114             : NPY_NO_EXPORT  int PyArray_CastTo \
+     115             :        (PyArrayObject *, PyArrayObject *);
+     116             : NPY_NO_EXPORT  int PyArray_CastAnyTo \
+     117             :        (PyArrayObject *, PyArrayObject *);
+     118             : NPY_NO_EXPORT  int PyArray_CanCastSafely \
+     119             :        (int, int);
+     120             : NPY_NO_EXPORT  npy_bool PyArray_CanCastTo \
+     121             :        (PyArray_Descr *, PyArray_Descr *);
+     122             : NPY_NO_EXPORT  int PyArray_ObjectType \
+     123             :        (PyObject *, int);
+     124             : NPY_NO_EXPORT  PyArray_Descr * PyArray_DescrFromObject \
+     125             :        (PyObject *, PyArray_Descr *);
+     126             : NPY_NO_EXPORT  PyArrayObject ** PyArray_ConvertToCommonType \
+     127             :        (PyObject *, int *);
+     128             : NPY_NO_EXPORT  PyArray_Descr * PyArray_DescrFromScalar \
+     129             :        (PyObject *);
+     130             : NPY_NO_EXPORT  PyArray_Descr * PyArray_DescrFromTypeObject \
+     131             :        (PyObject *);
+     132             : NPY_NO_EXPORT  npy_intp PyArray_Size \
+     133             :        (PyObject *);
+     134             : NPY_NO_EXPORT  PyObject * PyArray_Scalar \
+     135             :        (void *, PyArray_Descr *, PyObject *);
+     136             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) PyObject * PyArray_FromScalar \
+     137             :        (PyObject *, PyArray_Descr *);
+     138             : NPY_NO_EXPORT  void PyArray_ScalarAsCtype \
+     139             :        (PyObject *, void *);
+     140             : NPY_NO_EXPORT  int PyArray_CastScalarToCtype \
+     141             :        (PyObject *, void *, PyArray_Descr *);
+     142             : NPY_NO_EXPORT  int PyArray_CastScalarDirect \
+     143             :        (PyObject *, PyArray_Descr *, void *, int);
+     144             : NPY_NO_EXPORT  PyObject * PyArray_ScalarFromObject \
+     145             :        (PyObject *);
+     146             : NPY_NO_EXPORT  PyArray_VectorUnaryFunc * PyArray_GetCastFunc \
+     147             :        (PyArray_Descr *, int);
+     148             : NPY_NO_EXPORT  PyObject * PyArray_FromDims \
+     149             :        (int NPY_UNUSED(nd), int *NPY_UNUSED(d), int NPY_UNUSED(type));
+     150             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(3) PyObject * PyArray_FromDimsAndDataAndDescr \
+     151             :        (int NPY_UNUSED(nd), int *NPY_UNUSED(d), PyArray_Descr *, char *NPY_UNUSED(data));
+     152             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) PyObject * PyArray_FromAny \
+     153             :        (PyObject *, PyArray_Descr *, int, int, int, PyObject *);
+     154             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(1) PyObject * PyArray_EnsureArray \
+     155             :        (PyObject *);
+     156             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(1) PyObject * PyArray_EnsureAnyArray \
+     157             :        (PyObject *);
+     158             : NPY_NO_EXPORT  PyObject * PyArray_FromFile \
+     159             :        (FILE *, PyArray_Descr *, npy_intp, char *);
+     160             : NPY_NO_EXPORT  PyObject * PyArray_FromString \
+     161             :        (char *, npy_intp, PyArray_Descr *, npy_intp, char *);
+     162             : NPY_NO_EXPORT  PyObject * PyArray_FromBuffer \
+     163             :        (PyObject *, PyArray_Descr *, npy_intp, npy_intp);
+     164             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) PyObject * PyArray_FromIter \
+     165             :        (PyObject *, PyArray_Descr *, npy_intp);
+     166             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(1) PyObject * PyArray_Return \
+     167             :        (PyArrayObject *);
+     168             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) PyObject * PyArray_GetField \
+     169             :        (PyArrayObject *, PyArray_Descr *, int);
+     170             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) int PyArray_SetField \
+     171             :        (PyArrayObject *, PyArray_Descr *, int, PyObject *);
+     172             : NPY_NO_EXPORT  PyObject * PyArray_Byteswap \
+     173             :        (PyArrayObject *, npy_bool);
+     174             : NPY_NO_EXPORT  PyObject * PyArray_Resize \
+     175             :        (PyArrayObject *, PyArray_Dims *, int, NPY_ORDER NPY_UNUSED(order));
+     176             : NPY_NO_EXPORT  int PyArray_MoveInto \
+     177             :        (PyArrayObject *, PyArrayObject *);
+     178             : NPY_NO_EXPORT  int PyArray_CopyInto \
+     179             :        (PyArrayObject *, PyArrayObject *);
+     180             : NPY_NO_EXPORT  int PyArray_CopyAnyInto \
+     181             :        (PyArrayObject *, PyArrayObject *);
+     182             : NPY_NO_EXPORT  int PyArray_CopyObject \
+     183             :        (PyArrayObject *, PyObject *);
+     184             : NPY_NO_EXPORT  PyObject * PyArray_NewCopy \
+     185             :        (PyArrayObject *, NPY_ORDER);
+     186             : NPY_NO_EXPORT  PyObject * PyArray_ToList \
+     187             :        (PyArrayObject *);
+     188             : NPY_NO_EXPORT  PyObject * PyArray_ToString \
+     189             :        (PyArrayObject *, NPY_ORDER);
+     190             : NPY_NO_EXPORT  int PyArray_ToFile \
+     191             :        (PyArrayObject *, FILE *, char *, char *);
+     192             : NPY_NO_EXPORT  int PyArray_Dump \
+     193             :        (PyObject *, PyObject *, int);
+     194             : NPY_NO_EXPORT  PyObject * PyArray_Dumps \
+     195             :        (PyObject *, int);
+     196             : NPY_NO_EXPORT  int PyArray_ValidType \
+     197             :        (int);
+     198             : NPY_NO_EXPORT  void PyArray_UpdateFlags \
+     199             :        (PyArrayObject *, int);
+     200             : NPY_NO_EXPORT  PyObject * PyArray_New \
+     201             :        (PyTypeObject *, int, npy_intp const *, int, npy_intp const *, void *, int, int, PyObject *);
+     202             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) PyObject * PyArray_NewFromDescr \
+     203             :        (PyTypeObject *, PyArray_Descr *, int, npy_intp const *, npy_intp const *, void *, int, PyObject *);
+     204             : NPY_NO_EXPORT  PyArray_Descr * PyArray_DescrNew \
+     205             :        (PyArray_Descr *);
+     206             : NPY_NO_EXPORT  PyArray_Descr * PyArray_DescrNewFromType \
+     207             :        (int);
+     208             : NPY_NO_EXPORT  double PyArray_GetPriority \
+     209             :        (PyObject *, double);
+     210             : NPY_NO_EXPORT  PyObject * PyArray_IterNew \
+     211             :        (PyObject *);
+     212             : NPY_NO_EXPORT  PyObject* PyArray_MultiIterNew \
+     213             :        (int, ...);
+     214             : NPY_NO_EXPORT  int PyArray_PyIntAsInt \
+     215             :        (PyObject *);
+     216             : NPY_NO_EXPORT  npy_intp PyArray_PyIntAsIntp \
+     217             :        (PyObject *);
+     218             : NPY_NO_EXPORT  int PyArray_Broadcast \
+     219             :        (PyArrayMultiIterObject *);
+     220             : NPY_NO_EXPORT  void PyArray_FillObjectArray \
+     221             :        (PyArrayObject *, PyObject *);
+     222             : NPY_NO_EXPORT  int PyArray_FillWithScalar \
+     223             :        (PyArrayObject *, PyObject *);
+     224             : NPY_NO_EXPORT  npy_bool PyArray_CheckStrides \
+     225             :        (int, int, npy_intp, npy_intp, npy_intp const *, npy_intp const *);
+     226             : NPY_NO_EXPORT  PyArray_Descr * PyArray_DescrNewByteorder \
+     227             :        (PyArray_Descr *, char);
+     228             : NPY_NO_EXPORT  PyObject * PyArray_IterAllButAxis \
+     229             :        (PyObject *, int *);
+     230             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) PyObject * PyArray_CheckFromAny \
+     231             :        (PyObject *, PyArray_Descr *, int, int, int, PyObject *);
+     232             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) PyObject * PyArray_FromArray \
+     233             :        (PyArrayObject *, PyArray_Descr *, int);
+     234             : NPY_NO_EXPORT  PyObject * PyArray_FromInterface \
+     235             :        (PyObject *);
+     236             : NPY_NO_EXPORT  PyObject * PyArray_FromStructInterface \
+     237             :        (PyObject *);
+     238             : NPY_NO_EXPORT  PyObject * PyArray_FromArrayAttr \
+     239             :        (PyObject *, PyArray_Descr *, PyObject *);
+     240             : NPY_NO_EXPORT  NPY_SCALARKIND PyArray_ScalarKind \
+     241             :        (int, PyArrayObject **);
+     242             : NPY_NO_EXPORT  int PyArray_CanCoerceScalar \
+     243             :        (int, int, NPY_SCALARKIND);
+     244             : NPY_NO_EXPORT  PyObject * PyArray_NewFlagsObject \
+     245             :        (PyObject *);
+     246             : NPY_NO_EXPORT  npy_bool PyArray_CanCastScalar \
+     247             :        (PyTypeObject *, PyTypeObject *);
+     248             : NPY_NO_EXPORT  int PyArray_CompareUCS4 \
+     249             :        (npy_ucs4 const *, npy_ucs4 const *, size_t);
+     250             : NPY_NO_EXPORT  int PyArray_RemoveSmallest \
+     251             :        (PyArrayMultiIterObject *);
+     252             : NPY_NO_EXPORT  int PyArray_ElementStrides \
+     253             :        (PyObject *);
+     254             : NPY_NO_EXPORT  void PyArray_Item_INCREF \
+     255             :        (char *, PyArray_Descr *);
+     256             : NPY_NO_EXPORT  void PyArray_Item_XDECREF \
+     257             :        (char *, PyArray_Descr *);
+     258             : NPY_NO_EXPORT  PyObject * PyArray_FieldNames \
+     259             :        (PyObject *);
+     260             : NPY_NO_EXPORT  PyObject * PyArray_Transpose \
+     261             :        (PyArrayObject *, PyArray_Dims *);
+     262             : NPY_NO_EXPORT  PyObject * PyArray_TakeFrom \
+     263             :        (PyArrayObject *, PyObject *, int, PyArrayObject *, NPY_CLIPMODE);
+     264             : NPY_NO_EXPORT  PyObject * PyArray_PutTo \
+     265             :        (PyArrayObject *, PyObject*, PyObject *, NPY_CLIPMODE);
+     266             : NPY_NO_EXPORT  PyObject * PyArray_PutMask \
+     267             :        (PyArrayObject *, PyObject*, PyObject*);
+     268             : NPY_NO_EXPORT  PyObject * PyArray_Repeat \
+     269             :        (PyArrayObject *, PyObject *, int);
+     270             : NPY_NO_EXPORT  PyObject * PyArray_Choose \
+     271             :        (PyArrayObject *, PyObject *, PyArrayObject *, NPY_CLIPMODE);
+     272             : NPY_NO_EXPORT  int PyArray_Sort \
+     273             :        (PyArrayObject *, int, NPY_SORTKIND);
+     274             : NPY_NO_EXPORT  PyObject * PyArray_ArgSort \
+     275             :        (PyArrayObject *, int, NPY_SORTKIND);
+     276             : NPY_NO_EXPORT  PyObject * PyArray_SearchSorted \
+     277             :        (PyArrayObject *, PyObject *, NPY_SEARCHSIDE, PyObject *);
+     278             : NPY_NO_EXPORT  PyObject * PyArray_ArgMax \
+     279             :        (PyArrayObject *, int, PyArrayObject *);
+     280             : NPY_NO_EXPORT  PyObject * PyArray_ArgMin \
+     281             :        (PyArrayObject *, int, PyArrayObject *);
+     282             : NPY_NO_EXPORT  PyObject * PyArray_Reshape \
+     283             :        (PyArrayObject *, PyObject *);
+     284             : NPY_NO_EXPORT  PyObject * PyArray_Newshape \
+     285             :        (PyArrayObject *, PyArray_Dims *, NPY_ORDER);
+     286             : NPY_NO_EXPORT  PyObject * PyArray_Squeeze \
+     287             :        (PyArrayObject *);
+     288             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) PyObject * PyArray_View \
+     289             :        (PyArrayObject *, PyArray_Descr *, PyTypeObject *);
+     290             : NPY_NO_EXPORT  PyObject * PyArray_SwapAxes \
+     291             :        (PyArrayObject *, int, int);
+     292             : NPY_NO_EXPORT  PyObject * PyArray_Max \
+     293             :        (PyArrayObject *, int, PyArrayObject *);
+     294             : NPY_NO_EXPORT  PyObject * PyArray_Min \
+     295             :        (PyArrayObject *, int, PyArrayObject *);
+     296             : NPY_NO_EXPORT  PyObject * PyArray_Ptp \
+     297             :        (PyArrayObject *, int, PyArrayObject *);
+     298             : NPY_NO_EXPORT  PyObject * PyArray_Mean \
+     299             :        (PyArrayObject *, int, int, PyArrayObject *);
+     300             : NPY_NO_EXPORT  PyObject * PyArray_Trace \
+     301             :        (PyArrayObject *, int, int, int, int, PyArrayObject *);
+     302             : NPY_NO_EXPORT  PyObject * PyArray_Diagonal \
+     303             :        (PyArrayObject *, int, int, int);
+     304             : NPY_NO_EXPORT  PyObject * PyArray_Clip \
+     305             :        (PyArrayObject *, PyObject *, PyObject *, PyArrayObject *);
+     306             : NPY_NO_EXPORT  PyObject * PyArray_Conjugate \
+     307             :        (PyArrayObject *, PyArrayObject *);
+     308             : NPY_NO_EXPORT  PyObject * PyArray_Nonzero \
+     309             :        (PyArrayObject *);
+     310             : NPY_NO_EXPORT  PyObject * PyArray_Std \
+     311             :        (PyArrayObject *, int, int, PyArrayObject *, int);
+     312             : NPY_NO_EXPORT  PyObject * PyArray_Sum \
+     313             :        (PyArrayObject *, int, int, PyArrayObject *);
+     314             : NPY_NO_EXPORT  PyObject * PyArray_CumSum \
+     315             :        (PyArrayObject *, int, int, PyArrayObject *);
+     316             : NPY_NO_EXPORT  PyObject * PyArray_Prod \
+     317             :        (PyArrayObject *, int, int, PyArrayObject *);
+     318             : NPY_NO_EXPORT  PyObject * PyArray_CumProd \
+     319             :        (PyArrayObject *, int, int, PyArrayObject *);
+     320             : NPY_NO_EXPORT  PyObject * PyArray_All \
+     321             :        (PyArrayObject *, int, PyArrayObject *);
+     322             : NPY_NO_EXPORT  PyObject * PyArray_Any \
+     323             :        (PyArrayObject *, int, PyArrayObject *);
+     324             : NPY_NO_EXPORT  PyObject * PyArray_Compress \
+     325             :        (PyArrayObject *, PyObject *, int, PyArrayObject *);
+     326             : NPY_NO_EXPORT  PyObject * PyArray_Flatten \
+     327             :        (PyArrayObject *, NPY_ORDER);
+     328             : NPY_NO_EXPORT  PyObject * PyArray_Ravel \
+     329             :        (PyArrayObject *, NPY_ORDER);
+     330             : NPY_NO_EXPORT  npy_intp PyArray_MultiplyList \
+     331             :        (npy_intp const *, int);
+     332             : NPY_NO_EXPORT  int PyArray_MultiplyIntList \
+     333             :        (int const *, int);
+     334             : NPY_NO_EXPORT  void * PyArray_GetPtr \
+     335             :        (PyArrayObject *, npy_intp const*);
+     336             : NPY_NO_EXPORT  int PyArray_CompareLists \
+     337             :        (npy_intp const *, npy_intp const *, int);
+     338             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(5) int PyArray_AsCArray \
+     339             :        (PyObject **, void *, npy_intp *, int, PyArray_Descr*);
+     340             : NPY_NO_EXPORT  int PyArray_As1D \
+     341             :        (PyObject **NPY_UNUSED(op), char **NPY_UNUSED(ptr), int *NPY_UNUSED(d1), int NPY_UNUSED(typecode));
+     342             : NPY_NO_EXPORT  int PyArray_As2D \
+     343             :        (PyObject **NPY_UNUSED(op), char ***NPY_UNUSED(ptr), int *NPY_UNUSED(d1), int *NPY_UNUSED(d2), int NPY_UNUSED(typecode));
+     344             : NPY_NO_EXPORT  int PyArray_Free \
+     345             :        (PyObject *, void *);
+     346             : NPY_NO_EXPORT  int PyArray_Converter \
+     347             :        (PyObject *, PyObject **);
+     348             : NPY_NO_EXPORT  int PyArray_IntpFromSequence \
+     349             :        (PyObject *, npy_intp *, int);
+     350             : NPY_NO_EXPORT  PyObject * PyArray_Concatenate \
+     351             :        (PyObject *, int);
+     352             : NPY_NO_EXPORT  PyObject * PyArray_InnerProduct \
+     353             :        (PyObject *, PyObject *);
+     354             : NPY_NO_EXPORT  PyObject * PyArray_MatrixProduct \
+     355             :        (PyObject *, PyObject *);
+     356             : NPY_NO_EXPORT  PyObject * PyArray_CopyAndTranspose \
+     357             :        (PyObject *);
+     358             : NPY_NO_EXPORT  PyObject * PyArray_Correlate \
+     359             :        (PyObject *, PyObject *, int);
+     360             : NPY_NO_EXPORT  int PyArray_TypestrConvert \
+     361             :        (int, int);
+     362             : NPY_NO_EXPORT  int PyArray_DescrConverter \
+     363             :        (PyObject *, PyArray_Descr **);
+     364             : NPY_NO_EXPORT  int PyArray_DescrConverter2 \
+     365             :        (PyObject *, PyArray_Descr **);
+     366             : NPY_NO_EXPORT  int PyArray_IntpConverter \
+     367             :        (PyObject *, PyArray_Dims *);
+     368             : NPY_NO_EXPORT  int PyArray_BufferConverter \
+     369             :        (PyObject *, PyArray_Chunk *);
+     370             : NPY_NO_EXPORT  int PyArray_AxisConverter \
+     371             :        (PyObject *, int *);
+     372             : NPY_NO_EXPORT  int PyArray_BoolConverter \
+     373             :        (PyObject *, npy_bool *);
+     374             : NPY_NO_EXPORT  int PyArray_ByteorderConverter \
+     375             :        (PyObject *, char *);
+     376             : NPY_NO_EXPORT  int PyArray_OrderConverter \
+     377             :        (PyObject *, NPY_ORDER *);
+     378             : NPY_NO_EXPORT  unsigned char PyArray_EquivTypes \
+     379             :        (PyArray_Descr *, PyArray_Descr *);
+     380             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(3) PyObject * PyArray_Zeros \
+     381             :        (int, npy_intp const *, PyArray_Descr *, int);
+     382             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(3) PyObject * PyArray_Empty \
+     383             :        (int, npy_intp const *, PyArray_Descr *, int);
+     384             : NPY_NO_EXPORT  PyObject * PyArray_Where \
+     385             :        (PyObject *, PyObject *, PyObject *);
+     386             : NPY_NO_EXPORT  PyObject * PyArray_Arange \
+     387             :        (double, double, double, int);
+     388             : NPY_NO_EXPORT  PyObject * PyArray_ArangeObj \
+     389             :        (PyObject *, PyObject *, PyObject *, PyArray_Descr *);
+     390             : NPY_NO_EXPORT  int PyArray_SortkindConverter \
+     391             :        (PyObject *, NPY_SORTKIND *);
+     392             : NPY_NO_EXPORT  PyObject * PyArray_LexSort \
+     393             :        (PyObject *, int);
+     394             : NPY_NO_EXPORT  PyObject * PyArray_Round \
+     395             :        (PyArrayObject *, int, PyArrayObject *);
+     396             : NPY_NO_EXPORT  unsigned char PyArray_EquivTypenums \
+     397             :        (int, int);
+     398             : NPY_NO_EXPORT  int PyArray_RegisterDataType \
+     399             :        (PyArray_Descr *);
+     400             : NPY_NO_EXPORT  int PyArray_RegisterCastFunc \
+     401             :        (PyArray_Descr *, int, PyArray_VectorUnaryFunc *);
+     402             : NPY_NO_EXPORT  int PyArray_RegisterCanCast \
+     403             :        (PyArray_Descr *, int, NPY_SCALARKIND);
+     404             : NPY_NO_EXPORT  void PyArray_InitArrFuncs \
+     405             :        (PyArray_ArrFuncs *);
+     406             : NPY_NO_EXPORT  PyObject * PyArray_IntTupleFromIntp \
+     407             :        (int, npy_intp const *);
+     408             : NPY_NO_EXPORT  int PyArray_TypeNumFromName \
+     409             :        (char const *);
+     410             : NPY_NO_EXPORT  int PyArray_ClipmodeConverter \
+     411             :        (PyObject *, NPY_CLIPMODE *);
+     412             : NPY_NO_EXPORT  int PyArray_OutputConverter \
+     413             :        (PyObject *, PyArrayObject **);
+     414             : NPY_NO_EXPORT  PyObject * PyArray_BroadcastToShape \
+     415             :        (PyObject *, npy_intp *, int);
+     416             : NPY_NO_EXPORT  void _PyArray_SigintHandler \
+     417             :        (int);
+     418             : NPY_NO_EXPORT  void* _PyArray_GetSigintBuf \
+     419             :        (void);
+     420             : NPY_NO_EXPORT  int PyArray_DescrAlignConverter \
+     421             :        (PyObject *, PyArray_Descr **);
+     422             : NPY_NO_EXPORT  int PyArray_DescrAlignConverter2 \
+     423             :        (PyObject *, PyArray_Descr **);
+     424             : NPY_NO_EXPORT  int PyArray_SearchsideConverter \
+     425             :        (PyObject *, void *);
+     426             : NPY_NO_EXPORT  PyObject * PyArray_CheckAxis \
+     427             :        (PyArrayObject *, int *, int);
+     428             : NPY_NO_EXPORT  npy_intp PyArray_OverflowMultiplyList \
+     429             :        (npy_intp const *, int);
+     430             : NPY_NO_EXPORT  int PyArray_CompareString \
+     431             :        (const char *, const char *, size_t);
+     432             : NPY_NO_EXPORT  PyObject* PyArray_MultiIterFromObjects \
+     433             :        (PyObject **, int, int, ...);
+     434             : NPY_NO_EXPORT  int PyArray_GetEndianness \
+     435             :        (void);
+     436             : NPY_NO_EXPORT  unsigned int PyArray_GetNDArrayCFeatureVersion \
+     437             :        (void);
+     438             : NPY_NO_EXPORT  PyObject * PyArray_Correlate2 \
+     439             :        (PyObject *, PyObject *, int);
+     440             : NPY_NO_EXPORT  PyObject* PyArray_NeighborhoodIterNew \
+     441             :        (PyArrayIterObject *, const npy_intp *, int, PyArrayObject*);
+     442             : extern NPY_NO_EXPORT PyTypeObject PyTimeIntegerArrType_Type;
+     443             : 
+     444             : extern NPY_NO_EXPORT PyTypeObject PyDatetimeArrType_Type;
+     445             : 
+     446             : extern NPY_NO_EXPORT PyTypeObject PyTimedeltaArrType_Type;
+     447             : 
+     448             : extern NPY_NO_EXPORT PyTypeObject PyHalfArrType_Type;
+     449             : 
+     450             : extern NPY_NO_EXPORT PyTypeObject NpyIter_Type;
+     451             : 
+     452             : NPY_NO_EXPORT  void PyArray_SetDatetimeParseFunction \
+     453             :        (PyObject *NPY_UNUSED(op));
+     454             : NPY_NO_EXPORT  void PyArray_DatetimeToDatetimeStruct \
+     455             :        (npy_datetime NPY_UNUSED(val), NPY_DATETIMEUNIT NPY_UNUSED(fr), npy_datetimestruct *);
+     456             : NPY_NO_EXPORT  void PyArray_TimedeltaToTimedeltaStruct \
+     457             :        (npy_timedelta NPY_UNUSED(val), NPY_DATETIMEUNIT NPY_UNUSED(fr), npy_timedeltastruct *);
+     458             : NPY_NO_EXPORT  npy_datetime PyArray_DatetimeStructToDatetime \
+     459             :        (NPY_DATETIMEUNIT NPY_UNUSED(fr), npy_datetimestruct *NPY_UNUSED(d));
+     460             : NPY_NO_EXPORT  npy_datetime PyArray_TimedeltaStructToTimedelta \
+     461             :        (NPY_DATETIMEUNIT NPY_UNUSED(fr), npy_timedeltastruct *NPY_UNUSED(d));
+     462             : NPY_NO_EXPORT  NpyIter * NpyIter_New \
+     463             :        (PyArrayObject *, npy_uint32, NPY_ORDER, NPY_CASTING, PyArray_Descr*);
+     464             : NPY_NO_EXPORT  NpyIter * NpyIter_MultiNew \
+     465             :        (int, PyArrayObject **, npy_uint32, NPY_ORDER, NPY_CASTING, npy_uint32 *, PyArray_Descr **);
+     466             : NPY_NO_EXPORT  NpyIter * NpyIter_AdvancedNew \
+     467             :        (int, PyArrayObject **, npy_uint32, NPY_ORDER, NPY_CASTING, npy_uint32 *, PyArray_Descr **, int, int **, npy_intp *, npy_intp);
+     468             : NPY_NO_EXPORT  NpyIter * NpyIter_Copy \
+     469             :        (NpyIter *);
+     470             : NPY_NO_EXPORT  int NpyIter_Deallocate \
+     471             :        (NpyIter *);
+     472             : NPY_NO_EXPORT  npy_bool NpyIter_HasDelayedBufAlloc \
+     473             :        (NpyIter *);
+     474             : NPY_NO_EXPORT  npy_bool NpyIter_HasExternalLoop \
+     475             :        (NpyIter *);
+     476             : NPY_NO_EXPORT  int NpyIter_EnableExternalLoop \
+     477             :        (NpyIter *);
+     478             : NPY_NO_EXPORT  npy_intp * NpyIter_GetInnerStrideArray \
+     479             :        (NpyIter *);
+     480             : NPY_NO_EXPORT  npy_intp * NpyIter_GetInnerLoopSizePtr \
+     481             :        (NpyIter *);
+     482             : NPY_NO_EXPORT  int NpyIter_Reset \
+     483             :        (NpyIter *, char **);
+     484             : NPY_NO_EXPORT  int NpyIter_ResetBasePointers \
+     485             :        (NpyIter *, char **, char **);
+     486             : NPY_NO_EXPORT  int NpyIter_ResetToIterIndexRange \
+     487             :        (NpyIter *, npy_intp, npy_intp, char **);
+     488             : NPY_NO_EXPORT  int NpyIter_GetNDim \
+     489             :        (NpyIter *);
+     490             : NPY_NO_EXPORT  int NpyIter_GetNOp \
+     491             :        (NpyIter *);
+     492             : NPY_NO_EXPORT  NpyIter_IterNextFunc * NpyIter_GetIterNext \
+     493             :        (NpyIter *, char **);
+     494             : NPY_NO_EXPORT  npy_intp NpyIter_GetIterSize \
+     495             :        (NpyIter *);
+     496             : NPY_NO_EXPORT  void NpyIter_GetIterIndexRange \
+     497             :        (NpyIter *, npy_intp *, npy_intp *);
+     498             : NPY_NO_EXPORT  npy_intp NpyIter_GetIterIndex \
+     499             :        (NpyIter *);
+     500             : NPY_NO_EXPORT  int NpyIter_GotoIterIndex \
+     501             :        (NpyIter *, npy_intp);
+     502             : NPY_NO_EXPORT  npy_bool NpyIter_HasMultiIndex \
+     503             :        (NpyIter *);
+     504             : NPY_NO_EXPORT  int NpyIter_GetShape \
+     505             :        (NpyIter *, npy_intp *);
+     506             : NPY_NO_EXPORT  NpyIter_GetMultiIndexFunc * NpyIter_GetGetMultiIndex \
+     507             :        (NpyIter *, char **);
+     508             : NPY_NO_EXPORT  int NpyIter_GotoMultiIndex \
+     509             :        (NpyIter *, npy_intp const *);
+     510             : NPY_NO_EXPORT  int NpyIter_RemoveMultiIndex \
+     511             :        (NpyIter *);
+     512             : NPY_NO_EXPORT  npy_bool NpyIter_HasIndex \
+     513             :        (NpyIter *);
+     514             : NPY_NO_EXPORT  npy_bool NpyIter_IsBuffered \
+     515             :        (NpyIter *);
+     516             : NPY_NO_EXPORT  npy_bool NpyIter_IsGrowInner \
+     517             :        (NpyIter *);
+     518             : NPY_NO_EXPORT  npy_intp NpyIter_GetBufferSize \
+     519             :        (NpyIter *);
+     520             : NPY_NO_EXPORT  npy_intp * NpyIter_GetIndexPtr \
+     521             :        (NpyIter *);
+     522             : NPY_NO_EXPORT  int NpyIter_GotoIndex \
+     523             :        (NpyIter *, npy_intp);
+     524             : NPY_NO_EXPORT  char ** NpyIter_GetDataPtrArray \
+     525             :        (NpyIter *);
+     526             : NPY_NO_EXPORT  PyArray_Descr ** NpyIter_GetDescrArray \
+     527             :        (NpyIter *);
+     528             : NPY_NO_EXPORT  PyArrayObject ** NpyIter_GetOperandArray \
+     529             :        (NpyIter *);
+     530             : NPY_NO_EXPORT  PyArrayObject * NpyIter_GetIterView \
+     531             :        (NpyIter *, npy_intp);
+     532             : NPY_NO_EXPORT  void NpyIter_GetReadFlags \
+     533             :        (NpyIter *, char *);
+     534             : NPY_NO_EXPORT  void NpyIter_GetWriteFlags \
+     535             :        (NpyIter *, char *);
+     536             : NPY_NO_EXPORT  void NpyIter_DebugPrint \
+     537             :        (NpyIter *);
+     538             : NPY_NO_EXPORT  npy_bool NpyIter_IterationNeedsAPI \
+     539             :        (NpyIter *);
+     540             : NPY_NO_EXPORT  void NpyIter_GetInnerFixedStrideArray \
+     541             :        (NpyIter *, npy_intp *);
+     542             : NPY_NO_EXPORT  int NpyIter_RemoveAxis \
+     543             :        (NpyIter *, int);
+     544             : NPY_NO_EXPORT  npy_intp * NpyIter_GetAxisStrideArray \
+     545             :        (NpyIter *, int);
+     546             : NPY_NO_EXPORT  npy_bool NpyIter_RequiresBuffering \
+     547             :        (NpyIter *);
+     548             : NPY_NO_EXPORT  char ** NpyIter_GetInitialDataPtrArray \
+     549             :        (NpyIter *);
+     550             : NPY_NO_EXPORT  int NpyIter_CreateCompatibleStrides \
+     551             :        (NpyIter *, npy_intp, npy_intp *);
+     552             : NPY_NO_EXPORT  int PyArray_CastingConverter \
+     553             :        (PyObject *, NPY_CASTING *);
+     554             : NPY_NO_EXPORT  npy_intp PyArray_CountNonzero \
+     555             :        (PyArrayObject *);
+     556             : NPY_NO_EXPORT  PyArray_Descr * PyArray_PromoteTypes \
+     557             :        (PyArray_Descr *, PyArray_Descr *);
+     558             : NPY_NO_EXPORT  PyArray_Descr * PyArray_MinScalarType \
+     559             :        (PyArrayObject *);
+     560             : NPY_NO_EXPORT  PyArray_Descr * PyArray_ResultType \
+     561             :        (npy_intp, PyArrayObject *arrs[], npy_intp, PyArray_Descr *descrs[]);
+     562             : NPY_NO_EXPORT  npy_bool PyArray_CanCastArrayTo \
+     563             :        (PyArrayObject *, PyArray_Descr *, NPY_CASTING);
+     564             : NPY_NO_EXPORT  npy_bool PyArray_CanCastTypeTo \
+     565             :        (PyArray_Descr *, PyArray_Descr *, NPY_CASTING);
+     566             : NPY_NO_EXPORT  PyArrayObject * PyArray_EinsteinSum \
+     567             :        (char *, npy_intp, PyArrayObject **, PyArray_Descr *, NPY_ORDER, NPY_CASTING, PyArrayObject *);
+     568             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(3) PyObject * PyArray_NewLikeArray \
+     569             :        (PyArrayObject *, NPY_ORDER, PyArray_Descr *, int);
+     570             : NPY_NO_EXPORT  int PyArray_GetArrayParamsFromObject \
+     571             :        (PyObject *NPY_UNUSED(op), PyArray_Descr *NPY_UNUSED(requested_dtype), npy_bool NPY_UNUSED(writeable), PyArray_Descr **NPY_UNUSED(out_dtype), int *NPY_UNUSED(out_ndim), npy_intp *NPY_UNUSED(out_dims), PyArrayObject **NPY_UNUSED(out_arr), PyObject *NPY_UNUSED(context));
+     572             : NPY_NO_EXPORT  int PyArray_ConvertClipmodeSequence \
+     573             :        (PyObject *, NPY_CLIPMODE *, int);
+     574             : NPY_NO_EXPORT  PyObject * PyArray_MatrixProduct2 \
+     575             :        (PyObject *, PyObject *, PyArrayObject*);
+     576             : NPY_NO_EXPORT  npy_bool NpyIter_IsFirstVisit \
+     577             :        (NpyIter *, int);
+     578             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) int PyArray_SetBaseObject \
+     579             :        (PyArrayObject *, PyObject *);
+     580             : NPY_NO_EXPORT  void PyArray_CreateSortedStridePerm \
+     581             :        (int, npy_intp const *, npy_stride_sort_item *);
+     582             : NPY_NO_EXPORT  void PyArray_RemoveAxesInPlace \
+     583             :        (PyArrayObject *, const npy_bool *);
+     584             : NPY_NO_EXPORT  void PyArray_DebugPrint \
+     585             :        (PyArrayObject *);
+     586             : NPY_NO_EXPORT  int PyArray_FailUnlessWriteable \
+     587             :        (PyArrayObject *, const char *);
+     588             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) int PyArray_SetUpdateIfCopyBase \
+     589             :        (PyArrayObject *, PyArrayObject *);
+     590             : NPY_NO_EXPORT  void * PyDataMem_NEW \
+     591             :        (size_t);
+     592             : NPY_NO_EXPORT  void PyDataMem_FREE \
+     593             :        (void *);
+     594             : NPY_NO_EXPORT  void * PyDataMem_RENEW \
+     595             :        (void *, size_t);
+     596             : NPY_NO_EXPORT  PyDataMem_EventHookFunc * PyDataMem_SetEventHook \
+     597             :        (PyDataMem_EventHookFunc *, void *, void **);
+     598             : extern NPY_NO_EXPORT NPY_CASTING NPY_DEFAULT_ASSIGN_CASTING;
+     599             : 
+     600             : NPY_NO_EXPORT  void PyArray_MapIterSwapAxes \
+     601             :        (PyArrayMapIterObject *, PyArrayObject **, int);
+     602             : NPY_NO_EXPORT  PyObject * PyArray_MapIterArray \
+     603             :        (PyArrayObject *, PyObject *);
+     604             : NPY_NO_EXPORT  void PyArray_MapIterNext \
+     605             :        (PyArrayMapIterObject *);
+     606             : NPY_NO_EXPORT  int PyArray_Partition \
+     607             :        (PyArrayObject *, PyArrayObject *, int, NPY_SELECTKIND);
+     608             : NPY_NO_EXPORT  PyObject * PyArray_ArgPartition \
+     609             :        (PyArrayObject *, PyArrayObject *, int, NPY_SELECTKIND);
+     610             : NPY_NO_EXPORT  int PyArray_SelectkindConverter \
+     611             :        (PyObject *, NPY_SELECTKIND *);
+     612             : NPY_NO_EXPORT  void * PyDataMem_NEW_ZEROED \
+     613             :        (size_t, size_t);
+     614             : NPY_NO_EXPORT  int PyArray_CheckAnyScalarExact \
+     615             :        (PyObject *);
+     616             : NPY_NO_EXPORT  PyObject * PyArray_MapIterArrayCopyIfOverlap \
+     617             :        (PyArrayObject *, PyObject *, int, PyArrayObject *);
+     618             : NPY_NO_EXPORT  int PyArray_ResolveWritebackIfCopy \
+     619             :        (PyArrayObject *);
+     620             : NPY_NO_EXPORT  int PyArray_SetWritebackIfCopyBase \
+     621             :        (PyArrayObject *, PyArrayObject *);
+     622             : NPY_NO_EXPORT  PyObject * PyDataMem_SetHandler \
+     623             :        (PyObject *);
+     624             : NPY_NO_EXPORT  PyObject * PyDataMem_GetHandler \
+     625             :        (void);
+     626             : extern NPY_NO_EXPORT PyObject* PyDataMem_DefaultHandler;
+     627             : 
+     628             : 
+     629             : #else
+     630             : 
+     631             : #if defined(PY_ARRAY_UNIQUE_SYMBOL)
+     632             : #define PyArray_API PY_ARRAY_UNIQUE_SYMBOL
+     633             : #endif
+     634             : 
+     635             : #if defined(NO_IMPORT) || defined(NO_IMPORT_ARRAY)
+     636             : extern void **PyArray_API;
+     637             : #else
+     638             : #if defined(PY_ARRAY_UNIQUE_SYMBOL)
+     639             : void **PyArray_API;
+     640             : #else
+     641             : static void **PyArray_API=NULL;
+     642             : #endif
+     643             : #endif
+     644             : 
+     645             : #define PyArray_GetNDArrayCVersion \
+     646             :         (*(unsigned int (*)(void)) \
+     647             :     PyArray_API[0])
+     648             : #define PyBigArray_Type (*(PyTypeObject *)PyArray_API[1])
+     649             : #define PyArray_Type (*(PyTypeObject *)PyArray_API[2])
+     650             : #define PyArrayDescr_Type (*(PyTypeObject *)PyArray_API[3])
+     651             : #define PyArrayFlags_Type (*(PyTypeObject *)PyArray_API[4])
+     652             : #define PyArrayIter_Type (*(PyTypeObject *)PyArray_API[5])
+     653             : #define PyArrayMultiIter_Type (*(PyTypeObject *)PyArray_API[6])
+     654             : #define NPY_NUMUSERTYPES (*(int *)PyArray_API[7])
+     655             : #define PyBoolArrType_Type (*(PyTypeObject *)PyArray_API[8])
+     656             : #define _PyArrayScalar_BoolValues ((PyBoolScalarObject *)PyArray_API[9])
+     657             : #define PyGenericArrType_Type (*(PyTypeObject *)PyArray_API[10])
+     658             : #define PyNumberArrType_Type (*(PyTypeObject *)PyArray_API[11])
+     659             : #define PyIntegerArrType_Type (*(PyTypeObject *)PyArray_API[12])
+     660             : #define PySignedIntegerArrType_Type (*(PyTypeObject *)PyArray_API[13])
+     661             : #define PyUnsignedIntegerArrType_Type (*(PyTypeObject *)PyArray_API[14])
+     662             : #define PyInexactArrType_Type (*(PyTypeObject *)PyArray_API[15])
+     663             : #define PyFloatingArrType_Type (*(PyTypeObject *)PyArray_API[16])
+     664             : #define PyComplexFloatingArrType_Type (*(PyTypeObject *)PyArray_API[17])
+     665             : #define PyFlexibleArrType_Type (*(PyTypeObject *)PyArray_API[18])
+     666             : #define PyCharacterArrType_Type (*(PyTypeObject *)PyArray_API[19])
+     667             : #define PyByteArrType_Type (*(PyTypeObject *)PyArray_API[20])
+     668             : #define PyShortArrType_Type (*(PyTypeObject *)PyArray_API[21])
+     669             : #define PyIntArrType_Type (*(PyTypeObject *)PyArray_API[22])
+     670             : #define PyLongArrType_Type (*(PyTypeObject *)PyArray_API[23])
+     671             : #define PyLongLongArrType_Type (*(PyTypeObject *)PyArray_API[24])
+     672             : #define PyUByteArrType_Type (*(PyTypeObject *)PyArray_API[25])
+     673             : #define PyUShortArrType_Type (*(PyTypeObject *)PyArray_API[26])
+     674             : #define PyUIntArrType_Type (*(PyTypeObject *)PyArray_API[27])
+     675             : #define PyULongArrType_Type (*(PyTypeObject *)PyArray_API[28])
+     676             : #define PyULongLongArrType_Type (*(PyTypeObject *)PyArray_API[29])
+     677             : #define PyFloatArrType_Type (*(PyTypeObject *)PyArray_API[30])
+     678             : #define PyDoubleArrType_Type (*(PyTypeObject *)PyArray_API[31])
+     679             : #define PyLongDoubleArrType_Type (*(PyTypeObject *)PyArray_API[32])
+     680             : #define PyCFloatArrType_Type (*(PyTypeObject *)PyArray_API[33])
+     681             : #define PyCDoubleArrType_Type (*(PyTypeObject *)PyArray_API[34])
+     682             : #define PyCLongDoubleArrType_Type (*(PyTypeObject *)PyArray_API[35])
+     683             : #define PyObjectArrType_Type (*(PyTypeObject *)PyArray_API[36])
+     684             : #define PyStringArrType_Type (*(PyTypeObject *)PyArray_API[37])
+     685             : #define PyUnicodeArrType_Type (*(PyTypeObject *)PyArray_API[38])
+     686             : #define PyVoidArrType_Type (*(PyTypeObject *)PyArray_API[39])
+     687             : #define PyArray_SetNumericOps \
+     688             :         (*(int (*)(PyObject *)) \
+     689             :     PyArray_API[40])
+     690             : #define PyArray_GetNumericOps \
+     691             :         (*(PyObject * (*)(void)) \
+     692             :     PyArray_API[41])
+     693             : #define PyArray_INCREF \
+     694             :         (*(int (*)(PyArrayObject *)) \
+     695             :     PyArray_API[42])
+     696             : #define PyArray_XDECREF \
+     697             :         (*(int (*)(PyArrayObject *)) \
+     698             :     PyArray_API[43])
+     699             : #define PyArray_SetStringFunction \
+     700             :         (*(void (*)(PyObject *, int)) \
+     701             :     PyArray_API[44])
+     702             : #define PyArray_DescrFromType \
+     703             :         (*(PyArray_Descr * (*)(int)) \
+     704             :     PyArray_API[45])
+     705             : #define PyArray_TypeObjectFromType \
+     706             :         (*(PyObject * (*)(int)) \
+     707             :     PyArray_API[46])
+     708             : #define PyArray_Zero \
+     709             :         (*(char * (*)(PyArrayObject *)) \
+     710             :     PyArray_API[47])
+     711             : #define PyArray_One \
+     712             :         (*(char * (*)(PyArrayObject *)) \
+     713             :     PyArray_API[48])
+     714             : #define PyArray_CastToType \
+     715             :         (*(PyObject * (*)(PyArrayObject *, PyArray_Descr *, int)) \
+     716             :     PyArray_API[49])
+     717             : #define PyArray_CastTo \
+     718             :         (*(int (*)(PyArrayObject *, PyArrayObject *)) \
+     719             :     PyArray_API[50])
+     720             : #define PyArray_CastAnyTo \
+     721             :         (*(int (*)(PyArrayObject *, PyArrayObject *)) \
+     722             :     PyArray_API[51])
+     723             : #define PyArray_CanCastSafely \
+     724             :         (*(int (*)(int, int)) \
+     725             :     PyArray_API[52])
+     726             : #define PyArray_CanCastTo \
+     727             :         (*(npy_bool (*)(PyArray_Descr *, PyArray_Descr *)) \
+     728             :     PyArray_API[53])
+     729             : #define PyArray_ObjectType \
+     730             :         (*(int (*)(PyObject *, int)) \
+     731             :     PyArray_API[54])
+     732             : #define PyArray_DescrFromObject \
+     733             :         (*(PyArray_Descr * (*)(PyObject *, PyArray_Descr *)) \
+     734             :     PyArray_API[55])
+     735             : #define PyArray_ConvertToCommonType \
+     736             :         (*(PyArrayObject ** (*)(PyObject *, int *)) \
+     737             :     PyArray_API[56])
+     738             : #define PyArray_DescrFromScalar \
+     739             :         (*(PyArray_Descr * (*)(PyObject *)) \
+     740             :     PyArray_API[57])
+     741             : #define PyArray_DescrFromTypeObject \
+     742             :         (*(PyArray_Descr * (*)(PyObject *)) \
+     743             :     PyArray_API[58])
+     744             : #define PyArray_Size \
+     745             :         (*(npy_intp (*)(PyObject *)) \
+     746             :     PyArray_API[59])
+     747             : #define PyArray_Scalar \
+     748             :         (*(PyObject * (*)(void *, PyArray_Descr *, PyObject *)) \
+     749             :     PyArray_API[60])
+     750             : #define PyArray_FromScalar \
+     751             :         (*(PyObject * (*)(PyObject *, PyArray_Descr *)) \
+     752             :     PyArray_API[61])
+     753             : #define PyArray_ScalarAsCtype \
+     754             :         (*(void (*)(PyObject *, void *)) \
+     755             :     PyArray_API[62])
+     756             : #define PyArray_CastScalarToCtype \
+     757             :         (*(int (*)(PyObject *, void *, PyArray_Descr *)) \
+     758             :     PyArray_API[63])
+     759             : #define PyArray_CastScalarDirect \
+     760             :         (*(int (*)(PyObject *, PyArray_Descr *, void *, int)) \
+     761             :     PyArray_API[64])
+     762             : #define PyArray_ScalarFromObject \
+     763             :         (*(PyObject * (*)(PyObject *)) \
+     764             :     PyArray_API[65])
+     765             : #define PyArray_GetCastFunc \
+     766             :         (*(PyArray_VectorUnaryFunc * (*)(PyArray_Descr *, int)) \
+     767             :     PyArray_API[66])
+     768             : #define PyArray_FromDims \
+     769             :         (*(PyObject * (*)(int NPY_UNUSED(nd), int *NPY_UNUSED(d), int NPY_UNUSED(type))) \
+     770             :     PyArray_API[67])
+     771             : #define PyArray_FromDimsAndDataAndDescr \
+     772             :         (*(PyObject * (*)(int NPY_UNUSED(nd), int *NPY_UNUSED(d), PyArray_Descr *, char *NPY_UNUSED(data))) \
+     773             :     PyArray_API[68])
+     774             : #define PyArray_FromAny \
+     775             :         (*(PyObject * (*)(PyObject *, PyArray_Descr *, int, int, int, PyObject *)) \
+     776             :     PyArray_API[69])
+     777             : #define PyArray_EnsureArray \
+     778             :         (*(PyObject * (*)(PyObject *)) \
+     779             :     PyArray_API[70])
+     780             : #define PyArray_EnsureAnyArray \
+     781             :         (*(PyObject * (*)(PyObject *)) \
+     782             :     PyArray_API[71])
+     783             : #define PyArray_FromFile \
+     784             :         (*(PyObject * (*)(FILE *, PyArray_Descr *, npy_intp, char *)) \
+     785             :     PyArray_API[72])
+     786             : #define PyArray_FromString \
+     787             :         (*(PyObject * (*)(char *, npy_intp, PyArray_Descr *, npy_intp, char *)) \
+     788             :     PyArray_API[73])
+     789             : #define PyArray_FromBuffer \
+     790             :         (*(PyObject * (*)(PyObject *, PyArray_Descr *, npy_intp, npy_intp)) \
+     791             :     PyArray_API[74])
+     792             : #define PyArray_FromIter \
+     793             :         (*(PyObject * (*)(PyObject *, PyArray_Descr *, npy_intp)) \
+     794             :     PyArray_API[75])
+     795             : #define PyArray_Return \
+     796             :         (*(PyObject * (*)(PyArrayObject *)) \
+     797             :     PyArray_API[76])
+     798             : #define PyArray_GetField \
+     799             :         (*(PyObject * (*)(PyArrayObject *, PyArray_Descr *, int)) \
+     800             :     PyArray_API[77])
+     801             : #define PyArray_SetField \
+     802             :         (*(int (*)(PyArrayObject *, PyArray_Descr *, int, PyObject *)) \
+     803             :     PyArray_API[78])
+     804             : #define PyArray_Byteswap \
+     805             :         (*(PyObject * (*)(PyArrayObject *, npy_bool)) \
+     806             :     PyArray_API[79])
+     807             : #define PyArray_Resize \
+     808             :         (*(PyObject * (*)(PyArrayObject *, PyArray_Dims *, int, NPY_ORDER NPY_UNUSED(order))) \
+     809             :     PyArray_API[80])
+     810             : #define PyArray_MoveInto \
+     811             :         (*(int (*)(PyArrayObject *, PyArrayObject *)) \
+     812             :     PyArray_API[81])
+     813             : #define PyArray_CopyInto \
+     814             :         (*(int (*)(PyArrayObject *, PyArrayObject *)) \
+     815             :     PyArray_API[82])
+     816             : #define PyArray_CopyAnyInto \
+     817             :         (*(int (*)(PyArrayObject *, PyArrayObject *)) \
+     818             :     PyArray_API[83])
+     819             : #define PyArray_CopyObject \
+     820             :         (*(int (*)(PyArrayObject *, PyObject *)) \
+     821             :     PyArray_API[84])
+     822             : #define PyArray_NewCopy \
+     823             :         (*(PyObject * (*)(PyArrayObject *, NPY_ORDER)) \
+     824             :     PyArray_API[85])
+     825             : #define PyArray_ToList \
+     826             :         (*(PyObject * (*)(PyArrayObject *)) \
+     827             :     PyArray_API[86])
+     828             : #define PyArray_ToString \
+     829             :         (*(PyObject * (*)(PyArrayObject *, NPY_ORDER)) \
+     830             :     PyArray_API[87])
+     831             : #define PyArray_ToFile \
+     832             :         (*(int (*)(PyArrayObject *, FILE *, char *, char *)) \
+     833             :     PyArray_API[88])
+     834             : #define PyArray_Dump \
+     835             :         (*(int (*)(PyObject *, PyObject *, int)) \
+     836             :     PyArray_API[89])
+     837             : #define PyArray_Dumps \
+     838             :         (*(PyObject * (*)(PyObject *, int)) \
+     839             :     PyArray_API[90])
+     840             : #define PyArray_ValidType \
+     841             :         (*(int (*)(int)) \
+     842             :     PyArray_API[91])
+     843             : #define PyArray_UpdateFlags \
+     844             :         (*(void (*)(PyArrayObject *, int)) \
+     845             :     PyArray_API[92])
+     846             : #define PyArray_New \
+     847             :         (*(PyObject * (*)(PyTypeObject *, int, npy_intp const *, int, npy_intp const *, void *, int, int, PyObject *)) \
+     848             :     PyArray_API[93])
+     849             : #define PyArray_NewFromDescr \
+     850             :         (*(PyObject * (*)(PyTypeObject *, PyArray_Descr *, int, npy_intp const *, npy_intp const *, void *, int, PyObject *)) \
+     851             :     PyArray_API[94])
+     852             : #define PyArray_DescrNew \
+     853             :         (*(PyArray_Descr * (*)(PyArray_Descr *)) \
+     854             :     PyArray_API[95])
+     855             : #define PyArray_DescrNewFromType \
+     856             :         (*(PyArray_Descr * (*)(int)) \
+     857             :     PyArray_API[96])
+     858             : #define PyArray_GetPriority \
+     859             :         (*(double (*)(PyObject *, double)) \
+     860             :     PyArray_API[97])
+     861             : #define PyArray_IterNew \
+     862             :         (*(PyObject * (*)(PyObject *)) \
+     863             :     PyArray_API[98])
+     864             : #define PyArray_MultiIterNew \
+     865             :         (*(PyObject* (*)(int, ...)) \
+     866             :     PyArray_API[99])
+     867             : #define PyArray_PyIntAsInt \
+     868             :         (*(int (*)(PyObject *)) \
+     869             :     PyArray_API[100])
+     870             : #define PyArray_PyIntAsIntp \
+     871             :         (*(npy_intp (*)(PyObject *)) \
+     872             :     PyArray_API[101])
+     873             : #define PyArray_Broadcast \
+     874             :         (*(int (*)(PyArrayMultiIterObject *)) \
+     875             :     PyArray_API[102])
+     876             : #define PyArray_FillObjectArray \
+     877             :         (*(void (*)(PyArrayObject *, PyObject *)) \
+     878             :     PyArray_API[103])
+     879             : #define PyArray_FillWithScalar \
+     880             :         (*(int (*)(PyArrayObject *, PyObject *)) \
+     881             :     PyArray_API[104])
+     882             : #define PyArray_CheckStrides \
+     883             :         (*(npy_bool (*)(int, int, npy_intp, npy_intp, npy_intp const *, npy_intp const *)) \
+     884             :     PyArray_API[105])
+     885             : #define PyArray_DescrNewByteorder \
+     886             :         (*(PyArray_Descr * (*)(PyArray_Descr *, char)) \
+     887             :     PyArray_API[106])
+     888             : #define PyArray_IterAllButAxis \
+     889             :         (*(PyObject * (*)(PyObject *, int *)) \
+     890             :     PyArray_API[107])
+     891             : #define PyArray_CheckFromAny \
+     892             :         (*(PyObject * (*)(PyObject *, PyArray_Descr *, int, int, int, PyObject *)) \
+     893             :     PyArray_API[108])
+     894             : #define PyArray_FromArray \
+     895             :         (*(PyObject * (*)(PyArrayObject *, PyArray_Descr *, int)) \
+     896             :     PyArray_API[109])
+     897             : #define PyArray_FromInterface \
+     898             :         (*(PyObject * (*)(PyObject *)) \
+     899             :     PyArray_API[110])
+     900             : #define PyArray_FromStructInterface \
+     901             :         (*(PyObject * (*)(PyObject *)) \
+     902             :     PyArray_API[111])
+     903             : #define PyArray_FromArrayAttr \
+     904             :         (*(PyObject * (*)(PyObject *, PyArray_Descr *, PyObject *)) \
+     905             :     PyArray_API[112])
+     906             : #define PyArray_ScalarKind \
+     907             :         (*(NPY_SCALARKIND (*)(int, PyArrayObject **)) \
+     908             :     PyArray_API[113])
+     909             : #define PyArray_CanCoerceScalar \
+     910             :         (*(int (*)(int, int, NPY_SCALARKIND)) \
+     911             :     PyArray_API[114])
+     912             : #define PyArray_NewFlagsObject \
+     913             :         (*(PyObject * (*)(PyObject *)) \
+     914             :     PyArray_API[115])
+     915             : #define PyArray_CanCastScalar \
+     916             :         (*(npy_bool (*)(PyTypeObject *, PyTypeObject *)) \
+     917             :     PyArray_API[116])
+     918             : #define PyArray_CompareUCS4 \
+     919             :         (*(int (*)(npy_ucs4 const *, npy_ucs4 const *, size_t)) \
+     920             :     PyArray_API[117])
+     921             : #define PyArray_RemoveSmallest \
+     922             :         (*(int (*)(PyArrayMultiIterObject *)) \
+     923             :     PyArray_API[118])
+     924             : #define PyArray_ElementStrides \
+     925             :         (*(int (*)(PyObject *)) \
+     926             :     PyArray_API[119])
+     927             : #define PyArray_Item_INCREF \
+     928             :         (*(void (*)(char *, PyArray_Descr *)) \
+     929             :     PyArray_API[120])
+     930             : #define PyArray_Item_XDECREF \
+     931             :         (*(void (*)(char *, PyArray_Descr *)) \
+     932             :     PyArray_API[121])
+     933             : #define PyArray_FieldNames \
+     934             :         (*(PyObject * (*)(PyObject *)) \
+     935             :     PyArray_API[122])
+     936             : #define PyArray_Transpose \
+     937             :         (*(PyObject * (*)(PyArrayObject *, PyArray_Dims *)) \
+     938             :     PyArray_API[123])
+     939             : #define PyArray_TakeFrom \
+     940             :         (*(PyObject * (*)(PyArrayObject *, PyObject *, int, PyArrayObject *, NPY_CLIPMODE)) \
+     941             :     PyArray_API[124])
+     942             : #define PyArray_PutTo \
+     943             :         (*(PyObject * (*)(PyArrayObject *, PyObject*, PyObject *, NPY_CLIPMODE)) \
+     944             :     PyArray_API[125])
+     945             : #define PyArray_PutMask \
+     946             :         (*(PyObject * (*)(PyArrayObject *, PyObject*, PyObject*)) \
+     947             :     PyArray_API[126])
+     948             : #define PyArray_Repeat \
+     949             :         (*(PyObject * (*)(PyArrayObject *, PyObject *, int)) \
+     950             :     PyArray_API[127])
+     951             : #define PyArray_Choose \
+     952             :         (*(PyObject * (*)(PyArrayObject *, PyObject *, PyArrayObject *, NPY_CLIPMODE)) \
+     953             :     PyArray_API[128])
+     954             : #define PyArray_Sort \
+     955             :         (*(int (*)(PyArrayObject *, int, NPY_SORTKIND)) \
+     956             :     PyArray_API[129])
+     957             : #define PyArray_ArgSort \
+     958             :         (*(PyObject * (*)(PyArrayObject *, int, NPY_SORTKIND)) \
+     959             :     PyArray_API[130])
+     960             : #define PyArray_SearchSorted \
+     961             :         (*(PyObject * (*)(PyArrayObject *, PyObject *, NPY_SEARCHSIDE, PyObject *)) \
+     962             :     PyArray_API[131])
+     963             : #define PyArray_ArgMax \
+     964             :         (*(PyObject * (*)(PyArrayObject *, int, PyArrayObject *)) \
+     965             :     PyArray_API[132])
+     966             : #define PyArray_ArgMin \
+     967             :         (*(PyObject * (*)(PyArrayObject *, int, PyArrayObject *)) \
+     968             :     PyArray_API[133])
+     969             : #define PyArray_Reshape \
+     970             :         (*(PyObject * (*)(PyArrayObject *, PyObject *)) \
+     971             :     PyArray_API[134])
+     972             : #define PyArray_Newshape \
+     973             :         (*(PyObject * (*)(PyArrayObject *, PyArray_Dims *, NPY_ORDER)) \
+     974             :     PyArray_API[135])
+     975             : #define PyArray_Squeeze \
+     976             :         (*(PyObject * (*)(PyArrayObject *)) \
+     977             :     PyArray_API[136])
+     978             : #define PyArray_View \
+     979             :         (*(PyObject * (*)(PyArrayObject *, PyArray_Descr *, PyTypeObject *)) \
+     980             :     PyArray_API[137])
+     981             : #define PyArray_SwapAxes \
+     982             :         (*(PyObject * (*)(PyArrayObject *, int, int)) \
+     983             :     PyArray_API[138])
+     984             : #define PyArray_Max \
+     985             :         (*(PyObject * (*)(PyArrayObject *, int, PyArrayObject *)) \
+     986             :     PyArray_API[139])
+     987             : #define PyArray_Min \
+     988             :         (*(PyObject * (*)(PyArrayObject *, int, PyArrayObject *)) \
+     989             :     PyArray_API[140])
+     990             : #define PyArray_Ptp \
+     991             :         (*(PyObject * (*)(PyArrayObject *, int, PyArrayObject *)) \
+     992             :     PyArray_API[141])
+     993             : #define PyArray_Mean \
+     994             :         (*(PyObject * (*)(PyArrayObject *, int, int, PyArrayObject *)) \
+     995             :     PyArray_API[142])
+     996             : #define PyArray_Trace \
+     997             :         (*(PyObject * (*)(PyArrayObject *, int, int, int, int, PyArrayObject *)) \
+     998             :     PyArray_API[143])
+     999             : #define PyArray_Diagonal \
+    1000             :         (*(PyObject * (*)(PyArrayObject *, int, int, int)) \
+    1001             :     PyArray_API[144])
+    1002             : #define PyArray_Clip \
+    1003             :         (*(PyObject * (*)(PyArrayObject *, PyObject *, PyObject *, PyArrayObject *)) \
+    1004             :     PyArray_API[145])
+    1005             : #define PyArray_Conjugate \
+    1006             :         (*(PyObject * (*)(PyArrayObject *, PyArrayObject *)) \
+    1007             :     PyArray_API[146])
+    1008             : #define PyArray_Nonzero \
+    1009             :         (*(PyObject * (*)(PyArrayObject *)) \
+    1010             :     PyArray_API[147])
+    1011             : #define PyArray_Std \
+    1012             :         (*(PyObject * (*)(PyArrayObject *, int, int, PyArrayObject *, int)) \
+    1013             :     PyArray_API[148])
+    1014             : #define PyArray_Sum \
+    1015             :         (*(PyObject * (*)(PyArrayObject *, int, int, PyArrayObject *)) \
+    1016             :     PyArray_API[149])
+    1017             : #define PyArray_CumSum \
+    1018             :         (*(PyObject * (*)(PyArrayObject *, int, int, PyArrayObject *)) \
+    1019             :     PyArray_API[150])
+    1020             : #define PyArray_Prod \
+    1021             :         (*(PyObject * (*)(PyArrayObject *, int, int, PyArrayObject *)) \
+    1022             :     PyArray_API[151])
+    1023             : #define PyArray_CumProd \
+    1024             :         (*(PyObject * (*)(PyArrayObject *, int, int, PyArrayObject *)) \
+    1025             :     PyArray_API[152])
+    1026             : #define PyArray_All \
+    1027             :         (*(PyObject * (*)(PyArrayObject *, int, PyArrayObject *)) \
+    1028             :     PyArray_API[153])
+    1029             : #define PyArray_Any \
+    1030             :         (*(PyObject * (*)(PyArrayObject *, int, PyArrayObject *)) \
+    1031             :     PyArray_API[154])
+    1032             : #define PyArray_Compress \
+    1033             :         (*(PyObject * (*)(PyArrayObject *, PyObject *, int, PyArrayObject *)) \
+    1034             :     PyArray_API[155])
+    1035             : #define PyArray_Flatten \
+    1036             :         (*(PyObject * (*)(PyArrayObject *, NPY_ORDER)) \
+    1037             :     PyArray_API[156])
+    1038             : #define PyArray_Ravel \
+    1039             :         (*(PyObject * (*)(PyArrayObject *, NPY_ORDER)) \
+    1040             :     PyArray_API[157])
+    1041             : #define PyArray_MultiplyList \
+    1042             :         (*(npy_intp (*)(npy_intp const *, int)) \
+    1043             :     PyArray_API[158])
+    1044             : #define PyArray_MultiplyIntList \
+    1045             :         (*(int (*)(int const *, int)) \
+    1046             :     PyArray_API[159])
+    1047             : #define PyArray_GetPtr \
+    1048             :         (*(void * (*)(PyArrayObject *, npy_intp const*)) \
+    1049             :     PyArray_API[160])
+    1050             : #define PyArray_CompareLists \
+    1051             :         (*(int (*)(npy_intp const *, npy_intp const *, int)) \
+    1052             :     PyArray_API[161])
+    1053             : #define PyArray_AsCArray \
+    1054             :         (*(int (*)(PyObject **, void *, npy_intp *, int, PyArray_Descr*)) \
+    1055             :     PyArray_API[162])
+    1056             : #define PyArray_As1D \
+    1057             :         (*(int (*)(PyObject **NPY_UNUSED(op), char **NPY_UNUSED(ptr), int *NPY_UNUSED(d1), int NPY_UNUSED(typecode))) \
+    1058             :     PyArray_API[163])
+    1059             : #define PyArray_As2D \
+    1060             :         (*(int (*)(PyObject **NPY_UNUSED(op), char ***NPY_UNUSED(ptr), int *NPY_UNUSED(d1), int *NPY_UNUSED(d2), int NPY_UNUSED(typecode))) \
+    1061             :     PyArray_API[164])
+    1062             : #define PyArray_Free \
+    1063             :         (*(int (*)(PyObject *, void *)) \
+    1064             :     PyArray_API[165])
+    1065             : #define PyArray_Converter \
+    1066             :         (*(int (*)(PyObject *, PyObject **)) \
+    1067             :     PyArray_API[166])
+    1068             : #define PyArray_IntpFromSequence \
+    1069             :         (*(int (*)(PyObject *, npy_intp *, int)) \
+    1070             :     PyArray_API[167])
+    1071             : #define PyArray_Concatenate \
+    1072             :         (*(PyObject * (*)(PyObject *, int)) \
+    1073             :     PyArray_API[168])
+    1074             : #define PyArray_InnerProduct \
+    1075             :         (*(PyObject * (*)(PyObject *, PyObject *)) \
+    1076             :     PyArray_API[169])
+    1077             : #define PyArray_MatrixProduct \
+    1078             :         (*(PyObject * (*)(PyObject *, PyObject *)) \
+    1079             :     PyArray_API[170])
+    1080             : #define PyArray_CopyAndTranspose \
+    1081             :         (*(PyObject * (*)(PyObject *)) \
+    1082             :     PyArray_API[171])
+    1083             : #define PyArray_Correlate \
+    1084             :         (*(PyObject * (*)(PyObject *, PyObject *, int)) \
+    1085             :     PyArray_API[172])
+    1086             : #define PyArray_TypestrConvert \
+    1087             :         (*(int (*)(int, int)) \
+    1088             :     PyArray_API[173])
+    1089             : #define PyArray_DescrConverter \
+    1090             :         (*(int (*)(PyObject *, PyArray_Descr **)) \
+    1091             :     PyArray_API[174])
+    1092             : #define PyArray_DescrConverter2 \
+    1093             :         (*(int (*)(PyObject *, PyArray_Descr **)) \
+    1094             :     PyArray_API[175])
+    1095             : #define PyArray_IntpConverter \
+    1096             :         (*(int (*)(PyObject *, PyArray_Dims *)) \
+    1097             :     PyArray_API[176])
+    1098             : #define PyArray_BufferConverter \
+    1099             :         (*(int (*)(PyObject *, PyArray_Chunk *)) \
+    1100             :     PyArray_API[177])
+    1101             : #define PyArray_AxisConverter \
+    1102             :         (*(int (*)(PyObject *, int *)) \
+    1103             :     PyArray_API[178])
+    1104             : #define PyArray_BoolConverter \
+    1105             :         (*(int (*)(PyObject *, npy_bool *)) \
+    1106             :     PyArray_API[179])
+    1107             : #define PyArray_ByteorderConverter \
+    1108             :         (*(int (*)(PyObject *, char *)) \
+    1109             :     PyArray_API[180])
+    1110             : #define PyArray_OrderConverter \
+    1111             :         (*(int (*)(PyObject *, NPY_ORDER *)) \
+    1112             :     PyArray_API[181])
+    1113             : #define PyArray_EquivTypes \
+    1114             :         (*(unsigned char (*)(PyArray_Descr *, PyArray_Descr *)) \
+    1115             :     PyArray_API[182])
+    1116             : #define PyArray_Zeros \
+    1117             :         (*(PyObject * (*)(int, npy_intp const *, PyArray_Descr *, int)) \
+    1118             :     PyArray_API[183])
+    1119             : #define PyArray_Empty \
+    1120             :         (*(PyObject * (*)(int, npy_intp const *, PyArray_Descr *, int)) \
+    1121             :     PyArray_API[184])
+    1122             : #define PyArray_Where \
+    1123             :         (*(PyObject * (*)(PyObject *, PyObject *, PyObject *)) \
+    1124             :     PyArray_API[185])
+    1125             : #define PyArray_Arange \
+    1126             :         (*(PyObject * (*)(double, double, double, int)) \
+    1127             :     PyArray_API[186])
+    1128             : #define PyArray_ArangeObj \
+    1129             :         (*(PyObject * (*)(PyObject *, PyObject *, PyObject *, PyArray_Descr *)) \
+    1130             :     PyArray_API[187])
+    1131             : #define PyArray_SortkindConverter \
+    1132             :         (*(int (*)(PyObject *, NPY_SORTKIND *)) \
+    1133             :     PyArray_API[188])
+    1134             : #define PyArray_LexSort \
+    1135             :         (*(PyObject * (*)(PyObject *, int)) \
+    1136             :     PyArray_API[189])
+    1137             : #define PyArray_Round \
+    1138             :         (*(PyObject * (*)(PyArrayObject *, int, PyArrayObject *)) \
+    1139             :     PyArray_API[190])
+    1140             : #define PyArray_EquivTypenums \
+    1141             :         (*(unsigned char (*)(int, int)) \
+    1142             :     PyArray_API[191])
+    1143             : #define PyArray_RegisterDataType \
+    1144             :         (*(int (*)(PyArray_Descr *)) \
+    1145             :     PyArray_API[192])
+    1146             : #define PyArray_RegisterCastFunc \
+    1147             :         (*(int (*)(PyArray_Descr *, int, PyArray_VectorUnaryFunc *)) \
+    1148             :     PyArray_API[193])
+    1149             : #define PyArray_RegisterCanCast \
+    1150             :         (*(int (*)(PyArray_Descr *, int, NPY_SCALARKIND)) \
+    1151             :     PyArray_API[194])
+    1152             : #define PyArray_InitArrFuncs \
+    1153             :         (*(void (*)(PyArray_ArrFuncs *)) \
+    1154             :     PyArray_API[195])
+    1155             : #define PyArray_IntTupleFromIntp \
+    1156             :         (*(PyObject * (*)(int, npy_intp const *)) \
+    1157             :     PyArray_API[196])
+    1158             : #define PyArray_TypeNumFromName \
+    1159             :         (*(int (*)(char const *)) \
+    1160             :     PyArray_API[197])
+    1161             : #define PyArray_ClipmodeConverter \
+    1162             :         (*(int (*)(PyObject *, NPY_CLIPMODE *)) \
+    1163             :     PyArray_API[198])
+    1164             : #define PyArray_OutputConverter \
+    1165             :         (*(int (*)(PyObject *, PyArrayObject **)) \
+    1166             :     PyArray_API[199])
+    1167             : #define PyArray_BroadcastToShape \
+    1168             :         (*(PyObject * (*)(PyObject *, npy_intp *, int)) \
+    1169             :     PyArray_API[200])
+    1170             : #define _PyArray_SigintHandler \
+    1171             :         (*(void (*)(int)) \
+    1172             :     PyArray_API[201])
+    1173             : #define _PyArray_GetSigintBuf \
+    1174             :         (*(void* (*)(void)) \
+    1175             :     PyArray_API[202])
+    1176             : #define PyArray_DescrAlignConverter \
+    1177             :         (*(int (*)(PyObject *, PyArray_Descr **)) \
+    1178             :     PyArray_API[203])
+    1179             : #define PyArray_DescrAlignConverter2 \
+    1180             :         (*(int (*)(PyObject *, PyArray_Descr **)) \
+    1181             :     PyArray_API[204])
+    1182             : #define PyArray_SearchsideConverter \
+    1183             :         (*(int (*)(PyObject *, void *)) \
+    1184             :     PyArray_API[205])
+    1185             : #define PyArray_CheckAxis \
+    1186             :         (*(PyObject * (*)(PyArrayObject *, int *, int)) \
+    1187             :     PyArray_API[206])
+    1188             : #define PyArray_OverflowMultiplyList \
+    1189             :         (*(npy_intp (*)(npy_intp const *, int)) \
+    1190             :     PyArray_API[207])
+    1191             : #define PyArray_CompareString \
+    1192             :         (*(int (*)(const char *, const char *, size_t)) \
+    1193             :     PyArray_API[208])
+    1194             : #define PyArray_MultiIterFromObjects \
+    1195             :         (*(PyObject* (*)(PyObject **, int, int, ...)) \
+    1196             :     PyArray_API[209])
+    1197             : #define PyArray_GetEndianness \
+    1198             :         (*(int (*)(void)) \
+    1199             :     PyArray_API[210])
+    1200             : #define PyArray_GetNDArrayCFeatureVersion \
+    1201             :         (*(unsigned int (*)(void)) \
+    1202             :     PyArray_API[211])
+    1203             : #define PyArray_Correlate2 \
+    1204             :         (*(PyObject * (*)(PyObject *, PyObject *, int)) \
+    1205             :     PyArray_API[212])
+    1206             : #define PyArray_NeighborhoodIterNew \
+    1207             :         (*(PyObject* (*)(PyArrayIterObject *, const npy_intp *, int, PyArrayObject*)) \
+    1208             :     PyArray_API[213])
+    1209             : #define PyTimeIntegerArrType_Type (*(PyTypeObject *)PyArray_API[214])
+    1210             : #define PyDatetimeArrType_Type (*(PyTypeObject *)PyArray_API[215])
+    1211             : #define PyTimedeltaArrType_Type (*(PyTypeObject *)PyArray_API[216])
+    1212             : #define PyHalfArrType_Type (*(PyTypeObject *)PyArray_API[217])
+    1213             : #define NpyIter_Type (*(PyTypeObject *)PyArray_API[218])
+    1214             : #define PyArray_SetDatetimeParseFunction \
+    1215             :         (*(void (*)(PyObject *NPY_UNUSED(op))) \
+    1216             :     PyArray_API[219])
+    1217             : #define PyArray_DatetimeToDatetimeStruct \
+    1218             :         (*(void (*)(npy_datetime NPY_UNUSED(val), NPY_DATETIMEUNIT NPY_UNUSED(fr), npy_datetimestruct *)) \
+    1219             :     PyArray_API[220])
+    1220             : #define PyArray_TimedeltaToTimedeltaStruct \
+    1221             :         (*(void (*)(npy_timedelta NPY_UNUSED(val), NPY_DATETIMEUNIT NPY_UNUSED(fr), npy_timedeltastruct *)) \
+    1222             :     PyArray_API[221])
+    1223             : #define PyArray_DatetimeStructToDatetime \
+    1224             :         (*(npy_datetime (*)(NPY_DATETIMEUNIT NPY_UNUSED(fr), npy_datetimestruct *NPY_UNUSED(d))) \
+    1225             :     PyArray_API[222])
+    1226             : #define PyArray_TimedeltaStructToTimedelta \
+    1227             :         (*(npy_datetime (*)(NPY_DATETIMEUNIT NPY_UNUSED(fr), npy_timedeltastruct *NPY_UNUSED(d))) \
+    1228             :     PyArray_API[223])
+    1229             : #define NpyIter_New \
+    1230             :         (*(NpyIter * (*)(PyArrayObject *, npy_uint32, NPY_ORDER, NPY_CASTING, PyArray_Descr*)) \
+    1231             :     PyArray_API[224])
+    1232             : #define NpyIter_MultiNew \
+    1233             :         (*(NpyIter * (*)(int, PyArrayObject **, npy_uint32, NPY_ORDER, NPY_CASTING, npy_uint32 *, PyArray_Descr **)) \
+    1234             :     PyArray_API[225])
+    1235             : #define NpyIter_AdvancedNew \
+    1236             :         (*(NpyIter * (*)(int, PyArrayObject **, npy_uint32, NPY_ORDER, NPY_CASTING, npy_uint32 *, PyArray_Descr **, int, int **, npy_intp *, npy_intp)) \
+    1237             :     PyArray_API[226])
+    1238             : #define NpyIter_Copy \
+    1239             :         (*(NpyIter * (*)(NpyIter *)) \
+    1240             :     PyArray_API[227])
+    1241             : #define NpyIter_Deallocate \
+    1242             :         (*(int (*)(NpyIter *)) \
+    1243             :     PyArray_API[228])
+    1244             : #define NpyIter_HasDelayedBufAlloc \
+    1245             :         (*(npy_bool (*)(NpyIter *)) \
+    1246             :     PyArray_API[229])
+    1247             : #define NpyIter_HasExternalLoop \
+    1248             :         (*(npy_bool (*)(NpyIter *)) \
+    1249             :     PyArray_API[230])
+    1250             : #define NpyIter_EnableExternalLoop \
+    1251             :         (*(int (*)(NpyIter *)) \
+    1252             :     PyArray_API[231])
+    1253             : #define NpyIter_GetInnerStrideArray \
+    1254             :         (*(npy_intp * (*)(NpyIter *)) \
+    1255             :     PyArray_API[232])
+    1256             : #define NpyIter_GetInnerLoopSizePtr \
+    1257             :         (*(npy_intp * (*)(NpyIter *)) \
+    1258             :     PyArray_API[233])
+    1259             : #define NpyIter_Reset \
+    1260             :         (*(int (*)(NpyIter *, char **)) \
+    1261             :     PyArray_API[234])
+    1262             : #define NpyIter_ResetBasePointers \
+    1263             :         (*(int (*)(NpyIter *, char **, char **)) \
+    1264             :     PyArray_API[235])
+    1265             : #define NpyIter_ResetToIterIndexRange \
+    1266             :         (*(int (*)(NpyIter *, npy_intp, npy_intp, char **)) \
+    1267             :     PyArray_API[236])
+    1268             : #define NpyIter_GetNDim \
+    1269             :         (*(int (*)(NpyIter *)) \
+    1270             :     PyArray_API[237])
+    1271             : #define NpyIter_GetNOp \
+    1272             :         (*(int (*)(NpyIter *)) \
+    1273             :     PyArray_API[238])
+    1274             : #define NpyIter_GetIterNext \
+    1275             :         (*(NpyIter_IterNextFunc * (*)(NpyIter *, char **)) \
+    1276             :     PyArray_API[239])
+    1277             : #define NpyIter_GetIterSize \
+    1278             :         (*(npy_intp (*)(NpyIter *)) \
+    1279             :     PyArray_API[240])
+    1280             : #define NpyIter_GetIterIndexRange \
+    1281             :         (*(void (*)(NpyIter *, npy_intp *, npy_intp *)) \
+    1282             :     PyArray_API[241])
+    1283             : #define NpyIter_GetIterIndex \
+    1284             :         (*(npy_intp (*)(NpyIter *)) \
+    1285             :     PyArray_API[242])
+    1286             : #define NpyIter_GotoIterIndex \
+    1287             :         (*(int (*)(NpyIter *, npy_intp)) \
+    1288             :     PyArray_API[243])
+    1289             : #define NpyIter_HasMultiIndex \
+    1290             :         (*(npy_bool (*)(NpyIter *)) \
+    1291             :     PyArray_API[244])
+    1292             : #define NpyIter_GetShape \
+    1293             :         (*(int (*)(NpyIter *, npy_intp *)) \
+    1294             :     PyArray_API[245])
+    1295             : #define NpyIter_GetGetMultiIndex \
+    1296             :         (*(NpyIter_GetMultiIndexFunc * (*)(NpyIter *, char **)) \
+    1297             :     PyArray_API[246])
+    1298             : #define NpyIter_GotoMultiIndex \
+    1299             :         (*(int (*)(NpyIter *, npy_intp const *)) \
+    1300             :     PyArray_API[247])
+    1301             : #define NpyIter_RemoveMultiIndex \
+    1302             :         (*(int (*)(NpyIter *)) \
+    1303             :     PyArray_API[248])
+    1304             : #define NpyIter_HasIndex \
+    1305             :         (*(npy_bool (*)(NpyIter *)) \
+    1306             :     PyArray_API[249])
+    1307             : #define NpyIter_IsBuffered \
+    1308             :         (*(npy_bool (*)(NpyIter *)) \
+    1309             :     PyArray_API[250])
+    1310             : #define NpyIter_IsGrowInner \
+    1311             :         (*(npy_bool (*)(NpyIter *)) \
+    1312             :     PyArray_API[251])
+    1313             : #define NpyIter_GetBufferSize \
+    1314             :         (*(npy_intp (*)(NpyIter *)) \
+    1315             :     PyArray_API[252])
+    1316             : #define NpyIter_GetIndexPtr \
+    1317             :         (*(npy_intp * (*)(NpyIter *)) \
+    1318             :     PyArray_API[253])
+    1319             : #define NpyIter_GotoIndex \
+    1320             :         (*(int (*)(NpyIter *, npy_intp)) \
+    1321             :     PyArray_API[254])
+    1322             : #define NpyIter_GetDataPtrArray \
+    1323             :         (*(char ** (*)(NpyIter *)) \
+    1324             :     PyArray_API[255])
+    1325             : #define NpyIter_GetDescrArray \
+    1326             :         (*(PyArray_Descr ** (*)(NpyIter *)) \
+    1327             :     PyArray_API[256])
+    1328             : #define NpyIter_GetOperandArray \
+    1329             :         (*(PyArrayObject ** (*)(NpyIter *)) \
+    1330             :     PyArray_API[257])
+    1331             : #define NpyIter_GetIterView \
+    1332             :         (*(PyArrayObject * (*)(NpyIter *, npy_intp)) \
+    1333             :     PyArray_API[258])
+    1334             : #define NpyIter_GetReadFlags \
+    1335             :         (*(void (*)(NpyIter *, char *)) \
+    1336             :     PyArray_API[259])
+    1337             : #define NpyIter_GetWriteFlags \
+    1338             :         (*(void (*)(NpyIter *, char *)) \
+    1339             :     PyArray_API[260])
+    1340             : #define NpyIter_DebugPrint \
+    1341             :         (*(void (*)(NpyIter *)) \
+    1342             :     PyArray_API[261])
+    1343             : #define NpyIter_IterationNeedsAPI \
+    1344             :         (*(npy_bool (*)(NpyIter *)) \
+    1345             :     PyArray_API[262])
+    1346             : #define NpyIter_GetInnerFixedStrideArray \
+    1347             :         (*(void (*)(NpyIter *, npy_intp *)) \
+    1348             :     PyArray_API[263])
+    1349             : #define NpyIter_RemoveAxis \
+    1350             :         (*(int (*)(NpyIter *, int)) \
+    1351             :     PyArray_API[264])
+    1352             : #define NpyIter_GetAxisStrideArray \
+    1353             :         (*(npy_intp * (*)(NpyIter *, int)) \
+    1354             :     PyArray_API[265])
+    1355             : #define NpyIter_RequiresBuffering \
+    1356             :         (*(npy_bool (*)(NpyIter *)) \
+    1357             :     PyArray_API[266])
+    1358             : #define NpyIter_GetInitialDataPtrArray \
+    1359             :         (*(char ** (*)(NpyIter *)) \
+    1360             :     PyArray_API[267])
+    1361             : #define NpyIter_CreateCompatibleStrides \
+    1362             :         (*(int (*)(NpyIter *, npy_intp, npy_intp *)) \
+    1363             :     PyArray_API[268])
+    1364             : #define PyArray_CastingConverter \
+    1365             :         (*(int (*)(PyObject *, NPY_CASTING *)) \
+    1366             :     PyArray_API[269])
+    1367             : #define PyArray_CountNonzero \
+    1368             :         (*(npy_intp (*)(PyArrayObject *)) \
+    1369             :     PyArray_API[270])
+    1370             : #define PyArray_PromoteTypes \
+    1371             :         (*(PyArray_Descr * (*)(PyArray_Descr *, PyArray_Descr *)) \
+    1372             :     PyArray_API[271])
+    1373             : #define PyArray_MinScalarType \
+    1374             :         (*(PyArray_Descr * (*)(PyArrayObject *)) \
+    1375             :     PyArray_API[272])
+    1376             : #define PyArray_ResultType \
+    1377             :         (*(PyArray_Descr * (*)(npy_intp, PyArrayObject *arrs[], npy_intp, PyArray_Descr *descrs[])) \
+    1378             :     PyArray_API[273])
+    1379             : #define PyArray_CanCastArrayTo \
+    1380             :         (*(npy_bool (*)(PyArrayObject *, PyArray_Descr *, NPY_CASTING)) \
+    1381             :     PyArray_API[274])
+    1382             : #define PyArray_CanCastTypeTo \
+    1383             :         (*(npy_bool (*)(PyArray_Descr *, PyArray_Descr *, NPY_CASTING)) \
+    1384             :     PyArray_API[275])
+    1385             : #define PyArray_EinsteinSum \
+    1386             :         (*(PyArrayObject * (*)(char *, npy_intp, PyArrayObject **, PyArray_Descr *, NPY_ORDER, NPY_CASTING, PyArrayObject *)) \
+    1387             :     PyArray_API[276])
+    1388             : #define PyArray_NewLikeArray \
+    1389             :         (*(PyObject * (*)(PyArrayObject *, NPY_ORDER, PyArray_Descr *, int)) \
+    1390             :     PyArray_API[277])
+    1391             : #define PyArray_GetArrayParamsFromObject \
+    1392             :         (*(int (*)(PyObject *NPY_UNUSED(op), PyArray_Descr *NPY_UNUSED(requested_dtype), npy_bool NPY_UNUSED(writeable), PyArray_Descr **NPY_UNUSED(out_dtype), int *NPY_UNUSED(out_ndim), npy_intp *NPY_UNUSED(out_dims), PyArrayObject **NPY_UNUSED(out_arr), PyObject *NPY_UNUSED(context))) \
+    1393             :     PyArray_API[278])
+    1394             : #define PyArray_ConvertClipmodeSequence \
+    1395             :         (*(int (*)(PyObject *, NPY_CLIPMODE *, int)) \
+    1396             :     PyArray_API[279])
+    1397             : #define PyArray_MatrixProduct2 \
+    1398             :         (*(PyObject * (*)(PyObject *, PyObject *, PyArrayObject*)) \
+    1399             :     PyArray_API[280])
+    1400             : #define NpyIter_IsFirstVisit \
+    1401             :         (*(npy_bool (*)(NpyIter *, int)) \
+    1402             :     PyArray_API[281])
+    1403             : #define PyArray_SetBaseObject \
+    1404             :         (*(int (*)(PyArrayObject *, PyObject *)) \
+    1405             :     PyArray_API[282])
+    1406             : #define PyArray_CreateSortedStridePerm \
+    1407             :         (*(void (*)(int, npy_intp const *, npy_stride_sort_item *)) \
+    1408             :     PyArray_API[283])
+    1409             : #define PyArray_RemoveAxesInPlace \
+    1410             :         (*(void (*)(PyArrayObject *, const npy_bool *)) \
+    1411             :     PyArray_API[284])
+    1412             : #define PyArray_DebugPrint \
+    1413             :         (*(void (*)(PyArrayObject *)) \
+    1414             :     PyArray_API[285])
+    1415             : #define PyArray_FailUnlessWriteable \
+    1416             :         (*(int (*)(PyArrayObject *, const char *)) \
+    1417             :     PyArray_API[286])
+    1418             : #define PyArray_SetUpdateIfCopyBase \
+    1419             :         (*(int (*)(PyArrayObject *, PyArrayObject *)) \
+    1420             :     PyArray_API[287])
+    1421             : #define PyDataMem_NEW \
+    1422             :         (*(void * (*)(size_t)) \
+    1423             :     PyArray_API[288])
+    1424             : #define PyDataMem_FREE \
+    1425             :         (*(void (*)(void *)) \
+    1426             :     PyArray_API[289])
+    1427             : #define PyDataMem_RENEW \
+    1428             :         (*(void * (*)(void *, size_t)) \
+    1429             :     PyArray_API[290])
+    1430             : #define PyDataMem_SetEventHook \
+    1431             :         (*(PyDataMem_EventHookFunc * (*)(PyDataMem_EventHookFunc *, void *, void **)) \
+    1432             :     PyArray_API[291])
+    1433             : #define NPY_DEFAULT_ASSIGN_CASTING (*(NPY_CASTING *)PyArray_API[292])
+    1434             : #define PyArray_MapIterSwapAxes \
+    1435             :         (*(void (*)(PyArrayMapIterObject *, PyArrayObject **, int)) \
+    1436             :     PyArray_API[293])
+    1437             : #define PyArray_MapIterArray \
+    1438             :         (*(PyObject * (*)(PyArrayObject *, PyObject *)) \
+    1439             :     PyArray_API[294])
+    1440             : #define PyArray_MapIterNext \
+    1441             :         (*(void (*)(PyArrayMapIterObject *)) \
+    1442             :     PyArray_API[295])
+    1443             : #define PyArray_Partition \
+    1444             :         (*(int (*)(PyArrayObject *, PyArrayObject *, int, NPY_SELECTKIND)) \
+    1445             :     PyArray_API[296])
+    1446             : #define PyArray_ArgPartition \
+    1447             :         (*(PyObject * (*)(PyArrayObject *, PyArrayObject *, int, NPY_SELECTKIND)) \
+    1448             :     PyArray_API[297])
+    1449             : #define PyArray_SelectkindConverter \
+    1450             :         (*(int (*)(PyObject *, NPY_SELECTKIND *)) \
+    1451             :     PyArray_API[298])
+    1452             : #define PyDataMem_NEW_ZEROED \
+    1453             :         (*(void * (*)(size_t, size_t)) \
+    1454             :     PyArray_API[299])
+    1455             : #define PyArray_CheckAnyScalarExact \
+    1456             :         (*(int (*)(PyObject *)) \
+    1457             :     PyArray_API[300])
+    1458             : #define PyArray_MapIterArrayCopyIfOverlap \
+    1459             :         (*(PyObject * (*)(PyArrayObject *, PyObject *, int, PyArrayObject *)) \
+    1460             :     PyArray_API[301])
+    1461             : #define PyArray_ResolveWritebackIfCopy \
+    1462             :         (*(int (*)(PyArrayObject *)) \
+    1463             :     PyArray_API[302])
+    1464             : #define PyArray_SetWritebackIfCopyBase \
+    1465             :         (*(int (*)(PyArrayObject *, PyArrayObject *)) \
+    1466             :     PyArray_API[303])
+    1467             : 
+    1468             : #if NPY_FEATURE_VERSION >= NPY_1_22_API_VERSION
+    1469             : #define PyDataMem_SetHandler \
+    1470             :         (*(PyObject * (*)(PyObject *)) \
+    1471             :     PyArray_API[304])
+    1472             : #endif
+    1473             : 
+    1474             : #if NPY_FEATURE_VERSION >= NPY_1_22_API_VERSION
+    1475             : #define PyDataMem_GetHandler \
+    1476             :         (*(PyObject * (*)(void)) \
+    1477             :     PyArray_API[305])
+    1478             : #endif
+    1479             : #define PyDataMem_DefaultHandler (*(PyObject* *)PyArray_API[306])
+    1480             : 
+    1481             : #if !defined(NO_IMPORT_ARRAY) && !defined(NO_IMPORT)
+    1482             : static int
+    1483           4 : _import_array(void)
+    1484             : {
+    1485             :   int st;
+    1486           4 :   PyObject *numpy = PyImport_ImportModule("numpy.core._multiarray_umath");
+    1487             :   PyObject *c_api = NULL;
+    1488             : 
+    1489           4 :   if (numpy == NULL) {
+    1490             :       return -1;
+    1491             :   }
+    1492           4 :   c_api = PyObject_GetAttrString(numpy, "_ARRAY_API");
+    1493             :   Py_DECREF(numpy);
+    1494           4 :   if (c_api == NULL) {
+    1495             :       return -1;
+    1496             :   }
+    1497             : 
+    1498           4 :   if (!PyCapsule_CheckExact(c_api)) {
+    1499           0 :       PyErr_SetString(PyExc_RuntimeError, "_ARRAY_API is not PyCapsule object");
+    1500             :       Py_DECREF(c_api);
+    1501           0 :       return -1;
+    1502             :   }
+    1503           4 :   PyArray_API = (void **)PyCapsule_GetPointer(c_api, NULL);
+    1504             :   Py_DECREF(c_api);
+    1505           4 :   if (PyArray_API == NULL) {
+    1506           0 :       PyErr_SetString(PyExc_RuntimeError, "_ARRAY_API is NULL pointer");
+    1507           0 :       return -1;
+    1508             :   }
+    1509             : 
+    1510             :   /* Perform runtime check of C API version */
+    1511           4 :   if (NPY_VERSION != PyArray_GetNDArrayCVersion()) {
+    1512           0 :       PyErr_Format(PyExc_RuntimeError, "module compiled against "\
+    1513             :              "ABI version 0x%x but this version of numpy is 0x%x", \
+    1514           0 :              (int) NPY_VERSION, (int) PyArray_GetNDArrayCVersion());
+    1515           0 :       return -1;
+    1516             :   }
+    1517           4 :   if (NPY_FEATURE_VERSION > PyArray_GetNDArrayCFeatureVersion()) {
+    1518           0 :       PyErr_Format(PyExc_RuntimeError, "module compiled against "\
+    1519             :              "API version 0x%x but this version of numpy is 0x%x . "\
+    1520             :              "Check the section C-API incompatibility at the "\
+    1521             :              "Troubleshooting ImportError section at "\
+    1522             :              "https://numpy.org/devdocs/user/troubleshooting-importerror.html"\
+    1523             :              "#c-api-incompatibility "\
+    1524             :               "for indications on how to solve this problem .", \
+    1525           0 :              (int) NPY_FEATURE_VERSION, (int) PyArray_GetNDArrayCFeatureVersion());
+    1526           0 :       return -1;
+    1527             :   }
+    1528             : 
+    1529             :   /*
+    1530             :    * Perform runtime check of endianness and check it matches the one set by
+    1531             :    * the headers (npy_endian.h) as a safeguard
+    1532             :    */
+    1533           4 :   st = PyArray_GetEndianness();
+    1534           4 :   if (st == NPY_CPU_UNKNOWN_ENDIAN) {
+    1535           0 :       PyErr_SetString(PyExc_RuntimeError,
+    1536             :                       "FATAL: module compiled as unknown endian");
+    1537           0 :       return -1;
+    1538             :   }
+    1539             : #if NPY_BYTE_ORDER == NPY_BIG_ENDIAN
+    1540             :   if (st != NPY_CPU_BIG) {
+    1541             :       PyErr_SetString(PyExc_RuntimeError,
+    1542             :                       "FATAL: module compiled as big endian, but "
+    1543             :                       "detected different endianness at runtime");
+    1544             :       return -1;
+    1545             :   }
+    1546             : #elif NPY_BYTE_ORDER == NPY_LITTLE_ENDIAN
+    1547           4 :   if (st != NPY_CPU_LITTLE) {
+    1548           0 :       PyErr_SetString(PyExc_RuntimeError,
+    1549             :                       "FATAL: module compiled as little endian, but "
+    1550             :                       "detected different endianness at runtime");
+    1551           0 :       return -1;
+    1552             :   }
+    1553             : #endif
+    1554             : 
+    1555             :   return 0;
+    1556             : }
+    1557             : 
+    1558             : #define import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return NULL; } }
+    1559             : 
+    1560             : #define import_array1(ret) {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return ret; } }
+    1561             : 
+    1562             : #define import_array2(msg, ret) {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, msg); return ret; } }
+    1563             : 
+    1564             : #endif
+    1565             : 
+    1566             : #endif
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h.func-sort-c.html b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h.func-sort-c.html new file mode 100644 index 000000000..1e4f8aa99 --- /dev/null +++ b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h.func-sort-c.html @@ -0,0 +1,76 @@ + + + + + + + LCOV - coverage.info.cleaned - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy - __ufunc_api.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:81650.0 %
Date:2024-04-08 14:58:22Functions:11100.0 %
+
+ +
+ + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_import_umath4
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h.func.html b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h.func.html new file mode 100644 index 000000000..093ab6873 --- /dev/null +++ b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h.func.html @@ -0,0 +1,76 @@ + + + + + + + LCOV - coverage.info.cleaned - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy - __ufunc_api.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:81650.0 %
Date:2024-04-08 14:58:22Functions:11100.0 %
+
+ +
+ + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_import_umath4
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h.gcov.html b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h.gcov.html new file mode 100644 index 000000000..da3452463 --- /dev/null +++ b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h.gcov.html @@ -0,0 +1,390 @@ + + + + + + + LCOV - coverage.info.cleaned - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy - __ufunc_api.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:81650.0 %
Date:2024-04-08 14:58:22Functions:11100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : 
+       2             : #ifdef _UMATHMODULE
+       3             : 
+       4             : extern NPY_NO_EXPORT PyTypeObject PyUFunc_Type;
+       5             : 
+       6             : extern NPY_NO_EXPORT PyTypeObject PyUFunc_Type;
+       7             : 
+       8             : NPY_NO_EXPORT  PyObject * PyUFunc_FromFuncAndData \
+       9             :        (PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, int);
+      10             : NPY_NO_EXPORT  int PyUFunc_RegisterLoopForType \
+      11             :        (PyUFuncObject *, int, PyUFuncGenericFunction, const int *, void *);
+      12             : NPY_NO_EXPORT  int PyUFunc_GenericFunction \
+      13             :        (PyUFuncObject *NPY_UNUSED(ufunc), PyObject *NPY_UNUSED(args), PyObject *NPY_UNUSED(kwds), PyArrayObject **NPY_UNUSED(op));
+      14             : NPY_NO_EXPORT  void PyUFunc_f_f_As_d_d \
+      15             :        (char **, npy_intp const *, npy_intp const *, void *);
+      16             : NPY_NO_EXPORT  void PyUFunc_d_d \
+      17             :        (char **, npy_intp const *, npy_intp const *, void *);
+      18             : NPY_NO_EXPORT  void PyUFunc_f_f \
+      19             :        (char **, npy_intp const *, npy_intp const *, void *);
+      20             : NPY_NO_EXPORT  void PyUFunc_g_g \
+      21             :        (char **, npy_intp const *, npy_intp const *, void *);
+      22             : NPY_NO_EXPORT  void PyUFunc_F_F_As_D_D \
+      23             :        (char **, npy_intp const *, npy_intp const *, void *);
+      24             : NPY_NO_EXPORT  void PyUFunc_F_F \
+      25             :        (char **, npy_intp const *, npy_intp const *, void *);
+      26             : NPY_NO_EXPORT  void PyUFunc_D_D \
+      27             :        (char **, npy_intp const *, npy_intp const *, void *);
+      28             : NPY_NO_EXPORT  void PyUFunc_G_G \
+      29             :        (char **, npy_intp const *, npy_intp const *, void *);
+      30             : NPY_NO_EXPORT  void PyUFunc_O_O \
+      31             :        (char **, npy_intp const *, npy_intp const *, void *);
+      32             : NPY_NO_EXPORT  void PyUFunc_ff_f_As_dd_d \
+      33             :        (char **, npy_intp const *, npy_intp const *, void *);
+      34             : NPY_NO_EXPORT  void PyUFunc_ff_f \
+      35             :        (char **, npy_intp const *, npy_intp const *, void *);
+      36             : NPY_NO_EXPORT  void PyUFunc_dd_d \
+      37             :        (char **, npy_intp const *, npy_intp const *, void *);
+      38             : NPY_NO_EXPORT  void PyUFunc_gg_g \
+      39             :        (char **, npy_intp const *, npy_intp const *, void *);
+      40             : NPY_NO_EXPORT  void PyUFunc_FF_F_As_DD_D \
+      41             :        (char **, npy_intp const *, npy_intp const *, void *);
+      42             : NPY_NO_EXPORT  void PyUFunc_DD_D \
+      43             :        (char **, npy_intp const *, npy_intp const *, void *);
+      44             : NPY_NO_EXPORT  void PyUFunc_FF_F \
+      45             :        (char **, npy_intp const *, npy_intp const *, void *);
+      46             : NPY_NO_EXPORT  void PyUFunc_GG_G \
+      47             :        (char **, npy_intp const *, npy_intp const *, void *);
+      48             : NPY_NO_EXPORT  void PyUFunc_OO_O \
+      49             :        (char **, npy_intp const *, npy_intp const *, void *);
+      50             : NPY_NO_EXPORT  void PyUFunc_O_O_method \
+      51             :        (char **, npy_intp const *, npy_intp const *, void *);
+      52             : NPY_NO_EXPORT  void PyUFunc_OO_O_method \
+      53             :        (char **, npy_intp const *, npy_intp const *, void *);
+      54             : NPY_NO_EXPORT  void PyUFunc_On_Om \
+      55             :        (char **, npy_intp const *, npy_intp const *, void *);
+      56             : NPY_NO_EXPORT  int PyUFunc_GetPyValues \
+      57             :        (char *, int *, int *, PyObject **);
+      58             : NPY_NO_EXPORT  int PyUFunc_checkfperr \
+      59             :        (int, PyObject *, int *);
+      60             : NPY_NO_EXPORT  void PyUFunc_clearfperr \
+      61             :        (void);
+      62             : NPY_NO_EXPORT  int PyUFunc_getfperr \
+      63             :        (void);
+      64             : NPY_NO_EXPORT  int PyUFunc_handlefperr \
+      65             :        (int, PyObject *, int, int *);
+      66             : NPY_NO_EXPORT  int PyUFunc_ReplaceLoopBySignature \
+      67             :        (PyUFuncObject *, PyUFuncGenericFunction, const int *, PyUFuncGenericFunction *);
+      68             : NPY_NO_EXPORT  PyObject * PyUFunc_FromFuncAndDataAndSignature \
+      69             :        (PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, int, const char *);
+      70             : NPY_NO_EXPORT  int PyUFunc_SetUsesArraysAsData \
+      71             :        (void **NPY_UNUSED(data), size_t NPY_UNUSED(i));
+      72             : NPY_NO_EXPORT  void PyUFunc_e_e \
+      73             :        (char **, npy_intp const *, npy_intp const *, void *);
+      74             : NPY_NO_EXPORT  void PyUFunc_e_e_As_f_f \
+      75             :        (char **, npy_intp const *, npy_intp const *, void *);
+      76             : NPY_NO_EXPORT  void PyUFunc_e_e_As_d_d \
+      77             :        (char **, npy_intp const *, npy_intp const *, void *);
+      78             : NPY_NO_EXPORT  void PyUFunc_ee_e \
+      79             :        (char **, npy_intp const *, npy_intp const *, void *);
+      80             : NPY_NO_EXPORT  void PyUFunc_ee_e_As_ff_f \
+      81             :        (char **, npy_intp const *, npy_intp const *, void *);
+      82             : NPY_NO_EXPORT  void PyUFunc_ee_e_As_dd_d \
+      83             :        (char **, npy_intp const *, npy_intp const *, void *);
+      84             : NPY_NO_EXPORT  int PyUFunc_DefaultTypeResolver \
+      85             :        (PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyObject *, PyArray_Descr **);
+      86             : NPY_NO_EXPORT  int PyUFunc_ValidateCasting \
+      87             :        (PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyArray_Descr **);
+      88             : NPY_NO_EXPORT  int PyUFunc_RegisterLoopForDescr \
+      89             :        (PyUFuncObject *, PyArray_Descr *, PyUFuncGenericFunction, PyArray_Descr **, void *);
+      90             : NPY_NO_EXPORT  PyObject * PyUFunc_FromFuncAndDataAndSignatureAndIdentity \
+      91             :        (PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, const int, const char *, PyObject *);
+      92             : 
+      93             : #else
+      94             : 
+      95             : #if defined(PY_UFUNC_UNIQUE_SYMBOL)
+      96             : #define PyUFunc_API PY_UFUNC_UNIQUE_SYMBOL
+      97             : #endif
+      98             : 
+      99             : #if defined(NO_IMPORT) || defined(NO_IMPORT_UFUNC)
+     100             : extern void **PyUFunc_API;
+     101             : #else
+     102             : #if defined(PY_UFUNC_UNIQUE_SYMBOL)
+     103             : void **PyUFunc_API;
+     104             : #else
+     105             : static void **PyUFunc_API=NULL;
+     106             : #endif
+     107             : #endif
+     108             : 
+     109             : #define PyUFunc_Type (*(PyTypeObject *)PyUFunc_API[0])
+     110             : #define PyUFunc_FromFuncAndData \
+     111             :         (*(PyObject * (*)(PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, int)) \
+     112             :     PyUFunc_API[1])
+     113             : #define PyUFunc_RegisterLoopForType \
+     114             :         (*(int (*)(PyUFuncObject *, int, PyUFuncGenericFunction, const int *, void *)) \
+     115             :     PyUFunc_API[2])
+     116             : #define PyUFunc_GenericFunction \
+     117             :         (*(int (*)(PyUFuncObject *NPY_UNUSED(ufunc), PyObject *NPY_UNUSED(args), PyObject *NPY_UNUSED(kwds), PyArrayObject **NPY_UNUSED(op))) \
+     118             :     PyUFunc_API[3])
+     119             : #define PyUFunc_f_f_As_d_d \
+     120             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     121             :     PyUFunc_API[4])
+     122             : #define PyUFunc_d_d \
+     123             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     124             :     PyUFunc_API[5])
+     125             : #define PyUFunc_f_f \
+     126             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     127             :     PyUFunc_API[6])
+     128             : #define PyUFunc_g_g \
+     129             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     130             :     PyUFunc_API[7])
+     131             : #define PyUFunc_F_F_As_D_D \
+     132             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     133             :     PyUFunc_API[8])
+     134             : #define PyUFunc_F_F \
+     135             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     136             :     PyUFunc_API[9])
+     137             : #define PyUFunc_D_D \
+     138             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     139             :     PyUFunc_API[10])
+     140             : #define PyUFunc_G_G \
+     141             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     142             :     PyUFunc_API[11])
+     143             : #define PyUFunc_O_O \
+     144             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     145             :     PyUFunc_API[12])
+     146             : #define PyUFunc_ff_f_As_dd_d \
+     147             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     148             :     PyUFunc_API[13])
+     149             : #define PyUFunc_ff_f \
+     150             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     151             :     PyUFunc_API[14])
+     152             : #define PyUFunc_dd_d \
+     153             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     154             :     PyUFunc_API[15])
+     155             : #define PyUFunc_gg_g \
+     156             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     157             :     PyUFunc_API[16])
+     158             : #define PyUFunc_FF_F_As_DD_D \
+     159             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     160             :     PyUFunc_API[17])
+     161             : #define PyUFunc_DD_D \
+     162             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     163             :     PyUFunc_API[18])
+     164             : #define PyUFunc_FF_F \
+     165             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     166             :     PyUFunc_API[19])
+     167             : #define PyUFunc_GG_G \
+     168             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     169             :     PyUFunc_API[20])
+     170             : #define PyUFunc_OO_O \
+     171             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     172             :     PyUFunc_API[21])
+     173             : #define PyUFunc_O_O_method \
+     174             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     175             :     PyUFunc_API[22])
+     176             : #define PyUFunc_OO_O_method \
+     177             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     178             :     PyUFunc_API[23])
+     179             : #define PyUFunc_On_Om \
+     180             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     181             :     PyUFunc_API[24])
+     182             : #define PyUFunc_GetPyValues \
+     183             :         (*(int (*)(char *, int *, int *, PyObject **)) \
+     184             :     PyUFunc_API[25])
+     185             : #define PyUFunc_checkfperr \
+     186             :         (*(int (*)(int, PyObject *, int *)) \
+     187             :     PyUFunc_API[26])
+     188             : #define PyUFunc_clearfperr \
+     189             :         (*(void (*)(void)) \
+     190             :     PyUFunc_API[27])
+     191             : #define PyUFunc_getfperr \
+     192             :         (*(int (*)(void)) \
+     193             :     PyUFunc_API[28])
+     194             : #define PyUFunc_handlefperr \
+     195             :         (*(int (*)(int, PyObject *, int, int *)) \
+     196             :     PyUFunc_API[29])
+     197             : #define PyUFunc_ReplaceLoopBySignature \
+     198             :         (*(int (*)(PyUFuncObject *, PyUFuncGenericFunction, const int *, PyUFuncGenericFunction *)) \
+     199             :     PyUFunc_API[30])
+     200             : #define PyUFunc_FromFuncAndDataAndSignature \
+     201             :         (*(PyObject * (*)(PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, int, const char *)) \
+     202             :     PyUFunc_API[31])
+     203             : #define PyUFunc_SetUsesArraysAsData \
+     204             :         (*(int (*)(void **NPY_UNUSED(data), size_t NPY_UNUSED(i))) \
+     205             :     PyUFunc_API[32])
+     206             : #define PyUFunc_e_e \
+     207             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     208             :     PyUFunc_API[33])
+     209             : #define PyUFunc_e_e_As_f_f \
+     210             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     211             :     PyUFunc_API[34])
+     212             : #define PyUFunc_e_e_As_d_d \
+     213             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     214             :     PyUFunc_API[35])
+     215             : #define PyUFunc_ee_e \
+     216             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     217             :     PyUFunc_API[36])
+     218             : #define PyUFunc_ee_e_As_ff_f \
+     219             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     220             :     PyUFunc_API[37])
+     221             : #define PyUFunc_ee_e_As_dd_d \
+     222             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
+     223             :     PyUFunc_API[38])
+     224             : #define PyUFunc_DefaultTypeResolver \
+     225             :         (*(int (*)(PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyObject *, PyArray_Descr **)) \
+     226             :     PyUFunc_API[39])
+     227             : #define PyUFunc_ValidateCasting \
+     228             :         (*(int (*)(PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyArray_Descr **)) \
+     229             :     PyUFunc_API[40])
+     230             : #define PyUFunc_RegisterLoopForDescr \
+     231             :         (*(int (*)(PyUFuncObject *, PyArray_Descr *, PyUFuncGenericFunction, PyArray_Descr **, void *)) \
+     232             :     PyUFunc_API[41])
+     233             : 
+     234             : #if NPY_FEATURE_VERSION >= NPY_1_16_API_VERSION
+     235             : #define PyUFunc_FromFuncAndDataAndSignatureAndIdentity \
+     236             :         (*(PyObject * (*)(PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, const int, const char *, PyObject *)) \
+     237             :     PyUFunc_API[42])
+     238             : #endif
+     239             : 
+     240             : static inline int
+     241           4 : _import_umath(void)
+     242             : {
+     243           4 :   PyObject *numpy = PyImport_ImportModule("numpy.core._multiarray_umath");
+     244             :   PyObject *c_api = NULL;
+     245             : 
+     246           4 :   if (numpy == NULL) {
+     247           0 :       PyErr_SetString(PyExc_ImportError,
+     248             :                       "numpy.core._multiarray_umath failed to import");
+     249           0 :       return -1;
+     250             :   }
+     251           4 :   c_api = PyObject_GetAttrString(numpy, "_UFUNC_API");
+     252             :   Py_DECREF(numpy);
+     253           4 :   if (c_api == NULL) {
+     254           0 :       PyErr_SetString(PyExc_AttributeError, "_UFUNC_API not found");
+     255           0 :       return -1;
+     256             :   }
+     257             : 
+     258           4 :   if (!PyCapsule_CheckExact(c_api)) {
+     259           0 :       PyErr_SetString(PyExc_RuntimeError, "_UFUNC_API is not PyCapsule object");
+     260             :       Py_DECREF(c_api);
+     261           0 :       return -1;
+     262             :   }
+     263           4 :   PyUFunc_API = (void **)PyCapsule_GetPointer(c_api, NULL);
+     264             :   Py_DECREF(c_api);
+     265           4 :   if (PyUFunc_API == NULL) {
+     266           0 :       PyErr_SetString(PyExc_RuntimeError, "_UFUNC_API is NULL pointer");
+     267           0 :       return -1;
+     268             :   }
+     269             :   return 0;
+     270             : }
+     271             : 
+     272             : #define import_umath() \
+     273             :     do {\
+     274             :         UFUNC_NOFPE\
+     275             :         if (_import_umath() < 0) {\
+     276             :             PyErr_Print();\
+     277             :             PyErr_SetString(PyExc_ImportError,\
+     278             :                     "numpy.core.umath failed to import");\
+     279             :             return NULL;\
+     280             :         }\
+     281             :     } while(0)
+     282             : 
+     283             : #define import_umath1(ret) \
+     284             :     do {\
+     285             :         UFUNC_NOFPE\
+     286             :         if (_import_umath() < 0) {\
+     287             :             PyErr_Print();\
+     288             :             PyErr_SetString(PyExc_ImportError,\
+     289             :                     "numpy.core.umath failed to import");\
+     290             :             return ret;\
+     291             :         }\
+     292             :     } while(0)
+     293             : 
+     294             : #define import_umath2(ret, msg) \
+     295             :     do {\
+     296             :         UFUNC_NOFPE\
+     297             :         if (_import_umath() < 0) {\
+     298             :             PyErr_Print();\
+     299             :             PyErr_SetString(PyExc_ImportError, msg);\
+     300             :             return ret;\
+     301             :         }\
+     302             :     } while(0)
+     303             : 
+     304             : #define import_ufunc() \
+     305             :     do {\
+     306             :         UFUNC_NOFPE\
+     307             :         if (_import_umath() < 0) {\
+     308             :             PyErr_Print();\
+     309             :             PyErr_SetString(PyExc_ImportError,\
+     310             :                     "numpy.core.umath failed to import");\
+     311             :         }\
+     312             :     } while(0)
+     313             : 
+     314             : #endif
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/index-sort-f.html b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/index-sort-f.html new file mode 100644 index 000000000..2686fc849 --- /dev/null +++ b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/index-sort-f.html @@ -0,0 +1,113 @@ + + + + + + + LCOV - coverage.info.cleaned - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpyHitTotalCoverage
Test:coverage.info.cleanedLines:214843.8 %
Date:2024-04-08 14:58:22Functions:22100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
ndarraytypes.h +
0.0%
+
0.0 %0 / 5-0 / 0
__ufunc_api.h +
50.0%50.0%
+
50.0 %8 / 16100.0 %1 / 1
__multiarray_api.h +
48.1%48.1%
+
48.1 %13 / 27100.0 %1 / 1
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/index-sort-l.html b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/index-sort-l.html new file mode 100644 index 000000000..80f238d04 --- /dev/null +++ b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/index-sort-l.html @@ -0,0 +1,113 @@ + + + + + + + LCOV - coverage.info.cleaned - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpyHitTotalCoverage
Test:coverage.info.cleanedLines:214843.8 %
Date:2024-04-08 14:58:22Functions:22100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
ndarraytypes.h +
0.0%
+
0.0 %0 / 5-0 / 0
__multiarray_api.h +
48.1%48.1%
+
48.1 %13 / 27100.0 %1 / 1
__ufunc_api.h +
50.0%50.0%
+
50.0 %8 / 16100.0 %1 / 1
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/index.html b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/index.html new file mode 100644 index 000000000..124271195 --- /dev/null +++ b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/index.html @@ -0,0 +1,113 @@ + + + + + + + LCOV - coverage.info.cleaned - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpyHitTotalCoverage
Test:coverage.info.cleanedLines:214843.8 %
Date:2024-04-08 14:58:22Functions:22100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
__multiarray_api.h +
48.1%48.1%
+
48.1 %13 / 27100.0 %1 / 1
__ufunc_api.h +
50.0%50.0%
+
50.0 %8 / 16100.0 %1 / 1
ndarraytypes.h +
0.0%
+
0.0 %0 / 5-0 / 0
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h.func-sort-c.html b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h.func-sort-c.html new file mode 100644 index 000000000..84a09fcbb --- /dev/null +++ b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy - ndarraytypes.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:050.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h.func.html b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h.func.html new file mode 100644 index 000000000..ebd0e1b6a --- /dev/null +++ b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy - ndarraytypes.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:050.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h.gcov.html b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h.gcov.html new file mode 100644 index 000000000..c960b1d11 --- /dev/null +++ b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h.gcov.html @@ -0,0 +1,2021 @@ + + + + + + + LCOV - coverage.info.cleaned - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy - ndarraytypes.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:050.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef NUMPY_CORE_INCLUDE_NUMPY_NDARRAYTYPES_H_
+       2             : #define NUMPY_CORE_INCLUDE_NUMPY_NDARRAYTYPES_H_
+       3             : 
+       4             : #include "npy_common.h"
+       5             : #include "npy_endian.h"
+       6             : #include "npy_cpu.h"
+       7             : #include "utils.h"
+       8             : 
+       9             : #define NPY_NO_EXPORT NPY_VISIBILITY_HIDDEN
+      10             : 
+      11             : /* Only use thread if configured in config and python supports it */
+      12             : #if defined WITH_THREAD && !NPY_NO_SMP
+      13             :         #define NPY_ALLOW_THREADS 1
+      14             : #else
+      15             :         #define NPY_ALLOW_THREADS 0
+      16             : #endif
+      17             : 
+      18             : #ifndef __has_extension
+      19             : #define __has_extension(x) 0
+      20             : #endif
+      21             : 
+      22             : #if !defined(_NPY_NO_DEPRECATIONS) && \
+      23             :     ((defined(__GNUC__)&& __GNUC__ >= 6) || \
+      24             :      __has_extension(attribute_deprecated_with_message))
+      25             : #define NPY_ATTR_DEPRECATE(text) __attribute__ ((deprecated (text)))
+      26             : #else
+      27             : #define NPY_ATTR_DEPRECATE(text)
+      28             : #endif
+      29             : 
+      30             : /*
+      31             :  * There are several places in the code where an array of dimensions
+      32             :  * is allocated statically.  This is the size of that static
+      33             :  * allocation.
+      34             :  *
+      35             :  * The array creation itself could have arbitrary dimensions but all
+      36             :  * the places where static allocation is used would need to be changed
+      37             :  * to dynamic (including inside of several structures)
+      38             :  */
+      39             : 
+      40             : #define NPY_MAXDIMS 32
+      41             : #define NPY_MAXARGS 32
+      42             : 
+      43             : /* Used for Converter Functions "O&" code in ParseTuple */
+      44             : #define NPY_FAIL 0
+      45             : #define NPY_SUCCEED 1
+      46             : 
+      47             : 
+      48             : enum NPY_TYPES {    NPY_BOOL=0,
+      49             :                     NPY_BYTE, NPY_UBYTE,
+      50             :                     NPY_SHORT, NPY_USHORT,
+      51             :                     NPY_INT, NPY_UINT,
+      52             :                     NPY_LONG, NPY_ULONG,
+      53             :                     NPY_LONGLONG, NPY_ULONGLONG,
+      54             :                     NPY_FLOAT, NPY_DOUBLE, NPY_LONGDOUBLE,
+      55             :                     NPY_CFLOAT, NPY_CDOUBLE, NPY_CLONGDOUBLE,
+      56             :                     NPY_OBJECT=17,
+      57             :                     NPY_STRING, NPY_UNICODE,
+      58             :                     NPY_VOID,
+      59             :                     /*
+      60             :                      * New 1.6 types appended, may be integrated
+      61             :                      * into the above in 2.0.
+      62             :                      */
+      63             :                     NPY_DATETIME, NPY_TIMEDELTA, NPY_HALF,
+      64             : 
+      65             :                     NPY_NTYPES,
+      66             :                     NPY_NOTYPE,
+      67             :                     NPY_CHAR NPY_ATTR_DEPRECATE("Use NPY_STRING"),
+      68             :                     NPY_USERDEF=256,  /* leave room for characters */
+      69             : 
+      70             :                     /* The number of types not including the new 1.6 types */
+      71             :                     NPY_NTYPES_ABI_COMPATIBLE=21
+      72             : };
+      73             : #if defined(_MSC_VER) && !defined(__clang__)
+      74             : #pragma deprecated(NPY_CHAR)
+      75             : #endif
+      76             : 
+      77             : /* basetype array priority */
+      78             : #define NPY_PRIORITY 0.0
+      79             : 
+      80             : /* default subtype priority */
+      81             : #define NPY_SUBTYPE_PRIORITY 1.0
+      82             : 
+      83             : /* default scalar priority */
+      84             : #define NPY_SCALAR_PRIORITY -1000000.0
+      85             : 
+      86             : /* How many floating point types are there (excluding half) */
+      87             : #define NPY_NUM_FLOATTYPE 3
+      88             : 
+      89             : /*
+      90             :  * These characters correspond to the array type and the struct
+      91             :  * module
+      92             :  */
+      93             : 
+      94             : enum NPY_TYPECHAR {
+      95             :         NPY_BOOLLTR = '?',
+      96             :         NPY_BYTELTR = 'b',
+      97             :         NPY_UBYTELTR = 'B',
+      98             :         NPY_SHORTLTR = 'h',
+      99             :         NPY_USHORTLTR = 'H',
+     100             :         NPY_INTLTR = 'i',
+     101             :         NPY_UINTLTR = 'I',
+     102             :         NPY_LONGLTR = 'l',
+     103             :         NPY_ULONGLTR = 'L',
+     104             :         NPY_LONGLONGLTR = 'q',
+     105             :         NPY_ULONGLONGLTR = 'Q',
+     106             :         NPY_HALFLTR = 'e',
+     107             :         NPY_FLOATLTR = 'f',
+     108             :         NPY_DOUBLELTR = 'd',
+     109             :         NPY_LONGDOUBLELTR = 'g',
+     110             :         NPY_CFLOATLTR = 'F',
+     111             :         NPY_CDOUBLELTR = 'D',
+     112             :         NPY_CLONGDOUBLELTR = 'G',
+     113             :         NPY_OBJECTLTR = 'O',
+     114             :         NPY_STRINGLTR = 'S',
+     115             :         NPY_STRINGLTR2 = 'a',
+     116             :         NPY_UNICODELTR = 'U',
+     117             :         NPY_VOIDLTR = 'V',
+     118             :         NPY_DATETIMELTR = 'M',
+     119             :         NPY_TIMEDELTALTR = 'm',
+     120             :         NPY_CHARLTR = 'c',
+     121             : 
+     122             :         /*
+     123             :          * No Descriptor, just a define -- this let's
+     124             :          * Python users specify an array of integers
+     125             :          * large enough to hold a pointer on the
+     126             :          * platform
+     127             :          */
+     128             :         NPY_INTPLTR = 'p',
+     129             :         NPY_UINTPLTR = 'P',
+     130             : 
+     131             :         /*
+     132             :          * These are for dtype 'kinds', not dtype 'typecodes'
+     133             :          * as the above are for.
+     134             :          */
+     135             :         NPY_GENBOOLLTR ='b',
+     136             :         NPY_SIGNEDLTR = 'i',
+     137             :         NPY_UNSIGNEDLTR = 'u',
+     138             :         NPY_FLOATINGLTR = 'f',
+     139             :         NPY_COMPLEXLTR = 'c'
+     140             : };
+     141             : 
+     142             : /*
+     143             :  * Changing this may break Numpy API compatibility
+     144             :  * due to changing offsets in PyArray_ArrFuncs, so be
+     145             :  * careful. Here we have reused the mergesort slot for
+     146             :  * any kind of stable sort, the actual implementation will
+     147             :  * depend on the data type.
+     148             :  */
+     149             : typedef enum {
+     150             :         NPY_QUICKSORT=0,
+     151             :         NPY_HEAPSORT=1,
+     152             :         NPY_MERGESORT=2,
+     153             :         NPY_STABLESORT=2,
+     154             : } NPY_SORTKIND;
+     155             : #define NPY_NSORTS (NPY_STABLESORT + 1)
+     156             : 
+     157             : 
+     158             : typedef enum {
+     159             :         NPY_INTROSELECT=0
+     160             : } NPY_SELECTKIND;
+     161             : #define NPY_NSELECTS (NPY_INTROSELECT + 1)
+     162             : 
+     163             : 
+     164             : typedef enum {
+     165             :         NPY_SEARCHLEFT=0,
+     166             :         NPY_SEARCHRIGHT=1
+     167             : } NPY_SEARCHSIDE;
+     168             : #define NPY_NSEARCHSIDES (NPY_SEARCHRIGHT + 1)
+     169             : 
+     170             : 
+     171             : typedef enum {
+     172             :         NPY_NOSCALAR=-1,
+     173             :         NPY_BOOL_SCALAR,
+     174             :         NPY_INTPOS_SCALAR,
+     175             :         NPY_INTNEG_SCALAR,
+     176             :         NPY_FLOAT_SCALAR,
+     177             :         NPY_COMPLEX_SCALAR,
+     178             :         NPY_OBJECT_SCALAR
+     179             : } NPY_SCALARKIND;
+     180             : #define NPY_NSCALARKINDS (NPY_OBJECT_SCALAR + 1)
+     181             : 
+     182             : /* For specifying array memory layout or iteration order */
+     183             : typedef enum {
+     184             :         /* Fortran order if inputs are all Fortran, C otherwise */
+     185             :         NPY_ANYORDER=-1,
+     186             :         /* C order */
+     187             :         NPY_CORDER=0,
+     188             :         /* Fortran order */
+     189             :         NPY_FORTRANORDER=1,
+     190             :         /* An order as close to the inputs as possible */
+     191             :         NPY_KEEPORDER=2
+     192             : } NPY_ORDER;
+     193             : 
+     194             : /* For specifying allowed casting in operations which support it */
+     195             : typedef enum {
+     196             :         _NPY_ERROR_OCCURRED_IN_CAST = -1,
+     197             :         /* Only allow identical types */
+     198             :         NPY_NO_CASTING=0,
+     199             :         /* Allow identical and byte swapped types */
+     200             :         NPY_EQUIV_CASTING=1,
+     201             :         /* Only allow safe casts */
+     202             :         NPY_SAFE_CASTING=2,
+     203             :         /* Allow safe casts or casts within the same kind */
+     204             :         NPY_SAME_KIND_CASTING=3,
+     205             :         /* Allow any casts */
+     206             :         NPY_UNSAFE_CASTING=4,
+     207             : } NPY_CASTING;
+     208             : 
+     209             : typedef enum {
+     210             :         NPY_CLIP=0,
+     211             :         NPY_WRAP=1,
+     212             :         NPY_RAISE=2
+     213             : } NPY_CLIPMODE;
+     214             : 
+     215             : typedef enum {
+     216             :         NPY_VALID=0,
+     217             :         NPY_SAME=1,
+     218             :         NPY_FULL=2
+     219             : } NPY_CORRELATEMODE;
+     220             : 
+     221             : /* The special not-a-time (NaT) value */
+     222             : #define NPY_DATETIME_NAT NPY_MIN_INT64
+     223             : 
+     224             : /*
+     225             :  * Upper bound on the length of a DATETIME ISO 8601 string
+     226             :  *   YEAR: 21 (64-bit year)
+     227             :  *   MONTH: 3
+     228             :  *   DAY: 3
+     229             :  *   HOURS: 3
+     230             :  *   MINUTES: 3
+     231             :  *   SECONDS: 3
+     232             :  *   ATTOSECONDS: 1 + 3*6
+     233             :  *   TIMEZONE: 5
+     234             :  *   NULL TERMINATOR: 1
+     235             :  */
+     236             : #define NPY_DATETIME_MAX_ISO8601_STRLEN (21 + 3*5 + 1 + 3*6 + 6 + 1)
+     237             : 
+     238             : /* The FR in the unit names stands for frequency */
+     239             : typedef enum {
+     240             :         /* Force signed enum type, must be -1 for code compatibility */
+     241             :         NPY_FR_ERROR = -1,      /* error or undetermined */
+     242             : 
+     243             :         /* Start of valid units */
+     244             :         NPY_FR_Y = 0,           /* Years */
+     245             :         NPY_FR_M = 1,           /* Months */
+     246             :         NPY_FR_W = 2,           /* Weeks */
+     247             :         /* Gap where 1.6 NPY_FR_B (value 3) was */
+     248             :         NPY_FR_D = 4,           /* Days */
+     249             :         NPY_FR_h = 5,           /* hours */
+     250             :         NPY_FR_m = 6,           /* minutes */
+     251             :         NPY_FR_s = 7,           /* seconds */
+     252             :         NPY_FR_ms = 8,          /* milliseconds */
+     253             :         NPY_FR_us = 9,          /* microseconds */
+     254             :         NPY_FR_ns = 10,         /* nanoseconds */
+     255             :         NPY_FR_ps = 11,         /* picoseconds */
+     256             :         NPY_FR_fs = 12,         /* femtoseconds */
+     257             :         NPY_FR_as = 13,         /* attoseconds */
+     258             :         NPY_FR_GENERIC = 14     /* unbound units, can convert to anything */
+     259             : } NPY_DATETIMEUNIT;
+     260             : 
+     261             : /*
+     262             :  * NOTE: With the NPY_FR_B gap for 1.6 ABI compatibility, NPY_DATETIME_NUMUNITS
+     263             :  * is technically one more than the actual number of units.
+     264             :  */
+     265             : #define NPY_DATETIME_NUMUNITS (NPY_FR_GENERIC + 1)
+     266             : #define NPY_DATETIME_DEFAULTUNIT NPY_FR_GENERIC
+     267             : 
+     268             : /*
+     269             :  * Business day conventions for mapping invalid business
+     270             :  * days to valid business days.
+     271             :  */
+     272             : typedef enum {
+     273             :     /* Go forward in time to the following business day. */
+     274             :     NPY_BUSDAY_FORWARD,
+     275             :     NPY_BUSDAY_FOLLOWING = NPY_BUSDAY_FORWARD,
+     276             :     /* Go backward in time to the preceding business day. */
+     277             :     NPY_BUSDAY_BACKWARD,
+     278             :     NPY_BUSDAY_PRECEDING = NPY_BUSDAY_BACKWARD,
+     279             :     /*
+     280             :      * Go forward in time to the following business day, unless it
+     281             :      * crosses a month boundary, in which case go backward
+     282             :      */
+     283             :     NPY_BUSDAY_MODIFIEDFOLLOWING,
+     284             :     /*
+     285             :      * Go backward in time to the preceding business day, unless it
+     286             :      * crosses a month boundary, in which case go forward.
+     287             :      */
+     288             :     NPY_BUSDAY_MODIFIEDPRECEDING,
+     289             :     /* Produce a NaT for non-business days. */
+     290             :     NPY_BUSDAY_NAT,
+     291             :     /* Raise an exception for non-business days. */
+     292             :     NPY_BUSDAY_RAISE
+     293             : } NPY_BUSDAY_ROLL;
+     294             : 
+     295             : /************************************************************
+     296             :  * NumPy Auxiliary Data for inner loops, sort functions, etc.
+     297             :  ************************************************************/
+     298             : 
+     299             : /*
+     300             :  * When creating an auxiliary data struct, this should always appear
+     301             :  * as the first member, like this:
+     302             :  *
+     303             :  * typedef struct {
+     304             :  *     NpyAuxData base;
+     305             :  *     double constant;
+     306             :  * } constant_multiplier_aux_data;
+     307             :  */
+     308             : typedef struct NpyAuxData_tag NpyAuxData;
+     309             : 
+     310             : /* Function pointers for freeing or cloning auxiliary data */
+     311             : typedef void (NpyAuxData_FreeFunc) (NpyAuxData *);
+     312             : typedef NpyAuxData *(NpyAuxData_CloneFunc) (NpyAuxData *);
+     313             : 
+     314             : struct NpyAuxData_tag {
+     315             :     NpyAuxData_FreeFunc *free;
+     316             :     NpyAuxData_CloneFunc *clone;
+     317             :     /* To allow for a bit of expansion without breaking the ABI */
+     318             :     void *reserved[2];
+     319             : };
+     320             : 
+     321             : /* Macros to use for freeing and cloning auxiliary data */
+     322             : #define NPY_AUXDATA_FREE(auxdata) \
+     323             :     do { \
+     324             :         if ((auxdata) != NULL) { \
+     325             :             (auxdata)->free(auxdata); \
+     326             :         } \
+     327             :     } while(0)
+     328             : #define NPY_AUXDATA_CLONE(auxdata) \
+     329             :     ((auxdata)->clone(auxdata))
+     330             : 
+     331             : #define NPY_ERR(str) fprintf(stderr, #str); fflush(stderr);
+     332             : #define NPY_ERR2(str) fprintf(stderr, str); fflush(stderr);
+     333             : 
+     334             : /*
+     335             : * Macros to define how array, and dimension/strides data is
+     336             : * allocated. These should be made private
+     337             : */
+     338             : 
+     339             : #define NPY_USE_PYMEM 1
+     340             : 
+     341             : 
+     342             : #if NPY_USE_PYMEM == 1
+     343             : /* use the Raw versions which are safe to call with the GIL released */
+     344             : #define PyArray_malloc PyMem_RawMalloc
+     345             : #define PyArray_free PyMem_RawFree
+     346             : #define PyArray_realloc PyMem_RawRealloc
+     347             : #else
+     348             : #define PyArray_malloc malloc
+     349             : #define PyArray_free free
+     350             : #define PyArray_realloc realloc
+     351             : #endif
+     352             : 
+     353             : /* Dimensions and strides */
+     354             : #define PyDimMem_NEW(size)                                         \
+     355             :     ((npy_intp *)PyArray_malloc(size*sizeof(npy_intp)))
+     356             : 
+     357             : #define PyDimMem_FREE(ptr) PyArray_free(ptr)
+     358             : 
+     359             : #define PyDimMem_RENEW(ptr,size)                                   \
+     360             :         ((npy_intp *)PyArray_realloc(ptr,size*sizeof(npy_intp)))
+     361             : 
+     362             : /* forward declaration */
+     363             : struct _PyArray_Descr;
+     364             : 
+     365             : /* These must deal with unaligned and swapped data if necessary */
+     366             : typedef PyObject * (PyArray_GetItemFunc) (void *, void *);
+     367             : typedef int (PyArray_SetItemFunc)(PyObject *, void *, void *);
+     368             : 
+     369             : typedef void (PyArray_CopySwapNFunc)(void *, npy_intp, void *, npy_intp,
+     370             :                                      npy_intp, int, void *);
+     371             : 
+     372             : typedef void (PyArray_CopySwapFunc)(void *, void *, int, void *);
+     373             : typedef npy_bool (PyArray_NonzeroFunc)(void *, void *);
+     374             : 
+     375             : 
+     376             : /*
+     377             :  * These assume aligned and notswapped data -- a buffer will be used
+     378             :  * before or contiguous data will be obtained
+     379             :  */
+     380             : 
+     381             : typedef int (PyArray_CompareFunc)(const void *, const void *, void *);
+     382             : typedef int (PyArray_ArgFunc)(void*, npy_intp, npy_intp*, void *);
+     383             : 
+     384             : typedef void (PyArray_DotFunc)(void *, npy_intp, void *, npy_intp, void *,
+     385             :                                npy_intp, void *);
+     386             : 
+     387             : typedef void (PyArray_VectorUnaryFunc)(void *, void *, npy_intp, void *,
+     388             :                                        void *);
+     389             : 
+     390             : /*
+     391             :  * XXX the ignore argument should be removed next time the API version
+     392             :  * is bumped. It used to be the separator.
+     393             :  */
+     394             : typedef int (PyArray_ScanFunc)(FILE *fp, void *dptr,
+     395             :                                char *ignore, struct _PyArray_Descr *);
+     396             : typedef int (PyArray_FromStrFunc)(char *s, void *dptr, char **endptr,
+     397             :                                   struct _PyArray_Descr *);
+     398             : 
+     399             : typedef int (PyArray_FillFunc)(void *, npy_intp, void *);
+     400             : 
+     401             : typedef int (PyArray_SortFunc)(void *, npy_intp, void *);
+     402             : typedef int (PyArray_ArgSortFunc)(void *, npy_intp *, npy_intp, void *);
+     403             : typedef int (PyArray_PartitionFunc)(void *, npy_intp, npy_intp,
+     404             :                                     npy_intp *, npy_intp *,
+     405             :                                     void *);
+     406             : typedef int (PyArray_ArgPartitionFunc)(void *, npy_intp *, npy_intp, npy_intp,
+     407             :                                        npy_intp *, npy_intp *,
+     408             :                                        void *);
+     409             : 
+     410             : typedef int (PyArray_FillWithScalarFunc)(void *, npy_intp, void *, void *);
+     411             : 
+     412             : typedef int (PyArray_ScalarKindFunc)(void *);
+     413             : 
+     414             : typedef void (PyArray_FastClipFunc)(void *in, npy_intp n_in, void *min,
+     415             :                                     void *max, void *out);
+     416             : typedef void (PyArray_FastPutmaskFunc)(void *in, void *mask, npy_intp n_in,
+     417             :                                        void *values, npy_intp nv);
+     418             : typedef int  (PyArray_FastTakeFunc)(void *dest, void *src, npy_intp *indarray,
+     419             :                                        npy_intp nindarray, npy_intp n_outer,
+     420             :                                        npy_intp m_middle, npy_intp nelem,
+     421             :                                        NPY_CLIPMODE clipmode);
+     422             : 
+     423             : typedef struct {
+     424             :         npy_intp *ptr;
+     425             :         int len;
+     426             : } PyArray_Dims;
+     427             : 
+     428             : typedef struct {
+     429             :         /*
+     430             :          * Functions to cast to most other standard types
+     431             :          * Can have some NULL entries. The types
+     432             :          * DATETIME, TIMEDELTA, and HALF go into the castdict
+     433             :          * even though they are built-in.
+     434             :          */
+     435             :         PyArray_VectorUnaryFunc *cast[NPY_NTYPES_ABI_COMPATIBLE];
+     436             : 
+     437             :         /* The next four functions *cannot* be NULL */
+     438             : 
+     439             :         /*
+     440             :          * Functions to get and set items with standard Python types
+     441             :          * -- not array scalars
+     442             :          */
+     443             :         PyArray_GetItemFunc *getitem;
+     444             :         PyArray_SetItemFunc *setitem;
+     445             : 
+     446             :         /*
+     447             :          * Copy and/or swap data.  Memory areas may not overlap
+     448             :          * Use memmove first if they might
+     449             :          */
+     450             :         PyArray_CopySwapNFunc *copyswapn;
+     451             :         PyArray_CopySwapFunc *copyswap;
+     452             : 
+     453             :         /*
+     454             :          * Function to compare items
+     455             :          * Can be NULL
+     456             :          */
+     457             :         PyArray_CompareFunc *compare;
+     458             : 
+     459             :         /*
+     460             :          * Function to select largest
+     461             :          * Can be NULL
+     462             :          */
+     463             :         PyArray_ArgFunc *argmax;
+     464             : 
+     465             :         /*
+     466             :          * Function to compute dot product
+     467             :          * Can be NULL
+     468             :          */
+     469             :         PyArray_DotFunc *dotfunc;
+     470             : 
+     471             :         /*
+     472             :          * Function to scan an ASCII file and
+     473             :          * place a single value plus possible separator
+     474             :          * Can be NULL
+     475             :          */
+     476             :         PyArray_ScanFunc *scanfunc;
+     477             : 
+     478             :         /*
+     479             :          * Function to read a single value from a string
+     480             :          * and adjust the pointer; Can be NULL
+     481             :          */
+     482             :         PyArray_FromStrFunc *fromstr;
+     483             : 
+     484             :         /*
+     485             :          * Function to determine if data is zero or not
+     486             :          * If NULL a default version is
+     487             :          * used at Registration time.
+     488             :          */
+     489             :         PyArray_NonzeroFunc *nonzero;
+     490             : 
+     491             :         /*
+     492             :          * Used for arange. Should return 0 on success
+     493             :          * and -1 on failure.
+     494             :          * Can be NULL.
+     495             :          */
+     496             :         PyArray_FillFunc *fill;
+     497             : 
+     498             :         /*
+     499             :          * Function to fill arrays with scalar values
+     500             :          * Can be NULL
+     501             :          */
+     502             :         PyArray_FillWithScalarFunc *fillwithscalar;
+     503             : 
+     504             :         /*
+     505             :          * Sorting functions
+     506             :          * Can be NULL
+     507             :          */
+     508             :         PyArray_SortFunc *sort[NPY_NSORTS];
+     509             :         PyArray_ArgSortFunc *argsort[NPY_NSORTS];
+     510             : 
+     511             :         /*
+     512             :          * Dictionary of additional casting functions
+     513             :          * PyArray_VectorUnaryFuncs
+     514             :          * which can be populated to support casting
+     515             :          * to other registered types. Can be NULL
+     516             :          */
+     517             :         PyObject *castdict;
+     518             : 
+     519             :         /*
+     520             :          * Functions useful for generalizing
+     521             :          * the casting rules.
+     522             :          * Can be NULL;
+     523             :          */
+     524             :         PyArray_ScalarKindFunc *scalarkind;
+     525             :         int **cancastscalarkindto;
+     526             :         int *cancastto;
+     527             : 
+     528             :         PyArray_FastClipFunc *fastclip;
+     529             :         PyArray_FastPutmaskFunc *fastputmask;
+     530             :         PyArray_FastTakeFunc *fasttake;
+     531             : 
+     532             :         /*
+     533             :          * Function to select smallest
+     534             :          * Can be NULL
+     535             :          */
+     536             :         PyArray_ArgFunc *argmin;
+     537             : 
+     538             : } PyArray_ArrFuncs;
+     539             : 
+     540             : /* The item must be reference counted when it is inserted or extracted. */
+     541             : #define NPY_ITEM_REFCOUNT   0x01
+     542             : /* Same as needing REFCOUNT */
+     543             : #define NPY_ITEM_HASOBJECT  0x01
+     544             : /* Convert to list for pickling */
+     545             : #define NPY_LIST_PICKLE     0x02
+     546             : /* The item is a POINTER  */
+     547             : #define NPY_ITEM_IS_POINTER 0x04
+     548             : /* memory needs to be initialized for this data-type */
+     549             : #define NPY_NEEDS_INIT      0x08
+     550             : /* operations need Python C-API so don't give-up thread. */
+     551             : #define NPY_NEEDS_PYAPI     0x10
+     552             : /* Use f.getitem when extracting elements of this data-type */
+     553             : #define NPY_USE_GETITEM     0x20
+     554             : /* Use f.setitem when setting creating 0-d array from this data-type.*/
+     555             : #define NPY_USE_SETITEM     0x40
+     556             : /* A sticky flag specifically for structured arrays */
+     557             : #define NPY_ALIGNED_STRUCT  0x80
+     558             : 
+     559             : /*
+     560             :  *These are inherited for global data-type if any data-types in the
+     561             :  * field have them
+     562             :  */
+     563             : #define NPY_FROM_FIELDS    (NPY_NEEDS_INIT | NPY_LIST_PICKLE | \
+     564             :                             NPY_ITEM_REFCOUNT | NPY_NEEDS_PYAPI)
+     565             : 
+     566             : #define NPY_OBJECT_DTYPE_FLAGS (NPY_LIST_PICKLE | NPY_USE_GETITEM | \
+     567             :                                 NPY_ITEM_IS_POINTER | NPY_ITEM_REFCOUNT | \
+     568             :                                 NPY_NEEDS_INIT | NPY_NEEDS_PYAPI)
+     569             : 
+     570             : #define PyDataType_FLAGCHK(dtype, flag) \
+     571             :         (((dtype)->flags & (flag)) == (flag))
+     572             : 
+     573             : #define PyDataType_REFCHK(dtype) \
+     574             :         PyDataType_FLAGCHK(dtype, NPY_ITEM_REFCOUNT)
+     575             : 
+     576             : typedef struct _PyArray_Descr {
+     577             :         PyObject_HEAD
+     578             :         /*
+     579             :          * the type object representing an
+     580             :          * instance of this type -- should not
+     581             :          * be two type_numbers with the same type
+     582             :          * object.
+     583             :          */
+     584             :         PyTypeObject *typeobj;
+     585             :         /* kind for this type */
+     586             :         char kind;
+     587             :         /* unique-character representing this type */
+     588             :         char type;
+     589             :         /*
+     590             :          * '>' (big), '<' (little), '|'
+     591             :          * (not-applicable), or '=' (native).
+     592             :          */
+     593             :         char byteorder;
+     594             :         /* flags describing data type */
+     595             :         char flags;
+     596             :         /* number representing this type */
+     597             :         int type_num;
+     598             :         /* element size (itemsize) for this type */
+     599             :         int elsize;
+     600             :         /* alignment needed for this type */
+     601             :         int alignment;
+     602             :         /*
+     603             :          * Non-NULL if this type is
+     604             :          * is an array (C-contiguous)
+     605             :          * of some other type
+     606             :          */
+     607             :         struct _arr_descr *subarray;
+     608             :         /*
+     609             :          * The fields dictionary for this type
+     610             :          * For statically defined descr this
+     611             :          * is always Py_None
+     612             :          */
+     613             :         PyObject *fields;
+     614             :         /*
+     615             :          * An ordered tuple of field names or NULL
+     616             :          * if no fields are defined
+     617             :          */
+     618             :         PyObject *names;
+     619             :         /*
+     620             :          * a table of functions specific for each
+     621             :          * basic data descriptor
+     622             :          */
+     623             :         PyArray_ArrFuncs *f;
+     624             :         /* Metadata about this dtype */
+     625             :         PyObject *metadata;
+     626             :         /*
+     627             :          * Metadata specific to the C implementation
+     628             :          * of the particular dtype. This was added
+     629             :          * for NumPy 1.7.0.
+     630             :          */
+     631             :         NpyAuxData *c_metadata;
+     632             :         /* Cached hash value (-1 if not yet computed).
+     633             :          * This was added for NumPy 2.0.0.
+     634             :          */
+     635             :         npy_hash_t hash;
+     636             : } PyArray_Descr;
+     637             : 
+     638             : typedef struct _arr_descr {
+     639             :         PyArray_Descr *base;
+     640             :         PyObject *shape;       /* a tuple */
+     641             : } PyArray_ArrayDescr;
+     642             : 
+     643             : /*
+     644             :  * Memory handler structure for array data.
+     645             :  */
+     646             : /* The declaration of free differs from PyMemAllocatorEx */
+     647             : typedef struct {
+     648             :     void *ctx;
+     649             :     void* (*malloc) (void *ctx, size_t size);
+     650             :     void* (*calloc) (void *ctx, size_t nelem, size_t elsize);
+     651             :     void* (*realloc) (void *ctx, void *ptr, size_t new_size);
+     652             :     void (*free) (void *ctx, void *ptr, size_t size);
+     653             :     /*
+     654             :      * This is the end of the version=1 struct. Only add new fields after
+     655             :      * this line
+     656             :      */
+     657             : } PyDataMemAllocator;
+     658             : 
+     659             : typedef struct {
+     660             :     char name[127];  /* multiple of 64 to keep the struct aligned */
+     661             :     uint8_t version; /* currently 1 */
+     662             :     PyDataMemAllocator allocator;
+     663             : } PyDataMem_Handler;
+     664             : 
+     665             : 
+     666             : /*
+     667             :  * The main array object structure.
+     668             :  *
+     669             :  * It has been recommended to use the inline functions defined below
+     670             :  * (PyArray_DATA and friends) to access fields here for a number of
+     671             :  * releases. Direct access to the members themselves is deprecated.
+     672             :  * To ensure that your code does not use deprecated access,
+     673             :  * #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
+     674             :  * (or NPY_1_8_API_VERSION or higher as required).
+     675             :  */
+     676             : /* This struct will be moved to a private header in a future release */
+     677             : typedef struct tagPyArrayObject_fields {
+     678             :     PyObject_HEAD
+     679             :     /* Pointer to the raw data buffer */
+     680             :     char *data;
+     681             :     /* The number of dimensions, also called 'ndim' */
+     682             :     int nd;
+     683             :     /* The size in each dimension, also called 'shape' */
+     684             :     npy_intp *dimensions;
+     685             :     /*
+     686             :      * Number of bytes to jump to get to the
+     687             :      * next element in each dimension
+     688             :      */
+     689             :     npy_intp *strides;
+     690             :     /*
+     691             :      * This object is decref'd upon
+     692             :      * deletion of array. Except in the
+     693             :      * case of WRITEBACKIFCOPY which has
+     694             :      * special handling.
+     695             :      *
+     696             :      * For views it points to the original
+     697             :      * array, collapsed so no chains of
+     698             :      * views occur.
+     699             :      *
+     700             :      * For creation from buffer object it
+     701             :      * points to an object that should be
+     702             :      * decref'd on deletion
+     703             :      *
+     704             :      * For WRITEBACKIFCOPY flag this is an
+     705             :      * array to-be-updated upon calling
+     706             :      * PyArray_ResolveWritebackIfCopy
+     707             :      */
+     708             :     PyObject *base;
+     709             :     /* Pointer to type structure */
+     710             :     PyArray_Descr *descr;
+     711             :     /* Flags describing array -- see below */
+     712             :     int flags;
+     713             :     /* For weak references */
+     714             :     PyObject *weakreflist;
+     715             : #if NPY_FEATURE_VERSION >= NPY_1_20_API_VERSION
+     716             :     void *_buffer_info;  /* private buffer info, tagged to allow warning */
+     717             : #endif
+     718             :     /*
+     719             :      * For malloc/calloc/realloc/free per object
+     720             :      */
+     721             : #if NPY_FEATURE_VERSION >= NPY_1_22_API_VERSION
+     722             :     PyObject *mem_handler;
+     723             : #endif
+     724             : } PyArrayObject_fields;
+     725             : 
+     726             : /*
+     727             :  * To hide the implementation details, we only expose
+     728             :  * the Python struct HEAD.
+     729             :  */
+     730             : #if !defined(NPY_NO_DEPRECATED_API) || \
+     731             :     (NPY_NO_DEPRECATED_API < NPY_1_7_API_VERSION)
+     732             : /*
+     733             :  * Can't put this in npy_deprecated_api.h like the others.
+     734             :  * PyArrayObject field access is deprecated as of NumPy 1.7.
+     735             :  */
+     736             : typedef PyArrayObject_fields PyArrayObject;
+     737             : #else
+     738             : typedef struct tagPyArrayObject {
+     739             :         PyObject_HEAD
+     740             : } PyArrayObject;
+     741             : #endif
+     742             : 
+     743             : /*
+     744             :  * Removed 2020-Nov-25, NumPy 1.20
+     745             :  * #define NPY_SIZEOF_PYARRAYOBJECT (sizeof(PyArrayObject_fields))
+     746             :  *
+     747             :  * The above macro was removed as it gave a false sense of a stable ABI
+     748             :  * with respect to the structures size.  If you require a runtime constant,
+     749             :  * you can use `PyArray_Type.tp_basicsize` instead.  Otherwise, please
+     750             :  * see the PyArrayObject documentation or ask the NumPy developers for
+     751             :  * information on how to correctly replace the macro in a way that is
+     752             :  * compatible with multiple NumPy versions.
+     753             :  */
+     754             : 
+     755             : 
+     756             : /* Array Flags Object */
+     757             : typedef struct PyArrayFlagsObject {
+     758             :         PyObject_HEAD
+     759             :         PyObject *arr;
+     760             :         int flags;
+     761             : } PyArrayFlagsObject;
+     762             : 
+     763             : /* Mirrors buffer object to ptr */
+     764             : 
+     765             : typedef struct {
+     766             :         PyObject_HEAD
+     767             :         PyObject *base;
+     768             :         void *ptr;
+     769             :         npy_intp len;
+     770             :         int flags;
+     771             : } PyArray_Chunk;
+     772             : 
+     773             : typedef struct {
+     774             :     NPY_DATETIMEUNIT base;
+     775             :     int num;
+     776             : } PyArray_DatetimeMetaData;
+     777             : 
+     778             : typedef struct {
+     779             :     NpyAuxData base;
+     780             :     PyArray_DatetimeMetaData meta;
+     781             : } PyArray_DatetimeDTypeMetaData;
+     782             : 
+     783             : /*
+     784             :  * This structure contains an exploded view of a date-time value.
+     785             :  * NaT is represented by year == NPY_DATETIME_NAT.
+     786             :  */
+     787             : typedef struct {
+     788             :         npy_int64 year;
+     789             :         npy_int32 month, day, hour, min, sec, us, ps, as;
+     790             : } npy_datetimestruct;
+     791             : 
+     792             : /* This is not used internally. */
+     793             : typedef struct {
+     794             :         npy_int64 day;
+     795             :         npy_int32 sec, us, ps, as;
+     796             : } npy_timedeltastruct;
+     797             : 
+     798             : typedef int (PyArray_FinalizeFunc)(PyArrayObject *, PyObject *);
+     799             : 
+     800             : /*
+     801             :  * Means c-style contiguous (last index varies the fastest). The data
+     802             :  * elements right after each other.
+     803             :  *
+     804             :  * This flag may be requested in constructor functions.
+     805             :  * This flag may be tested for in PyArray_FLAGS(arr).
+     806             :  */
+     807             : #define NPY_ARRAY_C_CONTIGUOUS    0x0001
+     808             : 
+     809             : /*
+     810             :  * Set if array is a contiguous Fortran array: the first index varies
+     811             :  * the fastest in memory (strides array is reverse of C-contiguous
+     812             :  * array)
+     813             :  *
+     814             :  * This flag may be requested in constructor functions.
+     815             :  * This flag may be tested for in PyArray_FLAGS(arr).
+     816             :  */
+     817             : #define NPY_ARRAY_F_CONTIGUOUS    0x0002
+     818             : 
+     819             : /*
+     820             :  * Note: all 0-d arrays are C_CONTIGUOUS and F_CONTIGUOUS. If a
+     821             :  * 1-d array is C_CONTIGUOUS it is also F_CONTIGUOUS. Arrays with
+     822             :  * more then one dimension can be C_CONTIGUOUS and F_CONTIGUOUS
+     823             :  * at the same time if they have either zero or one element.
+     824             :  * A higher dimensional array always has the same contiguity flags as
+     825             :  * `array.squeeze()`; dimensions with `array.shape[dimension] == 1` are
+     826             :  * effectively ignored when checking for contiguity.
+     827             :  */
+     828             : 
+     829             : /*
+     830             :  * If set, the array owns the data: it will be free'd when the array
+     831             :  * is deleted.
+     832             :  *
+     833             :  * This flag may be tested for in PyArray_FLAGS(arr).
+     834             :  */
+     835             : #define NPY_ARRAY_OWNDATA         0x0004
+     836             : 
+     837             : /*
+     838             :  * An array never has the next four set; they're only used as parameter
+     839             :  * flags to the various FromAny functions
+     840             :  *
+     841             :  * This flag may be requested in constructor functions.
+     842             :  */
+     843             : 
+     844             : /* Cause a cast to occur regardless of whether or not it is safe. */
+     845             : #define NPY_ARRAY_FORCECAST       0x0010
+     846             : 
+     847             : /*
+     848             :  * Always copy the array. Returned arrays are always CONTIGUOUS,
+     849             :  * ALIGNED, and WRITEABLE. See also: NPY_ARRAY_ENSURENOCOPY = 0x4000.
+     850             :  *
+     851             :  * This flag may be requested in constructor functions.
+     852             :  */
+     853             : #define NPY_ARRAY_ENSURECOPY      0x0020
+     854             : 
+     855             : /*
+     856             :  * Make sure the returned array is a base-class ndarray
+     857             :  *
+     858             :  * This flag may be requested in constructor functions.
+     859             :  */
+     860             : #define NPY_ARRAY_ENSUREARRAY     0x0040
+     861             : 
+     862             : /*
+     863             :  * Make sure that the strides are in units of the element size Needed
+     864             :  * for some operations with record-arrays.
+     865             :  *
+     866             :  * This flag may be requested in constructor functions.
+     867             :  */
+     868             : #define NPY_ARRAY_ELEMENTSTRIDES  0x0080
+     869             : 
+     870             : /*
+     871             :  * Array data is aligned on the appropriate memory address for the type
+     872             :  * stored according to how the compiler would align things (e.g., an
+     873             :  * array of integers (4 bytes each) starts on a memory address that's
+     874             :  * a multiple of 4)
+     875             :  *
+     876             :  * This flag may be requested in constructor functions.
+     877             :  * This flag may be tested for in PyArray_FLAGS(arr).
+     878             :  */
+     879             : #define NPY_ARRAY_ALIGNED         0x0100
+     880             : 
+     881             : /*
+     882             :  * Array data has the native endianness
+     883             :  *
+     884             :  * This flag may be requested in constructor functions.
+     885             :  */
+     886             : #define NPY_ARRAY_NOTSWAPPED      0x0200
+     887             : 
+     888             : /*
+     889             :  * Array data is writeable
+     890             :  *
+     891             :  * This flag may be requested in constructor functions.
+     892             :  * This flag may be tested for in PyArray_FLAGS(arr).
+     893             :  */
+     894             : #define NPY_ARRAY_WRITEABLE       0x0400
+     895             : 
+     896             : /*
+     897             :  * If this flag is set, then base contains a pointer to an array of
+     898             :  * the same size that should be updated with the current contents of
+     899             :  * this array when PyArray_ResolveWritebackIfCopy is called.
+     900             :  *
+     901             :  * This flag may be requested in constructor functions.
+     902             :  * This flag may be tested for in PyArray_FLAGS(arr).
+     903             :  */
+     904             : #define NPY_ARRAY_WRITEBACKIFCOPY 0x2000
+     905             : 
+     906             : /*
+     907             :  * No copy may be made while converting from an object/array (result is a view)
+     908             :  *
+     909             :  * This flag may be requested in constructor functions.
+     910             :  */
+     911             : #define NPY_ARRAY_ENSURENOCOPY 0x4000
+     912             : 
+     913             : /*
+     914             :  * NOTE: there are also internal flags defined in multiarray/arrayobject.h,
+     915             :  * which start at bit 31 and work down.
+     916             :  */
+     917             : 
+     918             : #define NPY_ARRAY_BEHAVED      (NPY_ARRAY_ALIGNED | \
+     919             :                                 NPY_ARRAY_WRITEABLE)
+     920             : #define NPY_ARRAY_BEHAVED_NS   (NPY_ARRAY_ALIGNED | \
+     921             :                                 NPY_ARRAY_WRITEABLE | \
+     922             :                                 NPY_ARRAY_NOTSWAPPED)
+     923             : #define NPY_ARRAY_CARRAY       (NPY_ARRAY_C_CONTIGUOUS | \
+     924             :                                 NPY_ARRAY_BEHAVED)
+     925             : #define NPY_ARRAY_CARRAY_RO    (NPY_ARRAY_C_CONTIGUOUS | \
+     926             :                                 NPY_ARRAY_ALIGNED)
+     927             : #define NPY_ARRAY_FARRAY       (NPY_ARRAY_F_CONTIGUOUS | \
+     928             :                                 NPY_ARRAY_BEHAVED)
+     929             : #define NPY_ARRAY_FARRAY_RO    (NPY_ARRAY_F_CONTIGUOUS | \
+     930             :                                 NPY_ARRAY_ALIGNED)
+     931             : #define NPY_ARRAY_DEFAULT      (NPY_ARRAY_CARRAY)
+     932             : #define NPY_ARRAY_IN_ARRAY     (NPY_ARRAY_CARRAY_RO)
+     933             : #define NPY_ARRAY_OUT_ARRAY    (NPY_ARRAY_CARRAY)
+     934             : #define NPY_ARRAY_INOUT_ARRAY  (NPY_ARRAY_CARRAY)
+     935             : #define NPY_ARRAY_INOUT_ARRAY2 (NPY_ARRAY_CARRAY | \
+     936             :                                 NPY_ARRAY_WRITEBACKIFCOPY)
+     937             : #define NPY_ARRAY_IN_FARRAY    (NPY_ARRAY_FARRAY_RO)
+     938             : #define NPY_ARRAY_OUT_FARRAY   (NPY_ARRAY_FARRAY)
+     939             : #define NPY_ARRAY_INOUT_FARRAY (NPY_ARRAY_FARRAY)
+     940             : #define NPY_ARRAY_INOUT_FARRAY2 (NPY_ARRAY_FARRAY | \
+     941             :                                 NPY_ARRAY_WRITEBACKIFCOPY)
+     942             : 
+     943             : #define NPY_ARRAY_UPDATE_ALL   (NPY_ARRAY_C_CONTIGUOUS | \
+     944             :                                 NPY_ARRAY_F_CONTIGUOUS | \
+     945             :                                 NPY_ARRAY_ALIGNED)
+     946             : 
+     947             : /* This flag is for the array interface, not PyArrayObject */
+     948             : #define NPY_ARR_HAS_DESCR  0x0800
+     949             : 
+     950             : 
+     951             : 
+     952             : 
+     953             : /*
+     954             :  * Size of internal buffers used for alignment Make BUFSIZE a multiple
+     955             :  * of sizeof(npy_cdouble) -- usually 16 so that ufunc buffers are aligned
+     956             :  */
+     957             : #define NPY_MIN_BUFSIZE ((int)sizeof(npy_cdouble))
+     958             : #define NPY_MAX_BUFSIZE (((int)sizeof(npy_cdouble))*1000000)
+     959             : #define NPY_BUFSIZE 8192
+     960             : /* buffer stress test size: */
+     961             : /*#define NPY_BUFSIZE 17*/
+     962             : 
+     963             : #define PyArray_MAX(a,b) (((a)>(b))?(a):(b))
+     964             : #define PyArray_MIN(a,b) (((a)<(b))?(a):(b))
+     965             : #define PyArray_CLT(p,q) ((((p).real==(q).real) ? ((p).imag < (q).imag) : \
+     966             :                                ((p).real < (q).real)))
+     967             : #define PyArray_CGT(p,q) ((((p).real==(q).real) ? ((p).imag > (q).imag) : \
+     968             :                                ((p).real > (q).real)))
+     969             : #define PyArray_CLE(p,q) ((((p).real==(q).real) ? ((p).imag <= (q).imag) : \
+     970             :                                ((p).real <= (q).real)))
+     971             : #define PyArray_CGE(p,q) ((((p).real==(q).real) ? ((p).imag >= (q).imag) : \
+     972             :                                ((p).real >= (q).real)))
+     973             : #define PyArray_CEQ(p,q) (((p).real==(q).real) && ((p).imag == (q).imag))
+     974             : #define PyArray_CNE(p,q) (((p).real!=(q).real) || ((p).imag != (q).imag))
+     975             : 
+     976             : /*
+     977             :  * C API: consists of Macros and functions.  The MACROS are defined
+     978             :  * here.
+     979             :  */
+     980             : 
+     981             : 
+     982             : #define PyArray_ISCONTIGUOUS(m) PyArray_CHKFLAGS((m), NPY_ARRAY_C_CONTIGUOUS)
+     983             : #define PyArray_ISWRITEABLE(m) PyArray_CHKFLAGS((m), NPY_ARRAY_WRITEABLE)
+     984             : #define PyArray_ISALIGNED(m) PyArray_CHKFLAGS((m), NPY_ARRAY_ALIGNED)
+     985             : 
+     986             : #define PyArray_IS_C_CONTIGUOUS(m) PyArray_CHKFLAGS((m), NPY_ARRAY_C_CONTIGUOUS)
+     987             : #define PyArray_IS_F_CONTIGUOUS(m) PyArray_CHKFLAGS((m), NPY_ARRAY_F_CONTIGUOUS)
+     988             : 
+     989             : /* the variable is used in some places, so always define it */
+     990             : #define NPY_BEGIN_THREADS_DEF PyThreadState *_save=NULL;
+     991             : #if NPY_ALLOW_THREADS
+     992             : #define NPY_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
+     993             : #define NPY_END_ALLOW_THREADS Py_END_ALLOW_THREADS
+     994             : #define NPY_BEGIN_THREADS do {_save = PyEval_SaveThread();} while (0);
+     995             : #define NPY_END_THREADS   do { if (_save) \
+     996             :                 { PyEval_RestoreThread(_save); _save = NULL;} } while (0);
+     997             : #define NPY_BEGIN_THREADS_THRESHOLDED(loop_size) do { if ((loop_size) > 500) \
+     998             :                 { _save = PyEval_SaveThread();} } while (0);
+     999             : 
+    1000             : #define NPY_BEGIN_THREADS_DESCR(dtype) \
+    1001             :         do {if (!(PyDataType_FLAGCHK((dtype), NPY_NEEDS_PYAPI))) \
+    1002             :                 NPY_BEGIN_THREADS;} while (0);
+    1003             : 
+    1004             : #define NPY_END_THREADS_DESCR(dtype) \
+    1005             :         do {if (!(PyDataType_FLAGCHK((dtype), NPY_NEEDS_PYAPI))) \
+    1006             :                 NPY_END_THREADS; } while (0);
+    1007             : 
+    1008             : #define NPY_ALLOW_C_API_DEF  PyGILState_STATE __save__;
+    1009             : #define NPY_ALLOW_C_API      do {__save__ = PyGILState_Ensure();} while (0);
+    1010             : #define NPY_DISABLE_C_API    do {PyGILState_Release(__save__);} while (0);
+    1011             : #else
+    1012             : #define NPY_BEGIN_ALLOW_THREADS
+    1013             : #define NPY_END_ALLOW_THREADS
+    1014             : #define NPY_BEGIN_THREADS
+    1015             : #define NPY_END_THREADS
+    1016             : #define NPY_BEGIN_THREADS_THRESHOLDED(loop_size)
+    1017             : #define NPY_BEGIN_THREADS_DESCR(dtype)
+    1018             : #define NPY_END_THREADS_DESCR(dtype)
+    1019             : #define NPY_ALLOW_C_API_DEF
+    1020             : #define NPY_ALLOW_C_API
+    1021             : #define NPY_DISABLE_C_API
+    1022             : #endif
+    1023             : 
+    1024             : /**********************************
+    1025             :  * The nditer object, added in 1.6
+    1026             :  **********************************/
+    1027             : 
+    1028             : /* The actual structure of the iterator is an internal detail */
+    1029             : typedef struct NpyIter_InternalOnly NpyIter;
+    1030             : 
+    1031             : /* Iterator function pointers that may be specialized */
+    1032             : typedef int (NpyIter_IterNextFunc)(NpyIter *iter);
+    1033             : typedef void (NpyIter_GetMultiIndexFunc)(NpyIter *iter,
+    1034             :                                       npy_intp *outcoords);
+    1035             : 
+    1036             : /*** Global flags that may be passed to the iterator constructors ***/
+    1037             : 
+    1038             : /* Track an index representing C order */
+    1039             : #define NPY_ITER_C_INDEX                    0x00000001
+    1040             : /* Track an index representing Fortran order */
+    1041             : #define NPY_ITER_F_INDEX                    0x00000002
+    1042             : /* Track a multi-index */
+    1043             : #define NPY_ITER_MULTI_INDEX                0x00000004
+    1044             : /* User code external to the iterator does the 1-dimensional innermost loop */
+    1045             : #define NPY_ITER_EXTERNAL_LOOP              0x00000008
+    1046             : /* Convert all the operands to a common data type */
+    1047             : #define NPY_ITER_COMMON_DTYPE               0x00000010
+    1048             : /* Operands may hold references, requiring API access during iteration */
+    1049             : #define NPY_ITER_REFS_OK                    0x00000020
+    1050             : /* Zero-sized operands should be permitted, iteration checks IterSize for 0 */
+    1051             : #define NPY_ITER_ZEROSIZE_OK                0x00000040
+    1052             : /* Permits reductions (size-0 stride with dimension size > 1) */
+    1053             : #define NPY_ITER_REDUCE_OK                  0x00000080
+    1054             : /* Enables sub-range iteration */
+    1055             : #define NPY_ITER_RANGED                     0x00000100
+    1056             : /* Enables buffering */
+    1057             : #define NPY_ITER_BUFFERED                   0x00000200
+    1058             : /* When buffering is enabled, grows the inner loop if possible */
+    1059             : #define NPY_ITER_GROWINNER                  0x00000400
+    1060             : /* Delay allocation of buffers until first Reset* call */
+    1061             : #define NPY_ITER_DELAY_BUFALLOC             0x00000800
+    1062             : /* When NPY_KEEPORDER is specified, disable reversing negative-stride axes */
+    1063             : #define NPY_ITER_DONT_NEGATE_STRIDES        0x00001000
+    1064             : /*
+    1065             :  * If output operands overlap with other operands (based on heuristics that
+    1066             :  * has false positives but no false negatives), make temporary copies to
+    1067             :  * eliminate overlap.
+    1068             :  */
+    1069             : #define NPY_ITER_COPY_IF_OVERLAP            0x00002000
+    1070             : 
+    1071             : /*** Per-operand flags that may be passed to the iterator constructors ***/
+    1072             : 
+    1073             : /* The operand will be read from and written to */
+    1074             : #define NPY_ITER_READWRITE                  0x00010000
+    1075             : /* The operand will only be read from */
+    1076             : #define NPY_ITER_READONLY                   0x00020000
+    1077             : /* The operand will only be written to */
+    1078             : #define NPY_ITER_WRITEONLY                  0x00040000
+    1079             : /* The operand's data must be in native byte order */
+    1080             : #define NPY_ITER_NBO                        0x00080000
+    1081             : /* The operand's data must be aligned */
+    1082             : #define NPY_ITER_ALIGNED                    0x00100000
+    1083             : /* The operand's data must be contiguous (within the inner loop) */
+    1084             : #define NPY_ITER_CONTIG                     0x00200000
+    1085             : /* The operand may be copied to satisfy requirements */
+    1086             : #define NPY_ITER_COPY                       0x00400000
+    1087             : /* The operand may be copied with WRITEBACKIFCOPY to satisfy requirements */
+    1088             : #define NPY_ITER_UPDATEIFCOPY               0x00800000
+    1089             : /* Allocate the operand if it is NULL */
+    1090             : #define NPY_ITER_ALLOCATE                   0x01000000
+    1091             : /* If an operand is allocated, don't use any subtype */
+    1092             : #define NPY_ITER_NO_SUBTYPE                 0x02000000
+    1093             : /* This is a virtual array slot, operand is NULL but temporary data is there */
+    1094             : #define NPY_ITER_VIRTUAL                    0x04000000
+    1095             : /* Require that the dimension match the iterator dimensions exactly */
+    1096             : #define NPY_ITER_NO_BROADCAST               0x08000000
+    1097             : /* A mask is being used on this array, affects buffer -> array copy */
+    1098             : #define NPY_ITER_WRITEMASKED                0x10000000
+    1099             : /* This array is the mask for all WRITEMASKED operands */
+    1100             : #define NPY_ITER_ARRAYMASK                  0x20000000
+    1101             : /* Assume iterator order data access for COPY_IF_OVERLAP */
+    1102             : #define NPY_ITER_OVERLAP_ASSUME_ELEMENTWISE 0x40000000
+    1103             : 
+    1104             : #define NPY_ITER_GLOBAL_FLAGS               0x0000ffff
+    1105             : #define NPY_ITER_PER_OP_FLAGS               0xffff0000
+    1106             : 
+    1107             : 
+    1108             : /*****************************
+    1109             :  * Basic iterator object
+    1110             :  *****************************/
+    1111             : 
+    1112             : /* FWD declaration */
+    1113             : typedef struct PyArrayIterObject_tag PyArrayIterObject;
+    1114             : 
+    1115             : /*
+    1116             :  * type of the function which translates a set of coordinates to a
+    1117             :  * pointer to the data
+    1118             :  */
+    1119             : typedef char* (*npy_iter_get_dataptr_t)(
+    1120             :         PyArrayIterObject* iter, const npy_intp*);
+    1121             : 
+    1122             : struct PyArrayIterObject_tag {
+    1123             :         PyObject_HEAD
+    1124             :         int               nd_m1;            /* number of dimensions - 1 */
+    1125             :         npy_intp          index, size;
+    1126             :         npy_intp          coordinates[NPY_MAXDIMS];/* N-dimensional loop */
+    1127             :         npy_intp          dims_m1[NPY_MAXDIMS];    /* ao->dimensions - 1 */
+    1128             :         npy_intp          strides[NPY_MAXDIMS];    /* ao->strides or fake */
+    1129             :         npy_intp          backstrides[NPY_MAXDIMS];/* how far to jump back */
+    1130             :         npy_intp          factors[NPY_MAXDIMS];     /* shape factors */
+    1131             :         PyArrayObject     *ao;
+    1132             :         char              *dataptr;        /* pointer to current item*/
+    1133             :         npy_bool          contiguous;
+    1134             : 
+    1135             :         npy_intp          bounds[NPY_MAXDIMS][2];
+    1136             :         npy_intp          limits[NPY_MAXDIMS][2];
+    1137             :         npy_intp          limits_sizes[NPY_MAXDIMS];
+    1138             :         npy_iter_get_dataptr_t translate;
+    1139             : } ;
+    1140             : 
+    1141             : 
+    1142             : /* Iterator API */
+    1143             : #define PyArrayIter_Check(op) PyObject_TypeCheck((op), &PyArrayIter_Type)
+    1144             : 
+    1145             : #define _PyAIT(it) ((PyArrayIterObject *)(it))
+    1146             : #define PyArray_ITER_RESET(it) do { \
+    1147             :         _PyAIT(it)->index = 0; \
+    1148             :         _PyAIT(it)->dataptr = PyArray_BYTES(_PyAIT(it)->ao); \
+    1149             :         memset(_PyAIT(it)->coordinates, 0, \
+    1150             :                (_PyAIT(it)->nd_m1+1)*sizeof(npy_intp)); \
+    1151             : } while (0)
+    1152             : 
+    1153             : #define _PyArray_ITER_NEXT1(it) do { \
+    1154             :         (it)->dataptr += _PyAIT(it)->strides[0]; \
+    1155             :         (it)->coordinates[0]++; \
+    1156             : } while (0)
+    1157             : 
+    1158             : #define _PyArray_ITER_NEXT2(it) do { \
+    1159             :         if ((it)->coordinates[1] < (it)->dims_m1[1]) { \
+    1160             :                 (it)->coordinates[1]++; \
+    1161             :                 (it)->dataptr += (it)->strides[1]; \
+    1162             :         } \
+    1163             :         else { \
+    1164             :                 (it)->coordinates[1] = 0; \
+    1165             :                 (it)->coordinates[0]++; \
+    1166             :                 (it)->dataptr += (it)->strides[0] - \
+    1167             :                         (it)->backstrides[1]; \
+    1168             :         } \
+    1169             : } while (0)
+    1170             : 
+    1171             : #define PyArray_ITER_NEXT(it) do { \
+    1172             :         _PyAIT(it)->index++; \
+    1173             :         if (_PyAIT(it)->nd_m1 == 0) { \
+    1174             :                 _PyArray_ITER_NEXT1(_PyAIT(it)); \
+    1175             :         } \
+    1176             :         else if (_PyAIT(it)->contiguous) \
+    1177             :                 _PyAIT(it)->dataptr += PyArray_DESCR(_PyAIT(it)->ao)->elsize; \
+    1178             :         else if (_PyAIT(it)->nd_m1 == 1) { \
+    1179             :                 _PyArray_ITER_NEXT2(_PyAIT(it)); \
+    1180             :         } \
+    1181             :         else { \
+    1182             :                 int __npy_i; \
+    1183             :                 for (__npy_i=_PyAIT(it)->nd_m1; __npy_i >= 0; __npy_i--) { \
+    1184             :                         if (_PyAIT(it)->coordinates[__npy_i] < \
+    1185             :                             _PyAIT(it)->dims_m1[__npy_i]) { \
+    1186             :                                 _PyAIT(it)->coordinates[__npy_i]++; \
+    1187             :                                 _PyAIT(it)->dataptr += \
+    1188             :                                         _PyAIT(it)->strides[__npy_i]; \
+    1189             :                                 break; \
+    1190             :                         } \
+    1191             :                         else { \
+    1192             :                                 _PyAIT(it)->coordinates[__npy_i] = 0; \
+    1193             :                                 _PyAIT(it)->dataptr -= \
+    1194             :                                         _PyAIT(it)->backstrides[__npy_i]; \
+    1195             :                         } \
+    1196             :                 } \
+    1197             :         } \
+    1198             : } while (0)
+    1199             : 
+    1200             : #define PyArray_ITER_GOTO(it, destination) do { \
+    1201             :         int __npy_i; \
+    1202             :         _PyAIT(it)->index = 0; \
+    1203             :         _PyAIT(it)->dataptr = PyArray_BYTES(_PyAIT(it)->ao); \
+    1204             :         for (__npy_i = _PyAIT(it)->nd_m1; __npy_i>=0; __npy_i--) { \
+    1205             :                 if (destination[__npy_i] < 0) { \
+    1206             :                         destination[__npy_i] += \
+    1207             :                                 _PyAIT(it)->dims_m1[__npy_i]+1; \
+    1208             :                 } \
+    1209             :                 _PyAIT(it)->dataptr += destination[__npy_i] * \
+    1210             :                         _PyAIT(it)->strides[__npy_i]; \
+    1211             :                 _PyAIT(it)->coordinates[__npy_i] = \
+    1212             :                         destination[__npy_i]; \
+    1213             :                 _PyAIT(it)->index += destination[__npy_i] * \
+    1214             :                         ( __npy_i==_PyAIT(it)->nd_m1 ? 1 : \
+    1215             :                           _PyAIT(it)->dims_m1[__npy_i+1]+1) ; \
+    1216             :         } \
+    1217             : } while (0)
+    1218             : 
+    1219             : #define PyArray_ITER_GOTO1D(it, ind) do { \
+    1220             :         int __npy_i; \
+    1221             :         npy_intp __npy_ind = (npy_intp)(ind); \
+    1222             :         if (__npy_ind < 0) __npy_ind += _PyAIT(it)->size; \
+    1223             :         _PyAIT(it)->index = __npy_ind; \
+    1224             :         if (_PyAIT(it)->nd_m1 == 0) { \
+    1225             :                 _PyAIT(it)->dataptr = PyArray_BYTES(_PyAIT(it)->ao) + \
+    1226             :                         __npy_ind * _PyAIT(it)->strides[0]; \
+    1227             :         } \
+    1228             :         else if (_PyAIT(it)->contiguous) \
+    1229             :                 _PyAIT(it)->dataptr = PyArray_BYTES(_PyAIT(it)->ao) + \
+    1230             :                         __npy_ind * PyArray_DESCR(_PyAIT(it)->ao)->elsize; \
+    1231             :         else { \
+    1232             :                 _PyAIT(it)->dataptr = PyArray_BYTES(_PyAIT(it)->ao); \
+    1233             :                 for (__npy_i = 0; __npy_i<=_PyAIT(it)->nd_m1; \
+    1234             :                      __npy_i++) { \
+    1235             :                         _PyAIT(it)->coordinates[__npy_i] = \
+    1236             :                                 (__npy_ind / _PyAIT(it)->factors[__npy_i]); \
+    1237             :                         _PyAIT(it)->dataptr += \
+    1238             :                                 (__npy_ind / _PyAIT(it)->factors[__npy_i]) \
+    1239             :                                 * _PyAIT(it)->strides[__npy_i]; \
+    1240             :                         __npy_ind %= _PyAIT(it)->factors[__npy_i]; \
+    1241             :                 } \
+    1242             :         } \
+    1243             : } while (0)
+    1244             : 
+    1245             : #define PyArray_ITER_DATA(it) ((void *)(_PyAIT(it)->dataptr))
+    1246             : 
+    1247             : #define PyArray_ITER_NOTDONE(it) (_PyAIT(it)->index < _PyAIT(it)->size)
+    1248             : 
+    1249             : 
+    1250             : /*
+    1251             :  * Any object passed to PyArray_Broadcast must be binary compatible
+    1252             :  * with this structure.
+    1253             :  */
+    1254             : 
+    1255             : typedef struct {
+    1256             :         PyObject_HEAD
+    1257             :         int                  numiter;                 /* number of iters */
+    1258             :         npy_intp             size;                    /* broadcasted size */
+    1259             :         npy_intp             index;                   /* current index */
+    1260             :         int                  nd;                      /* number of dims */
+    1261             :         npy_intp             dimensions[NPY_MAXDIMS]; /* dimensions */
+    1262             :         PyArrayIterObject    *iters[NPY_MAXARGS];     /* iterators */
+    1263             : } PyArrayMultiIterObject;
+    1264             : 
+    1265             : #define _PyMIT(m) ((PyArrayMultiIterObject *)(m))
+    1266             : #define PyArray_MultiIter_RESET(multi) do {                                   \
+    1267             :         int __npy_mi;                                                         \
+    1268             :         _PyMIT(multi)->index = 0;                                             \
+    1269             :         for (__npy_mi=0; __npy_mi < _PyMIT(multi)->numiter;  __npy_mi++) {    \
+    1270             :                 PyArray_ITER_RESET(_PyMIT(multi)->iters[__npy_mi]);           \
+    1271             :         }                                                                     \
+    1272             : } while (0)
+    1273             : 
+    1274             : #define PyArray_MultiIter_NEXT(multi) do {                                    \
+    1275             :         int __npy_mi;                                                         \
+    1276             :         _PyMIT(multi)->index++;                                               \
+    1277             :         for (__npy_mi=0; __npy_mi < _PyMIT(multi)->numiter;   __npy_mi++) {   \
+    1278             :                 PyArray_ITER_NEXT(_PyMIT(multi)->iters[__npy_mi]);            \
+    1279             :         }                                                                     \
+    1280             : } while (0)
+    1281             : 
+    1282             : #define PyArray_MultiIter_GOTO(multi, dest) do {                            \
+    1283             :         int __npy_mi;                                                       \
+    1284             :         for (__npy_mi=0; __npy_mi < _PyMIT(multi)->numiter; __npy_mi++) {   \
+    1285             :                 PyArray_ITER_GOTO(_PyMIT(multi)->iters[__npy_mi], dest);    \
+    1286             :         }                                                                   \
+    1287             :         _PyMIT(multi)->index = _PyMIT(multi)->iters[0]->index;              \
+    1288             : } while (0)
+    1289             : 
+    1290             : #define PyArray_MultiIter_GOTO1D(multi, ind) do {                          \
+    1291             :         int __npy_mi;                                                      \
+    1292             :         for (__npy_mi=0; __npy_mi < _PyMIT(multi)->numiter; __npy_mi++) {  \
+    1293             :                 PyArray_ITER_GOTO1D(_PyMIT(multi)->iters[__npy_mi], ind);  \
+    1294             :         }                                                                  \
+    1295             :         _PyMIT(multi)->index = _PyMIT(multi)->iters[0]->index;             \
+    1296             : } while (0)
+    1297             : 
+    1298             : #define PyArray_MultiIter_DATA(multi, i)                \
+    1299             :         ((void *)(_PyMIT(multi)->iters[i]->dataptr))
+    1300             : 
+    1301             : #define PyArray_MultiIter_NEXTi(multi, i)               \
+    1302             :         PyArray_ITER_NEXT(_PyMIT(multi)->iters[i])
+    1303             : 
+    1304             : #define PyArray_MultiIter_NOTDONE(multi)                \
+    1305             :         (_PyMIT(multi)->index < _PyMIT(multi)->size)
+    1306             : 
+    1307             : /*
+    1308             :  * Store the information needed for fancy-indexing over an array. The
+    1309             :  * fields are slightly unordered to keep consec, dataptr and subspace
+    1310             :  * where they were originally.
+    1311             :  */
+    1312             : typedef struct {
+    1313             :         PyObject_HEAD
+    1314             :         /*
+    1315             :          * Multi-iterator portion --- needs to be present in this
+    1316             :          * order to work with PyArray_Broadcast
+    1317             :          */
+    1318             : 
+    1319             :         int                   numiter;                 /* number of index-array
+    1320             :                                                           iterators */
+    1321             :         npy_intp              size;                    /* size of broadcasted
+    1322             :                                                           result */
+    1323             :         npy_intp              index;                   /* current index */
+    1324             :         int                   nd;                      /* number of dims */
+    1325             :         npy_intp              dimensions[NPY_MAXDIMS]; /* dimensions */
+    1326             :         NpyIter               *outer;                  /* index objects
+    1327             :                                                           iterator */
+    1328             :         void                  *unused[NPY_MAXDIMS - 2];
+    1329             :         PyArrayObject         *array;
+    1330             :         /* Flat iterator for the indexed array. For compatibility solely. */
+    1331             :         PyArrayIterObject     *ait;
+    1332             : 
+    1333             :         /*
+    1334             :          * Subspace array. For binary compatibility (was an iterator,
+    1335             :          * but only the check for NULL should be used).
+    1336             :          */
+    1337             :         PyArrayObject         *subspace;
+    1338             : 
+    1339             :         /*
+    1340             :          * if subspace iteration, then this is the array of axes in
+    1341             :          * the underlying array represented by the index objects
+    1342             :          */
+    1343             :         int                   iteraxes[NPY_MAXDIMS];
+    1344             :         npy_intp              fancy_strides[NPY_MAXDIMS];
+    1345             : 
+    1346             :         /* pointer when all fancy indices are 0 */
+    1347             :         char                  *baseoffset;
+    1348             : 
+    1349             :         /*
+    1350             :          * after binding consec denotes at which axis the fancy axes
+    1351             :          * are inserted.
+    1352             :          */
+    1353             :         int                   consec;
+    1354             :         char                  *dataptr;
+    1355             : 
+    1356             :         int                   nd_fancy;
+    1357             :         npy_intp              fancy_dims[NPY_MAXDIMS];
+    1358             : 
+    1359             :         /*
+    1360             :          * Whether the iterator (any of the iterators) requires API.  This is
+    1361             :          * unused by NumPy itself; ArrayMethod flags are more precise.
+    1362             :          */
+    1363             :         int                   needs_api;
+    1364             : 
+    1365             :         /*
+    1366             :          * Extra op information.
+    1367             :          */
+    1368             :         PyArrayObject         *extra_op;
+    1369             :         PyArray_Descr         *extra_op_dtype;         /* desired dtype */
+    1370             :         npy_uint32            *extra_op_flags;         /* Iterator flags */
+    1371             : 
+    1372             :         NpyIter               *extra_op_iter;
+    1373             :         NpyIter_IterNextFunc  *extra_op_next;
+    1374             :         char                  **extra_op_ptrs;
+    1375             : 
+    1376             :         /*
+    1377             :          * Information about the iteration state.
+    1378             :          */
+    1379             :         NpyIter_IterNextFunc  *outer_next;
+    1380             :         char                  **outer_ptrs;
+    1381             :         npy_intp              *outer_strides;
+    1382             : 
+    1383             :         /*
+    1384             :          * Information about the subspace iterator.
+    1385             :          */
+    1386             :         NpyIter               *subspace_iter;
+    1387             :         NpyIter_IterNextFunc  *subspace_next;
+    1388             :         char                  **subspace_ptrs;
+    1389             :         npy_intp              *subspace_strides;
+    1390             : 
+    1391             :         /* Count for the external loop (which ever it is) for API iteration */
+    1392             :         npy_intp              iter_count;
+    1393             : 
+    1394             : } PyArrayMapIterObject;
+    1395             : 
+    1396             : enum {
+    1397             :     NPY_NEIGHBORHOOD_ITER_ZERO_PADDING,
+    1398             :     NPY_NEIGHBORHOOD_ITER_ONE_PADDING,
+    1399             :     NPY_NEIGHBORHOOD_ITER_CONSTANT_PADDING,
+    1400             :     NPY_NEIGHBORHOOD_ITER_CIRCULAR_PADDING,
+    1401             :     NPY_NEIGHBORHOOD_ITER_MIRROR_PADDING
+    1402             : };
+    1403             : 
+    1404             : typedef struct {
+    1405             :     PyObject_HEAD
+    1406             : 
+    1407             :     /*
+    1408             :      * PyArrayIterObject part: keep this in this exact order
+    1409             :      */
+    1410             :     int               nd_m1;            /* number of dimensions - 1 */
+    1411             :     npy_intp          index, size;
+    1412             :     npy_intp          coordinates[NPY_MAXDIMS];/* N-dimensional loop */
+    1413             :     npy_intp          dims_m1[NPY_MAXDIMS];    /* ao->dimensions - 1 */
+    1414             :     npy_intp          strides[NPY_MAXDIMS];    /* ao->strides or fake */
+    1415             :     npy_intp          backstrides[NPY_MAXDIMS];/* how far to jump back */
+    1416             :     npy_intp          factors[NPY_MAXDIMS];     /* shape factors */
+    1417             :     PyArrayObject     *ao;
+    1418             :     char              *dataptr;        /* pointer to current item*/
+    1419             :     npy_bool          contiguous;
+    1420             : 
+    1421             :     npy_intp          bounds[NPY_MAXDIMS][2];
+    1422             :     npy_intp          limits[NPY_MAXDIMS][2];
+    1423             :     npy_intp          limits_sizes[NPY_MAXDIMS];
+    1424             :     npy_iter_get_dataptr_t translate;
+    1425             : 
+    1426             :     /*
+    1427             :      * New members
+    1428             :      */
+    1429             :     npy_intp nd;
+    1430             : 
+    1431             :     /* Dimensions is the dimension of the array */
+    1432             :     npy_intp dimensions[NPY_MAXDIMS];
+    1433             : 
+    1434             :     /*
+    1435             :      * Neighborhood points coordinates are computed relatively to the
+    1436             :      * point pointed by _internal_iter
+    1437             :      */
+    1438             :     PyArrayIterObject* _internal_iter;
+    1439             :     /*
+    1440             :      * To keep a reference to the representation of the constant value
+    1441             :      * for constant padding
+    1442             :      */
+    1443             :     char* constant;
+    1444             : 
+    1445             :     int mode;
+    1446             : } PyArrayNeighborhoodIterObject;
+    1447             : 
+    1448             : /*
+    1449             :  * Neighborhood iterator API
+    1450             :  */
+    1451             : 
+    1452             : /* General: those work for any mode */
+    1453             : static inline int
+    1454             : PyArrayNeighborhoodIter_Reset(PyArrayNeighborhoodIterObject* iter);
+    1455             : static inline int
+    1456             : PyArrayNeighborhoodIter_Next(PyArrayNeighborhoodIterObject* iter);
+    1457             : #if 0
+    1458             : static inline int
+    1459             : PyArrayNeighborhoodIter_Next2D(PyArrayNeighborhoodIterObject* iter);
+    1460             : #endif
+    1461             : 
+    1462             : /*
+    1463             :  * Include inline implementations - functions defined there are not
+    1464             :  * considered public API
+    1465             :  */
+    1466             : #define NUMPY_CORE_INCLUDE_NUMPY__NEIGHBORHOOD_IMP_H_
+    1467             : #include "_neighborhood_iterator_imp.h"
+    1468             : #undef NUMPY_CORE_INCLUDE_NUMPY__NEIGHBORHOOD_IMP_H_
+    1469             : 
+    1470             : 
+    1471             : 
+    1472             : /* The default array type */
+    1473             : #define NPY_DEFAULT_TYPE NPY_DOUBLE
+    1474             : 
+    1475             : /*
+    1476             :  * All sorts of useful ways to look into a PyArrayObject. It is recommended
+    1477             :  * to use PyArrayObject * objects instead of always casting from PyObject *,
+    1478             :  * for improved type checking.
+    1479             :  *
+    1480             :  * In many cases here the macro versions of the accessors are deprecated,
+    1481             :  * but can't be immediately changed to inline functions because the
+    1482             :  * preexisting macros accept PyObject * and do automatic casts. Inline
+    1483             :  * functions accepting PyArrayObject * provides for some compile-time
+    1484             :  * checking of correctness when working with these objects in C.
+    1485             :  */
+    1486             : 
+    1487             : #define PyArray_ISONESEGMENT(m) (PyArray_CHKFLAGS(m, NPY_ARRAY_C_CONTIGUOUS) || \
+    1488             :                                  PyArray_CHKFLAGS(m, NPY_ARRAY_F_CONTIGUOUS))
+    1489             : 
+    1490             : #define PyArray_ISFORTRAN(m) (PyArray_CHKFLAGS(m, NPY_ARRAY_F_CONTIGUOUS) && \
+    1491             :                              (!PyArray_CHKFLAGS(m, NPY_ARRAY_C_CONTIGUOUS)))
+    1492             : 
+    1493             : #define PyArray_FORTRAN_IF(m) ((PyArray_CHKFLAGS(m, NPY_ARRAY_F_CONTIGUOUS) ? \
+    1494             :                                NPY_ARRAY_F_CONTIGUOUS : 0))
+    1495             : 
+    1496             : #if (defined(NPY_NO_DEPRECATED_API) && (NPY_1_7_API_VERSION <= NPY_NO_DEPRECATED_API))
+    1497             : /*
+    1498             :  * Changing access macros into functions, to allow for future hiding
+    1499             :  * of the internal memory layout. This later hiding will allow the 2.x series
+    1500             :  * to change the internal representation of arrays without affecting
+    1501             :  * ABI compatibility.
+    1502             :  */
+    1503             : 
+    1504             : static inline int
+    1505             : PyArray_NDIM(const PyArrayObject *arr)
+    1506             : {
+    1507             :     return ((PyArrayObject_fields *)arr)->nd;
+    1508             : }
+    1509             : 
+    1510             : static inline void *
+    1511             : PyArray_DATA(PyArrayObject *arr)
+    1512             : {
+    1513           0 :     return ((PyArrayObject_fields *)arr)->data;
+    1514             : }
+    1515             : 
+    1516             : static inline char *
+    1517             : PyArray_BYTES(PyArrayObject *arr)
+    1518             : {
+    1519             :     return ((PyArrayObject_fields *)arr)->data;
+    1520             : }
+    1521             : 
+    1522             : static inline npy_intp *
+    1523             : PyArray_DIMS(PyArrayObject *arr)
+    1524             : {
+    1525           0 :     return ((PyArrayObject_fields *)arr)->dimensions;
+    1526             : }
+    1527             : 
+    1528             : static inline npy_intp *
+    1529             : PyArray_STRIDES(PyArrayObject *arr)
+    1530             : {
+    1531             :     return ((PyArrayObject_fields *)arr)->strides;
+    1532             : }
+    1533             : 
+    1534             : static inline npy_intp
+    1535             : PyArray_DIM(const PyArrayObject *arr, int idim)
+    1536             : {
+    1537             :     return ((PyArrayObject_fields *)arr)->dimensions[idim];
+    1538             : }
+    1539             : 
+    1540             : static inline npy_intp
+    1541             : PyArray_STRIDE(const PyArrayObject *arr, int istride)
+    1542             : {
+    1543             :     return ((PyArrayObject_fields *)arr)->strides[istride];
+    1544             : }
+    1545             : 
+    1546             : static inline NPY_RETURNS_BORROWED_REF PyObject *
+    1547             : PyArray_BASE(PyArrayObject *arr)
+    1548             : {
+    1549             :     return ((PyArrayObject_fields *)arr)->base;
+    1550             : }
+    1551             : 
+    1552             : static inline NPY_RETURNS_BORROWED_REF PyArray_Descr *
+    1553             : PyArray_DESCR(PyArrayObject *arr)
+    1554             : {
+    1555             :     return ((PyArrayObject_fields *)arr)->descr;
+    1556             : }
+    1557             : 
+    1558             : static inline int
+    1559             : PyArray_FLAGS(const PyArrayObject *arr)
+    1560             : {
+    1561           0 :     return ((PyArrayObject_fields *)arr)->flags;
+    1562             : }
+    1563             : 
+    1564             : static inline npy_intp
+    1565             : PyArray_ITEMSIZE(const PyArrayObject *arr)
+    1566             : {
+    1567             :     return ((PyArrayObject_fields *)arr)->descr->elsize;
+    1568             : }
+    1569             : 
+    1570             : static inline int
+    1571             : PyArray_TYPE(const PyArrayObject *arr)
+    1572             : {
+    1573           0 :     return ((PyArrayObject_fields *)arr)->descr->type_num;
+    1574             : }
+    1575             : 
+    1576             : static inline int
+    1577             : PyArray_CHKFLAGS(const PyArrayObject *arr, int flags)
+    1578             : {
+    1579           0 :     return (PyArray_FLAGS(arr) & flags) == flags;
+    1580             : }
+    1581             : 
+    1582             : static inline PyObject *
+    1583             : PyArray_GETITEM(const PyArrayObject *arr, const char *itemptr)
+    1584             : {
+    1585             :     return ((PyArrayObject_fields *)arr)->descr->f->getitem(
+    1586             :                                         (void *)itemptr, (PyArrayObject *)arr);
+    1587             : }
+    1588             : 
+    1589             : /*
+    1590             :  * SETITEM should only be used if it is known that the value is a scalar
+    1591             :  * and of a type understood by the arrays dtype.
+    1592             :  * Use `PyArray_Pack` if the value may be of a different dtype.
+    1593             :  */
+    1594             : static inline int
+    1595             : PyArray_SETITEM(PyArrayObject *arr, char *itemptr, PyObject *v)
+    1596             : {
+    1597             :     return ((PyArrayObject_fields *)arr)->descr->f->setitem(v, itemptr, arr);
+    1598             : }
+    1599             : 
+    1600             : #else
+    1601             : 
+    1602             : /* These macros are deprecated as of NumPy 1.7. */
+    1603             : #define PyArray_NDIM(obj) (((PyArrayObject_fields *)(obj))->nd)
+    1604             : #define PyArray_BYTES(obj) (((PyArrayObject_fields *)(obj))->data)
+    1605             : #define PyArray_DATA(obj) ((void *)((PyArrayObject_fields *)(obj))->data)
+    1606             : #define PyArray_DIMS(obj) (((PyArrayObject_fields *)(obj))->dimensions)
+    1607             : #define PyArray_STRIDES(obj) (((PyArrayObject_fields *)(obj))->strides)
+    1608             : #define PyArray_DIM(obj,n) (PyArray_DIMS(obj)[n])
+    1609             : #define PyArray_STRIDE(obj,n) (PyArray_STRIDES(obj)[n])
+    1610             : #define PyArray_BASE(obj) (((PyArrayObject_fields *)(obj))->base)
+    1611             : #define PyArray_DESCR(obj) (((PyArrayObject_fields *)(obj))->descr)
+    1612             : #define PyArray_FLAGS(obj) (((PyArrayObject_fields *)(obj))->flags)
+    1613             : #define PyArray_CHKFLAGS(m, FLAGS) \
+    1614             :         ((((PyArrayObject_fields *)(m))->flags & (FLAGS)) == (FLAGS))
+    1615             : #define PyArray_ITEMSIZE(obj) \
+    1616             :                     (((PyArrayObject_fields *)(obj))->descr->elsize)
+    1617             : #define PyArray_TYPE(obj) \
+    1618             :                     (((PyArrayObject_fields *)(obj))->descr->type_num)
+    1619             : #define PyArray_GETITEM(obj,itemptr) \
+    1620             :         PyArray_DESCR(obj)->f->getitem((char *)(itemptr), \
+    1621             :                                      (PyArrayObject *)(obj))
+    1622             : 
+    1623             : #define PyArray_SETITEM(obj,itemptr,v) \
+    1624             :         PyArray_DESCR(obj)->f->setitem((PyObject *)(v), \
+    1625             :                                      (char *)(itemptr), \
+    1626             :                                      (PyArrayObject *)(obj))
+    1627             : #endif
+    1628             : 
+    1629             : static inline PyArray_Descr *
+    1630             : PyArray_DTYPE(PyArrayObject *arr)
+    1631             : {
+    1632             :     return ((PyArrayObject_fields *)arr)->descr;
+    1633             : }
+    1634             : 
+    1635             : static inline npy_intp *
+    1636             : PyArray_SHAPE(PyArrayObject *arr)
+    1637             : {
+    1638             :     return ((PyArrayObject_fields *)arr)->dimensions;
+    1639             : }
+    1640             : 
+    1641             : /*
+    1642             :  * Enables the specified array flags. Does no checking,
+    1643             :  * assumes you know what you're doing.
+    1644             :  */
+    1645             : static inline void
+    1646             : PyArray_ENABLEFLAGS(PyArrayObject *arr, int flags)
+    1647             : {
+    1648             :     ((PyArrayObject_fields *)arr)->flags |= flags;
+    1649             : }
+    1650             : 
+    1651             : /*
+    1652             :  * Clears the specified array flags. Does no checking,
+    1653             :  * assumes you know what you're doing.
+    1654             :  */
+    1655             : static inline void
+    1656             : PyArray_CLEARFLAGS(PyArrayObject *arr, int flags)
+    1657             : {
+    1658             :     ((PyArrayObject_fields *)arr)->flags &= ~flags;
+    1659             : }
+    1660             : 
+    1661             : #if NPY_FEATURE_VERSION >= NPY_1_22_API_VERSION
+    1662             :     static inline NPY_RETURNS_BORROWED_REF PyObject *
+    1663             :     PyArray_HANDLER(PyArrayObject *arr)
+    1664             :     {
+    1665             :         return ((PyArrayObject_fields *)arr)->mem_handler;
+    1666             :     }
+    1667             : #endif
+    1668             : 
+    1669             : #define PyTypeNum_ISBOOL(type) ((type) == NPY_BOOL)
+    1670             : 
+    1671             : #define PyTypeNum_ISUNSIGNED(type) (((type) == NPY_UBYTE) ||   \
+    1672             :                                  ((type) == NPY_USHORT) ||     \
+    1673             :                                  ((type) == NPY_UINT) ||       \
+    1674             :                                  ((type) == NPY_ULONG) ||      \
+    1675             :                                  ((type) == NPY_ULONGLONG))
+    1676             : 
+    1677             : #define PyTypeNum_ISSIGNED(type) (((type) == NPY_BYTE) ||      \
+    1678             :                                ((type) == NPY_SHORT) ||        \
+    1679             :                                ((type) == NPY_INT) ||          \
+    1680             :                                ((type) == NPY_LONG) ||         \
+    1681             :                                ((type) == NPY_LONGLONG))
+    1682             : 
+    1683             : #define PyTypeNum_ISINTEGER(type) (((type) >= NPY_BYTE) &&     \
+    1684             :                                 ((type) <= NPY_ULONGLONG))
+    1685             : 
+    1686             : #define PyTypeNum_ISFLOAT(type) ((((type) >= NPY_FLOAT) && \
+    1687             :                               ((type) <= NPY_LONGDOUBLE)) || \
+    1688             :                               ((type) == NPY_HALF))
+    1689             : 
+    1690             : #define PyTypeNum_ISNUMBER(type) (((type) <= NPY_CLONGDOUBLE) || \
+    1691             :                                   ((type) == NPY_HALF))
+    1692             : 
+    1693             : #define PyTypeNum_ISSTRING(type) (((type) == NPY_STRING) ||    \
+    1694             :                                   ((type) == NPY_UNICODE))
+    1695             : 
+    1696             : #define PyTypeNum_ISCOMPLEX(type) (((type) >= NPY_CFLOAT) &&   \
+    1697             :                                 ((type) <= NPY_CLONGDOUBLE))
+    1698             : 
+    1699             : #define PyTypeNum_ISPYTHON(type) (((type) == NPY_LONG) ||      \
+    1700             :                                   ((type) == NPY_DOUBLE) ||    \
+    1701             :                                   ((type) == NPY_CDOUBLE) ||   \
+    1702             :                                   ((type) == NPY_BOOL) ||      \
+    1703             :                                   ((type) == NPY_OBJECT ))
+    1704             : 
+    1705             : #define PyTypeNum_ISFLEXIBLE(type) (((type) >=NPY_STRING) &&  \
+    1706             :                                     ((type) <=NPY_VOID))
+    1707             : 
+    1708             : #define PyTypeNum_ISDATETIME(type) (((type) >=NPY_DATETIME) &&  \
+    1709             :                                     ((type) <=NPY_TIMEDELTA))
+    1710             : 
+    1711             : #define PyTypeNum_ISUSERDEF(type) (((type) >= NPY_USERDEF) && \
+    1712             :                                    ((type) < NPY_USERDEF+     \
+    1713             :                                     NPY_NUMUSERTYPES))
+    1714             : 
+    1715             : #define PyTypeNum_ISEXTENDED(type) (PyTypeNum_ISFLEXIBLE(type) ||  \
+    1716             :                                     PyTypeNum_ISUSERDEF(type))
+    1717             : 
+    1718             : #define PyTypeNum_ISOBJECT(type) ((type) == NPY_OBJECT)
+    1719             : 
+    1720             : 
+    1721             : #define PyDataType_ISBOOL(obj) PyTypeNum_ISBOOL(((PyArray_Descr*)(obj))->type_num)
+    1722             : #define PyDataType_ISUNSIGNED(obj) PyTypeNum_ISUNSIGNED(((PyArray_Descr*)(obj))->type_num)
+    1723             : #define PyDataType_ISSIGNED(obj) PyTypeNum_ISSIGNED(((PyArray_Descr*)(obj))->type_num)
+    1724             : #define PyDataType_ISINTEGER(obj) PyTypeNum_ISINTEGER(((PyArray_Descr*)(obj))->type_num )
+    1725             : #define PyDataType_ISFLOAT(obj) PyTypeNum_ISFLOAT(((PyArray_Descr*)(obj))->type_num)
+    1726             : #define PyDataType_ISNUMBER(obj) PyTypeNum_ISNUMBER(((PyArray_Descr*)(obj))->type_num)
+    1727             : #define PyDataType_ISSTRING(obj) PyTypeNum_ISSTRING(((PyArray_Descr*)(obj))->type_num)
+    1728             : #define PyDataType_ISCOMPLEX(obj) PyTypeNum_ISCOMPLEX(((PyArray_Descr*)(obj))->type_num)
+    1729             : #define PyDataType_ISPYTHON(obj) PyTypeNum_ISPYTHON(((PyArray_Descr*)(obj))->type_num)
+    1730             : #define PyDataType_ISFLEXIBLE(obj) PyTypeNum_ISFLEXIBLE(((PyArray_Descr*)(obj))->type_num)
+    1731             : #define PyDataType_ISDATETIME(obj) PyTypeNum_ISDATETIME(((PyArray_Descr*)(obj))->type_num)
+    1732             : #define PyDataType_ISUSERDEF(obj) PyTypeNum_ISUSERDEF(((PyArray_Descr*)(obj))->type_num)
+    1733             : #define PyDataType_ISEXTENDED(obj) PyTypeNum_ISEXTENDED(((PyArray_Descr*)(obj))->type_num)
+    1734             : #define PyDataType_ISOBJECT(obj) PyTypeNum_ISOBJECT(((PyArray_Descr*)(obj))->type_num)
+    1735             : #define PyDataType_HASFIELDS(obj) (((PyArray_Descr *)(obj))->names != NULL)
+    1736             : #define PyDataType_HASSUBARRAY(dtype) ((dtype)->subarray != NULL)
+    1737             : #define PyDataType_ISUNSIZED(dtype) ((dtype)->elsize == 0 && \
+    1738             :                                       !PyDataType_HASFIELDS(dtype))
+    1739             : #define PyDataType_MAKEUNSIZED(dtype) ((dtype)->elsize = 0)
+    1740             : 
+    1741             : #define PyArray_ISBOOL(obj) PyTypeNum_ISBOOL(PyArray_TYPE(obj))
+    1742             : #define PyArray_ISUNSIGNED(obj) PyTypeNum_ISUNSIGNED(PyArray_TYPE(obj))
+    1743             : #define PyArray_ISSIGNED(obj) PyTypeNum_ISSIGNED(PyArray_TYPE(obj))
+    1744             : #define PyArray_ISINTEGER(obj) PyTypeNum_ISINTEGER(PyArray_TYPE(obj))
+    1745             : #define PyArray_ISFLOAT(obj) PyTypeNum_ISFLOAT(PyArray_TYPE(obj))
+    1746             : #define PyArray_ISNUMBER(obj) PyTypeNum_ISNUMBER(PyArray_TYPE(obj))
+    1747             : #define PyArray_ISSTRING(obj) PyTypeNum_ISSTRING(PyArray_TYPE(obj))
+    1748             : #define PyArray_ISCOMPLEX(obj) PyTypeNum_ISCOMPLEX(PyArray_TYPE(obj))
+    1749             : #define PyArray_ISPYTHON(obj) PyTypeNum_ISPYTHON(PyArray_TYPE(obj))
+    1750             : #define PyArray_ISFLEXIBLE(obj) PyTypeNum_ISFLEXIBLE(PyArray_TYPE(obj))
+    1751             : #define PyArray_ISDATETIME(obj) PyTypeNum_ISDATETIME(PyArray_TYPE(obj))
+    1752             : #define PyArray_ISUSERDEF(obj) PyTypeNum_ISUSERDEF(PyArray_TYPE(obj))
+    1753             : #define PyArray_ISEXTENDED(obj) PyTypeNum_ISEXTENDED(PyArray_TYPE(obj))
+    1754             : #define PyArray_ISOBJECT(obj) PyTypeNum_ISOBJECT(PyArray_TYPE(obj))
+    1755             : #define PyArray_HASFIELDS(obj) PyDataType_HASFIELDS(PyArray_DESCR(obj))
+    1756             : 
+    1757             :     /*
+    1758             :      * FIXME: This should check for a flag on the data-type that
+    1759             :      * states whether or not it is variable length.  Because the
+    1760             :      * ISFLEXIBLE check is hard-coded to the built-in data-types.
+    1761             :      */
+    1762             : #define PyArray_ISVARIABLE(obj) PyTypeNum_ISFLEXIBLE(PyArray_TYPE(obj))
+    1763             : 
+    1764             : #define PyArray_SAFEALIGNEDCOPY(obj) (PyArray_ISALIGNED(obj) && !PyArray_ISVARIABLE(obj))
+    1765             : 
+    1766             : 
+    1767             : #define NPY_LITTLE '<'
+    1768             : #define NPY_BIG '>'
+    1769             : #define NPY_NATIVE '='
+    1770             : #define NPY_SWAP 's'
+    1771             : #define NPY_IGNORE '|'
+    1772             : 
+    1773             : #if NPY_BYTE_ORDER == NPY_BIG_ENDIAN
+    1774             : #define NPY_NATBYTE NPY_BIG
+    1775             : #define NPY_OPPBYTE NPY_LITTLE
+    1776             : #else
+    1777             : #define NPY_NATBYTE NPY_LITTLE
+    1778             : #define NPY_OPPBYTE NPY_BIG
+    1779             : #endif
+    1780             : 
+    1781             : #define PyArray_ISNBO(arg) ((arg) != NPY_OPPBYTE)
+    1782             : #define PyArray_IsNativeByteOrder PyArray_ISNBO
+    1783             : #define PyArray_ISNOTSWAPPED(m) PyArray_ISNBO(PyArray_DESCR(m)->byteorder)
+    1784             : #define PyArray_ISBYTESWAPPED(m) (!PyArray_ISNOTSWAPPED(m))
+    1785             : 
+    1786             : #define PyArray_FLAGSWAP(m, flags) (PyArray_CHKFLAGS(m, flags) &&       \
+    1787             :                                     PyArray_ISNOTSWAPPED(m))
+    1788             : 
+    1789             : #define PyArray_ISCARRAY(m) PyArray_FLAGSWAP(m, NPY_ARRAY_CARRAY)
+    1790             : #define PyArray_ISCARRAY_RO(m) PyArray_FLAGSWAP(m, NPY_ARRAY_CARRAY_RO)
+    1791             : #define PyArray_ISFARRAY(m) PyArray_FLAGSWAP(m, NPY_ARRAY_FARRAY)
+    1792             : #define PyArray_ISFARRAY_RO(m) PyArray_FLAGSWAP(m, NPY_ARRAY_FARRAY_RO)
+    1793             : #define PyArray_ISBEHAVED(m) PyArray_FLAGSWAP(m, NPY_ARRAY_BEHAVED)
+    1794             : #define PyArray_ISBEHAVED_RO(m) PyArray_FLAGSWAP(m, NPY_ARRAY_ALIGNED)
+    1795             : 
+    1796             : 
+    1797             : #define PyDataType_ISNOTSWAPPED(d) PyArray_ISNBO(((PyArray_Descr *)(d))->byteorder)
+    1798             : #define PyDataType_ISBYTESWAPPED(d) (!PyDataType_ISNOTSWAPPED(d))
+    1799             : 
+    1800             : /************************************************************
+    1801             :  * A struct used by PyArray_CreateSortedStridePerm, new in 1.7.
+    1802             :  ************************************************************/
+    1803             : 
+    1804             : typedef struct {
+    1805             :     npy_intp perm, stride;
+    1806             : } npy_stride_sort_item;
+    1807             : 
+    1808             : /************************************************************
+    1809             :  * This is the form of the struct that's stored in the
+    1810             :  * PyCapsule returned by an array's __array_struct__ attribute. See
+    1811             :  * https://docs.scipy.org/doc/numpy/reference/arrays.interface.html for the full
+    1812             :  * documentation.
+    1813             :  ************************************************************/
+    1814             : typedef struct {
+    1815             :     int two;              /*
+    1816             :                            * contains the integer 2 as a sanity
+    1817             :                            * check
+    1818             :                            */
+    1819             : 
+    1820             :     int nd;               /* number of dimensions */
+    1821             : 
+    1822             :     char typekind;        /*
+    1823             :                            * kind in array --- character code of
+    1824             :                            * typestr
+    1825             :                            */
+    1826             : 
+    1827             :     int itemsize;         /* size of each element */
+    1828             : 
+    1829             :     int flags;            /*
+    1830             :                            * how should be data interpreted. Valid
+    1831             :                            * flags are CONTIGUOUS (1), F_CONTIGUOUS (2),
+    1832             :                            * ALIGNED (0x100), NOTSWAPPED (0x200), and
+    1833             :                            * WRITEABLE (0x400).  ARR_HAS_DESCR (0x800)
+    1834             :                            * states that arrdescr field is present in
+    1835             :                            * structure
+    1836             :                            */
+    1837             : 
+    1838             :     npy_intp *shape;       /*
+    1839             :                             * A length-nd array of shape
+    1840             :                             * information
+    1841             :                             */
+    1842             : 
+    1843             :     npy_intp *strides;    /* A length-nd array of stride information */
+    1844             : 
+    1845             :     void *data;           /* A pointer to the first element of the array */
+    1846             : 
+    1847             :     PyObject *descr;      /*
+    1848             :                            * A list of fields or NULL (ignored if flags
+    1849             :                            * does not have ARR_HAS_DESCR flag set)
+    1850             :                            */
+    1851             : } PyArrayInterface;
+    1852             : 
+    1853             : /*
+    1854             :  * This is a function for hooking into the PyDataMem_NEW/FREE/RENEW functions.
+    1855             :  * See the documentation for PyDataMem_SetEventHook.
+    1856             :  */
+    1857             : typedef void (PyDataMem_EventHookFunc)(void *inp, void *outp, size_t size,
+    1858             :                                        void *user_data);
+    1859             : 
+    1860             : 
+    1861             : /*
+    1862             :  * PyArray_DTypeMeta related definitions.
+    1863             :  *
+    1864             :  * As of now, this API is preliminary and will be extended as necessary.
+    1865             :  */
+    1866             : #if defined(NPY_INTERNAL_BUILD) && NPY_INTERNAL_BUILD
+    1867             :     /*
+    1868             :      * The Structures defined in this block are currently considered
+    1869             :      * private API and may change without warning!
+    1870             :      * Part of this (at least the size) is expected to be public API without
+    1871             :      * further modifications.
+    1872             :      */
+    1873             :     /* TODO: Make this definition public in the API, as soon as its settled */
+    1874             :     NPY_NO_EXPORT extern PyTypeObject PyArrayDTypeMeta_Type;
+    1875             : 
+    1876             :     /*
+    1877             :      * While NumPy DTypes would not need to be heap types the plan is to
+    1878             :      * make DTypes available in Python at which point they will be heap types.
+    1879             :      * Since we also wish to add fields to the DType class, this looks like
+    1880             :      * a typical instance definition, but with PyHeapTypeObject instead of
+    1881             :      * only the PyObject_HEAD.
+    1882             :      * This must only be exposed very extremely careful consideration, since
+    1883             :      * it is a fairly complex construct which may be better to allow
+    1884             :      * refactoring of.
+    1885             :      */
+    1886             :     typedef struct {
+    1887             :         PyHeapTypeObject super;
+    1888             : 
+    1889             :         /*
+    1890             :          * Most DTypes will have a singleton default instance, for the
+    1891             :          * parametric legacy DTypes (bytes, string, void, datetime) this
+    1892             :          * may be a pointer to the *prototype* instance?
+    1893             :          */
+    1894             :         PyArray_Descr *singleton;
+    1895             :         /* Copy of the legacy DTypes type number, usually invalid. */
+    1896             :         int type_num;
+    1897             : 
+    1898             :         /* The type object of the scalar instances (may be NULL?) */
+    1899             :         PyTypeObject *scalar_type;
+    1900             :         /*
+    1901             :          * DType flags to signal legacy, parametric, or
+    1902             :          * abstract.  But plenty of space for additional information/flags.
+    1903             :          */
+    1904             :         npy_uint64 flags;
+    1905             : 
+    1906             :         /*
+    1907             :          * Use indirection in order to allow a fixed size for this struct.
+    1908             :          * A stable ABI size makes creating a static DType less painful
+    1909             :          * while also ensuring flexibility for all opaque API (with one
+    1910             :          * indirection due the pointer lookup).
+    1911             :          */
+    1912             :         void *dt_slots;
+    1913             :         void *reserved[3];
+    1914             :     } PyArray_DTypeMeta;
+    1915             : 
+    1916             : #endif  /* NPY_INTERNAL_BUILD */
+    1917             : 
+    1918             : 
+    1919             : /*
+    1920             :  * Use the keyword NPY_DEPRECATED_INCLUDES to ensure that the header files
+    1921             :  * npy_*_*_deprecated_api.h are only included from here and nowhere else.
+    1922             :  */
+    1923             : #ifdef NPY_DEPRECATED_INCLUDES
+    1924             : #error "Do not use the reserved keyword NPY_DEPRECATED_INCLUDES."
+    1925             : #endif
+    1926             : #define NPY_DEPRECATED_INCLUDES
+    1927             : #if !defined(NPY_NO_DEPRECATED_API) || \
+    1928             :     (NPY_NO_DEPRECATED_API < NPY_1_7_API_VERSION)
+    1929             : #include "npy_1_7_deprecated_api.h"
+    1930             : #endif
+    1931             : /*
+    1932             :  * There is no file npy_1_8_deprecated_api.h since there are no additional
+    1933             :  * deprecated API features in NumPy 1.8.
+    1934             :  *
+    1935             :  * Note to maintainers: insert code like the following in future NumPy
+    1936             :  * versions.
+    1937             :  *
+    1938             :  * #if !defined(NPY_NO_DEPRECATED_API) || \
+    1939             :  *     (NPY_NO_DEPRECATED_API < NPY_1_9_API_VERSION)
+    1940             :  * #include "npy_1_9_deprecated_api.h"
+    1941             :  * #endif
+    1942             :  */
+    1943             : #undef NPY_DEPRECATED_INCLUDES
+    1944             : 
+    1945             : #endif  /* NUMPY_CORE_INCLUDE_NUMPY_NDARRAYTYPES_H_ */
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/AssocVector.h.func-sort-c.html b/doc/coverageReport/include/crpropa/AssocVector.h.func-sort-c.html new file mode 100644 index 000000000..c39d31005 --- /dev/null +++ b/doc/coverageReport/include/crpropa/AssocVector.h.func-sort-c.html @@ -0,0 +1,92 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/AssocVector.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - AssocVector.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:2121100.0 %
Date:2024-04-08 14:58:22Functions:55100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN4Loki11AssocVectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7crpropa7VariantESt4lessIS6_ESaISt4pairIS6_S8_EEE4findERKS6_5
_ZN4Loki11AssocVectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7crpropa7VariantESt4lessIS6_ESaISt4pairIS6_S8_EEEaSERKSE_30
_ZNK4Loki11AssocVectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7crpropa7VariantESt4lessIS6_ESaISt4pairIS6_S8_EEE4findERKS6_41
_ZN4Loki11AssocVectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7crpropa7VariantESt4lessIS6_ESaISt4pairIS6_S8_EEE6insertERKSC_1143
_ZN4Loki11AssocVectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7crpropa7VariantESt4lessIS6_ESaISt4pairIS6_S8_EEEixERKS6_1143
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/AssocVector.h.func.html b/doc/coverageReport/include/crpropa/AssocVector.h.func.html new file mode 100644 index 000000000..206af8f4c --- /dev/null +++ b/doc/coverageReport/include/crpropa/AssocVector.h.func.html @@ -0,0 +1,92 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/AssocVector.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - AssocVector.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:2121100.0 %
Date:2024-04-08 14:58:22Functions:55100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN4Loki11AssocVectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7crpropa7VariantESt4lessIS6_ESaISt4pairIS6_S8_EEE4findERKS6_5
_ZN4Loki11AssocVectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7crpropa7VariantESt4lessIS6_ESaISt4pairIS6_S8_EEE6insertERKSC_1143
_ZN4Loki11AssocVectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7crpropa7VariantESt4lessIS6_ESaISt4pairIS6_S8_EEEaSERKSE_30
_ZN4Loki11AssocVectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7crpropa7VariantESt4lessIS6_ESaISt4pairIS6_S8_EEEixERKS6_1143
_ZNK4Loki11AssocVectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7crpropa7VariantESt4lessIS6_ESaISt4pairIS6_S8_EEE4findERKS6_41
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/AssocVector.h.gcov.html b/doc/coverageReport/include/crpropa/AssocVector.h.gcov.html new file mode 100644 index 000000000..6e1f36ba8 --- /dev/null +++ b/doc/coverageReport/include/crpropa/AssocVector.h.gcov.html @@ -0,0 +1,457 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/AssocVector.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - AssocVector.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:2121100.0 %
Date:2024-04-08 14:58:22Functions:55100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : ////////////////////////////////////////////////////////////////////////////////
+       2             : // The Loki Library
+       3             : // Copyright (c) 2001 by Andrei Alexandrescu
+       4             : // This code accompanies the book:
+       5             : // Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
+       6             : //     Patterns Applied". Copyright (c) 2001. Addison-Wesley.
+       7             : //
+       8             : // Permission is hereby granted, free of charge, to any person obtaining a copy
+       9             : // of this software and associated documentation files (the "Software"), to deal
+      10             : // in the Software without restriction, including without limitation the rights
+      11             : // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+      12             : // copies of the Software, and to permit persons to whom the Software is
+      13             : // furnished to do so, subject to the following conditions:
+      14             : //
+      15             : // The above copyright notice and this permission notice shall be included in
+      16             : // all copies or substantial portions of the Software.
+      17             : //
+      18             : // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+      19             : // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+      20             : // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+      21             : // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+      22             : // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+      23             : // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+      24             : // SOFTWARE.
+      25             : ////////////////////////////////////////////////////////////////////////////////
+      26             : #ifndef LOKI_ASSOCVECTOR_INC_
+      27             : #define LOKI_ASSOCVECTOR_INC_
+      28             : 
+      29             : // $Id$
+      30             : 
+      31             : 
+      32             : #include <algorithm>
+      33             : #include <functional>
+      34             : #include <vector>
+      35             : #include <utility>
+      36             : #include <iterator>
+      37             : #include <map>
+      38             : 
+      39             : 
+      40             : namespace Loki
+      41             : {
+      42             : ////////////////////////////////////////////////////////////////////////////////
+      43             : // class template AssocVectorCompare
+      44             : // Used by AssocVector
+      45             : ////////////////////////////////////////////////////////////////////////////////
+      46             : 
+      47             :     namespace Private
+      48             :     {
+      49             :         template <class Value, class C>
+      50             :         class AssocVectorCompare : public C
+      51             :         {
+      52             :             typedef std::pair<typename C::first_argument_type, Value>
+      53             :                 Data;
+      54             :             typedef typename C::first_argument_type first_argument_type;
+      55             : 
+      56             :         public:
+      57             :             AssocVectorCompare()
+      58             :             {}
+      59             : 
+      60             :             AssocVectorCompare(const C& src) : C(src)
+      61             :             {}
+      62             : 
+      63             :             bool operator()(const first_argument_type& lhs,
+      64             :                 const first_argument_type& rhs) const
+      65             :             { return C::operator()(lhs, rhs); }
+      66             : 
+      67             :             bool operator()(const Data& lhs, const Data& rhs) const
+      68             :             { return operator()(lhs.first, rhs.first); }
+      69             : 
+      70             :             bool operator()(const Data& lhs,
+      71             :                 const first_argument_type& rhs) const
+      72          57 :             { return operator()(lhs.first, rhs); }
+      73             : 
+      74             :             bool operator()(const first_argument_type& lhs,
+      75             :                 const Data& rhs) const
+      76             :             { return operator()(lhs, rhs.first); }
+      77             :         };
+      78             :     }
+      79             : 
+      80             : ////////////////////////////////////////////////////////////////////////////////
+      81             : // class template AssocVector
+      82             : // An associative vector built as a syntactic drop-in replacement for std::map
+      83             : // BEWARE: AssocVector doesn't respect all map's guarantees, the most important
+      84             : //     being:
+      85             : // * iterators are invalidated by insert and erase operations
+      86             : // * the complexity of insert/erase is O(N) not O(log N)
+      87             : // * value_type is std::pair<K, V> not std::pair<const K, V>
+      88             : // * iterators are random
+      89             : ////////////////////////////////////////////////////////////////////////////////
+      90             : 
+      91             : 
+      92             :     template
+      93             :     <
+      94             :         class K,
+      95             :         class V,
+      96             :         class C = std::less<K>,
+      97             :         class A = std::allocator< std::pair<K, V> >
+      98             :     >
+      99          30 :     class AssocVector
+     100             :         : private std::vector< std::pair<K, V>, A >
+     101             :         , private Private::AssocVectorCompare<V, C>
+     102             :     {
+     103             :         typedef std::vector<std::pair<K, V>, A> Base;
+     104             :         typedef Private::AssocVectorCompare<V, C> MyCompare;
+     105             : 
+     106             :     public:
+     107             :         typedef K key_type;
+     108             :         typedef V mapped_type;
+     109             :         typedef typename Base::value_type value_type;
+     110             : 
+     111             :         typedef C key_compare;
+     112             :         typedef A allocator_type;
+     113             :         typedef typename A::reference reference;
+     114             :         typedef typename A::const_reference const_reference;
+     115             :         typedef typename Base::iterator iterator;
+     116             :         typedef typename Base::const_iterator const_iterator;
+     117             :         typedef typename Base::size_type size_type;
+     118             :         typedef typename Base::difference_type difference_type;
+     119             :         typedef typename A::pointer pointer;
+     120             :         typedef typename A::const_pointer const_pointer;
+     121             :         typedef typename Base::reverse_iterator reverse_iterator;
+     122             :         typedef typename Base::const_reverse_iterator const_reverse_iterator;
+     123             : 
+     124             :         class value_compare
+     125             :             : public std::binary_function<value_type, value_type, bool>
+     126             :             , private key_compare
+     127             :         {
+     128             :             friend class AssocVector;
+     129             : 
+     130             :         protected:
+     131             :             value_compare(key_compare pred) : key_compare(pred)
+     132             :             {}
+     133             : 
+     134             :         public:
+     135             :             bool operator()(const value_type& lhs, const value_type& rhs) const
+     136             :             { return key_compare::operator()(lhs.first, rhs.first); }
+     137             :         };
+     138             : 
+     139             :         // 23.3.1.1 construct/copy/destroy
+     140             : 
+     141             :         explicit AssocVector(const key_compare& comp = key_compare(),
+     142             :             const A& alloc = A())
+     143             :         : Base(alloc), MyCompare(comp)
+     144             :         {}
+     145             : 
+     146             :         template <class InputIterator>
+     147             :         AssocVector(InputIterator first, InputIterator last,
+     148             :             const key_compare& comp = key_compare(),
+     149             :             const A& alloc = A())
+     150             :         : Base( alloc ), MyCompare( comp )
+     151             :         {
+     152             :             typedef ::std::vector< ::std::pair< K, V >, A > BaseType;
+     153             :             typedef ::std::map< K, V, C, A > TempMap;
+     154             :             typedef ::std::back_insert_iterator< Base > MyInserter;
+     155             :             MyCompare & me = *this;
+     156             :             const A tempAlloc;
+     157             :             // Make a temporary map similar to this type to prevent any duplicate elements.
+     158             :             TempMap temp( first, last, me, tempAlloc );
+     159             :             Base::reserve( temp.size() );
+     160             :             BaseType & target = static_cast< BaseType & >( *this );
+     161             :             MyInserter myInserter = ::std::back_inserter( target );
+     162             :             ::std::copy( temp.begin(), temp.end(), myInserter );
+     163             :         }
+     164             : 
+     165          30 :         AssocVector& operator=(const AssocVector& rhs)
+     166             :         {
+     167          30 :             AssocVector(rhs).swap(*this);
+     168          30 :             return *this;
+     169             :         }
+     170             : 
+     171             :         // iterators:
+     172             :         // The following are here because MWCW gets 'using' wrong
+     173             :         iterator begin() { return Base::begin(); }
+     174             :         const_iterator begin() const { return Base::begin(); }
+     175             :         iterator end() { return Base::end(); }
+     176             :         const_iterator end() const { return Base::end(); }
+     177             :         reverse_iterator rbegin() { return Base::rbegin(); }
+     178             :         const_reverse_iterator rbegin() const { return Base::rbegin(); }
+     179             :         reverse_iterator rend() { return Base::rend(); }
+     180             :         const_reverse_iterator rend() const { return Base::rend(); }
+     181             : 
+     182             :         // capacity:
+     183             :         bool empty() const { return Base::empty(); }
+     184             :         size_type size() const { return Base::size(); }
+     185             :         size_type max_size() { return Base::max_size(); }
+     186             : 
+     187             :         // 23.3.1.2 element access:
+     188        1143 :         mapped_type& operator[](const key_type& key)
+     189        1143 :         { return insert(value_type(key, mapped_type())).first->second; }
+     190             : 
+     191             :         // modifiers:
+     192        1143 :         std::pair<iterator, bool> insert(const value_type& val)
+     193             :         {
+     194             :             bool found(true);
+     195        1143 :             iterator i(lower_bound(val.first));
+     196             : 
+     197          13 :             if (i == end() || this->operator()(val.first, i->first))
+     198             :             {
+     199        1134 :                 i = Base::insert(i, val);
+     200             :                 found = false;
+     201             :             }
+     202        1143 :             return std::make_pair(i, !found);
+     203             :         }
+     204             :         //Section [23.1.2], Table 69
+     205             :         //http://developer.apple.com/documentation/DeveloperTools/gcc-3.3/libstdc++/23_containers/howto.html#4
+     206             :         iterator insert(iterator pos, const value_type& val)
+     207             :         {
+     208             :             if( (pos == begin() || this->operator()(*(pos-1),val)) &&
+     209             :                 (pos == end()    || this->operator()(val, *pos)) )
+     210             :             {
+     211             :                 return Base::insert(pos, val);
+     212             :             }
+     213             :             return insert(val).first;
+     214             :         }
+     215             : 
+     216             :         template <class InputIterator>
+     217             :         void insert(InputIterator first, InputIterator last)
+     218             :         { for (; first != last; ++first) insert(*first); }
+     219             : 
+     220             :         void erase(iterator pos)
+     221           5 :         { Base::erase(pos); }
+     222             : 
+     223             :         size_type erase(const key_type& k)
+     224             :         {
+     225             :             iterator i(find(k));
+     226             :             if (i == end()) return 0;
+     227             :             erase(i);
+     228             :             return 1;
+     229             :         }
+     230             : 
+     231             :         void erase(iterator first, iterator last)
+     232             :         { Base::erase(first, last); }
+     233             : 
+     234             :         void swap(AssocVector& other)
+     235             :         {
+     236             :             Base::swap(other);
+     237             :             MyCompare& me = *this;
+     238             :             MyCompare& rhs = other;
+     239             :             std::swap(me, rhs);
+     240             :         }
+     241             : 
+     242             :         void clear()
+     243             :         { Base::clear(); }
+     244             : 
+     245             :         // observers:
+     246             :         key_compare key_comp() const
+     247             :         { return *this; }
+     248             : 
+     249             :         value_compare value_comp() const
+     250             :         {
+     251             :             const key_compare& comp = *this;
+     252             :             return value_compare(comp);
+     253             :         }
+     254             : 
+     255             :         // 23.3.1.3 map operations:
+     256           5 :         iterator find(const key_type& k)
+     257             :         {
+     258             :             iterator i(lower_bound(k));
+     259           5 :             if (i != end() && this->operator()(k, i->first))
+     260             :             {
+     261             :                 i = end();
+     262             :             }
+     263           5 :             return i;
+     264             :         }
+     265             : 
+     266          41 :         const_iterator find(const key_type& k) const
+     267             :         {
+     268             :             const_iterator i(lower_bound(k));
+     269          33 :             if (i != end() && this->operator()(k, i->first))
+     270             :             {
+     271             :                 i = end();
+     272             :             }
+     273          41 :             return i;
+     274             :         }
+     275             : 
+     276             :         size_type count(const key_type& k) const
+     277             :         { return find(k) != end(); }
+     278             : 
+     279             :         iterator lower_bound(const key_type& k)
+     280             :         {
+     281             :             MyCompare& me = *this;
+     282        1148 :             return std::lower_bound(begin(), end(), k, me);
+     283             :         }
+     284             : 
+     285             :         const_iterator lower_bound(const key_type& k) const
+     286             :         {
+     287             :             const MyCompare& me = *this;
+     288          41 :             return std::lower_bound(begin(), end(), k, me);
+     289             :         }
+     290             : 
+     291             :         iterator upper_bound(const key_type& k)
+     292             :         {
+     293             :             MyCompare& me = *this;
+     294             :             return std::upper_bound(begin(), end(), k, me);
+     295             :         }
+     296             : 
+     297             :         const_iterator upper_bound(const key_type& k) const
+     298             :         {
+     299             :             const MyCompare& me = *this;
+     300             :             return std::upper_bound(begin(), end(), k, me);
+     301             :         }
+     302             : 
+     303             :         std::pair<iterator, iterator> equal_range(const key_type& k)
+     304             :         {
+     305             :             MyCompare& me = *this;
+     306             :             return std::equal_range(begin(), end(), k, me);
+     307             :         }
+     308             : 
+     309             :         std::pair<const_iterator, const_iterator> equal_range(
+     310             :             const key_type& k) const
+     311             :         {
+     312             :             const MyCompare& me = *this;
+     313             :             return std::equal_range(begin(), end(), k, me);
+     314             :         }
+     315             : 
+     316             :         template <class K1, class V1, class C1, class A1>
+     317             :         friend bool operator==(const AssocVector<K1, V1, C1, A1>& lhs,
+     318             :                         const AssocVector<K1, V1, C1, A1>& rhs);
+     319             : 
+     320             :         bool operator<(const AssocVector& rhs) const
+     321             :         {
+     322             :             const Base& me = *this;
+     323             :             const Base& yo = rhs;
+     324             :             return me < yo;
+     325             :         }
+     326             : 
+     327             :         template <class K1, class V1, class C1, class A1>
+     328             :         friend bool operator!=(const AssocVector<K1, V1, C1, A1>& lhs,
+     329             :                                const AssocVector<K1, V1, C1, A1>& rhs);
+     330             : 
+     331             :         template <class K1, class V1, class C1, class A1>
+     332             :         friend bool operator>(const AssocVector<K1, V1, C1, A1>& lhs,
+     333             :                               const AssocVector<K1, V1, C1, A1>& rhs);
+     334             : 
+     335             :         template <class K1, class V1, class C1, class A1>
+     336             :         friend bool operator>=(const AssocVector<K1, V1, C1, A1>& lhs,
+     337             :                                const AssocVector<K1, V1, C1, A1>& rhs);
+     338             : 
+     339             :         template <class K1, class V1, class C1, class A1>
+     340             :         friend bool operator<=(const AssocVector<K1, V1, C1, A1>& lhs,
+     341             :                                const AssocVector<K1, V1, C1, A1>& rhs);
+     342             :     };
+     343             : 
+     344             :     template <class K, class V, class C, class A>
+     345             :     inline bool operator==(const AssocVector<K, V, C, A>& lhs,
+     346             :                            const AssocVector<K, V, C, A>& rhs)
+     347             :     {
+     348             :       const std::vector<std::pair<K, V>, A>& me = lhs;
+     349             :       return me == rhs;
+     350             :     }
+     351             : 
+     352             :     template <class K, class V, class C, class A>
+     353             :     inline bool operator!=(const AssocVector<K, V, C, A>& lhs,
+     354             :                            const AssocVector<K, V, C, A>& rhs)
+     355             :     { return !(lhs == rhs); }
+     356             : 
+     357             :     template <class K, class V, class C, class A>
+     358             :     inline bool operator>(const AssocVector<K, V, C, A>& lhs,
+     359             :                           const AssocVector<K, V, C, A>& rhs)
+     360             :     { return rhs < lhs; }
+     361             : 
+     362             :     template <class K, class V, class C, class A>
+     363             :     inline bool operator>=(const AssocVector<K, V, C, A>& lhs,
+     364             :                            const AssocVector<K, V, C, A>& rhs)
+     365             :     { return !(lhs < rhs); }
+     366             : 
+     367             :     template <class K, class V, class C, class A>
+     368             :     inline bool operator<=(const AssocVector<K, V, C, A>& lhs,
+     369             :                            const AssocVector<K, V, C, A>& rhs)
+     370             :     { return !(rhs < lhs); }
+     371             : 
+     372             : 
+     373             :     // specialized algorithms:
+     374             :     template <class K, class V, class C, class A>
+     375             :     void swap(AssocVector<K, V, C, A>& lhs, AssocVector<K, V, C, A>& rhs)
+     376             :     { lhs.swap(rhs); }
+     377             : 
+     378             : } // namespace Loki
+     379             : 
+     380             : #endif // end file guardian
+     381             : 
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Candidate.h.func-sort-c.html b/doc/coverageReport/include/crpropa/Candidate.h.func-sort-c.html new file mode 100644 index 000000000..311549a2e --- /dev/null +++ b/doc/coverageReport/include/crpropa/Candidate.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Candidate.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Candidate.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Candidate.h.func.html b/doc/coverageReport/include/crpropa/Candidate.h.func.html new file mode 100644 index 000000000..2a4fbcad6 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Candidate.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Candidate.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Candidate.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Candidate.h.gcov.html b/doc/coverageReport/include/crpropa/Candidate.h.gcov.html new file mode 100644 index 000000000..393563bad --- /dev/null +++ b/doc/coverageReport/include/crpropa/Candidate.h.gcov.html @@ -0,0 +1,258 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Candidate.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Candidate.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_CANDIDATE_H
+       2             : #define CRPROPA_CANDIDATE_H
+       3             : 
+       4             : #include "crpropa/ParticleState.h"
+       5             : #include "crpropa/Referenced.h"
+       6             : #include "crpropa/AssocVector.h"
+       7             : #include "crpropa/Variant.h"
+       8             : 
+       9             : #include <vector>
+      10             : #include <map>
+      11             : #include <sstream>
+      12             : #include <stdint.h>
+      13             : 
+      14             : namespace crpropa {
+      15             : /**
+      16             :  * \addtogroup Core
+      17             :  * @{
+      18             :  */
+      19             : 
+      20             : /**
+      21             :  @class Candidate Candidate.h include/crpropa/Candidate.h
+      22             :  @brief All information about the cosmic ray.
+      23             : 
+      24             :  The Candidate is a passive object, that holds the information about the state
+      25             :  of the cosmic ray and the simulation itself.
+      26             :  */
+      27             : class Candidate: public Referenced {
+      28             : public:
+      29             :         ParticleState source; /**< Particle state at the source */
+      30             :         ParticleState created; /**< Particle state of parent particle at the time of creation */
+      31             :         ParticleState current; /**< Current particle state */
+      32             :         ParticleState previous; /**< Particle state at the end of the previous step */
+      33             : 
+      34             :         std::vector<ref_ptr<Candidate> > secondaries; /**< Secondary particles from interactions */
+      35             : 
+      36             :         typedef Loki::AssocVector<std::string, Variant> PropertyMap;
+      37             :         PropertyMap properties; /**< Map of property names and their values. */
+      38             : 
+      39             :         /** Parent candidate. 0 if no parent (initial particle). Must not be a ref_ptr to prevent circular referencing. */
+      40             :         Candidate *parent;
+      41             : 
+      42             : private:
+      43             :         bool active; /**< Active status */
+      44             :         double weight; /**< Weight of the candidate */
+      45             :         double redshift; /**< Current simulation time-point in terms of redshift z */
+      46             :         double trajectoryLength; /**< Comoving distance [m] the candidate has traveled so far */
+      47             :         double currentStep; /**< Size of the currently performed step in [m] comoving units */
+      48             :         double nextStep; /**< Proposed size of the next propagation step in [m] comoving units */
+      49             :         std::string tagOrigin; /**< Name of interaction/source process which created this candidate*/
+      50             : 
+      51             :         static uint64_t nextSerialNumber;
+      52             :         uint64_t serialNumber;
+      53             : 
+      54             : public:
+      55             :         Candidate(
+      56             :                 int id = 0,
+      57             :                 double energy = 0,
+      58             :                 Vector3d position = Vector3d(0, 0, 0),
+      59             :                 Vector3d direction = Vector3d(-1, 0, 0),
+      60             :                 double z = 0,
+      61             :                 double weight = 1., 
+      62             :                 std::string tagOrigin = "PRIM"
+      63             :         );
+      64             : 
+      65             :         /**
+      66             :          Creates a candidate, initializing the Candidate::source, Candidate::created,
+      67             :          Candidate::previous and Candidate::current state with the argument.
+      68             :          */
+      69             :         Candidate(const ParticleState &state);
+      70             : 
+      71             :         bool isActive() const;
+      72             :         void setActive(bool b);
+      73             : 
+      74             :         void setTrajectoryLength(double length);
+      75             :         double getTrajectoryLength() const;
+      76             : 
+      77             :         void setRedshift(double z);
+      78             :         double getRedshift() const;
+      79             : 
+      80             :         /**
+      81             :          Sets weight of each candidate.
+      82             :          Weights are calculated for each tracked secondary.
+      83             :          */
+      84             :         void setWeight(double weight);
+      85             :     void updateWeight(double weight);
+      86             :         double getWeight() const;
+      87             : 
+      88             :         /**
+      89             :          Sets the current step and increases the trajectory length accordingly.
+      90             :          Only the propagation module should use this.
+      91             :          */
+      92             :         void setCurrentStep(double step);
+      93             :         double getCurrentStep() const;
+      94             : 
+      95             :         /**
+      96             :          Sets the proposed next step.
+      97             :          Only the propagation module should use this.
+      98             :          */
+      99             :         void setNextStep(double step);
+     100             :         double getNextStep() const;
+     101             : 
+     102             :         /**
+     103             :          Sets the tagOrigin of the candidate. Can be used to trace back the interactions
+     104             :          */
+     105             :         void setTagOrigin(std::string tagOrigin);
+     106             :         std::string getTagOrigin() const;
+     107             : 
+     108             :         /**
+     109             :          Make a bid for the next step size: the lowest wins.
+     110             :          */
+     111             :         void limitNextStep(double step);
+     112             : 
+     113             :         void setProperty(const std::string &name, const Variant &value);
+     114             :         const Variant &getProperty(const std::string &name) const;
+     115             :         bool removeProperty(const std::string &name);
+     116             :         bool hasProperty(const std::string &name) const;
+     117             : 
+     118             :         /**
+     119             :          Add a new candidate to the list of secondaries.
+     120             :          @param c Candidate
+     121             : 
+     122             :          Adds a new candidate to the list of secondaries of this candidate.
+     123             :          The secondaries Candidate::source and Candidate::previous state are set to the _source_ and _previous_ state of its parent.
+     124             :          The secondaries Candidate::created and Candidate::current state are set to the _current_ state of its parent, except for the secondaries current energy and particle id.
+     125             :          Trajectory length and redshift are copied from the parent.
+     126             :          */
+     127             :         void addSecondary(Candidate *c);
+     128           4 :         inline void addSecondary(ref_ptr<Candidate> c) { addSecondary(c.get()); };
+     129             :         /**
+     130             :          Add a new candidate to the list of secondaries.
+     131             :          @param id                      particle ID of the secondary
+     132             :          @param energy          energy of the secondary
+     133             :          @param w                       weight of the secondary
+     134             :          @param tagOrigin       tag of the secondary
+     135             :          */
+     136             :         void addSecondary(int id, double energy, double w = 1., std::string tagOrigin = "SEC");
+     137             :         /**
+     138             :          Add a new candidate to the list of secondaries.
+     139             :          @param id                      particle ID of the secondary
+     140             :          @param energy          energy of the secondary
+     141             :          @param position        start position of the secondary
+     142             :          @param w                       weight of the secondary
+     143             :          @param tagOrigin       tag of the secondary
+     144             :          */
+     145             :         void addSecondary(int id, double energy, Vector3d position, double w = 1., std::string tagOrigin = "SEC");
+     146             :         void clearSecondaries();
+     147             : 
+     148             :         std::string getDescription() const;
+     149             : 
+     150             :         /** Unique (inside process) serial number (id) of candidate */
+     151             :         uint64_t getSerialNumber() const;
+     152             :         void setSerialNumber(const uint64_t snr);
+     153             : 
+     154             :         /** Serial number of candidate at source*/
+     155             :         uint64_t getSourceSerialNumber() const;
+     156             : 
+     157             :         /** Serial number of candidate at creation */
+     158             :         uint64_t getCreatedSerialNumber() const;
+     159             : 
+     160             :         /** Set the next serial number to use */
+     161             :         static void setNextSerialNumber(uint64_t snr);
+     162             : 
+     163             :         /** Get the next serial number that will be assigned */
+     164             :         static uint64_t getNextSerialNumber();
+     165             : 
+     166             :         /**
+     167             :          Create an exact clone of candidate
+     168             :          @param recursive       recursively clone and add the secondaries
+     169             :          */
+     170             :         ref_ptr<Candidate> clone(bool recursive = false) const;
+     171             : 
+     172             :         /**
+     173             :          Copy the source particle state to the current state
+     174             :          and activate it if inactive, e.g. restart it
+     175             :         */
+     176             :         void restart();
+     177             : };
+     178             : 
+     179             : /** @}*/
+     180             : } // namespace crpropa
+     181             : 
+     182             : #endif // CRPROPA_CANDIDATE_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Common.h.func-sort-c.html b/doc/coverageReport/include/crpropa/Common.h.func-sort-c.html new file mode 100644 index 000000000..b6011ea62 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Common.h.func-sort-c.html @@ -0,0 +1,80 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Common.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Common.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:1010100.0 %
Date:2024-04-08 14:58:22Functions:22100.0 %
+
+ +
+ + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa8gaussIntIZNS_20common_gaussInt_Test8TestBodyEvEUldE0_EEdOT_dd1
_ZN7crpropa8gaussIntIZNKS_19PhotoPionProduction7probEpsEdbddEUldE_EEdOT_dd10660
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Common.h.func.html b/doc/coverageReport/include/crpropa/Common.h.func.html new file mode 100644 index 000000000..480121887 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Common.h.func.html @@ -0,0 +1,80 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Common.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Common.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:1010100.0 %
Date:2024-04-08 14:58:22Functions:22100.0 %
+
+ +
+ + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa8gaussIntIZNKS_19PhotoPionProduction7probEpsEdbddEUldE_EEdOT_dd10660
_ZN7crpropa8gaussIntIZNS_20common_gaussInt_Test8TestBodyEvEUldE0_EEdOT_dd1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Common.h.gcov.html b/doc/coverageReport/include/crpropa/Common.h.gcov.html new file mode 100644 index 000000000..13a42780e --- /dev/null +++ b/doc/coverageReport/include/crpropa/Common.h.gcov.html @@ -0,0 +1,163 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Common.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Common.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:1010100.0 %
Date:2024-04-08 14:58:22Functions:22100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_COMMON_H
+       2             : #define CRPROPA_COMMON_H
+       3             : 
+       4             : #include <string>
+       5             : #include <vector>
+       6             : /**
+       7             :  @file
+       8             :  @brief Common helper functions
+       9             :  */
+      10             : 
+      11             : namespace crpropa {
+      12             : /**
+      13             :  * \addtogroup Core
+      14             :  * @{
+      15             :  */
+      16             : 
+      17             : // Returns the full path to a CRPropa data file
+      18             : std::string getDataPath(std::string filename);
+      19             : 
+      20             : // Returns the install prefix
+      21             : std::string getInstallPrefix();
+      22             : 
+      23             : // Returns a certain digit from a given integer
+      24             : inline int digit(const int& value, const int& d) {
+      25        1249 :         return (value % (d * 10)) / d;
+      26             : }
+      27             : 
+      28             : // Return value xclip which is the closest to x, so that lower <= xclip <= upper
+      29             : template <typename T>
+      30             : T clip(const T& x, const T& lower, const T& upper) {
+      31      499341 :         return std::max(lower, std::min(x, upper));
+      32             : }
+      33             : 
+      34             : // Perform linear interpolation on a set of n tabulated data points X[0 .. n-1] -> Y[0 .. n-1]
+      35             : // Returns Y[0] if x < X[0] and Y[n-1] if x > X[n-1]
+      36             : double interpolate(double x, const std::vector<double>& X,
+      37             :                 const std::vector<double>& Y);
+      38             : 
+      39             : 
+      40             : // Perform bilinear interpolation on a set of (n,m) tabulated data points X[0 .. n-1], Y[0 .. m-1] -> Z[0.. n-1*m-1]
+      41             : // Returns 0 if x < X[0] or x > X[n-1] or y < Y[0] or y > Y[m-1]
+      42             : double interpolate2d(double x, double y, const std::vector<double>& X,
+      43             :                 const std::vector<double>& Y, const std::vector<double>& Z);
+      44             : 
+      45             : // Perform linear interpolation on equidistant tabulated data
+      46             : // Returns Y[0] if x < lo and Y[n-1] if x > hi
+      47             : double interpolateEquidistant(double x, double lo, double hi,
+      48             :                 const std::vector<double>& Y);
+      49             : 
+      50             : // Find index of value in a sorted vector X that is closest to x
+      51             : size_t closestIndex(double x, const std::vector<double> &X);
+      52             : /** @}*/
+      53             : 
+      54             : 
+      55             : // pow implementation as template for integer exponents pow_integer<2>(x)
+      56             : // evaluates to x*x
+      57             : template <unsigned int exponent>
+      58             : inline double pow_integer(double base)
+      59             : {
+      60       63069 :   return pow_integer<(exponent >> 1)>(base*base) * (((exponent & 1) > 0) ? base : 1);
+      61             : }
+      62             : 
+      63             : template <>
+      64             : inline double pow_integer<0>(double base)
+      65             : {
+      66             :   return 1;
+      67             : }
+      68             : 
+      69             : // - input:  function over which to integrate, integration limits A and B
+      70             : // - output: 8-points Gauß-Legendre integral
+      71             : static const double X[8] = {.0950125098, .2816035507, .4580167776, .6178762444, .7554044083, .8656312023, .9445750230, .9894009349};
+      72             : static const double W[8] = {.1894506104, .1826034150, .1691565193, .1495959888, .1246289712, .0951585116, .0622535239, .0271524594};
+      73             : template<typename Integrand>
+      74       10661 : double gaussInt(Integrand&& integrand, double A, double B) {
+      75       10661 :         const double XM = 0.5 * (B + A);
+      76       10661 :         const double XR = 0.5 * (B - A);
+      77             :         double SS = 0.;
+      78       95958 :         for (int i = 0; i < 8; ++i) {
+      79       85296 :                 double DX = XR * X[i];
+      80       85296 :                 SS += W[i] * (integrand(XM + DX) + integrand(XM - DX));
+      81             :         }
+      82       10661 :         return XR * SS;
+      83             : }
+      84             : 
+      85             : } // namespace crpropa
+      86             : 
+      87             : #endif // CRPROPA_COMMON_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/EmissionMap.h.func-sort-c.html b/doc/coverageReport/include/crpropa/EmissionMap.h.func-sort-c.html new file mode 100644 index 000000000..a2a1cc9dd --- /dev/null +++ b/doc/coverageReport/include/crpropa/EmissionMap.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/EmissionMap.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - EmissionMap.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/EmissionMap.h.func.html b/doc/coverageReport/include/crpropa/EmissionMap.h.func.html new file mode 100644 index 000000000..fd1749d15 --- /dev/null +++ b/doc/coverageReport/include/crpropa/EmissionMap.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/EmissionMap.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - EmissionMap.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/EmissionMap.h.gcov.html b/doc/coverageReport/include/crpropa/EmissionMap.h.gcov.html new file mode 100644 index 000000000..deeb84f2e --- /dev/null +++ b/doc/coverageReport/include/crpropa/EmissionMap.h.gcov.html @@ -0,0 +1,212 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/EmissionMap.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - EmissionMap.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_EMISSION_MAP_H
+       2             : #define CRPROPA_EMISSION_MAP_H
+       3             : 
+       4             : #include "Referenced.h"
+       5             : #include "Candidate.h"
+       6             : 
+       7             : namespace crpropa {
+       8             : 
+       9             : /**
+      10             :  @class CylindricalProjectionMap
+      11             :  @brief 2D histogram of spherical coordinates in equal-area projection
+      12             :  */
+      13             : class CylindricalProjectionMap : public Referenced {
+      14             : private:
+      15             :         size_t nPhi, nTheta;
+      16             :         double sPhi, sTheta;
+      17             :         mutable bool dirty;
+      18             :         std::vector<double> pdf;
+      19             :         mutable std::vector<double> cdf;
+      20             : 
+      21             :         /** Calculate the cdf from the pdf */
+      22             :         void updateCdf() const;
+      23             : 
+      24             : public:
+      25             :         CylindricalProjectionMap();
+      26             :         /** constructur
+      27             :          * @param nPhi number of bins for phi (0-2pi)
+      28             :          * @param nTheta number of bins for theta (0-pi)
+      29             :          */
+      30             :         CylindricalProjectionMap(size_t nPhi, size_t nTheta);
+      31             : 
+      32             :         /** Increment the bin value in direction by weight. */
+      33             :         void fillBin(const Vector3d& direction, double weight = 1.);
+      34             : 
+      35             :         /** Increment the bin value by weight. */
+      36             :         void fillBin(size_t bin, double weight = 1.);
+      37             : 
+      38             :         /** Draw a random vector from the distribution. */
+      39             :         Vector3d drawDirection() const;
+      40             : 
+      41             :         /** Check if the direction has a non zero propabiliy. */
+      42             :         bool checkDirection(const Vector3d &direction) const;
+      43             : 
+      44             :         const std::vector<double>& getPdf() const;
+      45             :         std::vector<double>& getPdf();
+      46             : 
+      47             :         const std::vector<double>& getCdf() const;
+      48             : 
+      49             :         size_t getNPhi();
+      50             :         size_t getNTheta();
+      51             : 
+      52             :         /** Calculate the bin from a direction */
+      53             :         size_t binFromDirection(const Vector3d& direction) const;
+      54             : 
+      55             :         /** Calculate a random vector inside the bin boundaries */
+      56             :         Vector3d directionFromBin(size_t bin) const;
+      57             : };
+      58             : 
+      59             : /**
+      60             :  @class EmissionMap
+      61             :  @brief Particle Type and energy binned emission maps.
+      62             : 
+      63             :  Use SourceEmissionMap to suppress directions at the source. Use EmissionMapFiller to create EmissionMap from Observer.
+      64             :  */
+      65           2 : class EmissionMap : public Referenced {
+      66             : public:
+      67             :         typedef std::pair<int, size_t> key_t;
+      68             :         typedef std::map<key_t, ref_ptr<CylindricalProjectionMap> > map_t;
+      69             : 
+      70             :         EmissionMap();
+      71             :         /**
+      72             :          * @param nPhi number of bins for phi (0-2pi)
+      73             :          * @param nTheta number of bins for theta (0-pi)
+      74             :          * @param nEnergy number of bins for energy (1e-4 - 1e4 EeV)
+      75             :          */
+      76             :         EmissionMap(size_t nPhi, size_t nTheta, size_t nEnergy);
+      77             : 
+      78             :         /**
+      79             :          * @param nPhi number of bins for phi (0-2pi)
+      80             :          * @param nTheta number of bins for theta (0-pi)
+      81             :          * @param nEnergy number of bins for energy (1e-4 - 1e4 EeV)
+      82             :          * @param minEnergy minimum energy for binning
+      83             :          * @param maxEnergy maximum energy for binning
+      84             :          */
+      85             :         EmissionMap(size_t nPhi, size_t nTheta, size_t nEnergy, double minEnergy, double maxEnergy);
+      86             : 
+      87             :         /** Calculate energy from bin */
+      88             :         double energyFromBin(size_t bin) const;
+      89             : 
+      90             :         /** Calculate bin from energy */
+      91             :         size_t binFromEnergy(double energy) const;
+      92             : 
+      93             :         map_t &getMaps();
+      94             :         const map_t &getMaps() const;
+      95             : 
+      96             :         /** Increment the value for particle type, energy and direction by weight. */
+      97             :         void fillMap(int pid, double energy, const Vector3d& direction, double weight = 1.);
+      98             :         /** Increment the value for the particle state by weight. */
+      99             :         void fillMap(const ParticleState& state, double weight = 1.);
+     100             : 
+     101             :         /** Draw a random vector from the distribution. */
+     102             :         bool drawDirection(int pid, double energy, Vector3d& direction) const;
+     103             :         /** Draw a random vector from the distribution. */
+     104             :         bool drawDirection(const ParticleState& state, Vector3d& direction) const;
+     105             : 
+     106             :         /** Check if the direction has a non zero propabiliy. */
+     107             :         bool checkDirection(int pid, double energy, const Vector3d& direction) const;
+     108             :         /** Check if the direction has a non zero propabiliy. */
+     109             :         bool checkDirection(const ParticleState& state) const;
+     110             : 
+     111             :         /** Check if a valid map exists */
+     112             :         bool hasMap(int pid, double energy);
+     113             : 
+     114             :         /** Get the map for the specified pid and energy */
+     115             :         ref_ptr<CylindricalProjectionMap> getMap(int pid, double energy);
+     116             : 
+     117             :         /** Save the content of the maps into a text file */
+     118             :         void save(const std::string &filename);
+     119             :         /** Load the content of the maps from a text file */
+     120             :         void load(const std::string &filename);
+     121             : 
+     122             :         /** Merge other maps, add pdfs */
+     123             :         void merge(const EmissionMap *other);
+     124             : 
+     125             :         /** Merge maps from file */
+     126             :         void merge(const std::string &filename);
+     127             : 
+     128             : protected:
+     129             :         double minEnergy, maxEnergy, logStep;
+     130             :         size_t nPhi, nTheta, nEnergy;
+     131             :         map_t maps;
+     132             : };
+     133             : 
+     134             : } // namespace crpropa
+     135             : 
+     136             : #endif // CRPROPA_EMISSION_MAP_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Geometry.h.func-sort-c.html b/doc/coverageReport/include/crpropa/Geometry.h.func-sort-c.html new file mode 100644 index 000000000..6b4cfc036 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Geometry.h.func-sort-c.html @@ -0,0 +1,76 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Geometry.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Geometry.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:3475.0 %
Date:2024-04-08 14:58:22Functions:010.0 %
+
+ +
+ + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa7Surface14getDescriptionB5cxx11Ev0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Geometry.h.func.html b/doc/coverageReport/include/crpropa/Geometry.h.func.html new file mode 100644 index 000000000..9e2e188ad --- /dev/null +++ b/doc/coverageReport/include/crpropa/Geometry.h.func.html @@ -0,0 +1,76 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Geometry.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Geometry.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:3475.0 %
Date:2024-04-08 14:58:22Functions:010.0 %
+
+ +
+ + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa7Surface14getDescriptionB5cxx11Ev0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Geometry.h.gcov.html b/doc/coverageReport/include/crpropa/Geometry.h.gcov.html new file mode 100644 index 000000000..f7e267162 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Geometry.h.gcov.html @@ -0,0 +1,165 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Geometry.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Geometry.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:3475.0 %
Date:2024-04-08 14:58:22Functions:010.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_GEOMETRY_H
+       2             : #define CRPROPA_GEOMETRY_H
+       3             : 
+       4             : #include <vector>
+       5             : #include <string>
+       6             : 
+       7             : #include "crpropa/Candidate.h"
+       8             : #include "crpropa/Vector3.h"
+       9             : #include "crpropa/Referenced.h"
+      10             : 
+      11             : namespace crpropa {
+      12             : /**
+      13             :  * \addtogroup Core
+      14             :  * @{
+      15             :  */
+      16             : 
+      17             : /**
+      18             :  @class Surface
+      19             :  @brief A geometrical surface
+      20             : 
+      21             :  Defines a surface. Can be queried if the candidate has crossed the surface in the last step.
+      22             :  */
+      23             : class Surface : public Referenced {
+      24             : public:
+      25             :         /** Returns the distance of a point to the surface. Negative on the one side,
+      26             :          positive on the other. For closed surfaces it is negative on the inside.
+      27             :          @param point   vector corresponding to the point to which compute the distance
+      28             :          */
+      29             :         virtual double distance(const Vector3d& point) const = 0;
+      30             :         /**  Returns the normal to the surface at a point. Negative on the one side,
+      31             :          positive on the other. For closed surfaces it is negative on the inside.
+      32             :          @param point   vector corresponding to the point to which compute the normal vector
+      33             :          */
+      34             :         virtual Vector3d normal(const Vector3d& point) const = 0;
+      35           0 :         virtual std::string getDescription() const {return "Surface without description.";};
+      36             : };
+      37             : 
+      38             : 
+      39             : /**
+      40             :  @class Plane
+      41             :  @brief A plane given by a point x0 and two axes v1 and v2 with normal n = v1.cross(v2) or the normal n. Note that distance is negative on one side of the plane and positive on the other, depending on the orientation of the normal vector.
+      42             :  */
+      43           1 : class Plane: public Surface {
+      44             : private:
+      45             :         Vector3d x0, n;
+      46             : public:
+      47             :         Plane(const Vector3d& x0, const Vector3d& v1,const Vector3d& v2);
+      48             :         Plane(const Vector3d& x0, const Vector3d& n);
+      49             :         virtual double distance(const Vector3d &x) const;
+      50             :         virtual Vector3d normal(const Vector3d& point) const;
+      51             :         virtual std::string getDescription() const;
+      52             : };
+      53             : 
+      54             : 
+      55             : /**
+      56             :  @class Sphere
+      57             :  @brief A sphere around point _center with radius _radius.
+      58             :  */
+      59           1 : class Sphere: public Surface {
+      60             : private:
+      61             :         Vector3d center;
+      62             :         double radius;
+      63             : public:
+      64             :         Sphere(const Vector3d& center, double radius);
+      65             :         virtual double distance(const Vector3d &point) const;
+      66             :         virtual Vector3d normal(const Vector3d& point) const;
+      67             :         virtual std::string getDescription() const;
+      68             : };
+      69             : 
+      70             : 
+      71             : /**
+      72             :  @class ParaxialBox
+      73             :  @brief A box with perpendicular surfaces aligned to the x,y,z-axes.
+      74             :  */
+      75           1 : class ParaxialBox: public Surface {
+      76             : private:
+      77             :         Vector3d corner, size;
+      78             : public:
+      79             :         ParaxialBox(const Vector3d& corner, const Vector3d& size);
+      80             :         virtual double distance(const Vector3d &point) const;
+      81             :         virtual Vector3d normal(const Vector3d& point) const;
+      82             :         virtual std::string getDescription() const;
+      83             : };
+      84             : 
+      85             : 
+      86             : /** @}*/
+      87             : } // namespace crpropa
+      88             : 
+      89             : #endif // CRPROPA_GEOMETRY_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Grid.h.func-sort-c.html b/doc/coverageReport/include/crpropa/Grid.h.func-sort-c.html new file mode 100644 index 000000000..3c651a9f5 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Grid.h.func-sort-c.html @@ -0,0 +1,296 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Grid.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Grid.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:17319588.7 %
Date:2024-04-08 14:58:22Functions:235641.1 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa14GridPropertiesD2Ev0
_ZN7crpropa4GridINS_7Vector3IdEEE11interpolateERKS2_0
_ZN7crpropa4GridINS_7Vector3IdEEE11setGridSizeEmmm0
_ZN7crpropa4GridINS_7Vector3IdEEE20setInterpolationTypeENS_17interpolationTypeE0
_ZN7crpropa4GridINS_7Vector3IdEEEC2ERKNS_14GridPropertiesE0
_ZN7crpropa4GridINS_7Vector3IdEEEC2ES2_md0
_ZN7crpropa4GridINS_7Vector3IdEEEC2ES2_mmmS2_0
_ZN7crpropa4GridINS_7Vector3IdEEEC2ES2_mmmd0
_ZN7crpropa4GridINS_7Vector3IfEEE20setInterpolationTypeENS_17interpolationTypeE0
_ZN7crpropa4GridINS_7Vector3IfEEEC2ENS1_IdEEmmmS4_0
_ZN7crpropa4GridIdE11interpolateERKNS_7Vector3IdEE0
_ZN7crpropa4GridIdE11setGridSizeEmmm0
_ZN7crpropa4GridIdE20setInterpolationTypeENS_17interpolationTypeE0
_ZN7crpropa4GridIdEC2ENS_7Vector3IdEEmd0
_ZN7crpropa4GridIdEC2ENS_7Vector3IdEEmmmS3_0
_ZN7crpropa4GridIdEC2ENS_7Vector3IdEEmmmd0
_ZN7crpropa4GridIdEC2ERKNS_14GridPropertiesE0
_ZN7crpropa4GridIfE20setInterpolationTypeENS_17interpolationTypeE0
_ZNK7crpropa4GridINS_7Vector3IdEEE12closestValueERKS2_0
_ZNK7crpropa4GridINS_7Vector3IdEEE13reflectiveGetEmmm0
_ZNK7crpropa4GridINS_7Vector3IdEEE17positionFromIndexEi0
_ZNK7crpropa4GridINS_7Vector3IdEEE17simdreflectiveGetEmmm0
_ZNK7crpropa4GridINS_7Vector3IdEEE19tricubicInterpolateENS1_IfEERKS2_0
_ZNK7crpropa4GridINS_7Vector3IdEEE20trilinearInterpolateERKS2_0
_ZNK7crpropa4GridINS_7Vector3IfEEE13reflectiveGetEmmm0
_ZNK7crpropa4GridINS_7Vector3IfEEE17positionFromIndexEi0
_ZNK7crpropa4GridIdE12closestValueERKNS_7Vector3IdEE0
_ZNK7crpropa4GridIdE13reflectiveGetEmmm0
_ZNK7crpropa4GridIdE17positionFromIndexEi0
_ZNK7crpropa4GridIdE19tricubicInterpolateEdRKNS_7Vector3IdEE0
_ZNK7crpropa4GridIdE20trilinearInterpolateERKNS_7Vector3IdEE0
_ZNK7crpropa4GridIdE22CubicInterpolateScalarEddddd0
_ZNK7crpropa4GridIfE13reflectiveGetEmmm0
_ZN7crpropa4GridINS_7Vector3IfEEEC2ENS1_IdEEmmmd1
_ZN7crpropa4GridIfEC2ENS_7Vector3IdEEmmmS3_1
_ZN7crpropa14GridPropertiesD0Ev2
_ZN7crpropa4GridIfEC2ENS_7Vector3IdEEmd2
_ZN7crpropa4GridIfEC2ERKNS_14GridPropertiesE3
_ZNK7crpropa4GridIfE19tricubicInterpolateEdRKNS_7Vector3IdEE3
_ZN7crpropa4GridINS_7Vector3IfEEEC2ERKNS_14GridPropertiesE6
_ZN7crpropa4GridIfEC2ENS_7Vector3IdEEmmmd6
_ZNK7crpropa4GridIfE12closestValueERKNS_7Vector3IdEE7
_ZN7crpropa4GridINS_7Vector3IfEEEC2ENS1_IdEEmd9
_ZNK7crpropa4GridIfE20trilinearInterpolateERKNS_7Vector3IdEE9
_ZNK7crpropa4GridINS_7Vector3IfEEE12closestValueERKNS1_IdEE10
_ZN7crpropa4GridIfE11setGridSizeEmmm12
_ZNK7crpropa4GridINS_7Vector3IfEEE19tricubicInterpolateES2_RKNS1_IdEE15
_ZN7crpropa4GridINS_7Vector3IfEEE11setGridSizeEmmm16
_ZN7crpropa4GridIfE11interpolateERKNS_7Vector3IdEE18
_ZN7crpropa15reflectiveClampEdiRiS0_Rd20
_ZN7crpropa5roundEd51
_ZNK7crpropa4GridIfE22CubicInterpolateScalarEddddd63
_ZNK7crpropa4GridINS_7Vector3IfEEE17simdreflectiveGetEmmm384
_ZNK7crpropa4GridIfE17positionFromIndexEi10103
_ZNK7crpropa4GridINS_7Vector3IfEEE20trilinearInterpolateERKNS1_IdEE100046
_ZN7crpropa4GridINS_7Vector3IfEEE11interpolateERKNS1_IdEE100073
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Grid.h.func.html b/doc/coverageReport/include/crpropa/Grid.h.func.html new file mode 100644 index 000000000..0b9457ac3 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Grid.h.func.html @@ -0,0 +1,296 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Grid.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Grid.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:17319588.7 %
Date:2024-04-08 14:58:22Functions:235641.1 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa14GridPropertiesD0Ev2
_ZN7crpropa14GridPropertiesD2Ev0
_ZN7crpropa15reflectiveClampEdiRiS0_Rd20
_ZN7crpropa4GridINS_7Vector3IdEEE11interpolateERKS2_0
_ZN7crpropa4GridINS_7Vector3IdEEE11setGridSizeEmmm0
_ZN7crpropa4GridINS_7Vector3IdEEE20setInterpolationTypeENS_17interpolationTypeE0
_ZN7crpropa4GridINS_7Vector3IdEEEC2ERKNS_14GridPropertiesE0
_ZN7crpropa4GridINS_7Vector3IdEEEC2ES2_md0
_ZN7crpropa4GridINS_7Vector3IdEEEC2ES2_mmmS2_0
_ZN7crpropa4GridINS_7Vector3IdEEEC2ES2_mmmd0
_ZN7crpropa4GridINS_7Vector3IfEEE11interpolateERKNS1_IdEE100073
_ZN7crpropa4GridINS_7Vector3IfEEE11setGridSizeEmmm16
_ZN7crpropa4GridINS_7Vector3IfEEE20setInterpolationTypeENS_17interpolationTypeE0
_ZN7crpropa4GridINS_7Vector3IfEEEC2ENS1_IdEEmd9
_ZN7crpropa4GridINS_7Vector3IfEEEC2ENS1_IdEEmmmS4_0
_ZN7crpropa4GridINS_7Vector3IfEEEC2ENS1_IdEEmmmd1
_ZN7crpropa4GridINS_7Vector3IfEEEC2ERKNS_14GridPropertiesE6
_ZN7crpropa4GridIdE11interpolateERKNS_7Vector3IdEE0
_ZN7crpropa4GridIdE11setGridSizeEmmm0
_ZN7crpropa4GridIdE20setInterpolationTypeENS_17interpolationTypeE0
_ZN7crpropa4GridIdEC2ENS_7Vector3IdEEmd0
_ZN7crpropa4GridIdEC2ENS_7Vector3IdEEmmmS3_0
_ZN7crpropa4GridIdEC2ENS_7Vector3IdEEmmmd0
_ZN7crpropa4GridIdEC2ERKNS_14GridPropertiesE0
_ZN7crpropa4GridIfE11interpolateERKNS_7Vector3IdEE18
_ZN7crpropa4GridIfE11setGridSizeEmmm12
_ZN7crpropa4GridIfE20setInterpolationTypeENS_17interpolationTypeE0
_ZN7crpropa4GridIfEC2ENS_7Vector3IdEEmd2
_ZN7crpropa4GridIfEC2ENS_7Vector3IdEEmmmS3_1
_ZN7crpropa4GridIfEC2ENS_7Vector3IdEEmmmd6
_ZN7crpropa4GridIfEC2ERKNS_14GridPropertiesE3
_ZN7crpropa5roundEd51
_ZNK7crpropa4GridINS_7Vector3IdEEE12closestValueERKS2_0
_ZNK7crpropa4GridINS_7Vector3IdEEE13reflectiveGetEmmm0
_ZNK7crpropa4GridINS_7Vector3IdEEE17positionFromIndexEi0
_ZNK7crpropa4GridINS_7Vector3IdEEE17simdreflectiveGetEmmm0
_ZNK7crpropa4GridINS_7Vector3IdEEE19tricubicInterpolateENS1_IfEERKS2_0
_ZNK7crpropa4GridINS_7Vector3IdEEE20trilinearInterpolateERKS2_0
_ZNK7crpropa4GridINS_7Vector3IfEEE12closestValueERKNS1_IdEE10
_ZNK7crpropa4GridINS_7Vector3IfEEE13reflectiveGetEmmm0
_ZNK7crpropa4GridINS_7Vector3IfEEE17positionFromIndexEi0
_ZNK7crpropa4GridINS_7Vector3IfEEE17simdreflectiveGetEmmm384
_ZNK7crpropa4GridINS_7Vector3IfEEE19tricubicInterpolateES2_RKNS1_IdEE15
_ZNK7crpropa4GridINS_7Vector3IfEEE20trilinearInterpolateERKNS1_IdEE100046
_ZNK7crpropa4GridIdE12closestValueERKNS_7Vector3IdEE0
_ZNK7crpropa4GridIdE13reflectiveGetEmmm0
_ZNK7crpropa4GridIdE17positionFromIndexEi0
_ZNK7crpropa4GridIdE19tricubicInterpolateEdRKNS_7Vector3IdEE0
_ZNK7crpropa4GridIdE20trilinearInterpolateERKNS_7Vector3IdEE0
_ZNK7crpropa4GridIdE22CubicInterpolateScalarEddddd0
_ZNK7crpropa4GridIfE12closestValueERKNS_7Vector3IdEE7
_ZNK7crpropa4GridIfE13reflectiveGetEmmm0
_ZNK7crpropa4GridIfE17positionFromIndexEi10103
_ZNK7crpropa4GridIfE19tricubicInterpolateEdRKNS_7Vector3IdEE3
_ZNK7crpropa4GridIfE20trilinearInterpolateERKNS_7Vector3IdEE9
_ZNK7crpropa4GridIfE22CubicInterpolateScalarEddddd63
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Grid.h.gcov.html b/doc/coverageReport/include/crpropa/Grid.h.gcov.html new file mode 100644 index 000000000..cad5f1688 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Grid.h.gcov.html @@ -0,0 +1,640 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Grid.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Grid.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:17319588.7 %
Date:2024-04-08 14:58:22Functions:235641.1 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_GRID_H
+       2             : #define CRPROPA_GRID_H
+       3             : 
+       4             : #include "crpropa/Referenced.h"
+       5             : #include "crpropa/Vector3.h"
+       6             : 
+       7             : #include "kiss/string.h"
+       8             : #include "kiss/logger.h"
+       9             : 
+      10             : #include <vector>
+      11             : #include <type_traits>
+      12             : #if HAVE_SIMD
+      13             : #include <immintrin.h>
+      14             : #include <smmintrin.h>
+      15             : #endif // HAVE_SIMD
+      16             : 
+      17             : namespace crpropa {
+      18             : 
+      19             : /** If set to TRILINEAR, use trilinear interpolation (standard)
+      20             : If set to TRICUBIC, use tricubic interpolation instead of trilinear interpolation
+      21             : If set to NEAREST_NEIGHBOUR , use nearest neighbour interpolation instead of trilinear interpolation */
+      22             : enum interpolationType {
+      23             :   TRILINEAR = 0,
+      24             :   TRICUBIC,
+      25             :   NEAREST_NEIGHBOUR
+      26             : };
+      27             : 
+      28             : /** Lower and upper neighbour in a periodically continued unit grid */
+      29             : inline void periodicClamp(double x, int n, int &lo, int &hi) {
+      30      100051 :         lo = ((int(floor(x)) % (n)) + (n)) % (n);
+      31          10 :         hi = (lo + 1) % (n);
+      32             : }
+      33             : 
+      34             : /** grid index in a reflective continued unit grid */
+      35             : inline int reflectiveBoundary(int index, int n) {
+      36        1963 :         while ((index < -0.5) or (index > (n-0.5)))
+      37         806 :                 index = 2 * n * (index > (n-0.5)) - index-1;
+      38             :         return index;
+      39             : }
+      40             : 
+      41             : /** grid index in a periodically continued unit grid */
+      42             : inline int periodicBoundary(int index, int n) {
+      43         768 :         return ((index % (n)) + (n)) % (n);
+      44             : }
+      45             : 
+      46             : /** Lower and upper neighbour in a reflectively repeated unit grid */
+      47          20 : inline void reflectiveClamp(double x, int n, int &lo, int &hi, double &res) {
+      48          36 :         while ((x < -0.5) or (x > (n-0.5)))
+      49          16 :                 x = 2 * n * (x > (n-0.5)) -x-1;
+      50          20 :         res = x;
+      51          20 :         lo = floor(x);
+      52          20 :         hi = lo + (lo < n-1);
+      53          20 :         if (x<0) {
+      54          10 :                 lo=0; 
+      55          10 :                 hi=0;
+      56             :         }
+      57          20 : }
+      58             : 
+      59             : /** Symmetrical round */
+      60          51 : inline double round(double r) {
+      61          51 :         return (r > 0.0) ? floor(r + 0.5) : ceil(r - 0.5);
+      62             : }
+      63             : 
+      64             : /**
+      65             :  * \addtogroup Core
+      66             :  * @{
+      67             :  */
+      68             : 
+      69             : /**
+      70             :  @class GridProperties
+      71             :  @brief Combines parameters that uniquely define Grid class
+      72             :  */
+      73             : class GridProperties: public Referenced {
+      74             : public:
+      75             :         size_t Nx, Ny, Nz;      // Number of grid points
+      76             :         Vector3d origin;        // Position of the lower left front corner of the volume
+      77             :         Vector3d spacing;       // Spacing vector between gridpoints
+      78             :         bool reflective;        // using reflective repetition of the grid instead of periodic
+      79             :         interpolationType ipol; // Interpolation type used between grid points
+      80             :         bool clipVolume;        // Set grid values to 0 outside the volume if true
+      81             : 
+      82             :         /** Constructor for cubic grid
+      83             :          @param origin  Position of the lower left front corner of the volume
+      84             :          @param N               Number of grid points in one direction
+      85             :          @param spacing Spacing between grid points
+      86             :          */
+      87           6 :         GridProperties(Vector3d origin, size_t N, double spacing) :
+      88           6 :                 origin(origin), Nx(N), Ny(N), Nz(N), spacing(Vector3d(spacing)), reflective(false), ipol(TRILINEAR), clipVolume(false) {
+      89             :         }
+      90             : 
+      91             :         /** Constructor for non-cubic grid
+      92             :          @param origin  Position of the lower left front corner of the volume
+      93             :          @param Nx              Number of grid points in x-direction
+      94             :          @param Ny              Number of grid points in y-direction
+      95             :          @param Nz              Number of grid points in z-direction
+      96             :          @param spacing Spacing between grid points
+      97             :          */
+      98           0 :         GridProperties(Vector3d origin, size_t Nx, size_t Ny, size_t Nz, double spacing) :
+      99           0 :                 origin(origin), Nx(Nx), Ny(Ny), Nz(Nz), spacing(Vector3d(spacing)), reflective(false), ipol(TRILINEAR), clipVolume(false) {
+     100             :         }
+     101             : 
+     102             :         /** Constructor for non-cubic grid with spacing vector
+     103             :          @param origin  Position of the lower left front corner of the volume
+     104             :          @param Nx              Number of grid points in x-direction
+     105             :          @param Ny              Number of grid points in y-direction
+     106             :          @param Nz              Number of grid points in z-direction
+     107             :          @param spacing Spacing vector between grid points
+     108             :         */
+     109           1 :         GridProperties(Vector3d origin, size_t Nx, size_t Ny, size_t Nz, Vector3d spacing) :
+     110           1 :                 origin(origin), Nx(Nx), Ny(Ny), Nz(Nz), spacing(spacing), reflective(false), ipol(TRILINEAR), clipVolume(false) {
+     111             :         }
+     112             :         
+     113           2 :         virtual ~GridProperties() {
+     114           4 :         }
+     115             :         
+     116             :         /** If True, the repetition of the grid is refletive instead of periodic. */
+     117             :         void setReflective(bool b) {
+     118           0 :                 reflective = b;
+     119             :         }
+     120             : 
+     121             :         /** set the type of interpolation between grid points.
+     122             :          * @param i: interpolationType (TRILINEAR, TRICUBIC, NEAREST_NEIGHBOUR) */
+     123             :         void setInterpolationType(interpolationType i) {
+     124           0 :                 ipol = i;
+     125             :         }
+     126             : 
+     127             :         /** If True, the grid is set to zero outside of the volume. */
+     128             :         void setClipVolume(bool b) {
+     129           0 :                 clipVolume = b;
+     130             :         }
+     131             : };
+     132             : 
+     133             : /**
+     134             :  @class Grid
+     135             :  @brief Template class for fields on a periodic grid with trilinear interpolation
+     136             : 
+     137             :  The grid spacing is constant with diffrent resolution along all three axes.
+     138             :  Values are calculated by trilinear interpolation of the surrounding 8 grid points.
+     139             :  The grid is periodically (default) or reflectively extended.
+     140             :  The grid sample positions are at 1/2 * size/N, 3/2 * size/N ... (2N-1)/2 * size/N.
+     141             :  */
+     142             : template<typename T>
+     143          17 : class Grid: public Referenced {
+     144             :         std::vector<T> grid;
+     145             :         size_t Nx, Ny, Nz; /**< Number of grid points */
+     146             :         Vector3d origin; /**< Origin of the volume that is represented by the grid. */
+     147             :         Vector3d gridOrigin; /**< Grid origin */
+     148             :         Vector3d spacing; /**< Distance between grid points, determines the extension of the grid */
+     149             :         bool clipVolume; /**< If set to true, all values outside of the grid will be 0*/
+     150             :         bool reflective; /**< If set to true, the grid is repeated reflectively instead of periodically */
+     151             :         interpolationType ipolType; /**< Type of interpolation between the grid points */
+     152             : 
+     153             : public:
+     154             :         /** Constructor for cubic grid
+     155             :          @param origin  Position of the lower left front corner of the volume
+     156             :          @param N               Number of grid points in one direction
+     157             :          @param spacing Spacing between grid points
+     158             :          */
+     159          11 :         Grid(Vector3d origin, size_t N, double spacing) {
+     160             :                 setOrigin(origin);
+     161          11 :                 setGridSize(N, N, N);
+     162             :                 setSpacing(Vector3d(spacing));
+     163             :                 setReflective(false);
+     164             :                 setClipVolume(false);
+     165             :                 setInterpolationType(TRILINEAR);
+     166          11 :         }
+     167             : 
+     168             :         /** Constructor for non-cubic grid
+     169             :          @param origin  Position of the lower left front corner of the volume
+     170             :          @param Nx              Number of grid points in x-direction
+     171             :          @param Ny              Number of grid points in y-direction
+     172             :          @param Nz              Number of grid points in z-direction
+     173             :          @param spacing Spacing between grid points
+     174             :          */
+     175           7 :         Grid(Vector3d origin, size_t Nx, size_t Ny, size_t Nz, double spacing) {
+     176             :                 setOrigin(origin);
+     177           7 :                 setGridSize(Nx, Ny, Nz);
+     178             :                 setSpacing(Vector3d(spacing));
+     179             :                 setReflective(false);
+     180             :                 setClipVolume(false);
+     181             :                 setInterpolationType(TRILINEAR);
+     182           7 :         }
+     183             : 
+     184             :         /** Constructor for non-cubic grid with spacing vector
+     185             :          @param origin  Position of the lower left front corner of the volume
+     186             :          @param Nx              Number of grid points in x-direction
+     187             :          @param Ny              Number of grid points in y-direction
+     188             :          @param Nz              Number of grid points in z-direction
+     189             :          @param spacing Spacing vector between grid points
+     190             :         */
+     191           1 :         Grid(Vector3d origin, size_t Nx, size_t Ny, size_t Nz, Vector3d spacing) {
+     192             :                 setOrigin(origin);
+     193           1 :                 setGridSize(Nx, Ny, Nz);
+     194             :                 setSpacing(spacing);
+     195             :                 setReflective(false);
+     196             :                 setClipVolume(false);
+     197             :                 setInterpolationType(TRILINEAR);
+     198           1 :         }
+     199             : 
+     200             :         /** Constructor for GridProperties
+     201             :          @param p       GridProperties instance
+     202             :      */
+     203           9 :         Grid(const GridProperties &p) :
+     204           9 :                 origin(p.origin), spacing(p.spacing), reflective(p.reflective), ipolType(p.ipol) {
+     205           9 :                 setGridSize(p.Nx, p.Ny, p.Nz);
+     206           9 :                 setClipVolume(p.clipVolume);
+     207           9 :         }
+     208             : 
+     209             :         void setOrigin(Vector3d origin) {
+     210             :                 this->origin = origin;
+     211             :                 this->gridOrigin = origin + spacing/2;
+     212             :         }
+     213             : 
+     214             :         /** Resize grid, also enlarges the volume as the spacing stays constant */
+     215          28 :         void setGridSize(size_t Nx, size_t Ny, size_t Nz) {
+     216          28 :                 this->Nx = Nx;
+     217          28 :                 this->Ny = Ny;
+     218          28 :                 this->Nz = Nz;
+     219          28 :                 grid.resize(Nx * Ny * Nz);
+     220             :                 setOrigin(origin);
+     221          28 :         }
+     222             : 
+     223             :         void setSpacing(Vector3d spacing) {
+     224             :                 this->spacing = spacing;
+     225             :                 setOrigin(origin);
+     226             :         }
+     227             : 
+     228             :         void setReflective(bool b) {
+     229           8 :                 reflective = b;
+     230             :         }
+     231             : 
+     232             :         // If set to true, all values outside of the grid will be 0.
+     233             :         void setClipVolume(bool b) {
+     234          21 :                 clipVolume = b;
+     235             :         }
+     236             : 
+     237             :         /** Change the interpolation type to the routine specified by the user. Check if this routine is
+     238             :                 contained in the enum interpolationType and thus supported by CRPropa.*/
+     239           0 :         void setInterpolationType(interpolationType ipolType) {
+     240           0 :                 if (ipolType == TRILINEAR || ipolType == TRICUBIC || ipolType == NEAREST_NEIGHBOUR) {
+     241          30 :                         this->ipolType = ipolType;
+     242           0 :                         if ((ipolType == TRICUBIC) && (std::is_same<T, Vector3d>::value)) {
+     243           0 :                                 KISS_LOG_WARNING << "Tricubic interpolation on Grid3d works only with float-precision, doubles will be downcasted";
+     244             :                 }
+     245             :                 } else {
+     246           0 :                         throw std::runtime_error("InterpolationType: unknown interpolation type");
+     247             :                 }
+     248           0 :         }
+     249             : 
+     250             :         /** returns the position of the lower left front corner of the volume */
+     251             :         Vector3d getOrigin() const {
+     252             :                 return origin;
+     253             :         }
+     254             : 
+     255             :         bool getClipVolume() const {
+     256           0 :                 return clipVolume;
+     257             :         }
+     258             : 
+     259             :         size_t getNx() const {
+     260         728 :                 return Nx;
+     261             :         }
+     262             : 
+     263             :         size_t getNy() const {
+     264       41792 :                 return Ny;
+     265             :         }
+     266             : 
+     267             :         size_t getNz() const {
+     268     2663721 :                 return Nz;
+     269             :         }
+     270             : 
+     271             :         /** Calculates the total size of the grid in bytes */
+     272             :         size_t getSizeOf() const {
+     273           0 :                 return sizeof(grid) + (sizeof(grid[0]) * grid.size());
+     274             :         }
+     275             : 
+     276             :         Vector3d getSpacing() const {
+     277             :                 return spacing;
+     278             :         }
+     279             : 
+     280             :         bool isReflective() const {
+     281           0 :                 return reflective;
+     282             :         }
+     283             : 
+     284             :         /** Choose the interpolation algorithm based on the set interpolation type.
+     285             :           By default this it the trilinear interpolation. The user can change the
+     286             :           routine with the setInterpolationType function.*/
+     287      100091 :         T interpolate(const Vector3d &position) {
+     288             :                 // check for volume
+     289      100091 :                 if (clipVolume) {
+     290           5 :                         Vector3d edge = origin + Vector3d(Nx, Ny, Nz) * spacing;
+     291           5 :                         bool isInVolume = (position.x >= origin.x) && (position.x <= edge.x);
+     292           5 :                         isInVolume &= (position.y >= origin.y) && (position.y <= edge.y);
+     293           5 :                         isInVolume &= (position.z >= origin.z) && (position.z <= edge.z);
+     294           5 :                         if (!isInVolume) 
+     295             :                                 return T(0.);
+     296             :                 } 
+     297             : 
+     298      100086 :                 if (ipolType == TRICUBIC)
+     299          18 :                         return tricubicInterpolate(T(), position);
+     300      100068 :                 else if (ipolType == NEAREST_NEIGHBOUR)
+     301          13 :                         return closestValue(position);
+     302             :                 else
+     303      100055 :                         return trilinearInterpolate(position);
+     304             :         }
+     305             : 
+     306             :         /** Inspector & Mutator */
+     307             :         T &get(size_t ix, size_t iy, size_t iz) {
+     308     8391022 :                 return grid[ix * Ny * Nz + iy * Nz + iz];
+     309             :         }
+     310             : 
+     311             :         /** Inspector */
+     312             :         const T &get(size_t ix, size_t iy, size_t iz) const {
+     313      100072 :                 return grid[ix * Ny * Nz + iy * Nz + iz];
+     314             :         }
+     315             : 
+     316             :         const T &periodicGet(size_t ix, size_t iy, size_t iz) const {
+     317         192 :                 ix = periodicBoundary(ix, Nx);
+     318         192 :                 iy = periodicBoundary(iy, Ny);
+     319         192 :                 iz = periodicBoundary(iz, Nz);
+     320         192 :                 return grid[ix * Ny * Nz + iy * Nz + iz];
+     321             :         }
+     322             : 
+     323           0 :         const T &reflectiveGet(size_t ix, size_t iy, size_t iz) const {
+     324           0 :                 ix = reflectiveBoundary(ix, Nx);
+     325           0 :                 iy = reflectiveBoundary(iy, Ny);
+     326           0 :                 iz = reflectiveBoundary(iz, Nz);
+     327           0 :                 return grid[ix * Ny * Nz + iy * Nz + iz];
+     328             :         }
+     329             : 
+     330             :         T getValue(size_t ix, size_t iy, size_t iz) {
+     331           0 :                 return grid[ix * Ny * Nz + iy * Nz + iz];
+     332             :         }
+     333             : 
+     334             :         void setValue(size_t ix, size_t iy, size_t iz, T value) {
+     335           0 :                 grid[ix * Ny * Nz + iy * Nz + iz] = value;
+     336             :         }
+     337             : 
+     338             :         /** Return a reference to the grid values */
+     339             :         std::vector<T> &getGrid() {
+     340       10102 :                 return grid;
+     341             :         }
+     342             : 
+     343             :         /** Position of the grid point of a given index */
+     344       10103 :         Vector3d positionFromIndex(int index) const {
+     345       10103 :                 int ix = index / (Ny * Nz);
+     346       10103 :                 int iy = (index / Nz) % Ny;
+     347       10103 :                 int iz = index % Nz;
+     348       10103 :                 return Vector3d(ix, iy, iz) * spacing + gridOrigin;
+     349             :         }
+     350             : 
+     351             :         /** Value of a grid point that is closest to a given position / nearest neighbour interpolation */
+     352          17 :         T closestValue(const Vector3d &position) const {
+     353             :                 Vector3d r = (position - gridOrigin) / spacing;
+     354             :                 int ix, iy, iz;
+     355          17 :                 if (reflective) {
+     356           6 :                         ix = round(r.x);
+     357           6 :                         iy = round(r.y);
+     358           6 :                         iz = round(r.z);
+     359           9 :                         while ((ix < -0.5) or (ix > (Nx-0.5)))
+     360           3 :                                 ix = 2 * Nx * (ix > (Nx-0.5)) - ix-1;
+     361          11 :                         while ((iy < -0.5) or (iy > (Ny-0.5)))
+     362           5 :                                 iy = 2 * Ny * (iy > (Ny-0.5)) - iy-1;
+     363           9 :                         while ((iz < -0.5) or (iz > (Nz-0.5)))
+     364           3 :                                 iz = 2 * Nz * (iz > (Nz-0.5)) - iz-1;
+     365             :                 } else {
+     366          11 :                         ix = round(fmod(r.x, Nx));
+     367          11 :                         iy = round(fmod(r.y, Ny));
+     368          11 :                         iz = round(fmod(r.z, Nz));
+     369          11 :                         ix = (ix + Nx * (ix < 0)) % Nx;
+     370          11 :                         iy = (iy + Ny * (iy < 0)) % Ny;
+     371          11 :                         iz = (iz + Nz * (iz < 0)) % Nz;
+     372             :                 }
+     373          17 :                 return get(ix, iy, iz);
+     374             :         }
+     375             : 
+     376             : private:
+     377             :         #ifdef HAVE_SIMD
+     378             :         __m128 simdperiodicGet(size_t ix, size_t iy, size_t iz) const {
+     379         576 :                 ix = periodicBoundary(ix, Nx);
+     380         576 :                 iy = periodicBoundary(iy, Ny);
+     381         576 :                 iz = periodicBoundary(iz, Nz);
+     382         576 :                 return convertVector3fToSimd(grid[ix * Ny * Nz + iy * Nz + iz]);
+     383             :         }
+     384             : 
+     385         384 :         __m128 simdreflectiveGet(size_t ix, size_t iy, size_t iz) const {
+     386         384 :                 ix = reflectiveBoundary(ix, Nx);
+     387         384 :                 iy = reflectiveBoundary(iy, Ny);
+     388         384 :                 iz = reflectiveBoundary(iz, Nz);
+     389         384 :                 return convertVector3fToSimd(grid[ix * Ny * Nz + iy * Nz + iz]);
+     390             :         }
+     391             : 
+     392             :         __m128 convertVector3fToSimd(const Vector3f v) const {
+     393             :                 __m128 simdVar = _mm_set_ps(0,v.z,v.y,v.x);
+     394             :                 return simdVar;
+     395             :         }
+     396             :         
+     397             :         Vector3f convertSimdToVector3f(__m128 res) const {
+     398             :                 float vec[4];   
+     399             :                 _mm_store_ps(&vec[0], res);
+     400             :                 Vector3f result = Vector3f(vec[0], vec[1], vec[2]);
+     401             :                 return result;
+     402             :         }
+     403             : 
+     404             :         /** Vectorized cubic Interpolator in 1D */
+     405             :         __m128 CubicInterpolate(__m128 p0,__m128 p1,__m128 p2,__m128 p3,double position) const {
+     406             :                 __m128 c1 = _mm_set1_ps (1/2.);
+     407             :                 __m128 c2 = _mm_set1_ps (3/2.);
+     408             :                 __m128 c3 = _mm_set1_ps (2.);
+     409             :                 __m128 c4 = _mm_set1_ps (5/2.);
+     410             : 
+     411         315 :                 __m128 pos  = _mm_set1_ps (position);
+     412         315 :                 __m128 pos2 = _mm_set1_ps (position*position);
+     413         300 :                 __m128 pos3 = _mm_set1_ps (position*position*position);
+     414             : 
+     415             :                 /** SIMD optimized routine to calculate 'res = ((-0.5*p0+3/2.*p1-3/2.*p2+0.5*p3)*pos*pos*pos+(p0-5/2.*p1+p2*2-0.5*p3)*pos*pos+(-0.5*p0+0.5*p2)*pos+p1);'
+     416             :                          where terms are used as:
+     417             :                         term = (-0.5*p0+0.5*p2)*pos
+     418             :                         term2 = (p0-5/2.*p1+p2*2-0.5*p3)*pos*pos;
+     419             :                         term3 = (-0.5*p0+3/2.*p1-3/2.*p2+0.5*p3)*pos*pos*pos;  */
+     420             :                 __m128 term = _mm_mul_ps(_mm_sub_ps(_mm_mul_ps(c1,p2),_mm_mul_ps(c1,p0)),pos);
+     421             :                 __m128 term2 = _mm_mul_ps(_mm_sub_ps(_mm_add_ps(p0,_mm_mul_ps(c3,p2)),_mm_add_ps(_mm_mul_ps(c4,p1),_mm_mul_ps(c1,p3))),pos2);
+     422             :                 __m128 term3 = _mm_mul_ps(_mm_sub_ps(_mm_add_ps(_mm_mul_ps(c2,p1),_mm_mul_ps(c1,p3)),_mm_add_ps(_mm_mul_ps(c1,p0),_mm_mul_ps(c2,p2))),pos3);
+     423             :                 __m128 res = _mm_add_ps(_mm_add_ps(_mm_add_ps(term3,term2),term),p1);
+     424             :                 return res;
+     425             :         }
+     426             :         #endif // HAVE_SIMD
+     427             :         /** Interpolate the grid tricubic at a given position (see https://www.paulinternet.nl/?page=bicubic, http://graphics.cs.cmu.edu/nsp/course/15-462/Fall04/assts/catmullRom.pdf) */
+     428          15 :         Vector3f tricubicInterpolate(Vector3f, const Vector3d &position) const {
+     429             :                 #ifdef HAVE_SIMD
+     430             :                 // position on a unit grid
+     431             :                 Vector3d r = (position - gridOrigin) / spacing;
+     432             : 
+     433             :                 int iX0, iY0, iZ0;
+     434          15 :                 iX0 = floor(r.x);
+     435          15 :                 iY0 = floor(r.y);
+     436          15 :                 iZ0 = floor(r.z);
+     437             : 
+     438             :                 double fX, fY, fZ;
+     439          15 :                 fX = r.x - iX0;
+     440          15 :                 fY = r.y - iY0;
+     441          15 :                 fZ = r.z - iZ0;
+     442             : 
+     443             :                 int nrCubicInterpolations = 4;
+     444          15 :                 __m128 interpolateVaryX[nrCubicInterpolations];
+     445          15 :                 __m128 interpolateVaryY[nrCubicInterpolations];
+     446          15 :                 __m128 interpolateVaryZ[nrCubicInterpolations];
+     447             :                 /** Perform 1D interpolations while iterating in each for loop over the index of another direction */
+     448          75 :                 for (int iLoopX = -1; iLoopX < nrCubicInterpolations-1; iLoopX++) {
+     449         300 :                         for (int iLoopY = -1; iLoopY < nrCubicInterpolations-1; iLoopY++) {
+     450        1200 :                                 for (int iLoopZ = -1; iLoopZ < nrCubicInterpolations-1; iLoopZ++) {
+     451         960 :                                         if (reflective)
+     452         384 :                                                 interpolateVaryZ[iLoopZ+1] = simdreflectiveGet(iX0+iLoopX, iY0+iLoopY, iZ0+iLoopZ);
+     453             :                                         else 
+     454         576 :                                                 interpolateVaryZ[iLoopZ+1] = simdperiodicGet(iX0+iLoopX, iY0+iLoopY, iZ0+iLoopZ);
+     455             :                                 }
+     456         240 :                                 interpolateVaryY[iLoopY+1] = CubicInterpolate(interpolateVaryZ[0], interpolateVaryZ[1], interpolateVaryZ[2], interpolateVaryZ[3], fZ);
+     457             :                         }
+     458          60 :                         interpolateVaryX[iLoopX+1] = CubicInterpolate(interpolateVaryY[0], interpolateVaryY[1], interpolateVaryY[2], interpolateVaryY[3], fY);
+     459             :                 }
+     460          15 :                 __m128 result = CubicInterpolate(interpolateVaryX[0], interpolateVaryX[1], interpolateVaryX[2], interpolateVaryX[3], fX);
+     461          15 :                 return convertSimdToVector3f(result);
+     462             :                 #else // HAVE_SIMD
+     463             :                 throw std::runtime_error( "Tried to use tricubic Interpolation without SIMD_EXTENSION. SIMD Optimization is necessary for tricubic interpolation of vector grids.\n");
+     464             :                 #endif // HAVE_SIMD     
+     465          15 :         }
+     466             : 
+     467             :         /** Vectorized cubic Interpolator in 1D that returns a scalar (see https://www.paulinternet.nl/?page=bicubic, http://graphics.cs.cmu.edu/nsp/course/15-462/Fall04/assts/catmullRom.pdf) */
+     468          63 :         double CubicInterpolateScalar(double p0,double p1,double p2,double p3,double pos) const {
+     469          63 :                 return((-0.5*p0+3/2.*p1-3/2.*p2+0.5*p3)*pos*pos*pos+(p0-5/2.*p1+p2*2-0.5*p3)*pos*pos+(-0.5*p0+0.5*p2)*pos+p1);
+     470             :         }
+     471             : 
+     472             :   /** Interpolate the grid tricubic at a given position (see https://www.paulinternet.nl/?page=bicubic, http://graphics.cs.cmu.edu/nsp/course/15-462/Fall04/assts/catmullRom.pdf) */
+     473           3 :         double tricubicInterpolate(double, const Vector3d &position) const {
+     474             :                 /** position on a unit grid */
+     475             :                 Vector3d r = (position - gridOrigin) / spacing;
+     476             : 
+     477             :                 int iX0, iY0, iZ0;
+     478           3 :                 iX0 = floor(r.x);
+     479           3 :                 iY0 = floor(r.y);
+     480           3 :                 iZ0 = floor(r.z);
+     481             : 
+     482             :                 double fX, fY, fZ;
+     483           3 :                 fX = r.x - iX0;
+     484           3 :                 fY = r.y - iY0;
+     485           3 :                 fZ = r.z - iZ0;
+     486             : 
+     487             :                 int nrCubicInterpolations = 4;
+     488           3 :                 double interpolateVaryX[nrCubicInterpolations];
+     489           3 :                 double interpolateVaryY[nrCubicInterpolations];
+     490           3 :                 double interpolateVaryZ[nrCubicInterpolations];
+     491             :                 /** Perform 1D interpolations while iterating in each for loop over the index of another direction */
+     492          15 :                 for (int iLoopX = -1; iLoopX < nrCubicInterpolations-1; iLoopX++) {
+     493          60 :                         for (int iLoopY = -1; iLoopY < nrCubicInterpolations-1; iLoopY++) {
+     494         240 :                                 for (int iLoopZ = -1; iLoopZ < nrCubicInterpolations-1; iLoopZ++) {
+     495         192 :                                         if (reflective)
+     496           0 :                                                 interpolateVaryZ[iLoopZ+1] = reflectiveGet(iX0+iLoopX, iY0+iLoopY, iZ0+iLoopZ);
+     497             :                                         else
+     498         192 :                                                 interpolateVaryZ[iLoopZ+1] = periodicGet(iX0+iLoopX, iY0+iLoopY, iZ0+iLoopZ);
+     499             :                                 }
+     500          48 :                                 interpolateVaryY[iLoopY+1] = CubicInterpolateScalar(interpolateVaryZ[0], interpolateVaryZ[1], interpolateVaryZ[2], interpolateVaryZ[3], fZ);
+     501             :                         }
+     502          12 :                         interpolateVaryX[iLoopX+1] = CubicInterpolateScalar(interpolateVaryY[0], interpolateVaryY[1], interpolateVaryY[2], interpolateVaryY[3], fY);
+     503             :                 }
+     504           3 :                 double result = CubicInterpolateScalar(interpolateVaryX[0], interpolateVaryX[1], interpolateVaryX[2], interpolateVaryX[3], fX);
+     505           3 :                 return result;
+     506           3 :         }
+     507             : 
+     508             :         /** Interpolate the grid trilinear at a given position */
+     509      100055 :         T trilinearInterpolate(const Vector3d &position) const {
+     510             :                 /** position on a unit grid */
+     511             :                 Vector3d r = (position - gridOrigin) / spacing;
+     512             : 
+     513             :                 /** indices of lower (0) and upper (1) neighbours. The neighbours span a grid
+     514             :                   with the origin at [iX0, iY0, iZ0] and the most distant corner [iX1, iY1, iZ1]. */
+     515             :                 int iX0, iX1, iY0, iY1, iZ0, iZ1;
+     516             :                 double resX, resY, resZ, fX0, fY0, fZ0;
+     517             : 
+     518      100055 :                 if (reflective) {
+     519           6 :                         reflectiveClamp(r.x, Nx, iX0, iX1, resX);
+     520           6 :                         reflectiveClamp(r.y, Ny, iY0, iY1, resY);
+     521           6 :                         reflectiveClamp(r.z, Nz, iZ0, iZ1, resZ);
+     522           6 :                         fX0 = resX - floor(resX);
+     523           6 :                         fY0 = resY - floor(resY);
+     524           6 :                         fZ0 = resZ - floor(resZ);
+     525             :                 } else {
+     526      100049 :                         periodicClamp(r.x, Nx, iX0, iX1);
+     527      100049 :                         periodicClamp(r.y, Ny, iY0, iY1);
+     528      100049 :                         periodicClamp(r.z, Nz, iZ0, iZ1);
+     529      100049 :                         fX0 = r.x - floor(r.x);
+     530      100049 :                         fY0 = r.y - floor(r.y);
+     531      100049 :                         fZ0 = r.z - floor(r.z);
+     532             :                 }
+     533             : 
+     534             :                 /** linear fraction to upper neighbours based on lower neighbours calculated above */
+     535      100055 :                 double fX1 = 1 - fX0;
+     536      100055 :                 double fY1 = 1 - fY0;
+     537      100055 :                 double fZ1 = 1 - fZ0;
+     538             : 
+     539             :                 /** trilinear interpolation (see http://paulbourke.net/miscellaneous/interpolation) */
+     540             :                 T b(0.);
+     541      100055 :                 b += get(iX0, iY0, iZ0) * fX1 * fY1 * fZ1;
+     542      100055 :                 b += get(iX1, iY0, iZ0) * fX0 * fY1 * fZ1;
+     543      100055 :                 b += get(iX0, iY1, iZ0) * fX1 * fY0 * fZ1;
+     544      100055 :                 b += get(iX0, iY0, iZ1) * fX1 * fY1 * fZ0;
+     545           9 :                 b += get(iX1, iY0, iZ1) * fX0 * fY1 * fZ0;
+     546           9 :                 b += get(iX0, iY1, iZ1) * fX1 * fY0 * fZ0;
+     547           9 :                 b += get(iX1, iY1, iZ0) * fX0 * fY0 * fZ1;
+     548           9 :                 b += get(iX1, iY1, iZ1) * fX0 * fY0 * fZ0;
+     549             : 
+     550      100055 :                 return b;
+     551             :         }
+     552             : 
+     553             : }; // class Grid
+     554             : 
+     555             : typedef Grid<double> Grid1d;
+     556             : typedef Grid<float> Grid1f;
+     557             : typedef Grid<Vector3f> Grid3f;
+     558             : typedef Grid<Vector3d> Grid3d;
+     559             : 
+     560             : /** @}*/
+     561             : 
+     562             : } // namespace crpropa
+     563             : 
+     564             : #endif // CRPROPA_GRID_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Logging.h.func-sort-c.html b/doc/coverageReport/include/crpropa/Logging.h.func-sort-c.html new file mode 100644 index 000000000..df316be7f --- /dev/null +++ b/doc/coverageReport/include/crpropa/Logging.h.func-sort-c.html @@ -0,0 +1,96 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Logging.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Logging.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0180.0 %
Date:2024-04-08 14:58:22Functions:060.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_Z10logWarningRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_Z11setLogLeveli0
_Z12setLogStreamRSo0
_Z7logInfoRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_Z8logDebugRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_Z8logErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Logging.h.func.html b/doc/coverageReport/include/crpropa/Logging.h.func.html new file mode 100644 index 000000000..118e0b0b8 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Logging.h.func.html @@ -0,0 +1,96 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Logging.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Logging.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0180.0 %
Date:2024-04-08 14:58:22Functions:060.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_Z10logWarningRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_Z11setLogLeveli0
_Z12setLogStreamRSo0
_Z7logInfoRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_Z8logDebugRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_Z8logErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Logging.h.gcov.html b/doc/coverageReport/include/crpropa/Logging.h.gcov.html new file mode 100644 index 000000000..adb602fd6 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Logging.h.gcov.html @@ -0,0 +1,111 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Logging.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Logging.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0180.0 %
Date:2024-04-08 14:58:22Functions:060.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_LOGGING_H
+       2             : #define CRPROPA_LOGGING_H
+       3             : 
+       4             : #include "crpropa/Version.h"
+       5             : 
+       6             : #include "kiss/logger.h"
+       7             : 
+       8             : #include <fstream>
+       9             : 
+      10             : // make the kiss log functions available in python
+      11           0 : void inline logError(const std::string &log) {
+      12           0 :         KISS_LOG_ERROR << log;
+      13           0 : }
+      14             : 
+      15           0 : void inline logInfo(const std::string &log) {
+      16           0 :         KISS_LOG_INFO << log;
+      17           0 : }
+      18             : 
+      19           0 : void inline logWarning(const std::string &log) {
+      20           0 :         KISS_LOG_WARNING << log;
+      21           0 : }
+      22             : 
+      23           0 : void inline logDebug(const std::string &log) {
+      24           0 :         KISS_LOG_DEBUG << log;
+      25           0 : }
+      26             : 
+      27           0 : void setLogStream(std::ostream &stream) {
+      28           0 :         kiss::Logger::setLogStream(stream);
+      29           0 : }
+      30             : 
+      31           0 : void setLogLevel(int level) {
+      32           0 :         kiss::Logger::setLogLevel(static_cast<kiss::eLogLevel>(level));
+      33           0 : }
+      34             : 
+      35             : #endif // CRPROPA_LOGGING_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Module.h.func-sort-c.html b/doc/coverageReport/include/crpropa/Module.h.func-sort-c.html new file mode 100644 index 000000000..33e798596 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Module.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Module.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Module.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:2825.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Module.h.func.html b/doc/coverageReport/include/crpropa/Module.h.func.html new file mode 100644 index 000000000..1d53a83bf --- /dev/null +++ b/doc/coverageReport/include/crpropa/Module.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Module.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Module.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:2825.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Module.h.gcov.html b/doc/coverageReport/include/crpropa/Module.h.gcov.html new file mode 100644 index 000000000..be630b8ed --- /dev/null +++ b/doc/coverageReport/include/crpropa/Module.h.gcov.html @@ -0,0 +1,141 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Module.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Module.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:2825.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_MODULE_H
+       2             : #define CRPROPA_MODULE_H
+       3             : 
+       4             : #include "crpropa/Candidate.h"
+       5             : #include "crpropa/Referenced.h"
+       6             : #include "crpropa/Common.h"
+       7             : 
+       8             : #include <string>
+       9             : 
+      10             : namespace crpropa {
+      11             : 
+      12             : class Candidate;
+      13             : 
+      14             : /**
+      15             :  @class Module
+      16             :  @brief Abstract base class for modules
+      17             :  */
+      18             : class Module: public Referenced {
+      19             :         std::string description;
+      20             : public:
+      21             :         Module();
+      22          37 :         virtual ~Module() {
+      23           4 :         }
+      24             :         virtual std::string getDescription() const;
+      25             :         void setDescription(const std::string &description);
+      26             :         virtual void process(Candidate *candidate) const = 0;
+      27             :         inline void process(ref_ptr<Candidate> candidate) const {
+      28           0 :                 process(candidate.get());
+      29           0 :         }
+      30             : };
+      31             : 
+      32             : 
+      33             : /**
+      34             :  @class AbstractCondition
+      35             :  @brief Abstract Module providing common features for conditional modules.
+      36             :  */
+      37             : class AbstractCondition: public Module {
+      38             : protected:
+      39             :         ref_ptr<Module> rejectAction, acceptAction;
+      40             :         bool makeRejectedInactive, makeAcceptedInactive;
+      41             :         std::string rejectFlagKey, rejectFlagValue;
+      42             :         std::string acceptFlagKey, acceptFlagValue;
+      43             : 
+      44             :         void reject(Candidate *candidate) const;
+      45             :         inline void reject(ref_ptr<Candidate> candidate) const {
+      46           0 :                 reject(candidate.get());
+      47           0 :         }
+      48             : 
+      49             :         void accept(Candidate *candidate) const;
+      50             :         inline void accept(ref_ptr<Candidate> candidate) const {
+      51           0 :                 accept(candidate.get());
+      52           0 :         }
+      53             : 
+      54             : public:
+      55             :         AbstractCondition();
+      56             :         void onReject(Module *rejectAction);
+      57             :         void onAccept(Module *acceptAction);
+      58             :         void setMakeRejectedInactive(bool makeInactive);
+      59             :         void setMakeAcceptedInactive(bool makeInactive);
+      60             :         void setRejectFlag(std::string key, std::string value);
+      61             :         void setAcceptFlag(std::string key, std::string value);
+      62             : };
+      63             : } // namespace crpropa
+      64             : 
+      65             : #endif /* CRPROPA_MODULE_H */
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/ParticleState.h.func-sort-c.html b/doc/coverageReport/include/crpropa/ParticleState.h.func-sort-c.html new file mode 100644 index 000000000..71558e0b3 --- /dev/null +++ b/doc/coverageReport/include/crpropa/ParticleState.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/ParticleState.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - ParticleState.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/ParticleState.h.func.html b/doc/coverageReport/include/crpropa/ParticleState.h.func.html new file mode 100644 index 000000000..0ff39823d --- /dev/null +++ b/doc/coverageReport/include/crpropa/ParticleState.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/ParticleState.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - ParticleState.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/ParticleState.h.gcov.html b/doc/coverageReport/include/crpropa/ParticleState.h.gcov.html new file mode 100644 index 000000000..3c2bcfa41 --- /dev/null +++ b/doc/coverageReport/include/crpropa/ParticleState.h.gcov.html @@ -0,0 +1,196 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/ParticleState.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - ParticleState.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_PARTICLE_STATE_H
+       2             : #define CRPROPA_PARTICLE_STATE_H
+       3             : 
+       4             : #include "crpropa/Vector3.h"
+       5             : 
+       6             : namespace crpropa {
+       7             : /**
+       8             :  * \addtogroup Core
+       9             :  * @{
+      10             :  */
+      11             : 
+      12             : /**
+      13             :  @class ParticleState
+      14             :  @brief State of the particle: ID, energy, position, direction
+      15             : 
+      16             :  The ParticleState defines the state of an ultra-high energy cosmic ray, which
+      17             :  is assumed to be traveling at the exact speed of light.
+      18             :  The cosmic ray state is defined by particle ID, energy and position and
+      19             :  direction vector.
+      20             :  For faster lookup mass and charge of the particle are stored as members.
+      21             :  */
+      22     7199005 : class ParticleState {
+      23             : private:
+      24             :         int id; ///< particle ID (Particle Data Group numbering scheme)
+      25             :         double energy; ///< total energy
+      26             :         Vector3d position; ///< position vector in comoving coordinates
+      27             :         Vector3d direction; ///< unit vector of velocity or momentum
+      28             :         double pmass; ///< particle rest mass
+      29             :         double charge; ///< particle charge
+      30             : 
+      31             : public:
+      32             :         /** Constructor for a particle state.
+      33             :          @param id                      id of the particle following the PDG numbering scheme
+      34             :          @param energy          energy of the particle [in Joules]
+      35             :          @param position        vector containing the coordinates of the particle [in meters]
+      36             :          @param direction       vector containing the direction of motion of the particle
+      37             :          */
+      38             :         ParticleState(int id = 0, double energy = 0,
+      39             :                         Vector3d position = Vector3d(0, 0, 0),
+      40             :                         Vector3d direction = Vector3d(-1, 0, 0));
+      41             : 
+      42             :         /** Set particle position.
+      43             :          In simulations including cosmological effects, the position is given in comoving coordinates.
+      44             :          @param pos             vector containing the coordinates of the particle [in meters]
+      45             :         */
+      46             :         void setPosition(const Vector3d &pos);
+      47             :         /** Get position of particle.
+      48             :          @returns Position vector of particle. If cosmological effects are included, the coordinates are comoving.
+      49             :          */
+      50             :         const Vector3d &getPosition() const;
+      51             : 
+      52             :         /** Set direction unit vector, non unit-vectors are normalized
+      53             :          @param dir     vector containing the direction of motion of the particle
+      54             :          */
+      55             :         void setDirection(const Vector3d &dir);
+      56             :         /** Get direction unit vector
+      57             :          @returns Normalized vector containing direction of motion of particle.
+      58             :          */
+      59             :         const Vector3d &getDirection() const;
+      60             : 
+      61             :         /** Set energy of particle.
+      62             :          @param newEnergy       energy to be assigned to particle [in Joules]
+      63             :          */
+      64             :         void setEnergy(double newEnergy);
+      65             :         /** Get energy of particle.
+      66             :          @returns Energy of particle [in Joules]
+      67             :          */
+      68             :         double getEnergy() const;
+      69             :         /** Get rigidity of particle, defined as E/(Z*e).
+      70             :          @returns Rigidity of the particle [in Volts]
+      71             :          */
+      72             :         double getRigidity() const;
+      73             : 
+      74             :         /** Set particle ID.
+      75             :          This follows the PDG numbering scheme:
+      76             :           https://pdg.lbl.gov/2019/reviews/rpp2019-rev-monte-carlo-numbering.pdf
+      77             :          @param newId           id to be assigned to the particle 
+      78             :          */
+      79             :         void setId(int newId);
+      80             :         /** Get particle ID
+      81             :          @returns Particle ID (in PDG format).
+      82             :          */
+      83             :         int getId() const;
+      84             : 
+      85             :         std::string getDescription() const;
+      86             : 
+      87             :         // ======== Helper methods ========
+      88             : 
+      89             :         /** Get electrical charge of the particle.
+      90             :          @returns Charge of the particle [in Coulombs]
+      91             :          */
+      92             :         double getCharge() const;
+      93             :         /** Get mass of the particle.
+      94             :          @returns Mass of the particle [kg]
+      95             :          */
+      96             :         double getMass() const;
+      97             : 
+      98             :         /** Set Lorentz factor and modify the particle's energy accordingly.
+      99             :          @param gamma           Lorentz factor
+     100             :          */
+     101             :         void setLorentzFactor(double gamma);
+     102             :         /** Get Lorentz factor
+     103             :          @returns Lorentz factor of particle
+     104             :          */
+     105             :         double getLorentzFactor() const;
+     106             : 
+     107             :         /** Get velocity: direction times the speed of light.
+     108             :          @returns Velocity of particle [m/s]
+     109             :          */
+     110             :         Vector3d getVelocity() const;
+     111             :         /** Get momentum: direction times energy divided by the speed of light 
+     112             :          @returns The momentum [kg m/s]
+     113             :         */
+     114             :         Vector3d getMomentum() const;
+     115             : };
+     116             : /** @}*/
+     117             : 
+     118             : } // namespace crpropa
+     119             : 
+     120             : #endif // CRPROPA_PARTICLE_STATE_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/PhotonBackground.h.func-sort-c.html b/doc/coverageReport/include/crpropa/PhotonBackground.h.func-sort-c.html new file mode 100644 index 000000000..167da8226 --- /dev/null +++ b/doc/coverageReport/include/crpropa/PhotonBackground.h.func-sort-c.html @@ -0,0 +1,148 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/PhotonBackground.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - PhotonBackground.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:222781.5 %
Date:2024-04-08 14:58:22Functions:171989.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa19IRB_Saldana21_lowerC2Ev0
_ZN7crpropa19IRB_Saldana21_upperC2Ev0
_ZN7crpropa12URB_Fixsen11C2Ev4
_ZN7crpropa13IRB_Saldana21C2Ev4
_ZN7crpropa15URB_Protheroe96C2Ev6
_ZN7crpropa11IRB_Finke10C2Ev7
_ZN7crpropa11IRB_Finke22C2Ev7
_ZN7crpropa13IRB_Gilmore12C2Ev7
_ZN7crpropa13IRB_Stecker05C2Ev7
_ZN7crpropa15IRB_Dominguez11C2Ev7
_ZN7crpropa18IRB_Franceschini08C2Ev7
_ZN7crpropa19IRB_Stecker16_lowerC2Ev7
_ZN7crpropa19IRB_Stecker16_upperC2Ev7
_ZN7crpropa10URB_Nitu21C2Ev11
_ZN7crpropa13IRB_Kneiske04C2Ev13
_ZN7crpropa3CMBC2Ev40
_ZN7crpropa11PhotonFieldC2Ev135
_ZNK7crpropa11PhotonField12getFieldNameB5cxx11Ev175
_ZNK7crpropa11PhotonField18getRedshiftScalingEd16549
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/PhotonBackground.h.func.html b/doc/coverageReport/include/crpropa/PhotonBackground.h.func.html new file mode 100644 index 000000000..f8d9a9eee --- /dev/null +++ b/doc/coverageReport/include/crpropa/PhotonBackground.h.func.html @@ -0,0 +1,148 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/PhotonBackground.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - PhotonBackground.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:222781.5 %
Date:2024-04-08 14:58:22Functions:171989.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa10URB_Nitu21C2Ev11
_ZN7crpropa11IRB_Finke10C2Ev7
_ZN7crpropa11IRB_Finke22C2Ev7
_ZN7crpropa11PhotonFieldC2Ev135
_ZN7crpropa12URB_Fixsen11C2Ev4
_ZN7crpropa13IRB_Gilmore12C2Ev7
_ZN7crpropa13IRB_Kneiske04C2Ev13
_ZN7crpropa13IRB_Saldana21C2Ev4
_ZN7crpropa13IRB_Stecker05C2Ev7
_ZN7crpropa15IRB_Dominguez11C2Ev7
_ZN7crpropa15URB_Protheroe96C2Ev6
_ZN7crpropa18IRB_Franceschini08C2Ev7
_ZN7crpropa19IRB_Saldana21_lowerC2Ev0
_ZN7crpropa19IRB_Saldana21_upperC2Ev0
_ZN7crpropa19IRB_Stecker16_lowerC2Ev7
_ZN7crpropa19IRB_Stecker16_upperC2Ev7
_ZN7crpropa3CMBC2Ev40
_ZNK7crpropa11PhotonField12getFieldNameB5cxx11Ev175
_ZNK7crpropa11PhotonField18getRedshiftScalingEd16549
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/PhotonBackground.h.gcov.html b/doc/coverageReport/include/crpropa/PhotonBackground.h.gcov.html new file mode 100644 index 000000000..0a582c195 --- /dev/null +++ b/doc/coverageReport/include/crpropa/PhotonBackground.h.gcov.html @@ -0,0 +1,398 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/PhotonBackground.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - PhotonBackground.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:222781.5 %
Date:2024-04-08 14:58:22Functions:171989.5 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_PHOTONBACKGROUND_H
+       2             : #define CRPROPA_PHOTONBACKGROUND_H
+       3             : 
+       4             : #include "crpropa/Common.h"
+       5             : #include "crpropa/Referenced.h"
+       6             : 
+       7             : #include <vector>
+       8             : #include <string>
+       9             : 
+      10             : namespace crpropa {
+      11             : /**
+      12             :  * \addtogroup PhotonFields
+      13             :  * @{
+      14             :  */
+      15             : 
+      16             : /**
+      17             :  @class PhotonField
+      18             :  @brief Abstract base class for photon fields.
+      19             :  */
+      20           1 : class PhotonField: public Referenced {
+      21             : public:
+      22         135 :         PhotonField() {
+      23             :                 this->fieldName = "AbstractPhotonField";
+      24         135 :                 this->isRedshiftDependent = false;
+      25         135 :         }
+      26             : 
+      27             :         /**
+      28             :          returns comoving photon density [1/m^3].
+      29             :          multiply with (1+z^3) for physical number density.
+      30             :          @param ePhoton         photon energy [J]
+      31             :          @param z                       redshift (if redshift dependent, default = 0.)
+      32             :          */
+      33             :         virtual double getPhotonDensity(double ePhoton, double z = 0.) const = 0;
+      34             :         virtual double getMinimumPhotonEnergy(double z) const = 0;
+      35             :         virtual double getMaximumPhotonEnergy(double z) const = 0;
+      36         175 :         virtual std::string getFieldName() const {
+      37         175 :                 return this->fieldName;
+      38             :         }
+      39             : 
+      40             :         /**
+      41             :          returns overall comoving scaling factor
+      42             :          (cf. CRPropa3-data/calc_scaling.py)
+      43             :          @param z               redshift
+      44             :          */
+      45       16549 :         virtual double getRedshiftScaling(double z) const {
+      46       16549 :                 return 1.;
+      47             :         };
+      48             : 
+      49             :         bool hasRedshiftDependence() const {
+      50           0 :                 return this->isRedshiftDependent;
+      51             :         }
+      52             : 
+      53             :         void setFieldName(std::string fieldName) {
+      54           0 :                 this->fieldName = fieldName;
+      55           0 :         }
+      56             : 
+      57             : protected:
+      58             :         std::string fieldName;
+      59             :         bool isRedshiftDependent;
+      60             : };
+      61             : 
+      62             : /**
+      63             :  @class TabularPhotonField
+      64             :  @brief Photon field decorator for tabulated photon fields.
+      65             : 
+      66             :  This class reads photon field data from files;
+      67             :  The first file must be a list of photon energies [J], named fieldName_photonEnergy.txt
+      68             :  The second file must be a list of comoving photon field densities [1/m^3], named fieldName_photonDensity.txt
+      69             :  Optionally, a third file contains redshifts, named fieldName_redshift.txt
+      70             :  */
+      71             : class TabularPhotonField: public PhotonField {
+      72             : public:
+      73             :         TabularPhotonField(const std::string fieldName, const bool isRedshiftDependent = true);
+      74             : 
+      75             :         double getPhotonDensity(double ePhoton, double z = 0.) const;
+      76             :         double getRedshiftScaling(double z) const;
+      77             :         double getMinimumPhotonEnergy(double z) const;
+      78             :         double getMaximumPhotonEnergy(double z) const;
+      79             : 
+      80             : protected:
+      81             :         void readPhotonEnergy(std::string filePath);
+      82             :         void readPhotonDensity(std::string filePath);
+      83             :         void readRedshift(std::string filePath);
+      84             :         void initRedshiftScaling();
+      85             :         void checkInputData() const;
+      86             : 
+      87             :         std::vector<double> photonEnergies;
+      88             :         std::vector<double> photonDensity;
+      89             :         std::vector<double> redshifts;
+      90             :         std::vector<double> redshiftScalings;
+      91             : };
+      92             : 
+      93             : /**
+      94             :  @class IRB_Kneiske04
+      95             :  @brief Extragalactic background light model from Kneiske et al. 2004
+      96             : 
+      97             :  Source info:
+      98             :  DOI:10.1051/0004-6361:20031542,
+      99             :  https://www.aanda.org/articles/aa/pdf/2004/03/aa3848.pdf, figure 1 ("Best-fit" model)
+     100             :  */
+     101             : class IRB_Kneiske04: public TabularPhotonField {
+     102             : public:
+     103          26 :         IRB_Kneiske04() : TabularPhotonField("IRB_Kneiske04", true) {}
+     104             : };
+     105             : 
+     106             : /**
+     107             :  @class IRB_Stecker05
+     108             :  @brief Extragalactic background light model by Stecker at al. 2005
+     109             : 
+     110             :  Source info:
+     111             :  DOI:10.1086/506188, astro-ph/0510449
+     112             :  https://iopscience.iop.org/article/10.1086/506188/pdf
+     113             :  */
+     114             : class IRB_Stecker05: public TabularPhotonField {
+     115             : public:
+     116          14 :         IRB_Stecker05() : TabularPhotonField("IRB_Stecker05", true) {}
+     117             : };
+     118             : 
+     119             : /**
+     120             :  @class IRB_Franceschini08
+     121             :  @brief Extragalactic background light model from Franceschini et al. 2008
+     122             : 
+     123             :  Source info:
+     124             :  DOI:10.1051/0004-6361:200809691
+     125             :  https://arxiv.org/pdf/0805.1841.pdf, tables 1 and 2
+     126             :  */
+     127             : class IRB_Franceschini08: public TabularPhotonField {
+     128             : public:
+     129          14 :         IRB_Franceschini08() : TabularPhotonField("IRB_Franceschini08", true) {}
+     130             : };
+     131             : 
+     132             : /**
+     133             :  @class IRB_Finke10
+     134             :  @brief Extragalactic background light model from Finke et al. 2010
+     135             : 
+     136             :  Source info:
+     137             :  DOI:10.1088/0004-637X/712/1/238
+     138             :  https://iopscience.iop.org/article/10.1088/0004-637X/712/1/238/pdf
+     139             :  */
+     140             : class IRB_Finke10: public TabularPhotonField {
+     141             : public:
+     142          14 :         IRB_Finke10() : TabularPhotonField("IRB_Finke10", true) {}
+     143             : };
+     144             : 
+     145             : /**
+     146             :  @class IRB_Dominguez11
+     147             :  @brief Extragalactic background light model from Dominguez et al. 2011
+     148             : 
+     149             :  Source info:
+     150             :  DOI:10.1111/j.1365-2966.2010.17631.x
+     151             :  https://academic.oup.com/mnras/article/410/4/2556/1008012
+     152             :  */
+     153             : class IRB_Dominguez11: public TabularPhotonField {
+     154             : public:
+     155          14 :         IRB_Dominguez11() : TabularPhotonField("IRB_Dominguez11", true) {}
+     156             : };
+     157             : 
+     158             : /**
+     159             :  @class IRB_Gilmore12
+     160             :  @brief Extragalactic background light model from Gilmore et al. 2012
+     161             : 
+     162             :  Source info:
+     163             :  DOI:10.1111/j.1365-2966.2012.20841.x
+     164             :  https://academic.oup.com/mnras/article/422/4/3189/1050758
+     165             :  */
+     166             : class IRB_Gilmore12: public TabularPhotonField {
+     167             : public:
+     168          14 :         IRB_Gilmore12() : TabularPhotonField("IRB_Gilmore12", true) {}
+     169             : };
+     170             : 
+     171             : /**
+     172             :  @class IRB_Stecker16_upper
+     173             :  @brief Extragalactic background light model from Stecker et al. 2016 (upper-bound model)
+     174             : 
+     175             :  Source info:
+     176             :  DOI:10.3847/0004-637X/827/1/6
+     177             :  https://iopscience.iop.org/article/10.3847/0004-637X/827/1/6
+     178             :  */
+     179             : class IRB_Stecker16_upper: public TabularPhotonField {
+     180             : public:
+     181          14 :         IRB_Stecker16_upper() : TabularPhotonField("IRB_Stecker16_upper", true) {}
+     182             : };
+     183             : 
+     184             : /**
+     185             :  @class IRB_Stecker16_lower
+     186             :  @brief Extragalactic background light model from Stecker et al. 2016 (lower-bound model)
+     187             : 
+     188             :  Source info:
+     189             :  DOI:10.3847/0004-637X/827/1/6
+     190             :  https://iopscience.iop.org/article/10.3847/0004-637X/827/1/6
+     191             :  */
+     192             : class IRB_Stecker16_lower: public TabularPhotonField {
+     193             : public:
+     194          14 :         IRB_Stecker16_lower() : TabularPhotonField("IRB_Stecker16_lower", true) {}
+     195             : };
+     196             : 
+     197             : /**
+     198             :  @class IRB_Saldana21
+     199             :  @brief Extragalactic background light model from Saldana-Lopez et al. 2021
+     200             : 
+     201             :  Source info:
+     202             :  DOI:10.1093/mnras/stab2393
+     203             :  https://ui.adsabs.harvard.edu/abs/2021MNRAS.507.5144S/abstract
+     204             :  */
+     205             : class IRB_Saldana21: public TabularPhotonField {
+     206             : public:
+     207           8 :         IRB_Saldana21() : TabularPhotonField("IRB_Saldana21", true) {}
+     208             : };
+     209             : 
+     210             : /**
+     211             :  @class IRB_Saldana21_upper
+     212             :  @brief Extragalactic background light model from Saldana-Lopez et al. 2021 (upper-bound model)
+     213             : 
+     214             :  Source info:
+     215             :  DOI:10.1093/mnras/stab2393
+     216             :  https://ui.adsabs.harvard.edu/abs/2021MNRAS.507.5144S/abstract
+     217             :  */
+     218             : class IRB_Saldana21_upper: public TabularPhotonField {
+     219             : public:
+     220           0 :         IRB_Saldana21_upper() : TabularPhotonField("IRB_Saldana21_upper", true) {}
+     221             : };
+     222             : 
+     223             : /**
+     224             :  @class IRB_Saldana21_lower
+     225             :  @brief Extragalactic background light model from Saldana-Lopez et al. 2021 (lower-bound model)
+     226             : 
+     227             :  Source info:
+     228             :  DOI:10.1093/mnras/stab2393
+     229             :  https://ui.adsabs.harvard.edu/abs/2021MNRAS.507.5144S/abstract
+     230             :  */
+     231             : class IRB_Saldana21_lower: public TabularPhotonField {
+     232             : public:
+     233           0 :         IRB_Saldana21_lower() : TabularPhotonField("IRB_Saldana21_lower", true) {}
+     234             : };
+     235             : 
+     236             : /**
+     237             :  @class IRB_Finke22
+     238             :  @brief Extragalactic background light model from Finke et al. 2022
+     239             : 
+     240             :  Source info:
+     241             :  DOI:10.3847/1538-4357/ac9843
+     242             :  https://iopscience.iop.org/article/10.3847/1538-4357/ac9843/pdf
+     243             :  */
+     244             : class IRB_Finke22: public TabularPhotonField {
+     245             : public:
+     246          14 :         IRB_Finke22() : TabularPhotonField("IRB_Finke22", true) {}
+     247             : };
+     248             : 
+     249             : /**
+     250             :  @class URB
+     251             :  @brief Extragalactic background light model from Protheroe & Biermann 1996
+     252             : 
+     253             :  Source info:
+     254             :  DOI:10.1016/S0927-6505(96)00041-2
+     255             :  https://www.sciencedirect.com/science/article/abs/pii/S0927650596000412
+     256             :  */
+     257             : class URB_Protheroe96: public TabularPhotonField {
+     258             : public:
+     259          12 :         URB_Protheroe96() : TabularPhotonField("URB_Protheroe96", false) {}
+     260             : };
+     261             : 
+     262             : /**
+     263             :  @class URB
+     264             :  @brief Extragalactic background light model based on ARCADE2 observations, by Fixsen et al.
+     265             :  Note that this model does not cover the same energy range as other URB models. Here, only ~10 MHz - 10 GHz is considered.
+     266             :  Therefore, it only makes sense to use this model in very specific studies.
+     267             : 
+     268             :  Source info:
+     269             :  DOI:10.1088/0004-637X/734/1/5
+     270             :  https://iopscience.iop.org/article/10.1088/0004-637X/734/1/5
+     271             :  */
+     272             : class URB_Fixsen11: public TabularPhotonField {
+     273             : public:
+     274           8 :         URB_Fixsen11() : TabularPhotonField("URB_Fixsen11", false) {}
+     275             : };
+     276             : 
+     277             : /**
+     278             :  @class URB
+     279             :  @brief Extragalactic background light model by Nitu et al.
+     280             : 
+     281             :  Source info:
+     282             :  DOI:10.1016/j.astropartphys.2020.102532
+     283             :  https://www.sciencedirect.com/science/article/pii/S0927650520301043?
+     284             :  */
+     285             : class URB_Nitu21: public TabularPhotonField {
+     286             : public:
+     287          22 :         URB_Nitu21() : TabularPhotonField("URB_Nitu21", false) {}
+     288             : };
+     289             : 
+     290             : /**
+     291             :  @class BlackbodyPhotonField
+     292             :  @brief Photon field decorator for black body photon fields.
+     293             :  */
+     294             : class BlackbodyPhotonField: public PhotonField {
+     295             : public:
+     296             :         BlackbodyPhotonField(const std::string fieldName, const double blackbodyTemperature);
+     297             :         double getPhotonDensity(double ePhoton, double z = 0.) const;
+     298             :         double getMinimumPhotonEnergy(double z) const;
+     299             :         double getMaximumPhotonEnergy(double z) const;
+     300             :         void setQuantile(double q);
+     301             : 
+     302             : protected:
+     303             :         double blackbodyTemperature;
+     304             :         double quantile;
+     305             : };
+     306             : 
+     307             : /**
+     308             :  @class CMB
+     309             :  @brief Cosmic mircowave background photon field
+     310             : 
+     311             :  Source info:
+     312             :  This field is an isotropic blackbody photon field with temperature T = 2.73 K
+     313             :  */
+     314             : class CMB: public BlackbodyPhotonField {
+     315             : public:
+     316          80 :         CMB() : BlackbodyPhotonField("CMB", 2.73) {}
+     317             : };
+     318             : 
+     319             : 
+     320             : } // namespace crpropa
+     321             : 
+     322             : #endif // CRPROPA_PHOTONBACKGROUND_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Random.h.func-sort-c.html b/doc/coverageReport/include/crpropa/Random.h.func-sort-c.html new file mode 100644 index 000000000..e8f69e8b4 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Random.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Random.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Random.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:7887.5 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Random.h.func.html b/doc/coverageReport/include/crpropa/Random.h.func.html new file mode 100644 index 000000000..16cf98e23 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Random.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Random.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Random.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:7887.5 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Random.h.gcov.html b/doc/coverageReport/include/crpropa/Random.h.gcov.html new file mode 100644 index 000000000..5799cec29 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Random.h.gcov.html @@ -0,0 +1,317 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Random.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Random.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:7887.5 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : // Random.h
+       2             : // Mersenne Twister random number generator -- a C++ class Random
+       3             : // Based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus
+       4             : // Richard J. Wagner  v1.0  15 May 2003  rjwagner@writeme.com
+       5             : 
+       6             : // The Mersenne Twister is an algorithm for generating random numbers.  It
+       7             : // was designed with consideration of the flaws in various other generators.
+       8             : // The period, 2^19937-1, and the order of equidistribution, 623 dimensions,
+       9             : // are far greater.  The generator is also fast; it avoids multiplication and
+      10             : // division, and it benefits from caches and pipelines.  For more information
+      11             : // see the inventors' web page at http://www.math.keio.ac.jp/~matumoto/emt.html
+      12             : 
+      13             : // Reference
+      14             : // M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-Dimensionally
+      15             : // Equidistributed Uniform Pseudo-Random Number Generator", ACM Transactions on
+      16             : // Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3-30.
+      17             : 
+      18             : // Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
+      19             : // Copyright (C) 2000 - 2003, Richard J. Wagner
+      20             : // All rights reserved.
+      21             : //
+      22             : // Redistribution and use in source and binary forms, with or without
+      23             : // modification, are permitted provided that the following conditions
+      24             : // are met:
+      25             : //
+      26             : //   1. Redistributions of source code must retain the above copyright
+      27             : //      notice, this list of conditions and the following disclaimer.
+      28             : //
+      29             : //   2. Redistributions in binary form must reproduce the above copyright
+      30             : //      notice, this list of conditions and the following disclaimer in the
+      31             : //      documentation and/or other materials provided with the distribution.
+      32             : //
+      33             : //   3. The names of its contributors may not be used to endorse or promote
+      34             : //      products derived from this software without specific prior written
+      35             : //      permission.
+      36             : //
+      37             : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+      38             : // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+      39             : // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+      40             : // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+      41             : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+      42             : // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+      43             : // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+      44             : // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+      45             : // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+      46             : // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+      47             : // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+      48             : 
+      49             : // The original code included the following notice:
+      50             : //
+      51             : //     When you use this, send an email to: matumoto@math.keio.ac.jp
+      52             : //     with an appropriate reference to your work.
+      53             : //
+      54             : // It would be nice to CC: rjwagner@writeme.com and Cokus@math.washington.edu
+      55             : // when you write.
+      56             : 
+      57             : // Parts of this file are modified beginning in 29.10.09 for adaption in PXL.
+      58             : // Parts of this file are modified beginning in 10.02.12 for adaption in CRPropa.
+      59             : 
+      60             : #ifndef RANDOM_H
+      61             : #define RANDOM_H
+      62             : 
+      63             : // Not thread safe (unless auto-initialization is avoided and each thread has
+      64             : // its own Random object)
+      65             : #include "crpropa/Vector3.h"
+      66             : 
+      67             : #include <iostream>
+      68             : #include <limits>
+      69             : #include <ctime>
+      70             : #include <cmath>
+      71             : #include <vector>
+      72             : #include <stdexcept>
+      73             : #include <algorithm>
+      74             : 
+      75             : #include <stdint.h>
+      76             : #include <string>
+      77             : 
+      78             : //necessary for win32
+      79             : #ifndef M_PI
+      80             : #define M_PI 3.14159265358979323846
+      81             : #endif
+      82             : 
+      83             : namespace crpropa {
+      84             : 
+      85             : /**
+      86             :  * \addtogroup Core
+      87             :  * @{
+      88             :  */
+      89             : /**
+      90             :  @class Random
+      91             :  @brief Random number generator.
+      92             : 
+      93             :  Mersenne Twister random number generator -- a C++ class Random
+      94             :  Based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus
+      95             :  Richard J. Wagner  v1.0  15 May 2003  rjwagner@writeme.com
+      96             :  */
+      97           3 : class Random {
+      98             : public:
+      99             :         enum {N = 624}; // length of state vector
+     100             :         enum {SAVE = N + 1}; // length of array for save()
+     101             : 
+     102             : protected:
+     103             :         enum {M = 397}; // period parameter
+     104             :         uint32_t state[N];// internal state
+     105             :         std::vector<uint32_t> initial_seed;//
+     106             :         uint32_t *pNext;// next value to get from state
+     107             :         int left;// number of values left before reload needed
+     108             : 
+     109             : //Methods
+     110             : public:
+     111             :         /// initialize with a simple uint32_t
+     112             :         Random( const uint32_t& oneSeed );
+     113             :         // initialize with an array
+     114             :         Random( uint32_t *const bigSeed, uint32_t const seedLength = N );
+     115             :         /// auto-initialize with /dev/urandom or time() and clock()
+     116             :         /// Do NOT use for CRYPTOGRAPHY without securely hashing several returned
+     117             :         /// values together, otherwise the generator state can be learned after
+     118             :         /// reading 624 consecutive values.
+     119             :         Random();
+     120             :         // Access to 32-bit random numbers
+     121             :         double rand();///< real number in [0,1]
+     122             :         double rand( const double& n );///< real number in [0,n]
+     123             :         double randExc();///< real number in [0,1)
+     124             :         double randExc( const double& n );///< real number in [0,n)
+     125             :         double randDblExc();///< real number in (0,1)
+     126             :         double randDblExc( const double& n );///< real number in (0,n)
+     127             :         // Pull a 32-bit integer from the generator state
+     128             :         // Every other access function simply transforms the numbers extracted here
+     129             :         uint32_t randInt();///< integer in [0,2**32-1]
+     130             :         uint32_t randInt( const uint32_t& n );///< integer in [0,n] for n < 2**32
+     131             : 
+     132             :         uint64_t randInt64(); ///< integer in [0, 2**64 -1]. PROBABLY NOT SECURE TO USE
+     133             :         uint64_t randInt64(const uint64_t &n); ///< integer in [0, n] for n < 2**64 -1. PROBABLY NOT SECURE TO USE
+     134             : 
+     135           0 :         double operator()() {return rand();} ///< same as rand()
+     136             : 
+     137             :         // Access to 53-bit random numbers (capacity of IEEE double precision)
+     138             :         double rand53();///< real number in [0,1)  (capacity of IEEE double precision)
+     139             :         ///Exponential distribution in (0,inf)
+     140             :         double randExponential();
+     141             :         /// Normal distributed random number
+     142     1715954 :         double randNorm( const double& mean = 0.0, const double& variance = 1.0 );
+     143             :         /// Uniform distribution in [min, max]
+     144             :         double randUniform(double min, double max);
+     145             :         /// Rayleigh distributed random number
+     146             :         double randRayleigh(double sigma);
+     147             :         /// Fisher distributed random number
+     148             :         double randFisher(double k);
+     149             : 
+     150             :         /// Draw a random bin from a (unnormalized) cumulative distribution function, without leading zero.
+     151             :         size_t randBin(const std::vector<float> &cdf);
+     152             :         size_t randBin(const std::vector<double> &cdf);
+     153             : 
+     154             :         /// Random point on a unit-sphere
+     155             :         Vector3d randVector();
+     156             :         /// Random vector with given angular separation around mean direction
+     157             :         Vector3d randVectorAroundMean(const Vector3d &meanDirection, double angle);
+     158             :         /// Fisher distributed random vector
+     159             :         Vector3d randFisherVector(const Vector3d &meanDirection, double kappa);
+     160             :         /// Uniform distributed random vector inside a cone
+     161             :         Vector3d randConeVector(const Vector3d &meanDirection, double angularRadius);
+     162             :         /// Random lamberts distributed vector with theta distribution: sin(t) * cos(t),
+     163             :         /// aka cosine law (https://en.wikipedia.org/wiki/Lambert%27s_cosine_law),
+     164             :         /// for a surface element with normal vector pointing in positive z-axis (0, 0, 1)
+     165             :         Vector3d randVectorLamberts();
+     166             :         /// Same as above but rotated to the respective normalVector of surface element
+     167             :         Vector3d randVectorLamberts(const Vector3d &normalVector);
+     168             :         ///_Position vector uniformly distributed within propagation step size bin
+     169             :         Vector3d randomInterpolatedPosition(const Vector3d &a, const Vector3d &b);
+     170             : 
+     171             :         /// Power-law distribution of a given differential spectral index
+     172             :         double randPowerLaw(double index, double min, double max);
+     173             :         /// Broken power-law distribution
+     174             :         double randBrokenPowerLaw(double index1, double index2, double breakpoint, double min, double max );
+     175             : 
+     176             :         /// Seed the generator with a simple uint32_t
+     177             :         void seed( const uint32_t oneSeed );
+     178             :         /// Seed the generator with an array of uint32_t's
+     179             :         /// There are 2^19937-1 possible initial states.  This function allows
+     180             :         /// all of those to be accessed by providing at least 19937 bits (with a
+     181             :         /// default seed length of N = 624 uint32_t's).  Any bits above the lower 32
+     182             :         /// in each element are discarded.
+     183             :         /// Just call seed() if you want to get array from /dev/urandom
+     184             :         void seed( uint32_t *const bigSeed, const uint32_t seedLength = N );
+     185             :         // seed via an b64 encoded string
+     186             :         void seed( const std::string &b64Seed);
+     187             :         /// Seed the generator with an array from /dev/urandom if available
+     188             :         /// Otherwise use a hash of time() and clock() values
+     189             :         void seed();
+     190             : 
+     191             :         // Saving and loading generator state
+     192             :         void save( uint32_t* saveArray ) const;// to array of size SAVE
+     193             :         void load( uint32_t *const loadArray );// from such array
+     194             :         const std::vector<uint32_t> &getSeed() const; // copy the seed to the array
+     195             :         const std::string getSeed_base64() const; // get the base 64 encoded seed
+     196             : 
+     197             :         friend std::ostream& operator<<( std::ostream& os, const Random& mtrand );
+     198             :         friend std::istream& operator>>( std::istream& is, Random& mtrand );
+     199             : 
+     200             :         static Random &instance();
+     201             :         static void seedThreads(const uint32_t oneSeed);
+     202             :         static std::vector< std::vector<uint32_t> > getSeedThreads();
+     203             : 
+     204             : protected:
+     205             :         /// Initialize generator state with seed
+     206             :         /// See Knuth TAOCP Vol 2, 3rd Ed, p.106 for multiplier.
+     207             :         /// In previous versions, most significant bits (MSBs) of the seed affect
+     208             :         /// only MSBs of the state array.  Modified 9 Jan 2002 by Makoto Matsumoto.
+     209             :         void initialize( const uint32_t oneSeed );
+     210             : 
+     211             :         /// Generate N new values in state
+     212             :         /// Made clearer and faster by Matthew Bellew (matthew.bellew@home.com)
+     213             :         void reload();
+     214    28904304 :         uint32_t hiBit( const uint32_t& u ) const {return u & 0x80000000UL;}
+     215    28904304 :         uint32_t loBit( const uint32_t& u ) const {return u & 0x00000001UL;}
+     216    28904304 :         uint32_t loBits( const uint32_t& u ) const {return u & 0x7fffffffUL;}
+     217             :         uint32_t mixBits( const uint32_t& u, const uint32_t& v ) const
+     218    28904304 :         {       return hiBit(u) | loBits(v);}
+     219             : 
+     220             : #ifdef _MSC_VER
+     221             : #pragma warning( push )
+     222             : #pragma warning( disable : 4146 )
+     223             : #endif
+     224             :         uint32_t twist( const uint32_t& m, const uint32_t& s0, const uint32_t& s1 ) const
+     225    28857983 :         {       return m ^ (mixBits(s0,s1)>>1) ^ (-loBit(s1) & 0x9908b0dfUL);}
+     226             : 
+     227             : #ifdef _MSC_VER
+     228             : #pragma warning( pop )
+     229             : #endif
+     230             : 
+     231             :         /// Get a uint32_t from t and c
+     232             :         /// Better than uint32_t(x) in case x is floating point in [0,1]
+     233             :         /// Based on code by Lawrence Kirby (fred@genesis.demon.co.uk)
+     234             :         static uint32_t hash( time_t t, clock_t c );
+     235             : 
+     236             : };
+     237             : /** @}*/
+     238             : 
+     239             : } //namespace crpropa
+     240             : 
+     241             : #endif  // RANDOM_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Referenced.h.func-sort-c.html b/doc/coverageReport/include/crpropa/Referenced.h.func-sort-c.html new file mode 100644 index 000000000..ce69cfb72 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Referenced.h.func-sort-c.html @@ -0,0 +1,148 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Referenced.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Referenced.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:415673.2 %
Date:2024-04-08 14:58:22Functions:101952.6 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa10ReferencedD0Ev0
_ZN7crpropa10ReferencedD2Ev0
_ZN7crpropa7ref_ptrINS_10ModuleListEE6assignIS1_EEvRKNS0_IT_EE0
_ZN7crpropa7ref_ptrINS_11EmissionMapEEaSEPS1_0
_ZN7crpropa7ref_ptrINS_4GridINS_7Vector3IfEEEEE6assignIS4_EEvRKNS0_IT_EE0
_ZN7crpropa7ref_ptrINS_4GridIfEEE6assignIS2_EEvRKNS0_IT_EE0
_ZN7crpropa7ref_ptrINS_4GridIfEEEaSEPS2_0
_ZN7crpropa7ref_ptrINS_6ModuleEE6assignIS1_EEvRKNS0_IT_EE0
_ZN7crpropa7ref_ptrINS_7DensityEE6assignIS1_EEvRKNS0_IT_EE0
_ZN7crpropa7ref_ptrINS_13MagneticFieldEEaSEPS1_2
_ZN7crpropa7ref_ptrINS_6ModuleEEaSEPS1_4
_ZN7crpropa7ref_ptrINS_24CylindricalProjectionMapEE6assignIS1_EEvRKNS0_IT_EE5
_ZN7crpropa7ref_ptrINS_14AdvectionFieldEE6assignIS1_EEvRKNS0_IT_EE6
_ZN7crpropa7ref_ptrINS_4GridINS_7Vector3IfEEEEEaSEPS4_6
_ZN7crpropa7ref_ptrINS_13MagneticFieldEE6assignIS1_EEvRKNS0_IT_EE46
_ZN7crpropa7ref_ptrINS_11PhotonFieldEEaSEPS1_66
_ZN7crpropa7ref_ptrINS_11PhotonFieldEE6assignIS1_EEvRKNS0_IT_EE159
_ZN7crpropa7ref_ptrINS_9CandidateEE6assignIS1_EEvRKNS0_IT_EE1103
_ZNK7crpropa10Referenced15removeReferenceEv10914622
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Referenced.h.func.html b/doc/coverageReport/include/crpropa/Referenced.h.func.html new file mode 100644 index 000000000..1897f7f51 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Referenced.h.func.html @@ -0,0 +1,148 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Referenced.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Referenced.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:415673.2 %
Date:2024-04-08 14:58:22Functions:101952.6 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa10ReferencedD0Ev0
_ZN7crpropa10ReferencedD2Ev0
_ZN7crpropa7ref_ptrINS_10ModuleListEE6assignIS1_EEvRKNS0_IT_EE0
_ZN7crpropa7ref_ptrINS_11EmissionMapEEaSEPS1_0
_ZN7crpropa7ref_ptrINS_11PhotonFieldEE6assignIS1_EEvRKNS0_IT_EE159
_ZN7crpropa7ref_ptrINS_11PhotonFieldEEaSEPS1_66
_ZN7crpropa7ref_ptrINS_13MagneticFieldEE6assignIS1_EEvRKNS0_IT_EE46
_ZN7crpropa7ref_ptrINS_13MagneticFieldEEaSEPS1_2
_ZN7crpropa7ref_ptrINS_14AdvectionFieldEE6assignIS1_EEvRKNS0_IT_EE6
_ZN7crpropa7ref_ptrINS_24CylindricalProjectionMapEE6assignIS1_EEvRKNS0_IT_EE5
_ZN7crpropa7ref_ptrINS_4GridINS_7Vector3IfEEEEE6assignIS4_EEvRKNS0_IT_EE0
_ZN7crpropa7ref_ptrINS_4GridINS_7Vector3IfEEEEEaSEPS4_6
_ZN7crpropa7ref_ptrINS_4GridIfEEE6assignIS2_EEvRKNS0_IT_EE0
_ZN7crpropa7ref_ptrINS_4GridIfEEEaSEPS2_0
_ZN7crpropa7ref_ptrINS_6ModuleEE6assignIS1_EEvRKNS0_IT_EE0
_ZN7crpropa7ref_ptrINS_6ModuleEEaSEPS1_4
_ZN7crpropa7ref_ptrINS_7DensityEE6assignIS1_EEvRKNS0_IT_EE0
_ZN7crpropa7ref_ptrINS_9CandidateEE6assignIS1_EEvRKNS0_IT_EE1103
_ZNK7crpropa10Referenced15removeReferenceEv10914622
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Referenced.h.gcov.html b/doc/coverageReport/include/crpropa/Referenced.h.gcov.html new file mode 100644 index 000000000..5a9b12d1c --- /dev/null +++ b/doc/coverageReport/include/crpropa/Referenced.h.gcov.html @@ -0,0 +1,320 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Referenced.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Referenced.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:415673.2 %
Date:2024-04-08 14:58:22Functions:101952.6 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_REFERENCED_H
+       2             : #define CRPROPA_REFERENCED_H
+       3             : 
+       4             : #include <cstddef>
+       5             : 
+       6             : #ifdef DEBUG
+       7             : #include <iostream>
+       8             : #include <typeinfo>
+       9             : #endif
+      10             : 
+      11             : namespace crpropa {
+      12             : /**
+      13             :  * \addtogroup Core
+      14             :  * @{
+      15             :  */
+      16             : 
+      17             : /**
+      18             :  @class Referenced
+      19             :  @brief Base class for reference counting
+      20             : 
+      21             :  A form of memory management is needed to prevent memory leaks when using MPC in Python via SWIG.
+      22             :  This base class enables reference counting.
+      23             :  Every reference increases the reference counter, every dereference decreases it.
+      24             :  When the counter is decreased to 0, the object is deleted.
+      25             :  Candidate, Module, MagneticField and Source inherit from this class
+      26             :  */
+      27             : class Referenced {
+      28             : public:
+      29             : 
+      30     3369415 :         inline Referenced() :
+      31     3369394 :                         _referenceCount(0) {
+      32             :         }
+      33             : 
+      34           0 :         inline Referenced(const Referenced&) :
+      35           0 :                         _referenceCount(0) {
+      36             :         }
+      37             : 
+      38             :         inline Referenced& operator =(const Referenced&) {
+      39             :                 return *this;
+      40             :         }
+      41             : 
+      42             :         inline size_t addReference() const {
+      43             :                 int newRef;
+      44             : #if defined(OPENMP_3_1)
+      45             :                 #pragma omp atomic capture
+      46             :                 {newRef = _referenceCount++;}
+      47             : #elif defined(__GNUC__)
+      48    10913236 :                 newRef = __sync_add_and_fetch(&_referenceCount, 1);
+      49             : #else
+      50             :                 #pragma omp critical
+      51             :                 {newRef = _referenceCount++;}
+      52             : #endif
+      53     7546128 :                 return newRef;
+      54             :         }
+      55             : 
+      56    10914622 :         inline size_t removeReference() const {
+      57             : #ifdef DEBUG
+      58             :                 if (_referenceCount == 0)
+      59             :                         std::cerr
+      60             :                                         << "WARNING: Remove reference from Object with NO references: "
+      61             :                                         << typeid(*this).name() << std::endl;
+      62             : #endif
+      63             :                 int newRef;
+      64             : #if defined(OPENMP_3_1)
+      65             :                 #pragma omp atomic capture
+      66             :                 {newRef = _referenceCount--;}
+      67             : #elif defined(__GNUC__)
+      68    10914622 :                 newRef = __sync_sub_and_fetch(&_referenceCount, 1);
+      69             : #else
+      70             :                 #pragma omp critical
+      71             :                 {newRef = _referenceCount--;}
+      72             : #endif
+      73             : 
+      74    10914622 :                 if (newRef == 0) {
+      75     3367410 :                         delete this;
+      76             :                 }
+      77    10914622 :                 return newRef;
+      78             :         }
+      79             : 
+      80             :         int removeReferenceNoDelete() const {
+      81           0 :                 return --_referenceCount;
+      82             :         }
+      83             : 
+      84             :         inline size_t getReferenceCount() const {
+      85           0 :                 return _referenceCount;
+      86             :         }
+      87             : 
+      88             : protected:
+      89             : 
+      90           0 :         virtual inline ~Referenced() {
+      91             : #ifdef DEBUG
+      92             :                 if (_referenceCount)
+      93             :                         std::cerr << "WARNING: Deleting Object with references: "
+      94             :                                         << typeid(*this).name() << std::endl;
+      95             : #endif
+      96           0 :         }
+      97             : 
+      98             :         mutable size_t _referenceCount;
+      99             : };
+     100             : 
+     101             : inline void intrusive_ptr_add_ref(Referenced* p) {
+     102             :         p->addReference();
+     103             : }
+     104             : inline void intrusive_ptr_release(Referenced* p) {
+     105           0 :         p->removeReference();
+     106             : }
+     107             : 
+     108             : /**
+     109             :  @class ref_ptr
+     110             :  @brief Referenced pointer
+     111             :  */
+     112             : template<class T>
+     113             : class ref_ptr {
+     114             : public:
+     115             :         typedef T element_type;
+     116             : 
+     117         167 :         ref_ptr() :
+     118         167 :                         _ptr(0) {
+     119             :         }
+     120     3328293 :         ref_ptr(T* ptr) :
+     121     3330334 :                         _ptr(ptr) {
+     122        3307 :                 if (_ptr)
+     123             :                         _ptr->addReference();
+     124             :         }
+     125     7541490 :         ref_ptr(const ref_ptr& rp) :
+     126     7541372 :                         _ptr(rp._ptr) {
+     127     7541428 :                 if (_ptr)
+     128             :                         _ptr->addReference();
+     129           2 :         }
+     130           4 :         template<class Other> ref_ptr(const ref_ptr<Other>& rp) :
+     131           4 :                         _ptr(rp._ptr) {
+     132             :                 if (_ptr)
+     133             :                         _ptr->addReference();
+     134             :         }
+     135             : 
+     136             :         ~ref_ptr() {
+     137    10870856 :                 if (_ptr)
+     138    10870929 :                         _ptr->removeReference();
+     139             :                 _ptr = 0;
+     140    10870851 :         }
+     141             : 
+     142             :         ref_ptr& operator =(const ref_ptr& rp) {
+     143         218 :                 assign(rp);
+     144           0 :                 return *this;
+     145             :         }
+     146             : 
+     147             :         template<class Other> ref_ptr& operator =(const ref_ptr<Other>& rp) {
+     148             :                 assign(rp);
+     149             :                 return *this;
+     150             :         }
+     151             : 
+     152          78 :         inline ref_ptr& operator =(T* ptr) {
+     153          78 :                 if (_ptr == ptr)
+     154             :                         return *this;
+     155             :                 T* tmp_ptr = _ptr;
+     156          78 :                 _ptr = ptr;
+     157          78 :                 if (_ptr)
+     158             :                         _ptr->addReference();
+     159          78 :                 if (tmp_ptr)
+     160          68 :                         tmp_ptr->removeReference();
+     161             :                 return *this;
+     162             :         }
+     163             : 
+     164             :         operator T*() const {
+     165      481185 :                 return _ptr;
+     166             :         }
+     167             : 
+     168             :         T& operator*() const {
+     169        6611 :                 return *_ptr;
+     170             :         }
+     171             :         T* operator->() const {
+     172     6292284 :                 return _ptr;
+     173             :         }
+     174             :         T* get() const {
+     175          37 :                 return _ptr;
+     176             :         }
+     177             : 
+     178             :         bool operator!() const {
+     179           0 :                 return _ptr == 0;
+     180             :         } // not required
+     181             :         bool valid() const {
+     182     5881570 :                 return _ptr != 0;
+     183             :         }
+     184             : 
+     185             :         T* release() {
+     186           0 :                 T* tmp = _ptr;
+     187           0 :                 if (_ptr)
+     188             :                         _ptr->removeReferenceNoDelete();
+     189           0 :                 _ptr = 0;
+     190             :                 return tmp;
+     191             :         }
+     192             : 
+     193             :         void swap(ref_ptr& rp) {
+     194           0 :                 T* tmp = _ptr;
+     195           0 :                 _ptr = rp._ptr;
+     196           0 :                 rp._ptr = tmp;
+     197             :         }
+     198             : 
+     199             : private:
+     200             : 
+     201        1319 :         template<class Other> void assign(const ref_ptr<Other>& rp) {
+     202        1319 :                 if (_ptr == rp._ptr)
+     203             :                         return;
+     204             :                 T* tmp_ptr = _ptr;
+     205        1315 :                 _ptr = rp._ptr;
+     206        1315 :                 if (_ptr)
+     207             :                         _ptr->addReference();
+     208        1315 :                 if (tmp_ptr)
+     209          91 :                         tmp_ptr->removeReference();
+     210             :         }
+     211             : 
+     212             :         template<class Other> friend class ref_ptr;
+     213             : 
+     214             :         T* _ptr;
+     215             : };
+     216             : 
+     217             : template<class T> inline
+     218             : void swap(ref_ptr<T>& rp1, ref_ptr<T>& rp2) {
+     219             :         rp1.swap(rp2);
+     220             : }
+     221             : 
+     222             : template<class T> inline T* get_pointer(const ref_ptr<T>& rp) {
+     223             :         return rp.get();
+     224             : }
+     225             : 
+     226             : template<class T, class Y> inline ref_ptr<T> static_pointer_cast(
+     227             :                 const ref_ptr<Y>& rp) {
+     228             :         return static_cast<T*>(rp.get());
+     229             : }
+     230             : 
+     231             : template<class T, class Y> inline ref_ptr<T> dynamic_pointer_cast(
+     232             :                 const ref_ptr<Y>& rp) {
+     233             :         return dynamic_cast<T*>(rp.get());
+     234             : }
+     235             : 
+     236             : template<class T, class Y> inline ref_ptr<T> const_pointer_cast(
+     237             :                 const ref_ptr<Y>& rp) {
+     238             :         return const_cast<T*>(rp.get());
+     239             : }
+     240             : 
+     241             : /** @}*/
+     242             : } // namespace crpropa
+     243             : 
+     244             : #endif // CRPROPA_REFERENCED_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Source.h.func-sort-c.html b/doc/coverageReport/include/crpropa/Source.h.func-sort-c.html new file mode 100644 index 000000000..e0c693ff0 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Source.h.func-sort-c.html @@ -0,0 +1,76 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Source.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Source.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:141877.8 %
Date:2024-04-08 14:58:22Functions:010.0 %
+
+ +
+ + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa13SourceFeature15prepareParticleERNS_13ParticleStateE0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Source.h.func.html b/doc/coverageReport/include/crpropa/Source.h.func.html new file mode 100644 index 000000000..646b8d073 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Source.h.func.html @@ -0,0 +1,76 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Source.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Source.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:141877.8 %
Date:2024-04-08 14:58:22Functions:010.0 %
+
+ +
+ + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa13SourceFeature15prepareParticleERNS_13ParticleStateE0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Source.h.gcov.html b/doc/coverageReport/include/crpropa/Source.h.gcov.html new file mode 100644 index 000000000..82cca4d84 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Source.h.gcov.html @@ -0,0 +1,1002 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Source.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Source.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:141877.8 %
Date:2024-04-08 14:58:22Functions:010.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_SOURCE_H
+       2             : #define CRPROPA_SOURCE_H
+       3             : 
+       4             : #include "crpropa/Candidate.h"
+       5             : #include "crpropa/Grid.h"
+       6             : #include "crpropa/EmissionMap.h"
+       7             : #include "crpropa/massDistribution/Density.h"
+       8             : 
+       9             : 
+      10             : #include <vector>
+      11             : 
+      12             : namespace crpropa {
+      13             : /** @addtogroup SourceFeatures
+      14             :  *  @{
+      15             :  */
+      16             : 
+      17             : 
+      18             : /**
+      19             :  @class SourceFeature
+      20             :  @brief Abstract base class for specific source features
+      21             :  */
+      22           7 : class SourceFeature: public Referenced {
+      23             : protected:
+      24             :         std::string description;
+      25             : public:
+      26           0 :         virtual void prepareParticle(ParticleState& particle) const {};
+      27             :         virtual void prepareCandidate(Candidate& candidate) const;
+      28             :         std::string getDescription() const;
+      29             : };
+      30             : 
+      31             : 
+      32             : /**
+      33             :  @class SourceInterface
+      34             :  @brief Abstract base class for sources
+      35             :  */
+      36             : class SourceInterface : public Referenced {
+      37             : public:
+      38             :         virtual ref_ptr<Candidate> getCandidate() const = 0;
+      39             :         virtual std::string getDescription() const = 0;
+      40             : };
+      41             : 
+      42             : 
+      43             : /**
+      44             :  @class Source
+      45             :  @brief General source of particles
+      46             : 
+      47             :  This class is a container for source features.
+      48             :  The source prepares a new candidate by passing it to all its source features
+      49             :  to be modified accordingly.
+      50             :  */
+      51          10 : class Source: public SourceInterface {
+      52             :         std::vector<ref_ptr<SourceFeature> > features;
+      53             : public:
+      54             :         void add(SourceFeature* feature);
+      55             :         ref_ptr<Candidate> getCandidate() const;
+      56             :         std::string getDescription() const;
+      57             : };
+      58             : 
+      59             : 
+      60             : /**
+      61             :  @class SourceList
+      62             :  @brief List of particle sources of individual luminosities.
+      63             : 
+      64             :  The SourceList is a source itself. It can be used if several sources are
+      65             :  needed in one simulation.
+      66             :  */
+      67           3 : class SourceList: public SourceInterface {
+      68             :         std::vector<ref_ptr<Source> > sources;
+      69             :         std::vector<double> cdf;
+      70             : public:
+      71             :         /** Add an individual source to the list.
+      72             :          @param source          source to be added
+      73             :          @param weight          weight of the source; defaults to 1.
+      74             :          */
+      75             :         void add(Source* source, double weight = 1);
+      76             :         ref_ptr<Candidate> getCandidate() const;
+      77             :         std::string getDescription() const;
+      78             : };
+      79             : 
+      80             : 
+      81             : /**
+      82             :  @class SourceParticleType
+      83             :  @brief Particle type at the source
+      84             : 
+      85             :  This feature assigns a single particle type to the source.
+      86             :  For multiple types, use e.g. SourceMultipleParticleTypes.
+      87             :  Particles are identified following the PDG numbering scheme:
+      88             :    https://pdg.lbl.gov/2019/reviews/rpp2019-rev-monte-carlo-numbering.pdf
+      89             :  */
+      90             : class SourceParticleType: public SourceFeature {
+      91             :         int id;
+      92             : public:
+      93             :         /** Constructor for a source with a sign
+      94             :          @param id              id of the particle following the PDG numbering scheme
+      95             :         */
+      96             :         SourceParticleType(int id);
+      97             :         void prepareParticle(ParticleState &particle) const;
+      98             :         void setDescription();
+      99             : };
+     100             : 
+     101             : 
+     102             : /**
+     103             :  @class SourceMultipleParticleTypes
+     104             :  @brief Multiple particle types with individual relative abundances
+     105             : 
+     106             :  This feature assigns particle types to the events emitted by the sources.
+     107             :  It is possible to control the relative abundance of each particle species.
+     108             :  Particles are identified following the PDG numbering scheme:
+     109             :    https://pdg.lbl.gov/2019/reviews/rpp2019-rev-monte-carlo-numbering.pdf
+     110             :  */
+     111             : class SourceMultipleParticleTypes: public SourceFeature {
+     112             :         std::vector<int> particleTypes;
+     113             :         std::vector<double> cdf;
+     114             : public:
+     115             :         /** Constructor
+     116             :          */
+     117             :         SourceMultipleParticleTypes();
+     118             :         /** Add an individual particle type.
+     119             :          @param id                      id of the particle following the PDG numbering scheme
+     120             :          @param weight          relative abundance of individual particle species
+     121             :          */
+     122             :         void add(int id, double weight = 1);
+     123             :         void prepareParticle(ParticleState &particle) const;
+     124             :         void setDescription();
+     125             : };
+     126             : 
+     127             : 
+     128             : /**
+     129             :  @class SourceEnergy
+     130             :  @brief Sets the initial energy of the emitted particles to a specific value
+     131             : 
+     132             :  This feature assigns a monochromatic spectrum, i.e., a single energy to all particles.
+     133             :  */
+     134             : class SourceEnergy: public SourceFeature {
+     135             :         double E;
+     136             : public:
+     137             :         /** Constructor
+     138             :          @param energy          energy of the particle (in Joules)
+     139             :          */
+     140             :         SourceEnergy(double energy);
+     141             :         void prepareParticle(ParticleState &particle) const;
+     142             :         void setDescription();
+     143             : };
+     144             : 
+     145             : 
+     146             : /**
+     147             :  @class SourcePowerLawSpectrum
+     148             :  @brief Particle energy following a power-law spectrum
+     149             : 
+     150             :  The power law is of the form: dN/dE ~ E^index, for energies in the interval [Emin, Emax].
+     151             :  */
+     152           1 : class SourcePowerLawSpectrum: public SourceFeature {
+     153             :         double Emin;
+     154             :         double Emax;
+     155             :         double index;
+     156             : public:
+     157             :         /** Constructor
+     158             :          @param Emin            minimum energy (in Joules)
+     159             :          @param Emax            maximum energy (in Joules)
+     160             :          @param index           spectral index of the power law
+     161             :          */
+     162             :         SourcePowerLawSpectrum(double Emin, double Emax, double index);
+     163             :         void prepareParticle(ParticleState &particle) const;
+     164             :         void setDescription();
+     165             : };
+     166             : 
+     167             : 
+     168             : /**
+     169             :  @class SourceComposition
+     170             :  @brief Multiple nuclear species with a rigidity-dependent power-law spectrum
+     171             : 
+     172             :  The power law is of the form: E^index, for energies in the interval [Emin, Z * Rmax].
+     173             :  */
+     174             : class SourceComposition: public SourceFeature {
+     175             :         double Emin;
+     176             :         double Rmax;
+     177             :         double index;
+     178             :         std::vector<int> nuclei;
+     179             :         std::vector<double> cdf;
+     180             : public:
+     181             :         /** Constructor
+     182             :          @param Emin            minimum energy (in Joules)
+     183             :          @param Rmax            maximum rigidity (in Volts)
+     184             :          @param index           spectral index of the power law
+     185             :          */
+     186             :         SourceComposition(double Emin, double Rmax, double index);
+     187             :         /** Add individual particle species with a given abundance
+     188             :          @param id                      id of the particle following the PDG numbering scheme
+     189             :          @param abundance       relative abundance of the particle species
+     190             :          */
+     191             :         void add(int id, double abundance);
+     192             :         /** Add individual particle species with a given abundance
+     193             :          @param A                       atomic mass of the cosmic-ray nucleus
+     194             :          @param Z                       atomic number of the cosmic-ray nucleus
+     195             :          @param abundance       relative abundance of the particle species
+     196             :          */
+     197             :         void add(int A, int Z, double abundance);
+     198             :         void prepareParticle(ParticleState &particle) const;
+     199             :         void setDescription();
+     200             : };
+     201             : 
+     202             : 
+     203             : /**
+     204             :  @class SourcePosition
+     205             :  @brief Position of a point source
+     206             :  */
+     207           1 : class SourcePosition: public SourceFeature {
+     208             :         Vector3d position; 
+     209             : public:
+     210             :         /** Constructor for a source in 3D
+     211             :          @param position        vector containing the coordinates of the point source [in meters]
+     212             :          */
+     213             :         SourcePosition(Vector3d position);
+     214             :         /** Constructor for a source in 1D
+     215             :          @param d       distance of the point source to the observer at x = 0 [in meters]; 
+     216             :                                 internally this will be converted to a vector with x-coordinate equal to d
+     217             :          */
+     218             :         SourcePosition(double d);
+     219             :         void prepareParticle(ParticleState &state) const;
+     220             :         void setDescription();
+     221             : };
+     222             : 
+     223             : 
+     224             : /**
+     225             :  @class SourceMultiplePositions
+     226             :  @brief Multiple point-source positions with individual luminosities
+     227             :  */
+     228             : class SourceMultiplePositions: public SourceFeature {
+     229             :         std::vector<Vector3d> positions;
+     230             :         std::vector<double> cdf;
+     231             : public:
+     232             :         /** Constructor.
+     233             :          The sources must be added individually to the object.
+     234             :          */
+     235             :         SourceMultiplePositions();
+     236             :         /** Add an individual source with a given luminosity/contribution.
+     237             :          @param position        vector containing the coordinates of the point source [in meters]
+     238             :          @param weight          luminosity/contribution of the individual source
+     239             :          */
+     240             :         void add(Vector3d position, double weight = 1);
+     241             :         void prepareParticle(ParticleState &particle) const;
+     242             :         void setDescription();
+     243             : };
+     244             : 
+     245             : 
+     246             : /**
+     247             :  @class SourceUniformSphere
+     248             :  @brief Uniform distribution of sources in a spherical volume
+     249             :  */
+     250           1 : class SourceUniformSphere: public SourceFeature {
+     251             :         Vector3d center;
+     252             :         double radius;
+     253             : public:
+     254             :         /** Constructor
+     255             :          @param center          vector containing the coordinates of the center of the sphere
+     256             :          @param radius          radius of the sphere
+     257             :          */
+     258             :         SourceUniformSphere(Vector3d center, double radius);
+     259             :         void prepareParticle(ParticleState &particle) const;
+     260             :         void setDescription();
+     261             : };
+     262             : 
+     263             : 
+     264             : /**
+     265             :  @class SourceUniformHollowSphere
+     266             :  @brief Uniform distribution of sources between two spheres
+     267             :  */
+     268           1 : class SourceUniformHollowSphere: public SourceFeature {
+     269             :         Vector3d center;
+     270             :         double radius_inner;
+     271             :         double radius_outer;
+     272             : public:
+     273             :         /** Constructor
+     274             :          @param center                  vector containing the coordinates of the center of the sphere
+     275             :          @param radius_inner    radius of the inner sphere
+     276             :          @param radius_outer    radius of the outer sphere
+     277             :          */
+     278             :         SourceUniformHollowSphere(Vector3d center,
+     279             :                         double radius_inner, double radius_outer);
+     280             :         void prepareParticle(ParticleState &particle) const;
+     281             :         void setDescription();
+     282             : };
+     283             : 
+     284             : 
+     285             : /**
+     286             :  @class SourceUniformShell
+     287             :  @brief Uniform distribution of source positions on the surface of a sphere
+     288             :  */
+     289             : class SourceUniformShell: public SourceFeature {
+     290             :         Vector3d center;
+     291             :         double radius;
+     292             : public:
+     293             :         /** Constructor
+     294             :          @param center          vector containing the coordinates of the center of the sphere
+     295             :          @param radius          radius of the sphere
+     296             :          */
+     297             :         SourceUniformShell(Vector3d center, double radius);
+     298             :         void prepareParticle(ParticleState &particle) const;
+     299             :         void setDescription();
+     300             : };
+     301             : 
+     302             : 
+     303             : /**
+     304             :  @class SourceUniformBox
+     305             :  @brief Uniform random source positions inside a box. The box is aligned with the coordinate axes.
+     306             :  */
+     307           1 : class SourceUniformBox: public SourceFeature {
+     308             :         Vector3d origin;        // lower box corner
+     309             :         Vector3d size;          // sizes along each coordinate axes.
+     310             : public:
+     311             :         /** Constructor
+     312             :          @param origin  vector corresponding to the lower box corner
+     313             :          @param size    vector corresponding to the box sizes along each direction
+     314             :          */
+     315             :         SourceUniformBox(Vector3d origin, Vector3d size);
+     316             :         void prepareParticle(ParticleState &particle) const;
+     317             :         void setDescription();
+     318             : };
+     319             : 
+     320             : 
+     321             : /**
+     322             :  @class SourceUniformCylinder
+     323             :  @brief Uniform distribution of source positions inside the volume of a cylinder whose axis is along the z-axis. 
+     324             : 
+     325             :  The circle of the cylinder lays in the xy-plane and the height is along the z-axis.
+     326             :  */
+     327           1 : class SourceUniformCylinder: public SourceFeature {
+     328             :         Vector3d origin;        // central point of cylinder 
+     329             :         double height;          // total height of the cylinder along z-axis. Half over/under the center.
+     330             :         double radius;          // radius of the cylinder in the xy-plane
+     331             : public:
+     332             :         /** Constructor
+     333             :          @param origin  vector corresponding to the center of the cylinder axis
+     334             :          @param height  height of the cylinder, half lays over the origin, half is lower
+     335             :          @param radius  radius of the cylinder
+     336             :          */
+     337             :         SourceUniformCylinder(Vector3d origin, double height, double radius);
+     338             :         void prepareParticle(ParticleState &particle) const;
+     339             :         void setDescription();
+     340             : };
+     341             : 
+     342             : 
+     343             : /**
+     344             :  @class SourceSNRDistribution
+     345             :  @brief Source distribution that follows the Galactic SNR distribution in 2D
+     346             : 
+     347             :  The origin of the distribution is the Galactic center. The default maximum radius is set 
+     348             :  to rMax=20 kpc and the default maximum height is zMax = 5 kpc.
+     349             :  See G. Case and D. Bhattacharya (1996) for the details of the distribution.
+     350             :  */
+     351           1 : class SourceSNRDistribution: public SourceFeature {
+     352             :         double rEarth; // parameter given by observation
+     353             :         double alpha; // parameter to shift the maximum in R direction
+     354             :         double beta; // parameter to shift the maximum in R direction
+     355             :         double zg; // exponential cut parameter in z direction
+     356             :         double frMax; // helper for efficient sampling
+     357             :         double fzMax; // helper for efficient sampling
+     358             :         double rMax; // maximum radial distance - default 20 kpc 
+     359             :                       // (due to the extension of the JF12 field)
+     360             :         double zMax; // maximum distance from galactic plane - default 5 kpc
+     361             :         void setFrMax(); // calculate frMax with the current parameter. 
+     362             : 
+     363             : public:
+     364             :         /** Default constructor. 
+     365             :          Default parameters are:
+     366             :          . rEarth = 8.5 kpc
+     367             :          . alpha = 2
+     368             :          . beta = 3.53
+     369             :          . zg = 300 pc
+     370             :          . rMax = 20 kpc
+     371             :          . zMax = 5 kpc
+     372             :         */ 
+     373             :         SourceSNRDistribution();
+     374             :         /** Generic constructor
+     375             :          @param rEarth    distance from Earth to the Galactic centre [in meters]
+     376             :          @param alpha     parameter that shifts radially the maximum of the distributions
+     377             :          @param beta      parameter that shifts radially the maximum of the distributions 
+     378             :          @param zg                exponential cut-off parameter in the z-direction [in meters]
+     379             :         */      
+     380             :         SourceSNRDistribution(double rEarth,double alpha, double beta, double zg);
+     381             : 
+     382             :         void prepareParticle(ParticleState &particle) const;
+     383             :         /**
+     384             :          radial distribution of the SNR density.
+     385             :          @param r       galactocentric radius in [meter]
+     386             :         */
+     387             :         double fr(double r) const;
+     388             :         /**
+     389             :          height distribution of the SNR density.
+     390             :          @param z       height over/under the galactic plane in [meter]
+     391             :         */
+     392             :         double fz(double z) const;
+     393             : 
+     394             :         /**
+     395             :          Set the exponential cut-off parameter in the z-direction.
+     396             :          @param Zg      cut-off parameter
+     397             :         */
+     398             :         void setFzMax(double Zg);
+     399             : 
+     400             :         /**
+     401             :          @param rMax maximal radius up to which sources are possible
+     402             :         */
+     403             :         void setRMax(double rMax);
+     404             : 
+     405             :         /**
+     406             :          @param zMax maximal height up to which sources are possible
+     407             :         */
+     408             :         void setZMax(double zMax);
+     409             : 
+     410             :         // parameter for the raidal distribution
+     411             :         void setAlpha(double a);
+     412             :         // parameter for the exponential cut-off in the radial distribution
+     413             :         void setBeta(double b);
+     414             :         double getFrMax() const;
+     415             :         double getFzMax() const;
+     416             :         double getRMax() const;
+     417             :         double getZMax() const;
+     418             :         double getAlpha() const;
+     419             :         double getBeta() const;
+     420             :         void setDescription();
+     421             : };
+     422             : 
+     423             : 
+     424             : /**
+     425             :  @class SourcePulsarDistribution
+     426             :  @brief Source distribution following the Galactic pulsar distribution
+     427             : 
+     428             :  A logarithmic spiral with four arms is used for the radial distribution.
+     429             :  The z-distribution is a simple exponentially decaying distribution.
+     430             :  The pulsar distribution is explained in detail in C.-A. Faucher-Giguere
+     431             :  and V. M. Kaspi, ApJ 643 (May, 2006) 332. The radial distribution is 
+     432             :  parametrized as in Blasi and Amato, JCAP 1 (Jan., 2012) 10.
+     433             :  */
+     434             : class SourcePulsarDistribution: public SourceFeature {
+     435             :         double rEarth; // parameter given by observation
+     436             :         double beta; // parameter to shift the maximum in R direction
+     437             :         double zg; // exponential cut parameter in z direction
+     438             :         double frMax; // helper for efficient sampling
+     439             :         double fzMax; // helper for efficient sampling
+     440             :         double rMax; // maximum radial distance - default 22 kpc 
+     441             :         double zMax; // maximum distance from galactic plane - default 5 kpc
+     442             :         double rBlur; // relative smearing factor for the radius
+     443             :         double thetaBlur; // smearing factor for the angle. Unit = [1/length]
+     444             : public:
+     445             :         /** Default constructor. 
+     446             :          Default parameters are:
+     447             :          . rEarth = 8.5 kpc
+     448             :          . beta = 3.53
+     449             :          . zg = 300 pc
+     450             :          . Rmax = 22 kpc
+     451             :          . Zmax = 5 kpc
+     452             :          . rBlur = 0.07
+     453             :          . thetaBlur = 0.35 / kpc
+     454             :          */ 
+     455             :         SourcePulsarDistribution();     
+     456             :         /** Generic constructor
+     457             :          @param rEarth          distance from Earth to the Galactic centre [in meters]
+     458             :          @param beta            parameter that shifts radially the maximum of the distributions 
+     459             :          @param zg                      exponential cut-off parameter in the z-direction [in meters]
+     460             :          @param rBlur           relative smearing factor for radius
+     461             :          @param thetaBlur       smearing factor for the angle [in 1 / meters]
+     462             :          */     
+     463             :         SourcePulsarDistribution(double rEarth, double beta, double zg, double rBlur, double thetaBlur);
+     464             :         void prepareParticle(ParticleState &particle) const;
+     465             : 
+     466             :         /** 
+     467             :          radial distribution of pulsars
+     468             :          @param r       galactocentric radius
+     469             :         */
+     470             :         double fr(double r) const;
+     471             :         /**
+     472             :          z distribution of pulsars
+     473             :          @param z       height over/under the galactic plane
+     474             :         */
+     475             :         double fz(double z) const;
+     476             :         double ftheta(int i, double r) const;
+     477             :         double blurR(double r_tilde) const;
+     478             :         double blurTheta(double theta_tilde, double r_tilde) const;
+     479             :         void setFrMax(double R, double b);
+     480             :         void setFzMax(double zg);
+     481             :         void setRMax(double rMax);
+     482             :         void setZMax(double zMax);
+     483             :         void setRBlur(double rBlur);
+     484             :         void setThetaBlur(double thetaBlur);
+     485             :         double getFrMax();
+     486             :         double getFzMax();
+     487             :         double getRMax();
+     488             :         double getZMax();
+     489             :         double getRBlur();
+     490             :         double getThetaBlur();
+     491             :         void setDescription();
+     492             : };
+     493             : 
+     494             : 
+     495             : /**
+     496             :  @class SourceUniform1D
+     497             :  @brief Uniform source distribution in 1D
+     498             : 
+     499             :  This source property sets random x-coordinates according to a uniform source
+     500             :  distribution in a given distance interval. If cosmological effects are included, 
+     501             :  this is done by drawing a light-travel distance from a flat distribution and
+     502             :  converting to a comoving distance. In the absence of cosmological effects, the
+     503             :  positions are drawn uniformly in the light-travel distance interval (as opposed
+     504             :  to a comoving interval).
+     505             :  The source positions are assigned to the x-coordinate (Vector3d(distance, 0, 0))
+     506             :  in this one-dimensional case.
+     507             :  */
+     508             : class SourceUniform1D: public SourceFeature {
+     509             :         double minD; // minimum light-travel distance
+     510             :         double maxD; // maximum light-travel distance
+     511             :         bool withCosmology;     // whether to account for cosmological effects (expansion of the Universe)
+     512             : public:
+     513             :         /** Constructor
+     514             :          @param minD                    minimum distance; comoving if withCosmology is True
+     515             :          @param maxD                    maximum distance; comoving if withCosmology is True
+     516             :          @param withCosmology   whether to account for cosmological effects (expansion of the Universe)
+     517             :          */
+     518             :         SourceUniform1D(double minD, double maxD, bool withCosmology = true);
+     519             :         void prepareParticle(ParticleState& particle) const;
+     520             :         void setDescription();
+     521             : };
+     522             : 
+     523             : 
+     524             : /**
+     525             :  @class SourceDensityGrid
+     526             :  @brief Random source positions from a density grid
+     527             :  */
+     528             : class SourceDensityGrid: public SourceFeature {
+     529             :         ref_ptr<Grid1f> grid;
+     530             : public:
+     531             :         /** Constructor
+     532             :          @param densityGrid     3D grid containing the density of sources in each cell
+     533             :          */
+     534             :         SourceDensityGrid(ref_ptr<Grid1f> densityGrid);
+     535             :         void prepareParticle(ParticleState &particle) const;
+     536             :         void setDescription();
+     537             : };
+     538             : 
+     539             : 
+     540             : /**
+     541             :  @class SourceDensityGrid1D
+     542             :  @brief Random source positions from a 1D density grid
+     543             :  */
+     544             : class SourceDensityGrid1D: public SourceFeature {
+     545             :         ref_ptr<Grid1f> grid;     // 1D grid with Ny = Nz = 1
+     546             : public:
+     547             :         /** Constructor
+     548             :          @param densityGrid     1D grid containing the density of sources in each cell, Ny and Nz must be 1
+     549             :          */
+     550             :         SourceDensityGrid1D(ref_ptr<Grid1f> densityGrid);
+     551             :         void prepareParticle(ParticleState &particle) const;
+     552             :         void setDescription();
+     553             : };
+     554             : 
+     555             : 
+     556             : /**
+     557             :  @class SourceIsotropicEmission
+     558             :  @brief Isotropic emission from a source
+     559             :  */
+     560             : class SourceIsotropicEmission: public SourceFeature {
+     561             : public:
+     562             :         /** Constructor
+     563             :          */
+     564             :         SourceIsotropicEmission();
+     565             :         void prepareParticle(ParticleState &particle) const;
+     566             :         void setDescription();
+     567             : };
+     568             : 
+     569             : 
+     570             : /**
+     571             :  @class SourceDirectedEmission
+     572             :  @brief Directed emission from a source from the von-Mises-Fisher distribution 
+     573             :  
+     574             :  The emission from the source is generated following the von-Mises-Fisher distribution
+     575             :  with mean direction mu and concentration parameter kappa.
+     576             :  The sampling from the vMF distribution follows this document by Julian Straub:
+     577             :  http://people.csail.mit.edu/jstraub/download/straub2017vonMisesFisherInference.pdf
+     578             :  The emitted particles are assigned a weight so that the detected particles can be
+     579             :  reweighted to an isotropic emission distribution instead of a vMF distribution.
+     580             :  For details, see PoS (ICRC2019) 447.
+     581             :  */
+     582           1 : class SourceDirectedEmission: public SourceFeature {
+     583             :         Vector3d mu; // Mean emission direction in the vMF distribution
+     584             :         double kappa; // Concentration parameter of the vMF distribution
+     585             : public:
+     586             :         /** Constructor
+     587             :          @param mu      mean direction of the emission, mu should be normelized
+     588             :          @param kappa   concentration parameter
+     589             :         */
+     590             :         SourceDirectedEmission(Vector3d mu, double kappa);
+     591             :         void prepareCandidate(Candidate &candidate) const;
+     592             :         void setDescription();
+     593             : };
+     594             : 
+     595             : /**
+     596             :  @class SourceLambertDistributionOnSphere
+     597             :  @brief Uniform random position on a sphere with isotropic Lamberts distributed directions.
+     598             : 
+     599             :  This function should be used for crosschecking the arrival distribution for a
+     600             :  Galactic propagation with an isotropic arrival distribution at the Edge of our
+     601             :  Galaxy. Note, that for simulation speed you should rather use the backtracking
+     602             :  technique: see e.g. http://physik.rwth-aachen.de/parsec
+     603             :  */
+     604             : class SourceLambertDistributionOnSphere: public SourceFeature {
+     605             :         Vector3d center;        // center of the sphere
+     606             :         double radius;          // radius of the sphere
+     607             :         bool inward;            // if true, direction point inwards
+     608             : public:
+     609             :         /** Constructor
+     610             :          @param center          vector containing the coordinates of the center of the sphere
+     611             :          @param radius          radius of the sphere
+     612             :          @param inward          if true, the directions point inwards
+     613             :          */
+     614             :         SourceLambertDistributionOnSphere(const Vector3d &center, double radius, bool inward);
+     615             :         void prepareParticle(ParticleState &particle) const;
+     616             :         void setDescription();
+     617             : };
+     618             : 
+     619             : 
+     620             : /**
+     621             :  @class SourceDirection
+     622             :  @brief Collimated emission along a specific direction
+     623             :  */
+     624             : class SourceDirection: public SourceFeature {
+     625             :         Vector3d direction;
+     626             : public:
+     627             :         /** Constructor
+     628             :          @param direction       Vector3d corresponding to the direction of emission
+     629             :          */
+     630             :         SourceDirection(Vector3d direction = Vector3d(-1, 0, 0));
+     631             :         void prepareParticle(ParticleState &particle) const;
+     632             :         void setDescription();
+     633             : };
+     634             : 
+     635             : 
+     636             : /**
+     637             :  @class SourceEmissionMap
+     638             :  @brief Deactivate Candidate if it has zero probability in provided EmissionMap. 
+     639             : 
+     640             :         This feature does not change the direction of the candidate. Therefore a usefull direction feature (isotropic or directed emission)
+     641             :         must be added to the sources before. The propability of the emission map is not taken into account. 
+     642             :  */
+     643             : class SourceEmissionMap: public SourceFeature {
+     644             :         ref_ptr<EmissionMap> emissionMap;
+     645             : public:
+     646             :         /** Constructor
+     647             :          @param emissionMap             emission map containing probabilities of emission in various directions
+     648             :          */
+     649             :         SourceEmissionMap(EmissionMap *emissionMap);
+     650             :         void prepareCandidate(Candidate &candidate) const;
+     651             :         void setEmissionMap(EmissionMap *emissionMap);
+     652             :         void setDescription();
+     653             : };
+     654             : 
+     655             : 
+     656             : /**
+     657             :  @class SourceEmissionCone
+     658             :  @brief Uniform emission within a cone
+     659             :  */
+     660           1 : class SourceEmissionCone: public SourceFeature {
+     661             :         Vector3d direction;
+     662             :         double aperture;
+     663             : public:
+     664             :         /** Constructor
+     665             :          @param direction               Vector3d corresponding to the cone axis 
+     666             :          @param aperture                opening angle of the cone
+     667             :          */
+     668             :         SourceEmissionCone(Vector3d direction, double aperture);
+     669             :         void prepareParticle(ParticleState &particle) const;
+     670             : 
+     671             :         /**
+     672             :          @param direction Vector3d corresponding to the cone axis
+     673             :         */
+     674             :         void setDirection(Vector3d direction);
+     675             :         void setDescription();
+     676             : };
+     677             : 
+     678             : 
+     679             : /**
+     680             :  @class SourceRedshift
+     681             :  @brief Emission of particles at a specific redshift (or time)
+     682             : 
+     683             :  The redshift coordinate is used to treat cosmological effects and as a time coordinate.
+     684             :  Consider, for instance, a source located at a distance corresponding to a redshift z. 
+     685             :  In the absence of processes that cause time delays (e.g., magnetic deflections), particles
+     686             :  from this source could arrive after a time corresponding to the source redshift. Charged 
+     687             :  particles, on the other hand, can arrive at a time later than the corresponding straight-
+     688             :  line travel duration. 
+     689             :  This treatment is also useful for time-dependent studies (e.g. transient sources).
+     690             :  */
+     691             : class SourceRedshift: public SourceFeature {
+     692             :         double z;
+     693             : public:
+     694             :         /** Constructor
+     695             :          @param z               redshift of emission
+     696             :          */
+     697             :         SourceRedshift(double z);
+     698             :         void prepareCandidate(Candidate &candidate) const;
+     699             :         void setDescription();
+     700             : };
+     701             : 
+     702             : 
+     703             : /**
+     704             :  @class SourceUniformRedshift
+     705             :  @brief Random redshift (time of emission) from a uniform distribution
+     706             : 
+     707             :  This function assigns random redshifts to the particles emitted by a given source.
+     708             :  These values are drawn from a uniform redshift distribution in the interval [zmin, zmax].
+     709             :  The redshift coordinate is used to treat cosmological effects and as a time coordinate.
+     710             :  Consider, for instance, a source located at a distance corresponding to a redshift z. 
+     711             :  In the absence of processes that cause time delays (e.g., magnetic deflections), particles
+     712             :  from this source could arrive after a time corresponding to the source redshift. Charged 
+     713             :  particles, on the other hand, can arrive at a time later than the corresponding straight-
+     714             :  line travel duration. 
+     715             :  This treatment is also useful for time-dependent studies (e.g. transient sources).
+     716             :  */
+     717             : class SourceUniformRedshift: public SourceFeature {
+     718             :         double zmin, zmax;
+     719             : public:
+     720             :         /** Constructor
+     721             :          @param zmin    minimum redshift
+     722             :          @param zmax    maximum redshift
+     723             :          */
+     724             :         SourceUniformRedshift(double zmin, double zmax);
+     725             :         void prepareCandidate(Candidate &candidate) const;
+     726             :         void setDescription();
+     727             : };
+     728             : 
+     729             : 
+     730             : /**
+     731             :  @class SourceRedshiftEvolution
+     732             :  @brief Random redshift (time of emission) from (1+z)^m distribution
+     733             : 
+     734             :  This assigns redshifts to a given source according to a typical power-law distribution.
+     735             :  The redshift coordinate is used to treat cosmological effects and as a time coordinate.
+     736             :  Consider, for instance, a source located at a distance corresponding to a redshift z. 
+     737             :  In the absence of processes that cause time delays (e.g., magnetic deflections), particles
+     738             :  from this source could arrive after a time corresponding to the source redshift. Charged 
+     739             :  particles, on the other hand, can arrive at a time later than the corresponding straight-
+     740             :  line travel duration. 
+     741             :  This treatment is also useful for time-dependent studies (e.g. transient sources).
+     742             :  */
+     743           2 : class SourceRedshiftEvolution: public SourceFeature {
+     744             :         double zmin, zmax;
+     745             :         double m;
+     746             : public:
+     747             :         /** Constructor
+     748             :          @param m               index of the power law (1 + z)^m
+     749             :          @param zmin    minimum redshift
+     750             :          @param zmax    maximum redshift
+     751             :          */
+     752             :         SourceRedshiftEvolution(double m, double zmin, double zmax);
+     753             :         void prepareCandidate(Candidate &candidate) const;
+     754             : };
+     755             : 
+     756             : 
+     757             : /**
+     758             :  @class SourceRedshift1D
+     759             :  @brief Redshift according to the distance to 0
+     760             : 
+     761             :  This source property sets the redshift according to the distance from 
+     762             :  the source to the origin (0, 0, 0). 
+     763             :  It must be added after the position of the source is set because it
+     764             :  computes the redshifts based on the source distance.
+     765             :  */
+     766             : class SourceRedshift1D: public SourceFeature {
+     767             : public:
+     768             :         /** Constructor
+     769             :          */
+     770             :         SourceRedshift1D();
+     771             :         void prepareCandidate(Candidate &candidate) const;
+     772             :         void setDescription();
+     773             : };
+     774             : 
+     775             : 
+     776             : #ifdef CRPROPA_HAVE_MUPARSER
+     777             : /**
+     778             :  @class SourceGenericComposition
+     779             :  @brief Add multiple cosmic rays with energies described by an expression string
+     780             : 
+     781             :  This is particularly useful if an arbitrary combination of nuclei types with 
+     782             :  specific energy spectra. The strings parsed may contain 'A' (atomic mass), 
+     783             :  'Z' (atomic number).  The following units are recognized as part of the strings:
+     784             :  GeV, TeV, PeV, EeV.  The variable for energy is 'E', with limits 'Emin', 'Emax'.
+     785             :  This property only works if muparser is available.
+     786             :  For details about the library see:
+     787             :         https://beltoforion.de/en/muparser/
+     788             :  */
+     789             : class SourceGenericComposition: public SourceFeature {
+     790             : public:
+     791           7 :         struct Nucleus {
+     792             :                 int id;
+     793             :                 std::vector<double> cdf;
+     794             :         };
+     795             :         /** Constructor
+     796             :          @param Emin            minimum energy [in Joules]
+     797             :          @param Emax            maximum energy [in Joules]
+     798             :          @param expression      string containing the expression to generate the composition
+     799             :          @param bins            number of energy bins
+     800             :          */
+     801             :         SourceGenericComposition(double Emin, double Emax, std::string expression, size_t bins = 1024);
+     802             :         /** Add an individual particle id.
+     803             :          @param id                      id of the particle following the PDG numbering scheme
+     804             :          @param abundance       relative abundance of individual particle species
+     805             :          */
+     806             :         void add(int id, double abundance);
+     807             :         /** Add an individual particle id.
+     808             :          @param A                       atomic mass of the cosmic-ray nucleus
+     809             :          @param Z                       atomic number of the cosmic-ray nucleus
+     810             :          @param abundance       relative abundance of individual particle species
+     811             :          */
+     812             :         void add(int A, int Z, double abundance);
+     813             :         void prepareParticle(ParticleState &particle) const;
+     814             :         void setDescription();
+     815             : 
+     816             :         const std::vector<double> *getNucleusCDF(int id) const {
+     817           0 :                 for (size_t i = 0; i < nuclei.size(); i++) {
+     818           0 :                         if (nuclei[i].id == id)
+     819           0 :                                 return &nuclei[i].cdf;
+     820             :                 }
+     821             :                 return 0;
+     822             :         }
+     823             : 
+     824             : protected:
+     825             :         double Emin, Emax;
+     826             :         size_t bins;
+     827             :         std::string expression;
+     828             :         std::vector<double> energy;
+     829             : 
+     830             :         std::vector<Nucleus> nuclei;
+     831             :         std::vector<double> cdf;
+     832             : 
+     833             : };
+     834             : #endif
+     835             : 
+     836             : /**
+     837             :  * @class SourceTag
+     838             :  * @brief All candidates from this source get a given tag. This can be used to distinguish between different sources that follow the same spatial distribution
+     839             :  * 
+     840             :  * Sets the tag of the candidate. Can be used to trace back additional candidate properties, e.g. production interaction or source type. 
+     841             :  * The interaction overwrites the candidate tag from the source for all secondaries. 
+     842             :  */
+     843             : 
+     844             : class SourceTag: public SourceFeature {
+     845             : private:
+     846             :         std::string sourceTag;
+     847             : 
+     848             : public:
+     849             :         SourceTag(std::string tag);
+     850             :         void prepareCandidate(Candidate &candidate) const;
+     851             :         void setDescription();
+     852             :         void setTag(std::string tag);
+     853             : };
+     854             : 
+     855             : /**
+     856             :         @class SourceMassDistribution
+     857             :         @brief  Source position follows a given mass distribution
+     858             : 
+     859             :         The (source)position of the candidate is sampled from a given mass distribution. The distribution uses the getDensity function of the density module. 
+     860             :         If a weighting for different components is desired, the use of different densities in a densityList is recommended.
+     861             : 
+     862             :         The sampling range of the position can be restricted. Default is a sampling for x in [-20, 20] * kpc, y in [-20, 20] * kpc and z in [-4, 4] * kpc.
+     863             : */
+     864             : class SourceMassDistribution: public SourceFeature {
+     865             : private: 
+     866             :         ref_ptr<Density> density; //< density distribution
+     867             :         double maxDensity;                      //< maximal value of the density in the region of interest
+     868             :         double xMin, xMax;                      //< x-range to sample positions
+     869             :         double yMin, yMax;                      //< y-range to sample positions
+     870             :         double zMin, zMax;                      //< z-range to sample positions
+     871             :         int maxTries = 10000;           //< maximal number of tries to sample the position 
+     872             : 
+     873             : public: 
+     874             :         /** Constructor
+     875             :         @param density: CRPropa mass distribution 
+     876             :         @param maxDensity:      maximal density in the region where the position should be sampled
+     877             :         @param x:       the position will be sampled in the range [-x, x]. Non symmetric values can be set with setXrange.
+     878             :         @param y:       the position will be sampled in the range [-y, y]. Non symmetric values can be set with setYrange.
+     879             :         @param z:       the position will be sampled in the range [-z, z]. Non symmetric values can be set with setZrange.
+     880             :         */
+     881             :         SourceMassDistribution(ref_ptr<Density> density, double maxDensity = 0, double x = 20 * kpc, double y = 20 * kpc, double z = 4 * kpc);
+     882             : 
+     883             :         void prepareParticle(ParticleState &particle) const;
+     884             : 
+     885             :         /** Set the maximal density in the region of interest. This parameter is necessary for the sampling
+     886             :         @param maxDensity:      maximal density in [particle / m^3]
+     887             :         */
+     888             :         void setMaximalDensity(double maxDensity);
+     889             : 
+     890             :         /** set x-range in which the position of the candidate will be sampled. x in [xMin, xMax].
+     891             :         @param xMin: minimal x value of the allowed sample range in [m]
+     892             :         @param xMax: maximal x value of the allowed sample range in [m]
+     893             :         */
+     894             :         void setXrange(double xMin, double xMax);
+     895             : 
+     896             :         /** set y-range in which the position of the candidate will be sampled. y in [yMin, yMax].
+     897             :         @param yMin: minimal y value of the allowed sample range in [m]
+     898             :         @param yMax: maximal y value of the allowed sample range in [m]
+     899             :         */
+     900             :         void setYrange(double yMin, double yMax);
+     901             : 
+     902             :         /** set z-range in which the position of the candidate will be sampled. z in [zMin, zMax].
+     903             :         @param zMin: minimal z value of the allowed sample range in [m]
+     904             :         @param zMax: maximal z value of the allowed sample range in [m]
+     905             :         */
+     906             :         void setZrange(double zMin, double zMax);
+     907             : 
+     908             :         /*      samples the position. Can be used for testing.
+     909             :                 @return Vector3d with sampled position
+     910             :         */
+     911             :         Vector3d samplePosition() const;
+     912             : 
+     913             : 
+     914             :         /** set the number of maximal tries until the sampling routine breaks.
+     915             :                 @param tries: number of the maximal tries
+     916             :         */
+     917             :         void setMaximalTries(int tries);
+     918             : 
+     919             :         std::string getDescription();
+     920             : };
+     921             : 
+     922             : /**  @} */ // end of group SourceFeature
+     923             : 
+     924             : } // namespace crpropa
+     925             : 
+     926             : #endif // CRPROPA_SOURCE_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Variant.h.func-sort-c.html b/doc/coverageReport/include/crpropa/Variant.h.func-sort-c.html new file mode 100644 index 000000000..fa4e80473 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Variant.h.func-sort-c.html @@ -0,0 +1,136 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Variant.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Variant.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:133537.1 %
Date:2024-04-08 14:58:22Functions:41625.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa10safeDeleteINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEvRPT_0
_ZN7crpropa10safeDeleteISt6vectorINS_7VariantESaIS2_EEEEvRPT_0
_ZN7crpropa7Variant14bad_conversionC2ENS0_4TypeES2_0
_ZN7crpropa7Variant14bad_conversionD0Ev0
_ZN7crpropa7Variant14bad_conversionD2Ev0
_ZN7crpropa7VariantaSERKNS_7Vector3ISt7complexIdEEE0
_ZN7crpropa7VariantaSERKNS_7Vector3IdEE0
_ZN7crpropa7VariantaSERKNS_7Vector3IfEE0
_ZN7crpropa7VariantaSERKSt6vectorIS0_SaIS0_EE0
_ZN7crpropa7VariantaSERKSt7complexIdE0
_ZN7crpropa7VariantaSERKSt7complexIfE0
_ZNK7crpropa7Variant14bad_conversion4whatEv0
_ZN7crpropa7VariantC2ERKSt6vectorIS0_SaIS0_EE1
_ZNK7crpropa7VariantcvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEv1
_ZN7crpropa7VariantC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1130
_ZN7crpropa7VariantaSERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1136
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Variant.h.func.html b/doc/coverageReport/include/crpropa/Variant.h.func.html new file mode 100644 index 000000000..070430d10 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Variant.h.func.html @@ -0,0 +1,136 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Variant.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Variant.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:133537.1 %
Date:2024-04-08 14:58:22Functions:41625.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa10safeDeleteINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEvRPT_0
_ZN7crpropa10safeDeleteISt6vectorINS_7VariantESaIS2_EEEEvRPT_0
_ZN7crpropa7Variant14bad_conversionC2ENS0_4TypeES2_0
_ZN7crpropa7Variant14bad_conversionD0Ev0
_ZN7crpropa7Variant14bad_conversionD2Ev0
_ZN7crpropa7VariantC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1130
_ZN7crpropa7VariantC2ERKSt6vectorIS0_SaIS0_EE1
_ZN7crpropa7VariantaSERKNS_7Vector3ISt7complexIdEEE0
_ZN7crpropa7VariantaSERKNS_7Vector3IdEE0
_ZN7crpropa7VariantaSERKNS_7Vector3IfEE0
_ZN7crpropa7VariantaSERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1136
_ZN7crpropa7VariantaSERKSt6vectorIS0_SaIS0_EE0
_ZN7crpropa7VariantaSERKSt7complexIdE0
_ZN7crpropa7VariantaSERKSt7complexIfE0
_ZNK7crpropa7Variant14bad_conversion4whatEv0
_ZNK7crpropa7VariantcvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Variant.h.gcov.html b/doc/coverageReport/include/crpropa/Variant.h.gcov.html new file mode 100644 index 000000000..a97907206 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Variant.h.gcov.html @@ -0,0 +1,410 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Variant.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Variant.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:133537.1 %
Date:2024-04-08 14:58:22Functions:41625.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : //-------------------------------------------------------------
+       2             : // Based on Variant.hh of the Physics eXtension Library (PXL) -
+       3             : // http://vispa.physik.rwth-aachen.de/                        -
+       4             : // Licensed under a LGPL-2 or later license                   -
+       5             : //-------------------------------------------------------------
+       6             : 
+       7             : #ifndef CRPROPA_VARIANT_H
+       8             : #define CRPROPA_VARIANT_H
+       9             : 
+      10             : #include <complex>
+      11             : #include <cstdint>
+      12             : #include <cstdlib>
+      13             : #include <cstring>
+      14             : #include <iostream>
+      15             : #include <limits>
+      16             : #include <string>
+      17             : #include <sstream>
+      18             : #include <stdexcept>
+      19             : #include <typeinfo>
+      20             : 
+      21             : #include "crpropa/Vector3.h"
+      22             : 
+      23             : 
+      24             : 
+      25             : // defines copy constructor X(const X&), isX(), asX(), fromX(), toX(), op(), op=, op==, op!=
+      26             : #define VARIANT_ADD_TYPE_DECL_POD(NAME, TYPE, VALUE, FIELD) \
+      27             :         Variant(const VALUE& v) { \
+      28             :                 data._t_##FIELD = v; \
+      29             :                 type = TYPE;  \
+      30             :         } \
+      31             :         bool is##NAME() const { \
+      32             :                 return type == TYPE; \
+      33             :         } \
+      34             :         VALUE& as##NAME() { \
+      35             :                 check(TYPE); \
+      36             :                 return data._t_##FIELD; \
+      37             :         } \
+      38             :         const VALUE& as##NAME() const { \
+      39             :                 check(TYPE); \
+      40             :                 return data._t_##FIELD; \
+      41             :         } \
+      42             :         static Variant from##NAME(const VALUE& v) { \
+      43             :                 return Variant(v); \
+      44             :         } \
+      45             :         VALUE to##NAME() const; \
+      46             :         operator VALUE() const { \
+      47             :                 return to##NAME(); \
+      48             :         } \
+      49             :         Variant& operator=(const VALUE& v) { \
+      50             :                 clear(); \
+      51             :                 type = TYPE; \
+      52             :                 data._t_##FIELD = v; \
+      53             :                 return *this; \
+      54             :         } \
+      55             :         bool operator==(const VALUE& v) const { \
+      56             :                 check(TYPE); \
+      57             :                 return data._t_##FIELD == v; \
+      58             :         } \
+      59             :         bool operator!=(const VALUE& v) const { \
+      60             :                 check(TYPE); \
+      61             :                 return data._t_##FIELD != v; \
+      62             :         } \
+      63             : 
+      64             : // defines isX(), asX(), fromX()
+      65             : #define VARIANT_ADD_TYPE_DECL_PTR_BASE(NAME, TYPE, VALUE, FIELD) \
+      66             :         bool is##NAME() const { \
+      67             :                 return type == TYPE; \
+      68             :         } \
+      69             :         VALUE& as##NAME() { \
+      70             :                 check(TYPE); \
+      71             :                 return *data._t_##FIELD; \
+      72             :         } \
+      73             :         const VALUE& as##NAME() const { \
+      74             :                 check(TYPE); \
+      75             :                 return *data._t_##FIELD; \
+      76             :         } \
+      77             :         static Variant from##NAME(const VALUE& v) { \
+      78             :                 return Variant(v); \
+      79             :         } \
+      80             : 
+      81             : // defines isX(), asX(), fromX(), and copy constructor X(const X&), op=, op==, op!=
+      82             : #define VARIANT_ADD_TYPE_DECL_PTR(NAME, TYPE, VALUE, FIELD) \
+      83             :         VARIANT_ADD_TYPE_DECL_PTR_BASE(NAME, TYPE, VALUE, FIELD) \
+      84             :         Variant(const VALUE& v) { \
+      85             :                 data._t_##FIELD = new VALUE(v); \
+      86             :                 type = TYPE; \
+      87             :         } \
+      88             :         Variant& operator=(const VALUE& v) { \
+      89             :                 if (type != TYPE) { \
+      90             :                         clear(); \
+      91             :                         data._t_##FIELD = new VALUE();\
+      92             :                 } \
+      93             :                 type = TYPE; \
+      94             :                 (*data._t_##FIELD) = v; \
+      95             :                 return *this; \
+      96             :         } \
+      97             :         bool operator==(const VALUE& v) const { \
+      98             :                 check(TYPE); \
+      99             :                 return *data._t_##FIELD == v; \
+     100             :         } \
+     101             :         bool operator!=(const VALUE& v) const { \
+     102             :                 return !(*this == v); \
+     103             :         } \
+     104             : 
+     105             : #define VARIANT_ADD_ITER_DECL_PTR(NAME, TYPE, FIELD) \
+     106             :         typedef FIELD##_t::iterator FIELD##_iterator; \
+     107             :         typedef FIELD##_t::const_iterator FIELD##_const_iterator; \
+     108             :         inline FIELD##_iterator begin##NAME() { \
+     109             :                 check(TYPE); \
+     110             :                 return data._t_##FIELD->begin(); \
+     111             :         } \
+     112             :         inline FIELD##_iterator end##NAME() { \
+     113             :                 check(TYPE); \
+     114             :                 return data._t_##FIELD->end(); \
+     115             :         } \
+     116             :         inline FIELD##_const_iterator begin##NAME() const { \
+     117             :                 check(TYPE); \
+     118             :                 return data._t_##FIELD->begin(); \
+     119             :         } \
+     120             :         inline FIELD##_const_iterator end##NAME() const { \
+     121             :                 check(TYPE); \
+     122             :                 return data._t_##FIELD->end(); \
+     123             :         }                                                                                
+     124             : 
+     125             : 
+     126             : 
+     127             : namespace crpropa {
+     128             : 
+     129             : /**
+     130             :  @class Variant
+     131             :  @brief storage container for data types as e.g. int, float, string, etc.
+     132             : 
+     133             :  Allows storage of multiple data types in one base class. Used to construct a map of `arbitrary' data types.
+     134             :  Note that most default C++ types allow default conversions from `Variant` to the corresponding type.
+     135             :  Types that require an explicit call via `toTargetType()` are: complex (float and double), Vector3, and vector<Variant>.
+     136             :  */
+     137             : class Variant {
+     138             : public:
+     139             :         enum Type {
+     140             :                 TYPE_NONE = 0,
+     141             :                 TYPE_BOOL,
+     142             :                 TYPE_CHAR,
+     143             :                 TYPE_UCHAR,
+     144             :                 TYPE_INT16,
+     145             :                 TYPE_UINT16,
+     146             :                 TYPE_INT32,
+     147             :                 TYPE_UINT32,
+     148             :                 TYPE_INT64,
+     149             :                 TYPE_UINT64,
+     150             :                 TYPE_FLOAT,
+     151             :                 TYPE_DOUBLE,
+     152             :                 TYPE_LONGDOUBLE,
+     153             :                 TYPE_COMPLEXF,
+     154             :                 TYPE_COMPLEXD,
+     155             :                 TYPE_STRING,
+     156             :                 TYPE_VECTOR3F,
+     157             :                 TYPE_VECTOR3D,
+     158             :                 TYPE_VECTOR3C,
+     159             :                 TYPE_VECTOR
+     160             :         };
+     161             : 
+     162             :         class bad_conversion: public std::exception {
+     163             :                 protected:
+     164             :                         std::string msg;
+     165             :                 public:
+     166           0 :                         const char* what() const throw () {
+     167           0 :                                 return msg.c_str();
+     168             :                         }
+     169             : 
+     170           0 :                         bad_conversion(Type f, Type t) {
+     171             :                                 msg = "Variant: bad conversion from '";
+     172           0 :                                 msg += Variant::getTypeName(f);
+     173             :                                 msg += "' to '";
+     174           0 :                                 msg += Variant::getTypeName(t);
+     175             :                                 msg += "'";
+     176           0 :                         }
+     177             : 
+     178           0 :                         ~bad_conversion() throw () {
+     179           0 :                         }
+     180             :         };
+     181             : 
+     182             :         typedef std::complex<float> complex_f;
+     183             :         typedef std::complex<double> complex_d;
+     184             :         typedef Vector3<std::complex<double>> Vector3c;
+     185             :         typedef std::vector<Variant> vector_t;
+     186             : 
+     187             : protected:
+     188             :         Type type;
+     189             : 
+     190             :         union {
+     191             :                 bool _t_bool;
+     192             :                 char _t_char;
+     193             :                 unsigned char _t_uchar;
+     194             :                 int16_t _t_int16;
+     195             :                 uint16_t _t_uint16;
+     196             :                 int32_t _t_int32;
+     197             :                 uint32_t _t_uint32;
+     198             :                 int64_t _t_int64;
+     199             :                 uint64_t _t_uint64;
+     200             :                 float _t_float;
+     201             :                 double _t_double;
+     202             :                 long double _t_ldouble;
+     203             :                 complex_f* _t_complex_f;
+     204             :                 complex_d* _t_complex_d;
+     205             :                 std::string* _t_string;
+     206             :                 Vector3f* _t_vector3f;
+     207             :                 Vector3d* _t_vector3d;
+     208             :                 Vector3c* _t_vector3c;
+     209             :                 vector_t* _t_vector;
+     210             :         } data;
+     211             : 
+     212             : 
+     213             : public:
+     214             :         Variant();
+     215             :         Variant(Type t);
+     216             :         Variant(const Variant& v);
+     217             :         Variant(const char* s);
+     218             :         ~Variant();
+     219             :         inline Type getType() const {
+     220           2 :                 return type;
+     221             :         }
+     222             :         const char* getTypeName() const;
+     223             :         static const char* getTypeName(Type t);
+     224             :         const std::type_info& getTypeInfo() const;
+     225             :         static Type toType(const std::string& name);                
+     226             :         std::string toString(const std::string& delimiter = "\t") const;
+     227             :         std::complex<float> toComplexFloat() const;
+     228             :         std::complex<double> toComplexDouble() const;
+     229             :         Vector3f toVector3f() const;
+     230             :         Vector3d toVector3d() const;
+     231             :         Vector3c toVector3c() const;
+     232             :         vector_t toVector() const;
+     233             :         static Variant fromString(const std::string& str, Type type);
+     234             :         void clear(Type t = TYPE_NONE);
+     235             :         bool isValid() const;
+     236             :         size_t size() const;
+     237             :         size_t getSizeOf() const;
+     238             :         size_t getSize() const;
+     239             :         void resize(size_t i);
+     240             :         size_t copyToBuffer(void* buffer);
+     241           1 :         operator std::string() const {
+     242           2 :                 return toString();
+     243             :         }
+     244             :         Variant& operator=(const Variant& v);
+     245             :         bool operator==(const Variant& v) const;
+     246             :         bool operator!=(const Variant& v) const;
+     247             :         bool operator!=(const char* a) const;
+     248             :         Variant& operator[](size_t i);
+     249             :         inline Variant& operator[](int i) {
+     250             :                 return operator[]((size_t) i);
+     251             :         }
+     252             :         const Variant& operator[](size_t i) const;
+     253             :         const Variant& operator[](int i) const {
+     254             :                 return operator[]((size_t) i);
+     255             :         }
+     256             :         operator vector_t&();
+     257             :         operator const vector_t&() const;
+     258             : 
+     259             : 
+     260             :         template<class T>
+     261             :         T to() const {
+     262             :                 throw bad_conversion(type, TYPE_NONE);
+     263             :         }
+     264             : 
+     265             :         // automatically-generated functions    
+     266           6 :         VARIANT_ADD_TYPE_DECL_POD(Bool, TYPE_BOOL, bool, bool)
+     267           0 :         VARIANT_ADD_TYPE_DECL_POD(Char, TYPE_CHAR, char, char)
+     268           0 :         VARIANT_ADD_TYPE_DECL_POD(UChar, TYPE_UCHAR, unsigned char, uchar)
+     269           0 :         VARIANT_ADD_TYPE_DECL_POD(Int16, TYPE_INT16, int16_t, int16)
+     270           0 :         VARIANT_ADD_TYPE_DECL_POD(UInt16, TYPE_UINT16, uint16_t, uint16)
+     271          12 :         VARIANT_ADD_TYPE_DECL_POD(Int32, TYPE_INT32, int32_t, int32)
+     272           0 :         VARIANT_ADD_TYPE_DECL_POD(UInt32, TYPE_UINT32, uint32_t, uint32)
+     273           6 :         VARIANT_ADD_TYPE_DECL_POD(Int64, TYPE_INT64, int64_t, int64)
+     274          16 :         VARIANT_ADD_TYPE_DECL_POD(UInt64, TYPE_UINT64, uint64_t, uint64)
+     275           0 :         VARIANT_ADD_TYPE_DECL_POD(Float, TYPE_FLOAT, float, float)
+     276          34 :         VARIANT_ADD_TYPE_DECL_POD(Double, TYPE_DOUBLE, double, double)
+     277           0 :         VARIANT_ADD_TYPE_DECL_POD(LongDouble, TYPE_LONGDOUBLE, long double, ldouble)
+     278           0 :         VARIANT_ADD_TYPE_DECL_PTR(ComplexFloat, TYPE_COMPLEXF, std::complex<float>, complex_f)
+     279           1 :         VARIANT_ADD_TYPE_DECL_PTR(ComplexDouble, TYPE_COMPLEXD, std::complex<double>, complex_d)
+     280        3396 :         VARIANT_ADD_TYPE_DECL_PTR(String, TYPE_STRING, std::string, string)
+     281           0 :         VARIANT_ADD_TYPE_DECL_PTR(Vector3f, TYPE_VECTOR3F, Vector3f, vector3f)
+     282           1 :         VARIANT_ADD_TYPE_DECL_PTR(Vector3d, TYPE_VECTOR3D, Vector3d, vector3d)
+     283           1 :         VARIANT_ADD_TYPE_DECL_PTR(Vector3c, TYPE_VECTOR3C, Vector3c, vector3c)
+     284           2 :         VARIANT_ADD_TYPE_DECL_PTR(Vector, TYPE_VECTOR, vector_t, vector)
+     285             :         VARIANT_ADD_ITER_DECL_PTR(Vector, TYPE_VECTOR, vector)
+     286             :                 
+     287             : private:
+     288             :         void copy(const Variant& v);
+     289             :         void check(const Type t) const;
+     290             :         void check(const Type t);
+     291             : };
+     292             : 
+     293             : #define VARIANT_TO_DECL(NAME, VALUE) \
+     294             :         template<> inline VALUE Variant::to<VALUE>() const { \
+     295             :                 return to##NAME(); \
+     296             :         } \
+     297             : 
+     298             : // declare type conversion functions
+     299             : // not implemented for Vector3 and complex_*
+     300             : VARIANT_TO_DECL(Bool, bool)
+     301             : VARIANT_TO_DECL(Char, char)
+     302             : VARIANT_TO_DECL(UChar, unsigned char)
+     303             : VARIANT_TO_DECL(Int16, int16_t)
+     304             : VARIANT_TO_DECL(UInt16, uint16_t)
+     305             : VARIANT_TO_DECL(Int32, int32_t)
+     306             : VARIANT_TO_DECL(UInt32, uint32_t)
+     307             : VARIANT_TO_DECL(Int64, int64_t)
+     308             : VARIANT_TO_DECL(UInt64, uint64_t)
+     309             : VARIANT_TO_DECL(Float, float)
+     310             : VARIANT_TO_DECL(Double, double)
+     311             : VARIANT_TO_DECL(LongDouble, long double)
+     312             : VARIANT_TO_DECL(String, std::string)
+     313             : VARIANT_TO_DECL(Vector, Variant::vector_t)
+     314             : 
+     315             : std::ostream& operator <<(std::ostream& os, const Variant &v);
+     316             : 
+     317             : 
+     318             : /**
+     319             :  Taken from PXL
+     320             :  https://git.rwth-aachen.de/3pia/pxl/pxl/-/blob/master/core/include/pxl/core/Functions.hh
+     321             :  */
+     322             : template <class T> 
+     323           0 : inline void safeDelete(T*& p) {
+     324           0 :         if (p) {
+     325           0 :                 delete p;
+     326           0 :                 p = 0;
+     327             :         }
+     328           0 : }
+     329             : 
+     330             : 
+     331             : 
+     332             : } // namespace crpropa 
+     333             : 
+     334             : #endif // CRPROPA_VARIANT
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Vector3.h.func-sort-c.html b/doc/coverageReport/include/crpropa/Vector3.h.func-sort-c.html new file mode 100644 index 000000000..b44071763 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Vector3.h.func-sort-c.html @@ -0,0 +1,236 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Vector3.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Vector3.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:9915165.6 %
Date:2024-04-08 14:58:22Functions:164139.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa7Vector3IdE4setREd0
_ZN7crpropa7Vector3IdErMERKS1_0
_ZN7crpropa7Vector3IfE12setRThetaPhiEfff0
_ZN7crpropa7Vector3IfE4setREf0
_ZN7crpropa7Vector3IfErMERKS1_0
_ZN7crpropa7Vector3IfErMERKf0
_ZN7crpropalsISt7complexIdEEERSoS3_RKNS_7Vector3IT_EE0
_ZNK7crpropa7Vector3IdE4ceilEv0
_ZNK7crpropa7Vector3IdE4clipEdd0
_ZNK7crpropa7Vector3IdErmERKS1_0
_ZNK7crpropa7Vector3IdErmERKd0
_ZNK7crpropa7Vector3IfE10getRotatedERKS1_f0
_ZNK7crpropa7Vector3IfE13getDistanceToERKS1_0
_ZNK7crpropa7Vector3IfE13getParallelToERKS1_0
_ZNK7crpropa7Vector3IfE13getUnitVectorEv0
_ZNK7crpropa7Vector3IfE16getUnitVectorPhiEv0
_ZNK7crpropa7Vector3IfE18getPerpendicularToERKS1_0
_ZNK7crpropa7Vector3IfE18getUnitVectorThetaEv0
_ZNK7crpropa7Vector3IfE4ceilEv0
_ZNK7crpropa7Vector3IfE4clipEff0
_ZNK7crpropa7Vector3IfE5floorEv0
_ZNK7crpropa7Vector3IfE6getPhiEv0
_ZNK7crpropa7Vector3IfE8getThetaEv0
_ZNK7crpropa7Vector3IfErmERKS1_0
_ZNK7crpropa7Vector3IfErmERKf0
_ZN7crpropa7Vector3IdErMERKd1
_ZNK7crpropa7Vector3IdE18getPerpendicularToERKS1_1
_ZNK7crpropa7Vector3IdE18getUnitVectorThetaEv1
_ZNK7crpropa7Vector3IdE13getParallelToERKS1_2
_ZN7crpropa7Vector3IdE12setRThetaPhiEddd3
_ZNK7crpropa7Vector3IdE16getUnitVectorPhiEv4
_ZNK7crpropa7Vector3IdE5floorEv6
_ZNK7crpropa7Vector3IdE10getAngleToERKS1_8
_ZNK7crpropa7Vector3IdE8getThetaEv8
_ZN7crpropalsIdEERSoS1_RKNS_7Vector3IT_EE11
_ZNK7crpropa7Vector3IdE6getPhiEv19
_ZN7crpropalsIfEERSoS1_RKNS_7Vector3IT_EE27
_ZNK7crpropa7Vector3IdE13getDistanceToERKS1_110
_ZNK7crpropa7Vector3IdE10getRotatedERKS1_d481006
_ZNK7crpropa7Vector3IfE10getAngleToERKS1_691017
_ZNK7crpropa7Vector3IdE13getUnitVectorEv7201361
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Vector3.h.func.html b/doc/coverageReport/include/crpropa/Vector3.h.func.html new file mode 100644 index 000000000..8b3511c68 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Vector3.h.func.html @@ -0,0 +1,236 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Vector3.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Vector3.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:9915165.6 %
Date:2024-04-08 14:58:22Functions:164139.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa7Vector3IdE12setRThetaPhiEddd3
_ZN7crpropa7Vector3IdE4setREd0
_ZN7crpropa7Vector3IdErMERKS1_0
_ZN7crpropa7Vector3IdErMERKd1
_ZN7crpropa7Vector3IfE12setRThetaPhiEfff0
_ZN7crpropa7Vector3IfE4setREf0
_ZN7crpropa7Vector3IfErMERKS1_0
_ZN7crpropa7Vector3IfErMERKf0
_ZN7crpropalsISt7complexIdEEERSoS3_RKNS_7Vector3IT_EE0
_ZN7crpropalsIdEERSoS1_RKNS_7Vector3IT_EE11
_ZN7crpropalsIfEERSoS1_RKNS_7Vector3IT_EE27
_ZNK7crpropa7Vector3IdE10getAngleToERKS1_8
_ZNK7crpropa7Vector3IdE10getRotatedERKS1_d481006
_ZNK7crpropa7Vector3IdE13getDistanceToERKS1_110
_ZNK7crpropa7Vector3IdE13getParallelToERKS1_2
_ZNK7crpropa7Vector3IdE13getUnitVectorEv7201361
_ZNK7crpropa7Vector3IdE16getUnitVectorPhiEv4
_ZNK7crpropa7Vector3IdE18getPerpendicularToERKS1_1
_ZNK7crpropa7Vector3IdE18getUnitVectorThetaEv1
_ZNK7crpropa7Vector3IdE4ceilEv0
_ZNK7crpropa7Vector3IdE4clipEdd0
_ZNK7crpropa7Vector3IdE5floorEv6
_ZNK7crpropa7Vector3IdE6getPhiEv19
_ZNK7crpropa7Vector3IdE8getThetaEv8
_ZNK7crpropa7Vector3IdErmERKS1_0
_ZNK7crpropa7Vector3IdErmERKd0
_ZNK7crpropa7Vector3IfE10getAngleToERKS1_691017
_ZNK7crpropa7Vector3IfE10getRotatedERKS1_f0
_ZNK7crpropa7Vector3IfE13getDistanceToERKS1_0
_ZNK7crpropa7Vector3IfE13getParallelToERKS1_0
_ZNK7crpropa7Vector3IfE13getUnitVectorEv0
_ZNK7crpropa7Vector3IfE16getUnitVectorPhiEv0
_ZNK7crpropa7Vector3IfE18getPerpendicularToERKS1_0
_ZNK7crpropa7Vector3IfE18getUnitVectorThetaEv0
_ZNK7crpropa7Vector3IfE4ceilEv0
_ZNK7crpropa7Vector3IfE4clipEff0
_ZNK7crpropa7Vector3IfE5floorEv0
_ZNK7crpropa7Vector3IfE6getPhiEv0
_ZNK7crpropa7Vector3IfE8getThetaEv0
_ZNK7crpropa7Vector3IfErmERKS1_0
_ZNK7crpropa7Vector3IfErmERKf0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/Vector3.h.gcov.html b/doc/coverageReport/include/crpropa/Vector3.h.gcov.html new file mode 100644 index 000000000..f1fbcd9c0 --- /dev/null +++ b/doc/coverageReport/include/crpropa/Vector3.h.gcov.html @@ -0,0 +1,516 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/Vector3.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa - Vector3.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:9915165.6 %
Date:2024-04-08 14:58:22Functions:164139.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_VECTOR3_H
+       2             : #define CRPROPA_VECTOR3_H
+       3             : 
+       4             : #include <iostream>
+       5             : #include <cmath>
+       6             : #include <vector>
+       7             : #include <limits>
+       8             : #include <algorithm>
+       9             : 
+      10             : namespace crpropa {
+      11             : 
+      12             : /**
+      13             :  * \addtogroup Core
+      14             :  * @{
+      15             :  */
+      16             : 
+      17             : /**
+      18             :  @class Vector3
+      19             :  @brief Template class for 3-vectors of type float, double, ...
+      20             : 
+      21             :  Allows accessing and changing the elements x, y, z directly or  through the
+      22             :  corresponding get and set methods.
+      23             : 
+      24             :  Angle definitions are
+      25             :  phi [-pi, pi]: azimuthal angle in the x-y plane, 0 pointing in x-direction
+      26             :  theta [0, pi]: zenith angle towards the z axis, 0 pointing in z-direction
+      27             :  */
+      28             : template<typename T>
+      29             : class Vector3 {
+      30             : public:
+      31             :         union {
+      32             :                 struct
+      33             :                 {
+      34             :                         T x;
+      35             :                         T y;
+      36             :                         T z;
+      37             :                 };
+      38             :                 T data[3];
+      39             :         };
+      40             : 
+      41     3187045 :         Vector3() : data{0., 0., 0.} {
+      42             :         }
+      43             : 
+      44             :         // avoid creation of default non-conversion constructor
+      45    20387451 :         Vector3(const Vector3 &v) : data{v.data[0], v.data[1], v.data[2]} {
+      46           0 :         }
+      47             : 
+      48             :         // Provides implicit conversion
+      49             :         template<typename U>
+      50           0 :         Vector3(const Vector3<U> &v) {
+      51          14 :                 data[0] = v.x;
+      52           4 :                 data[1] = v.y;
+      53           4 :                 data[2] = v.z;
+      54           0 :         }
+      55             : 
+      56             :         ~Vector3()
+      57             :         {
+      58    26216757 :         }
+      59             : 
+      60           0 :         explicit Vector3(const double *v) {
+      61           0 :                 data[0] = v[0];
+      62           0 :                 data[1] = v[1];
+      63           0 :                 data[2] = v[2];
+      64             :         }
+      65             : 
+      66           0 :         explicit Vector3(const float *v) {
+      67           0 :                 data[0] = v[0];
+      68           0 :                 data[1] = v[1];
+      69           0 :                 data[2] = v[2];
+      70             :         }
+      71             : 
+      72    12617888 :         explicit Vector3(const T &X, const T &Y, const T &Z) : data{X, Y, Z} {
+      73             :         }
+      74             : 
+      75    18504508 :         explicit Vector3(T t) : data{t, t, t} {
+      76           1 :         }
+      77             : 
+      78             :         void setX(const T X) {
+      79           1 :                 x = X;
+      80             :         }
+      81             : 
+      82             :         void setY(const T Y) {
+      83           0 :                 y = Y;
+      84             :         }
+      85             : 
+      86             :         void setZ(const T Z) {
+      87           0 :                 z = Z;
+      88             :         }
+      89             : 
+      90             :         void setXYZ(const T X, const T Y, const T Z) {
+      91     1351680 :                 x = X;
+      92     1351680 :                 y = Y;
+      93     1351680 :                 z = Z;
+      94             :         }
+      95             : 
+      96           0 :         void setR(const T r) {
+      97           0 :                 *this *= r / getR();
+      98           0 :         }
+      99             : 
+     100           3 :         void setRThetaPhi(const T r, const T theta, const T phi) {
+     101           3 :                 x = r * sin(theta) * cos(phi);
+     102           3 :                 y = r * sin(theta) * sin(phi);
+     103           3 :                 z = r * cos(theta);
+     104           3 :         }
+     105             : 
+     106             :         T getX() const {
+     107      370007 :                 return x;
+     108             :         }
+     109             : 
+     110             :         T getY() const {
+     111      370006 :                 return y;
+     112             :         }
+     113             : 
+     114             :         T getZ() const {
+     115       40006 :                 return z;
+     116             :         }
+     117             : 
+     118             :         // magnitude (2-norm) of the vector
+     119             :         T getR() const {
+     120    25099477 :                 return std::sqrt(x * x + y * y + z * z);
+     121             :         }
+     122             : 
+     123             :         // square of magnitude of the vector
+     124             :         T getR2() const {
+     125     2883584 :                 return x * x + y * y + z * z;
+     126             :         }
+     127             : 
+     128             :         // return the azimuth angle
+     129          19 :         T getPhi() const {
+     130             :                 T eps = std::numeric_limits < T > ::min();
+     131          19 :                 if ((fabs(x) < eps) && (fabs(y) < eps))
+     132             :                         return 0.0;
+     133             :                 else
+     134          18 :                         return std::atan2(y, x);
+     135             :         }
+     136             : 
+     137             :         // return the zenith angle
+     138           8 :         T getTheta() const {
+     139             :                 T eps = std::numeric_limits < T > ::min();
+     140           8 :                 if ((fabs(x) < eps) && (fabs(y) < eps) && (fabs(z) < eps))
+     141             :                         return 0.0;
+     142             :                 else
+     143           8 :                         return atan2((T) sqrt(x * x + y * y), z);
+     144             :         }
+     145             : 
+     146             :         // return the unit-vector e_r
+     147     7201361 :         Vector3<T> getUnitVector() const {
+     148     7201361 :                 return *this / getR();
+     149             :         }
+     150             : 
+     151             :         // return the unit-vector e_theta
+     152           1 :         Vector3<T> getUnitVectorTheta() const {
+     153           1 :                 T theta = getTheta();
+     154           1 :                 T phi = getPhi();
+     155           1 :                 return Vector3<T>(cos(theta) * cos(phi), cos(theta) * sin(phi),
+     156           1 :                                 -sin(theta));
+     157             :         }
+     158             : 
+     159             :         // return the unit-vector e_phi
+     160           4 :         Vector3<T> getUnitVectorPhi() const {
+     161           4 :                 return Vector3<T>(-sin(getPhi()), cos(getPhi()), 0);
+     162             :         }
+     163             : 
+     164             :         // return the angle [0, pi] between the vectors
+     165      691025 :         T getAngleTo(const Vector3<T> &v) const {
+     166      691025 :                 T cosdistance = dot(v) / v.getR() / getR();
+     167             :                 // In some directions cosdistance is > 1 on some compilers
+     168             :                 // This ensures that the correct result is returned
+     169      691025 :                 if (cosdistance >= 1.)
+     170             :                         return 0;
+     171      690880 :                 else if (cosdistance <= -1.)
+     172             :                         return M_PI;
+     173             :                 else
+     174      690880 :                         return acos(cosdistance);
+     175             :         }
+     176             : 
+     177             :         // return true if the angle between the vectors is smaller than a threshold
+     178             :         bool isParallelTo(const Vector3<T> &v, T maxAngle) const {
+     179      691017 :                 return getAngleTo(v) < maxAngle;
+     180             :         }
+     181             : 
+     182             :         // linear distance to a given vector
+     183         110 :         T getDistanceTo(const Vector3<T> &point) const {
+     184             :                 Vector3<T> d = *this - point;
+     185         110 :                 return d.getR();
+     186             :         }
+     187             : 
+     188             :         // return the component parallel to a second vector
+     189             :         // 0 if the second vector has 0 magnitude
+     190           2 :         Vector3<T> getParallelTo(const Vector3<T> &v) const {
+     191             :                 T vmag = v.getR();
+     192           2 :                 if (vmag == std::numeric_limits < T > ::min())
+     193             :                         return Vector3<T>(0.);
+     194             :                 return v * dot(v) / vmag;
+     195             :         }
+     196             : 
+     197             :         // return the component perpendicular to a second vector
+     198             :         // 0 if the second vector has 0 magnitude
+     199           1 :         Vector3<T> getPerpendicularTo(const Vector3<T> &v) const {
+     200           1 :                 if (v.getR() == std::numeric_limits < T > ::min())
+     201             :                         return Vector3<T>(0.);
+     202           1 :                 return (*this) - getParallelTo(v);
+     203             :         }
+     204             : 
+     205             :         // rotate the vector around a given axis by a given angle
+     206      481006 :         Vector3<T> getRotated(const Vector3<T> &axis, T angle) const {
+     207             :                 Vector3<T> u = axis;
+     208      481006 :                 if (u.getR() != 0.)
+     209             :                         u = u / u.getR();
+     210      481006 :                 T c = cos(angle);
+     211      481006 :                 T s = sin(angle);
+     212      481006 :                 Vector3<T> Rx(c + u.x * u.x * (1 - c), u.x * u.y * (1 - c) - u.z * s,
+     213      481006 :                                 u.x * u.z * (1 - c) + u.y * s);
+     214      481006 :                 Vector3<T> Ry(u.y * u.x * (1 - c) + u.z * s, c + u.y * u.y * (1 - c),
+     215      481006 :                                 u.y * u.z * (1 - c) - u.x * s);
+     216      481006 :                 Vector3<T> Rz(u.z * u.x * (1 - c) - u.y * s,
+     217      481006 :                                 u.z * u.y * (1 - c) + u.x * s, c + u.z * u.z * (1 - c));
+     218      481006 :                 return Vector3<T>(dot(Rx), dot(Ry), dot(Rz));
+     219             :         }
+     220             : 
+     221             :         // return vector with values limited to the range [lower, upper]
+     222           0 :         Vector3<T> clip(T lower, T upper) const {
+     223             :                 Vector3<T> out;
+     224           0 :                 out.x = std::max(lower, std::min(x, upper));
+     225           0 :                 out.y = std::max(lower, std::min(y, upper));
+     226           0 :                 out.z = std::max(lower, std::min(z, upper));
+     227           0 :                 return out;
+     228             :         }
+     229             : 
+     230             :         // return vector with absolute values
+     231             :         Vector3<T> abs() const {
+     232           0 :                 return Vector3<T>(std::abs(x), std::abs(y), std::abs(z));
+     233             :         }
+     234             : 
+     235             :         // return vector with floored values
+     236           6 :         Vector3<T> floor() const {
+     237           6 :                 return Vector3<T>(std::floor(x), std::floor(y), std::floor(z));
+     238             :         }
+     239             : 
+     240             :         // return vector with ceiled values
+     241           0 :         Vector3<T> ceil() const {
+     242           0 :                 return Vector3<T>(std::ceil(x), std::ceil(y), std::ceil(z));
+     243             :         }
+     244             : 
+     245             :         // minimum element
+     246             :         T min() const {
+     247           4 :                 return std::min(x, std::min(y, z));
+     248             :         }
+     249             : 
+     250             :         // maximum element
+     251             :         T max() const {
+     252           4 :                 return std::max(x, std::max(y, z));
+     253             :         }
+     254             : 
+     255             :         // dot product
+     256             :         T dot(const Vector3<T> &v) const {
+     257      692583 :                 return x * v.x + y * v.y + z * v.z;
+     258             :         }
+     259             : 
+     260             :         // cross product
+     261             :         Vector3<T> cross(const Vector3<T> &v) const {
+     262     2132230 :                 return Vector3<T>(y * v.z - v.y * z, z * v.x - v.z * x,
+     263     1652230 :                                 x * v.y - v.x * y);
+     264             :         }
+     265             : 
+     266             :         // returns true if all elements of the two vectors are equal
+     267             :         bool operator ==(const Vector3<T> &v) const {
+     268          33 :                 if (x != v.x)
+     269             :                         return false;
+     270          33 :                 if (y != v.y)
+     271             :                         return false;
+     272          33 :                 if (z != v.z)
+     273           0 :                         return false;
+     274             :                 return true;
+     275             :         }
+     276             : 
+     277             :         Vector3<T> operator +(const Vector3<T> &v) const {
+     278     4339186 :                 return Vector3(x + v.x, y + v.y, z + v.z);
+     279             :         }
+     280             : 
+     281             :         Vector3<T> operator +(const T &f) const {
+     282           0 :                 return Vector3(x + f, y + f, z + f);
+     283             :         }
+     284             : 
+     285             :         Vector3<T> operator -(const Vector3<T> &v) const {
+     286     7533903 :                 return Vector3(x - v.x, y - v.y, z - v.z);
+     287             :         }
+     288             : 
+     289             :         Vector3<T> operator -(const T &f) const {
+     290           0 :                 return Vector3(x - f, y - f, z - f);
+     291             :         }
+     292             : 
+     293             :         // element-wise multiplication
+     294             :         Vector3<T> operator *(const Vector3<T> &v) const {
+     295          20 :                 return Vector3(x * v.x, y * v.y, z * v.z);
+     296             :         }
+     297             : 
+     298             :         Vector3<T> operator *(T v) const {
+     299     1191262 :                 return Vector3(data[0] * v, data[1] * v, data[2] * v);
+     300             :         }
+     301             : 
+     302             :         // element-wise division
+     303             :         Vector3<T> operator /(const Vector3<T> &v) const {
+     304      100097 :                 return Vector3(x / v.x, y / v.y, z / v.z);
+     305             :         }
+     306             : 
+     307             :         Vector3<T> operator /(const T &f) const {
+     308     6242639 :                 return Vector3(x / f, y / f, z / f);
+     309             :         }
+     310             : 
+     311             :         // element-wise modulo operation
+     312           0 :         Vector3<T> operator %(const Vector3<T> &v) const {
+     313           0 :                 return Vector3(fmod(x, v.x), fmod(y, v.y), fmod(z, v.z));
+     314             :         }
+     315             : 
+     316           0 :         Vector3<T> operator %(const T &f) const {
+     317           0 :                 return Vector3(fmod(x, f), fmod(y, f), fmod(z, f));
+     318             :         }
+     319             : 
+     320             :         Vector3<T> &operator -=(const Vector3<T> &v) {
+     321           0 :                 data[0] -= v.x;
+     322           0 :                 data[1] -= v.y;
+     323           0 :                 data[2] -= v.z;
+     324             :                 return *this;
+     325             :         }
+     326             : 
+     327             :         Vector3<T> &operator -=(const T &f) {
+     328           0 :                 data[0] -= f;
+     329           0 :                 data[1] -= f;
+     330           0 :                 data[2] -= f;
+     331             :                 return *this;
+     332             :         }
+     333             : 
+     334             :         Vector3<T> &operator +=(const Vector3<T> &v) {
+     335    20664839 :                 data[0] += v.x;
+     336    20664839 :                 data[1] += v.y;
+     337    20544720 :                 data[2] += v.z;
+     338             :                 return *this;
+     339             :         }
+     340             : 
+     341             :         Vector3<T> &operator +=(const T &f) {
+     342           0 :                 data[0] += f;
+     343           0 :                 data[1] += f;
+     344           0 :                 data[2] += f;
+     345             :                 return *this;
+     346             :         }
+     347             : 
+     348             :         // element-wise multiplication
+     349             :         Vector3<T> &operator *=(const Vector3<T> &v) {
+     350           0 :                 data[0] *= v.x;
+     351           0 :                 data[1] *= v.y;
+     352           0 :                 data[2] *= v.z;
+     353             :                 return *this;
+     354             :         }
+     355             : 
+     356             :         Vector3<T> &operator *=(const T &f) {
+     357     3312538 :                 data[0] *= f;
+     358     3312538 :                 data[1] *= f;
+     359     3312538 :                 data[2] *= f;
+     360             :                 return *this;
+     361             :         }
+     362             : 
+     363             :         // element-wise division
+     364             :         Vector3<T> &operator /=(const Vector3<T> &v) {
+     365           0 :                 data[0] /= v.x;
+     366           0 :                 data[1] /= v.y;
+     367           0 :                 data[2] /= v.z;
+     368             :                 return *this;
+     369             :         }
+     370             : 
+     371             :         Vector3<T> &operator /=(const T &f) {
+     372      691019 :                 data[0] /= f;
+     373      691019 :                 data[1] /= f;
+     374      691019 :                 data[2] /= f;
+     375             :                 return *this;
+     376             :         }
+     377             : 
+     378             :         // element-wise modulo operation
+     379           0 :         Vector3<T> &operator %=(const Vector3<T> &v) {
+     380           0 :                 data[0] = fmod(x, v.x);
+     381           0 :                 data[1] = fmod(y, v.y);
+     382           0 :                 data[2] = fmod(z, v.z);
+     383           0 :                 return *this;
+     384             :         }
+     385             : 
+     386           1 :         Vector3<T> &operator %=(const T &f) {
+     387           1 :                 data[0] = fmod(x, f);
+     388           1 :                 data[1] = fmod(y, f);
+     389           1 :                 data[2] = fmod(z, f);
+     390           1 :                 return *this;
+     391             :         }
+     392             : 
+     393             :         Vector3<T> &operator =(const Vector3<T> &v) {
+     394    64125712 :                 data[0] = v.x;
+     395    64125726 :                 data[1] = v.y;
+     396    63640105 :                 data[2] = v.z;
+     397           0 :                 return *this;
+     398             :         }
+     399             : 
+     400             :         //Vector3<T> &operator =(Vector3<T> &&v) noexcept {
+     401             :         //      data[0] = v.data[0];
+     402             :         //      data[1] = v.data[1];
+     403             :         //      data[2] = v.data[2];
+     404             :         //      return *this;
+     405             :         //}
+     406             : 
+     407             :         Vector3<T> &operator =(const T &f) {
+     408             :                 data[0] = f;
+     409             :                 data[1] = f;
+     410             :                 data[2] = f;
+     411             :                 return *this;
+     412             :         }
+     413             : };
+     414             : 
+     415             : #ifndef SWIG
+     416             : template<typename T>
+     417          38 : inline std::ostream &operator <<(std::ostream &out, const Vector3<T> &v) {
+     418         114 :         out << v.x << " " << v.y << " " << v.z;
+     419          38 :         return out;
+     420             : }
+     421             : 
+     422             : template<typename T>
+     423             : inline std::istream &operator >>(std::istream &in, Vector3<T> &v) {
+     424             :         in >> v.x >> v.y >> v.z;
+     425             :         return in;
+     426             : }
+     427             : #endif
+     428             : 
+     429             : template<typename T>
+     430             : inline Vector3<T> operator *(T f, const Vector3<T> &v) {
+     431     3628978 :         return Vector3<T>(v.x * f, v.y * f, v.z * f);
+     432             : }
+     433             : 
+     434             : typedef Vector3<double> Vector3d;
+     435             : typedef Vector3<float> Vector3f;
+     436             : 
+     437             : /** @}*/
+     438             : }  // namespace crpropa
+     439             : 
+     440             : #endif  // CRPROPA_VECTOR3_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/advectionField/AdvectionField.h.func-sort-c.html b/doc/coverageReport/include/crpropa/advectionField/AdvectionField.h.func-sort-c.html new file mode 100644 index 000000000..429d191a5 --- /dev/null +++ b/doc/coverageReport/include/crpropa/advectionField/AdvectionField.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/advectionField/AdvectionField.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/advectionField - AdvectionField.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:55100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/advectionField/AdvectionField.h.func.html b/doc/coverageReport/include/crpropa/advectionField/AdvectionField.h.func.html new file mode 100644 index 000000000..74fd9621e --- /dev/null +++ b/doc/coverageReport/include/crpropa/advectionField/AdvectionField.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/advectionField/AdvectionField.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/advectionField - AdvectionField.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:55100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/advectionField/AdvectionField.h.gcov.html b/doc/coverageReport/include/crpropa/advectionField/AdvectionField.h.gcov.html new file mode 100644 index 000000000..4be5bf68f --- /dev/null +++ b/doc/coverageReport/include/crpropa/advectionField/AdvectionField.h.gcov.html @@ -0,0 +1,367 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/advectionField/AdvectionField.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/advectionField - AdvectionField.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:55100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_ADVECTIONFIELD_H
+       2             : #define CRPROPA_ADVECTIONFIELD_H
+       3             : 
+       4             : 
+       5             : #include <string>
+       6             : #include <iostream>
+       7             : #include <cmath>
+       8             : #include <cstdlib>
+       9             : #include <sstream>
+      10             : 
+      11             : #include "crpropa/Vector3.h"
+      12             : #include "crpropa/Referenced.h"
+      13             : #include "crpropa/Units.h"
+      14             : 
+      15             : namespace crpropa {
+      16             : 
+      17             : /**
+      18             :  @class AdvectionField
+      19             :  @brief Abstract base class for advection fields. These are used to model 
+      20             :         the deterministic part of the Fokker-Planck equation. The getDivergence()
+      21             :         method is used to model the adibatic cooling/heating.
+      22             :  */
+      23             : class AdvectionField: public Referenced {
+      24             : public:
+      25             :         virtual ~AdvectionField() {
+      26             :         }
+      27             :         virtual Vector3d getField(const Vector3d &position) const = 0;
+      28             :         virtual double getDivergence(const Vector3d &position) const = 0;
+      29             : };
+      30             : 
+      31             : 
+      32             : /**
+      33             :  @class AdvectionFieldList
+      34             :  @brief Advection field decorator implementing a superposition of fields.
+      35             :  */
+      36           2 : class AdvectionFieldList: public AdvectionField {
+      37             :         std::vector<ref_ptr<AdvectionField> > fields;
+      38             : public:
+      39             :         void addField(ref_ptr<AdvectionField> field);
+      40             :         Vector3d getField(const Vector3d &position) const;
+      41             :         double getDivergence(const Vector3d &position) const;
+      42             : };
+      43             : 
+      44             : 
+      45             : /**
+      46             :  @class UniformAdvectionField
+      47             :  @brief Advection field with one velocity/advection-field vector.
+      48             :  */
+      49           1 : class UniformAdvectionField: public AdvectionField {
+      50             :         Vector3d value;
+      51             : public:
+      52             :         UniformAdvectionField(const Vector3d &value);
+      53             :         Vector3d getField(const Vector3d &position) const;
+      54             :         double getDivergence(const Vector3d &position) const;
+      55             : 
+      56             :         std::string getDescription() const;
+      57             : };
+      58             : 
+      59             : 
+      60             : /**
+      61             : @class ConstantSphericalAdvectionField
+      62             : @brief Spherical advection field with a constant wind speed
+      63             : */
+      64             : 
+      65           1 : class ConstantSphericalAdvectionField: public AdvectionField {
+      66             :         Vector3d origin; //origin of the advection sphere
+      67             :         double vWind; // wind velocity
+      68             : public:
+      69             :         /** Constructor
+      70             :          @param origin  Origin of the advection field
+      71             :          @param vWind   Constant wind velocity
+      72             : 
+      73             : */
+      74             : 
+      75             :         ConstantSphericalAdvectionField(const Vector3d origin, double vWind);
+      76             :         Vector3d getField(const Vector3d &position) const;
+      77             :         double getDivergence(const Vector3d &position) const;
+      78             : 
+      79             :         void setOrigin(const Vector3d origin);
+      80             :         void setVWind(double vMax);
+      81             : 
+      82             :         Vector3d getOrigin() const;
+      83             :         double getVWind() const;
+      84             : 
+      85             :         std::string getDescription() const;
+      86             : 
+      87             :         
+      88             : };
+      89             :         
+      90             : /**
+      91             :  @class SphericalAdvectionField
+      92             :  @brief Spherical advection with a exponentially increasing and
+      93             :         exponentially constant velocity.
+      94             : */
+      95             : 
+      96           1 : class SphericalAdvectionField: public AdvectionField {
+      97             :         Vector3d origin; //origin of the advection sphere
+      98             :         double radius; //radius of the advection sphere
+      99             :         double vMax; // maximum wind velocity
+     100             :         double tau; // transition distance
+     101             :         double alpha; //tuning parameter
+     102             : public:
+     103             :         /** Constructor
+     104             :         @param origin   Origin of the advection sphere
+     105             :         @param radius   Radius of the advection sphere
+     106             :         @param vMax     Maximum wind velocity
+     107             :         @param tau      Transition distance
+     108             :         @param alpha    Tuning parameter
+     109             : */
+     110             :         SphericalAdvectionField(const Vector3d origin, double radius, double vMax, double tau, double alpha);
+     111             :         Vector3d getField(const Vector3d &position) const;
+     112             :         double getDivergence(const Vector3d &position) const;
+     113             : 
+     114             :         double getV(const double &r) const;
+     115             : 
+     116             :         void setOrigin(const Vector3d origin);
+     117             :         void setRadius(double radius);
+     118             :         void setVMax(double vMax);
+     119             :         void setTau(double tau);
+     120             :         void setAlpha(double alpha);
+     121             : 
+     122             :         Vector3d getOrigin() const;
+     123             :         double getRadius() const;
+     124             :         double getVMax() const;
+     125             :         double getTau() const;
+     126             :         double getAlpha() const;
+     127             :         
+     128             :         std::string getDescription() const;
+     129             : };
+     130             : 
+     131             : /**
+     132             :  @class OneDimensionalCartesianShock
+     133             :  @brief Advection field in x-direction with shock at x = 0 and width lShock approximated by tanh() 
+     134             :                 with variable compression ratio vUp/vDown
+     135             :  */
+     136             : class OneDimensionalCartesianShock: public AdvectionField {
+     137             :         double compressionRatio; //compression ratio of shock
+     138             :         double vUp; //upstream velocity 
+     139             :         double lShock; //shock width
+     140             : public:
+     141             : /** Constructor
+     142             :         @param compressionRatio //compression ratio of shock
+     143             :         @param vUp //upstream velocity 
+     144             :         @param lShock //shock width
+     145             : */
+     146             :         OneDimensionalCartesianShock(double compressionRatio, double vUp, double lShock);
+     147             :         Vector3d getField(const Vector3d &position) const;
+     148             :         double getDivergence(const Vector3d &position) const;
+     149             : 
+     150             :         void setComp(double compressionRatio);
+     151             :         void setVup(double vUp);
+     152             :         void setShockwidth(double lShock);
+     153             : 
+     154             :         double getComp() const;
+     155             :         double getVup() const; 
+     156             :         double getShockwidth() const;
+     157             : 
+     158             :         std::string getDescription() const;
+     159             : };
+     160             : 
+     161             : /**
+     162             :  @class OneDimensionalSphericalShock
+     163             :  @brief Advection field in x-direction with shock at rShock and width lShock approximated by tanh() 
+     164             :                 with variable compression ratio ratio vUp/vDown
+     165             :  */
+     166             : class OneDimensionalSphericalShock: public AdvectionField {
+     167             :         double compressionRatio;        //compression ratio of shock
+     168             :         double vUp;     //upstream velocity 
+     169             :         double lShock;  //shock width
+     170             :         double rShock;  //shock radius
+     171             :         bool coolUpstream;      //flag for upstream cooling
+     172             : public:
+     173             : /** Constructor
+     174             :         @param compressionRatio //compression ratio of shock
+     175             :         @param vUp      //upstream velocity 
+     176             :         @param lShock   //shock width
+     177             :         @param rShock   //shock radius
+     178             :         @param coolUpstream //flag for upstream cooling
+     179             : */
+     180             :         OneDimensionalSphericalShock(double rShock, double vUp, double compressionRatio, double lShock, bool coolUpstream);
+     181             :         Vector3d getField(const Vector3d &position) const;
+     182             :         double getDivergence(const Vector3d &position) const;
+     183             : 
+     184             :         void setComp(double compressionRatio);
+     185             :         void setVup(double vUp);
+     186             :         void setShockwidth(double lShock);
+     187             :         void setShockRadius(double rShock);
+     188             :         void setCooling(bool coolUpstream);
+     189             : 
+     190             :         double getComp() const; 
+     191             :         double getVup() const;
+     192             :         double getShockwidth() const;
+     193             :         double getShockRadius() const;
+     194             :         bool getCooling() const;
+     195             : 
+     196             :         std::string getDescription() const;
+     197             : };
+     198             : 
+     199             : /**
+     200             :  @class ObliqueAdvectionShock
+     201             :  @brief Advection field in x-y-direction with shock at x = 0 and width x_sh approximated by tanh() 
+     202             :                 with variable compression ratio r_comp = vx_up/vx_down. The y component vy is not shocked 
+     203             :                 and remains constant. 
+     204             :  */
+     205             : class ObliqueAdvectionShock: public AdvectionField {
+     206             :         double compressionRatio; //compression ratio of shock
+     207             :         double vXUp; //upstream velocity x-component
+     208             :         double vY; //constant velocity y-component
+     209             :         double lShock; //shock width
+     210             :         
+     211             : public:
+     212             : /** Constructor
+     213             :         @param compressionRatio //compression ratio of shock
+     214             :         @param vXUp //upstream velocity x-component
+     215             :         @param vY //constant velocity y-component
+     216             :         @param lShock //shock width
+     217             :         
+     218             : */
+     219             :         ObliqueAdvectionShock(double compressionRatio, double vXUp, double vY, double lShock);
+     220             :         Vector3d getField(const Vector3d &position) const;
+     221             :         double getDivergence(const Vector3d &position) const;
+     222             : 
+     223             :         void setComp(double compressionRatio);
+     224             :         void setVup(double vXUp);
+     225             :         void setVy(double vY);
+     226             :         void setShockwidth(double lShock);
+     227             : 
+     228             :         double getComp() const; 
+     229             :         double getVup() const;
+     230             :         double getVy() const;
+     231             :         double getShockwidth() const;
+     232             :         
+     233             :         std::string getDescription() const;
+     234             : };
+     235             : 
+     236             : /**
+     237             :  @class SphericalAdvectionShock
+     238             :  @brief Spherical advection with a constant velocity for r<r_0
+     239             :         at the the shock the velocity drops to v_0/4. followed by
+     240             :         a decrease proportional to 1/r^2.
+     241             : */
+     242             : 
+     243           1 : class SphericalAdvectionShock: public AdvectionField {
+     244             :         Vector3d origin; // origin of the advection sphere
+     245             :         double r_0; // position of the shock
+     246             :         double v_0; // constant velocity
+     247             :         double lambda; //transition width
+     248             :         double r_rot; // normalization radius for rotation speed
+     249             :         double v_phi; // rotation speed at r_rot
+     250             : 
+     251             : public:
+     252             :         /** Constructor
+     253             :         @param origin   Origin of the advection sphere
+     254             :         @param r_0      Position of the shock
+     255             :         @param v_0      Constant velocity (r<<r_o)
+     256             :         @param lambda   Transition width / width of the shock
+     257             : */
+     258             :         SphericalAdvectionShock(const Vector3d origin, double r_0, double v_0, double lambda);
+     259             : 
+     260             :         Vector3d getField(const Vector3d &position) const;
+     261             :         double getDivergence(const Vector3d &position) const;
+     262             : 
+     263             :         double g(double R) const;
+     264             :         double g_prime(double R) const;
+     265             : 
+     266             :         void setOrigin(const Vector3d Origin);
+     267             :         void setR0(double r);
+     268             :         void setV0(double v);
+     269             :         void setLambda(double l);
+     270             :         void setRRot(double r);
+     271             :         void setAzimuthalSpeed(double vPhi);
+     272             : 
+     273             :         Vector3d getOrigin() const;
+     274             :         double getR0() const;
+     275             :         double getV0() const;
+     276             :         double getLambda() const;
+     277             :         /**
+     278             :          * @param r Normalization radius for rotation speed
+     279             :         */      
+     280             :         double getRRot() const;
+     281             :         /**
+     282             :          * @param vPhi  Rotation speed at r_rot
+     283             :         */      
+     284             :         double getAzimuthalSpeed() const;
+     285             : 
+     286             :         std::string getDescription() const;
+     287             : };
+     288             : 
+     289             : } // namespace crpropa
+     290             : 
+     291             : #endif // CRPROPA_ADVECTIONFIELD_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/advectionField/index-sort-f.html b/doc/coverageReport/include/crpropa/advectionField/index-sort-f.html new file mode 100644 index 000000000..4f7addbb4 --- /dev/null +++ b/doc/coverageReport/include/crpropa/advectionField/index-sort-f.html @@ -0,0 +1,93 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/advectionField + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/advectionFieldHitTotalCoverage
Test:coverage.info.cleanedLines:55100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
AdvectionField.h +
100.0%
+
100.0 %5 / 5-0 / 0
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/advectionField/index-sort-l.html b/doc/coverageReport/include/crpropa/advectionField/index-sort-l.html new file mode 100644 index 000000000..dd1aafc93 --- /dev/null +++ b/doc/coverageReport/include/crpropa/advectionField/index-sort-l.html @@ -0,0 +1,93 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/advectionField + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/advectionFieldHitTotalCoverage
Test:coverage.info.cleanedLines:55100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
AdvectionField.h +
100.0%
+
100.0 %5 / 5-0 / 0
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/advectionField/index.html b/doc/coverageReport/include/crpropa/advectionField/index.html new file mode 100644 index 000000000..b7333515c --- /dev/null +++ b/doc/coverageReport/include/crpropa/advectionField/index.html @@ -0,0 +1,93 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/advectionField + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/advectionFieldHitTotalCoverage
Test:coverage.info.cleanedLines:55100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
AdvectionField.h +
100.0%
+
100.0 %5 / 5-0 / 0
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/index-sort-f.html b/doc/coverageReport/include/crpropa/index-sort-f.html new file mode 100644 index 000000000..3e4666a0f --- /dev/null +++ b/doc/coverageReport/include/crpropa/index-sort-f.html @@ -0,0 +1,233 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropaHitTotalCoverage
Test:coverage.info.cleanedLines:40855473.6 %
Date:2024-04-08 14:58:22Functions:7716646.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Source.h +
77.8%77.8%
+
77.8 %14 / 180.0 %0 / 1
Geometry.h +
75.0%75.0%
+
75.0 %3 / 40.0 %0 / 1
Logging.h +
0.0%
+
0.0 %0 / 180.0 %0 / 6
Variant.h +
37.1%37.1%
+
37.1 %13 / 3525.0 %4 / 16
Vector3.h +
65.6%65.6%
+
65.6 %99 / 15139.0 %16 / 41
Grid.h +
88.7%88.7%
+
88.7 %173 / 19541.1 %23 / 56
Referenced.h +
73.2%73.2%
+
73.2 %41 / 5652.6 %10 / 19
PhotonBackground.h +
81.5%81.5%
+
81.5 %22 / 2789.5 %17 / 19
ParticleState.h +
100.0%
+
100.0 %1 / 1-0 / 0
Module.h +
25.0%25.0%
+
25.0 %2 / 8-0 / 0
Candidate.h +
100.0%
+
100.0 %1 / 1-0 / 0
EmissionMap.h +
100.0%
+
100.0 %1 / 1-0 / 0
Random.h +
87.5%87.5%
+
87.5 %7 / 8-0 / 0
Common.h +
100.0%
+
100.0 %10 / 10100.0 %2 / 2
AssocVector.h +
100.0%
+
100.0 %21 / 21100.0 %5 / 5
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/index-sort-l.html b/doc/coverageReport/include/crpropa/index-sort-l.html new file mode 100644 index 000000000..f2d075e22 --- /dev/null +++ b/doc/coverageReport/include/crpropa/index-sort-l.html @@ -0,0 +1,233 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropaHitTotalCoverage
Test:coverage.info.cleanedLines:40855473.6 %
Date:2024-04-08 14:58:22Functions:7716646.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Logging.h +
0.0%
+
0.0 %0 / 180.0 %0 / 6
Module.h +
25.0%25.0%
+
25.0 %2 / 8-0 / 0
Variant.h +
37.1%37.1%
+
37.1 %13 / 3525.0 %4 / 16
Vector3.h +
65.6%65.6%
+
65.6 %99 / 15139.0 %16 / 41
Referenced.h +
73.2%73.2%
+
73.2 %41 / 5652.6 %10 / 19
Geometry.h +
75.0%75.0%
+
75.0 %3 / 40.0 %0 / 1
Source.h +
77.8%77.8%
+
77.8 %14 / 180.0 %0 / 1
PhotonBackground.h +
81.5%81.5%
+
81.5 %22 / 2789.5 %17 / 19
Random.h +
87.5%87.5%
+
87.5 %7 / 8-0 / 0
Grid.h +
88.7%88.7%
+
88.7 %173 / 19541.1 %23 / 56
ParticleState.h +
100.0%
+
100.0 %1 / 1-0 / 0
Candidate.h +
100.0%
+
100.0 %1 / 1-0 / 0
EmissionMap.h +
100.0%
+
100.0 %1 / 1-0 / 0
Common.h +
100.0%
+
100.0 %10 / 10100.0 %2 / 2
AssocVector.h +
100.0%
+
100.0 %21 / 21100.0 %5 / 5
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/index.html b/doc/coverageReport/include/crpropa/index.html new file mode 100644 index 000000000..e5683710b --- /dev/null +++ b/doc/coverageReport/include/crpropa/index.html @@ -0,0 +1,233 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropaHitTotalCoverage
Test:coverage.info.cleanedLines:40855473.6 %
Date:2024-04-08 14:58:22Functions:7716646.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
AssocVector.h +
100.0%
+
100.0 %21 / 21100.0 %5 / 5
Candidate.h +
100.0%
+
100.0 %1 / 1-0 / 0
Common.h +
100.0%
+
100.0 %10 / 10100.0 %2 / 2
EmissionMap.h +
100.0%
+
100.0 %1 / 1-0 / 0
Geometry.h +
75.0%75.0%
+
75.0 %3 / 40.0 %0 / 1
Grid.h +
88.7%88.7%
+
88.7 %173 / 19541.1 %23 / 56
Logging.h +
0.0%
+
0.0 %0 / 180.0 %0 / 6
Module.h +
25.0%25.0%
+
25.0 %2 / 8-0 / 0
ParticleState.h +
100.0%
+
100.0 %1 / 1-0 / 0
PhotonBackground.h +
81.5%81.5%
+
81.5 %22 / 2789.5 %17 / 19
Random.h +
87.5%87.5%
+
87.5 %7 / 8-0 / 0
Referenced.h +
73.2%73.2%
+
73.2 %41 / 5652.6 %10 / 19
Source.h +
77.8%77.8%
+
77.8 %14 / 180.0 %0 / 1
Variant.h +
37.1%37.1%
+
37.1 %13 / 3525.0 %4 / 16
Vector3.h +
65.6%65.6%
+
65.6 %99 / 15139.0 %16 / 41
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/GalacticMagneticField.h.func-sort-c.html b/doc/coverageReport/include/crpropa/magneticField/GalacticMagneticField.h.func-sort-c.html new file mode 100644 index 000000000..afe0c0f07 --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/GalacticMagneticField.h.func-sort-c.html @@ -0,0 +1,88 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField/GalacticMagneticField.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticField - GalacticMagneticField.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:3838100.0 %
Date:2024-04-08 14:58:22Functions:44100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa22LogarithmicSpiralField11updatePhaseEv1
_ZN7crpropa22LogarithmicSpiralField16updatePitchAngleEv1
_ZNK7crpropa22LogarithmicSpiralField8getFieldENS_7Vector3IdEE1
_ZN7crpropa17ToroidalHaloField8getFieldENS_7Vector3IdEE2
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/GalacticMagneticField.h.func.html b/doc/coverageReport/include/crpropa/magneticField/GalacticMagneticField.h.func.html new file mode 100644 index 000000000..d44a00d58 --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/GalacticMagneticField.h.func.html @@ -0,0 +1,88 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField/GalacticMagneticField.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticField - GalacticMagneticField.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:3838100.0 %
Date:2024-04-08 14:58:22Functions:44100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa17ToroidalHaloField8getFieldENS_7Vector3IdEE2
_ZN7crpropa22LogarithmicSpiralField11updatePhaseEv1
_ZN7crpropa22LogarithmicSpiralField16updatePitchAngleEv1
_ZNK7crpropa22LogarithmicSpiralField8getFieldENS_7Vector3IdEE1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/GalacticMagneticField.h.gcov.html b/doc/coverageReport/include/crpropa/magneticField/GalacticMagneticField.h.gcov.html new file mode 100644 index 000000000..6ae2c08a8 --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/GalacticMagneticField.h.gcov.html @@ -0,0 +1,210 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField/GalacticMagneticField.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticField - GalacticMagneticField.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:3838100.0 %
Date:2024-04-08 14:58:22Functions:44100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_GALACTICMAGNETICFIELD_H
+       2             : #define CRPROPA_GALACTICMAGNETICFIELD_H
+       3             : 
+       4             : #include "crpropa/magneticField/MagneticField.h"
+       5             : #include <cmath>
+       6             : 
+       7             : namespace crpropa {
+       8             : /**
+       9             :  * \addtogroup MagneticFields
+      10             :  * @{
+      11             :  */
+      12             : 
+      13             : /**
+      14             :  @class ToroidalHaloField
+      15             :  @brief Galactic halo field model from Prouza & Smida 2003 and Sun et al. 2008
+      16             :  */
+      17             : class ToroidalHaloField: public MagneticField {
+      18             :         double b0; // halo field strength
+      19             :         double z0; // vertical position
+      20             :         double z1; // vertical scale
+      21             :         double r0; // radial scale
+      22             : 
+      23             : public:
+      24             :         /**
+      25             :          * Constructor
+      26             :          * @param b0 halo field strength
+      27             :          * @param z0 vertical position
+      28             :          * @param z1 vertical scale
+      29             :          * @param r0 radial scale
+      30             :         */
+      31           1 :         ToroidalHaloField(double b0 = 1., double z0 = 1., double z1 = 1., double r0 = 1.) {
+      32             :                 setParameters(b0, z0, z1, r0);
+      33             :         }
+      34             : 
+      35             :         void setParameters(double b0, double z0, double z1, double r0) {
+      36           1 :                 this->b0 = b0;
+      37           1 :                 this->z0 = z0;
+      38           1 :                 this->z1 = z1;
+      39           1 :                 this->r0 = r0;
+      40             :         }
+      41             : 
+      42           2 :         Vector3d getField(Vector3d pos) {
+      43           2 :                 double r = sqrt(pos.x * pos.x + pos.y * pos.y) / r0; // in-plane radius in units of the radial scale
+      44           2 :                 double b = b0 / (1 + pow((std::fabs(pos.z) - z0) / z1, 2)) * r * exp(1 - r);
+      45           2 :                 double phi = pos.getPhi(); // azimuth
+      46           2 :                 return Vector3d(cos(phi), sin(phi), 0) * b;
+      47             :         }
+      48             : };
+      49             : /** @} */
+      50             : 
+      51             : /**
+      52             :  * \addtogroup MagneticFields
+      53             :  * @{
+      54             :  */
+      55             : 
+      56             : /**
+      57             :  @class LogarithmicSpiralField
+      58             :  @brief Galactic disk field model of axisymmetric (ASS) or bisymmetric (BSS) logarithmic spiral shape
+      59             :  */
+      60             : class LogarithmicSpiralField: public MagneticField {
+      61             : private:
+      62             :         bool isBSS;   // true for BSS, false for ASS
+      63             :         double b0;    // field strength
+      64             :         double pitch; // pitch angle [rad]
+      65             :         double rsol;  // distance of sun to galactic center
+      66             :         double rc;    // radius of central region with constant field strength
+      67             :         double d;     // distance to the first field reversal
+      68             :         double z0;    // vertical attenuation length
+      69             : 
+      70             :         double phase; // phase of the spiral arms
+      71             :         double cosPhase;
+      72             :         double sinPitch;
+      73             :         double cosPitch;
+      74             :         double tanPitch;
+      75             : 
+      76           1 :         void updatePitchAngle() {
+      77           1 :                 sinPitch = sin(pitch);
+      78           1 :                 cosPitch = cos(pitch);
+      79           1 :                 tanPitch = tan(pitch);
+      80           1 :         }
+      81             : 
+      82           1 :         void updatePhase() {
+      83           1 :                 phase = log(1 + d / rsol) / tanPitch - M_PI / 2;
+      84           1 :                 cosPhase = cos(phase);
+      85           1 :         }
+      86             : 
+      87             : public:
+      88             :         /**
+      89             :          * Constructor
+      90             :          * @param isBSS switch for the magnetic field model
+      91             :          *                              true for BSS, false for ASS
+      92             :          * @param b0    magnetic field strength
+      93             :          * @param pitch pitch angle [rad]
+      94             :          * @param rsol  distance of sun from Galactic center
+      95             :          * @param rc    radius of central region with constant field
+      96             :          * @param d             distance to first field reversal
+      97             :          * @param z0    vertical attenuation length
+      98             :         */
+      99             :         LogarithmicSpiralField(bool isBSS = true, double b0 = 1., double pitch = M_1_PI/4.,
+     100           1 :                 double rsol = 8.5*kpc, double rc = 3*kpc, double d = 5*kpc, double z0 = 3*kpc) {
+     101             :                 setParameters(isBSS, b0, pitch, rsol, rc, d, z0);
+     102             :         }
+     103             : 
+     104             :         void setParameters(bool isBSS, double b0, double pitch, double rsol,
+     105             :                         double rc, double d, double z0) {
+     106           1 :                 this->isBSS = isBSS;
+     107           1 :                 this->b0 = b0;
+     108           1 :                 this->pitch = pitch;
+     109           1 :                 this->rsol = rsol;
+     110           1 :                 this->rc = rc;
+     111           1 :                 this->d = d;
+     112           1 :                 this->z0 = z0;
+     113           1 :                 updatePitchAngle();
+     114           1 :                 updatePhase();
+     115             :         }
+     116             : 
+     117           1 :         Vector3d getField(Vector3d pos) const {
+     118           1 :                 double r = sqrt(pos.x * pos.x + pos.y * pos.y); // in-plane radius
+     119           1 :                 double b = b0 / cosPhase * rsol / std::max(r, rc);
+     120             : 
+     121           1 :                 double phi = pos.getPhi();
+     122           1 :                 double c = cos(phi - log(r / rsol) / tanPitch + phase);
+     123           1 :                 if (isBSS)
+     124           1 :                         c = std::fabs(c);
+     125           1 :                 b *= c * exp(-std::fabs(pos.z) / z0);
+     126             : 
+     127           1 :                 return Vector3d(cosPitch * cos(phi), sinPitch * sin(phi), 0) * b;
+     128             :         }
+     129             : };
+     130             : /** @} */
+     131             : 
+     132             : }// namespace crpropa
+     133             : 
+     134             : #endif // CRPROPA_GALACTICMAGNETICFIELD_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/MagneticField.h.func-sort-c.html b/doc/coverageReport/include/crpropa/magneticField/MagneticField.h.func-sort-c.html new file mode 100644 index 000000000..841410136 --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/MagneticField.h.func-sort-c.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField/MagneticField.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticField - MagneticField.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:121770.6 %
Date:2024-04-08 14:58:22Functions:3742.9 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa13MagneticFieldD0Ev0
_ZN7crpropa13MagneticFieldD2Ev0
_ZN7crpropa24RenormalizeMagneticFieldD0Ev0
_ZNK7crpropa13MagneticField8getFieldERKNS_7Vector3IdEE0
_ZN7crpropa24RenormalizeMagneticFieldD2Ev1
_ZNK7crpropa20UniformMagneticField8getFieldERKNS_7Vector3IdEE5760340
_ZNK7crpropa13MagneticField8getFieldERKNS_7Vector3IdEEd5760379
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/MagneticField.h.func.html b/doc/coverageReport/include/crpropa/magneticField/MagneticField.h.func.html new file mode 100644 index 000000000..8ed4d10b3 --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/MagneticField.h.func.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField/MagneticField.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticField - MagneticField.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:121770.6 %
Date:2024-04-08 14:58:22Functions:3742.9 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa13MagneticFieldD0Ev0
_ZN7crpropa13MagneticFieldD2Ev0
_ZN7crpropa24RenormalizeMagneticFieldD0Ev0
_ZN7crpropa24RenormalizeMagneticFieldD2Ev1
_ZNK7crpropa13MagneticField8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa13MagneticField8getFieldERKNS_7Vector3IdEEd5760379
_ZNK7crpropa20UniformMagneticField8getFieldERKNS_7Vector3IdEE5760340
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/MagneticField.h.gcov.html b/doc/coverageReport/include/crpropa/magneticField/MagneticField.h.gcov.html new file mode 100644 index 000000000..2866a8501 --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/MagneticField.h.gcov.html @@ -0,0 +1,248 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField/MagneticField.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticField - MagneticField.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:121770.6 %
Date:2024-04-08 14:58:22Functions:3742.9 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_MAGNETICFIELD_H
+       2             : #define CRPROPA_MAGNETICFIELD_H
+       3             : 
+       4             : #include "crpropa/Units.h"
+       5             : #include "crpropa/Vector3.h"
+       6             : #include "crpropa/Referenced.h"
+       7             : 
+       8             : #ifdef CRPROPA_HAVE_MUPARSER
+       9             : #include "muParser.h"
+      10             : #endif
+      11             : 
+      12             : namespace crpropa {
+      13             : /**
+      14             :  * \addtogroup MagneticFields
+      15             :  * @{
+      16             :  */
+      17             : 
+      18             : /**
+      19             :  @class MagneticField
+      20             :  @brief Abstract base class for magnetic fields.
+      21             :  */
+      22           0 : class MagneticField: public Referenced {
+      23             : public:
+      24           0 :         virtual ~MagneticField() {
+      25           0 :         }
+      26           0 :         virtual Vector3d getField(const Vector3d &position) const {
+      27           0 :                 return Vector3d(0,0,0);
+      28             :         };
+      29     5760379 :         virtual Vector3d getField(const Vector3d &position, double z) const {
+      30     5760379 :                 return getField(position);
+      31             :         };
+      32             : };
+      33             : 
+      34             : /**
+      35             :  @class PeriodicMagneticField
+      36             :  @brief Magnetic field decorator implementing periodic fields.
+      37             : 
+      38             :  The periodic cube is defined by its origin (Vector3d) and an
+      39             :  extends parameter (Vector3d). All points x=(x_1, x_2, x_3) 
+      40             :  that are described by x_i = origin_i + epsilon * extend_i, 
+      41             :  with epsilon = 0...1 are within the base cube. Magnetic field
+      42             :  strengths for all positions outside of this cube are calculated 
+      43             :  based on the values in the base cube. 
+      44             :  This can be done periodically or reflectively.
+      45             : */
+      46             : 
+      47             : class PeriodicMagneticField: public MagneticField {
+      48             :         ref_ptr<MagneticField> field;
+      49             :         Vector3d origin, extends;
+      50             :         bool reflective;
+      51             : public:
+      52             :         /**
+      53             :          * Constructor
+      54             :          * @param field magnetic field reference pointer
+      55             :          * @param extends length, width, and height of the base cube 
+      56             :         */
+      57             :         PeriodicMagneticField(ref_ptr<MagneticField> field,
+      58             :                         const Vector3d &extends);
+      59             :         /**
+      60             :          * Constructor
+      61             :          * @param field magnetic field reference pointer
+      62             :          * @param extends length, width, and height of the base cube
+      63             :          * @param origin defines the reference position 
+      64             :          * @param reflective for periodic or reflective behavior  
+      65             :         */
+      66             :         PeriodicMagneticField(ref_ptr<MagneticField> field, const Vector3d &extends,
+      67             :                         const Vector3d &origin, bool reflective);
+      68             :         Vector3d &getOrigin();
+      69             :         void setOrigin(const Vector3d &origin);
+      70             :         Vector3d &getExtends();
+      71             :         void setExtends(const Vector3d &origin);
+      72             :         bool isReflective();
+      73             :         void setReflective(bool reflective);
+      74             :         Vector3d getField(const Vector3d &position) const;
+      75             : };
+      76             : 
+      77             : /**
+      78             :  @class MagneticFieldList
+      79             :  @brief Magnetic field decorator implementing a superposition of fields.
+      80             :  */
+      81           2 : class MagneticFieldList: public MagneticField {
+      82             :         std::vector<ref_ptr<MagneticField> > fields;
+      83             : public:
+      84             :         void addField(ref_ptr<MagneticField> field);
+      85             :         Vector3d getField(const Vector3d &position) const;
+      86             : };
+      87             : 
+      88             : /**
+      89             :  @class MagneticFieldEvolution
+      90             :  @brief Magnetic field decorator implementing an evolution of type (1+z)^m.
+      91             :  */
+      92           2 : class MagneticFieldEvolution: public MagneticField {
+      93             :         ref_ptr<MagneticField> field;
+      94             :         double m;
+      95             : public:
+      96             :         /**
+      97             :          * Constructor
+      98             :          * @param field magnetic field reference pointer
+      99             :          * @param m cosmic evolution parameter 
+     100             :         */
+     101             :         MagneticFieldEvolution(ref_ptr<MagneticField> field, double m);
+     102             :         Vector3d getField(const Vector3d &position, double z = 0) const;
+     103             : };
+     104             : 
+     105             : /**
+     106             :  @class UniformMagneticField
+     107             :  @brief Magnetic field with one B-field vector.
+     108             :  */
+     109             : class UniformMagneticField: public MagneticField {
+     110             :         Vector3d value;
+     111             : public:
+     112             :         /**
+     113             :          * Constructor
+     114             :          * @param value magnetic field strength
+     115             :         */
+     116          33 :         UniformMagneticField(const Vector3d &value) :
+     117          33 :                         value(value) {
+     118             :         }
+     119     5760340 :         Vector3d getField(const Vector3d &position) const {
+     120     5760340 :                 return value;
+     121             :         }
+     122             : };
+     123             : 
+     124             : /**
+     125             :  @class MagneticDipoleField
+     126             :  @brief Magnetic dipole field defined by the magnetic moment and the 'core' radius.
+     127             :  */
+     128           1 : class MagneticDipoleField: public MagneticField {
+     129             :         Vector3d origin;
+     130             :         Vector3d moment;
+     131             :         double radius;
+     132             : public:
+     133             :         /**
+     134             :          * Constructor
+     135             :          * @param origin        singularity of the dipole field
+     136             :          * @param moment        magnetic moment of the dipole field
+     137             :          * @param radius        inside a radius around the origin the 
+     138             :          *                                      magnetic field is constant: moment * 2 * mu0 / 3  
+     139             :         */
+     140           1 :         MagneticDipoleField(const Vector3d &origin, const Vector3d &moment, const double radius) :
+     141           1 :                         origin(origin), moment(moment), radius(radius) {
+     142             :         }
+     143             :         Vector3d getField(const Vector3d &position) const;
+     144             : };
+     145             : 
+     146             : #ifdef CRPROPA_HAVE_MUPARSER
+     147             : /**
+     148             :  @class RenormalizeMagneticField
+     149             :  @brief Renormalize strength of a given field by expression in which B is the strength variable.
+     150             :  */
+     151             : class RenormalizeMagneticField: public MagneticField {
+     152             :         ref_ptr<MagneticField> field;
+     153             :         std::string expression;
+     154             :         mu::Parser *p;
+     155             :         double Bmag;
+     156             : public:
+     157             :         /**
+     158             :          * Constructor
+     159             :          * @param field                 magnetic field reference pointer
+     160             :          * @param expression    muParser expression used to renormalize the field, 
+     161             :          *                                              e.g., "gauss". 
+     162             :         */
+     163             :         RenormalizeMagneticField(ref_ptr<MagneticField> field, std::string expression);
+     164           1 :         ~RenormalizeMagneticField() { delete p; }
+     165             :         Vector3d getField(const Vector3d &position);
+     166             : };
+     167             : #endif
+     168             : 
+     169             : /** @} */
+     170             : } // namespace crpropa
+     171             : 
+     172             : #endif // CRPROPA_MAGNETICFIELD_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/MagneticFieldGrid.h.func-sort-c.html b/doc/coverageReport/include/crpropa/magneticField/MagneticFieldGrid.h.func-sort-c.html new file mode 100644 index 000000000..62ce25a19 --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/MagneticFieldGrid.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField/MagneticFieldGrid.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticField - MagneticFieldGrid.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:010.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/MagneticFieldGrid.h.func.html b/doc/coverageReport/include/crpropa/magneticField/MagneticFieldGrid.h.func.html new file mode 100644 index 000000000..04a253ccc --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/MagneticFieldGrid.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField/MagneticFieldGrid.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticField - MagneticFieldGrid.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:010.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/MagneticFieldGrid.h.gcov.html b/doc/coverageReport/include/crpropa/magneticField/MagneticFieldGrid.h.gcov.html new file mode 100644 index 000000000..7d0df9558 --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/MagneticFieldGrid.h.gcov.html @@ -0,0 +1,139 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField/MagneticFieldGrid.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticField - MagneticFieldGrid.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:010.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_MAGNETICFIELDGRID_H
+       2             : #define CRPROPA_MAGNETICFIELDGRID_H
+       3             : 
+       4             : #include "crpropa/magneticField/MagneticField.h"
+       5             : #include "crpropa/Grid.h"
+       6             : 
+       7             : namespace crpropa {
+       8             : /**
+       9             :  * \addtogroup MagneticFields
+      10             :  * @{
+      11             :  */
+      12             : 
+      13             : /**
+      14             :  @class MagneticFieldGrid
+      15             :  @brief Magnetic field on a periodic (or reflective), cartesian grid with trilinear interpolation.
+      16             : 
+      17             :  This class wraps a Grid3f to serve as a MagneticField.
+      18             :  */
+      19             : class MagneticFieldGrid: public MagneticField {
+      20             :         ref_ptr<Grid3f> grid;
+      21             : public:
+      22             :         /**
+      23             :          *Constructor
+      24             :          @param grid Grid3f storing the magnetic field vectors
+      25             :         */
+      26             :         MagneticFieldGrid(ref_ptr<Grid3f> grid);
+      27             :         void setGrid(ref_ptr<Grid3f> grid);
+      28             :         ref_ptr<Grid3f> getGrid();
+      29             :         Vector3d getField(const Vector3d &position) const;
+      30             : };
+      31             : 
+      32             : /**
+      33             :  @class ModulatedMagneticFieldGrid
+      34             :  @brief Modulated magnetic field on a periodic grid.
+      35             : 
+      36             :  This class wraps a Grid3f to serve as a MagneticField.
+      37             :  The field is modulated on-the-fly with a Grid1f.
+      38             :  The Grid3f and Grid1f do not need to share the same origin, spacing or size.
+      39             :  */
+      40             : class ModulatedMagneticFieldGrid: public MagneticField {
+      41             :         ref_ptr<Grid3f> grid;
+      42             :         ref_ptr<Grid1f> modGrid;
+      43             : public:
+      44           0 :         ModulatedMagneticFieldGrid() {
+      45             :         }
+      46             :         /**
+      47             :          *Constructor
+      48             :          @param grid    Grid3f storing the magnetic field vectors
+      49             :          @param modGrid Grid1f used to scale the magnetic field strength
+      50             :                                         B^new_i = B^old_i * scale 
+      51             :         */
+      52             :         ModulatedMagneticFieldGrid(ref_ptr<Grid3f> grid, ref_ptr<Grid1f> modGrid);
+      53             :         void setGrid(ref_ptr<Grid3f> grid);
+      54             :         void setModulationGrid(ref_ptr<Grid1f> modGrid);
+      55             :         ref_ptr<Grid3f> getGrid();
+      56             :         ref_ptr<Grid1f> getModulationGrid();
+      57             :         void setReflective(bool gridReflective, bool modGridReflective);
+      58             :         Vector3d getField(const Vector3d &position) const;
+      59             : };
+      60             : /** @} */
+      61             : } // namespace crpropa
+      62             : 
+      63             : #endif // CRPROPA_MAGNETICFIELDGRID_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/index-sort-f.html b/doc/coverageReport/include/crpropa/magneticField/index-sort-f.html new file mode 100644 index 000000000..08da227af --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/index-sort-f.html @@ -0,0 +1,113 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticFieldHitTotalCoverage
Test:coverage.info.cleanedLines:505689.3 %
Date:2024-04-08 14:58:22Functions:71163.6 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
MagneticField.h +
70.6%70.6%
+
70.6 %12 / 1742.9 %3 / 7
MagneticFieldGrid.h +
0.0%
+
0.0 %0 / 1-0 / 0
GalacticMagneticField.h +
100.0%
+
100.0 %38 / 38100.0 %4 / 4
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/index-sort-l.html b/doc/coverageReport/include/crpropa/magneticField/index-sort-l.html new file mode 100644 index 000000000..3a378c7d3 --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/index-sort-l.html @@ -0,0 +1,113 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticFieldHitTotalCoverage
Test:coverage.info.cleanedLines:505689.3 %
Date:2024-04-08 14:58:22Functions:71163.6 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
MagneticFieldGrid.h +
0.0%
+
0.0 %0 / 1-0 / 0
MagneticField.h +
70.6%70.6%
+
70.6 %12 / 1742.9 %3 / 7
GalacticMagneticField.h +
100.0%
+
100.0 %38 / 38100.0 %4 / 4
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/index.html b/doc/coverageReport/include/crpropa/magneticField/index.html new file mode 100644 index 000000000..9cd37eb4a --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/index.html @@ -0,0 +1,113 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticFieldHitTotalCoverage
Test:coverage.info.cleanedLines:505689.3 %
Date:2024-04-08 14:58:22Functions:71163.6 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
GalacticMagneticField.h +
100.0%
+
100.0 %38 / 38100.0 %4 / 4
MagneticField.h +
70.6%70.6%
+
70.6 %12 / 1742.9 %3 / 7
MagneticFieldGrid.h +
0.0%
+
0.0 %0 / 1-0 / 0
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/GridTurbulence.h.func-sort-c.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/GridTurbulence.h.func-sort-c.html new file mode 100644 index 000000000..3432fc3a9 --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/turbulentField/GridTurbulence.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField/GridTurbulence.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticField/turbulentField - GridTurbulence.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/GridTurbulence.h.func.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/GridTurbulence.h.func.html new file mode 100644 index 000000000..fd3be85af --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/turbulentField/GridTurbulence.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField/GridTurbulence.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticField/turbulentField - GridTurbulence.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/GridTurbulence.h.gcov.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/GridTurbulence.h.gcov.html new file mode 100644 index 000000000..29f802928 --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/turbulentField/GridTurbulence.h.gcov.html @@ -0,0 +1,151 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField/GridTurbulence.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticField/turbulentField - GridTurbulence.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_GRIDTURBULENCE_H
+       2             : #define CRPROPA_GRIDTURBULENCE_H
+       3             : 
+       4             : #ifdef CRPROPA_HAVE_FFTW3F
+       5             : 
+       6             : #include "crpropa/Grid.h"
+       7             : #include "crpropa/magneticField/turbulentField/TurbulentField.h"
+       8             : 
+       9             : #include "fftw3.h"
+      10             : 
+      11             : namespace crpropa {
+      12             : /**
+      13             :  * \addtogroup MagneticFields
+      14             :  * @{
+      15             :  */
+      16             : 
+      17             : /**
+      18             :  @class GridTurbulence
+      19             :  @brief Turbulent grid-based magnetic field with a general energy spectrum
+      20             :  */
+      21           6 : class GridTurbulence : public TurbulentField {
+      22             :   protected:
+      23             :         unsigned int seed;
+      24             :         ref_ptr<Grid3f> gridPtr;
+      25             : 
+      26             :         void initGrid(const GridProperties &grid);
+      27             :         void initTurbulence();
+      28             : 
+      29             :   public:
+      30             :         /**
+      31             :          Create a random initialization of a turbulent field.
+      32             :          @param spectrum    TurbulenceSpectrum instance to define the spectrum of
+      33             :          turbulence
+      34             :          @param gridProp        GridProperties instance to define the underlying grid
+      35             :          @param seed     Random seed
+      36             :          */
+      37             :         GridTurbulence(const TurbulenceSpectrum &spectrum,
+      38             :                        const GridProperties &gridProp, unsigned int seed = 0);
+      39             : 
+      40             :         Vector3d getField(const Vector3d &pos) const;
+      41             : 
+      42             :         /** Return a const reference to the grid */
+      43             :         const ref_ptr<Grid3f> &getGrid() const;
+      44             : 
+      45             :         /* Helper functions for synthetic turbulent field models */
+      46             :         // Check the grid properties before the FFT procedure
+      47             :         static void checkGridRequirements(ref_ptr<Grid3f> grid, double lMin,
+      48             :                                           double lMax);
+      49             :         // Execute inverse discrete FFT in-place for a 3D grid, from complex to real
+      50             :         // space
+      51             :         static void executeInverseFFTInplace(ref_ptr<Grid3f> grid,
+      52             :                                              fftwf_complex *Bkx, fftwf_complex *Bky,
+      53             :                                              fftwf_complex *Bkz);
+      54             : 
+      55             :         // Usefull checks for a grid field
+      56             :         /** Evaluate the mean vector of all grid points */
+      57             :         Vector3f getMeanFieldVector() const;
+      58             :         /** Evaluate the mean of all grid points */
+      59             :         double getMeanFieldStrength() const;
+      60             :         /** Evaluate the RMS of all grid points */
+      61             :         double getRmsFieldStrength() const;
+      62             :         /** Evaluate the RMS of all grid points per axis */
+      63             :         std::array<float, 3> getRmsFieldStrengthPerAxis() const;
+      64             :         /** Evaluate generated power-spectrum */
+      65             :         std::vector<std::pair<int, float>> getPowerSpectrum() const;
+      66             :         /** Dump a Grid3f to a binary file */
+      67             :         void dumpToFile(std::string filename) const;
+      68             : };
+      69             : 
+      70             : /** @}*/
+      71             : } // namespace crpropa
+      72             : 
+      73             : #endif // CRPROPA_HAVE_FFTW3F
+      74             : 
+      75             : #endif // CRPROPA_GRIDTURBULENCE_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h.func-sort-c.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h.func-sort-c.html new file mode 100644 index 000000000..0c515e402 --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h.func-sort-c.html @@ -0,0 +1,76 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticField/turbulentField - HelicalGridTurbulence.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:050.0 %
Date:2024-04-08 14:58:22Functions:010.0 %
+
+ +
+ + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa21initHelicalTurbulenceENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEddddid0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h.func.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h.func.html new file mode 100644 index 000000000..b4ddcbe9c --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h.func.html @@ -0,0 +1,76 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticField/turbulentField - HelicalGridTurbulence.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:050.0 %
Date:2024-04-08 14:58:22Functions:010.0 %
+
+ +
+ + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa21initHelicalTurbulenceENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEddddid0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h.gcov.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h.gcov.html new file mode 100644 index 000000000..f2108a9f4 --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h.gcov.html @@ -0,0 +1,147 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticField/turbulentField - HelicalGridTurbulence.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:050.0 %
Date:2024-04-08 14:58:22Functions:010.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_HELICALGRIDTURBULENCE_H
+       2             : #define CRPROPA_HELICALGRIDTURBULENCE_H
+       3             : 
+       4             : #ifdef CRPROPA_HAVE_FFTW3F
+       5             : 
+       6             : #include "crpropa/Grid.h"
+       7             : #include "crpropa/magneticField/turbulentField/SimpleGridTurbulence.h"
+       8             : 
+       9             : #include "kiss/logger.h"
+      10             : #include "kiss/string.h"
+      11             : 
+      12             : namespace crpropa {
+      13             : /**
+      14             :  * \addtogroup MagneticFields
+      15             :  * @{
+      16             :  */
+      17             : 
+      18             : /**
+      19             :  @class HelicalGridTurbulence
+      20             :  @brief Turbulent grid-based magnetic field with a simple power-law spectrum
+      21             :  */
+      22             : class HelicalGridTurbulence : public SimpleGridTurbulence {
+      23             :   private:
+      24             :         double H;
+      25             : 
+      26             :   public:
+      27             :         /**
+      28             :          Create a random initialization of a turbulent field.
+      29             :          @param spectrum    TurbulenceSpectrum instance to define the spectrum of
+      30             :          turbulence
+      31             :          @param gridProp        GridProperties instance to define the underlying grid
+      32             :          @param H       Helicity
+      33             :          @param seed     Random seed
+      34             :          */
+      35             :         HelicalGridTurbulence(const SimpleTurbulenceSpectrum &spectrum,
+      36             :                               const GridProperties &gridProp, double H,
+      37             :                               unsigned int seed = 0);
+      38             : 
+      39             :         static void initTurbulence(ref_ptr<Grid3f> grid, double Brms, double lMin,
+      40             :                                    double lMax, double alpha, int seed, double H);
+      41             : };
+      42             : 
+      43             : // Compatibility with old functions from GridTurbulence:
+      44             : 
+      45             : /**
+      46             :  Create a random initialization of a turbulent field including helicity
+      47             :  @param grid    grid on which the turbulence is calculated
+      48             :  @param Brms    RMS field strength
+      49             :  @param lMin    Minimum wavelength of the turbulence
+      50             :  @param lMax    Maximum wavelength of the turbulence
+      51             :  @param alpha   Power law index of <B^2(k)> ~ k^alpha (alpha = -11/3 corresponds
+      52             :  to a Kolmogorov spectrum)
+      53             :  @param seed    Random seed
+      54             :  @param H               Helicity
+      55             : */
+      56           0 : void initHelicalTurbulence(ref_ptr<Grid3f> grid, double Brms, double lMin,
+      57             :                            double lMax, double alpha = -11 / 3., int seed = 0,
+      58             :                            double H = 0) {
+      59           0 :         KISS_LOG_WARNING
+      60             :             << "initTurbulence is deprecated and will be removed in the future. "
+      61           0 :                "Replace it with a more appropriate turbulent field model instance.";
+      62           0 :         HelicalGridTurbulence::initTurbulence(grid, Brms, lMin, lMax, alpha, seed,
+      63             :                                               H);
+      64           0 : }
+      65             : 
+      66             : /** @}*/
+      67             : } // namespace crpropa
+      68             : 
+      69             : #endif // CRPROPA_HAVE_FFTW3F
+      70             : 
+      71             : #endif // CRPROPA_HELICALGRIDTURBULENCE_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h.func-sort-c.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h.func-sort-c.html new file mode 100644 index 000000000..e3787874e --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h.func-sort-c.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticField/turbulentField - SimpleGridTurbulence.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:172181.0 %
Date:2024-04-08 14:58:22Functions:4757.1 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa24SimpleTurbulenceSpectrumD0Ev0
_ZN7crpropa24SimpleTurbulenceSpectrumD2Ev0
_ZNK7crpropa24SimpleTurbulenceSpectrum20getCorrelationLengthEv0
_ZN7crpropa24SimpleTurbulenceSpectrum26turbulentCorrelationLengthEddd1
_ZN7crpropa26turbulentCorrelationLengthEddd1
_ZN7crpropa14initTurbulenceENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEddddi4
_ZNK7crpropa24SimpleTurbulenceSpectrum14energySpectrumEd206961
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h.func.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h.func.html new file mode 100644 index 000000000..c913f5f27 --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h.func.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticField/turbulentField - SimpleGridTurbulence.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:172181.0 %
Date:2024-04-08 14:58:22Functions:4757.1 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa14initTurbulenceENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEddddi4
_ZN7crpropa24SimpleTurbulenceSpectrum26turbulentCorrelationLengthEddd1
_ZN7crpropa24SimpleTurbulenceSpectrumD0Ev0
_ZN7crpropa24SimpleTurbulenceSpectrumD2Ev0
_ZN7crpropa26turbulentCorrelationLengthEddd1
_ZNK7crpropa24SimpleTurbulenceSpectrum14energySpectrumEd206961
_ZNK7crpropa24SimpleTurbulenceSpectrum20getCorrelationLengthEv0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h.gcov.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h.gcov.html new file mode 100644 index 000000000..57422a4cb --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h.gcov.html @@ -0,0 +1,192 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticField/turbulentField - SimpleGridTurbulence.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:172181.0 %
Date:2024-04-08 14:58:22Functions:4757.1 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_SIMPLEGRIDTURBULENCE_H
+       2             : #define CRPROPA_SIMPLEGRIDTURBULENCE_H
+       3             : 
+       4             : #ifdef CRPROPA_HAVE_FFTW3F
+       5             : 
+       6             : #include "crpropa/magneticField/turbulentField/GridTurbulence.h"
+       7             : 
+       8             : #include "kiss/logger.h"
+       9             : #include "kiss/string.h"
+      10             : 
+      11             : namespace crpropa {
+      12             : /**
+      13             :  * \addtogroup MagneticFields
+      14             :  * @{
+      15             :  */
+      16             : 
+      17             : /**
+      18             :  @class SimpleTurbulenceSpectrum
+      19             :  @brief Defines the energy spectrum of simple power-law turbulence
+      20             :  */
+      21             : class SimpleTurbulenceSpectrum : public TurbulenceSpectrum {
+      22             :         const int constScaleBendover = 1000;    // define the bandover scale as 1000 * lMax to ensure k * lBendover >> 1. The bendover scale is necessary for the implementation of PlaneWaveTurbulence. 
+      23             :   public:
+      24             :         /**
+      25             :          * The bend-over scale is set to 1000 times lMax to ensure to be in the inertial range. This should not be changed.
+      26             :          @param Brms            Root mean square field strength for generated field
+      27             :          @param lMin            Minimum physical scale of the turbulence
+      28             :          @param lMax            Maximum physical scale of the turbulence
+      29             :          @param sIndex          Spectral index of the energy spectrum in the inertial range
+      30             :         */
+      31             :         SimpleTurbulenceSpectrum(double Brms, double lMin, double lMax,
+      32             :                                  double sIndex = 5. / 3)
+      33           2 :             : TurbulenceSpectrum(Brms, lMin, lMax, constScaleBendover * lMax, sIndex, 0) {}
+      34           0 :         ~SimpleTurbulenceSpectrum() {}
+      35             : 
+      36             :         /**
+      37             :         General energy spectrum for synthetic turbulence models
+      38             :         */
+      39      206961 :         double energySpectrum(double k) const {
+      40      206961 :                 return std::pow(k, -getSindex() - 2);
+      41             :         }
+      42             : 
+      43             :         /**
+      44             :             @brief       compute the magnetic field coherence length according to
+      45             :            the formula in  Harari et al. JHEP03(2002)045
+      46             :             @return Lc   coherence length of the magnetic field
+      47             :         */
+      48           0 :         double getCorrelationLength() const {
+      49           0 :                 return turbulentCorrelationLength(getLmin(), getLmax(),
+      50           0 :                                                   getSindex());
+      51             :         }
+      52           1 :         static double turbulentCorrelationLength(double lMin, double lMax,
+      53             :                                                  double s) {
+      54           1 :                 double r = lMin / lMax;
+      55           1 :                 return lMax / 2 * (s - 1) / s * (1 - pow(r, s)) / (1 - pow(r, s - 1));
+      56             :         }
+      57             : };
+      58             : 
+      59             : /**
+      60             :  @class SimpleGridTurbulence
+      61             :  @brief Turbulent grid-based magnetic field with a simple power-law spectrum
+      62             :  */
+      63           3 : class SimpleGridTurbulence : public GridTurbulence {
+      64             :   public:
+      65             :         /**
+      66             :          Create a random initialization of a turbulent field.
+      67             :          @param spectrum    TurbulenceSpectrum instance to define the spectrum of
+      68             :          turbulence
+      69             :          @param gridProp        GridProperties instance to define the underlying grid
+      70             :          @param seed     Random seed
+      71             :          */
+      72             :         SimpleGridTurbulence(const SimpleTurbulenceSpectrum &spectrum,
+      73             :                              const GridProperties &gridProp, unsigned int seed = 0);
+      74             : 
+      75             :         static void initTurbulence(ref_ptr<Grid3f> grid, double Brms, double lMin,
+      76             :                                    double lMax, double alpha, int seed);
+      77             : };
+      78             : 
+      79             : // Compatibility with old functions from GridTurbulence:
+      80             : 
+      81             : /** Analytically calculate the correlation length of the simple model turbulent
+      82             :  * field */
+      83           1 : inline double turbulentCorrelationLength(double lMin, double lMax,
+      84             :                                          double alpha = -11 / 3.) {
+      85           2 :         KISS_LOG_WARNING
+      86             :             << "turbulentCorrelationLength is deprecated and will be "
+      87             :                "removed in the future. Replace it with a more appropriate "
+      88           1 :                "turbulent field model and call getCorrelationLength().";
+      89           1 :         return SimpleTurbulenceSpectrum::turbulentCorrelationLength(lMin, lMax,
+      90           1 :                                                                     -alpha - 2);
+      91             : }
+      92             : 
+      93             : /**
+      94             :  Create a random initialization of a turbulent field.
+      95             :  @param grid    grid on which the turbulence is calculated
+      96             :  @param lMin    Minimum wavelength of the turbulence
+      97             :  @param lMax    Maximum wavelength of the turbulence
+      98             :  @param alpha   Power law index of <B^2(k)> ~ k^alpha (alpha = -11/3 corresponds
+      99             :  to a Kolmogorov spectrum)
+     100             :  @param Brms    RMS field strength
+     101             :  @param seed    Random seed
+     102             :  */
+     103           4 : inline void initTurbulence(ref_ptr<Grid3f> grid, double Brms, double lMin,
+     104             :                            double lMax, double alpha = -11 / 3., int seed = 0) {
+     105           8 :         KISS_LOG_WARNING
+     106             :             << "initTurbulence is deprecated and will be removed in the future. "
+     107           4 :                "Replace it with a more appropriate turbulent field model instance.";
+     108           4 :         SimpleGridTurbulence::initTurbulence(grid, Brms, lMin, lMax, alpha, seed);
+     109           1 : }
+     110             : 
+     111             : /** @}*/
+     112             : } // namespace crpropa
+     113             : 
+     114             : #endif // CRPROPA_HAVE_FFTW3F
+     115             : 
+     116             : #endif // CRPROPA_SIMPLEGRIDTURBULENCE_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/TurbulentField.h.func-sort-c.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/TurbulentField.h.func-sort-c.html new file mode 100644 index 000000000..e588a9cfb --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/turbulentField/TurbulentField.h.func-sort-c.html @@ -0,0 +1,108 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField/TurbulentField.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticField/turbulentField - TurbulentField.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:253278.1 %
Date:2024-04-08 14:58:22Functions:4944.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa14TurbulentFieldD0Ev0
_ZN7crpropa14TurbulentFieldD2Ev0
_ZN7crpropa18TurbulenceSpectrumD2Ev0
_ZNK7crpropa14TurbulentField20getCorrelationLengthEv0
_ZNK7crpropa18TurbulenceSpectrum20getCorrelationLengthEv0
_ZNK7crpropa18TurbulenceSpectrum21spectrumNormalizationEv1
_ZN7crpropa18TurbulenceSpectrumD0Ev2
_ZN7crpropa18TurbulenceSpectrumC2Edddddd9
_ZNK7crpropa18TurbulenceSpectrum14energySpectrumEd208128
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/TurbulentField.h.func.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/TurbulentField.h.func.html new file mode 100644 index 000000000..6e9224a7c --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/turbulentField/TurbulentField.h.func.html @@ -0,0 +1,108 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField/TurbulentField.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticField/turbulentField - TurbulentField.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:253278.1 %
Date:2024-04-08 14:58:22Functions:4944.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa14TurbulentFieldD0Ev0
_ZN7crpropa14TurbulentFieldD2Ev0
_ZN7crpropa18TurbulenceSpectrumC2Edddddd9
_ZN7crpropa18TurbulenceSpectrumD0Ev2
_ZN7crpropa18TurbulenceSpectrumD2Ev0
_ZNK7crpropa14TurbulentField20getCorrelationLengthEv0
_ZNK7crpropa18TurbulenceSpectrum14energySpectrumEd208128
_ZNK7crpropa18TurbulenceSpectrum20getCorrelationLengthEv0
_ZNK7crpropa18TurbulenceSpectrum21spectrumNormalizationEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/TurbulentField.h.gcov.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/TurbulentField.h.gcov.html new file mode 100644 index 000000000..dd676ef0c --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/turbulentField/TurbulentField.h.gcov.html @@ -0,0 +1,195 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField/TurbulentField.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticField/turbulentField - TurbulentField.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:253278.1 %
Date:2024-04-08 14:58:22Functions:4944.4 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_TURBULENTFIELD_H
+       2             : #define CRPROPA_TURBULENTFIELD_H
+       3             : 
+       4             : #include "crpropa/magneticField/MagneticField.h"
+       5             : #include <cmath>
+       6             : 
+       7             : namespace crpropa {
+       8             : /**
+       9             :  * \addtogroup MagneticFields
+      10             :  * @{
+      11             :  */
+      12             : 
+      13             : /**
+      14             :  @class TurbulenceSpectrum
+      15             :  @brief Defines the energy spectrum of turbulence parametrizied by A(k) ~ k^q /(1 + k^2)^{(s + q)/2 + 1}
+      16             :  */
+      17             : class TurbulenceSpectrum : public Referenced {
+      18             :   private:
+      19             :         const double Brms; /**< Brms value of the turbulent field (normalization) */
+      20             :         const double sIndex; /**< Spectral index for the inertial range, for example
+      21             :                           s=5/3 for Kolmogorov spectrum; in some parts of the code this
+      22             :                           parameter is referred by alpha which is the total 3D isotropic
+      23             :                           spectrum with additional k^2 and the minus sign, e.g.,
+      24             :                           for Kolmogorov: alpha = -(s + 2) */
+      25             :         const double qIndex; /**< Spectral index for the injection range, for
+      26             :                           example q=4 for 3D homogeneous turbulence */
+      27             :         const double lBendover;  /**< the bend-over scale */
+      28             :         const double lMin, lMax; /**< Min and Max scale of turbulence */
+      29             : 
+      30             :   protected:
+      31             :         /**
+      32             :         Normalization for the below defined Lc
+      33             :         */
+      34           1 :         double spectrumNormalization() const {
+      35           1 :                 return std::tgamma((sIndex + qIndex) / 2.0) /
+      36           1 :                        (2.0 * std::tgamma((sIndex - 1) / 2.0) *
+      37           1 :                         std::tgamma((qIndex + 1) / 2.0));
+      38             :         }
+      39             : 
+      40             :   public:
+      41             :         /**
+      42             :          * @param Brms         root mean square field strength for generated field
+      43             :          * @param lMin   Minimum physical scale of the turbulence
+      44             :          * @param lMax   Maximum physical scale of the turbulence
+      45             :          * @param lBendover        the bend-over scale
+      46             :          * @param sIndex         Spectral index of the energy spectrum in the inertial range
+      47             :          * @param qIndex         Spectral index of the energy spectrum in the energy range
+      48             :         */
+      49           9 :         TurbulenceSpectrum(double Brms, double lMin, double lMax,
+      50             :                            double lBendover = 1, double sIndex = (5. / 3.),
+      51             :                            double qIndex = 4)
+      52           9 :             : Brms(Brms), lMin(lMin), lMax(lMax), lBendover(lBendover),
+      53           9 :               sIndex(sIndex), qIndex(qIndex) {
+      54           9 :                 if (lMin > lMax) {
+      55           0 :                         throw std::runtime_error("TurbulenceSpectrum: lMin > lMax");
+      56             :                 }
+      57           9 :                 if (lMin <= 0) {
+      58           0 :                         throw std::runtime_error("TurbulenceSpectrum: lMin <= 0");
+      59             :                 }
+      60           9 :         }
+      61             : 
+      62           7 :         ~TurbulenceSpectrum() {}
+      63             : 
+      64          31 :         double getBrms() const { return Brms; }
+      65          19 :         double getLmin() const { return lMin; }
+      66          19 :         double getLmax() const { return lMax; }
+      67          22 :         double getLbendover() const { return lBendover; }
+      68           5 :         double getSindex() const { return sIndex; }
+      69           2 :         double getQindex() const { return qIndex; }
+      70             :         
+      71             :         /**
+      72             :         General energy spectrum for synthetic turbulence models (not normalized!)
+      73             :         with normalized ^k = k*lBendover
+      74             :         */
+      75      208128 :         virtual double energySpectrum(double k) const {
+      76      208128 :                 double kHat = k * lBendover;
+      77      208128 :                 return std::pow(kHat, qIndex) /
+      78      208128 :                                        std::pow(1.0 + kHat * kHat,
+      79      208128 :                                         (sIndex + qIndex) / 2.0 + 1.0);
+      80             :         }
+      81             : 
+      82             :         /**
+      83             :   Computes the magnetic field coherence length
+      84             :         Obtained from the definition of \f$l_c = 1/B_{\rm rms}^2 \int_0^\infty dr\langleB(0)B^*(r)\rangle \f$
+      85             :         Approximates the true value correctly as long as lBendover <= lMax/8 (~5%
+      86             :   error) (for the true value the above integral should go from lMin to lMax)
+      87             :         */
+      88           0 :         virtual double getCorrelationLength() const {
+      89           1 :                 return 4 * M_PI / ((sIndex + 2.0) * sIndex) * spectrumNormalization() *
+      90           1 :                        lBendover;
+      91             :         }
+      92             : };
+      93             : 
+      94             : /**
+      95             :  @class TurbulentField
+      96             :  @brief An abstract base class for different models of turbulent magnetic fields
+      97             : 
+      98             :  This module provides common methods for all turbulent (synthetic) magnetic
+      99             :  fields. Does not actually implement any turbulent field.
+     100             :  */
+     101             : class TurbulentField : public MagneticField {
+     102             :   protected:
+     103             :         const TurbulenceSpectrum &spectrum;
+     104             : 
+     105             :   public:
+     106           8 :         TurbulentField(const TurbulenceSpectrum &spectrum) : spectrum(spectrum) {}
+     107           0 :         virtual ~TurbulentField() {}
+     108             : 
+     109           0 :         double getBrms() const { return spectrum.getBrms(); }
+     110           0 :         virtual double getCorrelationLength() const {
+     111           0 :                 return spectrum.getCorrelationLength();
+     112             :         }
+     113             : };
+     114             : 
+     115             : /** @}*/
+     116             : 
+     117             : } // namespace crpropa
+     118             : 
+     119             : #endif // CRPROPA_TURBULENTFIELD_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/index-sort-f.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/index-sort-f.html new file mode 100644 index 000000000..297188998 --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/turbulentField/index-sort-f.html @@ -0,0 +1,123 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticField/turbulentFieldHitTotalCoverage
Test:coverage.info.cleanedLines:435972.9 %
Date:2024-04-08 14:58:22Functions:81747.1 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
HelicalGridTurbulence.h +
0.0%
+
0.0 %0 / 50.0 %0 / 1
TurbulentField.h +
78.1%78.1%
+
78.1 %25 / 3244.4 %4 / 9
SimpleGridTurbulence.h +
81.0%81.0%
+
81.0 %17 / 2157.1 %4 / 7
GridTurbulence.h +
100.0%
+
100.0 %1 / 1-0 / 0
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/index-sort-l.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/index-sort-l.html new file mode 100644 index 000000000..133acd288 --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/turbulentField/index-sort-l.html @@ -0,0 +1,123 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticField/turbulentFieldHitTotalCoverage
Test:coverage.info.cleanedLines:435972.9 %
Date:2024-04-08 14:58:22Functions:81747.1 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
HelicalGridTurbulence.h +
0.0%
+
0.0 %0 / 50.0 %0 / 1
TurbulentField.h +
78.1%78.1%
+
78.1 %25 / 3244.4 %4 / 9
SimpleGridTurbulence.h +
81.0%81.0%
+
81.0 %17 / 2157.1 %4 / 7
GridTurbulence.h +
100.0%
+
100.0 %1 / 1-0 / 0
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/index.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/index.html new file mode 100644 index 000000000..c75493324 --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticField/turbulentField/index.html @@ -0,0 +1,123 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticField/turbulentFieldHitTotalCoverage
Test:coverage.info.cleanedLines:435972.9 %
Date:2024-04-08 14:58:22Functions:81747.1 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
GridTurbulence.h +
100.0%
+
100.0 %1 / 1-0 / 0
HelicalGridTurbulence.h +
0.0%
+
0.0 %0 / 50.0 %0 / 1
SimpleGridTurbulence.h +
81.0%81.0%
+
81.0 %17 / 2157.1 %4 / 7
TurbulentField.h +
78.1%78.1%
+
78.1 %25 / 3244.4 %4 / 9
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticLens/MagneticLens.h.func-sort-c.html b/doc/coverageReport/include/crpropa/magneticLens/MagneticLens.h.func-sort-c.html new file mode 100644 index 000000000..1aa082456 --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticLens/MagneticLens.h.func-sort-c.html @@ -0,0 +1,96 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticLens/MagneticLens.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticLens - MagneticLens.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:204247.6 %
Date:2024-04-08 14:58:22Functions:4666.7 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa12MagneticLensC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa8LensPartC2Ev0
_ZN7crpropa12MagneticLensC2Eh3
_ZN7crpropa12MagneticLensD2Ev3
_ZN7crpropa8LensPartC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEdd3
_ZN7crpropa8LensPartD2Ev3
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticLens/MagneticLens.h.func.html b/doc/coverageReport/include/crpropa/magneticLens/MagneticLens.h.func.html new file mode 100644 index 000000000..41eba5bb7 --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticLens/MagneticLens.h.func.html @@ -0,0 +1,96 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticLens/MagneticLens.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticLens - MagneticLens.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:204247.6 %
Date:2024-04-08 14:58:22Functions:4666.7 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa12MagneticLensC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa12MagneticLensC2Eh3
_ZN7crpropa12MagneticLensD2Ev3
_ZN7crpropa8LensPartC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEdd3
_ZN7crpropa8LensPartC2Ev0
_ZN7crpropa8LensPartD2Ev3
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticLens/MagneticLens.h.gcov.html b/doc/coverageReport/include/crpropa/magneticLens/MagneticLens.h.gcov.html new file mode 100644 index 000000000..1a6c474df --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticLens/MagneticLens.h.gcov.html @@ -0,0 +1,352 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticLens/MagneticLens.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticLens - MagneticLens.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:204247.6 %
Date:2024-04-08 14:58:22Functions:4666.7 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : //----------------------------------------------------------------------
+       2             : // This file is part of PARSEC (http://physik.rwth-aachen.de/parsec)
+       3             : // a parametrized simulation engine for cosmic rays.
+       4             : //
+       5             : // Copyright (C) 2011   Martin Erdmann, Peter Schiffer, Tobias Winchen
+       6             : //                                                                               RWTH Aachen University, Germany
+       7             : // Contact: winchen@physik.rwth-aachen.de
+       8             : //
+       9             : //      This program is free software: you can redistribute it and/or
+      10             : //      modify it under the terms of the GNU General Public License as
+      11             : //      published by the Free Software Foundation, either version 3 of
+      12             : //      the License, or (at your option) any later version.
+      13             : //
+      14             : //      This program is distributed in the hope that it will be useful,
+      15             : //      but WITHOUT ANY WARRANTY; without even the implied warranty of
+      16             : //      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    See the
+      17             : //      GNU General Public License for more details.
+      18             : //
+      19             : //      You should have received a copy of the GNU General Public License
+      20             : //      along with this program. If not, see <http://www.gnu.org/licenses/>.
+      21             : //----------------------------------------------------------------------
+      22             : 
+      23             : #ifndef MAGNETICLENS_HH
+      24             : #define MAGNETICLENS_HH
+      25             : 
+      26             : #include "crpropa/magneticLens/ModelMatrix.h"
+      27             : #include "crpropa/magneticLens/Pixelization.h"
+      28             : #include "crpropa/Units.h"
+      29             : #include "crpropa/Vector3.h"
+      30             : 
+      31             : #include <vector>
+      32             : #include <string>
+      33             : #include <stdexcept>
+      34             : #include <fstream>
+      35             : #include <sstream>
+      36             : #include <iostream>
+      37             : #include <stdint.h>
+      38             : 
+      39             : 
+      40             : namespace crpropa
+      41             : {
+      42             : 
+      43             : /// Holds one matrix for the lens and information about the rigidity range
+      44             : class LensPart
+      45             : {
+      46             :         string _filename;
+      47             :         double _rigidityMin;
+      48             :         double _rigidityMax;
+      49             :         ModelMatrixType M;
+      50             :         double _maximumSumOfColumns;
+      51             :         bool _maximumSumOfColumns_calculated;
+      52             : 
+      53             : public:
+      54           0 :         LensPart()
+      55           0 :         {
+      56           0 :         }
+      57             :         /// File containing the matrix to be used in the range rigidityMin,
+      58             :         /// rigidityMax in Joule
+      59           3 :         LensPart(const std::string &filename, double rigidityMin, double rigidityMax) :
+      60           3 :                         _filename(filename), _rigidityMin(rigidityMin), _rigidityMax(rigidityMax), _maximumSumOfColumns_calculated(
+      61           3 :                                         false), _maximumSumOfColumns(0)
+      62             :         {
+      63           3 :         }
+      64             : 
+      65           3 :         ~LensPart()
+      66             :         {
+      67           3 :         }
+      68             : 
+      69             :         /// Loads the matrix from file
+      70             :         void loadMatrixFromFile()
+      71             :         {
+      72           0 :                 deserialize(_filename, M);
+      73           0 :         }
+      74             : 
+      75             :         /// Returns the filename of the matrix
+      76             :         const std::string& getFilename()
+      77             :         {
+      78             :                 return _filename;
+      79             :         }
+      80             : 
+      81             :         /// Calculates the maximum of the sums of columns for the matrix
+      82             :         double getMaximumOfSumsOfColumns()
+      83             :         {
+      84           0 :                 if (!_maximumSumOfColumns_calculated)
+      85             :                 { // lazy calculation of maximum
+      86           0 :                         _maximumSumOfColumns = maximumOfSumsOfColumns(M);
+      87           0 :                         _maximumSumOfColumns_calculated = true;
+      88             :                 }
+      89           0 :                 return _maximumSumOfColumns;
+      90             :         }
+      91             : 
+      92             :         /// Returns the minimum of the rigidity range for the lenspart in eV
+      93             :         double getMinimumRigidity()
+      94             :         {
+      95       12293 :                 return _rigidityMin / eV;
+      96             :         }
+      97             : 
+      98             :         /// Returns the maximum of the rigidity range for the lenspart in eV
+      99             :         double getMaximumRigidity()
+     100             :         {
+     101       12292 :                 return _rigidityMax / eV;
+     102             :         }
+     103             : 
+     104             :         /// Returns the modelmatrix
+     105             :         ModelMatrixType& getMatrix()
+     106             :         {
+     107           0 :                 return M;
+     108             :         }
+     109             : 
+     110             :         /// Sets the modelmatrix
+     111             :         void setMatrix(const ModelMatrixType& m)
+     112             :         {
+     113           3 :                 M = m;
+     114           0 :         }
+     115             : 
+     116             : 
+     117             : };
+     118             : 
+     119             : /// Function to calculate the mean deflection [rad] of the matrix M, given a pixelization
+     120             : //double calculateMeanDeflection(const ModelMatrix &M,
+     121             : //              const Pixelization &pixelization)
+     122             : //{
+     123             : //      double totalDeflection = 0;
+     124             : //      double weightSum = 0;
+     125             : //      for (const_i2_t it1 = M.begin2(); it1 != (M.end2()); it1++)
+     126             : //      {
+     127             : //              for (const_i1_t it2 = it1.begin(); it2 != it1.end(); it2++)
+     128             : //              {
+     129             : //                      totalDeflection+= pixelization.angularDistance(it2.index1(),
+     130             : //                                      it2.index2()) * (*it2) ;
+     131             : //                      weightSum+= (*it2);
+     132             : //              }
+     133             : //      }
+     134             : //      return totalDeflection / weightSum;
+     135             : //}
+     136             : 
+     137             : typedef std::vector<LensPart*>::iterator LensPartIter;
+     138             : typedef std::vector<LensPart*>::const_iterator const_LensPartIter;
+     139             : 
+     140             : /**
+     141             :  * \addtogroup MagneticLenses 
+     142             :  * @{
+     143             :  */
+     144             : 
+     145             : /// The lens for the galactic magnetic field.
+     146             : /// Note that the energies refer to protons (Z=1). To be used with other particles with a different charge number please select the rigidity accordingly.
+     147             : class MagneticLens
+     148             : {
+     149             : 
+     150             :         void updateRigidityBounds(double rigidityMin, double rigidityMax);
+     151             : 
+     152             :         /// Loads part of a lens (one matrix) from file to use it in given rigidity range.
+     153             :         void loadLensPart(const string &filename, double rigidityMin,
+     154             :                         double rigidityMax);
+     155             : 
+     156             :         // Stores the individual lenses
+     157             :         std::vector<LensPart*> _lensParts;
+     158             :         Pixelization* _pixelization;
+     159             :         // Checks Matrix, raises Errors if not ok - also generate
+     160             :         // _pixelization if called first time
+     161             :         void _checkMatrix(const ModelMatrixType &M);
+     162             :         // minimum / maximum rigidity that is covered by the lens [Joule]
+     163             :         double _minimumRigidity;
+     164             :         double _maximumRigidity;
+     165             :         static bool _randomSeeded;
+     166             :         double _norm;
+     167             : 
+     168             : public:
+     169             :         /// Default constructor
+     170           0 :         MagneticLens() :
+     171           0 :                         _pixelization(NULL), _minimumRigidity(DBL_MAX), _maximumRigidity(DBL_MIN), _norm(1)
+     172             :         {
+     173             :         }
+     174             : 
+     175             :         /// Constructs lens with predefined healpix order
+     176           3 :         MagneticLens(uint8_t healpixorder) :
+     177           3 :                         _pixelization(NULL), _minimumRigidity(DBL_MAX), _maximumRigidity(DBL_MIN)
+     178             :         {
+     179           3 :                 _pixelization = new Pixelization(healpixorder);
+     180           3 :         }
+     181             : 
+     182             :         /// Construct lens and load lens from file
+     183           0 :         MagneticLens(const string &filename) :
+     184           0 :                         _pixelization(NULL), _minimumRigidity(DBL_MAX), _maximumRigidity(DBL_MIN)
+     185             :         {
+     186           0 :                 loadLens(filename);
+     187           0 :         }
+     188             : 
+     189             :         /// Returns the pixelization used
+     190             :         const Pixelization& getPixelization() const
+     191             :         {
+     192           0 :                 return (*_pixelization);
+     193             :         }
+     194             : 
+     195             :         /// Default destructor
+     196           3 :         ~MagneticLens()
+     197             :         {
+     198           3 :                 if (_pixelization)
+     199           3 :                         delete _pixelization;
+     200           3 :                 for (std::vector<LensPart*>::iterator iter = _lensParts.begin();
+     201           6 :                                 iter != _lensParts.end(); iter++)
+     202             :                 {
+     203           3 :                         delete (*iter);
+     204             :                 }
+     205             :                 _lensParts.clear();
+     206           3 :         }
+     207             : 
+     208             :         /// Try to transform the comsic ray to a new direction.
+     209             :         /// Returns false and does not change phi and theta if the cosmic ray is
+     210             :         /// lost due to conservation of cosmic ray flux.
+     211             :         /// Rigidity is given in Joule, phi and theta in rad
+     212             :         bool transformCosmicRay(double rigidity, double& phi, double& theta);
+     213             : 
+     214             :         /// Tries transform a cosmic ray with momentum vector p
+     215             :         bool transformCosmicRay(double rigidity, Vector3d &p);
+     216             : 
+     217             :         /// transforms the model array assuming that model points to an array of the
+     218             :         /// correct size. Rigidity is given in Joule
+     219             :         void transformModelVector(double* model, double rigidity) const;
+     220             : 
+     221             :         /// Loads M as part of a lens and use it in given rigidity range with
+     222             :         /// rigidities given in Joule
+     223             :         void setLensPart(const ModelMatrixType &M, double rigidityMin, double rigidityMax);
+     224             : 
+     225             :         /// Loads a lens from a given file, containing lines like
+     226             :         /// lensefile.MLDAT rigidityMin rigidityMax
+     227             :         /// rigidities are given in logarithmic units [log10(E / eV)]
+     228             :         void loadLens(const string &filename);
+     229             : 
+     230             :         /// Normalizes the lens parts to the maximum of sums of columns of
+     231             :         /// every lenspart. By doing this, the lens won't distort the spectrum
+     232             :         void normalizeLens();
+     233             : 
+     234             :         /// Normalizes the lens parts individually. Normalized this way, the
+     235             :         /// lens generally distorts the spectrum of the sources, but deflects
+     236             :         /// the UHECR more efficiently.
+     237             :         void normalizeLensparts();
+     238             : 
+     239             :         /// Checks if rigidity [Joule] is covered by lens
+     240             :         bool rigidityCovered(double rigidity) const;
+     241             : 
+     242             :         /// Normalizes all matrix columns - the lens will then create fake
+     243             :         /// anisotropies, but won't drop particles
+     244             :         void normalizeMatrixColumns();
+     245             : 
+     246             :         /// Returns minimum rigidity covered by lens, in eV
+     247             :         double getMinimumRigidity() const
+     248             :         {
+     249           0 :                 return _minimumRigidity / eV;
+     250             :         }
+     251             :         /// Returns maximum rigidity covered by lens, in eV
+     252             :         double getMaximumRigidity() const
+     253             :         {
+     254           0 :                 return _maximumRigidity / eV;
+     255             :         }
+     256             : 
+     257             :         //      returns the norm used for the lenses
+     258             :         double getNorm()
+     259             :         {
+     260           0 :                 return _norm;
+     261             :         }
+     262             : 
+     263             :         /// Returns iterator to the lens part with rigidity Joule
+     264             :         LensPart* getLensPart(double rigidity) const;
+     265             : 
+     266             :         /// Returns all lens parts
+     267             :         const std::vector<LensPart*>& getLensParts() const
+     268             :         {
+     269           0 :                 return _lensParts;
+     270             :         }
+     271             : };
+     272             : 
+     273             : /** @}*/
+     274             : } // namespace
+     275             : 
+     276             : #endif // MAGNETICLENS_HH
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticLens/ParticleMapsContainer.h.func-sort-c.html b/doc/coverageReport/include/crpropa/magneticLens/ParticleMapsContainer.h.func-sort-c.html new file mode 100644 index 000000000..907daed16 --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticLens/ParticleMapsContainer.h.func-sort-c.html @@ -0,0 +1,80 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticLens/ParticleMapsContainer.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticLens - ParticleMapsContainer.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:21020.0 %
Date:2024-04-08 14:58:22Functions:1250.0 %
+
+ +
+ + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa21ParticleMapsContainer9getWeightEid0
_ZN7crpropa21ParticleMapsContainerC2Edd2
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticLens/ParticleMapsContainer.h.func.html b/doc/coverageReport/include/crpropa/magneticLens/ParticleMapsContainer.h.func.html new file mode 100644 index 000000000..1197e3fa1 --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticLens/ParticleMapsContainer.h.func.html @@ -0,0 +1,80 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticLens/ParticleMapsContainer.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticLens - ParticleMapsContainer.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:21020.0 %
Date:2024-04-08 14:58:22Functions:1250.0 %
+
+ +
+ + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa21ParticleMapsContainer9getWeightEid0
_ZN7crpropa21ParticleMapsContainerC2Edd2
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticLens/ParticleMapsContainer.h.gcov.html b/doc/coverageReport/include/crpropa/magneticLens/ParticleMapsContainer.h.gcov.html new file mode 100644 index 000000000..b652fe992 --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticLens/ParticleMapsContainer.h.gcov.html @@ -0,0 +1,221 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticLens/ParticleMapsContainer.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticLens - ParticleMapsContainer.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:21020.0 %
Date:2024-04-08 14:58:22Functions:1250.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_PARTICLEMAPSCONTAINER_HH
+       2             : #define CRPROPA_PARTICLEMAPSCONTAINER_HH
+       3             : 
+       4             : #include <map>
+       5             : #include <vector>
+       6             : #include "crpropa/magneticLens/Pixelization.h"
+       7             : #include "crpropa/magneticLens/MagneticLens.h"
+       8             : 
+       9             : #include "crpropa/Vector3.h"
+      10             : 
+      11             : namespace crpropa {
+      12             : /**
+      13             :  * \addtogroup MagneticLenses 
+      14             :  * @{
+      15             :  */
+      16             : 
+      17             : /** 
+      18             :  @class ParticleMapsContainer
+      19             :  @brief A container for particle maps
+      20             : 
+      21             :  The maps are stored with discrete energies on a logarithmic scale. The
+      22             :  default energy width is 0.02 with an energy bin from 10**17.99 - 10**18.01 eV.
+      23             :  */
+      24             : class ParticleMapsContainer {
+      25             : private:
+      26             :         std::map<int, std::map <int, double*> > _data;
+      27             :         Pixelization _pixelization;
+      28             :         double _deltaLogE;
+      29             :         double _bin0lowerEdge;
+      30             : 
+      31             :         // get the bin number of the energy
+      32             :         int energy2Idx(double energy) const;
+      33             :         double idx2Energy(int idx) const;
+      34             : 
+      35             :         // weights of the particles
+      36             :         double _sumOfWeights;
+      37             :         std::map<int, double > _weightsPID;
+      38             :         std::map<int, map<int, double> > _weights_pidEnergy;
+      39             : 
+      40             :         // lazy update of weights
+      41             :         bool _weightsUpToDate;
+      42             :         void _updateWeights();
+      43             : 
+      44             : public:
+      45             :         /** Constructor.
+      46             :          @param deltaLogE               width of logarithmic energy bin [in eV]
+      47             :          @param bin0lowerEdge   logarithm of energy of the lower edge of first bin [in log(eV)]
+      48             :          */
+      49           2 :         ParticleMapsContainer(double deltaLogE = 0.02, double bin0lowerEdge = 17.99) : _deltaLogE(deltaLogE), _bin0lowerEdge(bin0lowerEdge), _pixelization(6), _weightsUpToDate(false), _sumOfWeights(0) {
+      50           2 :         }
+      51             :         /** Destructor.
+      52             :          */
+      53             :         ~ParticleMapsContainer();
+      54             : 
+      55             :         size_t getNumberOfPixels() {
+      56           0 :                 return _pixelization.getNumberOfPixels();
+      57             :         }
+      58             : 
+      59             :         /** Get the map for the particleId with the given energy.
+      60             :          @param particleId              id of the particle following the PDG numbering scheme
+      61             :          @param energy                  the energy of the particle [in Joules]
+      62             :          @returns The map for a given particleId with a given energy
+      63             :          */
+      64             :         double *getMap(const int particleId, double energy);
+      65             : 
+      66             :         /** Adds a particle to the map container.
+      67             :          @param particleId                      id of the particle following the PDG numbering scheme
+      68             :          @param energy                          the energy of the particle [in Joules]
+      69             :          @param galacticLongitude       galactic longitude [radians]
+      70             :          @param galacticLatitude        galactic latitude [radians]
+      71             :          @param weight                          relative weight for the specific particle
+      72             :         */
+      73             :         void addParticle(const int particleId, double energy, double galacticLongitude, double galacticLatitude, double weight = 1);
+      74             :         /** Adds a particle to the map container.
+      75             :          @param particleId                      id of the particle following the PDG numbering scheme
+      76             :          @param energy                          the energy of the particle [in Joules]
+      77             :          @param v                                       vector containing the arrival directions of a particle
+      78             :          @param weight                          relative weight for the specific particle
+      79             :         */
+      80             :         void addParticle(const int particleId, double energy, const Vector3d &v, double weight = 1);
+      81             : 
+      82             :         /** Get all particle ids in the map.
+      83             :          @returns Vector of all ids.
+      84             :          */
+      85             :         std::vector<int> getParticleIds();
+      86             : 
+      87             :         /** Get energies in map.
+      88             :          @param pid     id of the particle following the PDG numbering scheme
+      89             :          @returns Energies are returned in units of eV (unlike in other CRPropa modules) for performance reasons
+      90             :          */
+      91             :         std::vector<double> getEnergies(int pid);
+      92             : 
+      93             :         void applyLens(MagneticLens &lens);;
+      94             : 
+      95             :         /** Get random particles from map.
+      96             :          The arguments are the vectors where the information will be stored.
+      97             :          @param N                                       number of particles to be selected
+      98             :          @param particleId                      id of the particle following the PDG numbering scheme
+      99             :          @param energy                          energy of interest [in eV]
+     100             :          @param galacticLongitudes      longitude in the interval [-pi, pi] [in radians]
+     101             :          @param galacticLatitudes       latitude in the interval [-pi/2, pi/2] [in radians]
+     102             :          */
+     103             :         void getRandomParticles(size_t N, vector<int> &particleId,
+     104             :                 vector<double> &energy, vector<double> &galacticLongitudes,
+     105             :                 vector<double> &galacticLatitudes);
+     106             : 
+     107             :         /** Places a particle with given id and energy according to the  probability maps. 
+     108             :          @param pid                                     id of the particle following the PDG numbering scheme
+     109             :          @param energy                          energy of interest [in eV]
+     110             :          @param galacticLongitude       longitude in the interval [-pi, pi] [in radians]
+     111             :          @param galacticLatitude        latitude in the interval [-pi/2, pi/2] [in radians]
+     112             :          @returns Returns false if operation not possible; true otherwise.
+     113             :          */
+     114             :         bool placeOnMap(int pid, double energy, double &galacticLongitude, double &galacticLatitude);
+     115             : 
+     116             :         /** Force weight update prior to getting random particles. 
+     117             :          Only necessary when reusing pointer to maps after calculating weights.
+     118             :         */
+     119             :         void forceWeightUpdate();
+     120             : 
+     121             :         /** Get sum of weights of the maps.
+     122             :          @returns Sum of all weights.
+     123             :          */
+     124             :         double getSumOfWeights() {
+     125           0 :                 if (!_weightsUpToDate)
+     126           0 :                         _updateWeights();
+     127           0 :                 return _sumOfWeights;
+     128             :         }
+     129             : 
+     130             :         /** Get weight for a given particle and energy
+     131             :          @param pid                                     id of the particle following the PDG numbering scheme
+     132             :          @param energy                          energy of interest [in eV]
+     133             :          @returns Weight for the chosen particle and energy.
+     134             :          */
+     135           0 :         double getWeight(int pid, double energy) {
+     136           0 :                 if (!_weightsUpToDate)
+     137           0 :                         _updateWeights();
+     138           0 :                 return _weights_pidEnergy[pid][energy2Idx(energy)];
+     139             :         }
+     140             : };
+     141             : /** @}*/
+     142             : 
+     143             : } // namespace crpropa
+     144             : 
+     145             : #endif // CRPROPA_PARTICLEMAPSCONTAINER_HH
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticLens/Pixelization.h.func-sort-c.html b/doc/coverageReport/include/crpropa/magneticLens/Pixelization.h.func-sort-c.html new file mode 100644 index 000000000..728ad5e1e --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticLens/Pixelization.h.func-sort-c.html @@ -0,0 +1,84 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticLens/Pixelization.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticLens - Pixelization.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:81844.4 %
Date:2024-04-08 14:58:22Functions:1333.3 %
+
+ +
+ + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa12Pixelization15getPixelsInConeEdddRSt6vectorIiSaIiEE0
_ZN7crpropa12PixelizationC2Ev0
_ZN7crpropa12PixelizationC2Eh10
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticLens/Pixelization.h.func.html b/doc/coverageReport/include/crpropa/magneticLens/Pixelization.h.func.html new file mode 100644 index 000000000..cc5239816 --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticLens/Pixelization.h.func.html @@ -0,0 +1,84 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticLens/Pixelization.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticLens - Pixelization.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:81844.4 %
Date:2024-04-08 14:58:22Functions:1333.3 %
+
+ +
+ + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa12Pixelization15getPixelsInConeEdddRSt6vectorIiSaIiEE0
_ZN7crpropa12PixelizationC2Eh10
_ZN7crpropa12PixelizationC2Ev0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticLens/Pixelization.h.gcov.html b/doc/coverageReport/include/crpropa/magneticLens/Pixelization.h.gcov.html new file mode 100644 index 000000000..370ed122b --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticLens/Pixelization.h.gcov.html @@ -0,0 +1,217 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticLens/Pixelization.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticLens - Pixelization.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:81844.4 %
Date:2024-04-08 14:58:22Functions:1333.3 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : //----------------------------------------------------------------------
+       2             : // This file is part of PARSEC (http://physik.rwth-aachen.de/parsec)
+       3             : // a parametrized simulation engine for cosmic rays.
+       4             : //
+       5             : // Copyright (C) 2011  Martin Erdmann, Peter Schiffer, Tobias Winchen
+       6             : //                     RWTH Aachen University, Germany
+       7             : // Contact: winchen@physik.rwth-aachen.de
+       8             : //
+       9             : //  This program is free software: you can redistribute it and/or
+      10             : //  modify it under the terms of the GNU General Public License as
+      11             : //  published by the Free Software Foundation, either version 3 of
+      12             : //  the License, or (at your option) any later version.
+      13             : //
+      14             : //  This program is distributed in the hope that it will be useful,
+      15             : //  but WITHOUT ANY WARRANTY; without even the implied warranty of
+      16             : //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+      17             : //  GNU General Public License for more details.
+      18             : //
+      19             : //  You should have received a copy of the GNU General Public License
+      20             : //  along with this program. If not, see <http://www.gnu.org/licenses/>.
+      21             : //----------------------------------------------------------------------
+      22             : 
+      23             : 
+      24             : #ifndef PIXELIZATION_HH
+      25             : #define PIXELIZATION_HH
+      26             : 
+      27             : #include "healpix_base/healpix_base.h"
+      28             : #include <cmath>
+      29             : #include <stdint.h>
+      30             : 
+      31             : namespace crpropa
+      32             : {
+      33             : /**
+      34             :  * \addtogroup MagneticLenses
+      35             :  * @{
+      36             :  */
+      37             : 
+      38             : /// Helpers to makes work with Healpix smooth
+      39             : const uint8_t _nOrder_max = 13;
+      40             : const uint32_t _nPix[] =
+      41             : {
+      42             :                 48,
+      43             :                 192,
+      44             :                 768,
+      45             :                 3072,
+      46             :                 12288,
+      47             :                 49152,
+      48             :                 196608,
+      49             :                 786432,
+      50             :                 3145728,
+      51             :                 12582912,
+      52             :                 50331648,
+      53             :                 201326592,
+      54             :                 805306368
+      55             : };
+      56             : 
+      57             : /// Every communication with healpix is done through this class to avoid
+      58             : /// bugs with missmatching coordinates (and make python hooks easier)
+      59             : class Pixelization
+      60             : {
+      61             : public:
+      62           0 :         Pixelization()
+      63           0 :         {
+      64           0 :                 _healpix = new healpix::T_Healpix_Base<int>(6, healpix::RING);
+      65           0 :         }
+      66             : 
+      67             :         /// Constructor creating Pixelization with healpix order 6 (about
+      68             :         /// 50000 pixels)
+      69          10 :         Pixelization(uint8_t order)
+      70          10 :         {
+      71          10 :                 _healpix = new healpix::T_Healpix_Base<int>(order, healpix::RING);
+      72          10 :         }
+      73             : 
+      74             :         ~Pixelization()
+      75             :         {
+      76          10 :                 delete _healpix;
+      77          10 :         }
+      78             : 
+      79             :         /// Returns the number of the pixel which includes the direction (phi,theta)
+      80             :         /// phi in [-pi, pi], theta in [-pi/2, pi/2]
+      81             :         uint32_t direction2Pix(double longitude, double latitude) const;
+      82             : 
+      83             :         /// Returns the number of pixels of the pixelization
+      84             :         uint32_t nPix() const
+      85             :         {
+      86       86026 :                 return _healpix->Npix();
+      87             :         }
+      88             : 
+      89             :         /// Returns the number of pixels given by healpix order
+      90             :         static uint32_t nPix(uint8_t order);
+      91             : 
+      92             :         /// Returns the number of pixels of the pixelization
+      93             :         int getNumberOfPixels()
+      94             :         {
+      95    10317737 :                 return _healpix->Npix();
+      96             :         }
+      97             : 
+      98             :         /// Returns the order, a given pixel number corresponds to. 0 if no
+      99             :         /// match!
+     100             :         static uint8_t pix2Order(uint32_t pix);
+     101             : 
+     102             :         /// Gives the center of pixel i in longitude [rad] and latitude [rad]
+     103             :         void pix2Direction(uint32_t i, double &longitude, double &latitude) const;
+     104             : 
+     105             :         /// Calculate the angle [rad] between the vectors pointing to pixels i and j
+     106             :         double angularDistance(uint32_t i, uint32_t j) const;
+     107             : 
+     108             :         /// Returns the maximum possible pixelization order
+     109             :         uint8_t getMaxOrder() const
+     110             :         {
+     111             :                 return _nOrder_max;
+     112             :         }
+     113             : 
+     114             :   /// Returns healpix order
+     115             :   uint8_t getOrder() const
+     116             :   {
+     117           0 :     return _healpix->Order();
+     118             :   }
+     119             : 
+     120             :         void getRandomDirectionInPixel(uint32_t pixel, double &longitude, double &latitude);
+     121             : 
+     122           0 :         void getPixelsInCone(double longitude, double latitude,double radius, std::vector<int>& listpix)
+     123             :         {
+     124             :                 healpix::vec3 v;
+     125           0 :                 spherCo2Vec(longitude, latitude, v);
+     126             :                 healpix::pointing p;
+     127           0 :                 p.from_vec3(v);
+     128           0 :                 _healpix->query_disc(p, radius, listpix);
+     129           0 :         }
+     130             : 
+     131             : private:
+     132             :         void spherCo2Vec(double phi, double theta, healpix::vec3 &V) const;
+     133             :         void vec2SphereCo(double &phi , double &theta, const healpix::vec3 &V) const;
+     134             :         healpix::T_Healpix_Base<int> *_healpix;
+     135             :         static healpix::T_Healpix_Base<healpix::int64> _healpix_nest;
+     136             : };
+     137             : 
+     138             : 
+     139             : /** @}*/
+     140             : } // namespace
+     141             : #endif // PIXELIZATION_HH
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticLens/index-sort-f.html b/doc/coverageReport/include/crpropa/magneticLens/index-sort-f.html new file mode 100644 index 000000000..6f02276e0 --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticLens/index-sort-f.html @@ -0,0 +1,113 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticLens + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticLensHitTotalCoverage
Test:coverage.info.cleanedLines:307042.9 %
Date:2024-04-08 14:58:22Functions:61154.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Pixelization.h +
44.4%44.4%
+
44.4 %8 / 1833.3 %1 / 3
ParticleMapsContainer.h +
20.0%20.0%
+
20.0 %2 / 1050.0 %1 / 2
MagneticLens.h +
47.6%47.6%
+
47.6 %20 / 4266.7 %4 / 6
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticLens/index-sort-l.html b/doc/coverageReport/include/crpropa/magneticLens/index-sort-l.html new file mode 100644 index 000000000..053630cae --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticLens/index-sort-l.html @@ -0,0 +1,113 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticLens + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticLensHitTotalCoverage
Test:coverage.info.cleanedLines:307042.9 %
Date:2024-04-08 14:58:22Functions:61154.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
ParticleMapsContainer.h +
20.0%20.0%
+
20.0 %2 / 1050.0 %1 / 2
Pixelization.h +
44.4%44.4%
+
44.4 %8 / 1833.3 %1 / 3
MagneticLens.h +
47.6%47.6%
+
47.6 %20 / 4266.7 %4 / 6
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/magneticLens/index.html b/doc/coverageReport/include/crpropa/magneticLens/index.html new file mode 100644 index 000000000..279e0695b --- /dev/null +++ b/doc/coverageReport/include/crpropa/magneticLens/index.html @@ -0,0 +1,113 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/magneticLens + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/magneticLensHitTotalCoverage
Test:coverage.info.cleanedLines:307042.9 %
Date:2024-04-08 14:58:22Functions:61154.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
MagneticLens.h +
47.6%47.6%
+
47.6 %20 / 4266.7 %4 / 6
ParticleMapsContainer.h +
20.0%20.0%
+
20.0 %2 / 1050.0 %1 / 2
Pixelization.h +
44.4%44.4%
+
44.4 %8 / 1833.3 %1 / 3
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/massDistribution/Cordes.h.func-sort-c.html b/doc/coverageReport/include/crpropa/massDistribution/Cordes.h.func-sort-c.html new file mode 100644 index 000000000..2d2c7d39b --- /dev/null +++ b/doc/coverageReport/include/crpropa/massDistribution/Cordes.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Cordes.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/massDistribution - Cordes.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/massDistribution/Cordes.h.func.html b/doc/coverageReport/include/crpropa/massDistribution/Cordes.h.func.html new file mode 100644 index 000000000..8ec13117b --- /dev/null +++ b/doc/coverageReport/include/crpropa/massDistribution/Cordes.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Cordes.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/massDistribution - Cordes.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/massDistribution/Cordes.h.gcov.html b/doc/coverageReport/include/crpropa/massDistribution/Cordes.h.gcov.html new file mode 100644 index 000000000..0ec8b1bff --- /dev/null +++ b/doc/coverageReport/include/crpropa/massDistribution/Cordes.h.gcov.html @@ -0,0 +1,121 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Cordes.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/massDistribution - Cordes.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_CORDES_H
+       2             : #define CRPROPA_CORDES_H
+       3             : 
+       4             : #include "crpropa/massDistribution/Density.h"
+       5             : 
+       6             : #include <cmath>
+       7             : #include <string>
+       8             : 
+       9             : namespace crpropa {
+      10             : /**
+      11             :         @class Cordes
+      12             :         @brief Cylindrical symetrical model of the density of ionised hydrogen (HII) of the Milky Way
+      13             :         Cordes et al., 1991, Nature 353,737
+      14             :         */
+      15           1 : class Cordes: public Density {
+      16             : private:
+      17             :         // DO NOT CHANGE model type!
+      18             :         bool isforHI = false;
+      19             :         bool isforHII = true;
+      20             :         bool isforH2 = false;
+      21             : 
+      22             : public:
+      23             :         /** @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
+      24             :          @return density in parts/m^3 */
+      25             :         double getDensity(const Vector3d &position) const;
+      26             :         /** @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
+      27             :          @return density of ionised hydrogen in parts/m^3, equal getDensity thus no other type is included for Cordes */
+      28             :         double getHIIDensity(const Vector3d &position) const;
+      29             :         /** @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
+      30             :          @return density of nucleons in parts/m^3, equal getDensity thus only HII is included for Cordes */
+      31             :         double getNucleonDensity(const Vector3d &position) const;
+      32             : 
+      33             :         /** @return activation status of HI */
+      34             :         bool getIsForHI();
+      35             :         /** @return activation status of HII */
+      36             :         bool getIsForHII();
+      37             :         /** @return activation status of H2 */
+      38             :         bool getIsForH2();
+      39             : 
+      40             :         std::string getDescription();
+      41             : };
+      42             : 
+      43             : }  // namespace crpropa
+      44             : 
+      45             : #endif  // CRPROPA_CORDES_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/massDistribution/Density.h.func-sort-c.html b/doc/coverageReport/include/crpropa/massDistribution/Density.h.func-sort-c.html new file mode 100644 index 000000000..61d743401 --- /dev/null +++ b/doc/coverageReport/include/crpropa/massDistribution/Density.h.func-sort-c.html @@ -0,0 +1,116 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Density.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/massDistribution - Density.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0210.0 %
Date:2024-04-08 14:58:22Functions:0110.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa7Density10getIsForH2Ev0
_ZN7crpropa7Density10getIsForHIEv0
_ZN7crpropa7Density11getIsForHIIEv0
_ZN7crpropa7Density14getDescriptionB5cxx11Ev0
_ZN7crpropa7DensityD0Ev0
_ZN7crpropa7DensityD2Ev0
_ZNK7crpropa7Density10getDensityERKNS_7Vector3IdEE0
_ZNK7crpropa7Density12getH2DensityERKNS_7Vector3IdEE0
_ZNK7crpropa7Density12getHIDensityERKNS_7Vector3IdEE0
_ZNK7crpropa7Density13getHIIDensityERKNS_7Vector3IdEE0
_ZNK7crpropa7Density17getNucleonDensityERKNS_7Vector3IdEE0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/massDistribution/Density.h.func.html b/doc/coverageReport/include/crpropa/massDistribution/Density.h.func.html new file mode 100644 index 000000000..f9ed0dff3 --- /dev/null +++ b/doc/coverageReport/include/crpropa/massDistribution/Density.h.func.html @@ -0,0 +1,116 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Density.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/massDistribution - Density.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0210.0 %
Date:2024-04-08 14:58:22Functions:0110.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa7Density10getIsForH2Ev0
_ZN7crpropa7Density10getIsForHIEv0
_ZN7crpropa7Density11getIsForHIIEv0
_ZN7crpropa7Density14getDescriptionB5cxx11Ev0
_ZN7crpropa7DensityD0Ev0
_ZN7crpropa7DensityD2Ev0
_ZNK7crpropa7Density10getDensityERKNS_7Vector3IdEE0
_ZNK7crpropa7Density12getH2DensityERKNS_7Vector3IdEE0
_ZNK7crpropa7Density12getHIDensityERKNS_7Vector3IdEE0
_ZNK7crpropa7Density13getHIIDensityERKNS_7Vector3IdEE0
_ZNK7crpropa7Density17getNucleonDensityERKNS_7Vector3IdEE0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/massDistribution/Density.h.gcov.html b/doc/coverageReport/include/crpropa/massDistribution/Density.h.gcov.html new file mode 100644 index 000000000..5b9e5404b --- /dev/null +++ b/doc/coverageReport/include/crpropa/massDistribution/Density.h.gcov.html @@ -0,0 +1,134 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Density.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/massDistribution - Density.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0210.0 %
Date:2024-04-08 14:58:22Functions:0110.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_DENSITY_H
+       2             : #define CRPROPA_DENSITY_H
+       3             : 
+       4             : #include "crpropa/Units.h"
+       5             : #include "crpropa/Vector3.h"
+       6             : #include "crpropa/Referenced.h"
+       7             : 
+       8             : namespace crpropa {
+       9             : 
+      10             : /**
+      11             :  @class Density
+      12             :  @brief Abstract base class for target densities
+      13             :  */
+      14           0 : class Density: public Referenced {
+      15             : public:
+      16           0 :         virtual ~Density() {
+      17           0 :         }
+      18             : 
+      19           0 :         virtual double getDensity(const Vector3d &position) const {  // sum of all densities
+      20           0 :                 return 0;
+      21             :         }
+      22             : 
+      23           0 :         virtual double getHIDensity(const Vector3d &position) const {
+      24           0 :                 return 0;
+      25             :         }
+      26             : 
+      27           0 :         virtual double getHIIDensity(const Vector3d &position) const {
+      28           0 :                 return 0;
+      29             :         }
+      30             : 
+      31           0 :         virtual double getH2Density(const Vector3d &position) const {
+      32           0 :                 return 0;
+      33             :         }
+      34             : 
+      35           0 :         virtual double getNucleonDensity(const Vector3d &position) const {  // sum of nucleons (H2 with factor 2)
+      36           0 :                 return 0;
+      37             :         }
+      38             : 
+      39           0 :         virtual bool getIsForHI() {
+      40           0 :                 return false;
+      41             :         }
+      42             : 
+      43           0 :         virtual bool getIsForHII() {
+      44           0 :                 return false;
+      45             :         }
+      46             : 
+      47           0 :         virtual bool getIsForH2() {
+      48           0 :                 return false;
+      49             :         }
+      50             : 
+      51           0 :         virtual std::string getDescription() {
+      52           0 :                 return "Abstract Density Module\n";
+      53             :         }
+      54             : };
+      55             : 
+      56             : }  // namespace crpropa
+      57             : 
+      58             : #endif  // CRPROPA_DENSITY_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/massDistribution/Ferriere.h.func-sort-c.html b/doc/coverageReport/include/crpropa/massDistribution/Ferriere.h.func-sort-c.html new file mode 100644 index 000000000..7bb1afb24 --- /dev/null +++ b/doc/coverageReport/include/crpropa/massDistribution/Ferriere.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Ferriere.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/massDistribution - Ferriere.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/massDistribution/Ferriere.h.func.html b/doc/coverageReport/include/crpropa/massDistribution/Ferriere.h.func.html new file mode 100644 index 000000000..9357468f5 --- /dev/null +++ b/doc/coverageReport/include/crpropa/massDistribution/Ferriere.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Ferriere.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/massDistribution - Ferriere.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/massDistribution/Ferriere.h.gcov.html b/doc/coverageReport/include/crpropa/massDistribution/Ferriere.h.gcov.html new file mode 100644 index 000000000..f69801f4a --- /dev/null +++ b/doc/coverageReport/include/crpropa/massDistribution/Ferriere.h.gcov.html @@ -0,0 +1,153 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Ferriere.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/massDistribution - Ferriere.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_FERRIERE_H
+       2             : #define CRPROPA_FERRIERE_H
+       3             : 
+       4             : #include "crpropa/massDistribution/Density.h"
+       5             : 
+       6             : #include <cmath>
+       7             : #include <string>
+       8             : 
+       9             : namespace crpropa {
+      10             : /**
+      11             :  @class Ferriere
+      12             :  @brief model of the distribution of hydrogen in the Milky Way
+      13             :   Here in model Ferriere 2007
+      14             :   seperated in 2 regions (inner, outer). The border is for R=3 kpc in galactocentric radius.
+      15             :   model is discribed in
+      16             : outer: ApJ, 497, 759
+      17             : inner:  arxiv:  astro-ph/0702532
+      18             : */
+      19           2 : class Ferriere: public Density {
+      20             : private:
+      21             :         // standard for all types of distribution
+      22             :         bool isforHI = true;
+      23             :         bool isforHII = true;
+      24             :         bool isforH2 = true;
+      25             :         double Rsun = 8.5 * kpc;  // distance sun-galactic center
+      26             : 
+      27             : public:
+      28             :         /** Coordinate transformation for the CentralMolecularZone region. Rotation arround z-axis such that X is the major axis and Y is the minor axis
+      29             :         @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
+      30             :         @return position in local coordinates for the CMZ region
+      31             :         */
+      32             :         Vector3d CMZTransformation(const Vector3d &position) const;
+      33             :         
+      34             :         /** Coordinate transformation for the galactic bulge disk region in galactic center. Rotation arround the x-axis, the y'-axis and the x''-axis. Difened with X along the major axis, Y along the minor axis and Z along the northern normal
+      35             :         @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
+      36             :         @return position in local coordinates for the GB disk region
+      37             :         */
+      38             :         Vector3d DiskTransformation(const Vector3d &position) const;
+      39             : 
+      40             :         /** @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
+      41             :          @return density in parts/m^3, only acitvated parts are summed up */
+      42             :         double getDensity(const Vector3d &position) const;
+      43             :         /** @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
+      44             :          @return density of atomic hydrogen in parts/m^3 */
+      45             :         double getHIDensity(const Vector3d &position) const;
+      46             :         /** @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
+      47             :          @return density of ionised hydrogen in parts/m^3 */
+      48             :         double getHIIDensity(const Vector3d &position) const;
+      49             :         /** @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
+      50             :          @return density of molecular hydrogen in parts/m^3 */
+      51             :         double getH2Density(const Vector3d &position) const;
+      52             :         /** @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
+      53             :          @return nucleon density in parts/m^3, only activated parts are summed up and H2 is weighted twice */
+      54             :         double getNucleonDensity(const Vector3d &position) const;
+      55             : 
+      56             :         /** changes activation status for atomic hydrogen */
+      57             :         void setIsForHI(bool HI);
+      58             :         /** changes activation status for ionised hydrogen */
+      59             :         void setIsForHII(bool HII);
+      60             :         /** changes activation status for molecular hydrogen */
+      61             :         void setIsForH2(bool H2);
+      62             : 
+      63             :         /** @return activation status for atomic hydrogen */
+      64             :         bool getIsForHI();
+      65             :         /** @return activation status for ionised hydrogen */
+      66             :         bool getIsForHII();
+      67             :         /** @return activation status for molecular hydrogen */
+      68             :         bool getIsForH2();
+      69             : 
+      70             :         std::string getDescription();
+      71             : };
+      72             : 
+      73             : }  // namespace crpropa
+      74             : 
+      75             : #endif  // CRPROPA_FERRIERE_H
+      76             : 
+      77             : 
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/massDistribution/Massdistribution.h.func-sort-c.html b/doc/coverageReport/include/crpropa/massDistribution/Massdistribution.h.func-sort-c.html new file mode 100644 index 000000000..f746939ad --- /dev/null +++ b/doc/coverageReport/include/crpropa/massDistribution/Massdistribution.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Massdistribution.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/massDistribution - Massdistribution.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:22100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/massDistribution/Massdistribution.h.func.html b/doc/coverageReport/include/crpropa/massDistribution/Massdistribution.h.func.html new file mode 100644 index 000000000..af406a149 --- /dev/null +++ b/doc/coverageReport/include/crpropa/massDistribution/Massdistribution.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Massdistribution.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/massDistribution - Massdistribution.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:22100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/massDistribution/Massdistribution.h.gcov.html b/doc/coverageReport/include/crpropa/massDistribution/Massdistribution.h.gcov.html new file mode 100644 index 000000000..a34abbae2 --- /dev/null +++ b/doc/coverageReport/include/crpropa/massDistribution/Massdistribution.h.gcov.html @@ -0,0 +1,212 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Massdistribution.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/massDistribution - Massdistribution.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:22100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_MASSDISTRIBUTION_H
+       2             : #define CRPROPA_MASSDISTRIBUTION_H
+       3             : 
+       4             : #include "crpropa/massDistribution/Density.h"
+       5             : #include "crpropa/Vector3.h"
+       6             : #include "crpropa/Grid.h"
+       7             : 
+       8             : #include "kiss/logger.h"
+       9             : 
+      10             : #include <vector>
+      11             : 
+      12             : namespace crpropa {
+      13             : 
+      14             : /**
+      15             :  @class DensityList
+      16             :  @brief Superposition of density models.
+      17             :  The addDensity function adds a new density to the list.
+      18             :  The getDensity function handles the activated types in loaded densities, whereas get(type)Density disregards the activation state.
+      19             : */
+      20           2 : class DensityList: public Density {
+      21             : private:
+      22             :         std::vector<ref_ptr<Density> > DensityList ;
+      23             : 
+      24             : public:
+      25             :         /** Add new density to list.
+      26             :          @param density density to add
+      27             :         */
+      28             :         void addDensity(ref_ptr<Density> density);
+      29             : 
+      30             :         /** Get density at a given position.
+      31             :          @param position position in Galactic coordinates with Earth at (-8.5 kpc, 0, 0)
+      32             :          @returns Density in particles/m^3, sum up densities from added densities 
+      33             :         */
+      34             :         double getDensity(const Vector3d &position) const;
+      35             :         /** Get HI density at a given position.
+      36             :          @param position position in Galactic coordinates with Earth at (-8.5 kpc, 0, 0)
+      37             :          @returns Density of HI at given position in particles/m^3, sum up all HI densities from added densities
+      38             :          */
+      39             :         double getHIDensity(const Vector3d &position) const;
+      40             :         /** Get HII density at a given position.
+      41             :          @param position position in Galactic coordinates with Earth at (-8.5 kpc, 0, 0)
+      42             :          @returns Density of HII at given position in particles/m^3, sum up all HII densities from added densities 
+      43             :          */
+      44             :         double getHIIDensity(const Vector3d &position) const;
+      45             :         /** Get H2 density at a given position.
+      46             :          @param position position in Galactic coordinates with Earth at (-8.5 kpc, 0, 0)
+      47             :          @returns Density of H2 at given position in particles/m^3, sum up all H2 densities from added densities 
+      48             :          */
+      49             :         double getH2Density(const Vector3d &position) const;
+      50             :         /** Get the density of nucleons.
+      51             :          This is the number of nucleons per volume, summed up all activated density and weight molecular hydrogyen twice
+      52             :          @param position position in Galactic coordinates with Earth at (-8.5 kpc, 0, 0)
+      53             :          @returns Density of nucleons at given position in particles/m^3, sum up all nucleon densities from added densities 
+      54             :          */
+      55             :         double getNucleonDensity(const Vector3d &position) const;
+      56             : 
+      57             :         std::string getDescription();
+      58             : };
+      59             : 
+      60             : /**
+      61             :  @class DensityGrid
+      62             :  @brief Wrapper to use a Grid1f for a density
+      63             : 
+      64             :  The DensityGrid uses a given grid for the chosen density type. More than one type can be chosen to follow the same distribution.
+      65             :  If no type is chosen a warning will be raised and all densities are 0.
+      66             : */
+      67           4 : class DensityGrid: public Density {
+      68             : private: 
+      69             :         ref_ptr<Grid1f> grid; //< Grid with data
+      70             :         bool isForHI, isForHII, isForH2; 
+      71             :         void checkAndWarn(); //< raise a warning if all density types are deactivated.
+      72             : 
+      73             : public:
+      74             :         DensityGrid(ref_ptr<Grid1f> grid, bool isForHI = false, bool isForHII = false, bool isForH2 = false);
+      75             :         
+      76             :         /** Get HI density at a given position.
+      77             :          @param position position in Galactic coordinates with Earth at (-8.5 kpc, 0, 0)
+      78             :          @returns Density of HI at given position in particles/m^3, sum up all HI densities from added densities
+      79             :          */
+      80             :         double getHIDensity(const Vector3d &position) const;
+      81             :         
+      82             :         /** Get HII density at a given position.
+      83             :          @param position position in Galactic coordinates with Earth at (-8.5 kpc, 0, 0)
+      84             :          @returns Density of HII at given position in particles/m^3, sum up all HII densities from added densities 
+      85             :          */
+      86             :         double getHIIDensity(const Vector3d &position) const;
+      87             :         
+      88             :         /** Get H2 density at a given position.
+      89             :          @param position position in Galactic coordinates with Earth at (-8.5 kpc, 0, 0)
+      90             :          @returns Density of H2 at given position in particles/m^3, sum up all H2 densities from added densities 
+      91             :          */
+      92             :         double getH2Density(const Vector3d &position) const;
+      93             : 
+      94             :         /** Get density at a given position.
+      95             :          @param position position in Galactic coordinates with Earth at (-8.5 kpc, 0, 0)
+      96             :          @returns Density in particles/m^3, sum up densities from added densities 
+      97             :         */
+      98             :         double getDensity(const Vector3d &position) const;
+      99             :         
+     100             :         /** Get the density of nucleons.
+     101             :          This is the number of nucleons per volume, summed up all activated density and weight molecular hydrogyen twice
+     102             :          @param position position in Galactic coordinates with Earth at (-8.5 kpc, 0, 0)
+     103             :          @returns Density of nucleons at given position in particles/m^3, sum up all nucleon densities from added densities 
+     104             :          */
+     105             :         double getNucleonDensity(const Vector3d &position) const;
+     106             : 
+     107             :         bool getIsForHI();
+     108             :         bool getIsForHII();
+     109             :         bool getIsForH2();
+     110             : 
+     111             :         /* set if the density is for HI type. 
+     112             :          @param b if True the density is used for HI
+     113             :         */
+     114             :         void setIsForHI(bool b);
+     115             : 
+     116             :         /* set if the density is for HII type. 
+     117             :          @param b if True the density is used for HII
+     118             :         */
+     119             :         void setIsForHII(bool b);
+     120             : 
+     121             :         /* set if the density is for H2 type. 
+     122             :          @param b if True the density is used for H2
+     123             :         */
+     124             :         void setIsForH2(bool b);
+     125             :         
+     126             :         /* Change the grid for the density
+     127             :          @param grid (Grid1f) new grid for the density. 
+     128             :         */
+     129             :         void setGrid(ref_ptr<Grid1f> grid);
+     130             : 
+     131             :         std::string getDescription();
+     132             : };
+     133             : 
+     134             : }  // namespace crpropa
+     135             : 
+     136             : #endif  // CRPROPA_MASSDISTRIBUTION_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/massDistribution/Nakanishi.h.func-sort-c.html b/doc/coverageReport/include/crpropa/massDistribution/Nakanishi.h.func-sort-c.html new file mode 100644 index 000000000..6bb472b29 --- /dev/null +++ b/doc/coverageReport/include/crpropa/massDistribution/Nakanishi.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Nakanishi.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/massDistribution - Nakanishi.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/massDistribution/Nakanishi.h.func.html b/doc/coverageReport/include/crpropa/massDistribution/Nakanishi.h.func.html new file mode 100644 index 000000000..4a26d7662 --- /dev/null +++ b/doc/coverageReport/include/crpropa/massDistribution/Nakanishi.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Nakanishi.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/massDistribution - Nakanishi.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/massDistribution/Nakanishi.h.gcov.html b/doc/coverageReport/include/crpropa/massDistribution/Nakanishi.h.gcov.html new file mode 100644 index 000000000..b3dc30cd8 --- /dev/null +++ b/doc/coverageReport/include/crpropa/massDistribution/Nakanishi.h.gcov.html @@ -0,0 +1,150 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Nakanishi.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/massDistribution - Nakanishi.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_NAKANISHI_H
+       2             : #define CRPROPA_NAKANISHI_H
+       3             : 
+       4             : #include "crpropa/massDistribution/Density.h"
+       5             : 
+       6             : #include <cmath>
+       7             : #include <string>
+       8             : 
+       9             : namespace crpropa {
+      10             : /**
+      11             :  @class Nakanishi
+      12             :  @brief Cylindrical symetrical model of the density distribution of the Milky Way for atomic (HI) and molecular (H2) hydrogen
+      13             :         Modell for HI arXiv:astro-ph/0304338
+      14             :         Modell for H2 arxiv:astro-ph/0610769
+      15             :         fit of the models given in arXiv:1607.07886
+      16             : */
+      17           1 : class Nakanishi: public Density {
+      18             : private:
+      19             :         bool isforHI = true;
+      20             :         bool isforHII = false;
+      21             :         bool isforH2 = true;
+      22             : 
+      23             : public:
+      24             :         /** @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
+      25             :          @returns density in parts/m^3, only activated parts are summed up */
+      26             :         double getDensity(const Vector3d &position) const;
+      27             :         /** @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
+      28             :          @returns density of atomic hydrogen in parts/m^3 */
+      29             :         double getHIDensity(const Vector3d &position) const;
+      30             :         /** @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
+      31             :          @returns density of molecular hydrogen in parts/m^3 */
+      32             :         double getH2Density(const Vector3d &position) const;
+      33             :         /** @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
+      34             :          @returns nucleon density in parts/m^3, only activated parts are summed up and H2 is weighted twice */
+      35             :         double getNucleonDensity(const Vector3d &position) const;
+      36             : 
+      37             :         /** the scale height over the galactic plane of atomic hydrogen is fitted by polynom of degree 3
+      38             :         @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
+      39             :         @returns scale height at given position */
+      40             :         double getHIScaleheight(const Vector3d &position)const;
+      41             :         /** the plane density is fittet by two exponential components with e^-R and e^-(R^2)
+      42             :         @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
+      43             :         @returns plane density in parts/m^3 */
+      44             :         double getHIPlanedensity(const Vector3d &position)const;
+      45             : 
+      46             :         /** the scale height over the galactic plane of molecular hydrogen is fitted by exponential function
+      47             :         @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
+      48             :         @returns scale height at given position */
+      49             :         double getH2Scaleheight(const Vector3d &position)const;
+      50             :         /** the plane density is fitted by two exponential components
+      51             :         @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
+      52             :         @returns plane density in parts/m^3 */
+      53             :         double getH2Planedensity(const Vector3d &position)const;
+      54             : 
+      55             :         /** changes activation status for atomic hydrogen */
+      56             :         void setIsForHI(bool HI);
+      57             :         /** changes activation status for molecular hydrogen */
+      58             :         void setIsForH2(bool H2);
+      59             : 
+      60             :         /** @returns activation status for atomic hydrogen */
+      61             :         bool getIsForHI();
+      62             :         /** @returns activation status for ionised hydrogen */
+      63             :         bool getIsForHII();
+      64             :         /** @returns activation status for molecular hydrogen */
+      65             :         bool getIsForH2();
+      66             :         std::string getDescription();
+      67             : };
+      68             : 
+      69             : }  // namespace crpropa
+      70             : 
+      71             : #endif  // CRPROPA_NAKANISHI_H
+      72             : 
+      73             : 
+      74             : 
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/massDistribution/index-sort-f.html b/doc/coverageReport/include/crpropa/massDistribution/index-sort-f.html new file mode 100644 index 000000000..3be7402d0 --- /dev/null +++ b/doc/coverageReport/include/crpropa/massDistribution/index-sort-f.html @@ -0,0 +1,133 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/massDistribution + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/massDistributionHitTotalCoverage
Test:coverage.info.cleanedLines:52619.2 %
Date:2024-04-08 14:58:22Functions:0110.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Density.h +
0.0%
+
0.0 %0 / 210.0 %0 / 11
Nakanishi.h +
100.0%
+
100.0 %1 / 1-0 / 0
Cordes.h +
100.0%
+
100.0 %1 / 1-0 / 0
Ferriere.h +
100.0%
+
100.0 %1 / 1-0 / 0
Massdistribution.h +
100.0%
+
100.0 %2 / 2-0 / 0
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/massDistribution/index-sort-l.html b/doc/coverageReport/include/crpropa/massDistribution/index-sort-l.html new file mode 100644 index 000000000..5bc81ca8e --- /dev/null +++ b/doc/coverageReport/include/crpropa/massDistribution/index-sort-l.html @@ -0,0 +1,133 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/massDistribution + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/massDistributionHitTotalCoverage
Test:coverage.info.cleanedLines:52619.2 %
Date:2024-04-08 14:58:22Functions:0110.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Density.h +
0.0%
+
0.0 %0 / 210.0 %0 / 11
Nakanishi.h +
100.0%
+
100.0 %1 / 1-0 / 0
Cordes.h +
100.0%
+
100.0 %1 / 1-0 / 0
Ferriere.h +
100.0%
+
100.0 %1 / 1-0 / 0
Massdistribution.h +
100.0%
+
100.0 %2 / 2-0 / 0
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/massDistribution/index.html b/doc/coverageReport/include/crpropa/massDistribution/index.html new file mode 100644 index 000000000..b39e47962 --- /dev/null +++ b/doc/coverageReport/include/crpropa/massDistribution/index.html @@ -0,0 +1,133 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/massDistribution + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/massDistributionHitTotalCoverage
Test:coverage.info.cleanedLines:52619.2 %
Date:2024-04-08 14:58:22Functions:0110.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Cordes.h +
100.0%
+
100.0 %1 / 1-0 / 0
Density.h +
0.0%
+
0.0 %0 / 210.0 %0 / 11
Ferriere.h +
100.0%
+
100.0 %1 / 1-0 / 0
Massdistribution.h +
100.0%
+
100.0 %2 / 2-0 / 0
Nakanishi.h +
100.0%
+
100.0 %1 / 1-0 / 0
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/Boundary.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/Boundary.h.func-sort-c.html new file mode 100644 index 000000000..e449df2d8 --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/Boundary.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/Boundary.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - Boundary.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:66100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/Boundary.h.func.html b/doc/coverageReport/include/crpropa/module/Boundary.h.func.html new file mode 100644 index 000000000..18325e255 --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/Boundary.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/Boundary.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - Boundary.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:66100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/Boundary.h.gcov.html b/doc/coverageReport/include/crpropa/module/Boundary.h.gcov.html new file mode 100644 index 000000000..2eb065210 --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/Boundary.h.gcov.html @@ -0,0 +1,283 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/Boundary.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - Boundary.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:66100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_BOUNDARY_H
+       2             : #define CRPROPA_BOUNDARY_H
+       3             : 
+       4             : #include "crpropa/Module.h"
+       5             : 
+       6             : namespace crpropa {
+       7             : /**
+       8             :  * \addtogroup Condition
+       9             :  * @{
+      10             :  */
+      11             : 
+      12             : /**
+      13             :  @class PeriodicBox
+      14             :  @brief Rectangular box with periodic boundaries.
+      15             : 
+      16             :  If a particle passes on of the sides it is placed at the opposite side and its initial (source) position changed accordingly.
+      17             :  This implements periodic boundaries, that keep the particle inside the box and instead move the source away periodically.
+      18             :  Particles can overshoot (be outside of the box during the step) since the step size is not limited by this module.
+      19             :  */
+      20           2 : class PeriodicBox: public Module {
+      21             : private:
+      22             :         Vector3d origin;
+      23             :         Vector3d size;
+      24             : 
+      25             : public:
+      26             :         /** Default constructor
+      27             :          */
+      28             :         PeriodicBox();
+      29             :         /** Constructor
+      30             :          @param origin  vector corresponding to the lower box corner
+      31             :          @param size    vector corresponding to the box sizes along each direction
+      32             :          */
+      33             :         PeriodicBox(Vector3d origin, Vector3d size);
+      34             :         void process(Candidate *candidate) const;
+      35             :         void setOrigin(Vector3d origin);
+      36             :         void setSize(Vector3d size);
+      37             :         std::string getDescription() const;
+      38             : };
+      39             : 
+      40             : /**
+      41             :  @class ReflectiveBox
+      42             :  @brief Rectangular box with reflective boundaries.
+      43             : 
+      44             :  If a particle passes on of the sides it is reflected back inside (position and velocity) and its initial position changed as if the particle had come from that side.
+      45             :  This implements periodic boundaries, that keep the particle inside the box and instead move the source away reflectively.
+      46             :  Particles can overshoot (be outside of the box during the step) since the step size is not limited by this module.
+      47             :  */
+      48           1 : class ReflectiveBox: public Module {
+      49             : private:
+      50             :         Vector3d origin;
+      51             :         Vector3d size;
+      52             : 
+      53             : public:
+      54             :         /** Default constructor
+      55             :          */
+      56             :         ReflectiveBox();
+      57             :         /** Constructor
+      58             :          @param origin  vector corresponding to the lower box corner
+      59             :          @param size    vector corresponding to the box sizes along each direction
+      60             :          */
+      61             :         ReflectiveBox(Vector3d origin, Vector3d size);
+      62             :         void process(Candidate *candidate) const;
+      63             :         void setOrigin(Vector3d origin);
+      64             :         void setSize(Vector3d size);
+      65             :         std::string getDescription() const;
+      66             : };
+      67             : 
+      68             : /**
+      69             :  @class CubicBoundary
+      70             :  @brief Flags a particle when exiting the cube.
+      71             : 
+      72             :  The particle is made inactive and flagged as "Rejected".
+      73             :  By default the module prevents overshooting the boundary by more than a margin of 0.1 kpc.
+      74             :  This corresponds to the default minimum step size of the propagation modules (PropagationCK and SimplePropagation).
+      75             :  */
+      76           4 : class CubicBoundary: public AbstractCondition {
+      77             : private:
+      78             :         Vector3d origin;
+      79             :         double size;
+      80             :         double margin;
+      81             :         bool limitStep;
+      82             : 
+      83             : public:
+      84             :         /** Default constructor
+      85             :          */
+      86             :         CubicBoundary();
+      87             :         /** Constructor
+      88             :          @param origin  vector corresponding to the lower box corner
+      89             :          @param size    vector corresponding to the box sizes along each direction
+      90             :          */
+      91             :         CubicBoundary(Vector3d origin, double size);
+      92             :         void process(Candidate *candidate) const;
+      93             :         void setOrigin(Vector3d origin);
+      94             :         void setSize(double size);
+      95             :         void setMargin(double margin);
+      96             :         void setLimitStep(bool limitStep);
+      97             :         std::string getDescription() const;
+      98             : };
+      99             : 
+     100             : /**
+     101             :  @class SphericalBoundary
+     102             :  @brief Flag a particle when leaving the sphere.
+     103             : 
+     104             :  The particle is made inactive and flagged as "Rejected".
+     105             :  By default the module prevents overshooting the boundary by more than a margin of 0.1 kpc.
+     106             :  This corresponds to the default minimum step size of the propagation modules (PropagationCK and SimplePropagation).
+     107             :  */
+     108           3 : class SphericalBoundary: public AbstractCondition {
+     109             : private:
+     110             :         Vector3d center;
+     111             :         double radius;
+     112             :         double margin;
+     113             :         bool limitStep;
+     114             : 
+     115             : public:
+     116             :         /** Default constructor
+     117             :          */
+     118             :         SphericalBoundary();
+     119             :         /** Constructor
+     120             :          @param center          vector containing the coordinates of the center of the sphere
+     121             :          @param radius          radius of the sphere
+     122             :          */
+     123             :         SphericalBoundary(Vector3d center, double radius);
+     124             :         void process(Candidate *candidate) const;
+     125             :         void setCenter(Vector3d center);
+     126             :         void setRadius(double size);
+     127             :         void setMargin(double margin);
+     128             :         void setLimitStep(bool limitStep);
+     129             :         std::string getDescription() const;
+     130             : };
+     131             : 
+     132             : /**
+     133             :  @class EllipsoidalBoundary
+     134             :  @brief Flags a particle when leaving the ellipsoid.
+     135             : 
+     136             :  This module flags particles when outside of the ellipsoid, defined by two focal points and a major axis (length).
+     137             :  The particle is made inactive and flagged as "Rejected".
+     138             :  By default the module prevents overshooting the boundary by more than a margin of 0.1 kpc.
+     139             :  This corresponds to the default minimum step size of the propagation modules (PropagationCK and SimplePropagation).
+     140             :  */
+     141           3 : class EllipsoidalBoundary: public AbstractCondition {
+     142             : private:
+     143             :         Vector3d focalPoint1;
+     144             :         Vector3d focalPoint2;
+     145             :         double majorAxis;
+     146             :         double margin;
+     147             :         bool limitStep;
+     148             : 
+     149             : public:
+     150             :         /** Default constructor
+     151             :          */
+     152             :         EllipsoidalBoundary();
+     153             :         /** Constructor
+     154             :          @param focalPoint1             one of the foci of the ellipsoid
+     155             :          @param focalPoint2             the other foci of the ellipsoid
+     156             :          @param majorAxis               length of the major axis of the ellipsoid
+     157             :          */
+     158             :         EllipsoidalBoundary(Vector3d focalPoint1, Vector3d focalPoint2,
+     159             :                         double majorAxis);
+     160             :         void process(Candidate *candidate) const;
+     161             :         void setFocalPoints(Vector3d focalPoint1, Vector3d focalPoint2);
+     162             :         void setMajorAxis(double size);
+     163             :         void setMargin(double margin);
+     164             :         void setLimitStep(bool limitStep);
+     165             :         std::string getDescription() const;
+     166             : };
+     167             : 
+     168             : 
+     169             : /**
+     170             :  @class CylindricalBoundary
+     171             :  @brief Flags a particle when leaving the cylinder whose axis is along the z-axis.
+     172             :  This module flags particles when outside of the cylinder, defined by a radius and a height.
+     173             :  The particle is made inactive and by default is flagged "OutOfBounds".
+     174             :  Optionally the module can ensure the candidate does not overshoot the boundary by more than a set margin.
+     175             :  */
+     176           3 : class CylindricalBoundary: public AbstractCondition {
+     177             : private:
+     178             :         Vector3d origin;
+     179             :         double height;
+     180             :         double radius;
+     181             :         double margin;
+     182             :         bool limitStep;
+     183             : 
+     184             : public:
+     185             :         /** Default constructor
+     186             :          */
+     187             :         CylindricalBoundary();
+     188             :         /** Constructor
+     189             :          @param origin  vector corresponding to the lower part of the cylinder axis
+     190             :          @param height  height of the cylinder
+     191             :          @param radius  radius of the cylinder
+     192             :          */
+     193             :         CylindricalBoundary(Vector3d origin, double height,
+     194             :                         double radius);
+     195             :         void process(Candidate *candidate) const;
+     196             :         void setOrigin(Vector3d origin);
+     197             :         void setHeight(double height);
+     198             :         void setRadius(double radius);
+     199             :         void setMargin(double margin);
+     200             :         void setLimitStep(bool limitStep);
+     201             :         std::string getDescription() const;
+     202             : };
+     203             : /** @}*/
+     204             : 
+     205             : } // namespace crpropa
+     206             : 
+     207             : #endif // CRPROPA_BOUNDARY_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/BreakCondition.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/BreakCondition.h.func-sort-c.html new file mode 100644 index 000000000..5eddfe368 --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/BreakCondition.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/BreakCondition.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - BreakCondition.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:44100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/BreakCondition.h.func.html b/doc/coverageReport/include/crpropa/module/BreakCondition.h.func.html new file mode 100644 index 000000000..bcf7545eb --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/BreakCondition.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/BreakCondition.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - BreakCondition.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:44100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/BreakCondition.h.gcov.html b/doc/coverageReport/include/crpropa/module/BreakCondition.h.gcov.html new file mode 100644 index 000000000..58e693670 --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/BreakCondition.h.gcov.html @@ -0,0 +1,221 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/BreakCondition.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - BreakCondition.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:44100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_BREAKCONDITION_H
+       2             : #define CRPROPA_BREAKCONDITION_H
+       3             : 
+       4             : #include "crpropa/Module.h"
+       5             : 
+       6             : namespace crpropa {
+       7             : /**
+       8             :  * \addtogroup Condition 
+       9             :  * @{
+      10             :  */
+      11             : 
+      12             : /**
+      13             :  @class MaximumTrajectoryLength
+      14             :  @brief Deactivates the candidate beyond a maximum trajectory length
+      15             : 
+      16             :  This module deactivates the candidate at a given maximum trajectory length.
+      17             :  In that case the property ("Deactivated", module::description) is set.
+      18             :  It also limits the candidates next step size to ensure the maximum trajectory length is not exceeded.
+      19             :  */
+      20             : class MaximumTrajectoryLength: public AbstractCondition {
+      21             :         double maxLength;
+      22             :         std::vector<Vector3d> observerPositions;
+      23             : public:
+      24             :         MaximumTrajectoryLength(double length = 0);
+      25             :         void setMaximumTrajectoryLength(double length);
+      26             :         double getMaximumTrajectoryLength() const;
+      27             :         void addObserverPosition(const Vector3d &position);
+      28             :         const std::vector<Vector3d>& getObserverPositions() const;
+      29             :         std::string getDescription() const;
+      30             :         void process(Candidate *candidate) const;
+      31             : };
+      32             : 
+      33             : /**
+      34             :  @class MinimumEnergy
+      35             :  @brief Deactivates the candidate below a minimum energy
+      36             : 
+      37             :  This module deactivates the candidate below a given minimum energy.
+      38             :  In that case the property ("Deactivated", module::description) is set.
+      39             :  */
+      40           1 : class MinimumEnergy: public AbstractCondition {
+      41             :         double minEnergy;
+      42             : public:
+      43             :         MinimumEnergy(double minEnergy = 0);
+      44             :         void setMinimumEnergy(double energy);
+      45             :         double getMinimumEnergy() const;
+      46             :         std::string getDescription() const;
+      47             :         void process(Candidate *candidate) const;
+      48             : };
+      49             : 
+      50             : 
+      51             : /**
+      52             :  @class MinimumRigidity
+      53             :  @brief Deactivates the candidate below a minimum rigidity
+      54             : 
+      55             :  This module deactivates the candidate below a given minimum rigidity (E/Z in EeV).
+      56             :  In that case the property ("Deactivated", module::description) is set.
+      57             :  */
+      58             : class MinimumRigidity: public AbstractCondition {
+      59             :         double minRigidity;
+      60             : public:
+      61             :         MinimumRigidity(double minRigidity = 0);
+      62             :         void setMinimumRigidity(double minRigidity);
+      63             :         double getMinimumRigidity() const;
+      64             :         std::string getDescription() const;
+      65             :         void process(Candidate *candidate) const;
+      66             : };
+      67             : 
+      68             : /**
+      69             :  @class MinimumRedshift
+      70             :  @brief Deactivates the candidate below a minimum redshift
+      71             : 
+      72             :  This module deactivates the candidate below a given minimum redshift.
+      73             :  In that case the property ("Deactivated", module::description) is set.
+      74             :  */
+      75           1 : class MinimumRedshift: public AbstractCondition {
+      76             :         double zmin;
+      77             : public:
+      78             :         MinimumRedshift(double zmin = 0);
+      79             :         void setMinimumRedshift(double z);
+      80             :         double getMinimumRedshift();
+      81             :         std::string getDescription() const;
+      82             :         void process(Candidate *candidate) const;
+      83             : };
+      84             : 
+      85             : /**
+      86             :  @class MinimumChargeNumber
+      87             :  @brief Deactivates the candidate below a minimum number
+      88             : 
+      89             :  This module deactivates the candidate below a given minimum charge number.
+      90             :  A minimum charge number of 26 deactivates all (anti-) isotopes which 
+      91             :  are ranked in the periodic table before iron (Fe). 
+      92             :  In that case the property ("Deactivated", module::description) is set.
+      93             :  */
+      94           1 : class MinimumChargeNumber: public AbstractCondition {
+      95             :         int minChargeNumber;
+      96             : public:
+      97             :         MinimumChargeNumber(int minChargeNumber = 0);
+      98             :         void setMinimumChargeNumber(int chargeNumber);
+      99             :         int getMinimumChargeNumber() const;
+     100             :         std::string getDescription() const;
+     101             :         void process(Candidate *candidate) const;
+     102             : };
+     103             : 
+     104             : /**
+     105             :  @class MinimumEnergyPerParticleId
+     106             :  @brief Deactivates the candidate below a minimum energy for specific particle Ids.
+     107             : 
+     108             :  This module deactivates the candidate below a given minimum energy for specific particle types.
+     109             :  In that case the property ("Deactivated", module::description) is set.
+     110             :  All particles whose minimum energy is not specified follow the more general minEnergyOthers condition.
+     111             :  */
+     112             : class MinimumEnergyPerParticleId: public AbstractCondition {
+     113             :         std::vector<double> minEnergies;
+     114             :         std::vector<int> particleIds;
+     115             :         double minEnergyOthers;
+     116             : public:
+     117             :         MinimumEnergyPerParticleId(double minEnergyOthers = 0);
+     118             :         void setMinimumEnergyOthers(double energy);
+     119             :         double getMinimumEnergyOthers() const;
+     120             :         void add(int id, double energy);
+     121             :         std::string getDescription() const;
+     122             :         void process(Candidate *candidate) const;
+     123             : };
+     124             : 
+     125             : 
+     126             : /**
+     127             :  @class DetectionLength
+     128             :  @brief Detects the candidate at a given trajectoryLength
+     129             :  
+     130             :  This break condition can be used for non-regular time observation of the particle density. See also ObserverTimeEvolution.
+     131             :  */
+     132           1 : class DetectionLength: public AbstractCondition {
+     133             :         double detLength;
+     134             : public:
+     135             :         DetectionLength(double length = 0);
+     136             :         void setDetectionLength(double length);
+     137             :         double getDetectionLength() const;
+     138             :         std::string getDescription() const;
+     139             :         void process(Candidate *candidate) const;
+     140             : };
+     141             : /** @}*/
+     142             : 
+     143             : } // namespace crpropa
+     144             : 
+     145             : #endif // CRPROPA_BREAKCONDITION_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/HDF5Output.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/HDF5Output.h.func-sort-c.html new file mode 100644 index 000000000..6be660edc --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/HDF5Output.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/HDF5Output.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - HDF5Output.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:010.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/HDF5Output.h.func.html b/doc/coverageReport/include/crpropa/module/HDF5Output.h.func.html new file mode 100644 index 000000000..b0f0e622a --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/HDF5Output.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/HDF5Output.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - HDF5Output.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:010.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/HDF5Output.h.gcov.html b/doc/coverageReport/include/crpropa/module/HDF5Output.h.gcov.html new file mode 100644 index 000000000..1db93380e --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/HDF5Output.h.gcov.html @@ -0,0 +1,217 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/HDF5Output.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - HDF5Output.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:010.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifdef CRPROPA_HAVE_HDF5
+       2             : 
+       3             : #ifndef CRPROPA_HDF5OUTPUT_H
+       4             : #define CRPROPA_HDF5OUTPUT_H
+       5             : 
+       6             : 
+       7             : #include "crpropa/module/Output.h"
+       8             : #include <stdint.h>
+       9             : #include <ctime>
+      10             : 
+      11             : #include <H5Ipublic.h>
+      12             : 
+      13             : namespace crpropa {
+      14             : 
+      15             : const size_t propertyBufferSize = 1024;
+      16             : 
+      17             : /**
+      18             :  * \addtogroup Output
+      19             :  * @{
+      20             :  */
+      21             : 
+      22             : /**
+      23             :  @class HDF5Output
+      24             :  @brief Output to HDF5 Format.
+      25             : The base class gives an overview of possible columns
+      26             : 
+      27             : HDF5 structure:
+      28             : ```
+      29             : HDF5 "FILENAME.h5" {
+      30             : GROUP "/" {
+      31             : DATASET "OUTPUTTYPE" {
+      32             :   DATATYPE  H5T_COMPOUND {
+      33             :   ...
+      34             :  }
+      35             :  DATASPACE  SIMPLE { ( 1 ) / ( H5S_UNLIMITED ) }
+      36             :  DATA {
+      37             :   ...
+      38             :  }
+      39             :   ATTRIBUTE "Version" {
+      40             :   DATATYPE  H5T_STRING {
+      41             :       STRSIZE 100;
+      42             :       STRPAD H5T_STR_NULLTERM;
+      43             :       CSET H5T_CSET_ASCII;
+      44             :       CTYPE H5T_C_S1;
+      45             :       }
+      46             :   DATASPACE  SCALAR
+      47             :   DATA { (0): "VERSION" }
+      48             :  }
+      49             : } } }
+      50             : ```
+      51             : 
+      52             :  */
+      53             : class HDF5Output: public Output {
+      54             : 
+      55           0 :         typedef struct OutputRow {
+      56             :                 double D;
+      57             :                 double z;
+      58             :                 uint64_t SN;
+      59             :                 int32_t ID;
+      60             :                 double E;
+      61             :                 double X;
+      62             :                 double Y;
+      63             :                 double Z;
+      64             :                 double Px;
+      65             :                 double Py;
+      66             :                 double Pz;
+      67             :                 uint64_t SN0;
+      68             :                 int32_t ID0;
+      69             :                 double E0;
+      70             :                 double X0;
+      71             :                 double Y0;
+      72             :                 double Z0;
+      73             :                 double P0x;
+      74             :                 double P0y;
+      75             :                 double P0z;
+      76             :                 uint64_t SN1;
+      77             :                 int32_t ID1;
+      78             :                 double E1;
+      79             :                 double X1;
+      80             :                 double Y1;
+      81             :                 double Z1;
+      82             :                 double P1x;
+      83             :                 double P1y;
+      84             :                 double P1z;
+      85             :                 double weight;
+      86             :                 std::string tag;
+      87             :                 unsigned char propertyBuffer[propertyBufferSize];
+      88             :         } OutputRow;
+      89             : 
+      90             :         std::string filename;
+      91             : 
+      92             :         hid_t file, sid;
+      93             :         hid_t dset, dataspace;
+      94             :         mutable std::vector<OutputRow> buffer;
+      95             : 
+      96             :         time_t lastFlush;
+      97             :         unsigned int flushLimit;
+      98             :         unsigned int candidatesSinceFlush;
+      99             : public:
+     100             :         /** Default constructor.
+     101             :                 Does not run from scratch.
+     102             :             At least open() has to be called in addition.
+     103             :                 Units of energy and length are, by default, EeV and Mpc.
+     104             :                 This can be changed with setEnergyScale and setLengthScale.
+     105             :          */
+     106             :         HDF5Output();
+     107             :         /** Constructor with the default OutputType (everything).
+     108             :                 @param filename string containing name of output hdf5 file
+     109             :          */
+     110             :         HDF5Output(const std::string &filename);
+     111             :         /** Constructor
+     112             :                 @param outputtype       type of output: Trajectory1D, Trajectory3D, Event1D, Event3D, Everything
+     113             :                 @param filename string containing name of output hdf5 file
+     114             :          */
+     115             :         HDF5Output(const std::string &filename, OutputType outputtype);
+     116             :         ~HDF5Output();
+     117             : 
+     118             :         void process(Candidate *candidate) const;
+     119             :         herr_t insertStringAttribute(const std::string &key, const std::string &value);
+     120             :         herr_t insertDoubleAttribute(const std::string &key, const double &value);
+     121             :         std::string getDescription() const;
+     122             : 
+     123             :         /// Force flush after N events. In long running applications with scarse
+     124             :         /// output this can be set to 1 or 0 to avoid data corruption. In applications
+     125             :         /// with frequent output this should be set to a high number (default)
+     126             :         void setFlushLimit(unsigned int N);
+     127             : 
+     128             :         /** Create and prepare a file as HDF5-file.
+     129             :          */
+     130             :         void open(const std::string &filename);
+     131             :         void close();
+     132             :         void flush() const;
+     133             : 
+     134             : };
+     135             : /** @}*/
+     136             : 
+     137             : } // namespace crpropa
+     138             : 
+     139             : #endif // CRPROPA_HDF5OUTPUT_H
+     140             : 
+     141             : #endif // CRPROPA_HAVE_HDF5
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/NuclearDecay.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/NuclearDecay.h.func-sort-c.html new file mode 100644 index 000000000..7c09d8ac5 --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/NuclearDecay.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/NuclearDecay.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - NuclearDecay.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/NuclearDecay.h.func.html b/doc/coverageReport/include/crpropa/module/NuclearDecay.h.func.html new file mode 100644 index 000000000..ffb262df7 --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/NuclearDecay.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/NuclearDecay.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - NuclearDecay.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/NuclearDecay.h.gcov.html b/doc/coverageReport/include/crpropa/module/NuclearDecay.h.gcov.html new file mode 100644 index 000000000..9bd7d125c --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/NuclearDecay.h.gcov.html @@ -0,0 +1,163 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/NuclearDecay.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - NuclearDecay.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_NUCLEARDECAY_H
+       2             : #define CRPROPA_NUCLEARDECAY_H
+       3             : 
+       4             : #include "crpropa/Module.h"
+       5             : 
+       6             : #include <vector>
+       7             : 
+       8             : namespace crpropa {
+       9             : /**
+      10             :  * \addtogroup EnergyLosses
+      11             :  * @{
+      12             :  */
+      13             : 
+      14             : /**
+      15             :  @class NuclearDecay
+      16             :  @brief Nuclear decay of unstable nuclei.
+      17             : 
+      18             :  This module simulates the nuclear decay of unstable nuclei using data from NuDat2.
+      19             :  All decay modes are considered: alpha, beta+- and gamma decay, as well as proton- and neutron dripping.
+      20             :  The resulting non-hadronic secondary particles (e+, e-, neutrinos, gamma) can optionally be created.
+      21             : 
+      22             :  For details on the preprocessing of the NuDat2 data refer to "CRPropa3-data/calc_decay.py".
+      23             :  */
+      24             : class NuclearDecay: public Module {
+      25             : private:
+      26             :         double limit;
+      27             :         bool haveElectrons;
+      28             :         bool havePhotons;
+      29             :         bool haveNeutrinos;
+      30        1800 :         struct DecayMode {
+      31             :                 int channel; // (#beta- #beta+ #alpha #proton #neutron)
+      32             :                 double rate; // decay rate in [1/m]
+      33             :                 std::vector<double> energy; // photon energies of ensuing gamma decays
+      34             :                 std::vector<double> intensity; // probabilities of ensuing gamma decays
+      35             :         };
+      36             :         std::vector<std::vector<DecayMode> > decayTable; // decayTable[Z * 31 + N] = vector<DecayMode>
+      37             :         std::string interactionTag = "ND";
+      38             : 
+      39             : public:
+      40             :         /** Constructor.
+      41             :          @param electrons               if true, add secondary photons as candidates
+      42             :          @param photons                 if true, add secondary photons as candidates
+      43             :          @param neutrinos               if true, add secondary neutrinos as candidates
+      44             :          @param limit                   step size limit as fraction of mean free path
+      45             :          */
+      46             :         NuclearDecay(bool electrons = false, bool photons = false, bool neutrinos = false, double limit = 0.1);
+      47             : 
+      48             :         /** Limit the propagation step to a fraction of the mean free path
+      49             :          * @param limit fraction of the mean free path
+      50             :          */
+      51             :         void setLimit(double limit);
+      52             : 
+      53             :         // decide if secondary electrons are added to the simulation    
+      54             :         void setHaveElectrons(bool b);
+      55             : 
+      56             :         // decide if secondary photons are added to the simulation      
+      57             :         void setHavePhotons(bool b);
+      58             : 
+      59             :         // decide if secondary neutrinos are added to the simulation    
+      60             :         void setHaveNeutrinos(bool b);
+      61             : 
+      62             :         /** set a custom interaction tag to trace back this interaction
+      63             :          * @param tag string that will be added to the candidate and output
+      64             :          */
+      65             :         void setInteractionTag(std::string tag);
+      66             :         std::string getInteractionTag() const;
+      67             : 
+      68             :         void process(Candidate *candidate) const;
+      69             :         void performInteraction(Candidate *candidate, int channel) const;
+      70             :         void gammaEmission(Candidate *candidate, int channel) const;
+      71             :         void betaDecay(Candidate *candidate, bool isBetaPlus) const;
+      72             :         void nucleonEmission(Candidate *candidate, int dA, int dZ) const;
+      73             : 
+      74             :         /**
+      75             :          Return the mean free path.
+      76             :          This is not used in the simulation.
+      77             :          @param id      PDG particle id
+      78             :          @param gamma   Lorentz factor of particle
+      79             :          @returns The mean free path [in meters]
+      80             :          */
+      81             :         double meanFreePath(int id, double gamma);
+      82             : };
+      83             : /** @}*/
+      84             : 
+      85             : } // namespace crpropa
+      86             : 
+      87             : #endif // CRPROPA_NUCLEARDECAY_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/Observer.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/Observer.h.func-sort-c.html new file mode 100644 index 000000000..9075a3567 --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/Observer.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/Observer.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - Observer.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:3837.5 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/Observer.h.func.html b/doc/coverageReport/include/crpropa/module/Observer.h.func.html new file mode 100644 index 000000000..9f9969a72 --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/Observer.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/Observer.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - Observer.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:3837.5 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/Observer.h.gcov.html b/doc/coverageReport/include/crpropa/module/Observer.h.gcov.html new file mode 100644 index 000000000..216df472e --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/Observer.h.gcov.html @@ -0,0 +1,351 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/Observer.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - Observer.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:3837.5 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_OBSERVER_H
+       2             : #define CRPROPA_OBSERVER_H
+       3             : 
+       4             : #include <fstream>
+       5             : #include <limits>
+       6             : #include <string>
+       7             : #include <vector>
+       8             : 
+       9             : #include "../Candidate.h"
+      10             : #include "../Module.h"
+      11             : #include "../Referenced.h"
+      12             : #include "../Vector3.h"
+      13             : #include "../Geometry.h"
+      14             : 
+      15             : namespace crpropa {
+      16             : 
+      17             : enum DetectionState {
+      18             :         DETECTED, VETO, NOTHING
+      19             : };
+      20             : 
+      21             : /** \addtogroup Observer
+      22             :  * @{
+      23             :  */
+      24             : 
+      25             : 
+      26             : /**
+      27             :  @class ObserverFeature
+      28             :  @brief Abstract base class for features of observers
+      29             :  */
+      30           1 : class ObserverFeature: public Referenced {
+      31             : protected:
+      32             :         std::string description;
+      33             : public:
+      34             :         virtual DetectionState checkDetection(Candidate *candidate) const;
+      35             :         virtual void onDetection(Candidate *candidate) const;
+      36             :         virtual std::string getDescription() const;
+      37             : };
+      38             : 
+      39             : 
+      40             : /**
+      41             :  @class Observer
+      42             :  @brief General particle observer
+      43             :  */
+      44             : class Observer: public Module {
+      45             :         std::string flagKey;
+      46             :         std::string flagValue;
+      47             : private:
+      48             :         std::vector<ref_ptr<ObserverFeature> > features;
+      49             :         ref_ptr<Module> detectionAction;
+      50             :         bool clone;
+      51             :         bool makeInactive;
+      52             : public:
+      53             :         /** Default observer constructor
+      54             :          */
+      55             :         Observer();
+      56             :         /** Add a feature to the observer
+      57             :          @param feature         observer feature to be added to the Observer object
+      58             :          */
+      59             :         void add(ObserverFeature *feature);
+      60             :         /** Perform some specific actions upon detection of candidate
+      61             :          @param action          module that performs a given action when candidate is detected
+      62             :          @param clone           if true, clone candidate
+      63             :          */
+      64             :         void onDetection(Module *action, bool clone = false);
+      65             :         void process(Candidate *candidate) const;
+      66             :         std::string getDescription() const;
+      67             :         void setFlag(std::string key, std::string value);
+      68             :         /** Determine whether candidate should be deactivated on detection
+      69             :          @param deactivate      if true, deactivate detected particles; if false, continue tracking them
+      70             :          */
+      71             :         void setDeactivateOnDetection(bool deactivate);
+      72             : };
+      73             : 
+      74             : 
+      75             : /**
+      76             :  @class ObserverDetectAll
+      77             :  @brief Detects all particles
+      78             :  */
+      79           2 : class ObserverDetectAll: public ObserverFeature {
+      80             : public:
+      81             :         DetectionState checkDetection(Candidate *candidate) const;
+      82             :         std::string getDescription() const;
+      83             : };
+      84             : 
+      85             : 
+      86             : /**
+      87             :  @class ObserverSurface
+      88             :  @brief Detects particles crossing the boundaries of a defined surface (see, e.g., `Geometry` module)
+      89             :  */
+      90             : class ObserverSurface: public ObserverFeature {
+      91             : private:
+      92             :         ref_ptr<Surface> surface;
+      93             : public:
+      94             :         /** Constructor
+      95             :          @param surface         object with some specific geometric (see Geometry.h)
+      96             :         */
+      97             :         ObserverSurface(Surface* surface);
+      98             :         DetectionState checkDetection(Candidate *candidate) const;
+      99             :         std::string getDescription() const;
+     100             : };
+     101             : 
+     102             : 
+     103             : /**
+     104             :  @class ObserverTracking
+     105             :  @brief Tracks particles inside a sphere
+     106             :  */
+     107             : class ObserverTracking: public ObserverFeature {
+     108             : private:
+     109             :         Vector3d center;
+     110             :         double radius;
+     111             :     double stepSize;
+     112             : public:
+     113             :         /** Constructor
+     114             :          @param center          vector containing the coordinates of the center of the sphere
+     115             :          @param radius          radius of the sphere
+     116             :          @param stepSize        observer will keep track of particles at every step with this size
+     117             :         */
+     118             :         ObserverTracking(Vector3d center, double radius, double stepSize = 0);
+     119             :         DetectionState checkDetection(Candidate *candidate) const;
+     120             :         std::string getDescription() const;
+     121             : };
+     122             : 
+     123             : 
+     124             : /**
+     125             :  @class Observer1D
+     126             :  @brief Detects particles when reaching x = 0
+     127             : 
+     128             :  This module detects particles when reaching x = 0 and also limits the next step size to prevent candidates from overshooting.
+     129             :  */
+     130           3 : class Observer1D: public ObserverFeature {
+     131             : public:
+     132             :         DetectionState checkDetection(Candidate *candidate) const;
+     133             :         std::string getDescription() const;
+     134             : };
+     135             : 
+     136             : 
+     137             : /**
+     138             :  @class ObserverRedshiftWindow
+     139             :  @brief Detects particles in a given redshift window
+     140             : 
+     141             :  When added to an observer, this feature generalizes it to four dimensions.
+     142             :  The fourth dimension is the redshift, a proxy for time. This is particularly
+     143             :  useful in "4D" studies, including either time-dependence (e.g. flaring objects),
+     144             :  or in 3D studies including cosmological evolution.
+     145             :  Note that redshifts should be assigned to sources when using this feature.
+     146             :  This can be done with: SourceRedshift, SourceRedshift1D, SourceUniformRedshift,
+     147             :  and SourceRedshiftEvolution.
+     148             :  */
+     149             : class ObserverRedshiftWindow: public ObserverFeature {
+     150             : private:
+     151             :         double zmin, zmax;
+     152             : public:
+     153             :         /** Constructor
+     154             :          @param zmin    lower bound of redshift interval
+     155             :          @param zmax    upper bound of redshift interval
+     156             :          */
+     157             :         ObserverRedshiftWindow(double zmin = 0, double zmax = 0.1);
+     158             :         DetectionState checkDetection(Candidate *candidate) const;
+     159             :         std::string getDescription() const;
+     160             : };
+     161             : 
+     162             : 
+     163             : /**
+     164             :  @class ObserverInactiveVeto
+     165             :  @brief Veto for inactive candidates
+     166             :  */
+     167           0 : class ObserverInactiveVeto: public ObserverFeature {
+     168             : public:
+     169             :         DetectionState checkDetection(Candidate *candidate) const;
+     170             :         std::string getDescription() const;
+     171             : };
+     172             : 
+     173             : 
+     174             : /**
+     175             :  @class ObserverNucleusVeto
+     176             :  @brief Veto for nuclei (including protons and neutrons)
+     177             :  */
+     178           0 : class ObserverNucleusVeto: public ObserverFeature {
+     179             : public:
+     180             :         DetectionState checkDetection(Candidate *candidate) const;
+     181             :         std::string getDescription() const;
+     182             : };
+     183             : 
+     184             : 
+     185             : /**
+     186             :  @class ObserverNeutrinoVeto
+     187             :  @brief Veto for neutrinos
+     188             :  */
+     189           0 : class ObserverNeutrinoVeto: public ObserverFeature {
+     190             : public:
+     191             :         DetectionState checkDetection(Candidate *candidate) const;
+     192             :         std::string getDescription() const;
+     193             : };
+     194             : 
+     195             : 
+     196             : /**
+     197             :  @class ObserverPhotonVeto
+     198             :  @brief Veto for photons
+     199             :  */
+     200           0 : class ObserverPhotonVeto: public ObserverFeature {
+     201             : public:
+     202             :         DetectionState checkDetection(Candidate *candidate) const;
+     203             :         std::string getDescription() const;
+     204             : };
+     205             : 
+     206             : 
+     207             : /**
+     208             :  @class ObserverElectronVeto
+     209             :  @brief Veto for electrons and positrons
+     210             :  */
+     211           0 : class ObserverElectronVeto: public ObserverFeature {
+     212             : public:
+     213             :         DetectionState checkDetection(Candidate *candidate) const;
+     214             :         std::string getDescription() const;
+     215             : };
+     216             : 
+     217             : 
+     218             : /**
+     219             :  @class ObserverParticleIdVeto
+     220             :  @brief Custom veto for user-defined particle types
+     221             :  Vetoes for more than one type of particle can be added by calling this
+     222             :  feature multiple times.
+     223             :  */
+     224             : class ObserverParticleIdVeto: public ObserverFeature {
+     225             : private:
+     226             :         int vetoParticleId;
+     227             : public:
+     228             :         /** Constructor
+     229             :          @param id              id of the particle following the PDG numbering scheme
+     230             :          */
+     231             :         ObserverParticleIdVeto(int id);
+     232             :         DetectionState checkDetection(Candidate *candidate) const;
+     233             :         std::string getDescription() const;
+     234             : };
+     235             : 
+     236             : 
+     237             : /**
+     238             :  @class ObserverTimeEvolution
+     239             :  @brief Observes the time evolution of the candidates (phase-space elements)
+     240             :  This observer is very useful if the time evolution of the particle density is needed. It detects all candidates in lin-spaced, log-spaced, or user-defined time intervals and limits the nextStep of candidates to prevent overshooting of detection intervals.
+     241             :  */
+     242             : class ObserverTimeEvolution: public ObserverFeature {
+     243             : private:
+     244             :         std::vector<double> detList;
+     245             : public:
+     246             :         /** Default constructor
+     247             :          */
+     248             :         ObserverTimeEvolution();
+     249             :         /** Constructor
+     250             :          @param min             minimum time
+     251             :          @param dist    time interval for detection
+     252             :          @param numb    number of time intervals
+     253             :          */
+     254             :         ObserverTimeEvolution(double min, double dist, double numb);
+     255             :         /** Constructor
+     256             :          @param min             minimum time
+     257             :          @param max         maximum time
+     258             :          @param numb    number of time intervals
+     259             :          @param log     log (input: true) or lin (input: false) scaling between min and max with numb steps
+     260             :          */
+     261             :         ObserverTimeEvolution(double min, double max, double numb, bool log);
+     262             :         // Add a new time step to the detection time list of the observer
+     263             :         void addTime(const double &position);
+     264             :         // Using log or lin spacing of times in the range between min and
+     265             :         // max for observing particles
+     266             :         void addTimeRange(double min, double max, double numb, bool log = false);
+     267             :         const std::vector<double>& getTimes() const;
+     268             :         DetectionState checkDetection(Candidate *candidate) const;
+     269             :         std::string getDescription() const;
+     270             : };
+     271             : /** @} */
+     272             : 
+     273             : }
+     274             : 
+     275             : #endif // CRPROPA_OBSERVER_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/OutputShell.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/OutputShell.h.func-sort-c.html new file mode 100644 index 000000000..743d7dacc --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/OutputShell.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/OutputShell.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - OutputShell.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:030.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/OutputShell.h.func.html b/doc/coverageReport/include/crpropa/module/OutputShell.h.func.html new file mode 100644 index 000000000..2db467b91 --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/OutputShell.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/OutputShell.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - OutputShell.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:030.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/OutputShell.h.gcov.html b/doc/coverageReport/include/crpropa/module/OutputShell.h.gcov.html new file mode 100644 index 000000000..c24dcbcbf --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/OutputShell.h.gcov.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/OutputShell.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - OutputShell.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:030.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_OUTPUTSHELL_H
+       2             : #define CRPROPA_OUTPUTSHELL_H
+       3             : 
+       4             : #include "crpropa/Module.h"
+       5             : #include "crpropa/AssocVector.h"
+       6             : #include "crpropa/Variant.h"
+       7             : 
+       8             : namespace crpropa {
+       9             : /**
+      10             :  * \addtogroup Output
+      11             :  * @{
+      12             :  */
+      13             : 
+      14             : /**
+      15             :  @class ShellOutput
+      16             :  @brief Show the trajectory in the shell.
+      17             :  */
+      18           0 : class ShellOutput: public Module {
+      19             : public:
+      20             :         void process(Candidate *candidate) const;
+      21             :         std::string getDescription() const;
+      22             : };
+      23             : 
+      24             : /**
+      25             :  @class ShellOutput1D
+      26             :  @brief Show the trajectory in the shell.
+      27             :  */
+      28           0 : class ShellOutput1D: public Module {
+      29             : public:
+      30             :         void process(Candidate *candidate) const;
+      31             :         std::string getDescription() const;
+      32             : };
+      33             : 
+      34             : /**
+      35             :  @class ShellPropertyOutput
+      36             :  @brief Show the candidate properties in the shell.
+      37             :  */
+      38           0 : class ShellPropertyOutput: public Module {
+      39             : public:
+      40             :         typedef Loki::AssocVector<std::string, Variant> PropertyMap;
+      41             :         void process(Candidate *candidate) const;
+      42             :         std::string getDescription() const;
+      43             : };
+      44             : /** @}*/
+      45             : 
+      46             : } // namespace cprpropa
+      47             : 
+      48             : #endif // CRPROPA_OUTPUTSHELL_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/PhotoDisintegration.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/PhotoDisintegration.h.func-sort-c.html new file mode 100644 index 000000000..182218a99 --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/PhotoDisintegration.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/PhotoDisintegration.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - PhotoDisintegration.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:22100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/PhotoDisintegration.h.func.html b/doc/coverageReport/include/crpropa/module/PhotoDisintegration.h.func.html new file mode 100644 index 000000000..fa9ee8229 --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/PhotoDisintegration.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/PhotoDisintegration.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - PhotoDisintegration.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:22100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/PhotoDisintegration.h.gcov.html b/doc/coverageReport/include/crpropa/module/PhotoDisintegration.h.gcov.html new file mode 100644 index 000000000..04ff87a36 --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/PhotoDisintegration.h.gcov.html @@ -0,0 +1,167 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/PhotoDisintegration.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - PhotoDisintegration.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:22100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_PHOTODISINTEGRATION_H
+       2             : #define CRPROPA_PHOTODISINTEGRATION_H
+       3             : 
+       4             : #include "crpropa/Module.h"
+       5             : #include "crpropa/PhotonBackground.h"
+       6             : 
+       7             : #include <vector>
+       8             : #include <map>
+       9             : 
+      10             : namespace crpropa {
+      11             : /**
+      12             :  * \addtogroup EnergyLosses
+      13             :  * @{
+      14             :  */
+      15             :  
+      16             : /**
+      17             :  @class PhotoDisintegration
+      18             :  @brief Photodisintegration of nuclei by background photons.
+      19             :  */
+      20             : class PhotoDisintegration: public Module {
+      21             : private:
+      22             :         ref_ptr<PhotonField> photonField;
+      23             :         double limit; // fraction of mean free path for limiting the next step
+      24             :         bool havePhotons;
+      25             :         std::string interactionTag = "PD";
+      26             : 
+      27      203566 :         struct Branch {
+      28             :                 int channel; // number of emitted (n, p, H2, H3, He3, He4)
+      29             :                 std::vector<double> branchingRatio; // branching ratio as function of nucleus Lorentz factor
+      30             :         };
+      31             : 
+      32      858506 :         struct PhotonEmission {
+      33             :                 double energy; // energy of emitted photon [J]
+      34             :                 std::vector<double> emissionProbability; // emission probability as function of nucleus Lorentz factor
+      35             :         };
+      36             : 
+      37             :         std::vector<std::vector<double> > pdRate; // pdRate[Z * 31 + N] = total interaction rate
+      38             :         std::vector<std::vector<Branch> > pdBranch; // pdTable[Z * 31 + N] = branching ratios
+      39             :         mutable std::map<int, std::vector<PhotonEmission> > pdPhoton; // map of emitted photon energies and photon emission probabilities
+      40             : 
+      41             :         static const double lgmin; // minimum log10(Lorentz-factor)
+      42             :         static const double lgmax; // maximum log10(Lorentz-factor)
+      43             :         static const size_t nlg; // number of Lorentz-factor steps
+      44             : 
+      45             : public:
+      46             :         /** Constructor.
+      47             :          @param photonField             target photon field
+      48             :          @param havePhotons             if true, add secondary photons as candidates
+      49             :          @param limit                   step size limit as fraction of mean free path
+      50             :          */
+      51             :         PhotoDisintegration(ref_ptr<PhotonField> photonField, bool havePhotons = false, double limit = 0.1);
+      52             : 
+      53             :         // set the target photon field
+      54             :         void setPhotonField(ref_ptr<PhotonField> photonField);
+      55             : 
+      56             :         // decide if secondary photons are added to the simulation
+      57             :         void setHavePhotons(bool havePhotons);
+      58             : 
+      59             :         /** Limit the propagation step to a fraction of the mean free path
+      60             :          * @param limit fraction of the mean free path
+      61             :          */
+      62             :         void setLimit(double limit);
+      63             : 
+      64             :         /** set a custom interaction tag to trace back this interaction
+      65             :          * @param tag string that will be added to the candidate and output
+      66             :          */
+      67             :         void setInteractionTag(std::string tag);
+      68             :         std::string getInteractionTag() const;
+      69             : 
+      70             :         void initRate(std::string filename);
+      71             :         void initBranching(std::string filename);
+      72             :         void initPhotonEmission(std::string filename);
+      73             : 
+      74             :         void process(Candidate *candidate) const;
+      75             :         void performInteraction(Candidate *candidate, int channel) const;
+      76             : 
+      77             :         /**
+      78             :          Calculates the loss length E dx/dE in [m] physical distance.
+      79             :          This is not used in the simulation.
+      80             :          @param id              PDG particle id
+      81             :          @param gamma   Lorentz factor of particle
+      82             :          @param z               redshift
+      83             :          @returns E dx/dE [in meters]
+      84             :          */
+      85             :         double lossLength(int id, double gamma, double z = 0);
+      86             : };
+      87             : 
+      88             : /** @}*/
+      89             : } // namespace crpropa
+      90             : 
+      91             : #endif // CRPROPA_PHOTODISINTEGRATION_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/PropagationBP.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/PropagationBP.h.func-sort-c.html new file mode 100644 index 000000000..b51198676 --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/PropagationBP.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/PropagationBP.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - PropagationBP.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:22100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/PropagationBP.h.func.html b/doc/coverageReport/include/crpropa/module/PropagationBP.h.func.html new file mode 100644 index 000000000..dbb675695 --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/PropagationBP.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/PropagationBP.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - PropagationBP.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:22100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/PropagationBP.h.gcov.html b/doc/coverageReport/include/crpropa/module/PropagationBP.h.gcov.html new file mode 100644 index 000000000..c1056913b --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/PropagationBP.h.gcov.html @@ -0,0 +1,225 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/PropagationBP.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - PropagationBP.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:22100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_PROPAGATIONBP_H
+       2             : #define CRPROPA_PROPAGATIONBP_H
+       3             : 
+       4             : #include "crpropa/Module.h"
+       5             : #include "crpropa/Units.h"
+       6             : #include "crpropa/magneticField/MagneticField.h"
+       7             : #include "kiss/logger.h"
+       8             : 
+       9             : namespace crpropa {
+      10             : /**
+      11             :  * \addtogroup Propagation
+      12             :  * @{
+      13             :  */
+      14             : 
+      15             : /**
+      16             :  @class PropagationBP
+      17             :  @brief Propagation through magnetic fields using the Boris method.
+      18             : 
+      19             :  This module solves the equations of motion of a relativistic charged particle when propagating through a magnetic field.\n
+      20             :  It uses the Boris push integration method.\n
+      21             :  It can be used with a fixed step size or an adaptive version which supports the step size control.
+      22             :  The step size control tries to keep the relative error close to, but smaller than the designated tolerance.
+      23             :  Additionally a minimum and maximum size for the steps can be set.
+      24             :  For neutral particles a rectilinear propagation is applied and a next step of the maximum step size proposed.
+      25             :  */
+      26             : class PropagationBP: public Module {
+      27             : 
+      28             : public:
+      29          84 :         class Y {
+      30             :         public:
+      31             :                 Vector3d x, u; /*< phase-point: position and direction */
+      32             : 
+      33             :                 Y() {
+      34             :                 }
+      35             : 
+      36          37 :                 Y(const Vector3d &x, const Vector3d &u) :
+      37             :                                 x(x), u(u) {
+      38             :                 }
+      39             : 
+      40             :                 Y(double f) :
+      41             :                                 x(Vector3d(f, f, f)), u(Vector3d(f, f, f)) {
+      42             :                 }
+      43             : 
+      44             :                 Y operator *(double f) const {
+      45             :                         return Y(x * f, u * f);
+      46             :                 }
+      47             : 
+      48             :                 Y &operator +=(const Y &y) {
+      49             :                         x += y.x;
+      50             :                         u += y.u;
+      51             :                         return *this;
+      52             :                 }
+      53             :         };
+      54             : 
+      55             : private:
+      56             :         ref_ptr<MagneticField> field;
+      57             :         double tolerance; /** target relative error of the numerical integration */
+      58             :         double minStep; /** minimum step size of the propagation */
+      59             :         double maxStep; /** maximum step size of the propagation */
+      60             : 
+      61             : public:
+      62             :         /** Default constructor for the Boris push. It is constructed with a fixed step size.
+      63             :          * @param field
+      64             :          * @param fixedStep 
+      65             :          */
+      66             :         PropagationBP(ref_ptr<MagneticField> field = NULL, double fixedStep = 1. * kpc);
+      67             : 
+      68             :         /** Constructor for the adaptive Boris push.
+      69             :          * @param field
+      70             :          * @param tolerance      tolerance is criterion for step adjustment. Step adjustment takes place only if minStep < maxStep
+      71             :          * @param minStep          minStep/c_light is the minimum integration time step
+      72             :          * @param maxStep          maxStep/c_light is the maximum integration time step. 
+      73             :          */
+      74             :     PropagationBP(ref_ptr<MagneticField> field, double tolerance, double minStep, double maxStep);
+      75             : 
+      76             :         /** Propagates the particle. Is called once per iteration.
+      77             :          * @param candidate      The Candidate is a passive object, that holds the information about the state of the cosmic ray and the simulation itself. */
+      78             :         void process(Candidate *candidate) const;
+      79             : 
+      80             :         /** Calculates the new position and direction of the particle based on the solution of the Lorentz force
+      81             :          * @param pos   current position of the candidate
+      82             :          * @param dir   current direction of the candidate
+      83             :          * @param step  current step size of the candidate
+      84             :          * @param z             current redshift is needed to calculate the magnetic field
+      85             :          * @param q             current charge of the candidate
+      86             :          * @param m             current mass of the candidate
+      87             :          * @return        return the new calculated position and direction of the candidate 
+      88             :          */
+      89             :         Y dY(Vector3d  pos, Vector3d  dir, double step, double z, double q, double m) const;
+      90             : 
+      91             :         /** comparison of the position after one step with the position after two steps with step/2.
+      92             :          * @param x1    position after one step of size step
+      93             :          * @param x2    position after two steps of size step/2
+      94             :          * @param step  current step size
+      95             :          * @return        measurement of the error of the step 
+      96             :          */
+      97             :         double errorEstimation(const Vector3d x1, const Vector3d x2, double step) const;
+      98             : 
+      99             :         /** Get magnetic field vector at current candidate position
+     100             :          * @param pos   current position of the candidate
+     101             :          * @param z      current redshift is needed to calculate the magnetic field
+     102             :          * @return        magnetic field vector at the position pos 
+     103             :          */
+     104             :         Vector3d getFieldAtPosition(Vector3d pos, double z) const;
+     105             : 
+     106             :         /** Adapt step size if required and calculates the new position and direction of the particle with the usage of the function dY
+     107             :          * @param y              current position and direction of candidate
+     108             :          * @param out      position and direction of candidate after the step
+     109             :          * @param error  error for the current step
+     110             :          * @param h              current step size
+     111             :          * @param p              current particle state
+     112             :          * @param z              current red shift
+     113             :          * @param q              current charge of the candidate 
+     114             :          * @param m              current mass of the candidate
+     115             :          */
+     116             :         void tryStep(const Y &y, Y &out, Y &error, double h, ParticleState &p, double z, double q, double m) const;
+     117             : 
+     118             :         /** Set functions for the parameters of the class PropagationBP */
+     119             : 
+     120             :         /** Set a specific magnetic field
+     121             :          * @param field  specific magnetic field 
+     122             :          */
+     123             :         void setField(ref_ptr<MagneticField> field);
+     124             :         /** Set a specific tolerance for the step size adaption
+     125             :          * @param tolerance      tolerance is criterion for step adjustment. Step adjustment takes place only if minStep < maxStep. 
+     126             :          */
+     127             :         void setTolerance(double tolerance);
+     128             :         /** Set the minimum step for the Boris push
+     129             :          * @param minStep          minStep/c_light is the minimum integration time step 
+     130             :          */
+     131             :         void setMinimumStep(double minStep);
+     132             :         /** Set the maximum step for the Boris push
+     133             :          * @param maxStep          maxStep/c_light is the maximum integration time step 
+     134             :          */
+     135             :         void setMaximumStep(double maxStep);
+     136             : 
+     137             :         /** Get functions for the parameters of the class PropagationBP, similar to the set functions */
+     138             : 
+     139             :         ref_ptr<MagneticField> getField() const;
+     140             :         double getTolerance() const;
+     141             :         double getMinimumStep() const;
+     142             :         double getMaximumStep() const;
+     143             :         std::string getDescription() const;
+     144             : };
+     145             : /** @}*/
+     146             : 
+     147             : } // namespace crpropa
+     148             : 
+     149             : #endif // PROPAGATIONBP_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/PropagationCK.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/PropagationCK.h.func-sort-c.html new file mode 100644 index 000000000..bd00cdf4d --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/PropagationCK.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/PropagationCK.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - PropagationCK.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:22100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/PropagationCK.h.func.html b/doc/coverageReport/include/crpropa/module/PropagationCK.h.func.html new file mode 100644 index 000000000..80cd4d8d7 --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/PropagationCK.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/PropagationCK.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - PropagationCK.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:22100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/PropagationCK.h.gcov.html b/doc/coverageReport/include/crpropa/module/PropagationCK.h.gcov.html new file mode 100644 index 000000000..1703a86ae --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/PropagationCK.h.gcov.html @@ -0,0 +1,178 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/PropagationCK.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - PropagationCK.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:22100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_PROPAGATIONCK_H
+       2             : #define CRPROPA_PROPAGATIONCK_H
+       3             : 
+       4             : #include "crpropa/Module.h"
+       5             : #include "crpropa/Units.h"
+       6             : #include "crpropa/magneticField/MagneticField.h"
+       7             : #include "kiss/logger.h"
+       8             : 
+       9             : namespace crpropa {
+      10             : /**
+      11             :  * \addtogroup Propagation 
+      12             :  * @{
+      13             :  */
+      14             : 
+      15             : /**
+      16             :  @class PropagationCK
+      17             :  @brief Rectilinear propagation through magnetic fields using the Cash-Karp method.
+      18             : 
+      19             :  This module solves the equations of motion of a relativistic charged particle when propagating through a magnetic field.\n
+      20             :  It uses the Runge-Kutta integration method with Cash-Karp coefficients.\n
+      21             :  The step size control tries to keep the relative error close to, but smaller than the designated tolerance.
+      22             :  Additionally a minimum and maximum size for the steps can be set.
+      23             :  For neutral particles a rectilinear propagation is applied and a next step of the maximum step size proposed.
+      24             :  */
+      25             : class PropagationCK: public Module {
+      26             : public:
+      27         286 :         class Y {
+      28             :         public:
+      29             :                 Vector3d x, u; /*< phase-point: position and direction */
+      30             : 
+      31             :                 Y() {
+      32             :                 }
+      33             : 
+      34          34 :                 Y(const Vector3d &x, const Vector3d &u) :
+      35             :                                 x(x), u(u) {
+      36             :                 }
+      37             : 
+      38             :                 Y(double f) :
+      39             :                                 x(Vector3d(f, f, f)), u(Vector3d(f, f, f)) {
+      40             :                 }
+      41             : 
+      42             :                 Y operator *(double f) const {
+      43             :                         return Y(x * f, u * f);
+      44             :                 }
+      45             : 
+      46             :                 Y &operator +=(const Y &y) {
+      47             :                         x += y.x;
+      48             :                         u += y.u;
+      49             :                         return *this;
+      50             :                 }
+      51             :         };
+      52             : 
+      53             : private:
+      54             :         std::vector<double> a, b, bs; /*< Cash-Karp coefficients */
+      55             :         ref_ptr<MagneticField> field;
+      56             :         double tolerance; /*< target relative error of the numerical integration */
+      57             :         double minStep; /*< minimum step size of the propagation */
+      58             :         double maxStep; /*< maximum step size of the propagation */
+      59             : 
+      60             : public:
+      61             :         /** Constructor for the adaptive Kash Carp.
+      62             :          * @param field
+      63             :          * @param tolerance      tolerance is criterion for step adjustment. Step adjustment takes place only if minStep < maxStep
+      64             :          * @param minStep          minStep/c_light is the minimum integration time step
+      65             :          * @param maxStep          maxStep/c_light is the maximum integration time step. 
+      66             :          */
+      67             :     PropagationCK(ref_ptr<MagneticField> field = NULL, double tolerance = 1e-4,
+      68             :                         double minStep = (0.1 * kpc), double maxStep = (1 * Gpc));
+      69             : 
+      70             :         void process(Candidate *candidate) const;
+      71             : 
+      72             :         // derivative of phase point, dY/dt = d/dt(x, u) = (v, du/dt)
+      73             :         // du/dt = q*c^2/E * (u x B)
+      74             :         Y dYdt(const Y &y, ParticleState &p, double z) const;
+      75             : 
+      76             :         void tryStep(const Y &y, Y &out, Y &error, double t,
+      77             :                         ParticleState &p, double z) const;
+      78             : 
+      79             :         void setField(ref_ptr<MagneticField> field);
+      80             :         void setTolerance(double tolerance);
+      81             :         void setMinimumStep(double minStep);
+      82             :         void setMaximumStep(double maxStep);
+      83             : 
+      84             :          /** get functions for the parameters of the class PropagationCK, similar to the set functions */
+      85             :         ref_ptr<MagneticField> getField() const;
+      86             :         
+      87             :         /** get magnetic field vector at current candidate position
+      88             :          * @param pos   current position of the candidate
+      89             :          * @param z      current redshift is needed to calculate the magnetic field
+      90             :          * @return        magnetic field vector at the position pos */
+      91             :         Vector3d getFieldAtPosition(Vector3d pos, double z) const;
+      92             : 
+      93             :         double getTolerance() const;
+      94             :         double getMinimumStep() const;
+      95             :         double getMaximumStep() const;
+      96             :         std::string getDescription() const;
+      97             : };
+      98             : /** @}*/
+      99             : 
+     100             : } // namespace crpropa
+     101             : 
+     102             : #endif // CRPROPA_PROPAGATIONCK_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/Redshift.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/Redshift.h.func-sort-c.html new file mode 100644 index 000000000..3041fd90b --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/Redshift.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/Redshift.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - Redshift.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:1250.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/Redshift.h.func.html b/doc/coverageReport/include/crpropa/module/Redshift.h.func.html new file mode 100644 index 000000000..b7380b3ff --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/Redshift.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/Redshift.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - Redshift.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:1250.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/Redshift.h.gcov.html b/doc/coverageReport/include/crpropa/module/Redshift.h.gcov.html new file mode 100644 index 000000000..9cbeaec26 --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/Redshift.h.gcov.html @@ -0,0 +1,111 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/Redshift.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - Redshift.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:1250.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_REDSHIFT_H
+       2             : #define CRPROPA_REDSHIFT_H
+       3             : 
+       4             : #include "crpropa/Module.h"
+       5             : 
+       6             : namespace crpropa {
+       7             : /**
+       8             :  * \addtogroup EnergyLosses
+       9             :  * @{
+      10             :  */
+      11             : 
+      12             : /**
+      13             :  @class Redshift
+      14             :  @brief Updates redshift and applies adiabatic energy loss according to the traveled distance.
+      15             :  */
+      16           5 : class Redshift: public Module {
+      17             : public:
+      18             :         void process(Candidate *candidate) const;
+      19             :         std::string getDescription() const;
+      20             : };
+      21             : 
+      22             : /**
+      23             :  @class FutureRedshift
+      24             :  @brief Updates redshift and applies adiabatic energy loss according to the traveled distance. Extends to negative redshift values to allow for symmetric time windows around z=0.
+      25             :  */
+      26           0 : class FutureRedshift: public Module {
+      27             : public:
+      28             :         void process(Candidate *candidate) const;
+      29             :         std::string getDescription() const;
+      30             : };
+      31             : 
+      32             : /** @}*/
+      33             : } // namespace crpropa
+      34             : 
+      35             : #endif // CRPROPA_REDSHIFT_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/SimplePropagation.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/SimplePropagation.h.func-sort-c.html new file mode 100644 index 000000000..487472bfc --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/SimplePropagation.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/SimplePropagation.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - SimplePropagation.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/SimplePropagation.h.func.html b/doc/coverageReport/include/crpropa/module/SimplePropagation.h.func.html new file mode 100644 index 000000000..340e30412 --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/SimplePropagation.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/SimplePropagation.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - SimplePropagation.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/SimplePropagation.h.gcov.html b/doc/coverageReport/include/crpropa/module/SimplePropagation.h.gcov.html new file mode 100644 index 000000000..5cd3cb7b6 --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/SimplePropagation.h.gcov.html @@ -0,0 +1,115 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/SimplePropagation.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - SimplePropagation.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef SIMPLEPROPAGATION_H
+       2             : #define SIMPLEPROPAGATION_H
+       3             : 
+       4             : #include "crpropa/Module.h"
+       5             : #include "crpropa/Units.h"
+       6             : 
+       7             : namespace crpropa {
+       8             : /**
+       9             :  * \addtogroup Propagation 
+      10             :  * @{
+      11             :  */
+      12             : 
+      13             : /**
+      14             :  @class SimplePropagation
+      15             :  @brief Simple rectilinear propagation in absence of magnetic fields.
+      16             : 
+      17             :  This module implements rectilinear propagation.
+      18             :  The step size is guaranteed to be larger than minStep and smaller than maxStep.
+      19             :  It always proposes a next step size of maxStep.
+      20             :  */
+      21           1 : class SimplePropagation: public Module {
+      22             : private:
+      23             :         double minStep, maxStep;
+      24             : 
+      25             : public:
+      26             :         SimplePropagation(double minStep = (0.1 * kpc), double maxStep = (1 * Gpc));
+      27             :         void process(Candidate *candidate) const;
+      28             :         void setMinimumStep(double minStep);
+      29             :         void setMaximumStep(double maxStep);
+      30             :         double getMinimumStep() const;
+      31             :         double getMaximumStep() const;
+      32             :         std::string getDescription() const;
+      33             : };
+      34             : /** @}*/
+      35             : 
+      36             : } // namespace crpropa
+      37             : 
+      38             : #endif // SIMPLEPROPAGATION_H
+      39             : 
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/TextOutput.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/TextOutput.h.func-sort-c.html new file mode 100644 index 000000000..a060bcffd --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/TextOutput.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/TextOutput.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - TextOutput.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:010.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/TextOutput.h.func.html b/doc/coverageReport/include/crpropa/module/TextOutput.h.func.html new file mode 100644 index 000000000..52ca0025f --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/TextOutput.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/TextOutput.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - TextOutput.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:010.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/TextOutput.h.gcov.html b/doc/coverageReport/include/crpropa/module/TextOutput.h.gcov.html new file mode 100644 index 000000000..e9fc25846 --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/TextOutput.h.gcov.html @@ -0,0 +1,155 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/TextOutput.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - TextOutput.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:010.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_TEXTOUTPUT_H
+       2             : #define CRPROPA_TEXTOUTPUT_H
+       3             : 
+       4             : #include "crpropa/module/Output.h"
+       5             : #include "crpropa/module/ParticleCollector.h"
+       6             : 
+       7             : #include <fstream>
+       8             : 
+       9             : namespace crpropa {
+      10             : /**
+      11             :  * \addtogroup Output
+      12             :  * @{
+      13             :  */
+      14             : 
+      15             : /**
+      16             :  @class TextOutput
+      17             :  @brief Configurable plain text output for particle information.
+      18             :  This type of output can also be used to generate a .tar.gz file if
+      19             :  the library zlib is available. For details see:
+      20             :         http://zlib.net/
+      21             :  */
+      22             : class TextOutput: public Output {
+      23             : protected:
+      24             :         std::ostream *out;
+      25             :         std::ofstream outfile;
+      26             :         std::string filename;
+      27             :         bool storeRandomSeeds;
+      28             :         
+      29             :         void printHeader() const;
+      30             : 
+      31             : public:
+      32             :         /** Default constructor
+      33             :          */
+      34             :         TextOutput();
+      35             :         /** Constructor
+      36             :          @param outputType      type of output: Trajectory1D, Trajectory3D, Event1D, Event3D, Everything
+      37             :          */
+      38             :         TextOutput(OutputType outputType);
+      39             :         /** Constructor
+      40             :          @param out                     output stream
+      41             :          */
+      42             :         TextOutput(std::ostream &out);
+      43             :         /** Constructor
+      44             :          @param out                     output stream
+      45             :          @param outputType      type of output: Trajectory1D, Trajectory3D, Event1D, Event3D, Everything
+      46             :          */
+      47             :         TextOutput(std::ostream &out, OutputType outputType);
+      48             :         /** Constructor with the default OutputType (everything).
+      49             :          @param filename        string containing name of output text file
+      50             :          */
+      51             :         TextOutput(const std::string &filename);
+      52             :         /** Constructor
+      53             :          @param filename        string containing name of output text file
+      54             :          @param outputType      type of output: Trajectory1D, Trajectory3D, Event1D, Event3D, Everything
+      55             :          */
+      56             :         TextOutput(const std::string &filename, OutputType outputType);
+      57             :         /** Destructor
+      58             :          */
+      59             :         ~TextOutput();
+      60             :         /** Whether to store the random seeds used in the simulation.
+      61             :          This enables reproducibility of each realisation of the simulation.
+      62             :          */
+      63           0 :         void enableRandomSeeds() {storeRandomSeeds = true;};
+      64             :         void close();
+      65             :         void gzip();
+      66             :         void process(Candidate *candidate) const;
+      67             :         /** Loads a file to a particle collector.
+      68             :          This is useful for analysis involving, e.g., magnetic lenses.
+      69             :          @param filename        string containing the name of the file to be loaded
+      70             :          @param collector       object of type ParticleCollector that will store the information
+      71             :          */
+      72             :         static void load(const std::string &filename, ParticleCollector *collector);
+      73             :         std::string getDescription() const;
+      74             : };
+      75             : /** @}*/
+      76             : 
+      77             : } // namespace crpropa
+      78             : 
+      79             : #endif // CRPROPA_TEXTOUTPUT_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/Tools.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/Tools.h.func-sort-c.html new file mode 100644 index 000000000..4ce957e1c --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/Tools.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/Tools.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - Tools.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:020.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/Tools.h.func.html b/doc/coverageReport/include/crpropa/module/Tools.h.func.html new file mode 100644 index 000000000..d4f77327f --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/Tools.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/Tools.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - Tools.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:020.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/Tools.h.gcov.html b/doc/coverageReport/include/crpropa/module/Tools.h.gcov.html new file mode 100644 index 000000000..ff73e05a6 --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/Tools.h.gcov.html @@ -0,0 +1,150 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module/Tools.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/module - Tools.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:020.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef CRPROPA_MODULETOOLS_H
+       2             : #define CRPROPA_MODULETOOLS_H
+       3             : 
+       4             : #include "crpropa/Module.h"
+       5             : #include "crpropa/EmissionMap.h"
+       6             : 
+       7             : #include <vector>
+       8             : #include <set>
+       9             : 
+      10             : namespace crpropa {
+      11             : /**
+      12             :  * \addtogroup Tools
+      13             :  * @{
+      14             :  */
+      15             : 
+      16             : /**
+      17             :  @class PerformanceModule
+      18             :  @brief Module to monitor the simulation performance
+      19             : 
+      20             :  Add modules under investigation to this module instead of the ModuleList.
+      21             :  */
+      22           0 : class PerformanceModule: public Module {
+      23             : private:
+      24           0 :         struct _module_info {
+      25             :                 double time;
+      26             :                 ref_ptr<Module> module;
+      27             :         };
+      28             : 
+      29             :         mutable std::vector<_module_info> modules;
+      30             :         mutable size_t calls;
+      31             : 
+      32             : public:
+      33             :         ~PerformanceModule();
+      34             :         void add(Module* module);
+      35             :         void process(Candidate* candidate) const;
+      36             :         std::string getDescription() const;
+      37             : };
+      38             : 
+      39             : /**
+      40             :   @class ParticleFilter
+      41             :   @brief Reject Particles not listed in filter.
+      42             : */
+      43             : class ParticleFilter: public AbstractCondition {
+      44             :         std::set<int> ids;
+      45             : 
+      46             : public:
+      47             :         ParticleFilter();
+      48             :         ParticleFilter(const std::set<int> &ids);
+      49             :         void addId(int id);
+      50             :         void removeId(int remove);
+      51             :         std::set<int> &getIds();
+      52             : 
+      53             :         void process(Candidate* candidate) const;
+      54             :         std::string getDescription() const;
+      55             : };
+      56             : 
+      57             : 
+      58             : /**
+      59             :   @class EmissionMapFiller
+      60             :   @brief Fill EmissionMap with source particle state
+      61             : */
+      62             : class EmissionMapFiller: public Module {
+      63             :         ref_ptr<EmissionMap> emissionMap;
+      64             : public:
+      65             :         EmissionMapFiller(EmissionMap *emissionMap);
+      66             :         void setEmissionMap(EmissionMap *emissionMap);
+      67             :         void process(Candidate* candidate) const;
+      68             :         std::string getDescription() const;
+      69             : };
+      70             : 
+      71             : /** @}*/
+      72             : } // namespace crpropa
+      73             : 
+      74             : #endif // CRPROPA_MODULETOOLS_H
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/index-sort-f.html b/doc/coverageReport/include/crpropa/module/index-sort-f.html new file mode 100644 index 000000000..14233aa5e --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/index-sort-f.html @@ -0,0 +1,213 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/moduleHitTotalCoverage
Test:coverage.info.cleanedLines:223562.9 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
OutputShell.h +
0.0%
+
0.0 %0 / 3-0 / 0
TextOutput.h +
0.0%
+
0.0 %0 / 1-0 / 0
SimplePropagation.h +
100.0%
+
100.0 %1 / 1-0 / 0
BreakCondition.h +
100.0%
+
100.0 %4 / 4-0 / 0
Boundary.h +
100.0%
+
100.0 %6 / 6-0 / 0
PhotoDisintegration.h +
100.0%
+
100.0 %2 / 2-0 / 0
Tools.h +
0.0%
+
0.0 %0 / 2-0 / 0
PropagationCK.h +
100.0%
+
100.0 %2 / 2-0 / 0
PropagationBP.h +
100.0%
+
100.0 %2 / 2-0 / 0
HDF5Output.h +
0.0%
+
0.0 %0 / 1-0 / 0
Observer.h +
37.5%37.5%
+
37.5 %3 / 8-0 / 0
NuclearDecay.h +
100.0%
+
100.0 %1 / 1-0 / 0
Redshift.h +
50.0%50.0%
+
50.0 %1 / 2-0 / 0
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/index-sort-l.html b/doc/coverageReport/include/crpropa/module/index-sort-l.html new file mode 100644 index 000000000..5ff9027ea --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/index-sort-l.html @@ -0,0 +1,213 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/moduleHitTotalCoverage
Test:coverage.info.cleanedLines:223562.9 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
TextOutput.h +
0.0%
+
0.0 %0 / 1-0 / 0
HDF5Output.h +
0.0%
+
0.0 %0 / 1-0 / 0
Tools.h +
0.0%
+
0.0 %0 / 2-0 / 0
OutputShell.h +
0.0%
+
0.0 %0 / 3-0 / 0
Observer.h +
37.5%37.5%
+
37.5 %3 / 8-0 / 0
Redshift.h +
50.0%50.0%
+
50.0 %1 / 2-0 / 0
SimplePropagation.h +
100.0%
+
100.0 %1 / 1-0 / 0
NuclearDecay.h +
100.0%
+
100.0 %1 / 1-0 / 0
PhotoDisintegration.h +
100.0%
+
100.0 %2 / 2-0 / 0
PropagationCK.h +
100.0%
+
100.0 %2 / 2-0 / 0
PropagationBP.h +
100.0%
+
100.0 %2 / 2-0 / 0
BreakCondition.h +
100.0%
+
100.0 %4 / 4-0 / 0
Boundary.h +
100.0%
+
100.0 %6 / 6-0 / 0
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/include/crpropa/module/index.html b/doc/coverageReport/include/crpropa/module/index.html new file mode 100644 index 000000000..5483b4fa7 --- /dev/null +++ b/doc/coverageReport/include/crpropa/module/index.html @@ -0,0 +1,213 @@ + + + + + + + LCOV - coverage.info.cleaned - include/crpropa/module + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - include/crpropa/moduleHitTotalCoverage
Test:coverage.info.cleanedLines:223562.9 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Boundary.h +
100.0%
+
100.0 %6 / 6-0 / 0
BreakCondition.h +
100.0%
+
100.0 %4 / 4-0 / 0
HDF5Output.h +
0.0%
+
0.0 %0 / 1-0 / 0
NuclearDecay.h +
100.0%
+
100.0 %1 / 1-0 / 0
Observer.h +
37.5%37.5%
+
37.5 %3 / 8-0 / 0
OutputShell.h +
0.0%
+
0.0 %0 / 3-0 / 0
PhotoDisintegration.h +
100.0%
+
100.0 %2 / 2-0 / 0
PropagationBP.h +
100.0%
+
100.0 %2 / 2-0 / 0
PropagationCK.h +
100.0%
+
100.0 %2 / 2-0 / 0
Redshift.h +
50.0%50.0%
+
50.0 %1 / 2-0 / 0
SimplePropagation.h +
100.0%
+
100.0 %1 / 1-0 / 0
TextOutput.h +
0.0%
+
0.0 %0 / 1-0 / 0
Tools.h +
0.0%
+
0.0 %0 / 2-0 / 0
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/index-sort-f.html b/doc/coverageReport/index-sort-f.html new file mode 100644 index 000000000..2f53c4197 --- /dev/null +++ b/doc/coverageReport/index-sort-f.html @@ -0,0 +1,293 @@ + + + + + + + LCOV - coverage.info.cleaned + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top levelHitTotalCoverage
Test:coverage.info.cleanedLines:87351426261.2 %
Date:2024-04-08 14:58:22Functions:1124206954.3 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Directory Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
include/crpropa/massDistribution +
19.2%19.2%
+
19.2 %5 / 260.0 %0 / 11
libs/healpix_base/include/healpix_base +
19.1%19.1%
+
19.1 %33 / 1738.1 %5 / 62
libs/healpix_base +
14.1%14.1%
+
14.1 %112 / 7929.4 %10 / 106
libs/kiss/include/kiss +
57.9%57.9%
+
57.9 %11 / 1920.9 %14 / 67
src/magneticField +
18.2%18.2%
+
18.2 %166 / 91021.0 %29 / 138
libs/HepPID/src +
11.4%11.4%
+
11.4 %50 / 44022.9 %11 / 48
libs/kiss/src +
28.1%28.1%
+
28.1 %34 / 12139.1 %9 / 23
include/crpropa +
73.6%73.6%
+
73.6 %408 / 55446.4 %77 / 166
include/crpropa/magneticField/turbulentField +
72.9%72.9%
+
72.9 %43 / 5947.1 %8 / 17
src/magneticLens +
45.7%45.7%
+
45.7 %147 / 32251.2 %21 / 41
src/advectionField +
42.5%42.5%
+
42.5 %131 / 30852.4 %44 / 84
include/crpropa/magneticLens +
42.9%42.9%
+
42.9 %30 / 7054.5 %6 / 11
src/magneticField/turbulentField +
71.1%71.1%
+
71.1 %187 / 26357.9 %11 / 19
src +
50.3%50.3%
+
50.3 %1361 / 270758.5 %251 / 429
src/module +
63.4%63.4%
+
63.4 %2250 / 354759.0 %286 / 485
include/crpropa/magneticField +
89.3%89.3%
+
89.3 %50 / 5663.6 %7 / 11
src/massDistribution +
83.9%83.9%
+
83.9 %349 / 41690.8 %69 / 76
test +
97.9%97.9%
+
97.9 %3320 / 339196.7 %264 / 273
include/crpropa/module +
62.9%62.9%
+
62.9 %22 / 35-0 / 0
include/crpropa/advectionField +
100.0%
+
100.0 %5 / 5-0 / 0
/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy +
43.8%43.8%
+
43.8 %21 / 48100.0 %2 / 2
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/index-sort-l.html b/doc/coverageReport/index-sort-l.html new file mode 100644 index 000000000..ae168257c --- /dev/null +++ b/doc/coverageReport/index-sort-l.html @@ -0,0 +1,293 @@ + + + + + + + LCOV - coverage.info.cleaned + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top levelHitTotalCoverage
Test:coverage.info.cleanedLines:87351426261.2 %
Date:2024-04-08 14:58:22Functions:1124206954.3 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Directory Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
libs/HepPID/src +
11.4%11.4%
+
11.4 %50 / 44022.9 %11 / 48
libs/healpix_base +
14.1%14.1%
+
14.1 %112 / 7929.4 %10 / 106
src/magneticField +
18.2%18.2%
+
18.2 %166 / 91021.0 %29 / 138
libs/healpix_base/include/healpix_base +
19.1%19.1%
+
19.1 %33 / 1738.1 %5 / 62
include/crpropa/massDistribution +
19.2%19.2%
+
19.2 %5 / 260.0 %0 / 11
libs/kiss/src +
28.1%28.1%
+
28.1 %34 / 12139.1 %9 / 23
src/advectionField +
42.5%42.5%
+
42.5 %131 / 30852.4 %44 / 84
include/crpropa/magneticLens +
42.9%42.9%
+
42.9 %30 / 7054.5 %6 / 11
/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy +
43.8%43.8%
+
43.8 %21 / 48100.0 %2 / 2
src/magneticLens +
45.7%45.7%
+
45.7 %147 / 32251.2 %21 / 41
src +
50.3%50.3%
+
50.3 %1361 / 270758.5 %251 / 429
libs/kiss/include/kiss +
57.9%57.9%
+
57.9 %11 / 1920.9 %14 / 67
include/crpropa/module +
62.9%62.9%
+
62.9 %22 / 35-0 / 0
src/module +
63.4%63.4%
+
63.4 %2250 / 354759.0 %286 / 485
src/magneticField/turbulentField +
71.1%71.1%
+
71.1 %187 / 26357.9 %11 / 19
include/crpropa/magneticField/turbulentField +
72.9%72.9%
+
72.9 %43 / 5947.1 %8 / 17
include/crpropa +
73.6%73.6%
+
73.6 %408 / 55446.4 %77 / 166
src/massDistribution +
83.9%83.9%
+
83.9 %349 / 41690.8 %69 / 76
include/crpropa/magneticField +
89.3%89.3%
+
89.3 %50 / 5663.6 %7 / 11
test +
97.9%97.9%
+
97.9 %3320 / 339196.7 %264 / 273
include/crpropa/advectionField +
100.0%
+
100.0 %5 / 5-0 / 0
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/index.html b/doc/coverageReport/index.html new file mode 100644 index 000000000..11a901d77 --- /dev/null +++ b/doc/coverageReport/index.html @@ -0,0 +1,293 @@ + + + + + + + LCOV - coverage.info.cleaned + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top levelHitTotalCoverage
Test:coverage.info.cleanedLines:87351426261.2 %
Date:2024-04-08 14:58:22Functions:1124206954.3 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Directory Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy +
43.8%43.8%
+
43.8 %21 / 48100.0 %2 / 2
include/crpropa +
73.6%73.6%
+
73.6 %408 / 55446.4 %77 / 166
include/crpropa/advectionField +
100.0%
+
100.0 %5 / 5-0 / 0
include/crpropa/magneticField +
89.3%89.3%
+
89.3 %50 / 5663.6 %7 / 11
include/crpropa/magneticField/turbulentField +
72.9%72.9%
+
72.9 %43 / 5947.1 %8 / 17
include/crpropa/magneticLens +
42.9%42.9%
+
42.9 %30 / 7054.5 %6 / 11
include/crpropa/massDistribution +
19.2%19.2%
+
19.2 %5 / 260.0 %0 / 11
include/crpropa/module +
62.9%62.9%
+
62.9 %22 / 35-0 / 0
libs/HepPID/src +
11.4%11.4%
+
11.4 %50 / 44022.9 %11 / 48
libs/healpix_base +
14.1%14.1%
+
14.1 %112 / 7929.4 %10 / 106
libs/healpix_base/include/healpix_base +
19.1%19.1%
+
19.1 %33 / 1738.1 %5 / 62
libs/kiss/include/kiss +
57.9%57.9%
+
57.9 %11 / 1920.9 %14 / 67
libs/kiss/src +
28.1%28.1%
+
28.1 %34 / 12139.1 %9 / 23
src +
50.3%50.3%
+
50.3 %1361 / 270758.5 %251 / 429
src/advectionField +
42.5%42.5%
+
42.5 %131 / 30852.4 %44 / 84
src/magneticField +
18.2%18.2%
+
18.2 %166 / 91021.0 %29 / 138
src/magneticField/turbulentField +
71.1%71.1%
+
71.1 %187 / 26357.9 %11 / 19
src/magneticLens +
45.7%45.7%
+
45.7 %147 / 32251.2 %21 / 41
src/massDistribution +
83.9%83.9%
+
83.9 %349 / 41690.8 %69 / 76
src/module +
63.4%63.4%
+
63.4 %2250 / 354759.0 %286 / 485
test +
97.9%97.9%
+
97.9 %3320 / 339196.7 %264 / 273
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/HepPID/src/ParticleIDMethods.cc.func-sort-c.html b/doc/coverageReport/libs/HepPID/src/ParticleIDMethods.cc.func-sort-c.html new file mode 100644 index 000000000..295e10399 --- /dev/null +++ b/doc/coverageReport/libs/HepPID/src/ParticleIDMethods.cc.func-sort-c.html @@ -0,0 +1,200 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/HepPID/src/ParticleIDMethods.cc - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/HepPID/src - ParticleIDMethods.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:5024920.1 %
Date:2024-04-08 14:58:22Functions:113234.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN6HepPID10hasStrangeERKi0
_ZN6HepPID12_GLOBAL__N_15findQERKiS2_0
_ZN6HepPID12isPentaquarkERKi0
_ZN6HepPID18hasFundamentalAntiERKi0
_ZN6HepPID5hasUpERKi0
_ZN6HepPID5jSpinERKi0
_ZN6HepPID5lSpinERKi0
_ZN6HepPID5sSpinERKi0
_ZN6HepPID6hasTopERKi0
_ZN6HepPID6isSUSYERKi0
_ZN6HepPID6lambdaERKi0
_ZN6HepPID7hasDownERKi0
_ZN6HepPID7isMesonERKi0
_ZN6HepPID7isValidERKi0
_ZN6HepPID8hasCharmERKi0
_ZN6HepPID8isBaryonERKi0
_ZN6HepPID8isHadronERKi0
_ZN6HepPID8isLeptonERKi0
_ZN6HepPID9hasBottomERKi0
_ZN6HepPID9isDiQuarkERKi0
_ZN6HepPID9isRhadronERKi0
_ZN6HepPID1AERKi202818
_ZN6HepPID1ZERKi364529
_ZN6HepPID6isDyonERKi3325562
_ZN6HepPID13fundamentalIDERKi20168250
_ZN6HepPID6chargeERKi20168251
_ZN6HepPID11threeChargeERKi20168252
_ZN6HepPID9isNucleusERKi20937352
_ZN6HepPID7isQBallERKi23493806
_ZN6HepPID9extraBitsERKi50313164
_ZN6HepPID5digitENS_8locationERKi146041016
_ZN6HepPID6abspidERKi260299484
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/HepPID/src/ParticleIDMethods.cc.func.html b/doc/coverageReport/libs/HepPID/src/ParticleIDMethods.cc.func.html new file mode 100644 index 000000000..078e3d9b7 --- /dev/null +++ b/doc/coverageReport/libs/HepPID/src/ParticleIDMethods.cc.func.html @@ -0,0 +1,200 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/HepPID/src/ParticleIDMethods.cc - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/HepPID/src - ParticleIDMethods.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:5024920.1 %
Date:2024-04-08 14:58:22Functions:113234.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN6HepPID10hasStrangeERKi0
_ZN6HepPID11threeChargeERKi20168252
_ZN6HepPID12_GLOBAL__N_15findQERKiS2_0
_ZN6HepPID12isPentaquarkERKi0
_ZN6HepPID13fundamentalIDERKi20168250
_ZN6HepPID18hasFundamentalAntiERKi0
_ZN6HepPID1AERKi202818
_ZN6HepPID1ZERKi364529
_ZN6HepPID5digitENS_8locationERKi146041016
_ZN6HepPID5hasUpERKi0
_ZN6HepPID5jSpinERKi0
_ZN6HepPID5lSpinERKi0
_ZN6HepPID5sSpinERKi0
_ZN6HepPID6abspidERKi260299484
_ZN6HepPID6chargeERKi20168251
_ZN6HepPID6hasTopERKi0
_ZN6HepPID6isDyonERKi3325562
_ZN6HepPID6isSUSYERKi0
_ZN6HepPID6lambdaERKi0
_ZN6HepPID7hasDownERKi0
_ZN6HepPID7isMesonERKi0
_ZN6HepPID7isQBallERKi23493806
_ZN6HepPID7isValidERKi0
_ZN6HepPID8hasCharmERKi0
_ZN6HepPID8isBaryonERKi0
_ZN6HepPID8isHadronERKi0
_ZN6HepPID8isLeptonERKi0
_ZN6HepPID9extraBitsERKi50313164
_ZN6HepPID9hasBottomERKi0
_ZN6HepPID9isDiQuarkERKi0
_ZN6HepPID9isNucleusERKi20937352
_ZN6HepPID9isRhadronERKi0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/HepPID/src/ParticleIDMethods.cc.gcov.html b/doc/coverageReport/libs/HepPID/src/ParticleIDMethods.cc.gcov.html new file mode 100644 index 000000000..de197c29e --- /dev/null +++ b/doc/coverageReport/libs/HepPID/src/ParticleIDMethods.cc.gcov.html @@ -0,0 +1,641 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/HepPID/src/ParticleIDMethods.cc + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/HepPID/src - ParticleIDMethods.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:5024920.1 %
Date:2024-04-08 14:58:22Functions:113234.4 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : // ----------------------------------------------------------------------
+       2             : //
+       3             : // ParticleIDMethods.cc
+       4             : //
+       5             : // ----------------------------------------------------------------------
+       6             : 
+       7             : #include <cmath>  // for pow()
+       8             : 
+       9             : #include "HepPID/ParticleIDMethods.hh"
+      10             : #include "HepPID/ParticleName.hh"
+      11             : 
+      12             : namespace HepPID {
+      13             : 
+      14             : namespace {
+      15             : 
+      16             : // internal function used by hasXXX methods
+      17           0 : bool findQ( const int & pid, const int & q )
+      18             : {
+      19           0 :     if( isDyon(pid) ) { return false; }
+      20           0 :     if( isRhadron(pid) ) {
+      21             :         int iz = 7;
+      22           0 :         for( int i=6; i > 1; --i ) {
+      23           0 :            if( digit(location(i),pid) == 0 ) {
+      24             :                iz = i;
+      25           0 :            } else if ( i == iz-1 ) {
+      26             :                // ignore squark or gluino
+      27             :            } else {
+      28           0 :                if( digit(location(i),pid) == q ) { return true; }
+      29             :            }
+      30             :         }
+      31             :         return false;
+      32             :     }
+      33           0 :     if( digit(nq3,pid) == q || digit(nq2,pid) == q || digit(nq1,pid) == q ) { return true; }
+      34           0 :     if( isPentaquark(pid) ) { 
+      35           0 :         if( digit(nl,pid) == q || digit(nr,pid) == q ) { return true; }
+      36             :     }
+      37             :     return false;
+      38             : }
+      39             : 
+      40             : }
+      41             : 
+      42             : // absolute value
+      43   260299484 : int abspid( const int & pid )
+      44             : {
+      45   260299484 :   return (pid < 0) ? -pid : pid;
+      46             : }
+      47             : 
+      48             : // returns everything beyond the 7th digit (e.g. outside the numbering scheme)
+      49    50313164 : int extraBits( const int & pid )
+      50             : {
+      51    50313164 :     return abspid(pid)/10000000;
+      52             : }
+      53             : 
+      54             : //  split the PID into constituent integers
+      55   146041016 : unsigned short digit( location loc, const int & pid )
+      56             : {
+      57             :     //  PID digits (base 10) are: n nr nl nq1 nq2 nq3 nj
+      58             :     //  the location enum provides a convenient index into the PID
+      59             :                 //
+      60             :                 //  Modified for CRPropa: use precalculated values isntead of pow for
+      61             :                 //  performance
+      62             :                 static unsigned int p10[] = { 1, 10, 100, 1000,  10000, 100000, 1000000,
+      63             :                         10000000, 100000000, 1000000000};
+      64   146041016 :     return (abspid(pid)/ p10[loc-1])%10;
+      65             : //    int numerator = (int) std::pow(10.0,(loc-1));
+      66             : //    return (abspid(pid)/numerator)%10;
+      67             : }
+      68             : 
+      69             : //  return the first two digits if this is a "fundamental" particle
+      70             : //  ID = 100 is a special case (internal generator ID's are 81-100)
+      71    20168250 : int fundamentalID( const int & pid )
+      72             : {
+      73    20168250 :     if( extraBits(pid) > 0 ) return 0;
+      74    20168243 :     if( digit(nq2,pid) == 0 && digit(nq1,pid) == 0) {
+      75    20168243 :         return abspid(pid)%10000;
+      76           0 :     } else if( abspid(pid) <= 100 ) {
+      77           0 :         return abspid(pid);
+      78             :     } else {
+      79             :         return 0;
+      80             :     }
+      81             : }
+      82             : 
+      83             : // Ion numbers are +/- 10LZZZAAAI. 
+      84      364529 : int Z( const int & pid )
+      85             : {
+      86             :     // a proton can also be a Hydrogen nucleus
+      87      364529 :     if( abspid(pid) == 2212 ) { return 1; }
+      88      364529 :     if( isNucleus(pid) ) return (abspid(pid)/10000)%1000;
+      89             :     return 0;
+      90             : }
+      91             : 
+      92             : // Ion numbers are +/- 10LZZZAAAI. 
+      93      202818 : int A( const int & pid )
+      94             : {
+      95             :     // a proton can also be a Hydrogen nucleus
+      96      202818 :     if( abspid(pid) == 2212 ) { return 1; }
+      97      202818 :     if( isNucleus(pid) ) return (abspid(pid)/10)%1000;
+      98             :     return 0;
+      99             : }
+     100             : 
+     101             : // if this is a nucleus (ion), get nLambda
+     102             : // Ion numbers are +/- 10LZZZAAAI. 
+     103           0 : int lambda( const int & pid )
+     104             : {
+     105             :     // a proton can also be a Hydrogen nucleus
+     106           0 :     if( abspid(pid) == 2212 ) { return 0; }
+     107           0 :     if( isNucleus(pid) ) return digit(n8,pid);
+     108             :     return 0;
+     109             : }
+     110             : 
+     111             : 
+     112             : // ---  boolean methods:
+     113             : //
+     114             : 
+     115             : //  check to see if this is a valid PID
+     116           0 : bool isValid( const int & pid )
+     117             : {
+     118           0 :     if( extraBits(pid) > 0 ) {
+     119           0 :         if( isNucleus(pid) )   { return true; }
+     120           0 :         if( isQBall(pid) )   { return true; }
+     121           0 :         return false; 
+     122             :     }
+     123           0 :     if( isSUSY(pid) ) { return true; }
+     124           0 :     if( isRhadron(pid) ) { return true; }
+     125           0 :     if( isDyon(pid) ) { return true; }
+     126             :     // Meson signature
+     127           0 :     if( isMeson(pid) )   { return true; }
+     128             :     // Baryon signature
+     129           0 :     if( isBaryon(pid) )  { return true; }
+     130             :     // DiQuark signature
+     131           0 :     if( isDiQuark(pid) ) { return true; }
+     132             :     // fundamental particle
+     133           0 :     if( fundamentalID(pid) > 0 ) { 
+     134           0 :       if(pid > 0 ) { 
+     135             :         return true; 
+     136             :       } else {
+     137           0 :         if( hasFundamentalAnti(pid) ) { return true; }
+     138           0 :         return false;
+     139             :       }
+     140             :     }
+     141             :     // pentaquark
+     142           0 :     if( isPentaquark(pid) ) { return true; }
+     143             :     // don't recognize this number
+     144             :     return false;
+     145             : }
+     146             : 
+     147             : // if this is a fundamental particle, does it have a valid antiparticle?
+     148           0 : bool hasFundamentalAnti( const int & pid )
+     149             : {
+     150             :     // these are defined by the generator and therefore are always valid
+     151           0 :     if( fundamentalID(pid) <= 100 && fundamentalID(pid) >= 80 ) { return true; }
+     152             :     // check id's from 1 to 79
+     153           0 :     if( fundamentalID(pid) > 0 && fundamentalID(pid) < 80 ) { 
+     154           0 :        if( validParticleName(-pid) ) { return true; }
+     155             :     }
+     156             :     return false;
+     157             : }
+     158             : 
+     159             : //  check to see if this is a valid meson
+     160           0 : bool isMeson( const int & pid )
+     161             : {
+     162           0 :     if( extraBits(pid) > 0 ) { return false; }
+     163           0 :     if( abspid(pid) <= 100 ) { return false; }
+     164           0 :     if( fundamentalID(pid) <= 100 && fundamentalID(pid) > 0 ) { return false; }
+     165           0 :     if( isRhadron(pid) ) { return false; }
+     166           0 :     int aid = abspid(pid);
+     167           0 :     if( aid == 130 || aid == 310 || aid == 210 ) { return true; }
+     168             :     // EvtGen uses some odd numbers
+     169           0 :     if( aid == 150 || aid == 350 || aid == 510 || aid == 530 ) { return true; }
+     170             :     // pomeron, etc.
+     171           0 :     if( pid == 110 || pid == 990 || pid == 9990 ) { return true; }
+     172           0 :     if(    digit(nj,pid) > 0 && digit(nq3,pid) > 0 
+     173           0 :         && digit(nq2,pid) > 0 && digit(nq1,pid) == 0 ) {
+     174             :         // check for illegal antiparticles
+     175           0 :         if( digit(nq3,pid) == digit(nq2,pid) && pid < 0 ) {
+     176           0 :             return false;
+     177             :         } else {
+     178             :             return true;
+     179             :         }
+     180             :     }
+     181             :     return false;
+     182             : }
+     183             : 
+     184             : //  check to see if this is a valid baryon
+     185           0 : bool isBaryon( const int & pid )
+     186             : {
+     187           0 :     if( extraBits(pid) > 0 ) { return false; }
+     188           0 :     if( abspid(pid) <= 100 ) { return false; }
+     189           0 :     if( fundamentalID(pid) <= 100 && fundamentalID(pid) > 0 ) { return false; }
+     190           0 :     if( isRhadron(pid) ) { return false; }
+     191           0 :     if( isPentaquark(pid) ) { return false; }
+     192           0 :     if( abspid(pid) == 2110 || abspid(pid) == 2210 ) { return true; }
+     193           0 :     if(    digit(nj,pid) > 0  && digit(nq3,pid) > 0 
+     194           0 :         && digit(nq2,pid) > 0 && digit(nq1,pid) > 0 ) { return true; }
+     195             :     return false;
+     196             : }
+     197             : 
+     198             : //  check to see if this is a valid diquark
+     199           0 : bool isDiQuark( const int & pid )
+     200             : {
+     201           0 :     if( extraBits(pid) > 0 ) { return false; }
+     202           0 :     if( abspid(pid) <= 100 ) { return false; }
+     203           0 :     if( fundamentalID(pid) <= 100 && fundamentalID(pid) > 0 ) { return false; }
+     204           0 :     if(    digit(nj,pid) > 0  && digit(nq3,pid) == 0 
+     205           0 :         && digit(nq2,pid) > 0 && digit(nq1,pid) > 0 ) {  // diquark signature
+     206             :        // EvtGen uses the diquarks for quark pairs, so, for instance, 
+     207             :        //   5501 is a valid "diquark" for EvtGen
+     208             :        //if( digit(nj) == 1 && digit(nq2) == digit(nq1) ) {     // illegal
+     209             :        //   return false; 
+     210             :        //} else {
+     211           0 :           return true;
+     212             :        //}
+     213             :     }
+     214             :     return false;
+     215             : }
+     216             : 
+     217             : // is this a valid hadron ID?
+     218           0 : bool isHadron( const int & pid )
+     219             : {
+     220           0 :     if( extraBits(pid) > 0 ) { return false; }
+     221           0 :     if( isMeson(pid) )   { return true; }
+     222           0 :     if( isBaryon(pid) )  { return true; }
+     223           0 :     if( isPentaquark(pid) ) { return true; }
+     224           0 :     if( isRhadron(pid) ) { return true; }
+     225             :     return false;
+     226             : }
+     227             : // is this a valid lepton ID?
+     228           0 : bool isLepton( const int & pid )
+     229             : {
+     230           0 :     if( extraBits(pid) > 0 ) { return false; }
+     231           0 :     if( fundamentalID(pid) >= 11 && fundamentalID(pid) <= 18 ) { return true; }
+     232             :     return false;
+     233             : }
+     234             : 
+     235             : //
+     236             : // This implements the 2006 Monte Carlo nuclear code scheme.
+     237             : // Ion numbers are +/- 10LZZZAAAI. 
+     238             : // AAA is A - total baryon number
+     239             : // ZZZ is Z - total charge
+     240             : // L is the total number of strange quarks.
+     241             : // I is the isomer number, with I=0 corresponding to the ground state.
+     242    20937352 : bool isNucleus( const int & pid )
+     243             : {
+     244             :      // a proton can also be a Hydrogen nucleus
+     245    20937352 :      if( abspid(pid) == 2212 ) { return true; }
+     246             :      // new standard: +/- 10LZZZAAAI
+     247    20937336 :      if( ( digit(n10,pid) == 1 ) && ( digit(n9,pid) == 0 ) ) {
+     248             :         // charge should always be less than or equal to baryon number
+     249             :         // the following line is A >= Z
+     250      769143 :         if( (abspid(pid)/10)%1000 >= (abspid(pid)/10000)%1000 ) { return true; }
+     251             :      }
+     252             :      return false;
+     253             : }
+     254             : 
+     255             : //  check to see if this is a valid pentaquark
+     256           0 : bool isPentaquark( const int & pid )
+     257             : {
+     258             :     // a pentaquark is of the form 9abcdej,
+     259             :     // where j is the spin and a, b, c, d, and e are quarks
+     260           0 :     if( extraBits(pid) > 0 ) { return false; }
+     261           0 :     if( digit(n,pid) != 9 )  { return false; }
+     262           0 :     if( digit(nr,pid) == 9 || digit(nr,pid) == 0 )  { return false; }
+     263           0 :     if( digit(nj,pid) == 9 || digit(nl,pid) == 0 )  { return false; }
+     264           0 :     if( digit(nq1,pid) == 0 )  { return false; }
+     265           0 :     if( digit(nq2,pid) == 0 )  { return false; }
+     266           0 :     if( digit(nq3,pid) == 0 )  { return false; }
+     267           0 :     if( digit(nj,pid) == 0 )  { return false; }
+     268             :     // check ordering
+     269           0 :     if( digit(nq2,pid) > digit(nq1,pid) )  { return false; }
+     270           0 :     if( digit(nq1,pid) > digit(nl,pid) )  { return false; }
+     271           0 :     if( digit(nl,pid) > digit(nr,pid) )  { return false; }
+     272             :     return true;
+     273             : }
+     274             : 
+     275             : // is this a SUSY?
+     276           0 : bool isSUSY( const int & pid )
+     277             : {
+     278             :     // fundamental SUSY particles have n = 1 or 2
+     279           0 :     if( extraBits(pid) > 0 ) { return false; }
+     280           0 :     if( digit(n,pid) != 1 && digit(n,pid) != 2 )  { return false; }
+     281           0 :     if( digit(nr,pid) != 0 )  { return false; }
+     282             :     // check fundamental part
+     283           0 :     if( fundamentalID(pid) == 0 )  { return false; }
+     284             :     return true;
+     285             : }
+     286             : 
+     287             : // is this an R-hadron?
+     288           0 : bool isRhadron( const int & pid )
+     289             : {
+     290             :     // an R-hadron is of the form 10abcdj, 100abcj, or 1000abj
+     291             :     // where j is the spin, b, c, and d are quarks or gluons,
+     292             :     // and a (the digit following the zero's) is a SUSY particle
+     293           0 :     if( extraBits(pid) > 0 ) { return false; }
+     294           0 :     if( digit(n,pid) != 1 )  { return false; }
+     295           0 :     if( digit(nr,pid) != 0 )  { return false; }
+     296             :     // make sure this isn't a SUSY particle
+     297           0 :     if( isSUSY(pid) ) { return false; }
+     298             :     // All R-hadrons have at least 3 core digits
+     299           0 :     if( digit(nq2,pid) == 0 )  { return false; }
+     300           0 :     if( digit(nq3,pid) == 0 )  { return false; }
+     301           0 :     if( digit(nj,pid) == 0 )  { return false; }
+     302             :     return true;
+     303             : }
+     304             : 
+     305             : // is this a Dyon (magnetic monopole)?
+     306     3325562 : bool isDyon( const int & pid )
+     307             : {
+     308             :     ///Magnetic monopoles and Dyons are assumed to have one unit of 
+     309             :     ///Dirac monopole charge and a variable integer number xyz units 
+     310             :     ///of electric charge.  
+     311             :     ///
+     312             :     ///Codes 411xyz0 are then used when the magnetic and electrical 
+     313             :     ///charge sign agree and 412xyz0 when they disagree, 
+     314             :     ///with the overall sign of the particle set by the magnetic charge.  
+     315             :     ///For now no spin information is provided.
+     316             :     ///
+     317     3325562 :     if( extraBits(pid) > 0 ) { return false; }
+     318     3325562 :     if( digit(n,pid) != 4 )  { return false; }
+     319           0 :     if( digit(nr,pid) != 1 )  { return false; }
+     320           0 :     if( (digit(nl,pid) != 1) && (digit(nl,pid) != 2) )  { return false; }
+     321             :     // All Dyons have at least 1 core digit
+     322           0 :     if( digit(nq3,pid) == 0 )  { return false; }
+     323             :     // Dyons have spin zero for now
+     324           0 :     if( digit(nj,pid) != 0 )  { return false; }
+     325             :     return true;
+     326             : }
+     327             : 
+     328             : // Check for QBalls
+     329             : // Ad-hoc numbering for such particles is 100xxxx0, 
+     330             : // where xxxx is the charge in tenths. 
+     331    23493806 : bool isQBall( const int & pid )
+     332             : {
+     333    23493806 :     if( extraBits(pid) != 1 ) { return false; }
+     334           0 :     if( digit(n,pid) != 0 )  { return false; }
+     335           0 :     if( digit(nr,pid) != 0 )  { return false; }
+     336             :     // check the core number
+     337           0 :     if( (abspid(pid)/10)%10000 == 0 )  { return false; }
+     338             :     // these particles have spin zero for now
+     339           0 :     if( digit(nj,pid) != 0 )  { return false; }
+     340             :     return true;
+     341             : }
+     342             : 
+     343             : // does this particle contain an up quark?
+     344           0 : bool hasUp( const int & pid)
+     345             : {
+     346           0 :     if( extraBits(pid) > 0 ) { return false; }
+     347           0 :     if( fundamentalID(pid) > 0 ) { return false; }
+     348           0 :     return findQ(pid,2);
+     349             : }
+     350             : // does this particle contain a down quark?
+     351           0 : bool hasDown( const int & pid)
+     352             : {
+     353           0 :     if( extraBits(pid) > 0 ) { return false; }
+     354           0 :     if( fundamentalID(pid) > 0 ) { return false; }
+     355           0 :     return findQ(pid,1);
+     356             : }
+     357             : // does this particle contain a strange quark?
+     358           0 : bool hasStrange( const int & pid )
+     359             : {
+     360           0 :     if( extraBits(pid) > 0 ) { return false; }
+     361           0 :     if( fundamentalID(pid) > 0 ) { return false; }
+     362           0 :     return findQ(pid,3);
+     363             : }
+     364             : // does this particle contain a charm quark?
+     365           0 : bool hasCharm( const int & pid )
+     366             : {
+     367           0 :     if( extraBits(pid) > 0 ) { return false; }
+     368           0 :     if( fundamentalID(pid) > 0 ) { return false; }
+     369           0 :     return findQ(pid,4);
+     370             : }
+     371             : // does this particle contain a bottom quark?
+     372           0 : bool hasBottom( const int & pid )
+     373             : {
+     374           0 :     if( extraBits(pid) > 0 ) { return false; }
+     375           0 :     if( fundamentalID(pid) > 0 ) { return false; }
+     376           0 :     return findQ(pid,5);
+     377             : }
+     378             : // does this particle contain a top quark?
+     379           0 : bool hasTop( const int & pid )
+     380             : {
+     381           0 :     if( extraBits(pid) > 0 ) { return false; }
+     382           0 :     if( fundamentalID(pid) > 0 ) { return false; }
+     383           0 :     return findQ(pid,6);
+     384             : }
+     385             : 
+     386             : // ---  other information
+     387             : //
+     388             : // jSpin returns 2J+1, where J is the total spin
+     389           0 : int  jSpin( const int & pid )
+     390             : {
+     391           0 :     if( fundamentalID(pid) > 0 ) { 
+     392             :         // some of these are known
+     393           0 :         int fund = fundamentalID(pid);
+     394           0 :         if( fund > 0 && fund < 7 ) return 2;
+     395           0 :         if( fund == 9 ) return 3; 
+     396           0 :         if( fund > 10 && fund < 17 ) return 2;
+     397           0 :         if( fund > 20 && fund < 25 ) return 3;
+     398           0 :         return 0; 
+     399           0 :     } else if( extraBits(pid) > 0 ) { 
+     400             :         return 0; 
+     401             :     }
+     402           0 :     return abspid(pid)%10;
+     403             : }
+     404             : // sSpin returns 2S+1, where S is the spin
+     405           0 : int  sSpin( const int & pid )
+     406             : {
+     407           0 :     if( !isMeson(pid) ) { return 0; }
+     408           0 :     int inl = digit(nl,pid);
+     409             :     //int tent = digit(n,pid);
+     410           0 :     int js = digit(nj,pid);
+     411           0 :     if( digit(n,pid) == 9 ) { return 0; }       // tentative ID
+     412             :     //if( tent == 9 ) { return 0; }     // tentative assignment
+     413           0 :     if( inl == 0 && js >= 3 ) { 
+     414             :         return 1;
+     415           0 :     } else if( inl == 0  && js == 1 ) {
+     416             :         return 0;
+     417           0 :     } else if( inl == 1  && js >= 3 ) {
+     418             :         return 0;
+     419           0 :     } else if( inl == 2  && js >= 3 ) {
+     420             :         return 1;
+     421           0 :     } else if( inl == 1  && js == 1 ) {
+     422             :         return 1;
+     423           0 :     } else if( inl == 3  && js >= 3 ) {
+     424           0 :         return 1;
+     425             :     }
+     426             :     // default to zero
+     427             :     return 0;
+     428             : }
+     429             : // lSpin returns 2L+1, where L is the orbital angular momentum
+     430           0 : int  lSpin( const int & pid )
+     431             : {
+     432           0 :     if( !isMeson(pid) ) { return 0; }
+     433           0 :     int inl = digit(nl,pid);
+     434             :     //int tent = digit(n,pid);
+     435           0 :     int js = digit(nj,pid);
+     436           0 :     if( digit(n,pid) == 9 ) { return 0; }       // tentative ID
+     437           0 :     if( inl == 0 && js == 3 ) { 
+     438             :         return 0;
+     439           0 :     } else if( inl == 0 && js == 5 ) {
+     440             :         return 1;
+     441           0 :     } else if( inl == 0 && js == 7 ) {
+     442             :         return 2;
+     443           0 :     } else if( inl == 0 && js == 9 ) {
+     444             :         return 3;
+     445           0 :     } else if( inl == 0  && js == 1 ) {
+     446             :         return 0;
+     447           0 :     } else if( inl == 1  && js == 3 ) {
+     448             :         return 1;
+     449           0 :     } else if( inl == 1  && js == 5 ) {
+     450             :         return 2;
+     451           0 :     } else if( inl == 1  && js == 7 ) {
+     452             :         return 3;
+     453           0 :     } else if( inl == 1  && js == 9 ) {
+     454             :         return 4;
+     455           0 :     } else if( inl == 2  && js == 3 ) {
+     456             :         return 1;
+     457           0 :     } else if( inl == 2  && js == 5 ) {
+     458             :         return 2;
+     459           0 :     } else if( inl == 2  && js == 7 ) {
+     460             :         return 3;
+     461           0 :     } else if( inl == 2  && js == 9 ) {
+     462             :         return 4;
+     463           0 :     } else if( inl == 1  && js == 1 ) {
+     464             :         return 1;
+     465           0 :     } else if( inl == 3  && js == 3 ) {
+     466             :         return 2;
+     467           0 :     } else if( inl == 3  && js == 5 ) {
+     468             :         return 3;
+     469           0 :     } else if( inl == 3  && js == 7 ) {
+     470             :         return 4;
+     471           0 :     } else if( inl == 3  && js == 9 ) {
+     472           0 :         return 5;
+     473             :     }
+     474             :     // default to zero
+     475             :     return 0;
+     476             : }
+     477             : 
+     478             : // 3 times the charge
+     479    20168252 : int threeCharge( const int & pid )
+     480             : {
+     481             :     int charge=0;
+     482             :     int ida, sid;
+     483             :     unsigned short q1, q2, q3, ql;
+     484             :     static int ch100[] = { -1, 2,-1, 2,-1, 2,-1, 2, 0, 0,
+     485             :                        -3, 0,-3, 0,-3, 0,-3, 0, 0, 0,
+     486             :                         0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
+     487             :                         0, 0, 0, 3, 0, 0, 3, 0, 0, 0,
+     488             :                         0, -1, 0, 0, 0, 0, 0, 0, 0, 0,
+     489             :                         0, 6, 3, 6, 0, 0, 0, 0, 0, 0,
+     490             :                         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+     491             :                         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+     492             :                         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+     493             :                         0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+     494    20168252 :     q1 = digit(nq1,pid);
+     495    20168249 :     q2 = digit(nq2,pid);
+     496    20168248 :     q3 = digit(nq3,pid);
+     497    20168250 :     ql = digit(nl,pid);
+     498    20168251 :     ida = abspid(pid);
+     499    20168250 :     sid = fundamentalID(pid);
+     500    20168244 :     if( ida == 0 ) {      // illegal
+     501             :         return 0;
+     502     3325563 :     } else if( isQBall(pid) ) {         // QBall
+     503           0 :        charge = 3*((abspid(pid)/10)%10000);
+     504     3325563 :     } else if( extraBits(pid) > 0 ) {                // ion
+     505             :         return 0;
+     506     3325562 :     } else if( isDyon(pid) ) {          // Dyon
+     507           0 :         charge = 3*( (abspid(pid)/10)%1000 );
+     508             :         // this is half right
+     509             :         // the charge sign will be changed below if pid < 0
+     510           0 :         if( ql == 2 ) {
+     511           0 :             charge = -charge; 
+     512             :         }
+     513     3325562 :     } else if( sid > 0 && sid <= 100 ) {  // use table
+     514     3325562 :         charge = ch100[sid-1];
+     515     3325562 :         if(ida==1000017 || ida==1000018) { charge = 0; }
+     516     3325562 :         if(ida==1000034 || ida==1000052) { charge = 0; }
+     517     3325562 :         if(ida==1000053 || ida==1000054) { charge = 0; }
+     518     3325562 :         if(ida==5100061 || ida==5100062) { charge = 6; }
+     519           0 :     } else if( digit(nj,pid) == 0 ) {           // KL, Ks, or undefined
+     520             :         return 0;
+     521           0 :     } else if( isMeson(pid) ) {                 // mesons
+     522           0 :             if( q2 == 3 || q2 == 5 ) {
+     523           0 :                 charge = ch100[q3-1] - ch100[q2-1];
+     524             :             } else {
+     525           0 :                 charge = ch100[q2-1] - ch100[q3-1];
+     526             :             }
+     527           0 :     } else if( isRhadron(pid) ) {               // Rhadron
+     528           0 :         if (( q1 == 0 ) || ( q1 == 9 )) {
+     529           0 :             if( q2 == 3 || q2 == 5 ) {
+     530           0 :                 charge = ch100[q3-1] - ch100[q2-1];
+     531             :             } else {
+     532           0 :                 charge = ch100[q2-1] - ch100[q3-1];
+     533             :             }
+     534           0 :         } else if( ql == 0 ) {
+     535           0 :             charge = ch100[q3-1] + ch100[q2-1] + ch100[q1-1];
+     536           0 :         } else if ( digit(nr,pid) == 0 ) {
+     537           0 :             charge = ch100[q3-1] + ch100[q2-1] + ch100[q1-1] + ch100[ql-1];
+     538             :         }
+     539           0 :     } else if( isDiQuark(pid) ) {                       // diquarks
+     540           0 :         charge = ch100[q2-1] + ch100[q1-1];
+     541           0 :     } else if( isBaryon(pid) ) {                        // baryons
+     542           0 :         charge = ch100[q3-1] + ch100[q2-1] + ch100[q1-1];
+     543             :     } else {            // unknown
+     544             :         return 0;
+     545             :     }
+     546     3325562 :     if( charge == 0 ) {
+     547     3310494 :         return 0;
+     548       15068 :     } else if( pid < 0 ) {
+     549        7103 :         charge = -charge; 
+     550             :     }
+     551             :     return charge;
+     552             : }
+     553             : 
+     554             : // the actual charge
+     555    20168251 : double charge( const int & pid )
+     556             : {
+     557    20168251 :    int tc = threeCharge(pid);
+     558    20168244 :    if( isQBall(pid) ) {
+     559           0 :        return double(tc)/30.;
+     560             :    } else {
+     561    20168248 :        return double(tc)/3.;
+     562             :    }
+     563             : }
+     564             : 
+     565             : } // HepPID
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/HepPID/src/ParticleName.cc.func-sort-c.html b/doc/coverageReport/libs/HepPID/src/ParticleName.cc.func-sort-c.html new file mode 100644 index 000000000..399175d29 --- /dev/null +++ b/doc/coverageReport/libs/HepPID/src/ParticleName.cc.func-sort-c.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/HepPID/src/ParticleName.cc - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/HepPID/src - ParticleName.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:01830.0 %
Date:2024-04-08 14:58:22Functions:0130.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN6HepPID12_GLOBAL__N_116ParticleNameInitEv0
_ZN6HepPID12_GLOBAL__N_121writeParticleNameLineEiRSo0
_ZN6HepPID12_GLOBAL__N_123checkForSpecialParticleERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN6HepPID12_GLOBAL__N_18dyonNameERKi0
_ZN6HepPID12_GLOBAL__N_19qballNameERKi0
_ZN6HepPID12particleNameB5cxx11ERKi0
_ZN6HepPID12particleNameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN6HepPID15ParticleNameMapC2ESt3mapIiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4lessIiESaISt4pairIKiS7_EEES1_IS7_iS8_IS7_ESaISA_IKS7_iEEE0
_ZN6HepPID15ParticleNameMapD2Ev0
_ZN6HepPID17listParticleNamesERSo0
_ZN6HepPID17validParticleNameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN6HepPID17validParticleNameERKi0
_ZN6HepPID18getParticleNameMapEv0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/HepPID/src/ParticleName.cc.func.html b/doc/coverageReport/libs/HepPID/src/ParticleName.cc.func.html new file mode 100644 index 000000000..392fe15ed --- /dev/null +++ b/doc/coverageReport/libs/HepPID/src/ParticleName.cc.func.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/HepPID/src/ParticleName.cc - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/HepPID/src - ParticleName.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:01830.0 %
Date:2024-04-08 14:58:22Functions:0130.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN6HepPID12_GLOBAL__N_116ParticleNameInitEv0
_ZN6HepPID12_GLOBAL__N_121writeParticleNameLineEiRSo0
_ZN6HepPID12_GLOBAL__N_123checkForSpecialParticleERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN6HepPID12_GLOBAL__N_18dyonNameERKi0
_ZN6HepPID12_GLOBAL__N_19qballNameERKi0
_ZN6HepPID12particleNameB5cxx11ERKi0
_ZN6HepPID12particleNameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN6HepPID15ParticleNameMapC2ESt3mapIiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4lessIiESaISt4pairIKiS7_EEES1_IS7_iS8_IS7_ESaISA_IKS7_iEEE0
_ZN6HepPID15ParticleNameMapD2Ev0
_ZN6HepPID17listParticleNamesERSo0
_ZN6HepPID17validParticleNameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN6HepPID17validParticleNameERKi0
_ZN6HepPID18getParticleNameMapEv0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/HepPID/src/ParticleName.cc.gcov.html b/doc/coverageReport/libs/HepPID/src/ParticleName.cc.gcov.html new file mode 100644 index 000000000..c67d5715b --- /dev/null +++ b/doc/coverageReport/libs/HepPID/src/ParticleName.cc.gcov.html @@ -0,0 +1,2075 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/HepPID/src/ParticleName.cc + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/HepPID/src - ParticleName.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:01830.0 %
Date:2024-04-08 14:58:22Functions:0130.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : // ----------------------------------------------------------------------
+       2             : //
+       3             : // ParticleName.cc
+       4             : // Author: Lynn Garren and Walter Brown
+       5             : //
+       6             : //  Create a map that gives a standard name for each pre-defined 
+       7             : //  particle ID number.   Also create a map for the reverse lookup of 
+       8             : //  the ID number from a string.  These maps are initialized if and only if 
+       9             : //  the public functions are called. Because the maps are static, 
+      10             : //  the initialization happens only once.
+      11             : //
+      12             : //  The user NEVER calls ParticleNameInit()
+      13             : //  We use a data table (struct Snames) so that compile time is not impacted.
+      14             : //
+      15             : //  public functions:
+      16             : //     PartcleIdMap const &  getPartcleIdMap()
+      17             : //     std::string              ParticleName( const int pid )
+      18             : //     void                     listParticleNames( std::ostream & os  )
+      19             : //
+      20             : // ----------------------------------------------------------------------
+      21             : 
+      22             : #include <string>
+      23             : #include <map>
+      24             : #include <iostream>
+      25             : #include <sstream>
+      26             : #include <iomanip>        // width
+      27             : #include <utility>        // make_pair
+      28             : 
+      29             : #include "HepPID/ParticleName.hh"
+      30             : #include "HepPID/ParticleIDMethods.hh"
+      31             : #include "HepPID/Version.hh"
+      32             : 
+      33             : namespace HepPID {
+      34             : 
+      35             : typedef  std::map< int, std::string >  PartcleIdMap;
+      36             : typedef  std::map< std::string, int >  ParticleLookupMap;
+      37             : 
+      38             : ///
+      39             : /// \class ParticleNameMap
+      40             : /// \author Lynn Garren
+      41             : ///
+      42             : /// Used internally to store the static maps
+      43             : ///
+      44             : class ParticleNameMap{
+      45             : 
+      46             : public:
+      47             : 
+      48             :    typedef PartcleIdMap::const_iterator      idIterator;
+      49             :    typedef ParticleLookupMap::const_iterator nameIterator;
+      50             :    
+      51           0 :    ParticleNameMap(PartcleIdMap m1,ParticleLookupMap m2)
+      52           0 :    : itsNameMap(m1), itsLookupMap(m2) {}
+      53           0 :    ~ParticleNameMap() {}
+      54             :    
+      55             :    PartcleIdMap       nameMap()    const { return itsNameMap; }
+      56             :    ParticleLookupMap lookupMap()  const { return itsLookupMap; }
+      57             :    idIterator   begin()               const { return itsNameMap.begin(); }
+      58             :    idIterator   end()                 const { return itsNameMap.end(); }
+      59             :    idIterator   find( const int & id) const { return itsNameMap.find(id); }
+      60             :    nameIterator beginLookupMap()      const { return itsLookupMap.begin(); }
+      61             :    nameIterator endLookupMap()        const { return itsLookupMap.end(); }
+      62             :    nameIterator findString( const std::string & s) const { return itsLookupMap.find(s); }
+      63             : 
+      64             : private:
+      65             :    
+      66             :    PartcleIdMap       itsNameMap;
+      67             :    ParticleLookupMap itsLookupMap;
+      68             :    
+      69             :    // copies are not allowed
+      70             :    ParticleNameMap( const ParticleNameMap & );
+      71             :    ParticleNameMap & operator = ( const ParticleNameMap & );
+      72             :    
+      73             : };
+      74             : 
+      75             : namespace {     // ParticleNameInit and ParticleNameMap are private
+      76             : 
+      77           0 : ParticleNameMap const &  ParticleNameInit()
+      78             : {
+      79             : 
+      80             :   PartcleIdMap  m;
+      81             :   ParticleLookupMap nameMap;
+      82             : 
+      83             :   static const struct {
+      84             :       int pid;
+      85             :       const char* pname;
+      86             :   } SNames[] = {
+      87             :       {          0, "" },
+      88             :       {          1, "d" },
+      89             :       {         -1, "d~" },
+      90             :       {          2, "u" },
+      91             :       {         -2, "u~" },
+      92             :       {          3, "s" },
+      93             :       {         -3, "s~" },
+      94             :       {          4, "c" },
+      95             :       {         -4, "c~" },
+      96             :       {          5, "b" },
+      97             :       {         -5, "b~" },
+      98             :       {          6, "t" },
+      99             :       {         -6, "t~" },
+     100             :       {          7, "b'" },
+     101             :       {         -7, "b'~" },
+     102             :       {          8, "t'" },
+     103             :       {         -8, "t'~" },
+     104             :       {         11, "e^-" },
+     105             :       {        -11, "e^+" },
+     106             :       {         12, "nu_e" },
+     107             :       {        -12, "nu_e~" },
+     108             :       {         13, "mu^-" },
+     109             :       {        -13, "mu^+" },
+     110             :       {         14, "nu_mu" },
+     111             :       {        -14, "nu_mu~" },
+     112             :       {         15, "tau^-" },
+     113             :       {        -15, "tau^+" },
+     114             :       {         16, "nu_tau" },
+     115             :       {        -16, "nu_tau~" },
+     116             :       {         17, "tau'^-" },
+     117             :       {        -17, "tau'^+" },
+     118             :       {         18, "nu_tau'" },
+     119             :       {        -18, "nu_tau'~" },
+     120             :       {         21, "g" },
+     121             :       {         22, "gamma" },
+     122             :       {      10022, "virtual-photon" },
+     123             :       {      20022, "Cerenkov-radiation" },
+     124             :       {         23, "Z^0" },
+     125             :       {         24, "W^+" },
+     126             :       {        -24, "W^-" },
+     127             :       {         25, "H_1^0" },
+     128             :       {         32, "Z_2^0" },
+     129             :       {         33, "Z_3^0" },
+     130             :       {         34, "W_2^+" },
+     131             :       {        -34, "W_2^-" },
+     132             :       {         35, "H_2^0" },
+     133             :       {         36, "H_3^0" },
+     134             :       {         37, "H^+" },
+     135             :       {        -37, "H^-" },
+     136             :       {         39, "G"  },
+     137             :       {         41, "R^0" },
+     138             :       {        -41, "R~^0" },
+     139             :       {         42, "LQ_c" },
+     140             :       {        -42, "LQ_c~" },
+     141             :       {         43, "Xu^0" },
+     142             :       {         44, "Xu^+" },
+     143             :       {        -44, "Xu^-" },
+     144             :       {         51, "H_L^0" },
+     145             :       {         52, "H_1^++" },
+     146             :       {        -52, "H_1^--" },
+     147             :       {         53, "H_2^+" },
+     148             :       {        -53, "H_2^-" },
+     149             :       {         54, "H_2^++" },
+     150             :       {        -54, "H_2^--" },
+     151             :       {         55, "H_4^0" },
+     152             :       {        -55, "H_4~^0" },
+     153             :       {         81, "generator-specific+81" },
+     154             :       {         82, "generator-specific+82" },
+     155             :       {         83, "generator-specific+83" },
+     156             :       {         84, "generator-specific+84" },
+     157             :       {         85, "generator-specific+85" },
+     158             :       {         86, "generator-specific+86" },
+     159             :       {         87, "generator-specific+87" },
+     160             :       {         88, "generator-specific+88" },
+     161             :       {         89, "generator-specific+89" },
+     162             :       {         90, "generator-specific+90" },
+     163             :       {         91, "generator-specific+91" },
+     164             :       {         92, "generator-specific+92" },
+     165             :       {         93, "generator-specific+93" },
+     166             :       {         94, "generator-specific+94" },
+     167             :       {         95, "generator-specific+95" },
+     168             :       {         96, "generator-specific+96" },
+     169             :       {         97, "generator-specific+97" },
+     170             :       {         98, "generator-specific+98" },
+     171             :       {         99, "generator-specific+99" },
+     172             :       {        -81, "generator-specific-81" },
+     173             :       {        -82, "generator-specific-82" },
+     174             :       {        -83, "generator-specific-83" },
+     175             :       {        -84, "generator-specific-84" },
+     176             :       {        -85, "generator-specific-85" },
+     177             :       {        -86, "generator-specific-86" },
+     178             :       {        -87, "generator-specific-87" },
+     179             :       {        -88, "generator-specific-88" },
+     180             :       {        -89, "generator-specific-89" },
+     181             :       {        -90, "generator-specific-90" },
+     182             :       {        -91, "generator-specific-91" },
+     183             :       {        -92, "generator-specific-92" },
+     184             :       {        -93, "generator-specific-93" },
+     185             :       {        -94, "generator-specific-94" },
+     186             :       {        -95, "generator-specific-95" },
+     187             :       {        -96, "generator-specific-96" },
+     188             :       {        -97, "generator-specific-97" },
+     189             :       {        -98, "generator-specific-98" },
+     190             :       {        -99, "generator-specific-99" },
+     191             :       {        100, "generator-specific+100" },
+     192             :       {       -100, "generator-specific-100" },
+     193             :       {        101, "geantino" },
+     194             :       {        102, "charged-geantino" },
+     195             :       {        110, "reggeon" },
+     196             :       {        130, "K_L^0" },
+     197             :       {        310, "K_S^0" },
+     198             :       {        990, "pomeron" },
+     199             :       {       9990, "odderon" },
+     200             :       {    1000001, "susy-d_L" },
+     201             :       {   -1000001, "susy-d_L~" },
+     202             :       {    1000002, "susy-u_L" },
+     203             :       {   -1000002, "susy-u_L~" },
+     204             :       {    1000003, "susy-s_L" },
+     205             :       {   -1000003, "susy-s_L~" },
+     206             :       {    1000004, "susy-c_L" },
+     207             :       {   -1000004, "susy-c_L~" },
+     208             :       {    1000005, "susy-b_1" },
+     209             :       {   -1000005, "susy-b_1~" },
+     210             :       {    1000006, "susy-t_1" },
+     211             :       {   -1000006, "susy-t_1~" },
+     212             :       {    1000011, "susy-e_L^-" },
+     213             :       {   -1000011, "susy-e_L^+" },
+     214             :       {    1000012, "susy-nu_eL" },
+     215             :       {   -1000012, "susy-nu_eL~" },
+     216             :       {    1000013, "susy-mu_L^-" },
+     217             :       {   -1000013, "susy-mu_L^+" },
+     218             :       {    1000014, "susy-nu_muL" },
+     219             :       {   -1000014, "susy-nu_muL~" },
+     220             :       {    1000015, "susy-tau_L^-" },
+     221             :       {   -1000015, "susy-tau_L^+" },
+     222             :       {    1000016, "susy-nu_tauL" },
+     223             :       {   -1000016, "susy-nu_tauL~" },
+     224             :       {    1000021, "gluino" },
+     225             :       {    1000022, "susy-chi_1^0" },
+     226             :       {    1000023, "susy-chi_2^0" },
+     227             :       {    1000024, "susy-chi_1^+" },
+     228             :       {   -1000024, "susy-chi_1^-" },
+     229             :       {    1000025, "susy-chi_3^0" },
+     230             :       {    1000035, "susy-chi_4^0" },
+     231             :       {    1000037, "susy-chi_2^+" },
+     232             :       {   -1000037, "susy-chi_2^-" },
+     233             :       {    1000039, "gravitino" },
+     234             :       {    2000001, "susy-d_R" },
+     235             :       {   -2000001, "susy-d_R~" },
+     236             :       {    2000002, "susy-u_R" },
+     237             :       {   -2000002, "susy-u_R~" },
+     238             :       {    2000003, "susy-s_R" },
+     239             :       {   -2000003, "susy-s_R~" },
+     240             :       {    2000004, "susy-c_R" },
+     241             :       {   -2000004, "susy-c_R~" },
+     242             :       {    2000005, "susy-b_R" },
+     243             :       {   -2000005, "susy-b_R~" },
+     244             :       {    2000006, "susy-t_R" },
+     245             :       {   -2000006, "susy-t_R~" },
+     246             :       {    2000011, "susy-e_R^-" },
+     247             :       {   -2000011, "susy-e_R^+" },
+     248             :       {    2000012, "susy-nu_eR" },
+     249             :       {   -2000012, "susy-nu_eR~" },
+     250             :       {    2000013, "susy-mu_R^-" },
+     251             :       {   -2000013, "susy-mu_R^+" },
+     252             :       {    2000014, "susy-nu_muR" },
+     253             :       {   -2000014, "susy-nu_muR~" },
+     254             :       {    2000015, "susy-tau_R^-" },
+     255             :       {   -2000015, "susy-tau_R^+" },
+     256             :       {    2000016, "susy-nu_tauR" },
+     257             :       {   -2000016, "susy-nu_tauR~" },
+     258             :       {    3100021, "V8_tech" },
+     259             :       {   -3100021, "V8_tech~" },
+     260             :       {    3000111, "pi_tech^0" },
+     261             :       {    3000115, "a_tech^0" },
+     262             :       {    3060111, "pi_tech_22_1" },
+     263             :       {    3160111, "pi_tech_22_8" },
+     264             :       {    3000113, "rho_tech^0" },
+     265             :       {    3130113, "rho_tech_11" },
+     266             :       {    3140113, "rho_tech_12" },
+     267             :       {    3150113, "rho_tech_21" },
+     268             :       {    3160113, "rho_tech_22" },
+     269             :       {    3000211, "pi_tech^+" },
+     270             :       {   -3000211, "pi_tech^-" },
+     271             :       {    3000213, "rho_tech^+" },
+     272             :       {   -3000213, "rho_tech^-" },
+     273             :       {    3000215, "a_tech^+" },
+     274             :       {   -3000215, "a_tech^-" },
+     275             :       {    3000221, "pi'_tech" },
+     276             :       {    3100221, "eta_tech" },
+     277             :       {    3000223, "omega_tech" },
+     278             :       {    4000001, "d*" },
+     279             :       {   -4000001, "d*~" },
+     280             :       {    4000002, "u*" },
+     281             :       {   -4000002, "u*~" },
+     282             :       {    4000011, "e*^-" },
+     283             :       {   -4000011, "e*^+" },
+     284             :       {    4000012, "nu*_e" },
+     285             :       {   -4000012, "nu*_e~" },
+     286             :       {    4000039, "G*" },
+     287             :       {   -4000039, "G*~" },
+     288             :       {    5000040, "black_hole" },
+     289             :       {    5100001, "d_L^(1)" },
+     290             :       {   -5100001, "d~_L^(1)" },
+     291             :       {    5100002, "u_L^(1)" },
+     292             :       {   -5100002, "u~_L^(1)" },
+     293             :       {    5100003, "s_L^(1)" },
+     294             :       {   -5100003, "s~_L^(1)" },
+     295             :       {    5100004, "c_L^(1)" },
+     296             :       {   -5100004, "c~_L^(1)" },
+     297             :       {    5100005, "b_L^(1)" },
+     298             :       {   -5100005, "b~_L^(1)" },
+     299             :       {    5100006, "t_L^(1)" },
+     300             :       {   -5100006, "t~_L^(1)" },
+     301             :       {    5100011, "e_L^(1)-" },
+     302             :       {   -5100011, "e_L^(1)+" },
+     303             :       {    5100012, "nu_eL^(1)" },
+     304             :       {   -5100012, "nu_eL~^(1)" },
+     305             :       {    5100013, "mu_L^(1)-" },
+     306             :       {   -5100013, "mu_L^(1)+" },
+     307             :       {    5100014, "nu_muL^(1)" },
+     308             :       {   -5100014, "nu_muL~^(1)" },
+     309             :       {    5100015, "tau_L^(1)-" },
+     310             :       {   -5100015, "tau_L^(1)+" },
+     311             :       {    5100016, "nu_tauL^(1)" },
+     312             :       {   -5100016, "nu_tauL~^(1)" },
+     313             :       {    6100001, "d_R^(1)" },
+     314             :       {   -6100001, "d~_R^(1)" },
+     315             :       {    6100002, "u_R^(1)" },
+     316             :       {   -6100002, "u~_R^(1)" },
+     317             :       {    6100003, "s_R^(1)" },
+     318             :       {   -6100003, "s~_R^(1)" },
+     319             :       {    6100004, "c_R^(1)" },
+     320             :       {   -6100004, "c~_R^(1)" },
+     321             :       {    6100005, "b_R^(1)" },
+     322             :       {   -6100005, "b~_R^(1)" },
+     323             :       {    6100006, "t_R^(1)" },
+     324             :       {   -6100006, "t~_R^(1)" },
+     325             :       {    6100011, "e_R^(1)-" },
+     326             :       {   -6100011, "e_R^(1)+" },
+     327             :       {    6100012, "nu_eR^(1)" },
+     328             :       {   -6100012, "nu_eR~^(1)" },
+     329             :       {    6100013, "mu_R^(1)-" },
+     330             :       {   -6100013, "mu_R^(1)+" },
+     331             :       {    6100014, "nu_muR^(1)" },
+     332             :       {   -6100014, "nu_muR~^(1)" },
+     333             :       {    6100015, "tau_R^(1)-" },
+     334             :       {   -6100015, "tau_R^(1)+" },
+     335             :       {    6100016, "nu_tauR^(1)" },
+     336             :       {   -6100016, "nu_tauR~^(1)" },
+     337             :       {    5100021, "g^(1)" },
+     338             :       {    5100022, "gamma^(1)" },
+     339             :       {    5100023, "Z^(1)0" },
+     340             :       {    5100024, "W^(1)+" },
+     341             :       {   -5100024, "W^(1)-" },
+     342             :       {    5100025, "h^(1)0" },
+     343             :       {    5100039, "G^(1)" },
+     344             :       {    9900012, "nu_Re" },
+     345             :       {   -9900012, "nu_Re~" },
+     346             :       {    9900014, "nu_Rmu" },
+     347             :       {   -9900014, "nu_Rmu~" },
+     348             :       {    9900016, "nu_Rtau" },
+     349             :       {   -9900016, "nu_Rtau~" },
+     350             :       {    9900023, "Z_R^0" },
+     351             :       {   -9900023, "Z_R~^0" },
+     352             :       {    9900024, "W_R^+" },
+     353             :       {   -9900024, "W_R^-" },
+     354             :       {    9900041, "H_L^++" },
+     355             :       {   -9900041, "H_L^--" },
+     356             :       {    9900042, "H_R^++" },
+     357             :       {   -9900042, "H_R^--" },
+     358             :       {    9910113, "rho_diffr^0" },
+     359             :       {    9910211, "pi_diffr^+" },
+     360             :       {   -9910211, "pi_diffr^-" },
+     361             :       {    9910223, "omega_diffr" },
+     362             :       {    9910333, "phi_diffr" },
+     363             :       {    9910443, "psi_diffr" },
+     364             :       {    9912112, "n_diffr^0" },
+     365             :       {   -9912112, "n_diffr~^0" },
+     366             :       {    9912212, "p_diffr^+" },
+     367             :       {   -9912212, "p_diffr~^-" },
+     368             :       {    9920022, "remnant photon" },
+     369             :       {    9922212, "remnant nucleon" },
+     370             :       {   -9922212, "remnant nucleon~" },
+     371             :       {    9900441, "cc~[1S08]" },     
+     372             :       {    9910441, "cc~[3P08]" },     
+     373             :       {    9900443, "cc~[3S18]" },     
+     374             :       {    9900551, "bb~[1S08]" },     
+     375             :       {    9910551, "bb~[3P08]" },     
+     376             :       {    9900553, "bb~[3S18]" },    
+     377             :       {       1103, "dd_1" },
+     378             :       {      -1103, "dd_1~" },
+     379             :       {       2101, "ud_0" },
+     380             :       {      -2101, "ud_0~" },
+     381             :       {       2103, "ud_1" },
+     382             :       {      -2103, "ud_1~" },
+     383             :       {       2203, "uu_1" },
+     384             :       {      -2203, "uu_1~" },
+     385             :       {       3101, "sd_0" },
+     386             :       {      -3101, "sd_0~" },
+     387             :       {       3103, "sd_1" },
+     388             :       {      -3103, "sd_1~" },
+     389             :       {       3201, "su_0" },
+     390             :       {      -3201, "su_0~" },
+     391             :       {       3203, "su_1" },
+     392             :       {      -3203, "su_1~" },
+     393             :       {       3303, "ss_1" },
+     394             :       {      -3303, "ss_1~" },
+     395             :       {       4101, "cd_0" },
+     396             :       {      -4101, "cd_0~" },
+     397             :       {       4103, "cd_1" },
+     398             :       {      -4103, "cd_1~" },
+     399             :       {       4201, "cu_0" },
+     400             :       {      -4201, "cu_0~" },
+     401             :       {       4203, "cu_1" },
+     402             :       {      -4203, "cu_1~" },
+     403             :       {       4301, "cs_0" },
+     404             :       {      -4301, "cs_0~" },
+     405             :       {       4303, "cs_1" },
+     406             :       {      -4303, "cs_1~" },
+     407             :       {       4403, "cc_1" },
+     408             :       {      -4403, "cc_1~" },
+     409             :       {       5101, "bd_0" },
+     410             :       {      -5101, "bd_0~" },
+     411             :       {       5103, "bd_1" },
+     412             :       {      -5103, "bd_1~" },
+     413             :       {       5201, "bu_0" },
+     414             :       {      -5201, "bu_0~" },
+     415             :       {       5203, "bu_1" },
+     416             :       {      -5203, "bu_1~" },
+     417             :       {       5301, "bs_0" },
+     418             :       {      -5301, "bs_0~" },
+     419             :       {       5303, "bs_1" },
+     420             :       {      -5303, "bs_1~" },
+     421             :       {       5401, "bc_0" },
+     422             :       {      -5401, "bc_0~" },
+     423             :       {       5403, "bc_1" },
+     424             :       {      -5403, "bc_1~" },
+     425             :       {       5503, "bb_1" },
+     426             :       {      -5503, "bb_1~" },
+     427             :       {       6101, "td_0" },
+     428             :       {      -6101, "td_0~" },
+     429             :       {       6103, "td_1" },
+     430             :       {      -6103, "td_1~" },
+     431             :       {       6201, "tu_0" },
+     432             :       {      -6201, "tu_0~" },
+     433             :       {       6203, "tu_1" },
+     434             :       {      -6203, "tu_1~" },
+     435             :       {       6301, "ts_0" },
+     436             :       {      -6301, "ts_0~" },
+     437             :       {       6303, "ts_1" },
+     438             :       {      -6303, "ts_1~" },
+     439             :       {       6401, "tc_0" },
+     440             :       {      -6401, "tc_0~" },
+     441             :       {       6403, "tc_1" },
+     442             :       {      -6403, "tc_1~" },
+     443             :       {       6501, "tb_0" },
+     444             :       {      -6501, "tb_0~" },
+     445             :       {       6503, "tb_1" },
+     446             :       {      -6503, "tb_1~" },
+     447             :       {       6603, "tt_1" },
+     448             :       {      -6603, "tt_1~" },
+     449             :       {       7101, "b'd_0" },
+     450             :       {      -7101, "b'd_0~" },
+     451             :       {       7103, "b'd_1" },
+     452             :       {      -7103, "b'd_1~" },
+     453             :       {       7201, "b'u_0" },
+     454             :       {      -7201, "b'u_0~" },
+     455             :       {       7203, "b'u_1" },
+     456             :       {      -7203, "b'u_1~" },
+     457             :       {       7301, "b's_0" },
+     458             :       {      -7301, "b's_0~" },
+     459             :       {       7303, "b's_1" },
+     460             :       {      -7303, "b's_1~" },
+     461             :       {       7401, "b'c_0" },
+     462             :       {      -7401, "b'c_0~" },
+     463             :       {       7403, "b'c_1" },
+     464             :       {      -7403, "b'c_1~" },
+     465             :       {       7501, "b'b_0" },
+     466             :       {      -7501, "b'b_0~" },
+     467             :       {       7503, "b'b_1" },
+     468             :       {      -7503, "b'b_1~" },
+     469             :       {       7601, "b't_0" },
+     470             :       {      -7601, "b't_0~" },
+     471             :       {       7603, "b't_1" },
+     472             :       {      -7603, "b't_1~" },
+     473             :       {       7703, "b'b'_1" },
+     474             :       {      -7703, "b'b'_1~" },
+     475             :       {       8101, "t'd_0" },
+     476             :       {      -8101, "t'd_0~" },
+     477             :       {       8103, "t'd_1" },
+     478             :       {      -8103, "t'd_1~" },
+     479             :       {       8201, "t'u_0" },
+     480             :       {      -8201, "t'u_0~" },
+     481             :       {       8203, "t'u_1" },
+     482             :       {      -8203, "t'u_1~" },
+     483             :       {       8301, "t's_0" },
+     484             :       {      -8301, "t's_0~" },
+     485             :       {       8303, "t's_1" },
+     486             :       {      -8303, "t's_1~" },
+     487             :       {       8401, "t'c_0" },
+     488             :       {      -8401, "t'c_0~" },
+     489             :       {       8403, "t'c_1" },
+     490             :       {      -8403, "t'c_1~" },
+     491             :       {       8501, "t'b_0" },
+     492             :       {      -8501, "t'b_0~" },
+     493             :       {       8503, "t'b_1" },
+     494             :       {      -8503, "t'b_1~" },
+     495             :       {       8601, "t't_0" },
+     496             :       {      -8601, "t't_0~" },
+     497             :       {       8603, "t't_1" },
+     498             :       {      -8603, "t't_1~" },
+     499             :       {       8701, "t'b'_0" },
+     500             :       {      -8701, "t'b'_0~" },
+     501             :       {       8703, "t'b'_1" },
+     502             :       {      -8703, "t'b'_1~" },
+     503             :       {       8803, "t't'_1" },
+     504             :       {      -8803, "t't'_1~" },
+     505             :       {        111, "pi^0" },
+     506             :       {    9000111, "a_0(980)^0" },
+     507             :       {      10111, "a_0(1450)^0" },
+     508             :       {     100111, "pi(1300)^0" },
+     509             :       {    9010111, "pi(1800)^0" },
+     510             :       {        113, "rho(770)^0" },
+     511             :       {      10113, "b_1(1235)^0" },
+     512             :       {      20113, "a_1(1260)^0" },
+     513             :       {    9000113, "pi_1(1400)^0" },
+     514             :       {     100113, "rho(1450)^0" },
+     515             :       {    9010113, "pi_1(1600)^0" },
+     516             :       {    9020113, "a_1(1640)^0" },
+     517             :       {      30113, "rho(1700)^0" },
+     518             :       {    9030113, "rho(1900)^0" },
+     519             :       {    9040113, "rho(2150)^0" },
+     520             :       {        115, "a_2(1320)^0" },
+     521             :       {      10115, "pi_2(1670)^0" },
+     522             :       {    9000115, "a_2(1700)^0" },
+     523             :       {    9010115, "pi_2(2100)^0" },
+     524             :       {        117, "rho_3(1690)^0" },
+     525             :       {    9000117, "rho_3(1990)^0" },
+     526             :       {    9010117, "rho_3(2250)^0" },
+     527             :       {        119, "a_4(2040)^0" },
+     528             :       {        211, "pi^+" },
+     529             :       {       -211, "pi^-" },
+     530             :       {    9000211, "a_0(980)^+" },
+     531             :       {   -9000211, "a_0(980)^-" },
+     532             :       {      10211, "a_0(1450)^+" },
+     533             :       {     -10211, "a_0(1450)^-" },
+     534             :       {     100211, "pi(1300)^+" },
+     535             :       {    -100211, "pi(1300)^-" },
+     536             :       {    9010211, "pi(1800)^+" },
+     537             :       {   -9010211, "pi(1800)^-" },
+     538             :       {        213, "rho(770)^+" },
+     539             :       {       -213, "rho(770)^-" },
+     540             :       {      10213, "b_1(1235)^+" },
+     541             :       {     -10213, "b_1(1235)^-" },
+     542             :       {      20213, "a_1(1260)^+" },
+     543             :       {     -20213, "a_1(1260)^-" },
+     544             :       {    9000213, "pi_1(1400)^+" },
+     545             :       {   -9000213, "pi_1(1400)^-" },
+     546             :       {     100213, "rho(1450)^+" },
+     547             :       {    -100213, "rho(1450)^-" },
+     548             :       {    9010213, "pi_1(1600)^+" },
+     549             :       {   -9010213, "pi_1(1600)^-" },
+     550             :       {    9020213, "a_1(1640)^+" },
+     551             :       {   -9020213, "a_1(1640)^-" },
+     552             :       {      30213, "rho(1700)^+" },
+     553             :       {     -30213, "rho(1700)^-" },
+     554             :       {    9030213, "rho(1900)^+" },
+     555             :       {   -9030213, "rho(1900)^-" },
+     556             :       {    9040213, "rho(2150)^+" },
+     557             :       {   -9040213, "rho(2150)^-" },
+     558             :       {        215, "a_2(1320)^+" },
+     559             :       {       -215, "a_2(1320)^-" },
+     560             :       {      10215, "pi_2(1670)^+" },
+     561             :       {     -10215, "pi_2(1670)^-" },
+     562             :       {    9000215, "a_2(1700)^+" },
+     563             :       {   -9000215, "a_2(1700)^-" },
+     564             :       {    9010215, "pi_2(2100)^+" },
+     565             :       {   -9010215, "pi_2(2100)^-" },
+     566             :       {        217, "rho_3(1690)^+" },
+     567             :       {       -217, "rho_3(1690)^-" },
+     568             :       {    9000217, "rho_3(1990)^+" },
+     569             :       {   -9000217, "rho_3(1990)^-" },
+     570             :       {    9010217, "rho_3(2250)^+" },
+     571             :       {   -9010217, "rho_3(2250)^-" },
+     572             :       {        219, "a_4(2040)^+" },
+     573             :       {       -219, "a_4(2040)^-" },
+     574             :       {        221, "eta" },
+     575             :       {    9000221, "f_0(600)" },
+     576             :       {      10221, "f_0(1370)" },
+     577             :       {    9010221, "f_0(980)" },
+     578             :       {    9020221, "eta(1405)" },
+     579             :       {    9030221, "f_0(1500)" },
+     580             :       {    9040221, "eta(1760)" },
+     581             :       {    9050221, "f_0(2020)" },
+     582             :       {    9060221, "f_0(2100)" },
+     583             :       {    9070221, "f_0(2200)" },
+     584             :       {    9080221, "eta(2225)" },
+     585             :       {    9090221, "sigma_0" },
+     586             :       {     100221, "eta(1295)" },
+     587             :       {        331, "eta'(958)" },
+     588             :       {      10331, "f_0(1710)" },
+     589             :       {     100331, "eta(1475)" },
+     590             :       {        223, "omega(782)" },
+     591             :       {    9000223, "f_1(1510)" },
+     592             :       {    9010223, "h_1(1595)" },
+     593             :       {      10223, "h_1(1170)" },
+     594             :       {      20223, "f_1(1285)" },
+     595             :       {      30223, "omega(1650)" },
+     596             :       {     100223, "omega(1420)" },
+     597             :       {        333, "phi(1020)" },
+     598             :       {      10333, "h_1(1380)" },
+     599             :       {      20333, "f_1(1420)" },
+     600             :       {     100333, "phi(1680)" },
+     601             :       {        225, "f_2(1270)" },
+     602             :       {    9000225, "f_2(1430)" },
+     603             :       {      10225, "eta_2(1645)" },
+     604             :       {    9010225, "f_2(1565)" },
+     605             :       {    9020225, "f_2(1640)" },
+     606             :       {    9030225, "f_2(1810)" },
+     607             :       {    9040225, "f_2(1910)" },
+     608             :       {    9050225, "f_2(1950)" },
+     609             :       {    9060225, "f_2(2010)" },
+     610             :       {    9070225, "f_2(2150)" },
+     611             :       {    9080225, "f_2(2300)" },
+     612             :       {    9090225, "f_2(2340)" },
+     613             :       {        335, "f'_2(1525)" },
+     614             :       {      10335, "eta_2(1870)" },
+     615             :       {        227, "omega_3(1670)" },
+     616             :       {        337, "phi_3(1850)" },
+     617             :       {        229, "f_4(2050)" },
+     618             :       {    9000229, "f_J(2220)" },
+     619             :       {    9010229, "f_4(2300)" },
+     620             :       {        311, "K^0" },
+     621             :       {       -311, "K~^0" },
+     622             :       {    9000311, "K*_0(800)^0" },
+     623             :       {   -9000311, "K*_0(800)~^0" },
+     624             :       {      10311, "K*_0(1430)^0" },
+     625             :       {     -10311, "K*_0(1430)~^0" },
+     626             :       {     100311, "K(1460)^0" },
+     627             :       {    -100311, "K(1460)~^0" },
+     628             :       {    9010311, "K(1830)^0" },
+     629             :       {   -9010311, "K(1830)~^0" },
+     630             :       {    9020311, "K*_0(1950)^0" },
+     631             :       {   -9020311, "K*_0(1950)~^0" },
+     632             :       {        321, "K^+" },
+     633             :       {       -321, "K^-" },
+     634             :       {    9000321, "K*_0(800)^+" },
+     635             :       {   -9000321, "K*_0(800)^-" },
+     636             :       {      10321, "K*_0(1430)^+" },
+     637             :       {     -10321, "K*_0(1430)^-" },
+     638             :       {     100321, "K(1460)^+" },
+     639             :       {    -100321, "K(1460)^-" },
+     640             :       {    9010321, "K(1830)^+" },
+     641             :       {   -9010321, "K(1830)^-" },
+     642             :       {    9020321, "K*_0(1950)^+" },
+     643             :       {   -9020321, "K*_0(1950)^-" },
+     644             :       {        313, "K*(892)^0" },
+     645             :       {       -313, "K*(892)~^0" },
+     646             :       {      10313, "K_1(1270)^0" },
+     647             :       {     -10313, "K_1(1270)~^0" },
+     648             :       {      20313, "K_1(1400)^0" },
+     649             :       {     -20313, "K_1(1400)~^0" },
+     650             :       {      30313, "K*(1680)^0" },
+     651             :       {     -30313, "K*(1680)~^0" },
+     652             :       {     100313, "K*(1410)^0" },
+     653             :       {    -100313, "K*(1410)~^0" },
+     654             :       {    9000313, "K_1(1650)^0" },
+     655             :       {   -9000313, "K_1(1650)~^0" },
+     656             :       {        323, "K*(892)^+" },
+     657             :       {       -323, "K*(892)^-" },
+     658             :       {      10323, "K_1(1270)^+" },
+     659             :       {     -10323, "K_1(1270)^-" },
+     660             :       {      20323, "K_1(1400)^+" },
+     661             :       {     -20323, "K_1(1400)^-" },
+     662             :       {      30323, "K*(1680)^+" },
+     663             :       {     -30323, "K*(1680)^-" },
+     664             :       {     100323, "K*(1410)^+" },
+     665             :       {    -100323, "K*(1410)^-" },
+     666             :       {    9000323, "K_1(1650)^+" },
+     667             :       {   -9000323, "K_1(1650)^-" },
+     668             :       {        315, "K*_2(1430)^0" },
+     669             :       {       -315, "K*_2(1430)~^0" },
+     670             :       {    9000315, "K_2(1580)^0" },
+     671             :       {   -9000315, "K_2(1580)~^0" },
+     672             :       {      10315, "K_2(1770)^0" },
+     673             :       {     -10315, "K_2(1770)~^0" },
+     674             :       {    9010315, "K*_2(1980)^0" },
+     675             :       {   -9010315, "K*_2(1980)~^0" },
+     676             :       {    9020315, "K_2(2250)^0" },
+     677             :       {   -9020315, "K_2(2250)~^0" },
+     678             :       {      20315, "K_2(1820)^0" },
+     679             :       {     -20315, "K_2(1820)~^0" },
+     680             :       {        325, "K*_2(1430)^+" },
+     681             :       {       -325, "K*_2(1430)^-" },
+     682             :       {    9000325, "K_2(1580)^+" },
+     683             :       {   -9000325, "K_2(1580)^-" },
+     684             :       {      10325, "K_2(1770)^+" },
+     685             :       {     -10325, "K_2(1770)^-" },
+     686             :       {    9010325, "K*_2(1980)^+" },
+     687             :       {   -9010325, "K*_2(1980)^-" },
+     688             :       {    9020325, "K_2(2250)^+" },
+     689             :       {   -9020325, "K_2(2250)^-" },
+     690             :       {      20325, "K_2(1820)^+" },
+     691             :       {     -20325, "K_2(1820)^-" },
+     692             :       {     100325, "K_2(1980)^+" },
+     693             :       {    -100325, "K_2(1980)^-" },
+     694             :       {        317, "K*_3(1780)^0" },
+     695             :       {       -317, "K*_3(1780)~^0" },
+     696             :       {    9010317, "K_3(2320)^0" },
+     697             :       {   -9010317, "K_3(2320)~^0" },
+     698             :       {        327, "K*_3(1780)^+" },
+     699             :       {       -327, "K*_3(1780)^-" },
+     700             :       {    9010327, "K_3(2320)^+" },
+     701             :       {   -9010327, "K_3(2320)^-" },
+     702             :       {        319, "K*_4(2045)^0" },
+     703             :       {       -319, "K*_4(2045)~^0" },
+     704             :       {    9000319, "K_4(2500)^0" },
+     705             :       {   -9000319, "K_4(2500)~^0" },
+     706             :       {        329, "K*_4(2045)^+" },
+     707             :       {       -329, "K*_4(2045)^-" },
+     708             :       {    9000329, "K_4(2500)^+" },
+     709             :       {   -9000329, "K_4(2500)^-" },
+     710             :       {        411, "D^+" },
+     711             :       {       -411, "D^-" },
+     712             :       {      10411, "D*_0(2400)^+" },
+     713             :       {     -10411, "D*_0(2400)^-" },
+     714             :       {     100411, "D(2S)^+" },
+     715             :       {    -100411, "D(2S)^-" },
+     716             :       {        413, "D*(2010)^+" },
+     717             :       {       -413, "D*(2010)^-" },
+     718             :       {      10413, "D_1(2420)^+" },
+     719             :       {     -10413, "D_1(2420)^-" },
+     720             :       {      20413, "D_1(H)^+" },
+     721             :       {     -20413, "D_1(H)^-" },
+     722             :       {     100413, "D*(2S)^+" },
+     723             :       {    -100413, "D*(2S)^-" },
+     724             :       {        415, "D*_2(2460)^+" },
+     725             :       {       -415, "D*_2(2460)^-" },
+     726             :       {        421, "D^0" },
+     727             :       {       -421, "D~^0" },
+     728             :       {      10421, "D*_0(2400)^0" },
+     729             :       {     -10421, "D*_0(2400)~^0" },
+     730             :       {     100421, "D(2S)^0" },
+     731             :       {    -100421, "D(2S)~^0" },
+     732             :       {        423, "D*(2007)^0" },
+     733             :       {       -423, "D*(2007)~^0" },
+     734             :       {      10423, "D_1(2420)^0" },
+     735             :       {     -10423, "D_1(2420)~^0" },
+     736             :       {      20423, "D_1(2430)^0" },
+     737             :       {     -20423, "D_1(2430)~^0" },
+     738             :       {     100423, "D*(2S)^0" },
+     739             :       {    -100423, "D*(2S)~^0" },
+     740             :       {        425, "D*_2(2460)^0" },
+     741             :       {       -425, "D*_2(2460)~^0" },
+     742             :       {        431, "D_s^+" },
+     743             :       {       -431, "D_s^-" },
+     744             :       {      10431, "D*_s0(2317)^+" },
+     745             :       {     -10431, "D*_s0(2317)^-" },
+     746             :       {        433, "D*_s^+" },
+     747             :       {       -433, "D*_s^-" },
+     748             :       {      10433, "D_s1(2536)^+" },
+     749             :       {     -10433, "D_s1(2536)^-" },
+     750             :       {      20433, "D_s1(2460)^+" },
+     751             :       {     -20433, "D_s1(2460)^-" },
+     752             :       {        435, "D*_s2(2573)^+" },
+     753             :       {       -435, "D*_s2(2573)^-" },
+     754             :       {        441, "eta_c(1S)" },
+     755             :       {      10441, "chi_c0(1P)" },
+     756             :       {     100441, "eta_c(2S)" },
+     757             :       {        443, "J/psi(1S)" },
+     758             :       {    9000443, "psi(4040)" },
+     759             :       {      10443, "hc(1P)" },
+     760             :       {    9010443, "psi(4160)" },
+     761             :       {      20443, "chi_c1(1P)" },
+     762             :       {    9020443, "psi(4415)" },
+     763             :       {      30443, "psi(3770)" },
+     764             :       {     100443, "psi(2S)" },
+     765             :       {        445, "chi_c2(1P)" },
+     766             :       {     100445, "chi_c2(2P)" },
+     767             :       {        511, "B^0" },
+     768             :       {       -511, "B~^0" },
+     769             :       {      10511, "B*_0^0" },
+     770             :       {     -10511, "B*_0~^0" },
+     771             :       {        513, "B*^0" },
+     772             :       {       -513, "B*~^0" },
+     773             :       {      10513, "B_1(L)^0" },
+     774             :       {     -10513, "B_1(L)~^0" },
+     775             :       {      20513, "B_1(H)^0" },
+     776             :       {     -20513, "B_1(H)~^0" },
+     777             :       {        515, "B*_2^0" },
+     778             :       {       -515, "B*_2~^0" },
+     779             :       {        521, "B^+" },
+     780             :       {       -521, "B^-" },
+     781             :       {      10521, "B*_0^+" },
+     782             :       {     -10521, "B*_0^-" },
+     783             :       {        523, "B*^+" },
+     784             :       {       -523, "B*^-" },
+     785             :       {      10523, "B_1(L)^+" },
+     786             :       {     -10523, "B_1(L)^-" },
+     787             :       {      20523, "B_1(H)^+" },
+     788             :       {     -20523, "B_1(H)^-" },
+     789             :       {        525, "B*_2^+" },
+     790             :       {       -525, "B*_2^-" },
+     791             :       {        531, "B_s^0" },
+     792             :       {       -531, "B_s~^0" },
+     793             :       {      10531, "B*_s0^0" },
+     794             :       {     -10531, "B*_s0~^0" },
+     795             :       {        533, "B*_s^0" },
+     796             :       {       -533, "B*_s~^0" },
+     797             :       {      10533, "B_s1(L)^0" },
+     798             :       {     -10533, "B_s1(L)~^0" },
+     799             :       {      20533, "B_s1(H)^0" },
+     800             :       {     -20533, "B_s1(H)~^0" },
+     801             :       {        535, "B*_s2^0" },
+     802             :       {       -535, "B*_s2~^0" },
+     803             :       {        541, "B_c^+" },
+     804             :       {       -541, "B_c^-" },
+     805             :       {      10541, "B*_c0^+" },
+     806             :       {     -10541, "B*_c0^-" },
+     807             :       {        543, "B*_c^+" },
+     808             :       {       -543, "B*_c^-" },
+     809             :       {      10543, "B_c1(L)^+" },
+     810             :       {     -10543, "B_c1(L)^-" },
+     811             :       {      20543, "B_c1(H)^+" },
+     812             :       {     -20543, "B_c1(H)^-" },
+     813             :       {        545, "B*_c2^+" },
+     814             :       {       -545, "B*_c2^-" },
+     815             :       {        551, "eta_b(1S)" },
+     816             :       {      10551, "chi_b0(1P)" },
+     817             :       {     100551, "eta_b(2S)" },
+     818             :       {     110551, "chi_b0(2P)" },
+     819             :       {     200551, "eta_b(3S)" },
+     820             :       {     210551, "chi_b0(3P)" },
+     821             :       {        553, "Upsilon(1S)" },
+     822             :       {    9000553, "Upsilon(10860)" },
+     823             :       {      10553, "h_b(1P)" },
+     824             :       {    9010553, "Upsilon(11020)" },
+     825             :       {      20553, "chi_b1(1P)" },
+     826             :       {    9020553, "Upsilon(7S)" },
+     827             :       {      30553, "Upsilon_1(1D)" },
+     828             :       {     100553, "Upsilon(2S)" },
+     829             :       {     110553, "h_b(2P)" },
+     830             :       {     120553, "chi_b1(2P)" },
+     831             :       {     130553, "Upsilon_1(2D)" },
+     832             :       {     200553, "Upsilon(3S)" },
+     833             :       {     210553, "h_b(3P)" },
+     834             :       {     220553, "chi_b1(3P)" },
+     835             :       {     300553, "Upsilon(4S)" },
+     836             :       {        555, "chi_b2(1P)" },
+     837             :       {      10555, "eta_b2(1D)" },
+     838             :       {      20555, "Upsilon_2(1D)" },
+     839             :       {     100555, "chi_b2(2P)" },
+     840             :       {     110555, "eta_b2(2D)" },
+     841             :       {     120555, "Upsilon_2(2D)" },
+     842             :       {     200555, "chi_b2(3P)" },
+     843             :       {        557, "Upsilon_3(1D)" },
+     844             :       {     100557, "Upsilon_3(2D)" },
+     845             :       {        611, "T^+" },
+     846             :       {       -611, "T^-" },
+     847             :       {        613, "T*^+" },
+     848             :       {       -613, "T*^-" },
+     849             :       {        621, "T^0" },
+     850             :       {       -621, "T~^0" },
+     851             :       {        623, "T*^0" },
+     852             :       {       -623, "T*~^0" },
+     853             :       {        631, "T_s^+" },
+     854             :       {       -631, "T_s^-" },
+     855             :       {        633, "T*_s^+" },
+     856             :       {       -633, "T*_s^-" },
+     857             :       {        641, "T_c^0" },
+     858             :       {       -641, "T_c~^0" },
+     859             :       {        643, "T*_c^0" },
+     860             :       {       -643, "T*_c~^0" },
+     861             :       {        651, "T_b^+" },
+     862             :       {       -651, "T_b^-" },
+     863             :       {        653, "T*_b^+" },
+     864             :       {       -653, "T*_b^-" },
+     865             :       {        661, "eta_t" },
+     866             :       {        663, "theta" },
+     867             :       {        711, "L^0" },
+     868             :       {       -711, "L~^0" },
+     869             :       {        713, "L*^0" },
+     870             :       {       -713, "L*~^0" },
+     871             :       {        721, "L^-" },
+     872             :       {       -721, "L^+" },
+     873             :       {        723, "L*^-" },
+     874             :       {       -723, "L*^+" },
+     875             :       {        731, "L_s^0" },
+     876             :       {       -731, "L_s~^0" },
+     877             :       {        733, "L*_s^0" },
+     878             :       {       -733, "L*_s~^0" },
+     879             :       {        741, "L_c^-" },
+     880             :       {       -741, "L_c^+" },
+     881             :       {        743, "L*_c^-" },
+     882             :       {       -743, "L*_c^+" },
+     883             :       {        751, "L_b^0" },
+     884             :       {       -751, "L_b~^0" },
+     885             :       {        753, "L*_b^0" },
+     886             :       {       -753, "L*_b~^0" },
+     887             :       {        761, "L_t^-" },
+     888             :       {       -761, "L_t^+" },
+     889             :       {        763, "L*_t^-" },
+     890             :       {       -763, "L*_t^+" },
+     891             :       {        771, "eta_l" },
+     892             :       {        773, "theta_l" },
+     893             :       {        811, "X^+" },
+     894             :       {       -811, "X^-" },
+     895             :       {        813, "X*^+" },
+     896             :       {       -813, "X*^-" },
+     897             :       {        821, "X^0" },
+     898             :       {       -821, "X~^0" },
+     899             :       {        823, "X*^0" },
+     900             :       {       -823, "X*~^0" },
+     901             :       {        831, "X_s^+" },
+     902             :       {       -831, "X_s^-" },
+     903             :       {        833, "X*_s^+" },
+     904             :       {       -833, "X*_s^-" },
+     905             :       {        841, "X_c^0" },
+     906             :       {       -841, "X_c~^0" },
+     907             :       {        843, "X*_c^0" },
+     908             :       {       -843, "X*_c~^0" },
+     909             :       {        851, "X_b^+" },
+     910             :       {       -851, "X_b^-" },
+     911             :       {        853, "X*_b^+" },
+     912             :       {       -853, "X*_b^-" },
+     913             :       {        861, "X_t^0" },
+     914             :       {       -861, "X_t~^0" },
+     915             :       {        863, "X*_t^0" },
+     916             :       {       -863, "X*_t~^0" },
+     917             :       {        871, "X_l^+" },
+     918             :       {       -871, "X_l^-" },
+     919             :       {        873, "X*_l^+" },
+     920             :       {       -873, "X*_l^-" },
+     921             :       {        881, "eta_h" },
+     922             :       {        883, "theta_H" },
+     923             :       {      30343, "Xsd" },
+     924             :       {     -30343, "anti-Xsd" },
+     925             :       {      30353, "Xsu" },
+     926             :       {     -30353, "anti-Xsu" },
+     927             :       {      30363, "Xss" },
+     928             :       {     -30363, "anti-Xss" },
+     929             :       {      30373, "Xdd" },
+     930             :       {     -30373, "anti-Xdd" },
+     931             :       {      30383, "Xdu" },
+     932             :       {     -30383, "anti-Xdu" },
+     933             :       {       2112, "n^0" },
+     934             :       {      -2112, "n~^0" },
+     935             :       {       2212, "p^+" },
+     936             :       {      -2212, "p~^-" },
+     937             :     {        12212,        "N(1440)^+"},
+     938             :     {        12112,        "N(1440)^0"},
+     939             :     {        22212,        "N(1535)^+"},
+     940             :     {        22112,        "N(1535)^0"},
+     941             :     {        32212,        "N(1650)^+"},
+     942             :     {        32112,        "N(1650)^0"},
+     943             :     {        42212,        "N(1710)^+"},
+     944             :     {        42112,        "N(1710)^0"},
+     945             :     {         1214,         "N(1520)^0"},
+     946             :     {         2124,         "N(1520)^+"},
+     947             :     {        21214,        "N(1700)^0"},
+     948             :     {        22124,        "N(1700)^+"},
+     949             :     {        31214,        "N(1720)^0"},
+     950             :     {        32124,        "N(1720)^+"},
+     951             :     {         2116,         "N(1675)^0"},
+     952             :     {         2216,         "N(1675)^+"},
+     953             :     {        12116,        "N(1680)^0"},
+     954             :     {        12216,        "N(1680)^+"},
+     955             :     {         1218,         "N(2190)^0"},
+     956             :     {         2128,        "N(2190)^+" },
+     957             :       {       1114, "Delta^-" },
+     958             :       {      -1114, "Delta~^+" },
+     959             :       {       2114, "Delta^0" },
+     960             :       {      -2114, "Delta~^0" },
+     961             :       {       2214, "Delta^+" },
+     962             :       {      -2214, "Delta~^-" },
+     963             :       {       2224, "Delta^++" },
+     964             :       {      -2224, "Delta~^--" },
+     965             :     {        31114,   "Delta(1600)^-"      },
+     966             :     {        32114,   "Delta(1600)^0"      },
+     967             :     {        32214,    "Delta(1600)^+"     },
+     968             :     {        32224,     "Delta(1600)^++"    },
+     969             :     {         1112,    "Delta(1620)^-"     },
+     970             :     {         1212,    "Delta(1620)^0"     },
+     971             :     {         2122,    "Delta(1620)^+"     },
+     972             :     {         2222,     "Delta(1620)^++"    },
+     973             :     {        11114,     "Delta(1700)^-"    },
+     974             :     {        12114,     "Delta(1700)^0"    },
+     975             :     {        12214,     "Delta(1700)^+"    },
+     976             :     {        12224,      "Delta(1700)^++"   },
+     977             :     {         1116,     "Delta(1905)^-"    },
+     978             :     {         1216,     "Delta(1905)^0"    },
+     979             :     {         2126,     "Delta(1905)^+"    },
+     980             :     {         2226,      "Delta(1905)^++"   },
+     981             :     {        21112,    "Delta(1910)^-"    },
+     982             :     {        21212,     "Delta(1910)^0"   },
+     983             :     {        22122,     "Delta(1910)^+"   },
+     984             :     {        22222,     "Delta(1910)^++"   },
+     985             :     {        21114,    "Delta(1920)^-"    },
+     986             :     {        22114,     "Delta(1920)^0"   },
+     987             :     {        22214,     "Delta(1920)^+"   },
+     988             :     {        22224,    "Delta(1920)^++"    },
+     989             :     {        11116,    "Delta(1930)^-"    },
+     990             :     {        11216,     "Delta(1930)^0"   },
+     991             :     {        12126,     "Delta(1930)^+"   },
+     992             :     {        12226,     "Delta(1930)^++"   },
+     993             :     {         1118,     "Delta(1950)^-"    },
+     994             :     {         2118,      "Delta(1950)^0"   },
+     995             :     {         2218,      "Delta(1950)^+"   },
+     996             :     {         2228,     "Delta(1950)^++"    },
+     997             :       {       3122, "Lambda^0" },
+     998             :       {      -3122, "Lambda~^0" },
+     999             :       {      13122, "Lambda(1405)^0" },
+    1000             :       {     -13122, "Lambda~(1405)^0" },
+    1001             :       {      23122, "Lambda(1600)^0" },
+    1002             :       {     -23122, "Lambda~(1600)^0" },
+    1003             :       {      33122, "Lambda(1670)^0" },
+    1004             :       {     -33122, "Lambda~(1670)^0" },
+    1005             :       {      43122, "Lambda(1800)^0" },
+    1006             :       {     -43122, "Lambda~(1800)^0" },
+    1007             :       {      53122, "Lambda(1810)^0" },
+    1008             :       {     -53122, "Lambda~(1810)^0" },
+    1009             :       {       3124, "Lambda(1520)^0" },
+    1010             :       {      -3124, "Lambda~(1520)^0" },
+    1011             :       {      13124, "Lambda(1690)^0" },
+    1012             :       {     -13124, "Lambda~(1690)^0" },
+    1013             :       {      23124, "Lambda(1890)^0" },
+    1014             :       {     -23124, "Lambda~(1890)^0" },
+    1015             :       {       3126, "Lambda(1820)^0" },
+    1016             :       {      -3126, "Lambda~(1820)^0" },
+    1017             :       {      13126, "Lambda(1830)^0" },
+    1018             :       {     -13126, "Lambda~(1830)^0" },
+    1019             :       {      23126, "Lambda(2110)^0" },
+    1020             :       {     -23126, "Lambda~(2110)^0" },
+    1021             :       {       3128, "Lambda(2100)^0" },
+    1022             :       {      -3128, "Lambda~(2100)^0" },
+    1023             :       {       3112, "Sigma^-" },
+    1024             :       {      -3112, "Sigma~^+" },
+    1025             :       {       3212, "Sigma^0" },
+    1026             :       {      -3212, "Sigma~^0" },
+    1027             :       {       3222, "Sigma^+" },
+    1028             :       {      -3222, "Sigma~^-" },
+    1029             :       {      13222, "Sigma(1660)^+" },
+    1030             :       {     -13222, "Sigma~(1660)^+" },
+    1031             :       {      13212, "Sigma(1660)^0" },
+    1032             :       {     -13212, "Sigma~(1660)^0" },
+    1033             :       {      13112, "Sigma(1660)^-" },
+    1034             :       {     -13112, "Sigma~(1660)^-" },
+    1035             :       {      23112, "Sigma(1750)^-" },
+    1036             :       {     -23112, "Sigma~(1750)^-" },
+    1037             :       {      23212, "Sigma(1750)^0" },
+    1038             :       {     -23212, "Sigma~(1750)^0" },
+    1039             :       {      23222, "Sigma(1750)^+" },
+    1040             :       {     -23222, "Sigma~(1750)^+" },
+    1041             :       {       3114, "Sigma*^-" },
+    1042             :       {      -3114, "Sigma*~^+" },
+    1043             :       {       3214, "Sigma*^0" },
+    1044             :       {      -3214, "Sigma*~^0" },
+    1045             :       {       3224, "Sigma*^+" },
+    1046             :       {      -3224, "Sigma*~^-" },
+    1047             :       {      13224, "Sigma(1670)^+" },
+    1048             :       {     -13224, "Sigma~(1670)^+" },
+    1049             :       {      13214, "Sigma(1670)^0" },
+    1050             :       {     -13214, "Sigma~(1670)^0" },
+    1051             :       {      13114, "Sigma(1670)^-" },
+    1052             :       {     -13114, "Sigma~(1670)^-" },
+    1053             :       {      23224, "Sigma(1940)^+" },
+    1054             :       {     -23224, "Sigma~(1940)^+" },
+    1055             :       {      23214, "Sigma(1940)^0" },
+    1056             :       {     -23214, "Sigma~(1940)^0" },
+    1057             :       {      23114, "Sigma(1940)^-" },
+    1058             :       {     -23114, "Sigma~(1940)^-" },
+    1059             :       {       3226, "Sigma(1775)^+" },
+    1060             :       {      -3226, "Sigma~(1775)^+" },
+    1061             :       {       3216, "Sigma(1775)^0" },
+    1062             :       {      -3216, "Sigma~(1775)^0" },
+    1063             :       {       3116, "Sigma(1775)^-" },
+    1064             :       {      -3116, "Sigma~(1775)^-" },
+    1065             :       {      13226, "Sigma(1915)^+" },
+    1066             :       {     -13226, "Sigma~(1915)^+" },
+    1067             :       {      13216, "Sigma(1915)^0" },
+    1068             :       {     -13216, "Sigma~(1915)^0" },
+    1069             :       {      13116, "Sigma(1915)^-" },
+    1070             :       {     -13116, "Sigma~(1915)^-" },
+    1071             :       {       3228, "Sigma(2030)^+" },
+    1072             :       {      -3228, "Sigma~(2030)^+" },
+    1073             :       {       3218, "Sigma(2030)^0" },
+    1074             :       {      -3218, "Sigma~(2030)^0" },
+    1075             :       {       3118, "Sigma(2030)^-" },
+    1076             :       {      -3118, "Sigma~(2030)^-" },
+    1077             :       {       3312, "Xi^-" },
+    1078             :       {      -3312, "Xi~^+" },
+    1079             :       {       3322, "Xi^0" },
+    1080             :       {      -3322, "Xi~^0" },
+    1081             :       {       3314, "Xi*^-" },
+    1082             :       {      -3314, "Xi*~^+" },
+    1083             :       {       3324, "Xi*^0" },
+    1084             :       {      -3324, "Xi*~^0" },
+    1085             :       {      13314, "Xi(1820)^-" },
+    1086             :       {     -13314, "Xi(1820)~^+" },
+    1087             :       {      13324, "Xi(1820)^0" },
+    1088             :       {     -13324, "Xi(1820)~^0" },
+    1089             :       {       3334, "Omega^-" },
+    1090             :       {      -3334, "Omega~^+" },
+    1091             :       {       4112, "Sigma_c^0" },
+    1092             :       {      -4112, "Sigma_c~^0" },
+    1093             :       {       4114, "Sigma*_c^0" },
+    1094             :       {      -4114, "Sigma*_c~^0" },
+    1095             :       {       4122, "Lambda_c^+" },
+    1096             :       {      -4122, "Lambda_c~^-" },
+    1097             :       {      14122, "Lambda_c(2593)^+" },
+    1098             :       {     -14122, "Lambda_c~(2593)^-" },
+    1099             :       {      14124, "Lambda_c(2625)^+" },
+    1100             :       {     -14124, "Lambda_c~(2625)^-" },
+    1101             :       {       4132, "Xi_c^0" },
+    1102             :       {      -4132, "Xi_c~^0" },
+    1103             :       {       4212, "Sigma_c^+" },
+    1104             :       {      -4212, "Sigma_c~^-" },
+    1105             :       {       4214, "Sigma*_c^+" },
+    1106             :       {      -4214, "Sigma*_c~^-" },
+    1107             :       {       4222, "Sigma_c^++" },
+    1108             :       {      -4222, "Sigma_c~^--" },
+    1109             :       {       4224, "Sigma*_c^++" },
+    1110             :       {      -4224, "Sigma*_c~^--" },
+    1111             :       {       4232, "Xi_c^+" },
+    1112             :       {      -4232, "Xi_c~^-" },
+    1113             :       {       4312, "Xi'_c^0" },
+    1114             :       {      -4312, "Xi'_c~^0" },
+    1115             :       {       4314, "Xi*_c^0" },
+    1116             :       {      -4314, "Xi*_c~^0" },
+    1117             :       {       4322, "Xi'_c^+" },
+    1118             :       {      -4322, "Xi'_c~^-" },
+    1119             :       {       4324, "Xi*_c^+" },
+    1120             :       {      -4324, "Xi*_c~^-" },
+    1121             :       {       4332, "Omega_c^0" },
+    1122             :       {      -4332, "Omega_c~^0" },
+    1123             :       {       4334, "Omega*_c^0" },
+    1124             :       {      -4334, "Omega*_c~^0" },
+    1125             :       {       4412, "Xi_cc^+" },
+    1126             :       {      -4412, "Xi_cc~^-" },
+    1127             :       {       4414, "Xi*_cc^+" },
+    1128             :       {      -4414, "Xi*_cc~^-" },
+    1129             :       {       4422, "Xi_cc^++" },
+    1130             :       {      -4422, "Xi_cc~^--" },
+    1131             :       {       4424, "Xi*_cc^++" },
+    1132             :       {      -4424, "Xi*_cc~^--" },
+    1133             :       {       4432, "Omega_cc^+" },
+    1134             :       {      -4432, "Omega_cc~^-" },
+    1135             :       {       4434, "Omega*_cc^+" },
+    1136             :       {      -4434, "Omega*_cc~^-" },
+    1137             :       {       4444, "Omega*_ccc^++" },
+    1138             :       {      -4444, "Omega*_ccc~^--" },
+    1139             :       {       5112, "Sigma_b^-" },
+    1140             :       {      -5112, "Sigma_b~^+" },
+    1141             :       {       5114, "Sigma*_b^-" },
+    1142             :       {      -5114, "Sigma*_b~^+" },
+    1143             :       {       5122, "Lambda_b^0" },
+    1144             :       {      -5122, "Lambda_b~^0" },
+    1145             :       {       5132, "Xi_b^-" },
+    1146             :       {      -5132, "Xi_b~^+" },
+    1147             :       {       5142, "Xi_bc^0" },
+    1148             :       {      -5142, "Xi_bc~^0" },
+    1149             :       {       5212, "Sigma_b^0" },
+    1150             :       {      -5212, "Sigma_b~^0" },
+    1151             :       {       5214, "Sigma*_b^0" },
+    1152             :       {      -5214, "Sigma*_b~^0" },
+    1153             :       {       5222, "Sigma_b^+" },
+    1154             :       {      -5222, "Sigma_b~^-" },
+    1155             :       {       5224, "Sigma*_b^+" },
+    1156             :       {      -5224, "Sigma*_b~^-" },
+    1157             :       {       5232, "Xi_b^0" },
+    1158             :       {      -5232, "Xi_b~^0" },
+    1159             :       {       5242, "Xi_bc^+" },
+    1160             :       {      -5242, "Xi_bc~^-" },
+    1161             :       {       5312, "Xi'_b^-" },
+    1162             :       {      -5312, "Xi'_b~^+" },
+    1163             :       {       5314, "Xi*_b^-" },
+    1164             :       {      -5314, "Xi*_b~^+" },
+    1165             :       {       5322, "Xi'_b^0" },
+    1166             :       {      -5322, "Xi'_b~^0" },
+    1167             :       {       5324, "Xi*_b^0" },
+    1168             :       {      -5324, "Xi*_b~^0" },
+    1169             :       {       5332, "Omega_b^-" },
+    1170             :       {      -5332, "Omega_b~^+" },
+    1171             :       {       5334, "Omega*_b^-" },
+    1172             :       {      -5334, "Omega*_b~^+" },
+    1173             :       {       5342, "Omega_bc^0" },
+    1174             :       {      -5342, "Omega_bc~^0" },
+    1175             :       {       5412, "Xi'_bc^0" },
+    1176             :       {      -5412, "Xi'_bc~^0" },
+    1177             :       {       5414, "Xi*_bc^0" },
+    1178             :       {      -5414, "Xi*_bc~^0" },
+    1179             :       {       5422, "Xi'_bc^+" },
+    1180             :       {      -5422, "Xi'_bc~^-" },
+    1181             :       {       5424, "Xi*_bc^+" },
+    1182             :       {      -5424, "Xi*_bc~^-" },
+    1183             :       {       5432, "Omega'_bc^0" },
+    1184             :       {      -5432, "Omega'_bc~^0" },
+    1185             :       {       5434, "Omega*_bc^0" },
+    1186             :       {      -5434, "Omega*_bc~^0" },
+    1187             :       {       5442, "Omega_bcc^+" },
+    1188             :       {      -5442, "Omega_bcc~^-" },
+    1189             :       {       5444, "Omega*_bcc^+" },
+    1190             :       {      -5444, "Omega*_bcc~^-" },
+    1191             :       {       5512, "Xi_bb^-" },
+    1192             :       {      -5512, "Xi_bb~^+" },
+    1193             :       {       5514, "Xi*_bb^-" },
+    1194             :       {      -5514, "Xi*_bb~^+" },
+    1195             :       {       5522, "Xi_bb^0" },
+    1196             :       {      -5522, "Xi_bb~^0" },
+    1197             :       {       5524, "Xi*_bb^0" },
+    1198             :       {      -5524, "Xi*_bb~^0" },
+    1199             :       {       5532, "Omega_bb^-" },
+    1200             :       {      -5532, "Omega_bb~^+" },
+    1201             :       {       5534, "Omega*_bb^-" },
+    1202             :       {      -5534, "Omega*_bb~^+" },
+    1203             :       {       5542, "Omega_bbc^0" },
+    1204             :       {      -5542, "Omega_bbc~^0" },
+    1205             :       {       5544, "Omega*_bbc^0" },
+    1206             :       {      -5544, "Omega*_bbc~^0" },
+    1207             :       {       5554, "Omega*_bbb^-" },
+    1208             :       {      -5554, "Omega*_bbb~^+" },
+    1209             :       {       6112, "Sigma_t^0" },
+    1210             :       {      -6112, "Sigma_t~^0" },
+    1211             :       {       6114, "Sigma*_t^0" },
+    1212             :       {      -6114, "Sigma*_t~^0" },
+    1213             :       {       6122, "Lambda_t^+" },
+    1214             :       {      -6122, "Lambda_t~^-" },
+    1215             :       {       6132, "Xi_t^0" },
+    1216             :       {      -6132, "Xi_t~^0" },
+    1217             :       {       6142, "Xi_tc^+" },
+    1218             :       {      -6142, "Xi_tc~^-" },
+    1219             :       {       6152, "Xi_tb^0" },
+    1220             :       {      -6152, "Xi_tb~^0" },
+    1221             :       {       6212, "Sigma_t^+" },
+    1222             :       {      -6212, "Sigma_t~^-" },
+    1223             :       {       6214, "Sigma*_t^+" },
+    1224             :       {      -6214, "Sigma*_t~^-" },
+    1225             :       {       6222, "Sigma_t^++" },
+    1226             :       {      -6222, "Sigma_t~^--" },
+    1227             :       {       6224, "Sigma*_t^++" },
+    1228             :       {      -6224, "Sigma*_t~^--" },
+    1229             :       {       6232, "Xi_t^+" },
+    1230             :       {      -6232, "Xi_t~^-" },
+    1231             :       {       6242, "Xi_tc^++" },
+    1232             :       {      -6242, "Xi_tc~^--" },
+    1233             :       {       6252, "Xi_tb^+" },
+    1234             :       {      -6252, "Xi_tb~^-" },
+    1235             :       {       6312, "Xi'_t^0" },
+    1236             :       {      -6312, "Xi'_t~^0" },
+    1237             :       {       6314, "Xi*_t^0" },
+    1238             :       {      -6314, "Xi*_t~^0" },
+    1239             :       {       6322, "Xi'_t^+" },
+    1240             :       {      -6322, "Xi'_t~^-" },
+    1241             :       {       6324, "Xi*_t^+" },
+    1242             :       {      -6324, "Xi*_t~^-" },
+    1243             :       {       6332, "Omega_t^0" },
+    1244             :       {      -6332, "Omega_t~^0" },
+    1245             :       {       6334, "Omega*_t^0" },
+    1246             :       {      -6334, "Omega*_t~^0" },
+    1247             :       {       6342, "Omega_tc^+" },
+    1248             :       {      -6342, "Omega_tc~^-" },
+    1249             :       {       6352, "Omega_tb^0" },
+    1250             :       {      -6352, "Omega_tb~^0" },
+    1251             :       {       6412, "Xi'_tc^+" },
+    1252             :       {      -6412, "Xi'_tc~^-" },
+    1253             :       {       6414, "Xi*_tc^+" },
+    1254             :       {      -6414, "Xi*_tc~^-" },
+    1255             :       {       6422, "Xi'_tc^++" },
+    1256             :       {      -6422, "Xi'_tc~^--" },
+    1257             :       {       6424, "Xi*_tc^++" },
+    1258             :       {      -6424, "Xi*_tc~^--" },
+    1259             :       {       6432, "Omega'_tc^+" },
+    1260             :       {      -6432, "Omega'_tc~^-" },
+    1261             :       {       6434, "Omega*_tc^+" },
+    1262             :       {      -6434, "Omega*_tc~^-" },
+    1263             :       {       6442, "Omega_tcc^++" },
+    1264             :       {      -6442, "Omega_tcc~^--" },
+    1265             :       {       6444, "Omega*_tcc^++" },
+    1266             :       {      -6444, "Omega*_tcc~^--" },
+    1267             :       {       6452, "Omega_tbc^+" },
+    1268             :       {      -6452, "Omega_tbc~^-" },
+    1269             :       {       6512, "Xi'_tb^0" },
+    1270             :       {      -6512, "Xi'_tb~^0" },
+    1271             :       {       6514, "Xi*_tb^0" },
+    1272             :       {      -6514, "Xi*_tb~^0" },
+    1273             :       {       6522, "Xi'_tb^+" },
+    1274             :       {      -6522, "Xi'_tb~^-" },
+    1275             :       {       6524, "Xi*_tb^+" },
+    1276             :       {      -6524, "Xi*_tb~^-" },
+    1277             :       {       6532, "Omega'_tb^0" },
+    1278             :       {      -6532, "Omega'_tb~^0" },
+    1279             :       {       6534, "Omega*_tb^0" },
+    1280             :       {      -6534, "Omega*_tb~^0" },
+    1281             :       {       6542, "Omega'_tbc^+" },
+    1282             :       {      -6542, "Omega'_tbc~^-" },
+    1283             :       {       6544, "Omega*_tbc^+" },
+    1284             :       {      -6544, "Omega*_tbc~^-" },
+    1285             :       {       6552, "Omega_tbb^0" },
+    1286             :       {      -6552, "Omega_tbb~^0" },
+    1287             :       {       6554, "Omega*_tbb^0" },
+    1288             :       {      -6554, "Omega*_tbb~^0" },
+    1289             :       {       6612, "Xi_tt^+" },
+    1290             :       {      -6612, "Xi_tt~^-" },
+    1291             :       {       6614, "Xi*_tt^+" },
+    1292             :       {      -6614, "Xi*_tt~^-" },
+    1293             :       {       6622, "Xi_tt^++" },
+    1294             :       {      -6622, "Xi_tt~^--" },
+    1295             :       {       6624, "Xi*_tt^++" },
+    1296             :       {      -6624, "Xi*_tt~^--" },
+    1297             :       {       6632, "Omega_tt^+" },
+    1298             :       {      -6632, "Omega_tt~^-" },
+    1299             :       {       6634, "Omega*_tt^+" },
+    1300             :       {      -6634, "Omega*_tt~^-" },
+    1301             :       {       6642, "Omega_ttc^++" },
+    1302             :       {      -6642, "Omega_ttc~^--" },
+    1303             :       {       6644, "Omega*_ttc^++" },
+    1304             :       {      -6644, "Omega*_ttc~^--" },
+    1305             :       {       6652, "Omega_ttb^+" },
+    1306             :       {      -6652, "Omega_ttb~^-" },
+    1307             :       {       6654, "Omega*_ttb^+" },
+    1308             :       {      -6654, "Omega*_ttb~^-" },
+    1309             :       {       6664, "Omega*_ttt^++" },
+    1310             :       {      -6664, "Omega*_ttt~^--" },
+    1311             :       {       7112, "Sigma_b'^-" },
+    1312             :       {      -7112, "Sigma_b'~^+" },
+    1313             :       {       7114, "Sigma*_b'^-" },
+    1314             :       {      -7114, "Sigma*_b'~^+" },
+    1315             :       {       7122, "Lambda_b'^0" },
+    1316             :       {      -7122, "Lambda_b'~^0" },
+    1317             :       {       7132, "Xi_b'^-" },
+    1318             :       {      -7132, "Xi_b'~^+" },
+    1319             :       {       7142, "Xi_b'c^0" },
+    1320             :       {      -7142, "Xi_b'c~^0" },
+    1321             :       {       7152, "Xi_b'b^-" },
+    1322             :       {      -7152, "Xi_b'b~^+" },
+    1323             :       {       7162, "Xi_b't^0" },
+    1324             :       {      -7162, "Xi_b't~^0" },
+    1325             :       {       7212, "Sigma_b'^0" },
+    1326             :       {      -7212, "Sigma_b'~^0" },
+    1327             :       {       7214, "Sigma*_b'^0" },
+    1328             :       {      -7214, "Sigma*_b'~^0" },
+    1329             :       {       7222, "Sigma_b'^+" },
+    1330             :       {      -7222, "Sigma_b'~^-" },
+    1331             :       {       7224, "Sigma*_b'^+" },
+    1332             :       {      -7224, "Sigma*_b'~^-" },
+    1333             :       {       7232, "Xi_b'^0" },
+    1334             :       {      -7232, "Xi_b'~^0" },
+    1335             :       {       7242, "Xi_b'c^+" },
+    1336             :       {      -7242, "Xi_b'c~^-" },
+    1337             :       {       7252, "Xi_b'b^0" },
+    1338             :       {      -7252, "Xi_b'b~^0" },
+    1339             :       {       7262, "Xi_b't^+" },
+    1340             :       {      -7262, "Xi_b't~^-" },
+    1341             :       {       7312, "Xi'_b'^-" },
+    1342             :       {      -7312, "Xi'_b'~^+" },
+    1343             :       {       7314, "Xi*_b'^-" },
+    1344             :       {      -7314, "Xi*_b'~^+" },
+    1345             :       {       7322, "Xi'_b'^0" },
+    1346             :       {      -7322, "Xi'_b'~^0" },
+    1347             :       {       7324, "Xi*_b'^0" },
+    1348             :       {      -7324, "Xi*_b'~^0" },
+    1349             :       {       7332, "Omega'_b'^-" },
+    1350             :       {      -7332, "Omega'_b'~^+" },
+    1351             :       {       7334, "Omega*_b'^-" },
+    1352             :       {      -7334, "Omega*_b'~^+" },
+    1353             :       {       7342, "Omega_b'c^0" },
+    1354             :       {      -7342, "Omega_b'c~^0" },
+    1355             :       {       7352, "Omega_b'b^-" },
+    1356             :       {      -7352, "Omega_b'b~^+" },
+    1357             :       {       7362, "Omega_b't^0" },
+    1358             :       {      -7362, "Omega_b't~^0" },
+    1359             :       {       7412, "Xi'_b'c^0" },
+    1360             :       {      -7412, "Xi'_b'c~^0" },
+    1361             :       {       7414, "Xi*_b'c^0" },
+    1362             :       {      -7414, "Xi*_b'c~^0" },
+    1363             :       {       7422, "Xi'_b'c^+" },
+    1364             :       {      -7422, "Xi'_b'c~^-" },
+    1365             :       {       7424, "Xi*_b'c^+" },
+    1366             :       {      -7424, "Xi*_b'c~^-" },
+    1367             :       {       7432, "Omega'_b'c^0" },
+    1368             :       {      -7432, "Omega'_b'c~^0" },
+    1369             :       {       7434, "Omega*_b'c^0" },
+    1370             :       {      -7434, "Omega*_b'c~^0" },
+    1371             :       {       7442, "Omega'_b'cc^+" },
+    1372             :       {      -7442, "Omega'_b'cc~^-" },
+    1373             :       {       7444, "Omega*_b'cc^+" },
+    1374             :       {      -7444, "Omega*_b'cc~^-" },
+    1375             :       {       7452, "Omega_b'bc^0" },
+    1376             :       {      -7452, "Omega_b'bc~^0" },
+    1377             :       {       7462, "Omega_b'tc^+" },
+    1378             :       {      -7462, "Omega_b'tc~^-" },
+    1379             :       {       7512, "Xi'_b'b^-" },
+    1380             :       {      -7512, "Xi'_b'b~^+" },
+    1381             :       {       7514, "Xi*_b'b^-" },
+    1382             :       {      -7514, "Xi*_b'b~^+" },
+    1383             :       {       7522, "Xi'_b'b^0" },
+    1384             :       {      -7522, "Xi'_b'b~^0" },
+    1385             :       {       7524, "Xi*_b'b^0" },
+    1386             :       {      -7524, "Xi*_b'b~^0" },
+    1387             :       {       7532, "Omega'_b'b^-" },
+    1388             :       {      -7532, "Omega'_b'b~^+" },
+    1389             :       {       7534, "Omega*_b'b^-" },
+    1390             :       {      -7534, "Omega*_b'b~^+" },
+    1391             :       {       7542, "Omega'_b'bc^0" },
+    1392             :       {      -7542, "Omega'_b'bc~^0" },
+    1393             :       {       7544, "Omega*_b'bc^0" },
+    1394             :       {      -7544, "Omega*_b'bc~^0" },
+    1395             :       {       7552, "Omega'_b'bb^-" },
+    1396             :       {      -7552, "Omega'_b'bb~^+" },
+    1397             :       {       7554, "Omega*_b'bb^-" },
+    1398             :       {      -7554, "Omega*_b'bb~^+" },
+    1399             :       {       7562, "Omega_b'tb^0" },
+    1400             :       {      -7562, "Omega_b'tb~^0" },
+    1401             :       {       7612, "Xi'_b't^0" },
+    1402             :       {      -7612, "Xi'_b't~^0" },
+    1403             :       {       7614, "Xi*_b't^0" },
+    1404             :       {      -7614, "Xi*_b't~^0" },
+    1405             :       {       7622, "Xi'_b't^+" },
+    1406             :       {      -7622, "Xi'_b't~^-" },
+    1407             :       {       7624, "Xi*_b't^+" },
+    1408             :       {      -7624, "Xi*_b't~^-" },
+    1409             :       {       7632, "Omega'_b't^0" },
+    1410             :       {      -7632, "Omega'_b't~^0" },
+    1411             :       {       7634, "Omega*_b't^0" },
+    1412             :       {      -7634, "Omega*_b't~^0" },
+    1413             :       {       7642, "Omega'_b'tc^+" },
+    1414             :       {      -7642, "Omega'_b'tc~^-" },
+    1415             :       {       7644, "Omega*_b'tc^+" },
+    1416             :       {      -7644, "Omega*_b'tc~^-" },
+    1417             :       {       7652, "Omega'_b'tb^0" },
+    1418             :       {      -7652, "Omega'_b'tb~^0" },
+    1419             :       {       7654, "Omega*_b'tb^0" },
+    1420             :       {      -7654, "Omega*_b'tb~^0" },
+    1421             :       {       7662, "Omega'_b'tt^+" },
+    1422             :       {      -7662, "Omega'_b'tt~^-" },
+    1423             :       {       7664, "Omega*_b'tt^+" },
+    1424             :       {      -7664, "Omega*_b'tt~^-" },
+    1425             :       {       7712, "Xi'_b'b'^-" },
+    1426             :       {      -7712, "Xi'_b'b'~^+" },
+    1427             :       {       7714, "Xi*_b'b'^-" },
+    1428             :       {      -7714, "Xi*_b'b'~^+" },
+    1429             :       {       7722, "Xi'_b'b'^0" },
+    1430             :       {      -7722, "Xi'_b'b'~^0" },
+    1431             :       {       7724, "Xi*_b'b'^0" },
+    1432             :       {      -7724, "Xi*_b'b'~^0" },
+    1433             :       {       7732, "Omega'_b'b'^-" },
+    1434             :       {      -7732, "Omega'_b'b'~^+" },
+    1435             :       {       7734, "Omega*_b'b'^-" },
+    1436             :       {      -7734, "Omega*_b'b'~^+" },
+    1437             :       {       7742, "Omega'_b'b'c^0" },
+    1438             :       {      -7742, "Omega'_b'b'c~^0" },
+    1439             :       {       7744, "Omega*_b'b'c^0" },
+    1440             :       {      -7744, "Omega*_b'b'c~^0" },
+    1441             :       {       7752, "Omega'_b'b'b^-" },
+    1442             :       {      -7752, "Omega'_b'b'b~^+" },
+    1443             :       {       7754, "Omega*_b'b'b^-" },
+    1444             :       {      -7754, "Omega*_b'b'b~^+" },
+    1445             :       {       7762, "Omega'_b'b't^0" },
+    1446             :       {      -7762, "Omega'_b'b't~^0" },
+    1447             :       {       7764, "Omega*_b'b't^0" },
+    1448             :       {      -7764, "Omega*_b'b't~^0" },
+    1449             :       {       7774, "Omega*_b'b'b'^-" },
+    1450             :       {      -7774, "Omega*_b'b'b'~^+" },
+    1451             :       {       8112, "Sigma_t'^0" },
+    1452             :       {      -8112, "Sigma_t'~^0" },
+    1453             :       {       8114, "Sigma*_t'^0" },
+    1454             :       {      -8114, "Sigma*_t'~^0" },
+    1455             :       {       8122, "Lambda_t'^+" },
+    1456             :       {      -8122, "Lambda_t'~^-" },
+    1457             :       {       8132, "Xi_t'^0" },
+    1458             :       {      -8132, "Xi_t'~^0" },
+    1459             :       {       8142, "Xi_t'c^+" },
+    1460             :       {      -8142, "Xi_t'c~^-" },
+    1461             :       {       8152, "Xi_t'b^0" },
+    1462             :       {      -8152, "Xi_t'b~^0" },
+    1463             :       {       8162, "Xi_t't^+" },
+    1464             :       {      -8162, "Xi_t't~^-" },
+    1465             :       {       8172, "Xi_t'b'^0" },
+    1466             :       {      -8172, "Xi_t'b'~^0" },
+    1467             :       {       8212, "Sigma_t'^+" },
+    1468             :       {      -8212, "Sigma_t'~^-" },
+    1469             :       {       8214, "Sigma*_t'^+" },
+    1470             :       {      -8214, "Sigma*_t'~^-" },
+    1471             :       {       8222, "Sigma_t'^++" },
+    1472             :       {      -8222, "Sigma_t'~^--" },
+    1473             :       {       8224, "Sigma*_t'^++" },
+    1474             :       {      -8224, "Sigma*_t'~^--" },
+    1475             :       {       8232, "Xi_t'^+" },
+    1476             :       {      -8232, "Xi_t'~^-" },
+    1477             :       {       8242, "Xi_t'c^++" },
+    1478             :       {      -8242, "Xi_t'c~^--" },
+    1479             :       {       8252, "Xi_t'b^+" },
+    1480             :       {      -8252, "Xi_t'b~^-" },
+    1481             :       {       8262, "Xi_t't^++" },
+    1482             :       {      -8262, "Xi_t't~^--" },
+    1483             :       {       8272, "Xi_t'b'^+" },
+    1484             :       {      -8272, "Xi_t'b'~^-" },
+    1485             :       {       8312, "Xi'_t'^0" },
+    1486             :       {      -8312, "Xi'_t'~^0" },
+    1487             :       {       8314, "Xi*_t'^0" },
+    1488             :       {      -8314, "Xi*_t'~^0" },
+    1489             :       {       8322, "Xi'_t'^+" },
+    1490             :       {      -8322, "Xi'_t'~^-" },
+    1491             :       {       8324, "Xi*_t'^+" },
+    1492             :       {      -8324, "Xi*_t'~^-" },
+    1493             :       {       8332, "Omega'_t'^0" },
+    1494             :       {      -8332, "Omega'_t'~^0" },
+    1495             :       {       8334, "Omega*_t'^0" },
+    1496             :       {      -8334, "Omega*_t'~^0" },
+    1497             :       {       8342, "Omega_t'c^+" },
+    1498             :       {      -8342, "Omega_t'c~^-" },
+    1499             :       {       8352, "Omega_t'b^0" },
+    1500             :       {      -8352, "Omega_t'b~^0" },
+    1501             :       {       8362, "Omega_t't^+" },
+    1502             :       {      -8362, "Omega_t't~^-" },
+    1503             :       {       8372, "Omega_t'b'^0" },
+    1504             :       {      -8372, "Omega_t'b'~^0" },
+    1505             :       {       8412, "Xi'_t'c^+" },
+    1506             :       {      -8412, "Xi'_t'c~^-" },
+    1507             :       {       8414, "Xi*_t'c^+" },
+    1508             :       {      -8414, "Xi*_t'c~^-" },
+    1509             :       {       8422, "Xi'_t'c^++" },
+    1510             :       {      -8422, "Xi'_t'c~^--" },
+    1511             :       {       8424, "Xi*_t'c^++" },
+    1512             :       {      -8424, "Xi*_t'c~^--" },
+    1513             :       {       8432, "Omega'_t'c^+" },
+    1514             :       {      -8432, "Omega'_t'c~^-" },
+    1515             :       {       8434, "Omega*_t'c^+" },
+    1516             :       {      -8434, "Omega*_t'c~^-" },
+    1517             :       {       8442, "Omega'_t'cc^++" },
+    1518             :       {      -8442, "Omega'_t'cc~^--" },
+    1519             :       {       8444, "Omega*_t'cc^++" },
+    1520             :       {      -8444, "Omega*_t'cc~^--" },
+    1521             :       {       8452, "Omega_t'bc^+" },
+    1522             :       {      -8452, "Omega_t'bc~^-" },
+    1523             :       {       8462, "Omega_t'tc^++" },
+    1524             :       {      -8462, "Omega_t'tc~^--" },
+    1525             :       {       8472, "Omega_t'b'c ^+" },
+    1526             :       {      -8472, "Omega_t'b'c ~^-" },
+    1527             :       {       8512, "Xi'_t'b^0" },
+    1528             :       {      -8512, "Xi'_t'b~^0" },
+    1529             :       {       8514, "Xi*_t'b^0" },
+    1530             :       {      -8514, "Xi*_t'b~^0" },
+    1531             :       {       8522, "Xi'_t'b^+" },
+    1532             :       {      -8522, "Xi'_t'b~^-" },
+    1533             :       {       8524, "Xi*_t'b^+" },
+    1534             :       {      -8524, "Xi*_t'b~^-" },
+    1535             :       {       8532, "Omega'_t'b^0" },
+    1536             :       {      -8532, "Omega'_t'b~^0" },
+    1537             :       {       8534, "Omega*_t'b^0" },
+    1538             :       {      -8534, "Omega*_t'b~^0" },
+    1539             :       {       8542, "Omega'_t'bc^+" },
+    1540             :       {      -8542, "Omega'_t'bc~^-" },
+    1541             :       {       8544, "Omega*_t'bc^+" },
+    1542             :       {      -8544, "Omega*_t'bc~^-" },
+    1543             :       {       8552, "Omega'_t'bb^0" },
+    1544             :       {      -8552, "Omega'_t'bb~^0" },
+    1545             :       {       8554, "Omega*_t'bb^0" },
+    1546             :       {      -8554, "Omega*_t'bb~^0" },
+    1547             :       {       8562, "Omega_t'tb^+" },
+    1548             :       {      -8562, "Omega_t'tb~^-" },
+    1549             :       {       8572, "Omega_t'b'b ^0" },
+    1550             :       {      -8572, "Omega_t'b'b ~^0" },
+    1551             :       {       8612, "Xi'_t't^+" },
+    1552             :       {      -8612, "Xi'_t't~^-" },
+    1553             :       {       8614, "Xi*_t't^+" },
+    1554             :       {      -8614, "Xi*_t't~^-" },
+    1555             :       {       8622, "Xi'_t't^++" },
+    1556             :       {      -8622, "Xi'_t't~^--" },
+    1557             :       {       8624, "Xi*_t't^++" },
+    1558             :       {      -8624, "Xi*_t't~^--" },
+    1559             :       {       8632, "Omega'_t't^+" },
+    1560             :       {      -8632, "Omega'_t't~^-" },
+    1561             :       {       8634, "Omega*_t't^+" },
+    1562             :       {      -8634, "Omega*_t't~^-" },
+    1563             :       {       8642, "Omega'_t'tc^++" },
+    1564             :       {      -8642, "Omega'_t'tc~^--" },
+    1565             :       {       8644, "Omega*_t'tc^++" },
+    1566             :       {      -8644, "Omega*_t'tc~^--" },
+    1567             :       {       8652, "Omega'_t'tb^+" },
+    1568             :       {      -8652, "Omega'_t'tb~^-" },
+    1569             :       {       8654, "Omega*_t'tb^+" },
+    1570             :       {      -8654, "Omega*_t'tb~^-" },
+    1571             :       {       8662, "Omega'_t'tt^++" },
+    1572             :       {      -8662, "Omega'_t'tt~^--" },
+    1573             :       {       8664, "Omega*_t'tt^++" },
+    1574             :       {      -8664, "Omega*_t'tt~^--" },
+    1575             :       {       8672, "Omega_t'b't ^+" },
+    1576             :       {      -8672, "Omega_t'b't ~^-" },
+    1577             :       {       8712, "Xi'_t'b'^0" },
+    1578             :       {      -8712, "Xi'_t'b'~^0" },
+    1579             :       {       8714, "Xi*_t'b'^0" },
+    1580             :       {      -8714, "Xi*_t'b'~^0" },
+    1581             :       {       8722, "Xi'_t'b'^+" },
+    1582             :       {      -8722, "Xi'_t'b'~^-" },
+    1583             :       {       8724, "Xi*_t'b'^+" },
+    1584             :       {      -8724, "Xi*_t'b'~^-" },
+    1585             :       {       8732, "Omega'_t'b'^0" },
+    1586             :       {      -8732, "Omega'_t'b'~^0" },
+    1587             :       {       8734, "Omega*_t'b'^0" },
+    1588             :       {      -8734, "Omega*_t'b'~^0" },
+    1589             :       {       8742, "Omega'_t'b'c^+" },
+    1590             :       {      -8742, "Omega'_t'b'c~^-" },
+    1591             :       {       8744, "Omega*_t'b'c^+" },
+    1592             :       {      -8744, "Omega*_t'b'c~^-" },
+    1593             :       {       8752, "Omega'_t'b'b^0" },
+    1594             :       {      -8752, "Omega'_t'b'b~^0" },
+    1595             :       {       8754, "Omega*_t'b'b^0" },
+    1596             :       {      -8754, "Omega*_t'b'b~^0" },
+    1597             :       {       8762, "Omega'_t'b't^+" },
+    1598             :       {      -8762, "Omega'_t'b't~^-" },
+    1599             :       {       8764, "Omega*_t'b't^+" },
+    1600             :       {      -8764, "Omega*_t'b't~^-" },
+    1601             :       {       8772, "Omega'_t'b'b'^0" },
+    1602             :       {      -8772, "Omega'_t'b'b'~^0" },
+    1603             :       {       8774, "Omega*_t'b'b'^0" },
+    1604             :       {      -8774, "Omega*_t'b'b'~^0" },
+    1605             :       {       8812, "Xi'_t't'^+" },
+    1606             :       {      -8812, "Xi'_t't'~^-" },
+    1607             :       {       8814, "Xi*_t't'^+" },
+    1608             :       {      -8814, "Xi*_t't'~^-" },
+    1609             :       {       8822, "Xi'_t't'^++" },
+    1610             :       {      -8822, "Xi'_t't'~^--" },
+    1611             :       {       8824, "Xi*_t't'^++" },
+    1612             :       {      -8824, "Xi*_t't'~^--" },
+    1613             :       {       8832, "Omega'_t't'^+" },
+    1614             :       {      -8832, "Omega'_t't'~^-" },
+    1615             :       {       8834, "Omega*_t't'^+" },
+    1616             :       {      -8834, "Omega*_t't'~^-" },
+    1617             :       {       8842, "Omega'_t't'c^++" },
+    1618             :       {      -8842, "Omega'_t't'c~^--" },
+    1619             :       {       8844, "Omega*_t't'c^++" },
+    1620             :       {      -8844, "Omega*_t't'c~^--" },
+    1621             :       {       8852, "Omega'_t't'b^+" },
+    1622             :       {      -8852, "Omega'_t't'b~^-" },
+    1623             :       {       8854, "Omega*_t't'b^+" },
+    1624             :       {      -8854, "Omega*_t't'b~^-" },
+    1625             :       {       8862, "Omega'_t't't^++" },
+    1626             :       {      -8862, "Omega'_t't't~^--" },
+    1627             :       {       8864, "Omega*_t't't^++" },
+    1628             :       {      -8864, "Omega*_t't't~^--" },
+    1629             :       {       8872, "Omega'_t't'b'^+" },
+    1630             :       {      -8872, "Omega'_t't'b'~^-" },
+    1631             :       {       8874, "Omega*_t't'b'^+" },
+    1632             :       {      -8874, "Omega*_t't'b'~^-" },
+    1633             :       {       8884, "Omega*_t't't'^++" },
+    1634             :       {      -8884, "Omega*_t't't'~^--" },
+    1635             :       {    9221132, "Theta^+" },
+    1636             :       {    9331122, "Phi^--" },
+    1637             :       {    1000993, "R_~gg^0" },
+    1638             :       {    1009113, "R_~gd~d^0" },
+    1639             :       {    1009213, "R_~gu~d^+" },
+    1640             :       {    1009223, "R_~gu~u^0" },
+    1641             :       {    1009313, "R_~gd~s^0" },
+    1642             :       {    1009323, "R_~gu~s^+" },
+    1643             :       {    1009333, "R_~gs~s^0" },
+    1644             :       {    1091114, "R_~gddd^-" },
+    1645             :       {    1092114, "R_~gudd^0" },
+    1646             :       {    1092214, "R_~guud^+" },
+    1647             :       {    1092224, "R_~guuu^++" },
+    1648             :       {    1093114, "R_~gsdd^-" },
+    1649             :       {    1093214, "R_~gsud^0" },
+    1650             :       {    1093224, "R_~gsuu^+" },
+    1651             :       {    1093314, "R_~gssd^-" },
+    1652             :       {    1093324, "R_~gssu^0" },
+    1653             :       {    1093334, "R_~gsss^-" },
+    1654             :       {    1000612, "R_~t_1~d^+" },
+    1655             :       {    1000622, "R_~t_1~u^0" },
+    1656             :       {    1000632, "R_~t_1~s^+" },
+    1657             :       {    1000642, "R_~t_1~c^0" },
+    1658             :       {    1000652, "R_~t_1~b^+" },
+    1659             :       {    1006113, "R_~t_1dd_1^0" },
+    1660             :       {    1006211, "R_~t_1ud_0^+" },
+    1661             :       {    1006213, "R_~t_1ud_1^+" },
+    1662             :       {    1006223, "R_~t_1uu_1^++" },
+    1663             :       {    1006311, "R_~t_1sd_0^0" },
+    1664             :       {    1006313, "R_~t_1sd_1^0" },
+    1665             :       {    1006321, "R_~t_1su_0^+" },
+    1666             :       {    1006323, "R_~t_1su_1^+" },
+    1667             :       {    1006333, "R_~t_1ss_1^0" },
+    1668             :       { 1000010010, "Hydrogen" },
+    1669             :       { 1000010020, "Deuterium" },
+    1670             :       {-1000010020, "Anti-Deuterium" },
+    1671             :       { 1000010030, "Tritium" },
+    1672             :       {-1000010030, "Anti-Tritium" },
+    1673             :       { 1000020030, "He3" },
+    1674             :       {-1000020030, "Anti-He3" },
+    1675             :       { 1000020040, "Alpha-(He4)" },
+    1676             :       {-1000020040, "Anti-Alpha-(He4)" }
+    1677             :   };
+    1678             : 
+    1679             :   int lnames = sizeof(SNames)/sizeof(SNames[0]);
+    1680           0 :   for( int k=0; k!=lnames; ++k) {
+    1681           0 :       m.insert( std::make_pair( SNames[k].pid, std::string(SNames[k].pname)) );
+    1682           0 :       nameMap.insert( std::make_pair( std::string(SNames[k].pname), SNames[k].pid ) );
+    1683             :   }
+    1684           0 :   static ParticleNameMap mymaps(m,nameMap);
+    1685             : 
+    1686           0 :   return mymaps;
+    1687             : }  // ParticleNameInit()
+    1688             : 
+    1689           0 : void writeParticleNameLine( int i, std::ostream & os  )
+    1690             : {
+    1691           0 :     if ( validParticleName( i ) ) {
+    1692           0 :         std::string pn = particleName( i );
+    1693           0 :         int pid = particleName( pn );
+    1694           0 :         os << " PDT number: " ;
+    1695           0 :         os.width(12);
+    1696           0 :         os << i << " PDT name: " << pn << std::endl;
+    1697             :         // verify reverse lookup
+    1698           0 :         if( pid != i ) {
+    1699             :             os << "HepPID::writeParticleNameLine ERROR: "
+    1700           0 :                << " got " << pid << " instead of " << i << std::endl;
+    1701             :         }
+    1702             :     }
+    1703           0 :     return;
+    1704             : }  // writeParticleNameLine()
+    1705             : 
+    1706           0 : std::string dyonName( const int & pid )
+    1707             : {
+    1708           0 :     std::ostringstream pn;
+    1709           0 :     pn << "Dyon^" << digit(nq1,pid) << digit(nq2,pid) << digit(nq3,pid);
+    1710           0 :     if ( digit(nl,pid) == 1 ) {
+    1711           0 :        if ( pid > 0 ) {
+    1712           0 :           pn << "++";
+    1713             :        } else {
+    1714           0 :           pn << "--";
+    1715             :        }
+    1716           0 :     } else if ( digit(nl,pid) == 2 ) {
+    1717           0 :        if ( pid > 0 ) {
+    1718           0 :           pn << "+-";
+    1719             :        } else {
+    1720           0 :           pn << "-+";
+    1721             :        }
+    1722             :     }
+    1723           0 :     return pn.str();
+    1724           0 : }
+    1725             : 
+    1726           0 : std::string qballName( const int & pid )
+    1727             : {
+    1728           0 :     std::ostringstream pn;
+    1729           0 :     pn << "QBall^" << ((abspid(pid)/100)%1000) << "." << digit(nq3,pid);
+    1730           0 :     if ( pid > 0 ) {
+    1731           0 :        pn << "+";
+    1732             :     } else {
+    1733           0 :        pn << "-";
+    1734             :     }
+    1735           0 :     return pn.str();
+    1736           0 : }
+    1737             : 
+    1738           0 : int  checkForSpecialParticle( const std::string & s )
+    1739             : {
+    1740             :     int chg, chg2, id;
+    1741             :     int m = 1;
+    1742           0 :     int len = s.length();
+    1743           0 :     if( s.substr(0,4) == "Dyon" ) {
+    1744           0 :        std::istringstream var1(s.substr(5,3).c_str());
+    1745           0 :        var1 >> chg;
+    1746           0 :        if( s.substr(len-2,1) == "+" && s.substr(len-1,1) == "-") m = 2;
+    1747           0 :        if( s.substr(len-2,1) == "-" && s.substr(len-1,1) == "+") m = 2;
+    1748           0 :        id = 4100000 + m*10000 + chg*10;
+    1749           0 :        if( s.substr(len-2,1) == "-" ) id = -id;
+    1750             :        return id;
+    1751           0 :     }
+    1752           0 :     if( s.substr(0,5) == "QBall" ) {
+    1753           0 :        int rem = len - 9;
+    1754           0 :        std::istringstream var2(s.substr(6,rem).c_str());
+    1755           0 :        var2 >> chg;
+    1756           0 :        std::istringstream var3(s.substr(7+rem,1).c_str());
+    1757           0 :        var3 >> chg2;
+    1758           0 :        id = 10000000 + chg*100+chg2*10;
+    1759           0 :        if( s.substr(len-1,1) == "-" ) id = -id;
+    1760             :        return id;
+    1761           0 :     }
+    1762             :     return 0;
+    1763             : }
+    1764             : 
+    1765             : } // unnamed namespace
+    1766             : 
+    1767             : //
+    1768             : // getPartcleIdMap is the ONLY function allowed to call ParticleNameInit
+    1769             : //
+    1770           0 : ParticleNameMap const &  getParticleNameMap()
+    1771             : {
+    1772           0 :   static  ParticleNameMap const &  pmap = ParticleNameInit();
+    1773           0 :   return pmap;
+    1774             : }  // getPartcleIdMap()
+    1775             : 
+    1776           0 : bool validParticleName( const int & pid )
+    1777             : {
+    1778             :     // check for the special cases first
+    1779           0 :     if ( isDyon(pid) ) return true;
+    1780           0 :     if ( isQBall(pid) ) return true;
+    1781             :     
+    1782           0 :     static  ParticleNameMap const &  pmap = getParticleNameMap();
+    1783             : 
+    1784           0 :     ParticleNameMap::idIterator const cit = pmap.find( pid );
+    1785             :     return ( cit == pmap.end() )
+    1786           0 :          ? false
+    1787             :          : true;
+    1788             : }  // validParticleName()
+    1789             : 
+    1790           0 : bool validParticleName( const std::string & s )
+    1791             : {
+    1792           0 :     static  ParticleNameMap const &  pmap = getParticleNameMap();
+    1793           0 :     ParticleNameMap::nameIterator const cit = pmap.findString( s );
+    1794             :     return ( cit == pmap.endLookupMap() )
+    1795           0 :          ? false
+    1796           0 :          : true;
+    1797             : }  // validParticleName()
+    1798             : 
+    1799           0 : std::string  particleName( const int & pid )
+    1800             : {
+    1801             :     // check for the special cases first
+    1802           0 :     if ( isDyon(pid) ) return dyonName(pid);
+    1803           0 :     if ( isQBall(pid) ) return qballName(pid);
+    1804             :     
+    1805           0 :     static  ParticleNameMap const &  pmap = getParticleNameMap();
+    1806             : 
+    1807           0 :     ParticleNameMap::idIterator const cit = pmap.find( pid );
+    1808             :     return ( cit == pmap.end() )
+    1809             :          ? std::string("not defined")
+    1810           0 :          : cit->second;
+    1811             : }  // particleName()
+    1812             : 
+    1813           0 : int  particleName( const std::string & s )
+    1814             : {
+    1815           0 :     static  ParticleNameMap const &  pmap = getParticleNameMap();
+    1816           0 :     ParticleNameMap::nameIterator const cit = pmap.findString( s );
+    1817             :     return ( cit == pmap.endLookupMap() )
+    1818           0 :          ? checkForSpecialParticle(s)
+    1819           0 :          : cit->second;
+    1820             : }  // particleName()
+    1821             : 
+    1822             : //
+    1823             : // list all the defined names
+    1824             : //
+    1825           0 : void  listParticleNames( std::ostream & os  )
+    1826             : {
+    1827           0 :     writeVersion( os );
+    1828             :     os << "     HepPID Particle List" << std::endl;
+    1829             :     os << std::endl;
+    1830             : 
+    1831             :     // simple: static  PartcleIdMap const &  pmap = getPartcleIdMap();
+    1832             :     // simple: for( PartcleIdMap::const_iterator cit = pmap.begin(), mend = pmap.end(); 
+    1833             :     // simple:                                 cit != mend;
+    1834             :         // simple:                        ++cit ) {
+    1835             :         // simple: os << "  PDT number: " ;
+    1836             :         // simple: os.width(12);
+    1837             :         // simple: os << cit->first << "  PDT name: " << cit->second << std::endl;
+    1838             :     // simple: }
+    1839             :     int id, i, j, q1, q2, q3, l, m, n;
+    1840             :     // special cases
+    1841           0 :     for( id=1; id<101; ++id) {
+    1842           0 :         writeParticleNameLine(  id, os );
+    1843           0 :         writeParticleNameLine( -id, os );
+    1844             :     }
+    1845           0 :     for( i=11; i<1000; ++i) {
+    1846           0 :         id = i*10;
+    1847           0 :         writeParticleNameLine(  id, os );
+    1848           0 :         writeParticleNameLine( -id, os );
+    1849             :     }
+    1850             :     // SUSY
+    1851           0 :     for( n=1; n<3; ++n) {
+    1852           0 :         for( q1=0; q1<10; ++q1) {
+    1853           0 :             for( j=0; j<10; ++j) {
+    1854           0 :                 id = 1000000*n+10*q1+j;
+    1855           0 :                 writeParticleNameLine(  id, os );
+    1856           0 :                 writeParticleNameLine( -id, os );
+    1857             :             }
+    1858             :         }
+    1859             :     }
+    1860             :     // technicolor, etc.
+    1861           0 :     for( n=3; n<7; ++n) {
+    1862           0 :         for( q2=0; q2<10; ++q2) {
+    1863           0 :             for( q1=0; q1<10; ++q1) {
+    1864           0 :                 for( j=0; j<10; ++j) {
+    1865           0 :                     for( m=0; m<10; ++m) {
+    1866           0 :                         for( l=0; l<7; ++l) {
+    1867           0 :                             id = 1000000*n+100000*m+10000*l+100*q2+10*q1+j;
+    1868             :                             // save dyons for later
+    1869           0 :                             if( !(n == 4 && m == 1) ) {
+    1870           0 :                             writeParticleNameLine(  id, os );
+    1871           0 :                             writeParticleNameLine( -id, os );
+    1872             :                             }
+    1873             :                         }
+    1874             :                     }
+    1875             :                 }
+    1876             :             }
+    1877             :         }
+    1878             :     }
+    1879             :     // R-hadrons
+    1880           0 :     for( q3=0; q3<10; ++q3) {
+    1881           0 :         for( q2=1; q2<10; ++q2) {
+    1882           0 :             for( q1=1; q1<10; ++q1) {
+    1883           0 :                 for( j=1; j<5; ++j) {
+    1884           0 :                     id = 1000000+1000*q3+100*q2+10*q1+j;
+    1885           0 :                     writeParticleNameLine( id, os );
+    1886           0 :                     if(q3 > 0 ) id = 1000000+90000+1000*q3+100*q2+10*q1+j;
+    1887           0 :                     writeParticleNameLine( id, os );
+    1888             :                 }
+    1889             :             }
+    1890             :         }
+    1891             :     }
+    1892             :     // miscellaneous generator particles
+    1893           0 :     for( l=0; l<9; ++l) {
+    1894           0 :         for( i=1; i<100; ++i) {
+    1895           0 :             id = 9900000+10000*l+i;
+    1896           0 :             writeParticleNameLine(  id, os );
+    1897           0 :             writeParticleNameLine( -id, os );
+    1898             :         }
+    1899           0 :         for( q3=0; q3<10; ++q3) {
+    1900           0 :             for( q2=1; q2<10; ++q2) {
+    1901           0 :                 for( q1=1; q1<10; ++q1) {
+    1902           0 :                     for( j=0; j<10; ++j) {
+    1903           0 :                         id = 9900000+10000*l+1000*q3+100*q2+10*q1+j;
+    1904           0 :                         writeParticleNameLine(  id, os );
+    1905           0 :                         writeParticleNameLine( -id, os );
+    1906             :                     }
+    1907             :                 }
+    1908             :             }
+    1909             :         }
+    1910             :     }
+    1911             :     // diquark
+    1912           0 :     for( i=11; i<100; ++i) {
+    1913           0 :         for( j=0; j<10; ++j) {
+    1914           0 :             id = 100*i+j;
+    1915           0 :             writeParticleNameLine(  id, os );
+    1916           0 :             writeParticleNameLine( -id, os );
+    1917             :         }
+    1918             :     }
+    1919             :     // mesons
+    1920           0 :     for( q2=1; q2<10; ++q2) {
+    1921           0 :         for( q1=1; q1<10; ++q1) {
+    1922           0 :             for( j=1; j<10; ++j) {
+    1923           0 :                 for( m=0; m<9; ++m) {
+    1924           0 :                     for( l=0; l<10; ++l) {
+    1925           0 :                         id = 100000*m+10000*l+100*q2+10*q1+j;
+    1926           0 :                         writeParticleNameLine(  id, os );
+    1927           0 :                         writeParticleNameLine( -id, os );
+    1928           0 :                         id = 9000000+100000*m+10000*l+100*q2+10*q1+j;
+    1929           0 :                         writeParticleNameLine(  id, os );
+    1930           0 :                         writeParticleNameLine( -id, os );
+    1931             :                     }
+    1932             :                 }
+    1933             :             }
+    1934             :         }
+    1935             :     }
+    1936             :     // baryons
+    1937           0 :     for( q3=1; q3<10; ++q3) {
+    1938           0 :         for( q2=1; q2<10; ++q2) {
+    1939           0 :             for( q1=1; q1<10; ++q1) {
+    1940           0 :                 for( j=1; j<10; ++j) {
+    1941           0 :                     for( m=0; m<9; ++m) {
+    1942           0 :                         id = 10000*m+1000*q3+100*q2+10*q1+j;
+    1943           0 :                         writeParticleNameLine(  id, os );
+    1944           0 :                         writeParticleNameLine( -id, os );
+    1945             :                     }
+    1946             :                 }
+    1947             :             }
+    1948             :         }
+    1949             :     }
+    1950             :     // pentaquarks
+    1951           0 :     for( l=1; l<9; ++l ) {
+    1952           0 :         for ( m=1; m<9; ++m ) {
+    1953           0 :             for( q3=1; q3<9; ++q3) {
+    1954           0 :                 for( q2=1; q2<9; ++q2) {
+    1955           0 :                     for( q1=1; q1<9; ++q1) {
+    1956           0 :                         id = 9*1000000+l*100000+m*10000+1000*q3+100*q2+10*q1+2;
+    1957           0 :                         writeParticleNameLine(  id, os );
+    1958           0 :                         writeParticleNameLine( -id, os );
+    1959             :                     }
+    1960             :                 }
+    1961             :             }
+    1962             :         }
+    1963             :     }
+    1964             :     // ions
+    1965           0 :     for( i=1; i<3; ++i) {
+    1966           0 :         for( m=1; m<5; ++m) {
+    1967           0 :                 id = 1000000000+10*m+10000*i;
+    1968           0 :                 writeParticleNameLine(  id, os );
+    1969           0 :                 writeParticleNameLine( -id, os );
+    1970             :         }
+    1971             :     }
+    1972             :     // some Dyons
+    1973           0 :     for( q3=0; q3<2; ++q3) {
+    1974           0 :         for( q2=0; q2<4; ++q2) {
+    1975           0 :             for( q1=0; q1<10; ++q1) {
+    1976           0 :                 ++q1;
+    1977           0 :                 id = 4110000+1000*q3+100*q2+10*q1;
+    1978           0 :                 writeParticleNameLine(  id, os );
+    1979           0 :                 writeParticleNameLine( -id, os );
+    1980           0 :                 id = 4120000+1000*q3+100*q2+10*q1;
+    1981           0 :                 writeParticleNameLine(  id, os );
+    1982           0 :                 writeParticleNameLine( -id, os );
+    1983             :             }
+    1984             :         }
+    1985             :     }
+    1986             :     // a few QBalls
+    1987           0 :     for( i=1; i<199; ++i ) {
+    1988           0 :         for( m=1; m<10; ) {
+    1989           0 :                 id = 10000000+10*m+100*i;
+    1990           0 :                 writeParticleNameLine(  id, os );
+    1991           0 :                 writeParticleNameLine( -id, os );
+    1992           0 :                 m += 3;
+    1993             :         }
+    1994             :         i += 11;
+    1995             :     }
+    1996           0 :     return;
+    1997             : }  // listParticleNames()
+    1998             : 
+    1999             : }       // HepPID
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/HepPID/src/Version.cc.func-sort-c.html b/doc/coverageReport/libs/HepPID/src/Version.cc.func-sort-c.html new file mode 100644 index 000000000..65c9d6164 --- /dev/null +++ b/doc/coverageReport/libs/HepPID/src/Version.cc.func-sort-c.html @@ -0,0 +1,84 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/HepPID/src/Version.cc - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/HepPID/src - Version.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:080.0 %
Date:2024-04-08 14:58:22Functions:030.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN6HepPID11versionNameB5cxx11Ev0
_ZN6HepPID12writeVersionERSo0
_ZN6HepPID7versionEv0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/HepPID/src/Version.cc.func.html b/doc/coverageReport/libs/HepPID/src/Version.cc.func.html new file mode 100644 index 000000000..0a0efae49 --- /dev/null +++ b/doc/coverageReport/libs/HepPID/src/Version.cc.func.html @@ -0,0 +1,84 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/HepPID/src/Version.cc - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/HepPID/src - Version.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:080.0 %
Date:2024-04-08 14:58:22Functions:030.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN6HepPID11versionNameB5cxx11Ev0
_ZN6HepPID12writeVersionERSo0
_ZN6HepPID7versionEv0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/HepPID/src/Version.cc.gcov.html b/doc/coverageReport/libs/HepPID/src/Version.cc.gcov.html new file mode 100644 index 000000000..1d5d7f616 --- /dev/null +++ b/doc/coverageReport/libs/HepPID/src/Version.cc.gcov.html @@ -0,0 +1,106 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/HepPID/src/Version.cc + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/HepPID/src - Version.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:080.0 %
Date:2024-04-08 14:58:22Functions:030.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : // ----------------------------------------------------------------------
+       2             : //
+       3             : // version.cc
+       4             : // Author: Lynn Garren
+       5             : //
+       6             : //  for now, this is a free function
+       7             : //
+       8             : // ----------------------------------------------------------------------
+       9             : 
+      10             : #include "HepPID/Version.hh"
+      11             : 
+      12             : namespace HepPID {
+      13             : 
+      14           0 : std::string versionName( )
+      15             : {
+      16           0 :     return "3.04.01";
+      17             : }
+      18             : 
+      19           0 : void version( )
+      20             : {
+      21           0 :     std::cout << " --------------- HepPID Version " << versionName()
+      22             :               << " --------------- " << std::endl;
+      23           0 : }
+      24             : 
+      25           0 : void writeVersion( std::ostream & os )
+      26             : {
+      27           0 :     os << "             HepPID Version: " << versionName() << std::endl;
+      28           0 : }
+      29             : 
+      30             : }       // HepPID
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/HepPID/src/index-sort-f.html b/doc/coverageReport/libs/HepPID/src/index-sort-f.html new file mode 100644 index 000000000..0bc408cce --- /dev/null +++ b/doc/coverageReport/libs/HepPID/src/index-sort-f.html @@ -0,0 +1,113 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/HepPID/src + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/HepPID/srcHitTotalCoverage
Test:coverage.info.cleanedLines:5044011.4 %
Date:2024-04-08 14:58:22Functions:114822.9 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Version.cc +
0.0%
+
0.0 %0 / 80.0 %0 / 3
ParticleName.cc +
0.0%
+
0.0 %0 / 1830.0 %0 / 13
ParticleIDMethods.cc +
20.1%20.1%
+
20.1 %50 / 24934.4 %11 / 32
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/HepPID/src/index-sort-l.html b/doc/coverageReport/libs/HepPID/src/index-sort-l.html new file mode 100644 index 000000000..5545aaf67 --- /dev/null +++ b/doc/coverageReport/libs/HepPID/src/index-sort-l.html @@ -0,0 +1,113 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/HepPID/src + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/HepPID/srcHitTotalCoverage
Test:coverage.info.cleanedLines:5044011.4 %
Date:2024-04-08 14:58:22Functions:114822.9 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Version.cc +
0.0%
+
0.0 %0 / 80.0 %0 / 3
ParticleName.cc +
0.0%
+
0.0 %0 / 1830.0 %0 / 13
ParticleIDMethods.cc +
20.1%20.1%
+
20.1 %50 / 24934.4 %11 / 32
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/HepPID/src/index.html b/doc/coverageReport/libs/HepPID/src/index.html new file mode 100644 index 000000000..cce8733cc --- /dev/null +++ b/doc/coverageReport/libs/HepPID/src/index.html @@ -0,0 +1,113 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/HepPID/src + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/HepPID/srcHitTotalCoverage
Test:coverage.info.cleanedLines:5044011.4 %
Date:2024-04-08 14:58:22Functions:114822.9 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
ParticleIDMethods.cc +
20.1%20.1%
+
20.1 %50 / 24934.4 %11 / 32
ParticleName.cc +
0.0%
+
0.0 %0 / 1830.0 %0 / 13
Version.cc +
0.0%
+
0.0 %0 / 80.0 %0 / 3
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/error_handling.cc.func-sort-c.html b/doc/coverageReport/libs/healpix_base/error_handling.cc.func-sort-c.html new file mode 100644 index 000000000..48630a2e2 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/error_handling.cc.func-sort-c.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/error_handling.cc - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base - error_handling.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0120.0 %
Date:2024-04-08 14:58:22Functions:070.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix11PlanckErrorC2EPKc0
_ZN7healpix11PlanckErrorC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7healpix11PlanckErrorD0Ev0
_ZN7healpix11PlanckErrorD2Ev0
_ZN7healpix16planck_failure__EPKciS1_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7healpix16planck_failure__EPKciS1_S1_0
_ZN7healpix9killjob__Ev0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/error_handling.cc.func.html b/doc/coverageReport/libs/healpix_base/error_handling.cc.func.html new file mode 100644 index 000000000..3f1abe29a --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/error_handling.cc.func.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/error_handling.cc - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base - error_handling.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0120.0 %
Date:2024-04-08 14:58:22Functions:070.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix11PlanckErrorC2EPKc0
_ZN7healpix11PlanckErrorC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7healpix11PlanckErrorD0Ev0
_ZN7healpix11PlanckErrorD2Ev0
_ZN7healpix16planck_failure__EPKciS1_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7healpix16planck_failure__EPKciS1_S1_0
_ZN7healpix9killjob__Ev0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/error_handling.cc.gcov.html b/doc/coverageReport/libs/healpix_base/error_handling.cc.gcov.html new file mode 100644 index 000000000..d09b41e69 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/error_handling.cc.gcov.html @@ -0,0 +1,136 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/error_handling.cc + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base - error_handling.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0120.0 %
Date:2024-04-08 14:58:22Functions:070.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : 
+       2             : /*
+       3             :  *  This file is part of libcxxsupport.
+       4             :  *
+       5             :  *  libcxxsupport is free software; you can redistribute it and/or modify
+       6             :  *  it under the terms of the GNU General Public License as published by
+       7             :  *  the Free Software Foundation; either version 2 of the License, or
+       8             :  *  (at your option) any later version.
+       9             :  *
+      10             :  *  libcxxsupport is distributed in the hope that it will be useful,
+      11             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+      12             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+      13             :  *  GNU General Public License for more details.
+      14             :  *
+      15             :  *  You should have received a copy of the GNU General Public License
+      16             :  *  along with libcxxsupport; if not, write to the Free Software
+      17             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+      18             :  */
+      19             : 
+      20             : /*
+      21             :  *  libcxxsupport is being developed at the Max-Planck-Institut fuer Astrophysik
+      22             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
+      23             :  *  (DLR).
+      24             :  */
+      25             : 
+      26             : /*
+      27             :  *  Utilities for error reporting
+      28             :  *
+      29             :  *  Copyright (C) 2003-2011 Max-Planck-Society
+      30             :  *  Author: Martin Reinecke
+      31             :  */
+      32             : 
+      33             : #include "healpix_base/error_handling.h"
+      34             : 
+      35             : namespace healpix{
+      36             : using namespace std;
+      37             : 
+      38           0 : PlanckError::PlanckError(const string &message) : msg (message) {}
+      39           0 : PlanckError::PlanckError(const char *message) : msg (message) {}
+      40             : 
+      41             : //virtual
+      42           0 : PlanckError::~PlanckError() {}
+      43             : 
+      44           0 : void planck_failure__(const char *file, int line, const char *func,
+      45             :   const string &msg)
+      46             :   {
+      47           0 :   cerr << "Error encountered at " << file << ", line " << line << endl;
+      48           0 :   if (func) cerr << "(function " << func << ")" << endl;
+      49           0 :   if (msg!="") cerr << endl << msg << endl;
+      50             :   cerr << endl;
+      51           0 :   }
+      52             : 
+      53           0 : void planck_failure__(const char *file, int line, const char *func,
+      54             :   const char *msg)
+      55           0 :   { planck_failure__ (file,line,func,string(msg)); }
+      56             : 
+      57           0 : void killjob__()
+      58           0 :   { throw; }
+      59             : } // namespace healpix
+      60             : 
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/geom_utils.cc.func-sort-c.html b/doc/coverageReport/libs/healpix_base/geom_utils.cc.func-sort-c.html new file mode 100644 index 000000000..c1777f967 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/geom_utils.cc.func-sort-c.html @@ -0,0 +1,84 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/geom_utils.cc - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base - geom_utils.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0250.0 %
Date:2024-04-08 14:58:22Functions:030.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix10get_circleERKNS_3arrINS_6vec3_tIdEEEEmRS2_Rd0
_ZN7healpix10get_circleERKNS_3arrINS_6vec3_tIdEEEEmmRS2_Rd0
_ZN7healpix21find_enclosing_circleERKNS_3arrINS_6vec3_tIdEEEERS2_Rd0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/geom_utils.cc.func.html b/doc/coverageReport/libs/healpix_base/geom_utils.cc.func.html new file mode 100644 index 000000000..db584b322 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/geom_utils.cc.func.html @@ -0,0 +1,84 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/geom_utils.cc - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base - geom_utils.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0250.0 %
Date:2024-04-08 14:58:22Functions:030.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix10get_circleERKNS_3arrINS_6vec3_tIdEEEEmRS2_Rd0
_ZN7healpix10get_circleERKNS_3arrINS_6vec3_tIdEEEEmmRS2_Rd0
_ZN7healpix21find_enclosing_circleERKNS_3arrINS_6vec3_tIdEEEERS2_Rd0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/geom_utils.cc.gcov.html b/doc/coverageReport/libs/healpix_base/geom_utils.cc.gcov.html new file mode 100644 index 000000000..2fdacf966 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/geom_utils.cc.gcov.html @@ -0,0 +1,151 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/geom_utils.cc + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base - geom_utils.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0250.0 %
Date:2024-04-08 14:58:22Functions:030.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : /*
+       2             :  *  This file is part of libcxxsupport.
+       3             :  *
+       4             :  *  libcxxsupport is free software; you can redistribute it and/or modify
+       5             :  *  it under the terms of the GNU General Public License as published by
+       6             :  *  the Free Software Foundation; either version 2 of the License, or
+       7             :  *  (at your option) any later version.
+       8             :  *
+       9             :  *  libcxxsupport is distributed in the hope that it will be useful,
+      10             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+      11             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+      12             :  *  GNU General Public License for more details.
+      13             :  *
+      14             :  *  You should have received a copy of the GNU General Public License
+      15             :  *  along with libcxxsupport; if not, write to the Free Software
+      16             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+      17             :  */
+      18             : 
+      19             : /*
+      20             :  *  libcxxsupport is being developed at the Max-Planck-Institut fuer Astrophysik
+      21             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
+      22             :  *  (DLR).
+      23             :  */
+      24             : 
+      25             : /*
+      26             :  *  Copyright (C) 2011 Max-Planck-Society
+      27             :  *  \author Martin Reinecke
+      28             :  */
+      29             : 
+      30             : #include "healpix_base/geom_utils.h"
+      31             : #include "healpix_base/arr.h"
+      32             : 
+      33             : 
+      34             : namespace healpix{
+      35             : using namespace std;
+      36             : 
+      37             : 
+      38           0 : void get_circle (const arr<vec3> &point, tsize q1, tsize q2, vec3 &center,
+      39             :   double &cosrad)
+      40             :   {
+      41           0 :   center = (point[q1]+point[q2]).Norm();
+      42           0 :   cosrad = dotprod(point[q1],center);
+      43           0 :   for (tsize i=0; i<q1; ++i)
+      44           0 :     if (dotprod(point[i],center)<cosrad) // point outside the current circle
+      45             :       {
+      46           0 :       center=crossprod(point[q1]-point[i],point[q2]-point[i]).Norm();
+      47           0 :       cosrad=dotprod(point[i],center);
+      48           0 :       if (cosrad<0)
+      49           0 :         { center.Flip(); cosrad=-cosrad; }
+      50             :       }
+      51           0 :   }
+      52           0 : void get_circle (const arr<vec3> &point, tsize q, vec3 &center,
+      53             :   double &cosrad)
+      54             :   {
+      55           0 :   center = (point[0]+point[q]).Norm();
+      56           0 :   cosrad = dotprod(point[0],center);
+      57           0 :   for (tsize i=1; i<q; ++i)
+      58           0 :     if (dotprod(point[i],center)<cosrad) // point outside the current circle
+      59           0 :       get_circle(point,i,q,center,cosrad);
+      60           0 :   }
+      61             : 
+      62             : 
+      63           0 : void find_enclosing_circle (const arr<vec3> &point, vec3 &center,
+      64             :   double &cosrad)
+      65             :   {
+      66             :   tsize np=point.size();
+      67           0 :   planck_assert(np>=3,"too few points");
+      68           0 :   center = (point[0]+point[1]).Norm();
+      69           0 :   cosrad = dotprod(point[0],center);
+      70           0 :   for (tsize i=2; i<np; ++i)
+      71           0 :     if (dotprod(point[i],center)<cosrad) // point outside the current circle
+      72           0 :       get_circle(point,i,center,cosrad);
+      73           0 :   }
+      74             : } // namespace healpix
+      75             : 
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/healpix_base.cc.func-sort-c.html b/doc/coverageReport/libs/healpix_base/healpix_base.cc.func-sort-c.html new file mode 100644 index 000000000..522a3b809 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/healpix_base.cc.func-sort-c.html @@ -0,0 +1,436 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/healpix_base.cc - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base - healpix_base.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11273415.3 %
Date:2024-04-08 14:58:22Functions:109111.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix12_GLOBAL__N_111check_pixelIiiEEviiiiRNS_8rangesetIT0_EET_RSt6vectorISt4pairIS6_iESaIS9_EEbRi0
_ZN7healpix12_GLOBAL__N_111check_pixelIliEEviiiiRNS_8rangesetIT0_EET_RSt6vectorISt4pairIS6_iESaIS9_EEbRi0
_ZN7healpix12_GLOBAL__N_111check_pixelIllEEviiiiRNS_8rangesetIT0_EET_RSt6vectorISt4pairIS6_iESaIS9_EEbRi0
_ZN7healpix12_GLOBAL__N_116check_pixel_ringIiEEbRKNS_14T_Healpix_BaseIT_EES6_S3_S3_S3_idddS3_0
_ZN7healpix12_GLOBAL__N_116check_pixel_ringIlEEbRKNS_14T_Healpix_BaseIT_EES6_S3_S3_S3_idddS3_0
_ZN7healpix12_GLOBAL__N_19locToVec3Edddb0
_ZN7healpix14T_Healpix_BaseIiE10npix2nsideEi0
_ZN7healpix14T_Healpix_BaseIiE11nside2orderEi0
_ZN7healpix14T_Healpix_BaseIiE4swapERS1_0
_ZN7healpix14T_Healpix_BaseIiE8SetNsideEiNS_23Healpix_Ordering_SchemeE0
_ZN7healpix14T_Healpix_BaseIiEC2Ev0
_ZN7healpix14T_Healpix_BaseIlE10npix2nsideEl0
_ZN7healpix14T_Healpix_BaseIlE11nside2orderEl0
_ZN7healpix14T_Healpix_BaseIlE4swapERS1_0
_ZN7healpix14T_Healpix_BaseIlE8SetNsideElNS_23Healpix_Ordering_SchemeE0
_ZN7healpix14T_Healpix_BaseIlEC2Ev0
_ZNK7healpix14T_Healpix_BaseIiE10boundariesEimRSt6vectorINS_6vec3_tIdEESaIS4_EE0
_ZNK7healpix14T_Healpix_BaseIiE10max_pixradEi0
_ZNK7healpix14T_Healpix_BaseIiE10max_pixradEv0
_ZNK7healpix14T_Healpix_BaseIiE10nest2peanoEi0
_ZNK7healpix14T_Healpix_BaseIiE10peano2nestEi0
_ZNK7healpix14T_Healpix_BaseIiE10query_discENS_8pointingEdRNS_8rangesetIiEE0
_ZNK7healpix14T_Healpix_BaseIiE10ring_aboveEd0
_ZNK7healpix14T_Healpix_BaseIiE11query_stripEddbRNS_8rangesetIiEE0
_ZNK7healpix14T_Healpix_BaseIiE11swap_cyclesEv0
_ZNK7healpix14T_Healpix_BaseIiE12get_interpolERKNS_8pointingERNS_7fix_arrIiLm4EEERNS5_IdLm4EEE0
_ZNK7healpix14T_Healpix_BaseIiE13get_ring_infoEiRiS2_RdS3_Rb0
_ZNK7healpix14T_Healpix_BaseIiE13query_polygonERKSt6vectorINS_8pointingESaIS3_EERNS_8rangesetIiEE0
_ZNK7healpix14T_Healpix_BaseIiE14get_ring_info2EiRiS2_RdRb0
_ZNK7healpix14T_Healpix_BaseIiE15query_multidiscIiEEvRKNS_3arrINS_6vec3_tIdEEEERKNS3_IdEEiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIiE17nest_peano_helperEii0
_ZNK7healpix14T_Healpix_BaseIiE19get_ring_info_smallEiRiS2_Rb0
_ZNK7healpix14T_Healpix_BaseIiE19query_disc_internalIiEEvNS_8pointingEdiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIiE20query_disc_inclusiveENS_8pointingEdRNS_8rangesetIiEEi0
_ZNK7healpix14T_Healpix_BaseIiE20query_strip_internalEddbRNS_8rangesetIiEE0
_ZNK7healpix14T_Healpix_BaseIiE22query_polygon_internalIiEEvRKSt6vectorINS_8pointingESaIS4_EEiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIiE23query_multidisc_generalERKNS_3arrINS_6vec3_tIdEEEERKNS2_IdEEbRKSt6vectorIiSaIiEERNS_8rangesetIiEE0
_ZNK7healpix14T_Healpix_BaseIiE23query_polygon_inclusiveERKSt6vectorINS_8pointingESaIS3_EERNS_8rangesetIiEEi0
_ZNK7healpix14T_Healpix_BaseIiE6ring2zEi0
_ZNK7healpix14T_Healpix_BaseIiE7xyf2locEddiRdS2_S2_Rb0
_ZNK7healpix14T_Healpix_BaseIiE8nest2xyfEiRiS2_S2_0
_ZNK7healpix14T_Healpix_BaseIiE8pix2ringEi0
_ZNK7healpix14T_Healpix_BaseIiE8xyf2ringEiii0
_ZNK7healpix14T_Healpix_BaseIiE9neighborsEiRNS_7fix_arrIiLm8EEE0
_ZNK7healpix14T_Healpix_BaseIiE9nest2ringEi0
_ZNK7healpix14T_Healpix_BaseIlE10boundariesElmRSt6vectorINS_6vec3_tIdEESaIS4_EE0
_ZNK7healpix14T_Healpix_BaseIlE10max_pixradEl0
_ZNK7healpix14T_Healpix_BaseIlE10max_pixradEv0
_ZNK7healpix14T_Healpix_BaseIlE10nest2peanoEl0
_ZNK7healpix14T_Healpix_BaseIlE10peano2nestEl0
_ZNK7healpix14T_Healpix_BaseIlE10query_discENS_8pointingEdRNS_8rangesetIlEE0
_ZNK7healpix14T_Healpix_BaseIlE10ring_aboveEd0
_ZNK7healpix14T_Healpix_BaseIlE11query_stripEddbRNS_8rangesetIlEE0
_ZNK7healpix14T_Healpix_BaseIlE11spread_bitsEi0
_ZNK7healpix14T_Healpix_BaseIlE11swap_cyclesEv0
_ZNK7healpix14T_Healpix_BaseIlE12get_interpolERKNS_8pointingERNS_7fix_arrIlLm4EEERNS5_IdLm4EEE0
_ZNK7healpix14T_Healpix_BaseIlE13get_ring_infoElRlS2_RdS3_Rb0
_ZNK7healpix14T_Healpix_BaseIlE13query_polygonERKSt6vectorINS_8pointingESaIS3_EERNS_8rangesetIlEE0
_ZNK7healpix14T_Healpix_BaseIlE14get_ring_info2ElRlS2_RdRb0
_ZNK7healpix14T_Healpix_BaseIlE15query_multidiscIiEEvRKNS_3arrINS_6vec3_tIdEEEERKNS3_IdEEiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIlE15query_multidiscIlEEvRKNS_3arrINS_6vec3_tIdEEEERKNS3_IdEEiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIlE17nest_peano_helperEli0
_ZNK7healpix14T_Healpix_BaseIlE19get_ring_info_smallElRlS2_Rb0
_ZNK7healpix14T_Healpix_BaseIlE19query_disc_internalIiEEvNS_8pointingEdiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIlE19query_disc_internalIlEEvNS_8pointingEdiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIlE20query_disc_inclusiveENS_8pointingEdRNS_8rangesetIlEEi0
_ZNK7healpix14T_Healpix_BaseIlE20query_strip_internalEddbRNS_8rangesetIlEE0
_ZNK7healpix14T_Healpix_BaseIlE22query_polygon_internalIiEEvRKSt6vectorINS_8pointingESaIS4_EEiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIlE22query_polygon_internalIlEEvRKSt6vectorINS_8pointingESaIS4_EEiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIlE23query_multidisc_generalERKNS_3arrINS_6vec3_tIdEEEERKNS2_IdEEbRKSt6vectorIiSaIiEERNS_8rangesetIlEE0
_ZNK7healpix14T_Healpix_BaseIlE23query_polygon_inclusiveERKSt6vectorINS_8pointingESaIS3_EERNS_8rangesetIlEEi0
_ZNK7healpix14T_Healpix_BaseIlE6ring2zEl0
_ZNK7healpix14T_Healpix_BaseIlE7loc2pixEdddb0
_ZNK7healpix14T_Healpix_BaseIlE7xyf2locEddiRdS2_S2_Rb0
_ZNK7healpix14T_Healpix_BaseIlE8pix2ringEl0
_ZNK7healpix14T_Healpix_BaseIlE8ring2xyfElRiS2_S2_0
_ZNK7healpix14T_Healpix_BaseIlE8xyf2nestEiii0
_ZNK7healpix14T_Healpix_BaseIlE8xyf2ringEiii0
_ZNK7healpix14T_Healpix_BaseIlE9neighborsElRNS_7fix_arrIlLm8EEE0
_ZNK7healpix14T_Healpix_BaseIlE9nest2ringEl0
_ZNK7healpix14T_Healpix_BaseIlE9ring2nestEl0
_ZN7healpix14T_Healpix_BaseIiE3SetEiNS_23Healpix_Ordering_SchemeE10
_ZN7healpix14T_Healpix_BaseIlE3SetEiNS_23Healpix_Ordering_SchemeE19
_ZNK7healpix14T_Healpix_BaseIiE8ring2xyfEiRiS2_S2_421
_ZNK7healpix14T_Healpix_BaseIiE8xyf2nestEiii421
_ZNK7healpix14T_Healpix_BaseIiE9ring2nestEi421
_ZNK7healpix14T_Healpix_BaseIlE7pix2locElRdS2_S2_Rb421
_ZNK7healpix14T_Healpix_BaseIlE8nest2xyfElRiS2_S2_421
_ZNK7healpix14T_Healpix_BaseIlE13compress_bitsEl842
_ZNK7healpix14T_Healpix_BaseIiE7loc2pixEdddb24585
_ZNK7healpix14T_Healpix_BaseIiE7pix2locEiRdS2_S2_Rb135172
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/healpix_base.cc.func.html b/doc/coverageReport/libs/healpix_base/healpix_base.cc.func.html new file mode 100644 index 000000000..30c46e124 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/healpix_base.cc.func.html @@ -0,0 +1,436 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/healpix_base.cc - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base - healpix_base.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11273415.3 %
Date:2024-04-08 14:58:22Functions:109111.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix12_GLOBAL__N_111check_pixelIiiEEviiiiRNS_8rangesetIT0_EET_RSt6vectorISt4pairIS6_iESaIS9_EEbRi0
_ZN7healpix12_GLOBAL__N_111check_pixelIliEEviiiiRNS_8rangesetIT0_EET_RSt6vectorISt4pairIS6_iESaIS9_EEbRi0
_ZN7healpix12_GLOBAL__N_111check_pixelIllEEviiiiRNS_8rangesetIT0_EET_RSt6vectorISt4pairIS6_iESaIS9_EEbRi0
_ZN7healpix12_GLOBAL__N_116check_pixel_ringIiEEbRKNS_14T_Healpix_BaseIT_EES6_S3_S3_S3_idddS3_0
_ZN7healpix12_GLOBAL__N_116check_pixel_ringIlEEbRKNS_14T_Healpix_BaseIT_EES6_S3_S3_S3_idddS3_0
_ZN7healpix12_GLOBAL__N_19locToVec3Edddb0
_ZN7healpix14T_Healpix_BaseIiE10npix2nsideEi0
_ZN7healpix14T_Healpix_BaseIiE11nside2orderEi0
_ZN7healpix14T_Healpix_BaseIiE3SetEiNS_23Healpix_Ordering_SchemeE10
_ZN7healpix14T_Healpix_BaseIiE4swapERS1_0
_ZN7healpix14T_Healpix_BaseIiE8SetNsideEiNS_23Healpix_Ordering_SchemeE0
_ZN7healpix14T_Healpix_BaseIiEC2Ev0
_ZN7healpix14T_Healpix_BaseIlE10npix2nsideEl0
_ZN7healpix14T_Healpix_BaseIlE11nside2orderEl0
_ZN7healpix14T_Healpix_BaseIlE3SetEiNS_23Healpix_Ordering_SchemeE19
_ZN7healpix14T_Healpix_BaseIlE4swapERS1_0
_ZN7healpix14T_Healpix_BaseIlE8SetNsideElNS_23Healpix_Ordering_SchemeE0
_ZN7healpix14T_Healpix_BaseIlEC2Ev0
_ZNK7healpix14T_Healpix_BaseIiE10boundariesEimRSt6vectorINS_6vec3_tIdEESaIS4_EE0
_ZNK7healpix14T_Healpix_BaseIiE10max_pixradEi0
_ZNK7healpix14T_Healpix_BaseIiE10max_pixradEv0
_ZNK7healpix14T_Healpix_BaseIiE10nest2peanoEi0
_ZNK7healpix14T_Healpix_BaseIiE10peano2nestEi0
_ZNK7healpix14T_Healpix_BaseIiE10query_discENS_8pointingEdRNS_8rangesetIiEE0
_ZNK7healpix14T_Healpix_BaseIiE10ring_aboveEd0
_ZNK7healpix14T_Healpix_BaseIiE11query_stripEddbRNS_8rangesetIiEE0
_ZNK7healpix14T_Healpix_BaseIiE11swap_cyclesEv0
_ZNK7healpix14T_Healpix_BaseIiE12get_interpolERKNS_8pointingERNS_7fix_arrIiLm4EEERNS5_IdLm4EEE0
_ZNK7healpix14T_Healpix_BaseIiE13get_ring_infoEiRiS2_RdS3_Rb0
_ZNK7healpix14T_Healpix_BaseIiE13query_polygonERKSt6vectorINS_8pointingESaIS3_EERNS_8rangesetIiEE0
_ZNK7healpix14T_Healpix_BaseIiE14get_ring_info2EiRiS2_RdRb0
_ZNK7healpix14T_Healpix_BaseIiE15query_multidiscIiEEvRKNS_3arrINS_6vec3_tIdEEEERKNS3_IdEEiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIiE17nest_peano_helperEii0
_ZNK7healpix14T_Healpix_BaseIiE19get_ring_info_smallEiRiS2_Rb0
_ZNK7healpix14T_Healpix_BaseIiE19query_disc_internalIiEEvNS_8pointingEdiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIiE20query_disc_inclusiveENS_8pointingEdRNS_8rangesetIiEEi0
_ZNK7healpix14T_Healpix_BaseIiE20query_strip_internalEddbRNS_8rangesetIiEE0
_ZNK7healpix14T_Healpix_BaseIiE22query_polygon_internalIiEEvRKSt6vectorINS_8pointingESaIS4_EEiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIiE23query_multidisc_generalERKNS_3arrINS_6vec3_tIdEEEERKNS2_IdEEbRKSt6vectorIiSaIiEERNS_8rangesetIiEE0
_ZNK7healpix14T_Healpix_BaseIiE23query_polygon_inclusiveERKSt6vectorINS_8pointingESaIS3_EERNS_8rangesetIiEEi0
_ZNK7healpix14T_Healpix_BaseIiE6ring2zEi0
_ZNK7healpix14T_Healpix_BaseIiE7loc2pixEdddb24585
_ZNK7healpix14T_Healpix_BaseIiE7pix2locEiRdS2_S2_Rb135172
_ZNK7healpix14T_Healpix_BaseIiE7xyf2locEddiRdS2_S2_Rb0
_ZNK7healpix14T_Healpix_BaseIiE8nest2xyfEiRiS2_S2_0
_ZNK7healpix14T_Healpix_BaseIiE8pix2ringEi0
_ZNK7healpix14T_Healpix_BaseIiE8ring2xyfEiRiS2_S2_421
_ZNK7healpix14T_Healpix_BaseIiE8xyf2nestEiii421
_ZNK7healpix14T_Healpix_BaseIiE8xyf2ringEiii0
_ZNK7healpix14T_Healpix_BaseIiE9neighborsEiRNS_7fix_arrIiLm8EEE0
_ZNK7healpix14T_Healpix_BaseIiE9nest2ringEi0
_ZNK7healpix14T_Healpix_BaseIiE9ring2nestEi421
_ZNK7healpix14T_Healpix_BaseIlE10boundariesElmRSt6vectorINS_6vec3_tIdEESaIS4_EE0
_ZNK7healpix14T_Healpix_BaseIlE10max_pixradEl0
_ZNK7healpix14T_Healpix_BaseIlE10max_pixradEv0
_ZNK7healpix14T_Healpix_BaseIlE10nest2peanoEl0
_ZNK7healpix14T_Healpix_BaseIlE10peano2nestEl0
_ZNK7healpix14T_Healpix_BaseIlE10query_discENS_8pointingEdRNS_8rangesetIlEE0
_ZNK7healpix14T_Healpix_BaseIlE10ring_aboveEd0
_ZNK7healpix14T_Healpix_BaseIlE11query_stripEddbRNS_8rangesetIlEE0
_ZNK7healpix14T_Healpix_BaseIlE11spread_bitsEi0
_ZNK7healpix14T_Healpix_BaseIlE11swap_cyclesEv0
_ZNK7healpix14T_Healpix_BaseIlE12get_interpolERKNS_8pointingERNS_7fix_arrIlLm4EEERNS5_IdLm4EEE0
_ZNK7healpix14T_Healpix_BaseIlE13compress_bitsEl842
_ZNK7healpix14T_Healpix_BaseIlE13get_ring_infoElRlS2_RdS3_Rb0
_ZNK7healpix14T_Healpix_BaseIlE13query_polygonERKSt6vectorINS_8pointingESaIS3_EERNS_8rangesetIlEE0
_ZNK7healpix14T_Healpix_BaseIlE14get_ring_info2ElRlS2_RdRb0
_ZNK7healpix14T_Healpix_BaseIlE15query_multidiscIiEEvRKNS_3arrINS_6vec3_tIdEEEERKNS3_IdEEiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIlE15query_multidiscIlEEvRKNS_3arrINS_6vec3_tIdEEEERKNS3_IdEEiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIlE17nest_peano_helperEli0
_ZNK7healpix14T_Healpix_BaseIlE19get_ring_info_smallElRlS2_Rb0
_ZNK7healpix14T_Healpix_BaseIlE19query_disc_internalIiEEvNS_8pointingEdiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIlE19query_disc_internalIlEEvNS_8pointingEdiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIlE20query_disc_inclusiveENS_8pointingEdRNS_8rangesetIlEEi0
_ZNK7healpix14T_Healpix_BaseIlE20query_strip_internalEddbRNS_8rangesetIlEE0
_ZNK7healpix14T_Healpix_BaseIlE22query_polygon_internalIiEEvRKSt6vectorINS_8pointingESaIS4_EEiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIlE22query_polygon_internalIlEEvRKSt6vectorINS_8pointingESaIS4_EEiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIlE23query_multidisc_generalERKNS_3arrINS_6vec3_tIdEEEERKNS2_IdEEbRKSt6vectorIiSaIiEERNS_8rangesetIlEE0
_ZNK7healpix14T_Healpix_BaseIlE23query_polygon_inclusiveERKSt6vectorINS_8pointingESaIS3_EERNS_8rangesetIlEEi0
_ZNK7healpix14T_Healpix_BaseIlE6ring2zEl0
_ZNK7healpix14T_Healpix_BaseIlE7loc2pixEdddb0
_ZNK7healpix14T_Healpix_BaseIlE7pix2locElRdS2_S2_Rb421
_ZNK7healpix14T_Healpix_BaseIlE7xyf2locEddiRdS2_S2_Rb0
_ZNK7healpix14T_Healpix_BaseIlE8nest2xyfElRiS2_S2_421
_ZNK7healpix14T_Healpix_BaseIlE8pix2ringEl0
_ZNK7healpix14T_Healpix_BaseIlE8ring2xyfElRiS2_S2_0
_ZNK7healpix14T_Healpix_BaseIlE8xyf2nestEiii0
_ZNK7healpix14T_Healpix_BaseIlE8xyf2ringEiii0
_ZNK7healpix14T_Healpix_BaseIlE9neighborsElRNS_7fix_arrIlLm8EEE0
_ZNK7healpix14T_Healpix_BaseIlE9nest2ringEl0
_ZNK7healpix14T_Healpix_BaseIlE9ring2nestEl0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/healpix_base.cc.gcov.html b/doc/coverageReport/libs/healpix_base/healpix_base.cc.gcov.html new file mode 100644 index 000000000..be3123d75 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/healpix_base.cc.gcov.html @@ -0,0 +1,1454 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/healpix_base.cc + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base - healpix_base.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11273415.3 %
Date:2024-04-08 14:58:22Functions:109111.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : /*
+       2             :  *  This file is part of Healpix_cxx.
+       3             :  *
+       4             :  *  Healpix_cxx is free software; you can redistribute it and/or modify
+       5             :  *  it under the terms of the GNU General Public License as published by
+       6             :  *  the Free Software Foundation; either version 2 of the License, or
+       7             :  *  (at your option) any later version.
+       8             :  *
+       9             :  *  Healpix_cxx is distributed in the hope that it will be useful,
+      10             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+      11             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+      12             :  *  GNU General Public License for more details.
+      13             :  *
+      14             :  *  You should have received a copy of the GNU General Public License
+      15             :  *  along with Healpix_cxx; if not, write to the Free Software
+      16             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+      17             :  *
+      18             :  *  For more information about HEALPix, see http://healpix.sourceforge.net
+      19             :  */
+      20             : 
+      21             : /*
+      22             :  *  Healpix_cxx is being developed at the Max-Planck-Institut fuer Astrophysik
+      23             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
+      24             :  *  (DLR).
+      25             :  */
+      26             : 
+      27             : /*
+      28             :  *  Copyright (C) 2003-2012 Max-Planck-Society
+      29             :  *  Author: Martin Reinecke
+      30             :  */
+      31             : 
+      32             : #include "healpix_base/healpix_base.h"
+      33             : #include "healpix_base/geom_utils.h"
+      34             : #include "healpix_base/lsconstants.h"
+      35             : 
+      36             : namespace healpix{
+      37             : 
+      38             : using namespace std;
+      39             : 
+      40             : template<> const int T_Healpix_Base<int  >::order_max=13;
+      41             : template<> const int T_Healpix_Base<int64>::order_max=29;
+      42             : 
+      43           0 : template<typename I> int T_Healpix_Base<I>::nside2order (I nside)
+      44             :   {
+      45           0 :   planck_assert (nside>I(0), "invalid value for Nside");
+      46           0 :   return ((nside)&(nside-1)) ? -1 : ilog2(nside);
+      47             :   }
+      48           0 : template<typename I> I T_Healpix_Base<I>::npix2nside (I npix)
+      49             :   {
+      50           0 :   I res=isqrt(npix/I(12));
+      51           0 :   planck_assert (npix==res*res*I(12), "invalid value for npix");
+      52           0 :   return res;
+      53             :   }
+      54             : 
+      55           0 : template<typename I> I T_Healpix_Base<I>::ring_above (double z) const
+      56             :   {
+      57             :   double az=abs(z);
+      58           0 :   if (az<=twothird) // equatorial region
+      59           0 :     return I(nside_*(2-1.5*z));
+      60           0 :   I iring = I(nside_*sqrt(3*(1-az)));
+      61           0 :   return (z>0) ? iring : 4*nside_-iring-1;
+      62             :   }
+      63             : 
+      64             : namespace {
+      65             : 
+      66             : /* Short note on the "zone":
+      67             :    zone = 0: pixel lies completely outside the queried shape
+      68             :           1: pixel may overlap with the shape, pixel center is outside
+      69             :           2: pixel center is inside the shape, but maybe not the complete pixel
+      70             :           3: pixel lies completely inside the shape */
+      71             : 
+      72           0 : template<typename I, typename I2> inline void check_pixel (int o, int order_,
+      73             :   int omax, int zone, rangeset<I2> &pixset, I pix, vector<pair<I,int> > &stk,
+      74             :   bool inclusive, int &stacktop)
+      75             :   {
+      76           0 :   if (zone==0) return;
+      77             : 
+      78           0 :   if (o<order_)
+      79             :     {
+      80           0 :     if (zone>=3)
+      81             :       {
+      82           0 :       int sdist=2*(order_-o); // the "bit-shift distance" between map orders
+      83           0 :       pixset.append(pix<<sdist,(pix+1)<<sdist); // output all subpixels
+      84             :       }
+      85             :     else // (zone>=1)
+      86           0 :       for (int i=0; i<4; ++i)
+      87           0 :         stk.push_back(make_pair(4*pix+3-i,o+1)); // add children
+      88             :     }
+      89           0 :   else if (o>order_) // this implies that inclusive==true
+      90             :     {
+      91           0 :     if (zone>=2) // pixel center in shape
+      92             :       {
+      93           0 :       pixset.append(pix>>(2*(o-order_))); // output the parent pixel at order_
+      94           0 :       stk.resize(stacktop); // unwind the stack
+      95             :       }
+      96             :     else // (zone>=1): pixel center in safety range
+      97             :       {
+      98           0 :       if (o<omax) // check sublevels
+      99           0 :         for (int i=0; i<4; ++i) // add children in reverse order
+     100           0 :           stk.push_back(make_pair(4*pix+3-i,o+1));
+     101             :       else // at resolution limit
+     102             :         {
+     103           0 :         pixset.append(pix>>(2*(o-order_))); // output the parent pixel at order_
+     104           0 :         stk.resize(stacktop); // unwind the stack
+     105             :         }
+     106             :       }
+     107             :     }
+     108             :   else // o==order_
+     109             :     {
+     110           0 :     if (zone>=2)
+     111           0 :       pixset.append(pix);
+     112           0 :     else if (inclusive) // and (zone>=1)
+     113             :       {
+     114           0 :       if (order_<omax) // check sublevels
+     115             :         {
+     116           0 :         stacktop=stk.size(); // remember current stack position
+     117           0 :         for (int i=0; i<4; ++i) // add children in reverse order
+     118           0 :           stk.push_back(make_pair(4*pix+3-i,o+1));
+     119             :         }
+     120             :       else // at resolution limit
+     121           0 :         pixset.append(pix); // output the pixel
+     122             :       }
+     123             :     }
+     124             :   }
+     125             : 
+     126           0 : template<typename I> bool check_pixel_ring (const T_Healpix_Base<I> &b1,
+     127             :   const T_Healpix_Base<I> &b2, I pix, I nr, I ipix1, int fct,
+     128             :   double cz, double cphi, double cosrp2, I cpix)
+     129             :   {
+     130           0 :   if (pix>=nr) pix-=nr;
+     131           0 :   if (pix<0) pix+=nr;
+     132           0 :   pix+=ipix1;
+     133           0 :   if (pix==cpix) return false; // disk center in pixel => overlap
+     134             :   int px,py,pf;
+     135           0 :   b1.pix2xyf(pix,px,py,pf);
+     136           0 :   for (int i=0; i<fct-1; ++i) // go along the 4 edges
+     137             :     {
+     138           0 :     I ox=fct*px, oy=fct*py;
+     139             :     double pz,pphi;
+     140           0 :     b2.pix2zphi(b2.xyf2pix(ox+i,oy,pf),pz,pphi);
+     141           0 :     if (cosdist_zphi(pz,pphi,cz,cphi)>cosrp2) // overlap
+     142           0 :       return false;
+     143           0 :     b2.pix2zphi(b2.xyf2pix(ox+fct-1,oy+i,pf),pz,pphi);
+     144           0 :     if (cosdist_zphi(pz,pphi,cz,cphi)>cosrp2) // overlap
+     145             :       return false;
+     146           0 :     b2.pix2zphi(b2.xyf2pix(ox+fct-1-i,oy+fct-1,pf),pz,pphi);
+     147           0 :     if (cosdist_zphi(pz,pphi,cz,cphi)>cosrp2) // overlap
+     148             :       return false;
+     149           0 :     b2.pix2zphi(b2.xyf2pix(ox,oy+fct-1-i,pf),pz,pphi);
+     150           0 :     if (cosdist_zphi(pz,pphi,cz,cphi)>cosrp2) // overlap
+     151             :       return false;
+     152             :     }
+     153             :   return true;
+     154             :   }
+     155             : 
+     156             : } // unnamed namespace
+     157             : 
+     158             : template<typename I> template<typename I2>
+     159           0 :   void T_Healpix_Base<I>::query_disc_internal
+     160             :   (pointing ptg, double radius, int fact, rangeset<I2> &pixset) const
+     161             :   {
+     162           0 :   bool inclusive = (fact!=0);
+     163             :   pixset.clear();
+     164           0 :   ptg.normalize();
+     165             : 
+     166           0 :   if (scheme_==RING)
+     167             :     {
+     168             :     I fct=1;
+     169           0 :     if (inclusive)
+     170             :       {
+     171           0 :       planck_assert (((I(1)<<order_max)/nside_)>=fact,
+     172             :         "invalid oversampling factor");
+     173             :       fct = fact;
+     174             :       }
+     175           0 :     T_Healpix_Base b2;
+     176             :     double rsmall, rbig;
+     177           0 :     if (fct>1)
+     178             :       {
+     179           0 :       b2.SetNside(fct*nside_,RING);
+     180           0 :       rsmall = radius+b2.max_pixrad();
+     181           0 :       rbig = radius+max_pixrad();
+     182             :       }
+     183             :     else
+     184           0 :       rsmall = rbig = inclusive ? radius+max_pixrad() : radius;
+     185             : 
+     186           0 :     if (rsmall>=pi)
+     187           0 :       { pixset.append(0,npix_); return; }
+     188             : 
+     189           0 :     rbig = min(pi,rbig);
+     190             : 
+     191           0 :     double cosrsmall = cos(rsmall);
+     192           0 :     double cosrbig = cos(rbig);
+     193             : 
+     194           0 :     double z0 = cos(ptg.theta);
+     195           0 :     double xa = 1./sqrt((1-z0)*(1+z0));
+     196             : 
+     197           0 :     I cpix=zphi2pix(z0,ptg.phi);
+     198             : 
+     199           0 :     double rlat1 = ptg.theta - rsmall;
+     200           0 :     double zmax = cos(rlat1);
+     201           0 :     I irmin = ring_above (zmax)+1;
+     202             : 
+     203           0 :     if ((rlat1<=0) && (irmin>1)) // north pole in the disk
+     204             :       {
+     205             :       I sp,rp; bool dummy;
+     206           0 :       get_ring_info_small(irmin-1,sp,rp,dummy);
+     207           0 :       pixset.append(0,sp+rp);
+     208             :       }
+     209             : 
+     210           0 :     if ((fct>1) && (rlat1>0)) irmin=max(I(1),irmin-1);
+     211             : 
+     212           0 :     double rlat2 = ptg.theta + rsmall;
+     213           0 :     double zmin = cos(rlat2);
+     214           0 :     I irmax = ring_above (zmin);
+     215             : 
+     216           0 :     if ((fct>1) && (rlat2<pi)) irmax=min(4*nside_-1,irmax+1);
+     217             : 
+     218           0 :     for (I iz=irmin; iz<=irmax; ++iz)
+     219             :       {
+     220           0 :       double z=ring2z(iz);
+     221           0 :       double x = (cosrbig-z*z0)*xa;
+     222           0 :       double ysq = 1-z*z-x*x;
+     223           0 :       double dphi = (ysq<=0) ? pi-1e-15 : atan2(sqrt(ysq),x);
+     224             :       I nr, ipix1;
+     225             :       bool shifted;
+     226           0 :       get_ring_info_small(iz,ipix1,nr,shifted);
+     227           0 :       double shift = shifted ? 0.5 : 0.;
+     228             : 
+     229           0 :       I ipix2 = ipix1 + nr - 1; // highest pixel number in the ring
+     230             : 
+     231           0 :       I ip_lo = ifloor<I>(nr*inv_twopi*(ptg.phi-dphi) - shift)+1;
+     232           0 :       I ip_hi = ifloor<I>(nr*inv_twopi*(ptg.phi+dphi) - shift);
+     233             : 
+     234           0 :       if (fct>1)
+     235             :         {
+     236           0 :         while ((ip_lo<=ip_hi) && check_pixel_ring
+     237           0 :                (*this,b2,ip_lo,nr,ipix1,fct,z0,ptg.phi,cosrsmall,cpix))
+     238           0 :           ++ip_lo;
+     239           0 :         while ((ip_hi>ip_lo) && check_pixel_ring
+     240           0 :                (*this,b2,ip_hi,nr,ipix1,fct,z0,ptg.phi,cosrsmall,cpix))
+     241           0 :           --ip_hi;
+     242             :         }
+     243             : 
+     244           0 :       if (ip_lo<=ip_hi)
+     245             :         {
+     246           0 :         if (ip_hi>=nr)
+     247           0 :           { ip_lo-=nr; ip_hi-=nr; }
+     248           0 :         if (ip_lo<0)
+     249             :           {
+     250           0 :           pixset.append(ipix1,ipix1+ip_hi+1);
+     251           0 :           pixset.append(ipix1+ip_lo+nr,ipix2+1);
+     252             :           }
+     253             :         else
+     254           0 :           pixset.append(ipix1+ip_lo,ipix1+ip_hi+1);
+     255             :         }
+     256             :       }
+     257           0 :     if ((rlat2>=pi) && (irmax+1<4*nside_)) // south pole in the disk
+     258             :       {
+     259             :       I sp,rp; bool dummy;
+     260           0 :       get_ring_info_small(irmax+1,sp,rp,dummy);
+     261           0 :       pixset.append(sp,npix_);
+     262             :       }
+     263             :     }
+     264             :   else // scheme_==NEST
+     265             :     {
+     266           0 :     if (radius>=pi) // disk covers the whole sphere
+     267           0 :       { pixset.append(0,npix_); return; }
+     268             : 
+     269             :     int oplus = 0;
+     270           0 :     if (inclusive)
+     271             :       {
+     272           0 :       planck_assert ((I(1)<<(order_max-order_))>=fact,
+     273             :         "invalid oversampling factor");
+     274           0 :       planck_assert ((fact&(fact-1))==0,
+     275             :         "oversampling factor must be a power of 2");
+     276           0 :       oplus=ilog2(fact);
+     277             :       }
+     278           0 :     int omax=order_+oplus; // the order up to which we test
+     279             : 
+     280             :     vec3 vptg(ptg);
+     281           0 :     arr<T_Healpix_Base<I> > base(omax+1);
+     282             :     arr<double> crpdr(omax+1), crmdr(omax+1);
+     283           0 :     double cosrad=cos(radius);
+     284           0 :     for (int o=0; o<=omax; ++o) // prepare data at the required orders
+     285             :       {
+     286           0 :       base[o].Set(o,NEST);
+     287           0 :       double dr=base[o].max_pixrad(); // safety distance
+     288           0 :       crpdr[o] = (radius+dr>pi) ? -1. : cos(radius+dr);
+     289           0 :       crmdr[o] = (radius-dr<0.) ?  1. : cos(radius-dr);
+     290             :       }
+     291             :     vector<pair<I,int> > stk; // stack for pixel numbers and their orders
+     292           0 :     stk.reserve(12+3*omax); // reserve maximum size to avoid reallocation
+     293           0 :     for (int i=0; i<12; ++i) // insert the 12 base pixels in reverse order
+     294           0 :       stk.push_back(make_pair(I(11-i),0));
+     295             : 
+     296           0 :     int stacktop=0; // a place to save a stack position
+     297             : 
+     298           0 :     while (!stk.empty()) // as long as there are pixels on the stack
+     299             :       {
+     300             :       // pop current pixel number and order from the stack
+     301           0 :       I pix=stk.back().first;
+     302           0 :       int o=stk.back().second;
+     303             :       stk.pop_back();
+     304             : 
+     305             :       double z,phi;
+     306             :       base[o].pix2zphi(pix,z,phi);
+     307             :       // cosine of angular distance between pixel center and disk center
+     308           0 :       double cangdist=cosdist_zphi(vptg.z,ptg.phi,z,phi);
+     309             : 
+     310           0 :       if (cangdist>crpdr[o])
+     311             :         {
+     312           0 :         int zone = (cangdist<cosrad) ? 1 : ((cangdist<=crmdr[o]) ? 2 : 3);
+     313             : 
+     314           0 :         check_pixel (o, order_, omax, zone, pixset, pix, stk, inclusive,
+     315             :           stacktop);
+     316             :         }
+     317             :       }
+     318             :     }
+     319             :   }
+     320             : 
+     321           0 : template<typename I> void T_Healpix_Base<I>::query_disc
+     322             :   (pointing ptg, double radius, rangeset<I> &pixset) const
+     323             :   {
+     324           0 :   query_disc_internal (ptg, radius, 0, pixset);
+     325           0 :   }
+     326             : 
+     327           0 : template<typename I> void T_Healpix_Base<I>::query_disc_inclusive
+     328             :   (pointing ptg, double radius, rangeset<I> &pixset, int fact) const
+     329             :   {
+     330           0 :   planck_assert(fact>0,"fact must be a positive integer");
+     331           0 :   if ((sizeof(I)<8) && (((I(1)<<order_max)/nside_)<fact))
+     332             :     {
+     333           0 :     T_Healpix_Base<int64> base2(nside_,scheme_,SET_NSIDE);
+     334           0 :     base2.query_disc_internal(ptg,radius,fact,pixset);
+     335             :     return;
+     336             :     }
+     337           0 :   query_disc_internal (ptg, radius, fact, pixset);
+     338             :   }
+     339             : 
+     340             : template<typename I> template<typename I2>
+     341           0 :   void T_Healpix_Base<I>::query_multidisc (const arr<vec3> &norm,
+     342             :   const arr<double> &rad, int fact, rangeset<I2> &pixset) const
+     343             :   {
+     344           0 :   bool inclusive = (fact!=0);
+     345             :   tsize nv=norm.size();
+     346           0 :   planck_assert(nv==rad.size(),"inconsistent input arrays");
+     347             :   pixset.clear();
+     348             : 
+     349           0 :   if (scheme_==RING)
+     350             :     {
+     351             :     I fct=1;
+     352           0 :     if (inclusive)
+     353             :       {
+     354           0 :       planck_assert (((I(1)<<order_max)/nside_)>=fact,
+     355             :         "invalid oversampling factor");
+     356             :       fct = fact;
+     357             :       }
+     358           0 :     T_Healpix_Base b2;
+     359             :     double rpsmall, rpbig;
+     360           0 :     if (fct>1)
+     361             :       {
+     362           0 :       b2.SetNside(fct*nside_,RING);
+     363           0 :       rpsmall = b2.max_pixrad();
+     364           0 :       rpbig = max_pixrad();
+     365             :       }
+     366             :     else
+     367           0 :       rpsmall = rpbig = inclusive ? max_pixrad() : 0;
+     368             : 
+     369           0 :     I irmin=1, irmax=4*nside_-1;
+     370             :     vector<double> z0,xa,cosrsmall,cosrbig;
+     371             :     vector<pointing> ptg;
+     372             :     vector<I> cpix;
+     373           0 :     for (tsize i=0; i<nv; ++i)
+     374             :       {
+     375           0 :       double rsmall=rad[i]+rpsmall;
+     376           0 :       if (rsmall<pi)
+     377             :         {
+     378           0 :         double rbig=min(pi,rad[i]+rpbig);
+     379             :         pointing pnt=pointing(norm[i]);
+     380           0 :         cosrsmall.push_back(cos(rsmall));
+     381           0 :         cosrbig.push_back(cos(rbig));
+     382           0 :         double cth=cos(pnt.theta);
+     383           0 :         z0.push_back(cth);
+     384           0 :         if (fct>1) cpix.push_back(zphi2pix(cth,pnt.phi));
+     385           0 :         xa.push_back(1./sqrt((1-cth)*(1+cth)));
+     386           0 :         ptg.push_back(pnt);
+     387             : 
+     388           0 :         double rlat1 = pnt.theta - rsmall;
+     389           0 :         double zmax = cos(rlat1);
+     390           0 :         I irmin_t = (rlat1<=0) ? 1 : ring_above (zmax)+1;
+     391             : 
+     392           0 :         if ((fct>1) && (rlat1>0)) irmin_t=max(I(1),irmin_t-1);
+     393             : 
+     394           0 :         double rlat2 = pnt.theta + rsmall;
+     395           0 :         double zmin = cos(rlat2);
+     396           0 :         I irmax_t = (rlat2>=pi) ? 4*nside_-1 : ring_above (zmin);
+     397             : 
+     398           0 :         if ((fct>1) && (rlat2<pi)) irmax_t=min(4*nside_-1,irmax_t+1);
+     399             : 
+     400             :         if (irmax_t < irmax) irmax=irmax_t;
+     401             :         if (irmin_t > irmin) irmin=irmin_t;
+     402             :         }
+     403             :       }
+     404             : 
+     405           0 :     for (I iz=irmin; iz<=irmax; ++iz)
+     406             :       {
+     407           0 :       double z=ring2z(iz);
+     408             :       I ipix1,nr;
+     409             :       bool shifted;
+     410           0 :       get_ring_info_small(iz,ipix1,nr,shifted);
+     411           0 :       double shift = shifted ? 0.5 : 0.;
+     412             :       rangeset<I2> tr;
+     413           0 :       tr.append(ipix1,ipix1+nr);
+     414           0 :       for (tsize j=0; j<z0.size(); ++j)
+     415             :         {
+     416           0 :         double x = (cosrbig[j]-z*z0[j])*xa[j];
+     417           0 :         double ysq = 1.-z*z-x*x;
+     418           0 :         double dphi = (ysq<=0) ? pi-1e-15 : atan2(sqrt(ysq),x);
+     419           0 :         I ip_lo = ifloor<I>(nr*inv_twopi*(ptg[j].phi-dphi) - shift)+1;
+     420           0 :         I ip_hi = ifloor<I>(nr*inv_twopi*(ptg[j].phi+dphi) - shift);
+     421           0 :         if (fct>1)
+     422             :           {
+     423           0 :           while ((ip_lo<=ip_hi) && check_pixel_ring
+     424           0 :             (*this,b2,ip_lo,nr,ipix1,fct,z0[j],ptg[j].phi,cosrsmall[j],cpix[j]))
+     425           0 :             ++ip_lo;
+     426           0 :           while ((ip_hi>ip_lo) && check_pixel_ring
+     427           0 :             (*this,b2,ip_hi,nr,ipix1,fct,z0[j],ptg[j].phi,cosrsmall[j],cpix[j]))
+     428           0 :             --ip_hi;
+     429             :           }
+     430           0 :         if (ip_hi>=nr)
+     431           0 :           { ip_lo-=nr; ip_hi-=nr;}
+     432           0 :         if (ip_lo<0)
+     433           0 :           tr.remove(ipix1+ip_hi+1,ipix1+ip_lo+nr);
+     434             :         else
+     435           0 :           tr.intersect(ipix1+ip_lo,ipix1+ip_hi+1);
+     436             :         }
+     437           0 :       pixset.append(tr);
+     438             :       }
+     439             :     }
+     440             :   else // scheme_ == NEST
+     441             :     {
+     442             :     int oplus = 0;
+     443           0 :     if (inclusive)
+     444             :       {
+     445           0 :       planck_assert ((I(1)<<(order_max-order_))>=fact,
+     446             :         "invalid oversampling factor");
+     447           0 :       planck_assert ((fact&(fact-1))==0,
+     448             :         "oversampling factor must be a power of 2");
+     449           0 :       oplus=ilog2(fact);
+     450             :       }
+     451           0 :     int omax=order_+oplus; // the order up to which we test
+     452             : 
+     453             :     // TODO: ignore all disks with radius>=pi
+     454             : 
+     455           0 :     arr<T_Healpix_Base<I> > base(omax+1);
+     456             :     arr3<double> crlimit(omax+1,nv,3);
+     457           0 :     for (int o=0; o<=omax; ++o) // prepare data at the required orders
+     458             :       {
+     459           0 :       base[o].Set(o,NEST);
+     460           0 :       double dr=base[o].max_pixrad(); // safety distance
+     461           0 :       for (tsize i=0; i<nv; ++i)
+     462             :         {
+     463           0 :         crlimit(o,i,0) = (rad[i]+dr>pi) ? -1. : cos(rad[i]+dr);
+     464           0 :         crlimit(o,i,1) = (o==0) ? cos(rad[i]) : crlimit(0,i,1);
+     465           0 :         crlimit(o,i,2) = (rad[i]-dr<0.) ?  1. : cos(rad[i]-dr);
+     466             :         }
+     467             :       }
+     468             : 
+     469             :     vector<pair<I,int> > stk; // stack for pixel numbers and their orders
+     470           0 :     stk.reserve(12+3*omax); // reserve maximum size to avoid reallocation
+     471           0 :     for (int i=0; i<12; ++i) // insert the 12 base pixels in reverse order
+     472           0 :       stk.push_back(make_pair(I(11-i),0));
+     473             : 
+     474           0 :     int stacktop=0; // a place to save a stack position
+     475             : 
+     476           0 :     while (!stk.empty()) // as long as there are pixels on the stack
+     477             :       {
+     478             :       // pop current pixel number and order from the stack
+     479           0 :       I pix=stk.back().first;
+     480           0 :       int o=stk.back().second;
+     481             :       stk.pop_back();
+     482             : 
+     483           0 :       vec3 pv(base[o].pix2vec(pix));
+     484             : 
+     485             :       tsize zone=3;
+     486           0 :       for (tsize i=0; i<nv; ++i)
+     487             :         {
+     488             :         double crad=dotprod(pv,norm[i]);
+     489           0 :         for (tsize iz=0; iz<zone; ++iz)
+     490           0 :           if (crad<crlimit(o,i,iz))
+     491           0 :             if ((zone=iz)==0) goto bailout;
+     492             :         }
+     493             : 
+     494           0 :       check_pixel (o, order_, omax, zone, pixset, pix, stk, inclusive,
+     495             :         stacktop);
+     496           0 :       bailout:;
+     497             :       }
+     498             :     }
+     499           0 :   }
+     500             : 
+     501           0 : template<typename I> void T_Healpix_Base<I>::query_multidisc_general
+     502             :   (const arr<vec3> &norm, const arr<double> &rad, bool inclusive,
+     503             :   const vector<int> &cmds, rangeset<I> &pixset) const
+     504             :   {
+     505             :   tsize nv=norm.size();
+     506           0 :   planck_assert(nv==rad.size(),"inconsistent input arrays");
+     507             :   pixset.clear();
+     508             : 
+     509           0 :   if (scheme_==RING)
+     510             :     {
+     511           0 :     planck_fail ("not yet implemented");
+     512             :     }
+     513             :   else // scheme_ == NEST
+     514             :     {
+     515           0 :     int oplus=inclusive ? 2 : 0;
+     516           0 :     int omax=min(order_max,order_+oplus); // the order up to which we test
+     517             : 
+     518             :     // TODO: ignore all disks with radius>=pi
+     519             : 
+     520           0 :     arr<T_Healpix_Base<I> > base(omax+1);
+     521             :     arr3<double> crlimit(omax+1,nv,3);
+     522           0 :     for (int o=0; o<=omax; ++o) // prepare data at the required orders
+     523             :       {
+     524           0 :       base[o].Set(o,NEST);
+     525           0 :       double dr=base[o].max_pixrad(); // safety distance
+     526           0 :       for (tsize i=0; i<nv; ++i)
+     527             :         {
+     528           0 :         crlimit(o,i,0) = (rad[i]+dr>pi) ? -1. : cos(rad[i]+dr);
+     529           0 :         crlimit(o,i,1) = (o==0) ? cos(rad[i]) : crlimit(0,i,1);
+     530           0 :         crlimit(o,i,2) = (rad[i]-dr<0.) ?  1. : cos(rad[i]-dr);
+     531             :         }
+     532             :       }
+     533             : 
+     534             :     vector<pair<I,int> > stk; // stack for pixel numbers and their orders
+     535           0 :     stk.reserve(12+3*omax); // reserve maximum size to avoid reallocation
+     536           0 :     for (int i=0; i<12; ++i) // insert the 12 base pixels in reverse order
+     537           0 :       stk.push_back(make_pair(I(11-i),0));
+     538             : 
+     539           0 :     int stacktop=0; // a place to save a stack position
+     540             :     arr<tsize> zone(nv);
+     541             : 
+     542           0 :     vector<tsize> zstk; zstk.reserve(cmds.size());
+     543             : 
+     544           0 :     while (!stk.empty()) // as long as there are pixels on the stack
+     545             :       {
+     546             :       // pop current pixel number and order from the stack
+     547           0 :       I pix=stk.back().first;
+     548           0 :       int o=stk.back().second;
+     549             :       stk.pop_back();
+     550             : 
+     551           0 :       vec3 pv(base[o].pix2vec(pix));
+     552             : 
+     553           0 :       for (tsize i=0; i<nv; ++i)
+     554             :         {
+     555           0 :         zone[i]=3;
+     556             :         double crad=dotprod(pv,norm[i]);
+     557           0 :         for (tsize iz=0; iz<zone[i]; ++iz)
+     558           0 :           if (crad<crlimit(o,i,iz))
+     559           0 :             zone[i]=iz;
+     560             :         }
+     561             : 
+     562           0 :       for (tsize i=0; i<cmds.size(); ++i)
+     563             :         {
+     564             :         tsize tmp;
+     565           0 :         switch (cmds[i])
+     566             :           {
+     567             :           case -1: // union
+     568           0 :             tmp=zstk.back(); zstk.pop_back();
+     569           0 :             zstk.back() = max(zstk.back(),tmp);
+     570           0 :             break;
+     571             :           case -2: // intersection
+     572           0 :             tmp=zstk.back(); zstk.pop_back();
+     573           0 :             zstk.back() = min(zstk.back(),tmp);
+     574           0 :             break;
+     575             :           default: // add value
+     576           0 :             zstk.push_back(zone[cmds[i]]);
+     577             :           }
+     578             :         }
+     579           0 :       planck_assert(zstk.size()==1,"inconsistent commands");
+     580           0 :       tsize zn=zstk[0]; zstk.pop_back();
+     581             : 
+     582           0 :       check_pixel (o, order_, omax, zn, pixset, pix, stk, inclusive,
+     583             :         stacktop);
+     584             :       }
+     585             :     }
+     586           0 :   }
+     587             : 
+     588             : template<> inline int T_Healpix_Base<int>::spread_bits (int v) const
+     589         421 :   { return utab[v&0xff] | (utab[(v>>8)&0xff]<<16); }
+     590           0 : template<> inline int64 T_Healpix_Base<int64>::spread_bits (int v) const
+     591             :   {
+     592           0 :   return  int64(utab[ v     &0xff])      | (int64(utab[(v>> 8)&0xff])<<16)
+     593           0 :        | (int64(utab[(v>>16)&0xff])<<32) | (int64(utab[(v>>24)&0xff])<<48);
+     594             :   }
+     595             : 
+     596             : template<> inline int T_Healpix_Base<int>::compress_bits (int v) const
+     597             :   {
+     598           0 :   int raw = (v&0x5555) | ((v&0x55550000)>>15);
+     599           0 :   return ctab[raw&0xff] | (ctab[raw>>8]<<4);
+     600             :   }
+     601         842 : template<> inline int T_Healpix_Base<int64>::compress_bits (int64 v) const
+     602             :   {
+     603         842 :   int64 raw = v&0x5555555555555555ull;
+     604         842 :   raw|=raw>>15;
+     605         842 :   return ctab[ raw     &0xff]      | (ctab[(raw>> 8)&0xff]<< 4)
+     606         842 :       | (ctab[(raw>>32)&0xff]<<16) | (ctab[(raw>>40)&0xff]<<20);
+     607             :   }
+     608             : 
+     609         421 : template<typename I> inline void T_Healpix_Base<I>::nest2xyf (I pix, int &ix,
+     610             :   int &iy, int &face_num) const
+     611             :   {
+     612         421 :   face_num = pix>>(2*order_);
+     613         421 :   pix &= (npface_-1);
+     614         421 :   ix = compress_bits(pix);
+     615         421 :   iy = compress_bits(pix>>1);
+     616         421 :   }
+     617             : 
+     618         421 : template<typename I> inline I T_Healpix_Base<I>::xyf2nest (int ix, int iy,
+     619             :   int face_num) const
+     620         421 :   { return (I(face_num)<<(2*order_)) + spread_bits(ix) + (spread_bits(iy)<<1); }
+     621             : 
+     622         421 : template<typename I> void T_Healpix_Base<I>::ring2xyf (I pix, int &ix, int &iy,
+     623             :   int &face_num) const
+     624             :   {
+     625             :   I iring, iphi, kshift, nr;
+     626         421 :   I nl2 = 2*nside_;
+     627             : 
+     628         421 :   if (pix<ncap_) // North Polar cap
+     629             :     {
+     630           0 :     iring = (1+isqrt(1+2*pix))>>1; //counted from North pole
+     631           0 :     iphi  = (pix+1) - 2*iring*(iring-1);
+     632             :     kshift = 0;
+     633             :     nr = iring;
+     634           0 :     face_num=(iphi-1)/nr;
+     635             :     }
+     636         421 :   else if (pix<(npix_-ncap_)) // Equatorial region
+     637             :     {
+     638         421 :     I ip = pix - ncap_;
+     639         421 :     I tmp = (order_>=0) ? ip>>(order_+2) : ip/(4*nside_);
+     640         421 :     iring = tmp+nside_;
+     641         421 :     iphi = ip-tmp*4*nside_ + 1;
+     642         421 :     kshift = (iring+nside_)&1;
+     643             :     nr = nside_;
+     644         421 :     I ire = iring-nside_+1,
+     645         421 :       irm = nl2+2-ire;
+     646         421 :     I ifm = iphi - ire/2 + nside_ -1,
+     647         421 :       ifp = iphi - irm/2 + nside_ -1;
+     648         421 :     if (order_>=0)
+     649         421 :       { ifm >>= order_; ifp >>= order_; }
+     650             :     else
+     651           0 :       { ifm /= nside_; ifp /= nside_; }
+     652         421 :     face_num = (ifp==ifm) ? (ifp|4) : ((ifp<ifm) ? ifp : (ifm+8));
+     653             :     }
+     654             :   else // South Polar cap
+     655             :     {
+     656           0 :     I ip = npix_ - pix;
+     657           0 :     iring = (1+isqrt(2*ip-1))>>1; //counted from South pole
+     658           0 :     iphi  = 4*iring + 1 - (ip - 2*iring*(iring-1));
+     659             :     kshift = 0;
+     660             :     nr = iring;
+     661           0 :     iring = 2*nl2-iring;
+     662           0 :     face_num = 8 + (iphi-1)/nr;
+     663             :     }
+     664             : 
+     665         421 :   I irt = iring - (jrll[face_num]*nside_) + 1;
+     666         421 :   I ipt = 2*iphi- jpll[face_num]*nr - kshift -1;
+     667         421 :   if (ipt>=nl2) ipt-=8*nside_;
+     668             : 
+     669         421 :   ix =  (ipt-irt) >>1;
+     670         421 :   iy = (-ipt-irt) >>1;
+     671         421 :   }
+     672             : 
+     673           0 : template<typename I> I T_Healpix_Base<I>::xyf2ring (int ix, int iy,
+     674             :   int face_num) const
+     675             :   {
+     676           0 :   I nl4 = 4*nside_;
+     677           0 :   I jr = (jrll[face_num]*nside_) - ix - iy  - 1;
+     678             : 
+     679             :   I nr, kshift, n_before;
+     680             : 
+     681             :   bool shifted;
+     682           0 :   get_ring_info_small(jr,n_before,nr,shifted);
+     683           0 :   nr>>=2;
+     684           0 :   kshift=1-shifted;
+     685           0 :   I jp = (jpll[face_num]*nr + ix - iy + 1 + kshift) / 2;
+     686           0 :   planck_assert(jp<=4*nr,"must not happen");
+     687           0 :   if (jp<1) jp+=nl4; // assumption: if this triggers, then nl4==4*nr
+     688             : 
+     689           0 :   return n_before + jp - 1;
+     690             :   }
+     691             : 
+     692           0 : template<typename I> T_Healpix_Base<I>::T_Healpix_Base ()
+     693           0 :   : order_(-1), nside_(0), npface_(0), ncap_(0), npix_(0),
+     694           0 :     fact1_(0), fact2_(0), scheme_(RING) {}
+     695             : 
+     696          29 : template<typename I> void T_Healpix_Base<I>::Set (int order,
+     697             :   Healpix_Ordering_Scheme scheme)
+     698             :   {
+     699          29 :   planck_assert ((order>=0)&&(order<=order_max), "bad order");
+     700          29 :   order_  = order;
+     701          29 :   nside_  = I(1)<<order;
+     702          29 :   npface_ = nside_<<order_;
+     703          29 :   ncap_   = (npface_-nside_)<<1;
+     704          29 :   npix_   = 12*npface_;
+     705          29 :   fact2_  = 4./npix_;
+     706          29 :   fact1_  = (nside_<<1)*fact2_;
+     707          29 :   scheme_ = scheme;
+     708          29 :   }
+     709           0 : template<typename I> void T_Healpix_Base<I>::SetNside (I nside,
+     710             :   Healpix_Ordering_Scheme scheme)
+     711             :   {
+     712           0 :   order_  = nside2order(nside);
+     713           0 :   planck_assert ((scheme!=NEST) || (order_>=0),
+     714             :     "SetNside: nside must be power of 2 for nested maps");
+     715           0 :   nside_  = nside;
+     716           0 :   npface_ = nside_*nside_;
+     717           0 :   ncap_   = (npface_-nside_)<<1;
+     718           0 :   npix_   = 12*npface_;
+     719           0 :   fact2_  = 4./npix_;
+     720           0 :   fact1_  = (nside_<<1)*fact2_;
+     721           0 :   scheme_ = scheme;
+     722           0 :   }
+     723             : 
+     724           0 : template<typename I> double T_Healpix_Base<I>::ring2z (I ring) const
+     725             :   {
+     726           0 :   if (ring<nside_)
+     727           0 :     return 1 - ring*ring*fact2_;
+     728           0 :   if (ring <=3*nside_)
+     729           0 :     return (2*nside_-ring)*fact1_;
+     730           0 :   ring=4*nside_ - ring;
+     731           0 :   return ring*ring*fact2_ - 1;
+     732             :   }
+     733             : 
+     734           0 : template<typename I> I T_Healpix_Base<I>::pix2ring (I pix) const
+     735             :   {
+     736           0 :   if (scheme_==RING)
+     737             :     {
+     738           0 :     if (pix<ncap_) // North Polar cap
+     739           0 :       return (1+I(isqrt(1+2*pix)))>>1; // counted from North pole
+     740           0 :     else if (pix<(npix_-ncap_)) // Equatorial region
+     741           0 :       return (pix-ncap_)/(4*nside_) + nside_; // counted from North pole
+     742             :     else // South Polar cap
+     743           0 :       return 4*nside_-((1+I(isqrt(2*(npix_-pix)-1)))>>1);
+     744             :     }
+     745             :   else
+     746             :     {
+     747             :     int face_num, ix, iy;
+     748           0 :     nest2xyf(pix,ix,iy,face_num);
+     749           0 :     return (I(jrll[face_num])<<order_) - ix - iy - 1;
+     750             :     }
+     751             :   }
+     752             : 
+     753           0 : template<typename I> I T_Healpix_Base<I>::nest2ring (I pix) const
+     754             :   {
+     755           0 :   planck_assert(order_>=0, "hierarchical map required");
+     756             :   int ix, iy, face_num;
+     757           0 :   nest2xyf (pix, ix, iy, face_num);
+     758           0 :   return xyf2ring (ix, iy, face_num);
+     759             :   }
+     760             : 
+     761         421 : template<typename I> I T_Healpix_Base<I>::ring2nest (I pix) const
+     762             :   {
+     763         421 :   planck_assert(order_>=0, "hierarchical map required");
+     764             :   int ix, iy, face_num;
+     765         421 :   ring2xyf (pix, ix, iy, face_num);
+     766         421 :   return xyf2nest (ix, iy, face_num);
+     767             :   }
+     768             : 
+     769           0 : template<typename I> inline I T_Healpix_Base<I>::nest_peano_helper
+     770             :   (I pix, int dir) const
+     771             :   {
+     772           0 :   int face = pix>>(2*order_);
+     773             :   I result = 0;
+     774           0 :   uint8 path = peano_face2path[dir][face];
+     775             : 
+     776           0 :   for (int shift=2*order_-2; shift>=0; shift-=2)
+     777             :     {
+     778           0 :     uint8 spix = uint8((pix>>shift) & 0x3);
+     779           0 :     result <<= 2;
+     780           0 :     result |= peano_subpix[dir][path][spix];
+     781           0 :     path=peano_subpath[dir][path][spix];
+     782             :     }
+     783             : 
+     784           0 :   return result + (I(peano_face2face[dir][face])<<(2*order_));
+     785             :   }
+     786             : 
+     787           0 : template<typename I> I T_Healpix_Base<I>::nest2peano (I pix) const
+     788           0 :   { return nest_peano_helper(pix,0); }
+     789             : 
+     790           0 : template<typename I> I T_Healpix_Base<I>::peano2nest (I pix) const
+     791           0 :   { return nest_peano_helper(pix,1); }
+     792             : 
+     793       24585 : template<typename I> I T_Healpix_Base<I>::loc2pix (double z, double phi,
+     794             :   double sth, bool have_sth) const
+     795             :   {
+     796             :   double za = abs(z);
+     797       24585 :   double tt = fmodulo(phi*inv_halfpi,4.0); // in [0,4)
+     798             : 
+     799       24585 :   if (scheme_==RING)
+     800             :     {
+     801       24585 :     if (za<=twothird) // Equatorial region
+     802             :       {
+     803       16535 :       I nl4 = 4*nside_;
+     804       16535 :       double temp1 = nside_*(0.5+tt);
+     805       16535 :       double temp2 = nside_*z*0.75;
+     806       16535 :       I jp = I(temp1-temp2); // index of  ascending edge line
+     807       16535 :       I jm = I(temp1+temp2); // index of descending edge line
+     808             : 
+     809             :       // ring number counted from z=2/3
+     810       16535 :       I ir = nside_ + 1 + jp - jm; // in {1,2n+1}
+     811       16535 :       I kshift = 1-(ir&1); // kshift=1 if ir even, 0 otherwise
+     812             : 
+     813       16535 :       I t1 = jp+jm-nside_+kshift+1+nl4+nl4;
+     814       16535 :       I ip = (order_>0) ?
+     815       16535 :         (t1>>1)&(nl4-1) : ((t1>>1)%nl4); // in {0,4n-1}
+     816             : 
+     817       16535 :       return ncap_ + (ir-1)*nl4 + ip;
+     818             :       }
+     819             :     else  // North & South polar caps
+     820             :       {
+     821        8050 :       double tp = tt-I(tt);
+     822        8050 :       double tmp = ((za<0.99)||(!have_sth)) ?
+     823        7809 :                    nside_*sqrt(3*(1-za)) :
+     824         241 :                    nside_*sth/sqrt((1.+za)/3.);
+     825             : 
+     826        8050 :       I jp = I(tp*tmp); // increasing edge line index
+     827        8050 :       I jm = I((1.0-tp)*tmp); // decreasing edge line index
+     828             : 
+     829        8050 :       I ir = jp+jm+1; // ring number counted from the closest pole
+     830        8050 :       I ip = I(tt*ir); // in {0,4*ir-1}
+     831        8050 :       planck_assert((ip>=0)&&(ip<4*ir),"must not happen");
+     832             :       //ip %= 4*ir;
+     833             : 
+     834        8050 :       return (z>0)  ?  2*ir*(ir-1) + ip  :  npix_ - 2*ir*(ir+1) + ip;
+     835             :       }
+     836             :     }
+     837             :   else // scheme_ == NEST
+     838             :     {
+     839           0 :     if (za<=twothird) // Equatorial region
+     840             :       {
+     841           0 :       double temp1 = nside_*(0.5+tt);
+     842           0 :       double temp2 = nside_*(z*0.75);
+     843           0 :       I jp = I(temp1-temp2); // index of  ascending edge line
+     844           0 :       I jm = I(temp1+temp2); // index of descending edge line
+     845           0 :       I ifp = jp >> order_;  // in {0,4}
+     846           0 :       I ifm = jm >> order_;
+     847           0 :       int face_num = (ifp==ifm) ? (ifp|4) : ((ifp<ifm) ? ifp : (ifm+8));
+     848             : 
+     849           0 :       int ix = jm & (nside_-1),
+     850           0 :           iy = nside_ - (jp & (nside_-1)) - 1;
+     851           0 :       return xyf2nest(ix,iy,face_num);
+     852             :       }
+     853             :     else // polar region, za > 2/3
+     854             :       {
+     855           0 :       int ntt = min(3,int(tt));
+     856           0 :       double tp = tt-ntt;
+     857           0 :       double tmp = ((za<0.99)||(!have_sth)) ?
+     858           0 :                    nside_*sqrt(3*(1-za)) :
+     859           0 :                    nside_*sth/sqrt((1.+za)/3.);
+     860             : 
+     861           0 :       I jp = I(tp*tmp); // increasing edge line index
+     862           0 :       I jm = I((1.0-tp)*tmp); // decreasing edge line index
+     863           0 :       jp=min(jp,nside_-1); // for points too close to the boundary
+     864           0 :       jm=min(jm,nside_-1);
+     865           0 :       return (z>=0) ?
+     866           0 :         xyf2nest(nside_-jm -1,nside_-jp-1,ntt) : xyf2nest(jp,jm,ntt+8);
+     867             :       }
+     868             :     }
+     869             :   }
+     870             : 
+     871      135593 : template<typename I> void T_Healpix_Base<I>::pix2loc (I pix, double &z,
+     872             :   double &phi, double &sth, bool &have_sth) const
+     873             :   {
+     874      135593 :   have_sth=false;
+     875      135593 :   if (scheme_==RING)
+     876             :     {
+     877      135172 :     if (pix<ncap_) // North Polar cap
+     878             :       {
+     879       22080 :       I iring = (1+I(isqrt(1+2*pix)))>>1; // counted from North pole
+     880       22080 :       I iphi  = (pix+1) - 2*iring*(iring-1);
+     881             : 
+     882       22080 :       double tmp=(iring*iring)*fact2_;
+     883       22080 :       z = 1.0 - tmp;
+     884       22080 :       if (z>0.99) { sth=sqrt(tmp*(2.-tmp)); have_sth=true; }
+     885       22080 :       phi = (iphi-0.5) * halfpi/iring;
+     886             :       }
+     887      113092 :     else if (pix<(npix_-ncap_)) // Equatorial region
+     888             :       {
+     889       91010 :       I nl4 = 4*nside_;
+     890       91010 :       I ip  = pix - ncap_;
+     891       91010 :       I tmp = (order_>=0) ? ip>>(order_+2) : ip/nl4;
+     892       91010 :       I iring = tmp + nside_,
+     893       91010 :         iphi = ip-nl4*tmp+1;
+     894             :       // 1 if iring+nside is odd, 1/2 otherwise
+     895       91010 :       double fodd = ((iring+nside_)&1) ? 1 : 0.5;
+     896             : 
+     897       91010 :       z = (2*nside_-iring)*fact1_;
+     898       91010 :       phi = (iphi-fodd) * pi*0.75*fact1_;
+     899             :       }
+     900             :     else // South Polar cap
+     901             :       {
+     902       22082 :       I ip = npix_ - pix;
+     903       22082 :       I iring = (1+I(isqrt(2*ip-1)))>>1; // counted from South pole
+     904       22082 :       I iphi  = 4*iring + 1 - (ip - 2*iring*(iring-1));
+     905             : 
+     906       22082 :       double tmp=(iring*iring)*fact2_;
+     907       22082 :       z = tmp - 1.0;
+     908       22082 :       if (z<-0.99) { sth=sqrt(tmp*(2.-tmp)); have_sth=true; }
+     909       22082 :       phi = (iphi-0.5) * halfpi/iring;
+     910             :       }
+     911             :     }
+     912             :   else
+     913             :     {
+     914             :     int face_num, ix, iy;
+     915         421 :     nest2xyf(pix,ix,iy,face_num);
+     916             : 
+     917         421 :     I jr = (I(jrll[face_num])<<order_) - ix - iy - 1;
+     918             : 
+     919             :     I nr;
+     920         421 :     if (jr<nside_)
+     921             :       {
+     922             :       nr = jr;
+     923           0 :       double tmp=(nr*nr)*fact2_;
+     924           0 :       z = 1 - tmp;
+     925           0 :       if (z>0.99) { sth=sqrt(tmp*(2.-tmp)); have_sth=true; }
+     926             :       }
+     927         421 :     else if (jr > 3*nside_)
+     928             :       {
+     929           0 :       nr = nside_*4-jr;
+     930           0 :       double tmp=(nr*nr)*fact2_;
+     931           0 :       z = tmp - 1;
+     932           0 :       if (z<-0.99) { sth=sqrt(tmp*(2.-tmp)); have_sth=true; }
+     933             :       }
+     934             :     else
+     935             :       {
+     936             :       nr = nside_;
+     937         421 :       z = (2*nside_-jr)*fact1_;
+     938             :       }
+     939             : 
+     940         421 :     I tmp=I(jpll[face_num])*nr+ix-iy;
+     941         421 :     planck_assert(tmp<8*nr,"must not happen");
+     942         421 :     if (tmp<0) tmp+=8*nr;
+     943         421 :     phi = (nr==nside_) ? 0.75*halfpi*tmp*fact1_ :
+     944           0 :                          (0.5*halfpi*tmp)/nr;
+     945             :     }
+     946      135593 :   }
+     947             : 
+     948             : template<typename I> template<typename I2>
+     949           0 :   void T_Healpix_Base<I>::query_polygon_internal
+     950             :   (const vector<pointing> &vertex, int fact, rangeset<I2> &pixset) const
+     951             :   {
+     952             :   bool inclusive = (fact!=0);
+     953             :   tsize nv=vertex.size();
+     954           0 :   tsize ncirc = inclusive ? nv+1 : nv;
+     955           0 :   planck_assert(nv>=3,"not enough vertices in polygon");
+     956             :   arr<vec3> vv(nv);
+     957           0 :   for (tsize i=0; i<nv; ++i)
+     958           0 :     vv[i]=vertex[i].to_vec3();
+     959             :   arr<vec3> normal(ncirc);
+     960             :   int flip=0;
+     961           0 :   for (tsize i=0; i<nv; ++i)
+     962             :     {
+     963           0 :     normal[i]=crossprod(vv[i],vv[(i+1)%nv]);
+     964           0 :     double hnd=dotprod(normal[i],vv[(i+2)%nv]);
+     965           0 :     planck_assert(abs(hnd)>1e-10,"degenerate corner");
+     966           0 :     if (i==0)
+     967           0 :       flip = (hnd<0.) ? -1 : 1;
+     968             :     else
+     969           0 :       planck_assert(flip*hnd>0,"polygon is not convex");
+     970           0 :     normal[i]*=flip/normal[i].Length();
+     971             :     }
+     972             :   arr<double> rad(ncirc,halfpi);
+     973           0 :   if (inclusive)
+     974             :     {
+     975             :     double cosrad;
+     976           0 :     find_enclosing_circle (vv, normal[nv], cosrad);
+     977           0 :     rad[nv]=acos(cosrad);
+     978             :     }
+     979           0 :   query_multidisc(normal,rad,fact,pixset);
+     980           0 :   }
+     981             : 
+     982           0 : template<typename I> void T_Healpix_Base<I>::query_polygon
+     983             :   (const vector<pointing> &vertex, rangeset<I> &pixset) const
+     984             :   {
+     985           0 :   query_polygon_internal(vertex, 0, pixset);
+     986           0 :   }
+     987             : 
+     988           0 : template<typename I> void T_Healpix_Base<I>::query_polygon_inclusive
+     989             :   (const vector<pointing> &vertex, rangeset<I> &pixset, int fact) const
+     990             :   {
+     991           0 :   planck_assert(fact>0,"fact must be a positive integer");
+     992           0 :   if ((sizeof(I)<8) && (((I(1)<<order_max)/nside_)<fact))
+     993             :     {
+     994           0 :     T_Healpix_Base<int64> base2(nside_,scheme_,SET_NSIDE);
+     995           0 :     base2.query_polygon_internal(vertex,fact,pixset);
+     996             :     return;
+     997             :     }
+     998           0 :   query_polygon_internal(vertex, fact, pixset);
+     999             :   }
+    1000             : 
+    1001           0 : template<typename I> void T_Healpix_Base<I>::query_strip_internal
+    1002             :   (double theta1, double theta2, bool inclusive, rangeset<I> &pixset) const
+    1003             :   {
+    1004           0 :   if (scheme_==RING)
+    1005             :     {
+    1006           0 :     I ring1 = max(I(1),1+ring_above(cos(theta1))),
+    1007           0 :       ring2 = min(4*nside_-1,ring_above(cos(theta2)));
+    1008           0 :     if (inclusive)
+    1009             :       {
+    1010           0 :       ring1 = max(I(1),ring1-1);
+    1011           0 :       ring2 = min(4*nside_-1,ring2+1);
+    1012             :       }
+    1013             : 
+    1014             :     I sp1,rp1,sp2,rp2;
+    1015             :     bool dummy;
+    1016           0 :     get_ring_info_small(ring1,sp1,rp1,dummy);
+    1017           0 :     get_ring_info_small(ring2,sp2,rp2,dummy);
+    1018           0 :     I pix1 = sp1,
+    1019           0 :       pix2 = sp2+rp2;
+    1020           0 :     if (pix1<=pix2) pixset.append(pix1,pix2);
+    1021             :     }
+    1022             :   else
+    1023           0 :     planck_fail("query_strip not yet implemented for NESTED");
+    1024           0 :   }
+    1025             : 
+    1026           0 : template<typename I> void T_Healpix_Base<I>::query_strip (double theta1,
+    1027             :   double theta2, bool inclusive, rangeset<I> &pixset) const
+    1028             :   {
+    1029             :   pixset.clear();
+    1030             : 
+    1031           0 :   if (theta1<theta2)
+    1032           0 :     query_strip_internal(theta1,theta2,inclusive,pixset);
+    1033             :   else
+    1034             :     {
+    1035           0 :     query_strip_internal(0.,theta2,inclusive,pixset);
+    1036             :     rangeset<I> ps2;
+    1037           0 :     query_strip_internal(theta1,pi,inclusive,ps2);
+    1038           0 :     pixset.append(ps2);
+    1039             :     }
+    1040           0 :   }
+    1041             : 
+    1042           0 : template<typename I> inline void T_Healpix_Base<I>::get_ring_info_small
+    1043             :   (I ring, I &startpix, I &ringpix, bool &shifted) const
+    1044             :   {
+    1045           0 :   if (ring < nside_)
+    1046             :     {
+    1047           0 :     shifted = true;
+    1048           0 :     ringpix = 4*ring;
+    1049           0 :     startpix = 2*ring*(ring-1);
+    1050             :     }
+    1051           0 :   else if (ring < 3*nside_)
+    1052             :     {
+    1053           0 :     shifted = ((ring-nside_) & 1) == 0;
+    1054           0 :     ringpix = 4*nside_;
+    1055           0 :     startpix = ncap_ + (ring-nside_)*ringpix;
+    1056             :     }
+    1057             :   else
+    1058             :     {
+    1059           0 :     shifted = true;
+    1060           0 :     I nr= 4*nside_-ring;
+    1061           0 :     ringpix = 4*nr;
+    1062           0 :     startpix = npix_-2*nr*(nr+1);
+    1063             :     }
+    1064           0 :   }
+    1065             : 
+    1066           0 : template<typename I> void T_Healpix_Base<I>::get_ring_info (I ring, I &startpix,
+    1067             :   I &ringpix, double &costheta, double &sintheta, bool &shifted) const
+    1068             :   {
+    1069           0 :   I northring = (ring>2*nside_) ? 4*nside_-ring : ring;
+    1070           0 :   if (northring < nside_)
+    1071             :     {
+    1072           0 :     double tmp = northring*northring*fact2_;
+    1073           0 :     costheta = 1 - tmp;
+    1074           0 :     sintheta = sqrt(tmp*(2-tmp));
+    1075           0 :     ringpix = 4*northring;
+    1076           0 :     shifted = true;
+    1077           0 :     startpix = 2*northring*(northring-1);
+    1078             :     }
+    1079             :   else
+    1080             :     {
+    1081           0 :     costheta = (2*nside_-northring)*fact1_;
+    1082           0 :     sintheta = sqrt((1+costheta)*(1-costheta));
+    1083           0 :     ringpix = 4*nside_;
+    1084           0 :     shifted = ((northring-nside_) & 1) == 0;
+    1085           0 :     startpix = ncap_ + (northring-nside_)*ringpix;
+    1086             :     }
+    1087           0 :   if (northring != ring) // southern hemisphere
+    1088             :     {
+    1089           0 :     costheta = -costheta;
+    1090           0 :     startpix = npix_ - startpix - ringpix;
+    1091             :     }
+    1092           0 :   }
+    1093           0 : template<typename I> void T_Healpix_Base<I>::get_ring_info2 (I ring,
+    1094             :   I &startpix, I &ringpix, double &theta, bool &shifted) const
+    1095             :   {
+    1096           0 :   I northring = (ring>2*nside_) ? 4*nside_-ring : ring;
+    1097           0 :   if (northring < nside_)
+    1098             :     {
+    1099           0 :     double tmp = northring*northring*fact2_;
+    1100           0 :     double costheta = 1 - tmp;
+    1101           0 :     double sintheta = sqrt(tmp*(2-tmp));
+    1102           0 :     theta = atan2(sintheta,costheta);
+    1103           0 :     ringpix = 4*northring;
+    1104           0 :     shifted = true;
+    1105           0 :     startpix = 2*northring*(northring-1);
+    1106             :     }
+    1107             :   else
+    1108             :     {
+    1109           0 :     theta = acos((2*nside_-northring)*fact1_);
+    1110           0 :     ringpix = 4*nside_;
+    1111           0 :     shifted = ((northring-nside_) & 1) == 0;
+    1112           0 :     startpix = ncap_ + (northring-nside_)*ringpix;
+    1113             :     }
+    1114           0 :   if (northring != ring) // southern hemisphere
+    1115             :     {
+    1116           0 :     theta = pi-theta;
+    1117           0 :     startpix = npix_ - startpix - ringpix;
+    1118             :     }
+    1119           0 :   }
+    1120             : 
+    1121           0 : template<typename I> void T_Healpix_Base<I>::neighbors (I pix,
+    1122             :   fix_arr<I,8> &result) const
+    1123             :   {
+    1124             :   int ix, iy, face_num;
+    1125           0 :   (scheme_==RING) ?
+    1126           0 :     ring2xyf(pix,ix,iy,face_num) : nest2xyf(pix,ix,iy,face_num);
+    1127             : 
+    1128           0 :   const I nsm1 = nside_-1;
+    1129           0 :   if ((ix>0)&&(ix<nsm1)&&(iy>0)&&(iy<nsm1))
+    1130             :     {
+    1131           0 :     if (scheme_==RING)
+    1132           0 :       for (int m=0; m<8; ++m)
+    1133           0 :         result[m] = xyf2ring(ix+nb_xoffset[m],iy+nb_yoffset[m],face_num);
+    1134             :     else
+    1135             :       {
+    1136           0 :       I fpix = I(face_num)<<(2*order_),
+    1137           0 :         px0=spread_bits(ix  ), py0=spread_bits(iy  )<<1,
+    1138           0 :         pxp=spread_bits(ix+1), pyp=spread_bits(iy+1)<<1,
+    1139           0 :         pxm=spread_bits(ix-1), pym=spread_bits(iy-1)<<1;
+    1140             : 
+    1141           0 :       result[0] = fpix+pxm+py0; result[1] = fpix+pxm+pyp;
+    1142           0 :       result[2] = fpix+px0+pyp; result[3] = fpix+pxp+pyp;
+    1143           0 :       result[4] = fpix+pxp+py0; result[5] = fpix+pxp+pym;
+    1144           0 :       result[6] = fpix+px0+pym; result[7] = fpix+pxm+pym;
+    1145             :       }
+    1146             :     }
+    1147             :   else
+    1148             :     {
+    1149           0 :     for (int i=0; i<8; ++i)
+    1150             :       {
+    1151           0 :       int x=ix+nb_xoffset[i], y=iy+nb_yoffset[i];
+    1152             :       int nbnum=4;
+    1153           0 :       if (x<0)
+    1154           0 :         { x+=nside_; nbnum-=1; }
+    1155           0 :       else if (x>=nside_)
+    1156           0 :         { x-=nside_; nbnum+=1; }
+    1157           0 :       if (y<0)
+    1158           0 :         { y+=nside_; nbnum-=3; }
+    1159           0 :       else if (y>=nside_)
+    1160           0 :         { y-=nside_; nbnum+=3; }
+    1161             : 
+    1162           0 :       int f = nb_facearray[nbnum][face_num];
+    1163           0 :       if (f>=0)
+    1164             :         {
+    1165           0 :         int bits = nb_swaparray[nbnum][face_num>>2];
+    1166           0 :         if (bits&1) x=nside_-x-1;
+    1167           0 :         if (bits&2) y=nside_-y-1;
+    1168           0 :         if (bits&4) std::swap(x,y);
+    1169           0 :         result[i] = (scheme_==RING) ? xyf2ring(x,y,f) : xyf2nest(x,y,f);
+    1170             :         }
+    1171             :       else
+    1172           0 :         result[i] = -1;
+    1173             :       }
+    1174             :     }
+    1175           0 :   }
+    1176             : 
+    1177           0 : template<typename I> void T_Healpix_Base<I>::get_interpol (const pointing &ptg,
+    1178             :   fix_arr<I,4> &pix, fix_arr<double,4> &wgt) const
+    1179             :   {
+    1180           0 :   planck_assert((ptg.theta>=0)&&(ptg.theta<=pi),"invalid theta value");
+    1181           0 :   double z = cos (ptg.theta);
+    1182           0 :   I ir1 = ring_above(z);
+    1183           0 :   I ir2 = ir1+1;
+    1184             :   double theta1, theta2, w1, tmp, dphi;
+    1185             :   I sp,nr;
+    1186             :   bool shift;
+    1187             :   I i1,i2;
+    1188           0 :   if (ir1>0)
+    1189             :     {
+    1190           0 :     get_ring_info2 (ir1, sp, nr, theta1, shift);
+    1191           0 :     dphi = twopi/nr;
+    1192           0 :     tmp = (ptg.phi/dphi - .5*shift);
+    1193           0 :     i1 = (tmp<0) ? I(tmp)-1 : I(tmp);
+    1194           0 :     w1 = (ptg.phi-(i1+.5*shift)*dphi)/dphi;
+    1195           0 :     i2 = i1+1;
+    1196           0 :     if (i1<0) i1 +=nr;
+    1197           0 :     if (i2>=nr) i2 -=nr;
+    1198           0 :     pix[0] = sp+i1; pix[1] = sp+i2;
+    1199           0 :     wgt[0] = 1-w1; wgt[1] = w1;
+    1200             :     }
+    1201           0 :   if (ir2<(4*nside_))
+    1202             :     {
+    1203           0 :     get_ring_info2 (ir2, sp, nr, theta2, shift);
+    1204           0 :     dphi = twopi/nr;
+    1205           0 :     tmp = (ptg.phi/dphi - .5*shift);
+    1206           0 :     i1 = (tmp<0) ? I(tmp)-1 : I(tmp);
+    1207           0 :     w1 = (ptg.phi-(i1+.5*shift)*dphi)/dphi;
+    1208           0 :     i2 = i1+1;
+    1209           0 :     if (i1<0) i1 +=nr;
+    1210           0 :     if (i2>=nr) i2 -=nr;
+    1211           0 :     pix[2] = sp+i1; pix[3] = sp+i2;
+    1212           0 :     wgt[2] = 1-w1; wgt[3] = w1;
+    1213             :     }
+    1214             : 
+    1215           0 :   if (ir1==0)
+    1216             :     {
+    1217           0 :     double wtheta = ptg.theta/theta2;
+    1218           0 :     wgt[2] *= wtheta; wgt[3] *= wtheta;
+    1219           0 :     double fac = (1-wtheta)*0.25;
+    1220           0 :     wgt[0] = fac; wgt[1] = fac; wgt[2] += fac; wgt[3] +=fac;
+    1221           0 :     pix[0] = (pix[2]+2)&3;
+    1222           0 :     pix[1] = (pix[3]+2)&3;
+    1223             :     }
+    1224           0 :   else if (ir2==4*nside_)
+    1225             :     {
+    1226           0 :     double wtheta = (ptg.theta-theta1)/(pi-theta1);
+    1227           0 :     wgt[0] *= (1-wtheta); wgt[1] *= (1-wtheta);
+    1228           0 :     double fac = wtheta*0.25;
+    1229           0 :     wgt[0] += fac; wgt[1] += fac; wgt[2] = fac; wgt[3] =fac;
+    1230           0 :     pix[2] = ((pix[0]+2)&3)+npix_-4;
+    1231           0 :     pix[3] = ((pix[1]+2)&3)+npix_-4;
+    1232             :     }
+    1233             :   else
+    1234             :     {
+    1235           0 :     double wtheta = (ptg.theta-theta1)/(theta2-theta1);
+    1236           0 :     wgt[0] *= (1-wtheta); wgt[1] *= (1-wtheta);
+    1237           0 :     wgt[2] *= wtheta; wgt[3] *= wtheta;
+    1238             :     }
+    1239             : 
+    1240           0 :   if (scheme_==NEST)
+    1241           0 :     for (tsize m=0; m<pix.size(); ++m)
+    1242           0 :       pix[m] = ring2nest(pix[m]);
+    1243           0 :   }
+    1244             : 
+    1245           0 : template<typename I> void T_Healpix_Base<I>::swap (T_Healpix_Base &other)
+    1246             :   {
+    1247             :   std::swap(order_,other.order_);
+    1248             :   std::swap(nside_,other.nside_);
+    1249             :   std::swap(npface_,other.npface_);
+    1250             :   std::swap(ncap_,other.ncap_);
+    1251             :   std::swap(npix_,other.npix_);
+    1252             :   std::swap(fact1_,other.fact1_);
+    1253             :   std::swap(fact2_,other.fact2_);
+    1254             :   std::swap(scheme_,other.scheme_);
+    1255           0 :   }
+    1256             : 
+    1257           0 : template<typename I> double T_Healpix_Base<I>::max_pixrad() const
+    1258             :   {
+    1259             :   vec3 va,vb;
+    1260           0 :   va.set_z_phi (2./3., pi/(4*nside_));
+    1261           0 :   double t1 = 1.-1./nside_;
+    1262           0 :   t1*=t1;
+    1263           0 :   vb.set_z_phi (1-t1/3, 0);
+    1264           0 :   return v_angle(va,vb);
+    1265             :   }
+    1266             : 
+    1267           0 : template<typename I> double T_Healpix_Base<I>::max_pixrad(I ring) const
+    1268             :   {
+    1269           0 :   if (ring>=2*nside_) ring=4*nside_-ring;
+    1270           0 :   double z=ring2z(ring), z_up=(ring>1) ? ring2z(ring-1) : 1.;
+    1271             :   vec3 mypos, uppos;
+    1272           0 :   uppos.set_z_phi(z_up,0);
+    1273           0 :   if (ring<=nside_)
+    1274             :     {
+    1275           0 :     mypos.set_z_phi(z,pi/(4*ring));
+    1276           0 :     return v_angle(mypos,uppos);
+    1277             :     }
+    1278           0 :   mypos.set_z_phi(z,0);
+    1279           0 :   double vdist=v_angle(mypos,uppos);
+    1280           0 :   double hdist=sqrt(1.-z*z)*pi/(4*nside_);
+    1281           0 :   return max(hdist,vdist);
+    1282             :   }
+    1283             : 
+    1284           0 : template<typename I> void T_Healpix_Base<I>::xyf2loc (double x, double y,
+    1285             :   int face, double &z, double &phi, double &sth, bool &have_sth) const
+    1286             :   {
+    1287           0 :   have_sth = false;
+    1288           0 :   double jr = jrll[face] - x - y;
+    1289             :   double nr;
+    1290           0 :   if (jr<1)
+    1291             :     {
+    1292             :     nr = jr;
+    1293           0 :     double tmp = nr*nr/3.;
+    1294           0 :     z = 1 - tmp;
+    1295           0 :     if (z > 0.99)
+    1296             :       {
+    1297           0 :       sth = std::sqrt(tmp*(2.0-tmp));
+    1298           0 :       have_sth = true;
+    1299             :       }
+    1300             :     }
+    1301           0 :   else if (jr>3)
+    1302             :     {
+    1303           0 :     nr = 4-jr;
+    1304           0 :     double tmp = nr*nr/3.;
+    1305           0 :     z = tmp - 1;
+    1306           0 :     if (z<-0.99)
+    1307             :       {
+    1308           0 :       sth = std::sqrt(tmp*(2.-tmp));
+    1309           0 :       have_sth = true;
+    1310             :       }
+    1311             :     }
+    1312             :   else
+    1313             :     {
+    1314             :     nr = 1;
+    1315           0 :     z = (2-jr)*2./3.;
+    1316             :     }
+    1317             : 
+    1318           0 :   double tmp=jpll[face]*nr+x-y;
+    1319           0 :   if (tmp<0) tmp+=8;
+    1320           0 :   if (tmp>=8) tmp-=8;
+    1321           0 :   phi = (nr<1e-15) ? 0 : (0.5*halfpi*tmp)/nr;
+    1322           0 :   }
+    1323             : 
+    1324             : namespace {
+    1325             : 
+    1326           0 : vec3 locToVec3 (double z, double phi, double sth, bool have_sth)
+    1327             :   {
+    1328           0 :   if (have_sth)
+    1329           0 :     return vec3(sth*cos(phi),sth*sin(phi),z);
+    1330             :   else
+    1331             :     {
+    1332             :     vec3 res;
+    1333           0 :     res.set_z_phi (z, phi);
+    1334           0 :     return res;
+    1335             :     }
+    1336             :   }
+    1337             : 
+    1338             : } // unnamed namespace
+    1339             : 
+    1340           0 : template<typename I> void T_Healpix_Base<I>::boundaries(I pix, tsize step,
+    1341             :   vector<vec3> &out) const
+    1342             :   {
+    1343           0 :   out.resize(4*step);
+    1344             :   int ix, iy, face;
+    1345           0 :   pix2xyf(pix, ix, iy, face);
+    1346           0 :   double dc = 0.5 / nside_;
+    1347           0 :   double xc = (ix + 0.5)/nside_, yc = (iy + 0.5)/nside_;
+    1348           0 :   double d = 1.0/(step*nside_);
+    1349           0 :   for (tsize i=0; i<step; ++i)
+    1350             :     {
+    1351             :     double z, phi, sth;
+    1352             :     bool have_sth;
+    1353           0 :     xyf2loc(xc+dc-i*d, yc+dc, face, z, phi, sth, have_sth);
+    1354           0 :     out[i] = locToVec3(z, phi, sth, have_sth);
+    1355           0 :     xyf2loc(xc-dc, yc+dc-i*d, face, z, phi, sth, have_sth);
+    1356           0 :     out[i+step] = locToVec3(z, phi, sth, have_sth);
+    1357           0 :     xyf2loc(xc-dc+i*d, yc-dc, face, z, phi, sth, have_sth);
+    1358           0 :     out[i+2*step] = locToVec3(z, phi, sth, have_sth);
+    1359           0 :     xyf2loc(xc+dc, yc-dc+i*d, face, z, phi, sth, have_sth);
+    1360           0 :     out[i+3*step] = locToVec3(z, phi, sth, have_sth);
+    1361             :     }
+    1362           0 :   }
+    1363             : 
+    1364           0 : template<typename I> arr<int> T_Healpix_Base<I>::swap_cycles() const
+    1365             :   {
+    1366           0 :   planck_assert(order_>=0, "need hierarchical map");
+    1367           0 :   planck_assert(order_<=13, "map too large");
+    1368           0 :   arr<int> result(swap_clen[order_]);
+    1369             :   tsize ofs=0;
+    1370           0 :   for (int m=0; m<order_;++m) ofs+=swap_clen[m];
+    1371           0 :   for (tsize m=0; m<result.size();++m) result[m]=swap_cycle[m+ofs];
+    1372           0 :   return result;
+    1373             :   }
+    1374             : 
+    1375             : template class T_Healpix_Base<int>;
+    1376             : template class T_Healpix_Base<int64>;
+    1377             : } // namespace healpix
+    1378             : 
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/alloc_utils.h.func-sort-c.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/alloc_utils.h.func-sort-c.html new file mode 100644 index 000000000..7fadb1a05 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/alloc_utils.h.func-sort-c.html @@ -0,0 +1,96 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/alloc_utils.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - alloc_utils.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:020.0 %
Date:2024-04-08 14:58:22Functions:060.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZNK7healpix13normalAlloc__INS_14T_Healpix_BaseIiEEE5allocEm0
_ZNK7healpix13normalAlloc__INS_14T_Healpix_BaseIlEEE5allocEm0
_ZNK7healpix13normalAlloc__INS_6vec3_tIdEEE5allocEm0
_ZNK7healpix13normalAlloc__IdE5allocEm0
_ZNK7healpix13normalAlloc__IiE5allocEm0
_ZNK7healpix13normalAlloc__ImE5allocEm0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/alloc_utils.h.func.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/alloc_utils.h.func.html new file mode 100644 index 000000000..4e93cb259 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/alloc_utils.h.func.html @@ -0,0 +1,96 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/alloc_utils.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - alloc_utils.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:020.0 %
Date:2024-04-08 14:58:22Functions:060.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZNK7healpix13normalAlloc__INS_14T_Healpix_BaseIiEEE5allocEm0
_ZNK7healpix13normalAlloc__INS_14T_Healpix_BaseIlEEE5allocEm0
_ZNK7healpix13normalAlloc__INS_6vec3_tIdEEE5allocEm0
_ZNK7healpix13normalAlloc__IdE5allocEm0
_ZNK7healpix13normalAlloc__IiE5allocEm0
_ZNK7healpix13normalAlloc__ImE5allocEm0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/alloc_utils.h.gcov.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/alloc_utils.h.gcov.html new file mode 100644 index 000000000..6d1cc4bf4 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/alloc_utils.h.gcov.html @@ -0,0 +1,154 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/alloc_utils.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - alloc_utils.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:020.0 %
Date:2024-04-08 14:58:22Functions:060.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : 
+       2             : /*
+       3             :  *  This file is part of libcxxsupport.
+       4             :  *
+       5             :  *  libcxxsupport is free software; you can redistribute it and/or modify
+       6             :  *  it under the terms of the GNU General Public License as published by
+       7             :  *  the Free Software Foundation; either version 2 of the License, or
+       8             :  *  (at your option) any later version.
+       9             :  *
+      10             :  *  libcxxsupport is distributed in the hope that it will be useful,
+      11             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+      12             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+      13             :  *  GNU General Public License for more details.
+      14             :  *
+      15             :  *  You should have received a copy of the GNU General Public License
+      16             :  *  along with libcxxsupport; if not, write to the Free Software
+      17             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+      18             :  */
+      19             : 
+      20             : /*
+      21             :  *  libcxxsupport is being developed at the Max-Planck-Institut fuer Astrophysik
+      22             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
+      23             :  *  (DLR).
+      24             :  */
+      25             : 
+      26             : /*! \file alloc_utils.h
+      27             :  *  Classes providing raw memory allocation and deallocation support.
+      28             :  *
+      29             :  *  Copyright (C) 2011 Max-Planck-Society
+      30             :  *  \author Martin Reinecke
+      31             :  */
+      32             : 
+      33             : #ifndef PLANCK_ALLOC_UTILS_H
+      34             : #define PLANCK_ALLOC_UTILS_H
+      35             : 
+      36             : #include <cstdlib>
+      37             : #include "healpix_base/datatypes.h"
+      38             : 
+      39             : namespace healpix{
+      40             : template <typename T> class normalAlloc__
+      41             :   {
+      42             :   public:
+      43           0 :     T *alloc(tsize sz) const { return (sz>0) ? new T[sz] : 0; }
+      44           0 :     void dealloc (T *ptr) const { delete[] ptr; }
+      45             :   };
+      46             : 
+      47             : template <typename T, int align> class alignAlloc__
+      48             :   {
+      49             :   public:
+      50             :     T *alloc(tsize sz) const
+      51             :       {
+      52             :       using namespace std;
+      53             :       if (sz==0) return 0;
+      54             :       planck_assert((align&(align-1))==0,"alignment must be power of 2");
+      55             :       void *res;
+      56             : /* OSX up to version 10.5 does not define posix_memalign(), but fortunately
+      57             :    the normal malloc() returns 16 byte aligned storage */
+      58             : #ifdef __APPLE__
+      59             :       planck_assert(align<=16, "bad alignment requested");
+      60             :       res=malloc(sz*sizeof(T));
+      61             :       planck_assert(res!=0,"error in malloc()");
+      62             : #else
+      63             :       planck_assert(posix_memalign(&res,align,sz*sizeof(T))==0,
+      64             :         "error in posix_memalign()");
+      65             : #endif
+      66             :       return static_cast<T *>(res);
+      67             :       }
+      68             :     void dealloc(T *ptr) const
+      69             :       {
+      70             :       using namespace std;
+      71             :       free(ptr);
+      72             :       }
+      73             :   };
+      74             : 
+      75             : 
+      76             : } // namespace healpix
+      77             : 
+      78             : #endif
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/arr.h.func-sort-c.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/arr.h.func-sort-c.html new file mode 100644 index 000000000..9bd6e3a5a --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/arr.h.func-sort-c.html @@ -0,0 +1,76 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/arr.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - arr.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0150.0 %
Date:2024-04-08 14:58:22Functions:010.0 %
+
+ +
+ + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix4arrTIdNS_13normalAlloc__IdEEEC2EmRKd0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/arr.h.func.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/arr.h.func.html new file mode 100644 index 000000000..782efedc9 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/arr.h.func.html @@ -0,0 +1,76 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/arr.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - arr.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0150.0 %
Date:2024-04-08 14:58:22Functions:010.0 %
+
+ +
+ + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix4arrTIdNS_13normalAlloc__IdEEEC2EmRKd0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/arr.h.gcov.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/arr.h.gcov.html new file mode 100644 index 000000000..b9803ade1 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/arr.h.gcov.html @@ -0,0 +1,734 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/arr.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - arr.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0150.0 %
Date:2024-04-08 14:58:22Functions:010.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : /*
+       2             :  *  This file is part of libcxxsupport.
+       3             :  *
+       4             :  *  libcxxsupport is free software; you can redistribute it and/or modify
+       5             :  *  it under the terms of the GNU General Public License as published by
+       6             :  *  the Free Software Foundation; either version 2 of the License, or
+       7             :  *  (at your option) any later version.
+       8             :  *
+       9             :  *  libcxxsupport is distributed in the hope that it will be useful,
+      10             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+      11             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+      12             :  *  GNU General Public License for more details.
+      13             :  *
+      14             :  *  You should have received a copy of the GNU General Public License
+      15             :  *  along with libcxxsupport; if not, write to the Free Software
+      16             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+      17             :  */
+      18             : 
+      19             : /*
+      20             :  *  libcxxsupport is being developed at the Max-Planck-Institut fuer Astrophysik
+      21             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
+      22             :  *  (DLR).
+      23             :  */
+      24             : 
+      25             : /*! \file arr.h
+      26             :  *  Various high-performance array classes used by the Planck LevelS package.
+      27             :  *
+      28             :  *  Copyright (C) 2002-2012 Max-Planck-Society
+      29             :  *  \author Martin Reinecke
+      30             :  */
+      31             : 
+      32             : #ifndef PLANCK_ARR_H
+      33             : #define PLANCK_ARR_H
+      34             : 
+      35             : #include <algorithm>
+      36             : #include <vector>
+      37             : #include <cstdlib>
+      38             : #include "healpix_base/alloc_utils.h"
+      39             : #include "healpix_base/datatypes.h"
+      40             : #include "healpix_base/math_utils.h"
+      41             : 
+      42             : namespace healpix{
+      43             : 
+      44             : /*! \defgroup arraygroup Array classes */
+      45             : /*! \{ */
+      46             : 
+      47             : /*! View of a 1D array */
+      48             : template <typename T> class arr_ref
+      49             :   {
+      50             :   protected:
+      51             :     tsize s;
+      52             :     T *d;
+      53             : 
+      54             :   public:
+      55             :     /*! Constructs an \a arr_ref of size \a s_, starting at \a d_. */
+      56           0 :     arr_ref(T *d_, tsize s_) : s(s_),d(d_) {}
+      57             : 
+      58             :     /*! Returns the current array size. */
+      59           0 :     tsize size() const { return s; }
+      60             : 
+      61             :     /*! Writes \a val into every element of the array. */
+      62             :     void fill (const T &val)
+      63           0 :       { for (tsize m=0; m<s; ++m) d[m]=val; }
+      64             : 
+      65             :     /*! Returns a reference to element \a n */
+      66           0 :     template<typename T2> T &operator[] (T2 n) {return d[n];}
+      67             :     /*! Returns a constant reference to element \a n */
+      68           0 :     template<typename T2> const T &operator[] (T2 n) const {return d[n];}
+      69             : 
+      70             :     /*! Returns a pointer to the first array element, or NULL if the array
+      71             :         is zero-sized. */
+      72             :     T *begin() { return d; }
+      73             :     /*! Returns a pointer to the one-past-last array element, or NULL if the
+      74             :         array is zero-sized. */
+      75             :     T *end() { return d+s; }
+      76             :     /*! Returns a constant pointer to the first array element, or NULL if the
+      77             :         array is zero-sized. */
+      78             :     const T *begin() const { return d; }
+      79             :     /*! Returns a constant pointer to the one-past-last array element, or NULL
+      80             :         if the array is zero-sized. */
+      81             :     const T *end() const { return d+s; }
+      82             : 
+      83             :     /*! Copies all array elements to \a ptr. */
+      84             :     template<typename T2> void copyToPtr (T *ptr) const
+      85             :       { for (tsize m=0; m<s; ++m) ptr[m]=d[m]; }
+      86             : 
+      87             :     /*! Sorts the elements in the array, in ascending order. */
+      88             :     void sort()
+      89             :       { std::sort (d,d+s); }
+      90             : 
+      91             :     /*! Sorts the elements in the array, such that \a comp(d[i],d[j])==true
+      92             :         for \a i<j. */
+      93             :     template<typename Comp> void sort(Comp comp)
+      94             :       { std::sort (d,d+s,comp); }
+      95             : 
+      96             :     /*! Helper function for linear interpolation (or extrapolation).
+      97             :         \a idx and \a val are computed such that
+      98             :         \a val=d[idx]+frac*(d[idx+1]-d[idx]). If \a val<d[0], \a frac will be
+      99             :         negative, if \a val>d[s-1], frac will be larger than 1. In all other
+     100             :         cases \a 0<=frac<=1.
+     101             : 
+     102             :         The array must be ordered in ascending order; no two values may be
+     103             :         equal. */
+     104             :     void interpol_helper (const T &val, tsize &idx, double &frac) const
+     105             :       { healpix::interpol_helper (d, d+s, val, idx, frac); }
+     106             : 
+     107             :     /*! Helper function for linear interpolation (or extrapolation).
+     108             :         \a idx and \a val are computed such that
+     109             :         \a val=d[idx]+frac*(d[idx+1]-d[idx]). If \a comp(val,d[0])==true,
+     110             :         \a frac will be negative, if \a comp(val,d[s-1])==false, frac will be
+     111             :         larger than 1. In all other cases \a 0<=frac<=1.
+     112             : 
+     113             :         The array must be ordered such that \a comp(d[i],d[j])==true
+     114             :         for \a i<j; no two values may be equal. */
+     115             :     template<typename Comp> void interpol_helper (const T &val, Comp comp,
+     116             :       tsize &idx, double &frac) const
+     117             :       { healpix::interpol_helper (d, d+s, val, comp, idx, frac); }
+     118             : 
+     119             :     /*! Returns the minimum and maximum entry in \a minv and \a maxv,
+     120             :         respectively. Throws an exception if the array is zero-sized. */
+     121             :     void minmax (T &minv, T &maxv) const
+     122             :       {
+     123             :       planck_assert(s>0,"trying to find min and max of a zero-sized array");
+     124             :       minv=maxv=d[0];
+     125             :       for (tsize m=1; m<s; ++m)
+     126             :         {
+     127             :         if (d[m]<minv) minv=d[m];
+     128             :         else if (d[m]>maxv) maxv=d[m];
+     129             :         }
+     130             :       }
+     131             : 
+     132             :     /*! Returns \a true, if \a val is found in the array, else \a false. */
+     133             :     bool contains (const T &val) const
+     134             :       {
+     135             :       for (tsize m=0; m<s; ++m)
+     136             :         if (d[m]==val) return true;
+     137             :       return false;
+     138             :       }
+     139             : 
+     140             :     /*! Returns the index of the first occurrence of \a val in the array.
+     141             :         If it is not found, an exception is thrown. */
+     142             :     tsize find (const T &val) const
+     143             :       {
+     144             :       for (tsize m=0; m<s; ++m)
+     145             :         if (d[m]==val) return m;
+     146             :       planck_fail ("entry not found in array");
+     147             :       }
+     148             : 
+     149             :     /*! Returns \a true if the array has the same size as \a other and all
+     150             :         elements of both arrays are equal, else \a false. */
+     151             :     bool contentsEqual(const arr_ref &other) const
+     152             :       {
+     153             :       if (s!=other.s) return false;
+     154             :       for (tsize i=0; i<s; ++i)
+     155             :         if (d[i]!=other.d[i]) return false;
+     156             :       return true;
+     157             :       }
+     158             :   };
+     159             : 
+     160             : /*! An array whose size is known at compile time. Very useful for storing
+     161             :     small arrays on the stack, without need for \a new and \a delete(). */
+     162             : template <typename T, tsize sz> class fix_arr
+     163             :   {
+     164             :   private:
+     165             :     T d[sz];
+     166             : 
+     167             :   public:
+     168             :     /*! Returns the size of the array. */
+     169             :     tsize size() const { return sz; }
+     170             : 
+     171             :     /*! Returns a reference to element \a n */
+     172             :     template<typename T2> T &operator[] (T2 n) {return d[n];}
+     173             :     /*! Returns a constant reference to element \a n */
+     174             :     template<typename T2> const T &operator[] (T2 n) const {return d[n];}
+     175             :   };
+     176             : 
+     177             : 
+     178             : /*! One-dimensional array type, with selectable storage management. */
+     179             : template <typename T, typename storageManager> class arrT: public arr_ref<T>
+     180             :   {
+     181             :   private:
+     182             :     storageManager stm;
+     183             :     bool own;
+     184             : 
+     185             :     void reset()
+     186             :       { this->d=0; this->s=0; own=true; }
+     187             : 
+     188             :   public:
+     189             :     /*! Creates a zero-sized array. */
+     190             :     arrT() : arr_ref<T>(0,0), own(true) {}
+     191             :     /*! Creates an array with \a sz entries. */
+     192           0 :     arrT(tsize sz) : arr_ref<T>(stm.alloc(sz),sz), own(true) {}
+     193             :     /*! Creates an array with \a sz entries, and initializes them with
+     194             :         \a inival. */
+     195           0 :     arrT(tsize sz, const T &inival) : arr_ref<T>(stm.alloc(sz),sz), own(true)
+     196           0 :       { this->fill(inival); }
+     197             :     /*! Creates an array with \a sz entries, which uses the memory pointed
+     198             :         to by \a ptr.
+     199             :         \note \a ptr will <i>not</i> be deallocated by the destructor.
+     200             :         \warning Only use this if you REALLY know what you are doing.
+     201             :         In particular, this is only safely usable if
+     202             :           <ul>
+     203             :           <li>\a T is a POD type</li>
+     204             :           <li>\a ptr survives during the lifetime of the array object</li>
+     205             :           <li>\a ptr is not subject to garbage collection</li>
+     206             :           </ul>
+     207             :         Other restrictions may apply. You have been warned. */
+     208             :     arrT (T *ptr, tsize sz): arr_ref<T>(ptr,sz), own(false) {}
+     209             :     /*! Creates an array which is a copy of \a orig. The data in \a orig
+     210             :         is duplicated. */
+     211             :     arrT (const arrT &orig): arr_ref<T>(stm.alloc(orig.s),orig.s), own(true)
+     212             :       { for (tsize m=0; m<this->s; ++m) this->d[m] = orig.d[m]; }
+     213             :     /*! Frees the memory allocated by the object. */
+     214           0 :     ~arrT() { if (own) stm.dealloc(this->d); }
+     215             : 
+     216             :     /*! Allocates space for \a sz elements. The content of the array is
+     217             :         undefined on exit. \a sz can be 0. If \a sz is the
+     218             :         same as the current size, no reallocation is performed. */
+     219             :     void alloc (tsize sz)
+     220             :       {
+     221             :       if (sz==this->s) return;
+     222             :       if (own) stm.dealloc(this->d);
+     223             :       this->s = sz;
+     224             :       this->d = stm.alloc(sz);
+     225             :       own = true;
+     226             :       }
+     227             :     /*! Allocates space for \a sz elements. If \a sz is the
+     228             :         same as the current size, no reallocation is performed.
+     229             :         All elements are set to \a inival. */
+     230             :     void allocAndFill (tsize sz, const T &inival)
+     231             :       { alloc(sz); this->fill(inival); }
+     232             :     /*! Deallocates the memory held by the array, and sets the array size
+     233             :         to 0. */
+     234             :     void dealloc() {if (own) stm.dealloc(this->d); reset();}
+     235             :     /*! Resizes the array to hold \a sz elements. The existing content of the
+     236             :         array is copied over to the new array to the extent possible.
+     237             :         \a sz can be 0. If \a sz is the same as the current size, no
+     238             :         reallocation is performed. */
+     239             :     void resize (tsize sz)
+     240             :       {
+     241             :       using namespace std;
+     242             :       if (sz==this->s) return;
+     243             :       T *tmp = stm.alloc(sz);
+     244             :       for (tsize m=0; m<min(sz,this->s); ++m)
+     245             :         tmp[m]=this->d[m];
+     246             :       if (own) stm.dealloc(this->d);
+     247             :       this->s = sz;
+     248             :       this->d = tmp;
+     249             :       own = true;
+     250             :       }
+     251             : 
+     252             :     /*! Changes the array to be a copy of \a orig. */
+     253             :     arrT &operator= (const arrT &orig)
+     254             :       {
+     255             :       if (this==&orig) return *this;
+     256             :       alloc (orig.s);
+     257             :       for (tsize m=0; m<this->s; ++m) this->d[m] = orig.d[m];
+     258             :       return *this;
+     259             :       }
+     260             : 
+     261             :     /*! Changes the array to be a copy of the std::vector \a orig. */
+     262             :     template<typename T2> void copyFrom (const std::vector<T2> &orig)
+     263             :       {
+     264             :       alloc (orig.size());
+     265             :       for (tsize m=0; m<this->s; ++m) this->d[m] = orig[m];
+     266             :       }
+     267             :     /*! Changes the std::vector \a vec to be a copy of the object. */
+     268             :     template<typename T2> void copyTo (std::vector<T2> &vec) const
+     269             :       {
+     270             :       vec.clear(); vec.reserve(this->s);
+     271             :       for (tsize m=0; m<this->s; ++m) vec.push_back(this->d[m]);
+     272             :       }
+     273             : 
+     274             :     /*! Reserves space for \a sz elements, then copies \a sz elements
+     275             :         from \a ptr into the array. */
+     276             :     template<typename T2> void copyFromPtr (const T2 *ptr, tsize sz)
+     277             :       {
+     278             :       alloc(sz);
+     279             :       for (tsize m=0; m<this->s; ++m) this->d[m]=ptr[m];
+     280             :       }
+     281             : 
+     282             :     /*! Assigns the contents and size of \a other to the array.
+     283             :         \note On exit, \a other is zero-sized! */
+     284             :     void transfer (arrT &other)
+     285             :       {
+     286             :       if (own) stm.dealloc(this->d);
+     287             :       this->d=other.d;
+     288             :       this->s=other.s;
+     289             :       own=other.own;
+     290             :       other.reset();
+     291             :       }
+     292             :     /*! Swaps contents and size with \a other. */
+     293             :     void swap (arrT &other)
+     294             :       {
+     295             :       std::swap(this->d,other.d);
+     296             :       std::swap(this->s,other.s);
+     297             :       std::swap(own,other.own);
+     298             :       }
+     299             :   };
+     300             : 
+     301             : /*! One-dimensional array type. */
+     302             : template <typename T>
+     303           0 :   class arr: public arrT<T,normalAlloc__<T> >
+     304             :   {
+     305             :   public:
+     306             :     /*! Creates a zero-sized array. */
+     307             :     arr() : arrT<T,normalAlloc__<T> >() {}
+     308             :     /*! Creates an array with \a sz entries. */
+     309             :     arr(tsize sz) : arrT<T,normalAlloc__<T> >(sz) {}
+     310             :     /*! Creates an array with \a sz entries, and initializes them with
+     311             :         \a inival. */
+     312           0 :     arr(tsize sz, const T &inival) : arrT<T,normalAlloc__<T> >(sz,inival) {}
+     313             :     /*! Creates an array with \a sz entries, which uses the memory pointed
+     314             :         to by \a ptr.
+     315             :         \note \a ptr will <i>not</i> be deallocated by the destructor.
+     316             :         \warning Only use this if you REALLY know what you are doing.
+     317             :         In particular, this is only safely usable if
+     318             :           <ul>
+     319             :           <li>\a T is a POD type</li>
+     320             :           <li>\a ptr survives during the lifetime of the array object</li>
+     321             :           <li>\a ptr is not subject to garbage collection</li>
+     322             :           </ul>
+     323             :         Other restrictions may apply. You have been warned. */
+     324             :     arr (T *ptr, tsize sz): arrT<T,normalAlloc__<T> >(ptr,sz) {}
+     325             :     /*! Creates an array which is a copy of \a orig. The data in \a orig
+     326             :         is duplicated. */
+     327             :     arr (const arr &orig): arrT<T,normalAlloc__<T> >(orig) {}
+     328             :   };
+     329             : 
+     330             : /*! One-dimensional array type, with selectable storage alignment. */
+     331             : template <typename T, int align>
+     332             :   class arr_align: public arrT<T,alignAlloc__<T,align> >
+     333             :   {
+     334             :   public:
+     335             :     /*! Creates a zero-sized array. */
+     336             :     arr_align() : arrT<T,alignAlloc__<T,align> >() {}
+     337             :     /*! Creates an array with \a sz entries. */
+     338             :     arr_align(tsize sz) : arrT<T,alignAlloc__<T,align> >(sz) {}
+     339             :     /*! Creates an array with \a sz entries, and initializes them with
+     340             :         \a inival. */
+     341             :     arr_align(tsize sz, const T &inival)
+     342             :       : arrT<T,alignAlloc__<T,align> >(sz,inival) {}
+     343             :   };
+     344             : 
+     345             : 
+     346             : /*! Two-dimensional array type, with selectable storage management.
+     347             :     The storage ordering is the same as in C.
+     348             :     An entry is located by address arithmetic, not by double dereferencing.
+     349             :     The indices start at zero. */
+     350             : template <typename T, typename storageManager> class arr2T
+     351             :   {
+     352             :   private:
+     353             :     tsize s1, s2;
+     354             :     arrT<T, storageManager> d;
+     355             : 
+     356             :   public:
+     357             :     /*! Creates a zero-sized array. */
+     358             :     arr2T() : s1(0), s2(0) {}
+     359             :     /*! Creates an array with the dimensions \a sz1 and \a sz2. */
+     360             :     arr2T(tsize sz1, tsize sz2)
+     361             :       : s1(sz1), s2(sz2), d(s1*s2) {}
+     362             :     /*! Creates an array with the dimensions  \a sz1 and \a sz2
+     363             :         and initializes them with \a inival. */
+     364             :     arr2T(tsize sz1, tsize sz2, const T &inival)
+     365             :       : s1(sz1), s2(sz2), d (s1*s2)
+     366             :       { fill(inival); }
+     367             :     /*! Creates the array as a copy of \a orig. */
+     368             :     arr2T(const arr2T &orig)
+     369             :       : s1(orig.s1), s2(orig.s2), d(orig.d) {}
+     370             :     /*! Frees the memory associated with the array. */
+     371             :     ~arr2T() {}
+     372             : 
+     373             :     /*! Returns the first array dimension. */
+     374             :     tsize size1() const { return s1; }
+     375             :     /*! Returns the second array dimension. */
+     376             :     tsize size2() const { return s2; }
+     377             :     /*! Returns the total array size, i.e. the product of both dimensions. */
+     378             :     tsize size () const { return s1*s2; }
+     379             : 
+     380             :     /*! Allocates space for an array with \a sz1*sz2 elements.
+     381             :         The content of the array is undefined on exit.
+     382             :         \a sz1 or \a sz2 can be 0. If \a sz1*sz2 is the same as the
+     383             :         currently allocated space, no reallocation is performed. */
+     384             :     void alloc (tsize sz1, tsize sz2)
+     385             :       {
+     386             :       if (sz1*sz2 != d.size())
+     387             :         d.alloc(sz1*sz2);
+     388             :       s1=sz1; s2=sz2;
+     389             :       }
+     390             :     /*! Allocates space for an array with \a sz1*sz2 elements.
+     391             :         All elements are set to \a inival.
+     392             :         \a sz1 or \a sz2 can be 0. If \a sz1*sz2 is the same as the
+     393             :         currently allocated space, no reallocation is performed. */
+     394             :     void allocAndFill (tsize sz1, tsize sz2, const T &inival)
+     395             :       { alloc(sz1,sz2); fill(inival); }
+     396             :     /*! Allocates space for an array with \a sz1*sz2 elements.
+     397             :         The content of the array is undefined on exit.
+     398             :         \a sz1 or \a sz2 can be 0. If \a sz1*sz2 is smaller than the
+     399             :         currently allocated space, no reallocation is performed. */
+     400             :     void fast_alloc (tsize sz1, tsize sz2)
+     401             :       {
+     402             :       if (sz1*sz2<=d.size())
+     403             :         { s1=sz1; s2=sz2; }
+     404             :       else
+     405             :         alloc(sz1,sz2);
+     406             :       }
+     407             :     /*! Deallocates the space and makes the array zero-sized. */
+     408             :     void dealloc () {d.dealloc(); s1=0; s2=0;}
+     409             : 
+     410             :     /*! Sets all array elements to \a val. */
+     411             :     void fill (const T &val)
+     412             :       { for (tsize m=0; m<s1*s2; ++m) d[m]=val; }
+     413             : 
+     414             :     /*! Multiplies all array elements by \a val. */
+     415             :     void scale (const T &val)
+     416             :       { for (tsize m=0; m<s1*s2; ++m) d[m]*=val; }
+     417             : 
+     418             :     /*! Changes the array to be a copy of \a orig. */
+     419             :     arr2T &operator= (const arr2T &orig)
+     420             :       {
+     421             :       if (this==&orig) return *this;
+     422             :       alloc (orig.s1, orig.s2);
+     423             :       d = orig.d;
+     424             :       return *this;
+     425             :       }
+     426             : 
+     427             :     /*! Returns a pointer to the beginning of slice \a n. */
+     428             :     template<typename T2> T *operator[] (T2 n) {return &d[n*s2];}
+     429             :     /*! Returns a constant pointer to the beginning of slice \a n. */
+     430             :     template<typename T2> const T *operator[] (T2 n) const {return &d[n*s2];}
+     431             : 
+     432             :     /*! Returns a reference to the element with the indices \a n1 and \a n2. */
+     433             :     template<typename T2, typename T3> T &operator() (T2 n1, T3 n2)
+     434             :       {return d[n1*s2 + n2];}
+     435             :     /*! Returns a constant reference to the element with the indices
+     436             :         \a n1 and \a n2. */
+     437             :     template<typename T2, typename T3> const T &operator() (T2 n1, T3 n2) const
+     438             :       {return d[n1*s2 + n2];}
+     439             : 
+     440             :     /*! Returns the minimum and maximum entry in \a minv and \a maxv,
+     441             :         respectively. Throws an exception if the array is zero-sized. */
+     442             :     void minmax (T &minv, T &maxv) const
+     443             :       {
+     444             :       planck_assert(s1*s2>0,
+     445             :         "trying to find min and max of a zero-sized array");
+     446             :       minv=maxv=d[0];
+     447             :       for (tsize m=1; m<s1*s2; ++m)
+     448             :         {
+     449             :         if (d[m]<minv) minv=d[m];
+     450             :         if (d[m]>maxv) maxv=d[m];
+     451             :         }
+     452             :       }
+     453             : 
+     454             :     /*! Swaps contents and sizes with \a other. */
+     455             :     void swap (arr2T &other)
+     456             :       {
+     457             :       d.swap(other.d);
+     458             :       std::swap(s1,other.s1);
+     459             :       std::swap(s2,other.s2);
+     460             :       }
+     461             : 
+     462             :     /*! Returns \c true if the array and \a other have the same dimensions,
+     463             :         else \c false. */
+     464             :     template<typename T2, typename T3> bool conformable
+     465             :       (const arr2T<T2,T3> &other) const
+     466             :       { return (other.size1()==s1) && (other.size2()==s2); }
+     467             :   };
+     468             : 
+     469             : /*! Two-dimensional array type. The storage ordering is the same as in C.
+     470             :     An entry is located by address arithmetic, not by double dereferencing.
+     471             :     The indices start at zero. */
+     472             : template <typename T>
+     473             :   class arr2: public arr2T<T,normalAlloc__<T> >
+     474             :   {
+     475             :   public:
+     476             :     /*! Creates a zero-sized array. */
+     477             :     arr2() : arr2T<T,normalAlloc__<T> > () {}
+     478             :     /*! Creates an array with the dimensions \a sz1 and \a sz2. */
+     479             :     arr2(tsize sz1, tsize sz2) : arr2T<T,normalAlloc__<T> > (sz1,sz2) {}
+     480             :     /*! Creates an array with the dimensions  \a sz1 and \a sz2
+     481             :         and initializes them with \a inival. */
+     482             :     arr2(tsize sz1, tsize sz2, const T &inival)
+     483             :       : arr2T<T,normalAlloc__<T> > (sz1,sz2,inival) {}
+     484             :   };
+     485             : 
+     486             : /*! Two-dimensional array type, with selectable storage alignment.
+     487             :     The storage ordering is the same as in C.
+     488             :     An entry is located by address arithmetic, not by double dereferencing.
+     489             :     The indices start at zero. */
+     490             : template <typename T, int align>
+     491             :   class arr2_align: public arr2T<T,alignAlloc__<T,align> >
+     492             :   {
+     493             :   public:
+     494             :     /*! Creates a zero-sized array. */
+     495             :     arr2_align() : arr2T<T,alignAlloc__<T,align> > () {}
+     496             :     /*! Creates an array with the dimensions \a sz1 and \a sz2. */
+     497             :     arr2_align(tsize sz1, tsize sz2)
+     498             :       : arr2T<T,alignAlloc__<T,align> > (sz1,sz2) {}
+     499             :     /*! Creates an array with the dimensions  \a sz1 and \a sz2
+     500             :         and initializes them with \a inival. */
+     501             :     arr2_align(tsize sz1, tsize sz2, const T &inival)
+     502             :       : arr2T<T,alignAlloc__<T,align> > (sz1,sz2,inival) {}
+     503             :   };
+     504             : 
+     505             : /*! Two-dimensional array type. An entry is located by double dereferencing,
+     506             :     i.e. via an array of pointers. The indices start at zero. */
+     507             : template <typename T> class arr2b
+     508             :   {
+     509             :   private:
+     510             :     tsize s1, s2;
+     511             :     arr<T> d;
+     512             :     arr<T *> d1;
+     513             : 
+     514             :     void fill_d1()
+     515             :       { for (tsize m=0; m<s1; ++m) d1[m] = &d[m*s2]; }
+     516             : 
+     517             :   public:
+     518             :     /*! Creates a zero-sized array. */
+     519             :     arr2b() : s1(0), s2(0), d(0), d1(0) {}
+     520             :     /*! Creates an array with the dimensions \a sz1 and \a sz2. */
+     521             :     arr2b(tsize sz1, tsize sz2)
+     522             :       : s1(sz1), s2(sz2), d(s1*s2), d1(s1)
+     523             :       { fill_d1(); }
+     524             :     /*! Creates the array as a copy of \a orig. */
+     525             :     arr2b(const arr2b &orig)
+     526             :       : s1(orig.s1), s2(orig.s2), d(orig.d), d1(s1)
+     527             :       { fill_d1(); }
+     528             :     /*! Frees the memory associated with the array. */
+     529             :     ~arr2b() {}
+     530             : 
+     531             :     /*! Returns the first array dimension. */
+     532             :     tsize size1() const { return s1; }
+     533             :     /*! Returns the second array dimension. */
+     534             :     tsize size2() const { return s2; }
+     535             :     /*! Returns the total array size, i.e. the product of both dimensions. */
+     536             :     tsize size () const { return s1*s2; }
+     537             : 
+     538             :     /*! Allocates space for an array with \a sz1*sz2 elements.
+     539             :         The content of the array is undefined on exit. */
+     540             :     void alloc (tsize sz1, tsize sz2)
+     541             :       {
+     542             :       if ((s1==sz1) && (s2==sz2)) return;
+     543             :       s1=sz1; s2=sz2;
+     544             :       d.alloc(s1*s2);
+     545             :       d1.alloc(s1);
+     546             :       fill_d1();
+     547             :       }
+     548             :     /*! Deallocates the space and makes the array zero-sized. */
+     549             :     void dealloc () {d.dealloc(); d1.dealloc(); s1=0; s2=0;}
+     550             : 
+     551             :     /*! Sets all array elements to \a val. */
+     552             :     void fill (const T &val)
+     553             :       { d.fill(val); }
+     554             : 
+     555             :     /*! Changes the array to be a copy of \a orig. */
+     556             :     arr2b &operator= (const arr2b &orig)
+     557             :       {
+     558             :       if (this==&orig) return *this;
+     559             :       alloc (orig.s1, orig.s2);
+     560             :       for (tsize m=0; m<s1*s2; ++m) d[m] = orig.d[m];
+     561             :       return *this;
+     562             :       }
+     563             : 
+     564             :     /*! Returns a pointer to the beginning of slice \a n. */
+     565             :     template<typename T2> T *operator[] (T2 n) {return d1[n];}
+     566             :     /*! Returns a constant pointer to the beginning of slice \a n. */
+     567             :     template<typename T2> const T *operator[] (T2 n) const {return d1[n];}
+     568             : 
+     569             :     /*! Returns a pointer to the beginning of the pointer array. */
+     570             :     T **p0() {return &d1[0];}
+     571             :   };
+     572             : 
+     573             : 
+     574             : /*! Three-dimensional array type. The storage ordering is the same as in C.
+     575             :     An entry is located by address arithmetic, not by multiple dereferencing.
+     576             :     The indices start at zero. */
+     577             : template <typename T> class arr3
+     578             :   {
+     579             :   private:
+     580             :     tsize s1, s2, s3, s2s3;
+     581             :     arr<T> d;
+     582             : 
+     583             :   public:
+     584             :     /*! Creates a zero-sized array. */
+     585             :     arr3() : s1(0), s2(0), s3(0), s2s3(0), d(0) {}
+     586             :     /*! Creates an array with the dimensions \a sz1, \a sz2 and \a sz3. */
+     587           0 :     arr3(tsize sz1, tsize sz2, tsize sz3)
+     588           0 :       : s1(sz1), s2(sz2), s3(sz3), s2s3(s2*s3), d(s1*s2*s3) {}
+     589             :     /*! Creates the array as a copy of \a orig. */
+     590             :     arr3(const arr3 &orig)
+     591             :       : s1(orig.s1), s2(orig.s2), s3(orig.s3), s2s3(orig.s2s3), d(orig.d) {}
+     592             :     /*! Frees the memory associated with the array. */
+     593           0 :     ~arr3() {}
+     594             : 
+     595             :     /*! Returns the first array dimension. */
+     596             :     tsize size1() const { return s1; }
+     597             :     /*! Returns the second array dimension. */
+     598             :     tsize size2() const { return s2; }
+     599             :     /*! Returns the third array dimension. */
+     600             :     tsize size3() const { return s3; }
+     601             :     /*! Returns the total array size, i.e. the product of all dimensions. */
+     602             :     tsize size () const { return s1*s2*s3; }
+     603             : 
+     604             :     /*! Allocates space for an array with \a sz1*sz2*sz3 elements.
+     605             :         The content of the array is undefined on exit. */
+     606             :     void alloc (tsize sz1, tsize sz2, tsize sz3)
+     607             :       {
+     608             :       d.alloc(sz1*sz2*sz3);
+     609             :       s1=sz1; s2=sz2; s3=sz3; s2s3=s2*s3;
+     610             :       }
+     611             :     /*! Deallocates the space and makes the array zero-sized. */
+     612             :     void dealloc () {d.dealloc(); s1=0; s2=0; s3=0; s2s3=0;}
+     613             : 
+     614             :     /*! Sets all array elements to \a val. */
+     615             :     void fill (const T &val)
+     616             :       { d.fill(val); }
+     617             : 
+     618             :     /*! Changes the array to be a copy of \a orig. */
+     619             :     arr3 &operator= (const arr3 &orig)
+     620             :       {
+     621             :       if (this==&orig) return *this;
+     622             :       alloc (orig.s1, orig.s2, orig.s3);
+     623             :       d = orig.d;
+     624             :       return *this;
+     625             :       }
+     626             : 
+     627             :     /*! Returns a reference to the element with the indices
+     628             :         \a n1, \a n2 and \a n3. */
+     629             :     template<typename T2, typename T3, typename T4> T &operator()
+     630             :       (T2 n1, T3 n2, T4 n3)
+     631           0 :       {return d[n1*s2s3 + n2*s3 + n3];}
+     632             :     /*! Returns a constant reference to the element with the indices
+     633             :         \a n1, \a n2 and \a n3. */
+     634             :     template<typename T2, typename T3, typename T4> const T &operator()
+     635             :       (T2 n1, T3 n2, T4 n3) const
+     636             :       {return d[n1*s2s3 + n2*s3 + n3];}
+     637             : 
+     638             :     /*! Swaps contents and sizes with \a other. */
+     639             :     void swap (arr3 &other)
+     640             :       {
+     641             :       d.swap(other.d);
+     642             :       std::swap(s1,other.s1);
+     643             :       std::swap(s2,other.s2);
+     644             :       std::swap(s3,other.s3);
+     645             :       std::swap(s2s3,other.s2s3);
+     646             :       }
+     647             : 
+     648             :     /*! Returns \c true if the array and \a other have the same dimensions,
+     649             :         else \c false. */
+     650             :     template<typename T2> bool conformable (const arr3<T2> &other) const
+     651             :       { return (other.size1()==s1)&&(other.size2()==s2)&&(other.size3()==s3); }
+     652             :   };
+     653             : 
+     654             : /*! \} */
+     655             : 
+     656             : } // namespace healpix
+     657             : #endif
+     658             : 
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/error_handling.h.func-sort-c.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/error_handling.h.func-sort-c.html new file mode 100644 index 000000000..3feba0c8f --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/error_handling.h.func-sort-c.html @@ -0,0 +1,76 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/error_handling.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - error_handling.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:020.0 %
Date:2024-04-08 14:58:22Functions:010.0 %
+
+ +
+ + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZNK7healpix11PlanckError4whatEv0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/error_handling.h.func.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/error_handling.h.func.html new file mode 100644 index 000000000..256c36ce3 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/error_handling.h.func.html @@ -0,0 +1,76 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/error_handling.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - error_handling.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:020.0 %
Date:2024-04-08 14:58:22Functions:010.0 %
+
+ +
+ + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZNK7healpix11PlanckError4whatEv0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/error_handling.h.gcov.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/error_handling.h.gcov.html new file mode 100644 index 000000000..5a90a3d3f --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/error_handling.h.gcov.html @@ -0,0 +1,180 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/error_handling.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - error_handling.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:020.0 %
Date:2024-04-08 14:58:22Functions:010.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : 
+       2             : /*
+       3             :  *  This file is part of libcxxsupport.
+       4             :  *
+       5             :  *  libcxxsupport is free software; you can redistribute it and/or modify
+       6             :  *  it under the terms of the GNU General Public License as published by
+       7             :  *  the Free Software Foundation; either version 2 of the License, or
+       8             :  *  (at your option) any later version.
+       9             :  *
+      10             :  *  libcxxsupport is distributed in the hope that it will be useful,
+      11             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+      12             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+      13             :  *  GNU General Public License for more details.
+      14             :  *
+      15             :  *  You should have received a copy of the GNU General Public License
+      16             :  *  along with libcxxsupport; if not, write to the Free Software
+      17             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+      18             :  */
+      19             : 
+      20             : /*
+      21             :  *  libcxxsupport is being developed at the Max-Planck-Institut fuer Astrophysik
+      22             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
+      23             :  *  (DLR).
+      24             :  */
+      25             : 
+      26             : /*! \file error_handling.h
+      27             :  *  Utilities for error reporting
+      28             :  *
+      29             :  *  Copyright (C) 2003-2011 Max-Planck-Society
+      30             :  *  Authors: Reinhard Hell, Martin Reinecke
+      31             :  */
+      32             : 
+      33             : #ifndef PLANCK_ERROR_HANDLING_H
+      34             : #define PLANCK_ERROR_HANDLING_H
+      35             : 
+      36             : #include <string>
+      37             : #include <iostream>
+      38             : 
+      39             : namespace healpix{
+      40             : #if defined (__GNUC__)
+      41             : #define PLANCK_FUNC_NAME__ __PRETTY_FUNCTION__
+      42             : #else
+      43             : #define PLANCK_FUNC_NAME__ 0
+      44             : #endif
+      45             : 
+      46             : void planck_failure__(const char *file, int line, const char *func,
+      47             :   const std::string &msg);
+      48             : void planck_failure__(const char *file, int line, const char *func,
+      49             :   const char *msg);
+      50             : void killjob__();
+      51             : 
+      52             : class PlanckError
+      53             :   {
+      54             :   private:
+      55             :     std::string msg;
+      56             : 
+      57             :   public:
+      58             :     explicit PlanckError(const std::string &message);
+      59             :     explicit PlanckError(const char *message);
+      60             : 
+      61           0 :     virtual const char* what() const
+      62           0 :       { return msg.c_str(); }
+      63             : 
+      64             :     virtual ~PlanckError();
+      65             :   };
+      66             : 
+      67             : /*! \defgroup errorgroup Error handling */
+      68             : /*! \{ */
+      69             : 
+      70             : /*! Writes diagnostic output and exits with an error status. */
+      71             : #define planck_fail(msg) \
+      72             : do { planck_failure__(__FILE__,__LINE__,PLANCK_FUNC_NAME__,msg); \
+      73             : throw PlanckError(msg); } while(0)
+      74             : 
+      75             : /*! Throws a PlanckError without diagnostic message. */
+      76             : #define planck_fail_quietly(msg) \
+      77             : do { throw PlanckError(msg); } while(0)
+      78             : 
+      79             : /*! Writes diagnostic output and exits with an error status if \a testval
+      80             :     is \a false. */
+      81             : #define planck_assert(testval,msg) \
+      82             : do { if (testval); else planck_fail(msg); } while(0)
+      83             : 
+      84             : /*! Macro for improving error diagnostics. Should be placed immediately
+      85             :     after the opening brace of \c main(). Must be used in conjunction with
+      86             :     \c PLANCK_DIAGNOSIS_END. */
+      87             : #define PLANCK_DIAGNOSIS_BEGIN try {
+      88             : /*! Macro for improving error diagnostics. Should be placed immediately
+      89             :     before the closing brace of \c main(). Must be used in conjunction with
+      90             :     \c PLANCK_DIAGNOSIS_BEGIN. */
+      91             : #define PLANCK_DIAGNOSIS_END \
+      92             : } \
+      93             : catch (PlanckError &) \
+      94             :   { killjob__(); /* no need for further diagnostics; they were shown already */ } \
+      95             : catch (std::exception &e) \
+      96             :   { std::cerr << "std::exception: " << e.what() << std::endl; killjob__(); } \
+      97             : catch (...) \
+      98             :   { std::cerr << "Unknown exception" << std::endl; killjob__(); }
+      99             : 
+     100             : /*! \} */
+     101             : 
+     102             : } // namespace healpix
+     103             : #endif
+     104             : 
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/geom_utils.h.func-sort-c.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/geom_utils.h.func-sort-c.html new file mode 100644 index 000000000..19feeba32 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/geom_utils.h.func-sort-c.html @@ -0,0 +1,80 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/geom_utils.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - geom_utils.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:040.0 %
Date:2024-04-08 14:58:22Functions:020.0 %
+
+ +
+ + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix12cosdist_zphiEdddd0
_ZN7healpix7v_angleERKNS_6vec3_tIdEES3_0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/geom_utils.h.func.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/geom_utils.h.func.html new file mode 100644 index 000000000..be6031adf --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/geom_utils.h.func.html @@ -0,0 +1,80 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/geom_utils.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - geom_utils.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:040.0 %
Date:2024-04-08 14:58:22Functions:020.0 %
+
+ +
+ + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix12cosdist_zphiEdddd0
_ZN7healpix7v_angleERKNS_6vec3_tIdEES3_0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/geom_utils.h.gcov.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/geom_utils.h.gcov.html new file mode 100644 index 000000000..42f3ff33f --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/geom_utils.h.gcov.html @@ -0,0 +1,161 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/geom_utils.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - geom_utils.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:040.0 %
Date:2024-04-08 14:58:22Functions:020.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : /*
+       2             :  *  This file is part of libcxxsupport.
+       3             :  *
+       4             :  *  libcxxsupport is free software; you can redistribute it and/or modify
+       5             :  *  it under the terms of the GNU General Public License as published by
+       6             :  *  the Free Software Foundation; either version 2 of the License, or
+       7             :  *  (at your option) any later version.
+       8             :  *
+       9             :  *  libcxxsupport is distributed in the hope that it will be useful,
+      10             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+      11             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+      12             :  *  GNU General Public License for more details.
+      13             :  *
+      14             :  *  You should have received a copy of the GNU General Public License
+      15             :  *  along with libcxxsupport; if not, write to the Free Software
+      16             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+      17             :  */
+      18             : 
+      19             : /*
+      20             :  *  libcxxsupport is being developed at the Max-Planck-Institut fuer Astrophysik
+      21             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
+      22             :  *  (DLR).
+      23             :  */
+      24             : 
+      25             : /*! \file geom_utils.h
+      26             :  *  Geometric utility functions.
+      27             :  *
+      28             :  *  Copyright (C) 2003-2011 Max-Planck-Society
+      29             :  *  \author Martin Reinecke
+      30             :  *  \author Reinhard Hell
+      31             :  */
+      32             : 
+      33             : #ifndef PLANCK_GEOM_UTILS_H
+      34             : #define PLANCK_GEOM_UTILS_H
+      35             : 
+      36             : #include "healpix_base/math_utils.h"
+      37             : #include "healpix_base/vec3.h"
+      38             : 
+      39             : namespace healpix{
+      40             : 
+      41             : template<typename T> class arr;
+      42             : 
+      43             : /*! Returns the orientation when looking from point \a loc on the unit
+      44             :     sphere in the direction \a dir. \a loc must be normalized. The result
+      45             :     ranges from -pi to pi, is 0 for North and pi/2 for West, i.e. the angle
+      46             :     is given in mathematically positive sense.
+      47             : 
+      48             :     If \a loc is the North or South pole, the returned angle is
+      49             :     \a atan2(dir.y,dir.x). */
+      50             : inline double orientation (const vec3 &loc, const vec3 &dir)
+      51             :   {
+      52             : // FIXME: here is still optimization potential
+      53             :   if (loc.x==0 && loc.y==0)
+      54             :     return (loc.z>0) ? safe_atan2(dir.y,-dir.x) : safe_atan2(dir.y,dir.x);
+      55             :   vec3 east (-loc.y, loc.x, 0);
+      56             :   vec3 north = crossprod(loc,east);
+      57             :   return safe_atan2(-dotprod(dir,east),dotprod(dir,north));
+      58             :   }
+      59             : 
+      60             : /*! Returns the angle between \a v1 and \a v2 in radians. */
+      61           0 : inline double v_angle (const vec3 &v1, const vec3 &v2)
+      62             :   {
+      63             :   using namespace std;
+      64           0 :   return atan2 (crossprod(v1,v2).Length(), dotprod(v1,v2));
+      65             :   }
+      66             : 
+      67             : /*! Returns the cosine of the angle between the two points on the sphere defined
+      68             :     by (\a z1, \a phi1) and (\a z2, \a phi2), respectively. \a z is the cosine
+      69             :     of the colatitude, and \a phi is the longitude. */
+      70           0 : inline double cosdist_zphi (double z1, double phi1, double z2, double phi2)
+      71             :   {
+      72             :   using namespace std;
+      73           0 :   return z1*z2+cos(phi1-phi2)*sqrt((1.-z1*z1)*(1.-z2*z2));
+      74             :   }
+      75             : 
+      76             : /*! Finds the smallest enclosing cone for a point set on the sphere according to
+      77             :     Barequet & Elber: Information Processing Letters 93(2005), p.83.
+      78             :     All points are expected to be passed as unit vectors.
+      79             :     The enclosing cone must have an opening angle <pi/2. */
+      80             : void find_enclosing_circle (const arr<vec3> &point, vec3 &center,
+      81             :   double &cosrad);
+      82             : 
+      83             : } // namespace healpix
+      84             : #endif
+      85             : 
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/healpix_base.h.func-sort-c.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/healpix_base.h.func-sort-c.html new file mode 100644 index 000000000..c2ac9dce4 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/healpix_base.h.func-sort-c.html @@ -0,0 +1,208 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/healpix_base.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - healpix_base.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:165032.0 %
Date:2024-04-08 14:58:22Functions:3348.8 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix14T_Healpix_BaseIiEC2EiNS_23Healpix_Ordering_SchemeE0
_ZN7healpix14T_Healpix_BaseIiEC2EiNS_23Healpix_Ordering_SchemeENS_11nside_dummyE0
_ZN7healpix14T_Healpix_BaseIlEC2EiNS_23Healpix_Ordering_SchemeE0
_ZN7healpix14T_Healpix_BaseIlEC2ElNS_23Healpix_Ordering_SchemeENS_11nside_dummyE0
_ZNK7healpix14T_Healpix_BaseIiE10query_discERKNS_8pointingEdRSt6vectorIiSaIiEE0
_ZNK7healpix14T_Healpix_BaseIiE11conformableERKS1_0
_ZNK7healpix14T_Healpix_BaseIiE20query_disc_inclusiveERKNS_8pointingEdRSt6vectorIiSaIiEEi0
_ZNK7healpix14T_Healpix_BaseIiE4NpixEv0
_ZNK7healpix14T_Healpix_BaseIiE5NsideEv0
_ZNK7healpix14T_Healpix_BaseIiE5OrderEv0
_ZNK7healpix14T_Healpix_BaseIiE6SchemeEv0
_ZNK7healpix14T_Healpix_BaseIiE7ang2pixERKNS_8pointingE0
_ZNK7healpix14T_Healpix_BaseIiE7pix2angEi0
_ZNK7healpix14T_Healpix_BaseIiE7pix2xyfEiRiS2_S2_0
_ZNK7healpix14T_Healpix_BaseIiE7xyf2pixEiii0
_ZNK7healpix14T_Healpix_BaseIiE8pix2zphiEiRdS2_0
_ZNK7healpix14T_Healpix_BaseIiE8zphi2pixEdd0
_ZNK7healpix14T_Healpix_BaseIlE10query_discERKNS_8pointingEdRSt6vectorIlSaIlEE0
_ZNK7healpix14T_Healpix_BaseIlE11conformableERKS1_0
_ZNK7healpix14T_Healpix_BaseIlE20query_disc_inclusiveERKNS_8pointingEdRSt6vectorIlSaIlEEi0
_ZNK7healpix14T_Healpix_BaseIlE4NpixEv0
_ZNK7healpix14T_Healpix_BaseIlE5NsideEv0
_ZNK7healpix14T_Healpix_BaseIlE5OrderEv0
_ZNK7healpix14T_Healpix_BaseIlE6SchemeEv0
_ZNK7healpix14T_Healpix_BaseIlE7ang2pixERKNS_8pointingE0
_ZNK7healpix14T_Healpix_BaseIlE7pix2angEl0
_ZNK7healpix14T_Healpix_BaseIlE7pix2xyfElRiS2_S2_0
_ZNK7healpix14T_Healpix_BaseIlE7vec2pixERKNS_6vec3_tIdEE0
_ZNK7healpix14T_Healpix_BaseIlE7xyf2pixEiii0
_ZNK7healpix14T_Healpix_BaseIlE8pix2zphiElRdS2_0
_ZNK7healpix14T_Healpix_BaseIlE8zphi2pixEdd0
_ZNK7healpix14T_Healpix_BaseIlE7pix2vecEl421
_ZNK7healpix14T_Healpix_BaseIiE7vec2pixERKNS_6vec3_tIdEE24585
_ZNK7healpix14T_Healpix_BaseIiE7pix2vecEi135172
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/healpix_base.h.func.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/healpix_base.h.func.html new file mode 100644 index 000000000..b4d88f50c --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/healpix_base.h.func.html @@ -0,0 +1,208 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/healpix_base.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - healpix_base.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:165032.0 %
Date:2024-04-08 14:58:22Functions:3348.8 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix14T_Healpix_BaseIiEC2EiNS_23Healpix_Ordering_SchemeE0
_ZN7healpix14T_Healpix_BaseIiEC2EiNS_23Healpix_Ordering_SchemeENS_11nside_dummyE0
_ZN7healpix14T_Healpix_BaseIlEC2EiNS_23Healpix_Ordering_SchemeE0
_ZN7healpix14T_Healpix_BaseIlEC2ElNS_23Healpix_Ordering_SchemeENS_11nside_dummyE0
_ZNK7healpix14T_Healpix_BaseIiE10query_discERKNS_8pointingEdRSt6vectorIiSaIiEE0
_ZNK7healpix14T_Healpix_BaseIiE11conformableERKS1_0
_ZNK7healpix14T_Healpix_BaseIiE20query_disc_inclusiveERKNS_8pointingEdRSt6vectorIiSaIiEEi0
_ZNK7healpix14T_Healpix_BaseIiE4NpixEv0
_ZNK7healpix14T_Healpix_BaseIiE5NsideEv0
_ZNK7healpix14T_Healpix_BaseIiE5OrderEv0
_ZNK7healpix14T_Healpix_BaseIiE6SchemeEv0
_ZNK7healpix14T_Healpix_BaseIiE7ang2pixERKNS_8pointingE0
_ZNK7healpix14T_Healpix_BaseIiE7pix2angEi0
_ZNK7healpix14T_Healpix_BaseIiE7pix2vecEi135172
_ZNK7healpix14T_Healpix_BaseIiE7pix2xyfEiRiS2_S2_0
_ZNK7healpix14T_Healpix_BaseIiE7vec2pixERKNS_6vec3_tIdEE24585
_ZNK7healpix14T_Healpix_BaseIiE7xyf2pixEiii0
_ZNK7healpix14T_Healpix_BaseIiE8pix2zphiEiRdS2_0
_ZNK7healpix14T_Healpix_BaseIiE8zphi2pixEdd0
_ZNK7healpix14T_Healpix_BaseIlE10query_discERKNS_8pointingEdRSt6vectorIlSaIlEE0
_ZNK7healpix14T_Healpix_BaseIlE11conformableERKS1_0
_ZNK7healpix14T_Healpix_BaseIlE20query_disc_inclusiveERKNS_8pointingEdRSt6vectorIlSaIlEEi0
_ZNK7healpix14T_Healpix_BaseIlE4NpixEv0
_ZNK7healpix14T_Healpix_BaseIlE5NsideEv0
_ZNK7healpix14T_Healpix_BaseIlE5OrderEv0
_ZNK7healpix14T_Healpix_BaseIlE6SchemeEv0
_ZNK7healpix14T_Healpix_BaseIlE7ang2pixERKNS_8pointingE0
_ZNK7healpix14T_Healpix_BaseIlE7pix2angEl0
_ZNK7healpix14T_Healpix_BaseIlE7pix2vecEl421
_ZNK7healpix14T_Healpix_BaseIlE7pix2xyfElRiS2_S2_0
_ZNK7healpix14T_Healpix_BaseIlE7vec2pixERKNS_6vec3_tIdEE0
_ZNK7healpix14T_Healpix_BaseIlE7xyf2pixEiii0
_ZNK7healpix14T_Healpix_BaseIlE8pix2zphiElRdS2_0
_ZNK7healpix14T_Healpix_BaseIlE8zphi2pixEdd0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/healpix_base.h.gcov.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/healpix_base.h.gcov.html new file mode 100644 index 000000000..c89cc2a4d --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/healpix_base.h.gcov.html @@ -0,0 +1,457 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/healpix_base.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - healpix_base.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:165032.0 %
Date:2024-04-08 14:58:22Functions:3348.8 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : /*
+       2             :  *  This file is part of Healpix_cxx.
+       3             :  *
+       4             :  *  Healpix_cxx is free software; you can redistribute it and/or modify
+       5             :  *  it under the terms of the GNU General Public License as published by
+       6             :  *  the Free Software Foundation; either version 2 of the License, or
+       7             :  *  (at your option) any later version.
+       8             :  *
+       9             :  *  Healpix_cxx is distributed in the hope that it will be useful,
+      10             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+      11             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+      12             :  *  GNU General Public License for more details.
+      13             :  *
+      14             :  *  You should have received a copy of the GNU General Public License
+      15             :  *  along with Healpix_cxx; if not, write to the Free Software
+      16             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+      17             :  *
+      18             :  *  For more information about HEALPix, see http://healpix.sourceforge.net
+      19             :  */
+      20             : 
+      21             : /*
+      22             :  *  Healpix_cxx is being developed at the Max-Planck-Institut fuer Astrophysik
+      23             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
+      24             :  *  (DLR).
+      25             :  */
+      26             : 
+      27             : /*! \file healpix_base.h
+      28             :  *  Copyright (C) 2003-2012 Max-Planck-Society
+      29             :  *  \author Martin Reinecke
+      30             :  */
+      31             : 
+      32             : #ifndef HEALPIX_BASE_H
+      33             : #define HEALPIX_BASE_H
+      34             : 
+      35             : #include <vector>
+      36             : #include "healpix_base/healpix_tables.h"
+      37             : #include "healpix_base/pointing.h"
+      38             : #include "healpix_base/arr.h"
+      39             : #include "healpix_base/rangeset.h"
+      40             : 
+      41             : namespace healpix{
+      42             : 
+      43             : /*! Functionality related to the HEALPix pixelisation. */
+      44             : template<typename I> class T_Healpix_Base: public Healpix_Tables
+      45             :   {
+      46             :   protected:
+      47             :     /*! The order of the map; -1 for nonhierarchical map. */
+      48             :     int order_;
+      49             :     /*! The N_side parameter of the map; 0 if not allocated. */
+      50             :     I nside_;
+      51             :     I npface_, ncap_, npix_;
+      52             :     double fact1_, fact2_;
+      53             :     /*! The map's ordering scheme. */
+      54             :     Healpix_Ordering_Scheme scheme_;
+      55             : 
+      56             :     /*! Returns the number of the next ring to the north of \a z=cos(theta).
+      57             :         It may return 0; in this case \a z lies north of all rings. */
+      58             :     inline I ring_above (double z) const;
+      59             :     void in_ring (I iz, double phi0, double dphi, rangeset<I> &pixset) const;
+      60             : 
+      61             :     template<typename I2> void query_multidisc (const arr<vec3> &norm,
+      62             :       const arr<double> &rad, int fact, rangeset<I2> &pixset) const;
+      63             : 
+      64             :     void query_multidisc_general (const arr<vec3> &norm, const arr<double> &rad,
+      65             :       bool inclusive, const std::vector<int> &cmds, rangeset<I> &pixset) const;
+      66             : 
+      67             :     void query_strip_internal (double theta1, double theta2, bool inclusive,
+      68             :       rangeset<I> &pixset) const;
+      69             : 
+      70             :     inline I spread_bits (int v) const;
+      71             :     inline int compress_bits (I v) const;
+      72             : 
+      73             :     I xyf2nest(int ix, int iy, int face_num) const;
+      74             :     void nest2xyf(I pix, int &ix, int &iy, int &face_num) const;
+      75             :     I xyf2ring(int ix, int iy, int face_num) const;
+      76             :     void ring2xyf(I pix, int &ix, int &iy, int &face_num) const;
+      77             : 
+      78             :     I loc2pix (double z, double phi, double sth, bool have_sth) const;
+      79             :     void pix2loc (I pix, double &z, double &phi, double &sth, bool &have_sth)
+      80             :       const;
+      81             : 
+      82             :     void xyf2loc(double x, double y, int face, double &z, double &ph,
+      83             :       double &sth, bool &have_sth) const;
+      84             : 
+      85             :     I nest_peano_helper (I pix, int dir) const;
+      86             : 
+      87             :     typedef I (T_Healpix_Base::*swapfunc)(I pix) const;
+      88             : 
+      89             :   public:
+      90             :     static const int order_max;
+      91             : 
+      92             :     /*! Calculates the map order from its \a N_side parameter.
+      93             :         Returns -1 if \a nside is not a power of 2.
+      94             :         \param nside the \a N_side parameter */
+      95             :     static int nside2order (I nside);
+      96             :     /*! Calculates the \a N_side parameter from the number of pixels.
+      97             :         \param npix the number of pixels */
+      98             :     static I npix2nside (I npix);
+      99             :     /*! Constructs an unallocated object. */
+     100             :     T_Healpix_Base ();
+     101             :     /*! Constructs an object with a given \a order and the ordering
+     102             :         scheme \a scheme. */
+     103          10 :     T_Healpix_Base (int order, Healpix_Ordering_Scheme scheme)
+     104          10 :       { Set (order, scheme); }
+     105             :     /*! Constructs an object with a given \a nside and the ordering
+     106             :         scheme \a scheme. The \a nside_dummy parameter must be set to
+     107             :         SET_NSIDE. */
+     108           0 :     T_Healpix_Base (I nside, Healpix_Ordering_Scheme scheme, const nside_dummy)
+     109           0 :       { SetNside (nside, scheme); }
+     110             : 
+     111             :     /*! Adjusts the object to \a order and \a scheme. */
+     112             :     void Set (int order, Healpix_Ordering_Scheme scheme);
+     113             :     /*! Adjusts the object to \a nside and \a scheme. */
+     114             :     void SetNside (I nside, Healpix_Ordering_Scheme scheme);
+     115             : 
+     116             :     /*! Returns the z-coordinate of the ring \a ring. This also works
+     117             :         for the (not really existing) rings 0 and 4*nside. */
+     118             :     double ring2z (I ring) const;
+     119             :     /*! Returns the number of the ring in which \a pix lies. */
+     120             :     I pix2ring (I pix) const;
+     121             : 
+     122           0 :     I xyf2pix(int ix, int iy, int face_num) const
+     123             :       {
+     124           0 :       return (scheme_==RING) ?
+     125           0 :         xyf2ring(ix,iy,face_num) : xyf2nest(ix,iy,face_num);
+     126             :       }
+     127           0 :     void pix2xyf(I pix, int &ix, int &iy, int &face_num) const
+     128             :       {
+     129           0 :       (scheme_==RING) ?
+     130           0 :         ring2xyf(pix,ix,iy,face_num) : nest2xyf(pix,ix,iy,face_num);
+     131           0 :       }
+     132             : 
+     133             :     /*! Translates a pixel number from NEST to RING. */
+     134             :     I nest2ring (I pix) const;
+     135             :     /*! Translates a pixel number from RING to NEST. */
+     136             :     I ring2nest (I pix) const;
+     137             :     /*! Translates a pixel number from NEST to its Peano index. */
+     138             :     I nest2peano (I pix) const;
+     139             :     /*! Translates a pixel number from its Peano index to NEST. */
+     140             :     I peano2nest (I pix) const;
+     141             : 
+     142             :     /*! Returns the number of the pixel which contains the angular coordinates
+     143             :         (\a z:=cos(theta), \a phi).
+     144             :         \note This method is inaccurate near the poles at high resolutions. */
+     145           0 :     I zphi2pix (double z, double phi) const
+     146           0 :       { return loc2pix(z,phi,0.,false); }
+     147             : 
+     148             :     /*! Returns the number of the pixel which contains the angular coordinates
+     149             :         \a ang. */
+     150           0 :     I ang2pix (const pointing &ang) const
+     151             :       {
+     152             :       const double pi_=3.141592653589793238462643383279502884197;
+     153           0 :       planck_assert((ang.theta>=0)&&(ang.theta<=pi_),"invalid theta value");
+     154           0 :       return ((ang.theta<0.01) || (ang.theta > 3.14159-0.01)) ?
+     155           0 :         loc2pix(cos(ang.theta),ang.phi,sin(ang.theta),true) :
+     156           0 :         loc2pix(cos(ang.theta),ang.phi,0.,false);
+     157             :       }
+     158             :     /*! Returns the number of the pixel which contains the vector \a vec
+     159             :         (\a vec is normalized if necessary). */
+     160       24585 :     I vec2pix (const vec3 &vec) const
+     161             :       {
+     162       24585 :       double xl = 1./vec.Length();
+     163             :       double phi = safe_atan2(vec.y,vec.x);
+     164       24585 :       double nz = vec.z*xl;
+     165       24585 :       if (std::abs(nz)>0.99)
+     166         241 :         return loc2pix (nz,phi,sqrt(vec.x*vec.x+vec.y*vec.y)*xl,true);
+     167             :       else
+     168       24344 :         return loc2pix (nz,phi,0,false);
+     169             :       }
+     170             : 
+     171             :     /*! Returns the angular coordinates (\a z:=cos(theta), \a phi) of the center
+     172             :         of the pixel with number \a pix.
+     173             :         \note This method is inaccurate near the poles at high resolutions. */
+     174           0 :     void pix2zphi (I pix, double &z, double &phi) const
+     175             :       {
+     176             :       bool dum_b;
+     177             :       double dum_d;
+     178           0 :       pix2loc(pix,z,phi,dum_d,dum_b);
+     179           0 :       }
+     180             : 
+     181             :     /*! Returns the angular coordinates of the center of the pixel with
+     182             :         number \a pix. */
+     183           0 :     pointing pix2ang (I pix) const
+     184             :       {
+     185             :       double z, phi, sth;
+     186             :       bool have_sth;
+     187           0 :       pix2loc (pix,z,phi,sth,have_sth);
+     188           0 :       return have_sth ? pointing(atan2(sth,z),phi) : pointing(acos(z),phi);
+     189             :       }
+     190             :     /*! Returns the vector to the center of the pixel with number \a pix. */
+     191      135593 :     vec3 pix2vec (I pix) const
+     192             :       {
+     193             :       double z, phi, sth;
+     194             :       bool have_sth;
+     195      135593 :       pix2loc (pix,z,phi,sth,have_sth);
+     196      135593 :       if (have_sth)
+     197        1417 :         return vec3(sth*cos(phi),sth*sin(phi),z);
+     198             :       else
+     199             :         {
+     200             :         vec3 res;
+     201      134176 :         res.set_z_phi (z, phi);
+     202      134176 :         return res;
+     203             :         }
+     204             :       }
+     205             : 
+     206             :     template<typename I2> void query_disc_internal (pointing ptg, double radius,
+     207             :       int fact, rangeset<I2> &pixset) const;
+     208             : 
+     209             :     /*! Returns the range set of all pixels whose centers lie within the disk
+     210             :         defined by \a dir and \a radius.
+     211             :         \param dir the angular coordinates of the disk center
+     212             :         \param radius the radius (in radians) of the disk
+     213             :         \param pixset a \a rangeset object containing the indices of all pixels
+     214             :            whose centers lie inside the disk
+     215             :         \note This method is more efficient in the RING scheme. */
+     216             :     void query_disc (pointing ptg, double radius, rangeset<I> &pixset) const;
+     217             :     /*! Returns the range set of all pixels which overlap with the disk
+     218             :         defined by \a dir and \a radius.
+     219             :         \param dir the angular coordinates of the disk center
+     220             :         \param radius the radius (in radians) of the disk
+     221             :         \param pixset a \a rangeset object containing the indices of all pixels
+     222             :            overlapping with the disk.
+     223             :         \param fact The overlapping test will be done at the resolution
+     224             :            \a fact*nside. For NESTED ordering, \a fact must be a power of 2,
+     225             :            else it can be any positive integer. A typical choice would be 4.
+     226             :         \note This method may return some pixels which don't overlap with
+     227             :            the disk at all. The higher \a fact is chosen, the fewer false
+     228             :            positives are returned, at the cost of increased run time.
+     229             :         \note This method is more efficient in the RING scheme. */
+     230             :     void query_disc_inclusive (pointing ptg, double radius, rangeset<I> &pixset,
+     231             :       int fact=1) const;
+     232             : 
+     233             :     /*! \deprecated Please use the version based on \a rangeset */
+     234           0 :     void query_disc (const pointing &dir, double radius,
+     235             :       std::vector<I> &listpix) const
+     236             :       {
+     237             :       rangeset<I> pixset;
+     238           0 :       query_disc(dir,radius,pixset);
+     239           0 :       pixset.toVector(listpix);
+     240           0 :       }
+     241             :     /*! \deprecated Please use the version based on \a rangeset */
+     242           0 :     void query_disc_inclusive (const pointing &dir, double radius,
+     243             :       std::vector<I> &listpix, int fact=1) const
+     244             :       {
+     245             :       rangeset<I> pixset;
+     246           0 :       query_disc_inclusive(dir,radius,pixset,fact);
+     247           0 :       pixset.toVector(listpix);
+     248           0 :       }
+     249             : 
+     250             :     template<typename I2> void query_polygon_internal
+     251             :       (const std::vector<pointing> &vertex, int fact,
+     252             :       rangeset<I2> &pixset) const;
+     253             : 
+     254             :     /*! Returns a range set of pixels whose centers lie within the convex
+     255             :         polygon defined by the \a vertex array.
+     256             :         \param vertex array containing the vertices of the polygon.
+     257             :         \param pixset a \a rangeset object containing the indices of all pixels
+     258             :            whose centers lie inside the polygon
+     259             :         \note This method is more efficient in the RING scheme. */
+     260             :     void query_polygon (const std::vector<pointing> &vertex,
+     261             :       rangeset<I> &pixset) const;
+     262             : 
+     263             :     /*! Returns a range set of pixels which overlap with the convex
+     264             :         polygon defined by the \a vertex array.
+     265             :         \param vertex array containing the vertices of the polygon.
+     266             :         \param pixset a \a rangeset object containing the indices of all pixels
+     267             :            overlapping with the polygon.
+     268             :         \param fact The overlapping test will be done at the resolution
+     269             :            \a fact*nside. For NESTED ordering, \a fact must be a power of 2,
+     270             :            else it can be any positive integer. A typical choice would be 4.
+     271             :         \note This method may return some pixels which don't overlap with
+     272             :            the polygon at all. The higher \a fact is chosen, the fewer false
+     273             :            positives are returned, at the cost of increased run time.
+     274             :         \note This method is more efficient in the RING scheme. */
+     275             :     void query_polygon_inclusive (const std::vector<pointing> &vertex,
+     276             :       rangeset<I> &pixset, int fact=1) const;
+     277             : 
+     278             :     /*! Returns a range set of pixels whose centers lie within the colatitude
+     279             :         range defined by \a theta1 and \a theta2 (if \a inclusive==false), or
+     280             :         which overlap with this region (if \a inclusive==true). If
+     281             :         \a theta1<theta2, the region between both angles is considered,
+     282             :         otherwise the regions \a 0<theta<theta2 and \a theta1<theta<pi.
+     283             :         \param theta1 first colatitude
+     284             :         \param theta2 second colatitude
+     285             :         \param inclusive if \a false, return the exact set of pixels whose
+     286             :            pixels centers lie within the region; if \a true, return all pixels
+     287             :            that overlap with the region. */
+     288             :     void query_strip (double theta1, double theta2, bool inclusive,
+     289             :       rangeset<I> &pixset) const;
+     290             : 
+     291             :     /*! Returns useful information about a given ring of the map.
+     292             :         \param ring the ring number (the number of the first ring is 1)
+     293             :         \param startpix the number of the first pixel in the ring
+     294             :                (NOTE: this is always given in the RING numbering scheme!)
+     295             :         \param ringpix the number of pixels in the ring
+     296             :         \param costheta the cosine of the colatitude of the ring
+     297             :         \param sintheta the sine of the colatitude of the ring
+     298             :         \param shifted if \a true, the center of the first pixel is not at
+     299             :                \a phi=0 */
+     300             :     void get_ring_info (I ring, I &startpix, I &ringpix,
+     301             :       double &costheta, double &sintheta, bool &shifted) const;
+     302             :     /*! Returns useful information about a given ring of the map.
+     303             :         \param ring the ring number (the number of the first ring is 1)
+     304             :         \param startpix the number of the first pixel in the ring
+     305             :                (NOTE: this is always given in the RING numbering scheme!)
+     306             :         \param ringpix the number of pixels in the ring
+     307             :         \param theta the colatitude (in radians) of the ring
+     308             :         \param shifted if \a true, the center of the first pixel is not at
+     309             :                \a phi=0 */
+     310             :     void get_ring_info2 (I ring, I &startpix, I &ringpix,
+     311             :       double &theta, bool &shifted) const;
+     312             :     /*! Returns useful information about a given ring of the map.
+     313             :         \param ring the ring number (the number of the first ring is 1)
+     314             :         \param startpix the number of the first pixel in the ring
+     315             :                (NOTE: this is always given in the RING numbering scheme!)
+     316             :         \param ringpix the number of pixels in the ring
+     317             :         \param shifted if \a true, the center of the first pixel is not at
+     318             :                \a phi=0 */
+     319             :     void get_ring_info_small (I ring, I &startpix, I &ringpix,
+     320             :         bool &shifted) const;
+     321             :     /*! Returns the neighboring pixels of \a pix in \a result.
+     322             :         On exit, \a result contains (in this order)
+     323             :         the pixel numbers of the SW, W, NW, N, NE, E, SE and S neighbor
+     324             :         of \a pix. If a neighbor does not exist (this can only be the case
+     325             :         for the W, N, E and S neighbors), its entry is set to -1.
+     326             : 
+     327             :         \note This method works in both RING and NEST schemes, but is
+     328             :           considerably faster in the NEST scheme. */
+     329             :     void neighbors (I pix, fix_arr<I,8> &result) const;
+     330             :     /*! Returns interpolation information for the direction \a ptg.
+     331             :         The surrounding pixels are returned in \a pix, their corresponding
+     332             :         weights in \a wgt.
+     333             :         \note This method works in both RING and NEST schemes, but is
+     334             :           considerably faster in the RING scheme. */
+     335             :     void get_interpol (const pointing &ptg, fix_arr<I,4> &pix,
+     336             :                        fix_arr<double,4> &wgt) const;
+     337             : 
+     338             :     /*! Returns the order parameter of the object. */
+     339         421 :     int Order() const { return order_; }
+     340             :     /*! Returns the \a N_side parameter of the object. */
+     341           0 :     I Nside() const { return nside_; }
+     342             :     /*! Returns the number of pixels of the object. */
+     343    10403763 :     I Npix() const { return npix_; }
+     344             :     /*! Returns the ordering scheme of the object. */
+     345           0 :     Healpix_Ordering_Scheme Scheme() const { return scheme_; }
+     346             : 
+     347             :     /*! Returns \a true, if both objects have the same nside and scheme,
+     348             :         else \a false. */
+     349           0 :     bool conformable (const T_Healpix_Base &other) const
+     350           0 :       { return ((nside_==other.nside_) && (scheme_==other.scheme_)); }
+     351             : 
+     352             :     /*! Swaps the contents of two Healpix_Base objects. */
+     353             :     void swap (T_Healpix_Base &other);
+     354             : 
+     355             :     /*! Returns the maximum angular distance (in radian) between any pixel
+     356             :         center and its corners. */
+     357             :     double max_pixrad() const;
+     358             : 
+     359             :     /*! Returns the maximum angular distance (in radian) between any pixel
+     360             :         center and its corners in a given ring. */
+     361             :     double max_pixrad(I ring) const;
+     362             : 
+     363             :     /*! Returns a set of points along the boundary of the given pixel.
+     364             :         \a step=1 gives 4 points on the corners. The first point corresponds
+     365             :         to the northernmost corner, the subsequent points follow the pixel
+     366             :         boundary through west, south and east corners.
+     367             :         \param pix pixel index number
+     368             :         \param step the number of returned points is 4*step. */
+     369             :     void boundaries (I pix, tsize step, std::vector<vec3> &out) const;
+     370             : 
+     371             :     arr<int> swap_cycles() const;
+     372             :   };
+     373             : 
+     374             : /*! T_Healpix_Base for Nside up to 2^13. */
+     375             : typedef T_Healpix_Base<int> Healpix_Base;
+     376             : /*! T_Healpix_Base for Nside up to 2^29. */
+     377             : typedef T_Healpix_Base<int64> Healpix_Base2;
+     378             : 
+     379             : } // namespace healpix
+     380             : #endif
+     381             : 
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/index-sort-f.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/index-sort-f.html new file mode 100644 index 000000000..0195d8cd1 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/index-sort-f.html @@ -0,0 +1,173 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_baseHitTotalCoverage
Test:coverage.info.cleanedLines:3317319.1 %
Date:2024-04-08 14:58:22Functions:5628.1 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
error_handling.h +
0.0%
+
0.0 %0 / 20.0 %0 / 1
arr.h +
0.0%
+
0.0 %0 / 150.0 %0 / 1
geom_utils.h +
0.0%
+
0.0 %0 / 40.0 %0 / 2
alloc_utils.h +
0.0%
+
0.0 %0 / 20.0 %0 / 6
rangeset.h +
0.0%
+
0.0 %0 / 510.0 %0 / 12
healpix_base.h +
32.0%32.0%
+
32.0 %16 / 508.8 %3 / 34
math_utils.h +
30.4%30.4%
+
30.4 %7 / 2325.0 %1 / 4
vec3.h +
45.5%45.5%
+
45.5 %10 / 2250.0 %1 / 2
pointing.h +
0.0%
+
0.0 %0 / 4-0 / 0
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/index-sort-l.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/index-sort-l.html new file mode 100644 index 000000000..19da9ac89 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/index-sort-l.html @@ -0,0 +1,173 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_baseHitTotalCoverage
Test:coverage.info.cleanedLines:3317319.1 %
Date:2024-04-08 14:58:22Functions:5628.1 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
error_handling.h +
0.0%
+
0.0 %0 / 20.0 %0 / 1
alloc_utils.h +
0.0%
+
0.0 %0 / 20.0 %0 / 6
geom_utils.h +
0.0%
+
0.0 %0 / 40.0 %0 / 2
pointing.h +
0.0%
+
0.0 %0 / 4-0 / 0
arr.h +
0.0%
+
0.0 %0 / 150.0 %0 / 1
rangeset.h +
0.0%
+
0.0 %0 / 510.0 %0 / 12
math_utils.h +
30.4%30.4%
+
30.4 %7 / 2325.0 %1 / 4
healpix_base.h +
32.0%32.0%
+
32.0 %16 / 508.8 %3 / 34
vec3.h +
45.5%45.5%
+
45.5 %10 / 2250.0 %1 / 2
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/index.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/index.html new file mode 100644 index 000000000..ce3223c46 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/index.html @@ -0,0 +1,173 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_baseHitTotalCoverage
Test:coverage.info.cleanedLines:3317319.1 %
Date:2024-04-08 14:58:22Functions:5628.1 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
alloc_utils.h +
0.0%
+
0.0 %0 / 20.0 %0 / 6
arr.h +
0.0%
+
0.0 %0 / 150.0 %0 / 1
error_handling.h +
0.0%
+
0.0 %0 / 20.0 %0 / 1
geom_utils.h +
0.0%
+
0.0 %0 / 40.0 %0 / 2
healpix_base.h +
32.0%32.0%
+
32.0 %16 / 508.8 %3 / 34
math_utils.h +
30.4%30.4%
+
30.4 %7 / 2325.0 %1 / 4
pointing.h +
0.0%
+
0.0 %0 / 4-0 / 0
rangeset.h +
0.0%
+
0.0 %0 / 510.0 %0 / 12
vec3.h +
45.5%45.5%
+
45.5 %10 / 2250.0 %1 / 2
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/math_utils.h.func-sort-c.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/math_utils.h.func-sort-c.html new file mode 100644 index 000000000..822b61bad --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/math_utils.h.func-sort-c.html @@ -0,0 +1,88 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/math_utils.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - math_utils.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:72330.4 %
Date:2024-04-08 14:58:22Functions:1425.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix14isqrt_helper__IlLb1EE5isqrtEl0
_ZN7healpix5ilog2IiEEiT_0
_ZN7healpix5ilog2IlEEiT_0
_ZN7healpix7fmoduloEdd24585
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/math_utils.h.func.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/math_utils.h.func.html new file mode 100644 index 000000000..0fdeff09e --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/math_utils.h.func.html @@ -0,0 +1,88 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/math_utils.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - math_utils.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:72330.4 %
Date:2024-04-08 14:58:22Functions:1425.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix14isqrt_helper__IlLb1EE5isqrtEl0
_ZN7healpix5ilog2IiEEiT_0
_ZN7healpix5ilog2IlEEiT_0
_ZN7healpix7fmoduloEdd24585
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/math_utils.h.gcov.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/math_utils.h.gcov.html new file mode 100644 index 000000000..badf8789f --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/math_utils.h.gcov.html @@ -0,0 +1,259 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/math_utils.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - math_utils.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:72330.4 %
Date:2024-04-08 14:58:22Functions:1425.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : /*
+       2             :  *  This file is part of libcxxsupport.
+       3             :  *
+       4             :  *  libcxxsupport is free software; you can redistribute it and/or modify
+       5             :  *  it under the terms of the GNU General Public License as published by
+       6             :  *  the Free Software Foundation; either version 2 of the License, or
+       7             :  *  (at your option) any later version.
+       8             :  *
+       9             :  *  libcxxsupport is distributed in the hope that it will be useful,
+      10             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+      11             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+      12             :  *  GNU General Public License for more details.
+      13             :  *
+      14             :  *  You should have received a copy of the GNU General Public License
+      15             :  *  along with libcxxsupport; if not, write to the Free Software
+      16             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+      17             :  */
+      18             : 
+      19             : /*
+      20             :  *  libcxxsupport is being developed at the Max-Planck-Institut fuer Astrophysik
+      21             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
+      22             :  *  (DLR).
+      23             :  */
+      24             : 
+      25             : /*! \file math_utils.h
+      26             :  *  Various convenience mathematical functions.
+      27             :  *
+      28             :  *  Copyright (C) 2002-2012 Max-Planck-Society
+      29             :  *  \author Martin Reinecke
+      30             :  */
+      31             : 
+      32             : #ifndef PLANCK_MATH_UTILS_H
+      33             : #define PLANCK_MATH_UTILS_H
+      34             : 
+      35             : #include <cmath>
+      36             : #include <algorithm>
+      37             : #include "healpix_base/datatypes.h"
+      38             : 
+      39             : namespace healpix{
+      40             : 
+      41             : /*! \defgroup mathutilsgroup Mathematical helper functions */
+      42             : /*! \{ */
+      43             : 
+      44             : /*! Returns \e true if | \a a-b | <= \a epsilon * | \a b |, else \e false. */
+      45             : template<typename F> inline bool approx (F a, F b, F epsilon=1e-5)
+      46             :   {
+      47             :   using namespace std;
+      48             :   return abs(a-b) <= (epsilon*abs(b));
+      49             :   }
+      50             : 
+      51             : /*! Returns \e true if | \a a-b | <= \a epsilon, else \e false. */
+      52             : template<typename F> inline bool abs_approx (F a, F b, F epsilon=1e-5)
+      53             :   {
+      54             :   using namespace std;
+      55             :   return abs(a-b) <= epsilon;
+      56             :   }
+      57             : 
+      58             : /*! Returns the largest integer which is smaller than (or equal to) \a arg. */
+      59             : template<typename I, typename F> inline I ifloor (F arg)
+      60             :   {
+      61             :   using namespace std;
+      62           0 :   return I(floor(arg));
+      63             :   }
+      64             : 
+      65             : /*! Returns the integer which is nearest to \a arg. */
+      66             : template<typename I, typename F> inline I nearest (F arg)
+      67             :   { return ifloor<I>(arg+0.5); }
+      68             : 
+      69             : /*! Returns the remainder of the division \a v1/v2.
+      70             :     The result is non-negative.
+      71             :     \a v1 can be positive or negative; \a v2 must be positive. */
+      72       24585 : inline double fmodulo (double v1, double v2)
+      73             :   {
+      74             :   using namespace std;
+      75       24585 :   if (v1>=0)
+      76       12356 :     return (v1<v2) ? v1 : fmod(v1,v2);
+      77       12229 :   double tmp=fmod(v1,v2)+v2;
+      78       12229 :   return (tmp==v2) ? 0. : tmp;
+      79             : //  return (v1>=0) ? ((v1<v2) ? v1 : fmod(v1,v2)) : (fmod(v1,v2)+v2);
+      80             :   }
+      81             : 
+      82             : /*! Returns the remainder of the division \a v1/v2.
+      83             :     The result is non-negative.
+      84             :     \a v1 can be positive or negative; \a v2 must be positive. */
+      85             : template<typename I> inline I imodulo (I v1, I v2)
+      86             :   { I v=v1%v2; return (v>=0) ? v : v+v2; }
+      87             : 
+      88             : /*! Returns -1 if \a signvalue is negative, else +1. */
+      89             : template<typename T> inline T sign (const T& signvalue)
+      90             :   { return (signvalue>=0) ? 1 : -1; }
+      91             : 
+      92             : /*! Returns \a val*pow(-1,m) */
+      93             : template<typename T, typename I> inline T xpow (I m, T val)
+      94             :   { return (m&1) ? -val : val; }
+      95             : 
+      96             : template<typename I, bool g4> struct isqrt_helper__
+      97             :   {};
+      98             : template<typename I> struct isqrt_helper__ <I, false>
+      99             :   {
+     100             :   static uint32 isqrt (I arg)
+     101             :     {
+     102             :     using namespace std;
+     103       44162 :     return uint32 (sqrt(arg+0.5));
+     104             :     }
+     105             :   };
+     106             : template<typename I> struct isqrt_helper__ <I, true>
+     107             :   {
+     108           0 :   static uint32 isqrt (I arg)
+     109             :     {
+     110             :     using namespace std;
+     111           0 :     I res = sqrt(double(arg)+0.5);
+     112           0 :     if (arg<(int64(1)<<50)) return uint32(res);
+     113           0 :     if (res*res>arg)
+     114           0 :       --res;
+     115           0 :     else if ((res+1)*(res+1)<=arg)
+     116             :       ++res;
+     117           0 :     return uint32(res);
+     118             :     }
+     119             :   };
+     120             : 
+     121             : /*! Returns the integer \a n, which fulfills \a n*n<=arg<(n+1)*(n+1). */
+     122             : template<typename I> inline uint32 isqrt (I arg)
+     123           0 :   { return isqrt_helper__<I,(sizeof(I)>4)>::isqrt(arg); }
+     124             : 
+     125             : /*! Returns the largest integer \a n that fulfills \a 2^n<=arg. */
+     126           0 : template<typename I> inline int ilog2 (I arg)
+     127             :   {
+     128             :   int res=0;
+     129           0 :   while (arg > 0x0000FFFF) { res+=16; arg>>=16; }
+     130           0 :   if (arg > 0x000000FF) { res|=8; arg>>=8; }
+     131           0 :   if (arg > 0x0000000F) { res|=4; arg>>=4; }
+     132           0 :   if (arg > 0x00000003) { res|=2; arg>>=2; }
+     133           0 :   if (arg > 0x00000001) { res|=1; }
+     134           0 :   return res;
+     135             :   }
+     136             : 
+     137             : /*! Returns \a atan2(y,x) if \a x!=0 or \a y!=0; else returns 0. */
+     138             : inline double safe_atan2 (double y, double x)
+     139             :   {
+     140             :   using namespace std;
+     141       61874 :   return ((x==0.) && (y==0.)) ? 0.0 : atan2(y,x);
+     142             :   }
+     143             : 
+     144             : /*! Helper function for linear interpolation (or extrapolation).
+     145             :     The array must be ordered in ascending order; no two values may be equal. */
+     146             : template<typename T, typename Iter, typename Comp> inline void interpol_helper
+     147             :   (const Iter &begin, const Iter &end, const T &val, Comp comp, tsize &idx,
+     148             :   T &frac)
+     149             :   {
+     150             :   using namespace std;
+     151             :   planck_assert((end-begin)>1,"sequence too small for interpolation");
+     152             :   idx = lower_bound(begin,end,val,comp)-begin;
+     153             :   if (idx>0) --idx;
+     154             :   idx = min(tsize(end-begin-2),idx);
+     155             :   frac = (val-begin[idx])/(begin[idx+1]-begin[idx]);
+     156             :   }
+     157             : 
+     158             : /*! Helper function for linear interpolation (or extrapolation).
+     159             :     The array must be ordered in ascending order; no two values may be equal. */
+     160             : template<typename T, typename Iter> inline void interpol_helper
+     161             :   (const Iter &begin, const Iter &end, const T &val, tsize &idx, T &frac)
+     162             :   { interpol_helper (begin,end,val,std::less<T>(),idx,frac); }
+     163             : 
+     164             : /*! \} */
+     165             : 
+     166             : template<typename T> inline bool multiequal (const T &a, const T &b, const T &c)
+     167             :   { return (a==b) && (a==c); }
+     168             : 
+     169             : template<typename T> inline bool multiequal (const T &a, const T &b, const T &c,
+     170             :   const T &d)
+     171             :   { return (a==b) && (a==c) && (a==d); }
+     172             : 
+     173             : template<typename T> inline bool multiequal (const T &a, const T &b, const T &c,
+     174             :   const T &d, const T &e)
+     175             :   { return (a==b) && (a==c) && (a==d) && (a==e); }
+     176             : 
+     177             : template<typename T> inline bool multiequal (const T &a, const T &b, const T &c,
+     178             :   const T &d, const T &e, const T &f)
+     179             :   { return (a==b) && (a==c) && (a==d) && (a==e) && (a==f); }
+     180             : 
+     181             : } // namespace healpix
+     182             : #endif
+     183             : 
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/pointing.h.func-sort-c.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/pointing.h.func-sort-c.html new file mode 100644 index 000000000..bd57abfaa --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/pointing.h.func-sort-c.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/pointing.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - pointing.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:040.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/pointing.h.func.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/pointing.h.func.html new file mode 100644 index 000000000..1bde73dd1 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/pointing.h.func.html @@ -0,0 +1,72 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/pointing.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - pointing.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:040.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ +
+ + + + + + +

Function Name Sort by function nameHit count Sort by hit count
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/pointing.h.gcov.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/pointing.h.gcov.html new file mode 100644 index 000000000..59e765ab6 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/pointing.h.gcov.html @@ -0,0 +1,161 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/pointing.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - pointing.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:040.0 %
Date:2024-04-08 14:58:22Functions:00-
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : /*
+       2             :  *  This file is part of libcxxsupport.
+       3             :  *
+       4             :  *  libcxxsupport is free software; you can redistribute it and/or modify
+       5             :  *  it under the terms of the GNU General Public License as published by
+       6             :  *  the Free Software Foundation; either version 2 of the License, or
+       7             :  *  (at your option) any later version.
+       8             :  *
+       9             :  *  libcxxsupport is distributed in the hope that it will be useful,
+      10             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+      11             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+      12             :  *  GNU General Public License for more details.
+      13             :  *
+      14             :  *  You should have received a copy of the GNU General Public License
+      15             :  *  along with libcxxsupport; if not, write to the Free Software
+      16             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+      17             :  */
+      18             : 
+      19             : /*
+      20             :  *  libcxxsupport is being developed at the Max-Planck-Institut fuer Astrophysik
+      21             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
+      22             :  *  (DLR).
+      23             :  */
+      24             : 
+      25             : /*! \file pointing.h
+      26             :  *  Class representing a direction in 3D space
+      27             :  *
+      28             :  *  Copyright (C) 2003-2012 Max-Planck-Society
+      29             :  *  \author Martin Reinecke
+      30             :  */
+      31             : 
+      32             : #ifndef PLANCK_POINTING_H
+      33             : #define PLANCK_POINTING_H
+      34             : 
+      35             : #include <cmath>
+      36             : #include "healpix_base/vec3.h"
+      37             : 
+      38             : namespace healpix{
+      39             : 
+      40             : /*! \defgroup pointinggroup Pointings */
+      41             : /*! \{ */
+      42             : 
+      43             : /*! Class representing a direction in 3D space or a location on the
+      44             :     unit sphere. All angles in radians. */
+      45             : class pointing
+      46             :   {
+      47             :   public:
+      48             :     /*! Colatitude of the pointing (i.e. the North pole is at \a theta=0). */
+      49             :     double theta;
+      50             :     /*! Longitude of the pointing. */
+      51             :     double phi;
+      52             : 
+      53             :     /*! Default constructor. \a theta and \a phi are not initialized. */
+      54           0 :     pointing() {}
+      55             :     /*! Creates a pointing with \a Theta and \a Phi. */
+      56           0 :     pointing (double Theta, double Phi) : theta(Theta), phi(Phi) {}
+      57             : 
+      58             : // FIXME: should become "explicit" some time
+      59             :     /*! Creates a pointing from the vector \a inp. \a inp need not be
+      60             :         normalized. */
+      61             :     pointing (const vec3 &inp)
+      62           0 :       { from_vec3(inp); }
+      63             : // FIXME: should be removed some time
+      64             :     /*! Returns a normalized vector pointing in the same direction. */
+      65             :     operator vec3() const
+      66           0 :       { return to_vec3(); }
+      67             :     /*! Returns a normalized vector pointing in the same direction. */
+      68             :     vec3 to_vec3() const;
+      69             :     /*! Converts \a inp to \a ptg. \a inp need not be normalized. */
+      70             :     void from_vec3 (const vec3 &inp);
+      71             :     /*! Changes the angles so that \a 0<=theta<=pi. */
+      72             :     void normalize_theta();
+      73             :     /*! Changes the angles so that \a 0<=theta<=pi and \a 0<=phi<2*pi. */
+      74             :     void normalize();
+      75             :   };
+      76             : 
+      77             : /*! Writes \a p to \a os.
+      78             :     \relates pointing */
+      79             : std::ostream &operator<< (std::ostream &os, const pointing &p);
+      80             : 
+      81             : /*! \} */
+      82             : 
+      83             : } // namespace healpix
+      84             : #endif
+      85             : 
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/rangeset.h.func-sort-c.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/rangeset.h.func-sort-c.html new file mode 100644 index 000000000..9daab7962 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/rangeset.h.func-sort-c.html @@ -0,0 +1,120 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/rangeset.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - rangeset.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0510.0 %
Date:2024-04-08 14:58:22Functions:0120.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix8rangesetIiE6appendERKS1_0
_ZN7healpix8rangesetIiE6appendERKiS3_0
_ZN7healpix8rangesetIiE9addRemoveEiil0
_ZN7healpix8rangesetIiE9intersectERKiS3_0
_ZN7healpix8rangesetIlE6appendERKS1_0
_ZN7healpix8rangesetIlE6appendERKlS3_0
_ZN7healpix8rangesetIlE9addRemoveElll0
_ZN7healpix8rangesetIlE9intersectERKlS3_0
_ZNK7healpix8rangesetIiE3iivERKi0
_ZNK7healpix8rangesetIiE8toVectorERSt6vectorIiSaIiEE0
_ZNK7healpix8rangesetIlE3iivERKl0
_ZNK7healpix8rangesetIlE8toVectorERSt6vectorIlSaIlEE0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/rangeset.h.func.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/rangeset.h.func.html new file mode 100644 index 000000000..8a90294c3 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/rangeset.h.func.html @@ -0,0 +1,120 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/rangeset.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - rangeset.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0510.0 %
Date:2024-04-08 14:58:22Functions:0120.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix8rangesetIiE6appendERKS1_0
_ZN7healpix8rangesetIiE6appendERKiS3_0
_ZN7healpix8rangesetIiE9addRemoveEiil0
_ZN7healpix8rangesetIiE9intersectERKiS3_0
_ZN7healpix8rangesetIlE6appendERKS1_0
_ZN7healpix8rangesetIlE6appendERKlS3_0
_ZN7healpix8rangesetIlE9addRemoveElll0
_ZN7healpix8rangesetIlE9intersectERKlS3_0
_ZNK7healpix8rangesetIiE3iivERKi0
_ZNK7healpix8rangesetIiE8toVectorERSt6vectorIiSaIiEE0
_ZNK7healpix8rangesetIlE3iivERKl0
_ZNK7healpix8rangesetIlE8toVectorERSt6vectorIlSaIlEE0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/rangeset.h.gcov.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/rangeset.h.gcov.html new file mode 100644 index 000000000..177519f90 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/rangeset.h.gcov.html @@ -0,0 +1,363 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/rangeset.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - rangeset.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0510.0 %
Date:2024-04-08 14:58:22Functions:0120.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : /*
+       2             :  *  This file is part of libcxxsupport.
+       3             :  *
+       4             :  *  libcxxsupport is free software; you can redistribute it and/or modify
+       5             :  *  it under the terms of the GNU General Public License as published by
+       6             :  *  the Free Software Foundation; either version 2 of the License, or
+       7             :  *  (at your option) any later version.
+       8             :  *
+       9             :  *  libcxxsupport is distributed in the hope that it will be useful,
+      10             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+      11             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+      12             :  *  GNU General Public License for more details.
+      13             :  *
+      14             :  *  You should have received a copy of the GNU General Public License
+      15             :  *  along with libcxxsupport; if not, write to the Free Software
+      16             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+      17             :  */
+      18             : 
+      19             : /*
+      20             :  *  libcxxsupport is being developed at the Max-Planck-Institut fuer Astrophysik
+      21             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
+      22             :  *  (DLR).
+      23             :  */
+      24             : 
+      25             : /*! \file rangeset.h
+      26             :  *  Class for storing sets of ranges of integer numbers
+      27             :  *
+      28             :  *  Copyright (C) 2011, 2012 Max-Planck-Society
+      29             :  *  \author Martin Reinecke
+      30             :  */
+      31             : 
+      32             : #ifndef PLANCK_RANGESET_H
+      33             : #define PLANCK_RANGESET_H
+      34             : 
+      35             : #include <algorithm>
+      36             : #include <vector>
+      37             : #include <utility>
+      38             : #include <iostream>
+      39             : #include "healpix_base/datatypes.h"
+      40             : #include "healpix_base/error_handling.h"
+      41             : 
+      42             : namespace healpix{
+      43             : 
+      44             : /*! Class for storing sets of ranges of integer numbers */
+      45           0 : template<typename T> class rangeset
+      46             :   {
+      47             :   private:
+      48             :     typedef std::vector<T> rtype;
+      49             :     typedef typename rtype::iterator iterator;
+      50             :     typedef typename rtype::const_iterator c_iterator;
+      51             :     rtype r;
+      52             : 
+      53           0 :     tdiff iiv (const T &val) const
+      54           0 :       { return tdiff(std::upper_bound(r.begin(),r.end(),val)-r.begin())-1; }
+      55             : 
+      56           0 :     void addRemove (T a, T b, tdiff v)
+      57             :       {
+      58           0 :       tdiff pos1=iiv(a), pos2=iiv(b);
+      59           0 :       if ((pos1>=0) && (r[pos1]==a)) --pos1;
+      60             :       // first to delete is at pos1+1; last is at pos2
+      61           0 :       bool insert_a = (pos1&1)==v;
+      62           0 :       bool insert_b = (pos2&1)==v;
+      63           0 :       int rmstart=pos1+1+(insert_a ? 1 : 0);
+      64           0 :       int rmend  =pos2-(insert_b?1:0);
+      65             : 
+      66           0 :       planck_assert((rmend-rmstart)&1,"cannot happen");
+      67             : 
+      68           0 :       if (insert_a && insert_b && (pos1+1>pos2)) // insert
+      69             :         {
+      70           0 :         r.insert(r.begin()+pos1+1,2,a);
+      71           0 :         r[pos1+2]=b;
+      72             :         }
+      73             :       else
+      74             :         {
+      75           0 :         if (insert_a) r[pos1+1]=a;
+      76           0 :         if (insert_b) r[pos2]=b;
+      77           0 :         r.erase(r.begin()+rmstart,r.begin()+rmend+1);
+      78             :         }
+      79           0 :       }
+      80             : 
+      81             :     static void generalUnion (const rtype &a, const rtype &b,
+      82             :       bool flip_a, bool flip_b, rtype &c)
+      83             :       {
+      84             :       planck_assert((&c!=&a)&&(&c!=&b), "cannot overwrite the rangeset");
+      85             :       c.clear();
+      86             :       bool state_a=flip_a, state_b=flip_b, state_res=state_a||state_b;
+      87             :       tsize ia=0, ea=a.size(), ib=0, eb=b.size();
+      88             :       bool runa = ia!=ea, runb = ib!=eb;
+      89             :       while(runa||runb)
+      90             :         {
+      91             :         bool adv_a=false, adv_b=false;
+      92             :         T val,va=T(),vb=T();
+      93             :         if (runa) va = a[ia];
+      94             :         if (runb) vb = b[ib];
+      95             :         if (runa && (!runb || (va<=vb))) { adv_a=true; val=va; }
+      96             :         if (runb && (!runa || (vb<=va))) { adv_b=true; val=vb; }
+      97             :         if (adv_a) { state_a=!state_a; ++ia; runa = ia!=ea; }
+      98             :         if (adv_b) { state_b=!state_b; ++ib; runb = ib!=eb; }
+      99             :         if ((state_a||state_b)!=state_res)
+     100             :           { c.push_back(val); state_res = !state_res; }
+     101             :         }
+     102             :       }
+     103             : 
+     104             :   public:
+     105             :     /*! Removes all rangeset entries. */
+     106             :     void clear() { r.clear(); }
+     107             :     /*! Reserves space for \a n ranges. */
+     108             :     void reserve(tsize n) { r.reserve(2*n); }
+     109             :     /*! Returns the current number of ranges. */
+     110           0 :     tsize size() const { return r.size()>>1; }
+     111             :     /*! Returns the current vector of ranges. */
+     112             :     const rtype &data() const { return r; }
+     113             : 
+     114             :     /*! Returns the first value of range \a i. */
+     115           0 :     const T &ivbegin (tdiff i) const { return r[2*i]; }
+     116             :     /*! Returns the one-past-last value of range \a i. */
+     117           0 :     const T &ivend (tdiff i) const { return r[2*i+1]; }
+     118             :     /*! Returns the length of range \a i. */
+     119             :     T ivlen (tdiff i) const { return r[2*i+1]-r[2*i]; }
+     120             : 
+     121             :     /*! Appends \a [v1;v2[ to the rangeset. \a v1 must be larger
+     122             :         than the minimum of the last range in the rangeset. */
+     123           0 :     void append(const T &v1, const T &v2)
+     124             :       {
+     125           0 :       if (v2<=v1) return;
+     126           0 :       if ((!r.empty()) && (v1<=r.back()))
+     127             :         {
+     128           0 :         planck_assert (v1>=r[r.size()-2],"bad append operation");
+     129           0 :         if (v2>r.back()) r.back()=v2;
+     130             :         }
+     131             :       else
+     132           0 :         { r.push_back(v1); r.push_back(v2); }
+     133             :       }
+     134             :     /*! Appends \a [v;v+1[ to the rangeset. \a v must be larger
+     135             :         than the minimum of the last range in the rangeset. */
+     136             :     void append(const T &v)
+     137           0 :       { append(v,v+1); }
+     138             : 
+     139             :     /*! Appends \a other to the rangeset. All values in \a other must be larger
+     140             :         than the minimum of the last range in the rangeset. */
+     141           0 :     void append (const rangeset &other)
+     142             :       {
+     143           0 :       for (tsize j=0; j<other.size(); ++j)
+     144           0 :         append(other.ivbegin(j),other.ivend(j));
+     145           0 :       }
+     146             : 
+     147             :     /*! After this operation, the rangeset contains the union of itself
+     148             :         with \a [v1;v2[. */
+     149             :     void add(const T &v1, const T &v2) { addRemove(v1,v2,1); }
+     150             :     /*! After this operation, the rangeset contains the union of itself
+     151             :         with \a [v;v+1[. */
+     152             :     void add(const T &v) { addRemove(v,v+1,1); }
+     153             : 
+     154             :     /*! Removes all values within \a [v1;v2[ from the rangeset. */
+     155           0 :     void remove(const T &v1, const T &v2) { addRemove(v1,v2,0); }
+     156             :     /*! Removes the value \a v from the rangeset. */
+     157             :     void remove(const T &v) { addRemove(v,v+1,0); }
+     158             : 
+     159             :     /*! Removes all values not within \a [v1;v2[ from the rangeset. */
+     160           0 :     void intersect (const T &a, const T &b)
+     161             :       {
+     162           0 :       tdiff pos1=iiv(a), pos2=iiv(b);
+     163           0 :       if ((pos2>=0) && (r[pos2]==b)) --pos2;
+     164             :       // delete all up to pos1 (inclusive); and starting from pos2+1
+     165           0 :       bool insert_a = (pos1&1)==0;
+     166           0 :       bool insert_b = (pos2&1)==0;
+     167             : 
+     168             :       // cut off end
+     169           0 :       r.erase(r.begin()+pos2+1,r.end());
+     170           0 :       if (insert_b) r.push_back(b);
+     171             : 
+     172             :       // erase start
+     173           0 :       if (insert_a) r[pos1--]=a;
+     174           0 :       if (pos1>=0)
+     175             :         r.erase(r.begin(),r.begin()+pos1+1);
+     176           0 :       }
+     177             : 
+     178             :     /*! Returns the total number of elements in the rangeset. */
+     179             :     T nval() const
+     180             :       {
+     181             :       T result=T(0);
+     182           0 :       for (tsize i=0; i<r.size(); i+=2)
+     183           0 :         result+=r[i+1]-r[i];
+     184             :       return result;
+     185             :       }
+     186             : 
+     187             :     /*! After this opration, \a res contains all elements of the rangeset
+     188             :         in ascending order. */
+     189           0 :     void toVector (std::vector<T> &res) const
+     190             :       {
+     191             :       res.clear();
+     192           0 :       res.reserve(nval());
+     193           0 :       for (tsize i=0; i<r.size(); i+=2)
+     194           0 :         for (T m(r[i]); m<r[i+1]; ++m)
+     195           0 :           res.push_back(m);
+     196           0 :       }
+     197             : 
+     198             :     /*! After this operation, the rangeset contains the union of itself
+     199             :         and \a other. */
+     200             :     void unite (const rangeset &other)
+     201             :       {
+     202             :       rtype tmp;
+     203             :       generalUnion (r,other.r,false,false,tmp);
+     204             :       std::swap(r,tmp);
+     205             :       }
+     206             :     /*! After this operation, the rangeset contains the intersection of itself
+     207             :         and \a other. */
+     208             :     void intersect (const rangeset &other)
+     209             :       {
+     210             :       rtype tmp;
+     211             :       generalUnion (r,other.r,true,true,tmp);
+     212             :       std::swap(r,tmp);
+     213             :       }
+     214             :     /*! After this operation, the rangeset contains the union of itself
+     215             :         with the inverse of \a other. */
+     216             :     void subtract (const rangeset &other)
+     217             :       {
+     218             :       rtype tmp;
+     219             :       generalUnion (r,other.r,true,false,tmp);
+     220             :       std::swap(r,tmp);
+     221             :       }
+     222             :     /*! After this operation, the rangeset contains the union of \a a
+     223             :         and \a b. */
+     224             :     void setToUnion (const rangeset &a, const rangeset &b)
+     225             :       { generalUnion (a.r,b.r,false,false,r); }
+     226             :     /*! After this operation, the rangeset contains the intersection of \a a
+     227             :         and \a b. */
+     228             :     void setToIntersection (const rangeset &a, const rangeset &b)
+     229             :       { generalUnion (a.r,b.r,true,true,r); }
+     230             :     /*! After this operation, the rangeset contains the union of \a a
+     231             :         with the inverse of \a b. */
+     232             :     void setToDifference (const rangeset &a, const rangeset &b)
+     233             :       { generalUnion (a.r,b.r,true,false,r); }
+     234             : 
+     235             :     /*! Returns the index of the interval containing \a v; if no such interval
+     236             :         exists, -1 is returned. */
+     237             :     tdiff findInterval (const T &v) const
+     238             :       {
+     239             :       tdiff res = iiv(v);
+     240             :       return (res&1) ? -1 : res>>1;
+     241             :       }
+     242             : 
+     243             :     /*! Returns \a true if the rangeset is identical to \a other, else \a false.
+     244             :         */
+     245             :     bool equals (const rangeset &other) const
+     246             :       { return r==other.data(); }
+     247             : 
+     248             :     /*! Returns \a true if the rangeset contains all values in the range
+     249             :         \a [a;b[, else \a false. */
+     250             :     bool containsAll (T a,T b) const
+     251             :       {
+     252             :       tdiff res=iiv(a);
+     253             :       if (res&1) return false;
+     254             :       return (b<=r[res+1]);
+     255             :       }
+     256             :     /*! Returns \a true if the rangeset contains the value \a v,
+     257             :         else \a false. */
+     258             :     bool contains (T v) const
+     259             :       { return !(iiv(v)&1); }
+     260             :     /*! Returns \a true if the rangeset contains all values stored in \a other,
+     261             :         else \a false. */
+     262             :     bool contains (const rangeset &other) const
+     263             :       {
+     264             :       tsize im=0, em=r.size();
+     265             :       for (tsize i=0; i<other.r.size(); i+=2)
+     266             :         {
+     267             :         T a=other.r[i], b=other.r[i+1];
+     268             :         while ((im!=em) && (r[im+1] < a)) im+=2;
+     269             :         if (im==em) return false;
+     270             :         if ((r[im]>a) || (r[im+1]<b)) return false;
+     271             :         }
+     272             :       return true;
+     273             :       }
+     274             :   };
+     275             : 
+     276             : template<typename T> inline std::ostream &operator<< (std::ostream &os,
+     277             :   const rangeset<T> &rs)
+     278             :   {
+     279             :   os << "{ ";
+     280             :   for (tsize i=0; i<rs.size(); ++i)
+     281             :     os << "["<<rs.ivbegin(i)<<";"<<rs.ivend(i)<<"[ ";
+     282             :   return os << "}";
+     283             :   }
+     284             : 
+     285             : } // namespace healpix
+     286             : #endif
+     287             : 
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/vec3.h.func-sort-c.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/vec3.h.func-sort-c.html new file mode 100644 index 000000000..50398e10d --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/vec3.h.func-sort-c.html @@ -0,0 +1,80 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/vec3.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - vec3.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:102245.5 %
Date:2024-04-08 14:58:22Functions:1250.0 %
+
+ +
+ + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix6vec3_tIdE9NormalizeEv0
_ZN7healpix6vec3_tIdE9set_z_phiEdd134176
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/vec3.h.func.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/vec3.h.func.html new file mode 100644 index 000000000..633dc74e4 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/vec3.h.func.html @@ -0,0 +1,80 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/vec3.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - vec3.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:102245.5 %
Date:2024-04-08 14:58:22Functions:1250.0 %
+
+ +
+ + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix6vec3_tIdE9NormalizeEv0
_ZN7healpix6vec3_tIdE9set_z_phiEdd134176
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/vec3.h.gcov.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/vec3.h.gcov.html new file mode 100644 index 000000000..78b942fb1 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/include/healpix_base/vec3.h.gcov.html @@ -0,0 +1,229 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/vec3.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base/include/healpix_base - vec3.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:102245.5 %
Date:2024-04-08 14:58:22Functions:1250.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : /*
+       2             :  *  This file is part of libcxxsupport.
+       3             :  *
+       4             :  *  libcxxsupport is free software; you can redistribute it and/or modify
+       5             :  *  it under the terms of the GNU General Public License as published by
+       6             :  *  the Free Software Foundation; either version 2 of the License, or
+       7             :  *  (at your option) any later version.
+       8             :  *
+       9             :  *  libcxxsupport is distributed in the hope that it will be useful,
+      10             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+      11             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+      12             :  *  GNU General Public License for more details.
+      13             :  *
+      14             :  *  You should have received a copy of the GNU General Public License
+      15             :  *  along with libcxxsupport; if not, write to the Free Software
+      16             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+      17             :  */
+      18             : 
+      19             : /*
+      20             :  *  libcxxsupport is being developed at the Max-Planck-Institut fuer Astrophysik
+      21             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
+      22             :  *  (DLR).
+      23             :  */
+      24             : 
+      25             : /*! \file vec3.h
+      26             :  *  Class representing 3D cartesian vectors
+      27             :  *
+      28             :  *  Copyright (C) 2003, 2006 Max-Planck-Society
+      29             :  *  \author Martin Reinecke
+      30             :  */
+      31             : 
+      32             : #ifndef PLANCK_VEC3_H
+      33             : #define PLANCK_VEC3_H
+      34             : 
+      35             : #include <cmath>
+      36             : #include <iostream>
+      37             : #include "healpix_base/datatypes.h"
+      38             : 
+      39             : namespace healpix{
+      40             : 
+      41             : /*! \defgroup vec3group 3D vectors */
+      42             : /*! \{ */
+      43             : 
+      44             : /*! Class representing a 3D cartesian vector. */
+      45             : template<typename T>class vec3_t
+      46             :   {
+      47             :   public:
+      48             :     T x, /*!< x-coordinate */
+      49             :       y, /*!< y-coordinate */
+      50             :       z; /*!< z-coordinate */
+      51             : 
+      52             :     /*! Default constructor. Does not initialize \a x, \a y, and \a z. */
+      53      244781 :     vec3_t () {}
+      54             :     /*! Creates a vector with the coordinates \a xc, \a yc, and \a zc. */
+      55        1417 :     vec3_t (T xc, T yc, T zc)
+      56        1417 :       : x(xc), y(yc), z(zc) {}
+      57             :     template<typename T2> explicit vec3_t (const vec3_t<T2> &orig)
+      58             :       : x(orig.x), y(orig.y), z(orig.z) {}
+      59             : 
+      60             :     /*! Sets the vector components to \a xc, \a yc, and \a zc. */
+      61             :     void Set (T xc, T yc, T zc)
+      62             :       { x=xc; y=yc; z=zc; }
+      63             :     /*! Creates a unit vector from a z coordinate and an azimuthal angle. */
+      64      134176 :     void set_z_phi (T z_, T phi)
+      65             :       {
+      66             :       using namespace std;
+      67      134176 :       T sintheta = sqrt((T(1)-z_)*(T(1)+z_));
+      68      134176 :       x = sintheta*cos(phi);
+      69      134176 :       y = sintheta*sin(phi);
+      70      134176 :       z = z_;
+      71      134176 :       }
+      72             : 
+      73             :     /*! Normalizes the vector to length 1. */
+      74           0 :     void Normalize ()
+      75             :       {
+      76             :       using namespace std;
+      77           0 :       T l = T(1)/sqrt (x*x + y*y + z*z);
+      78           0 :       x*=l; y*=l; z*=l;
+      79           0 :       }
+      80             : 
+      81             :     vec3_t Norm() const
+      82             :       {
+      83           0 :       vec3_t res(*this);
+      84           0 :       res.Normalize();
+      85             :       return res;
+      86             :       }
+      87             : 
+      88             :     /*! Returns the length of the vector. */
+      89             :     T Length () const
+      90       24585 :       { return sqrt (x*x + y*y + z*z); }
+      91             : 
+      92             :     /*! Returns the squared length of the vector. */
+      93             :     T SquaredLength () const
+      94             :       { return (x*x + y*y + z*z); }
+      95             :     /*! Returns the vector with the signs of all coordinates flipped. */
+      96             :     const vec3_t operator- () const
+      97             :       { return vec3_t (-x, -y, -z); }
+      98             :     /*! Flips the signs of all coordinates. */
+      99             :     void Flip ()
+     100           0 :       { x=-x; y=-y; z=-z; }
+     101             :     /*! Returns (\a *this + \a vec). */
+     102             :     const vec3_t operator+ (const vec3_t &vec) const
+     103           0 :       { return vec3_t (x+vec.x, y+vec.y, z+vec.z); }
+     104             :     /*! Adds \a vec to \a *this. */
+     105             :     vec3_t &operator+= (const vec3_t &vec)
+     106             :       { x+=vec.x; y+=vec.y; z+=vec.z; return *this; }
+     107             :     /*! Returns (\a *this - \a vec). */
+     108             :     const vec3_t operator- (const vec3_t &vec) const
+     109           0 :       { return vec3_t (x-vec.x, y-vec.y, z-vec.z); }
+     110             :     /*! Subtracts \a vec from \a *this. */
+     111             :     vec3_t &operator-= (const vec3_t &vec)
+     112             :       { x-=vec.x; y-=vec.y; z-=vec.z; return *this; }
+     113             :     /*! Returns the vector scaled by \a fact. */
+     114             :     const vec3_t operator* (T fact) const
+     115             :       { return vec3_t (x*fact, y*fact, z*fact); }
+     116             :     /*! Returns the vector scaled by \a 1/fact. */
+     117             :     const vec3_t operator/ (T fact) const
+     118             :       { T xfact = T(1)/fact; return vec3_t (x*xfact, y*xfact, z*xfact); }
+     119             :     /*! Scales the vector by \a fact. */
+     120             :     vec3_t &operator*= (T fact)
+     121           0 :       { x*=fact; y*=fact; z*=fact; return *this; }
+     122             :   };
+     123             : 
+     124             : /*! Returns the dot product of \a v1 and \a v2.
+     125             :     \relates vec3_t */
+     126             : template<typename T> inline T dotprod(const vec3_t<T> &v1, const vec3_t<T> &v2)
+     127           0 :   { return v1.x*v2.x + v1.y*v2.y + v1.z*v2.z; }
+     128             : 
+     129             : /*! Returns the cross product of \a a and \a b.
+     130             :     \relates vec3_t */
+     131             : template<typename T> inline vec3_t<T> crossprod
+     132             :   (const vec3_t<T> &a, const vec3_t<T> &b)
+     133           0 :   { return vec3_t<T>(a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x); }
+     134             : 
+     135             : /*! Writes \a v to \a os.
+     136             :     \relates vec3_t */
+     137             : template<typename T> inline std::ostream &operator<<
+     138             :   (std::ostream &os, const vec3_t<T> &v)
+     139             :   {
+     140             :   os << v.x << ", " << v.y << ", " << v.z << std::endl;
+     141             :   return os;
+     142             :   }
+     143             : 
+     144             : /*! Specialisation of vec3_t for 64-bit floating point components */
+     145             : typedef vec3_t<float64> vec3;
+     146             : /*! Specialisation of vec3_t for 32-bit floating point components */
+     147             : typedef vec3_t<float32> vec3f;
+     148             : 
+     149             : /*! \} */
+     150             : 
+     151             : } // namespace healpix
+     152             : #endif
+     153             : 
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/index-sort-f.html b/doc/coverageReport/libs/healpix_base/index-sort-f.html new file mode 100644 index 000000000..90582d17c --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/index-sort-f.html @@ -0,0 +1,123 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_baseHitTotalCoverage
Test:coverage.info.cleanedLines:11279214.1 %
Date:2024-04-08 14:58:22Functions:101069.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
geom_utils.cc +
0.0%
+
0.0 %0 / 250.0 %0 / 3
pointing.cc +
0.0%
+
0.0 %0 / 210.0 %0 / 5
error_handling.cc +
0.0%
+
0.0 %0 / 120.0 %0 / 7
healpix_base.cc +
15.3%15.3%
+
15.3 %112 / 73411.0 %10 / 91
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/index-sort-l.html b/doc/coverageReport/libs/healpix_base/index-sort-l.html new file mode 100644 index 000000000..51b835471 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/index-sort-l.html @@ -0,0 +1,123 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_baseHitTotalCoverage
Test:coverage.info.cleanedLines:11279214.1 %
Date:2024-04-08 14:58:22Functions:101069.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
error_handling.cc +
0.0%
+
0.0 %0 / 120.0 %0 / 7
pointing.cc +
0.0%
+
0.0 %0 / 210.0 %0 / 5
geom_utils.cc +
0.0%
+
0.0 %0 / 250.0 %0 / 3
healpix_base.cc +
15.3%15.3%
+
15.3 %112 / 73411.0 %10 / 91
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/index.html b/doc/coverageReport/libs/healpix_base/index.html new file mode 100644 index 000000000..5078da2bf --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/index.html @@ -0,0 +1,123 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_baseHitTotalCoverage
Test:coverage.info.cleanedLines:11279214.1 %
Date:2024-04-08 14:58:22Functions:101069.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
error_handling.cc +
0.0%
+
0.0 %0 / 120.0 %0 / 7
geom_utils.cc +
0.0%
+
0.0 %0 / 250.0 %0 / 3
healpix_base.cc +
15.3%15.3%
+
15.3 %112 / 73411.0 %10 / 91
pointing.cc +
0.0%
+
0.0 %0 / 210.0 %0 / 5
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/pointing.cc.func-sort-c.html b/doc/coverageReport/libs/healpix_base/pointing.cc.func-sort-c.html new file mode 100644 index 000000000..4499d9636 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/pointing.cc.func-sort-c.html @@ -0,0 +1,92 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/pointing.cc - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base - pointing.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0210.0 %
Date:2024-04-08 14:58:22Functions:050.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix8pointing15normalize_thetaEv0
_ZN7healpix8pointing9from_vec3ERKNS_6vec3_tIdEE0
_ZN7healpix8pointing9normalizeEv0
_ZN7healpixlsERSoRKNS_8pointingE0
_ZNK7healpix8pointing7to_vec3Ev0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/pointing.cc.func.html b/doc/coverageReport/libs/healpix_base/pointing.cc.func.html new file mode 100644 index 000000000..473f90349 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/pointing.cc.func.html @@ -0,0 +1,92 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/pointing.cc - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base - pointing.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0210.0 %
Date:2024-04-08 14:58:22Functions:050.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix8pointing15normalize_thetaEv0
_ZN7healpix8pointing9from_vec3ERKNS_6vec3_tIdEE0
_ZN7healpix8pointing9normalizeEv0
_ZN7healpixlsERSoRKNS_8pointingE0
_ZNK7healpix8pointing7to_vec3Ev0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/healpix_base/pointing.cc.gcov.html b/doc/coverageReport/libs/healpix_base/pointing.cc.gcov.html new file mode 100644 index 000000000..678a7db26 --- /dev/null +++ b/doc/coverageReport/libs/healpix_base/pointing.cc.gcov.html @@ -0,0 +1,148 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/healpix_base/pointing.cc + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/healpix_base - pointing.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0210.0 %
Date:2024-04-08 14:58:22Functions:050.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : /*
+       2             :  *  This file is part of libcxxsupport.
+       3             :  *
+       4             :  *  libcxxsupport is free software; you can redistribute it and/or modify
+       5             :  *  it under the terms of the GNU General Public License as published by
+       6             :  *  the Free Software Foundation; either version 2 of the License, or
+       7             :  *  (at your option) any later version.
+       8             :  *
+       9             :  *  libcxxsupport is distributed in the hope that it will be useful,
+      10             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+      11             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+      12             :  *  GNU General Public License for more details.
+      13             :  *
+      14             :  *  You should have received a copy of the GNU General Public License
+      15             :  *  along with libcxxsupport; if not, write to the Free Software
+      16             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+      17             :  */
+      18             : 
+      19             : /*
+      20             :  *  libcxxsupport is being developed at the Max-Planck-Institut fuer Astrophysik
+      21             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
+      22             :  *  (DLR).
+      23             :  */
+      24             : 
+      25             : /*! \file pointing.cc
+      26             :  *  Class representing a direction in 3D space
+      27             :  *
+      28             :  *  Copyright (C) 2003-2012 Max-Planck-Society
+      29             :  *  \author Martin Reinecke
+      30             :  */
+      31             : 
+      32             : #include "healpix_base/pointing.h"
+      33             : #include "healpix_base/lsconstants.h"
+      34             : #include "healpix_base/math_utils.h"
+      35             : 
+      36             : namespace healpix{
+      37             : 
+      38             : using namespace std;
+      39             : 
+      40           0 : vec3 pointing::to_vec3() const
+      41             :   {
+      42           0 :   double st=sin(theta);
+      43           0 :   return vec3 (st*cos(phi), st*sin(phi), cos(theta));
+      44             :   }
+      45           0 : void pointing::from_vec3 (const vec3 &inp)
+      46             :   {
+      47           0 :   theta = atan2(sqrt(inp.x*inp.x+inp.y*inp.y),inp.z);
+      48           0 :   phi = safe_atan2 (inp.y,inp.x);
+      49           0 :   if (phi<0.) phi += twopi;
+      50           0 :   }
+      51           0 : void pointing::normalize_theta()
+      52             :   {
+      53           0 :   theta=fmodulo(theta,twopi);
+      54           0 :   if (theta>pi)
+      55             :     {
+      56           0 :     phi+=pi;
+      57           0 :     theta=twopi-theta;
+      58             :     }
+      59           0 :   }
+      60           0 : void pointing::normalize()
+      61             :   {
+      62           0 :   normalize_theta();
+      63           0 :   phi=fmodulo(phi,twopi);
+      64           0 :   }
+      65             : 
+      66           0 : ostream &operator<< (ostream &os, const pointing &p)
+      67             :   {
+      68           0 :   os << p.theta << ", " << p.phi << std::endl;
+      69           0 :   return os;
+      70             :   }
+      71             : } // namespace healpix
+      72             : 
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/kiss/include/kiss/convert.h.func-sort-c.html b/doc/coverageReport/libs/kiss/include/kiss/convert.h.func-sort-c.html new file mode 100644 index 000000000..3091b54e8 --- /dev/null +++ b/doc/coverageReport/libs/kiss/include/kiss/convert.h.func-sort-c.html @@ -0,0 +1,76 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/kiss/include/kiss/convert.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/kiss/include/kiss - convert.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:71070.0 %
Date:2024-04-08 14:58:22Functions:11100.0 %
+
+ +
+ + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN4kiss3strIiEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_2
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/kiss/include/kiss/convert.h.func.html b/doc/coverageReport/libs/kiss/include/kiss/convert.h.func.html new file mode 100644 index 000000000..df4061a5f --- /dev/null +++ b/doc/coverageReport/libs/kiss/include/kiss/convert.h.func.html @@ -0,0 +1,76 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/kiss/include/kiss/convert.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/kiss/include/kiss - convert.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:71070.0 %
Date:2024-04-08 14:58:22Functions:11100.0 %
+
+ +
+ + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN4kiss3strIiEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_2
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/kiss/include/kiss/convert.h.gcov.html b/doc/coverageReport/libs/kiss/include/kiss/convert.h.gcov.html new file mode 100644 index 000000000..6a912c12a --- /dev/null +++ b/doc/coverageReport/libs/kiss/include/kiss/convert.h.gcov.html @@ -0,0 +1,150 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/kiss/include/kiss/convert.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/kiss/include/kiss - convert.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:71070.0 %
Date:2024-04-08 14:58:22Functions:11100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef KISS_CONVERT_H
+       2             : #define KISS_CONVERT_H
+       3             : 
+       4             : #include <iostream>
+       5             : #include <sstream>
+       6             : #include <string>
+       7             : #include <typeinfo>
+       8             : #include <stdexcept>
+       9             : 
+      10             : namespace kiss {
+      11             : 
+      12             : class bad_conversion: public std::runtime_error {
+      13             : public:
+      14           0 :         bad_conversion(std::string const& s) :
+      15           0 :                         std::runtime_error(s) {
+      16             :         }
+      17             : };
+      18             : 
+      19             : template<typename T>
+      20           2 : inline std::string str(T const& x) {
+      21           2 :         std::ostringstream o;
+      22           2 :         o.imbue(std::locale("C"));
+      23           2 :         o << x;
+      24           2 :         if (!o) {
+      25             : #ifdef DEBUG
+      26             :                 std::cerr << "bad_conversion: str(" << typeid(x).name() << ")";
+      27             : #endif
+      28           0 :                 throw bad_conversion(std::string("str(") + typeid(x).name() + ")");
+      29             :         }
+      30           2 :         return o.str();
+      31           2 : }
+      32             : 
+      33             : template<typename T>
+      34             : inline void convert(const char *s, T& x) {
+      35             :         if (s == 0) {
+      36             : #ifdef DEBUG
+      37             :                 std::cerr << "bad_conversion: convert, null pointer";
+      38             : #endif
+      39             :                 throw bad_conversion("null pointer");
+      40             :         }
+      41             :         std::istringstream i(s);
+      42             :         i.imbue(std::locale("C"));
+      43             :         i >> x;
+      44             :         if (!i) {
+      45             : #ifdef DEBUG
+      46             :                 std::cerr << "bad_conversion: convert (" << s << ")";
+      47             : #endif
+      48             :                 throw bad_conversion(std::string(s) + " to " + typeid(x).name());
+      49             :         }
+      50             : }
+      51             : 
+      52             : template<typename T>
+      53             : inline void convert(std::string const& s, T& x) {
+      54             :         std::istringstream i(s);
+      55             :         i.imbue(std::locale("C"));
+      56             :         i >> x;
+      57             :         if (!i) {
+      58             : #ifdef DEBUG
+      59             :                 std::cerr << "bad_conversion: convert (" << s << ")";
+      60             : #endif
+      61             :                 throw bad_conversion(s + " to " + typeid(x).name());
+      62             :         }
+      63             : }
+      64             : 
+      65             : template<typename T>
+      66             : inline T convertTo(std::string const& s, bool failIfLeftoverChars = true) {
+      67             :         T x;
+      68             :         convert(s, x, failIfLeftoverChars);
+      69             :         return x;
+      70             : }
+      71             : 
+      72             : } // namespace kiss
+      73             : 
+      74             : #endif /* KISSCONVERT_H */
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/kiss/include/kiss/index-sort-f.html b/doc/coverageReport/libs/kiss/include/kiss/index-sort-f.html new file mode 100644 index 000000000..bb06075e7 --- /dev/null +++ b/doc/coverageReport/libs/kiss/include/kiss/index-sort-f.html @@ -0,0 +1,103 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/kiss/include/kiss + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/kiss/include/kissHitTotalCoverage
Test:coverage.info.cleanedLines:111957.9 %
Date:2024-04-08 14:58:22Functions:146720.9 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
logger.h +
44.4%44.4%
+
44.4 %4 / 919.7 %13 / 66
convert.h +
70.0%70.0%
+
70.0 %7 / 10100.0 %1 / 1
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/kiss/include/kiss/index-sort-l.html b/doc/coverageReport/libs/kiss/include/kiss/index-sort-l.html new file mode 100644 index 000000000..b047c279f --- /dev/null +++ b/doc/coverageReport/libs/kiss/include/kiss/index-sort-l.html @@ -0,0 +1,103 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/kiss/include/kiss + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/kiss/include/kissHitTotalCoverage
Test:coverage.info.cleanedLines:111957.9 %
Date:2024-04-08 14:58:22Functions:146720.9 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
logger.h +
44.4%44.4%
+
44.4 %4 / 919.7 %13 / 66
convert.h +
70.0%70.0%
+
70.0 %7 / 10100.0 %1 / 1
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/kiss/include/kiss/index.html b/doc/coverageReport/libs/kiss/include/kiss/index.html new file mode 100644 index 000000000..c4b160333 --- /dev/null +++ b/doc/coverageReport/libs/kiss/include/kiss/index.html @@ -0,0 +1,103 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/kiss/include/kiss + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/kiss/include/kissHitTotalCoverage
Test:coverage.info.cleanedLines:111957.9 %
Date:2024-04-08 14:58:22Functions:146720.9 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
convert.h +
70.0%70.0%
+
70.0 %7 / 10100.0 %1 / 1
logger.h +
44.4%44.4%
+
44.4 %4 / 919.7 %13 / 66
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/kiss/include/kiss/logger.h.func-sort-c.html b/doc/coverageReport/libs/kiss/include/kiss/logger.h.func-sort-c.html new file mode 100644 index 000000000..35772c48a --- /dev/null +++ b/doc/coverageReport/libs/kiss/include/kiss/logger.h.func-sort-c.html @@ -0,0 +1,336 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/kiss/include/kiss/logger.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/kiss/include/kiss - logger.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:4944.4 %
Date:2024-04-08 14:58:22Functions:136619.7 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN4kiss6LoggerlsEPFRSoS1_E0
_ZN4kiss6LoggerlsIA11_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA12_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA135_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA14_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA156_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA15_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA16_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA18_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA197_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA231_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA23_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA256_cEERS0_RT_0
_ZN4kiss6LoggerlsIA25_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA26_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA27_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA33_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA34_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA35_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA39_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA40_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA41_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA42_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA46_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA47_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA49_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA53_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA54_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA55_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA69_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA6_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA70_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA71_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA72_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA73_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA74_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA75_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA81_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA82_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA83_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA8_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA93_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA9_KcEERS0_RT_0
_ZN4kiss6LoggerlsIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEERS0_RT_0
_ZN4kiss6LoggerlsIKbEERS0_RT_0
_ZN4kiss6LoggerlsIKiEERS0_RT_0
_ZN4kiss6LoggerlsIKmEERS0_RT_0
_ZN4kiss6LoggerlsIN7crpropa7Vector3IdEEEERS0_RT_0
_ZN4kiss6LoggerlsINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEERS0_RT_0
_ZN4kiss6LoggerlsIbEERS0_RT_0
_ZN4kiss6LoggerlsIdEERS0_RT_0
_ZN4kiss6LoggerlsImEERS0_RT_0
_ZN4kiss6LoggerlsIyEERS0_RT_0
_ZN4kiss6LoggerlsIA166_KcEERS0_RT_1
_ZN4kiss6LoggerlsIA3_KcEERS0_RT_1
_ZN4kiss6LoggerlsIA59_KcEERS0_RT_1
_ZN4kiss6LoggerlsIA5_KcEERS0_RT_1
_ZN4kiss6LoggerlsIA7_KcEERS0_RT_1
_ZN4kiss6LoggerlsIA2_KcEERS0_RT_2
_ZN4kiss6LoggerlsIA58_KcEERS0_RT_2
_ZN4kiss6LoggerlsIA64_KcEERS0_RT_2
_ZN4kiss6LoggerlsIA67_KcEERS0_RT_2
_ZN4kiss6LoggerlsIiEERS0_RT_2
_ZN4kiss6LoggerlsIA51_KcEERS0_RT_3
_ZN4kiss6LoggerlsIA131_KcEERS0_RT_4
_ZN4kiss6LoggerlsIA50_KcEERS0_RT_4
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/kiss/include/kiss/logger.h.func.html b/doc/coverageReport/libs/kiss/include/kiss/logger.h.func.html new file mode 100644 index 000000000..1f4061bc2 --- /dev/null +++ b/doc/coverageReport/libs/kiss/include/kiss/logger.h.func.html @@ -0,0 +1,336 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/kiss/include/kiss/logger.h - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/kiss/include/kiss - logger.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:4944.4 %
Date:2024-04-08 14:58:22Functions:136619.7 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN4kiss6LoggerlsEPFRSoS1_E0
_ZN4kiss6LoggerlsIA11_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA12_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA131_KcEERS0_RT_4
_ZN4kiss6LoggerlsIA135_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA14_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA156_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA15_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA166_KcEERS0_RT_1
_ZN4kiss6LoggerlsIA16_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA18_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA197_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA231_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA23_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA256_cEERS0_RT_0
_ZN4kiss6LoggerlsIA25_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA26_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA27_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA2_KcEERS0_RT_2
_ZN4kiss6LoggerlsIA33_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA34_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA35_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA39_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA3_KcEERS0_RT_1
_ZN4kiss6LoggerlsIA40_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA41_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA42_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA46_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA47_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA49_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA50_KcEERS0_RT_4
_ZN4kiss6LoggerlsIA51_KcEERS0_RT_3
_ZN4kiss6LoggerlsIA53_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA54_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA55_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA58_KcEERS0_RT_2
_ZN4kiss6LoggerlsIA59_KcEERS0_RT_1
_ZN4kiss6LoggerlsIA5_KcEERS0_RT_1
_ZN4kiss6LoggerlsIA64_KcEERS0_RT_2
_ZN4kiss6LoggerlsIA67_KcEERS0_RT_2
_ZN4kiss6LoggerlsIA69_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA6_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA70_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA71_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA72_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA73_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA74_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA75_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA7_KcEERS0_RT_1
_ZN4kiss6LoggerlsIA81_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA82_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA83_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA8_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA93_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA9_KcEERS0_RT_0
_ZN4kiss6LoggerlsIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEERS0_RT_0
_ZN4kiss6LoggerlsIKbEERS0_RT_0
_ZN4kiss6LoggerlsIKiEERS0_RT_0
_ZN4kiss6LoggerlsIKmEERS0_RT_0
_ZN4kiss6LoggerlsIN7crpropa7Vector3IdEEEERS0_RT_0
_ZN4kiss6LoggerlsINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEERS0_RT_0
_ZN4kiss6LoggerlsIbEERS0_RT_0
_ZN4kiss6LoggerlsIdEERS0_RT_0
_ZN4kiss6LoggerlsIiEERS0_RT_2
_ZN4kiss6LoggerlsImEERS0_RT_0
_ZN4kiss6LoggerlsIyEERS0_RT_0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/kiss/include/kiss/logger.h.gcov.html b/doc/coverageReport/libs/kiss/include/kiss/logger.h.gcov.html new file mode 100644 index 000000000..a7402eee3 --- /dev/null +++ b/doc/coverageReport/libs/kiss/include/kiss/logger.h.gcov.html @@ -0,0 +1,131 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/kiss/include/kiss/logger.h + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/kiss/include/kiss - logger.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:4944.4 %
Date:2024-04-08 14:58:22Functions:136619.7 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifndef KISS_LOG_H
+       2             : #define KISS_LOG_H
+       3             : 
+       4             : #include <iostream>
+       5             : 
+       6             : namespace kiss {
+       7             : 
+       8             : enum eLogLevel {
+       9             :         LOG_LEVEL_ERROR, LOG_LEVEL_WARNING, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG
+      10             : };
+      11             : 
+      12             : class Logger {
+      13             :         static std::ostream *stream;
+      14             :         static eLogLevel level;
+      15             : public:
+      16             :         Logger(eLogLevel level);
+      17             :         ~Logger();
+      18             :         static std::ostream &getLogStream();
+      19             :         static void setLogStream(std::ostream *s);
+      20             :         static void setLogStream(std::ostream &s);
+      21             : 
+      22             :         static void setLogLevel(eLogLevel level);
+      23             :         static eLogLevel getLogLevel();
+      24             : 
+      25             :         static void loadEnvLogLevel();
+      26             : 
+      27             :         operator std::ostream &() {
+      28           0 :                 return getLogStream();
+      29             :         }
+      30             : 
+      31          26 :         template<typename T> inline Logger& operator<<(T& data) {
+      32          52 :                 #pragma omp critical (KISS_LOGGER)
+      33             :                 {
+      34          26 :                 getLogStream() << data;
+      35             :                 }
+      36          26 :                 return *this;
+      37             :         }
+      38             : 
+      39           0 :         inline Logger& operator<<(std::ostream& (*func)(std::ostream&)) {
+      40           0 :                 #pragma omp critical (KISS_LOGGER)
+      41             :                 {
+      42           0 :                 getLogStream() << func;
+      43             :                 }
+      44           0 :                 return *this;
+      45             :         }
+      46             : };
+      47             : 
+      48             : } // namespace kiss
+      49             : 
+      50             : #define KISS_LOG_ERROR if (kiss::Logger::getLogLevel() < kiss::LOG_LEVEL_ERROR) {} else kiss::Logger(kiss::LOG_LEVEL_ERROR)
+      51             : #define KISS_LOG_WARNING if (kiss::Logger::getLogLevel() < kiss::LOG_LEVEL_WARNING) {} else kiss::Logger(kiss::LOG_LEVEL_WARNING)
+      52             : #define KISS_LOG_INFO if (kiss::Logger::getLogLevel() < kiss::LOG_LEVEL_INFO) {} else kiss::Logger(kiss::LOG_LEVEL_INFO)
+      53             : #define KISS_LOG_DEBUG if (kiss::Logger::getLogLevel() < kiss::LOG_LEVEL_DEBUG) {} else kiss::Logger(kiss::LOG_LEVEL_DEBUG)
+      54             : 
+      55             : #endif /* KISSLOG_H */
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/kiss/src/index-sort-f.html b/doc/coverageReport/libs/kiss/src/index-sort-f.html new file mode 100644 index 000000000..ec409f400 --- /dev/null +++ b/doc/coverageReport/libs/kiss/src/index-sort-f.html @@ -0,0 +1,113 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/kiss/src + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/kiss/srcHitTotalCoverage
Test:coverage.info.cleanedLines:3412128.1 %
Date:2024-04-08 14:58:22Functions:92339.1 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
string.cpp +
14.8%14.8%
+
14.8 %4 / 2714.3 %1 / 7
path.cpp +
24.5%24.5%
+
24.5 %13 / 5337.5 %3 / 8
logger.cpp +
41.5%41.5%
+
41.5 %17 / 4162.5 %5 / 8
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/kiss/src/index-sort-l.html b/doc/coverageReport/libs/kiss/src/index-sort-l.html new file mode 100644 index 000000000..4cac3f96c --- /dev/null +++ b/doc/coverageReport/libs/kiss/src/index-sort-l.html @@ -0,0 +1,113 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/kiss/src + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/kiss/srcHitTotalCoverage
Test:coverage.info.cleanedLines:3412128.1 %
Date:2024-04-08 14:58:22Functions:92339.1 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
string.cpp +
14.8%14.8%
+
14.8 %4 / 2714.3 %1 / 7
path.cpp +
24.5%24.5%
+
24.5 %13 / 5337.5 %3 / 8
logger.cpp +
41.5%41.5%
+
41.5 %17 / 4162.5 %5 / 8
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/kiss/src/index.html b/doc/coverageReport/libs/kiss/src/index.html new file mode 100644 index 000000000..d44e18167 --- /dev/null +++ b/doc/coverageReport/libs/kiss/src/index.html @@ -0,0 +1,113 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/kiss/src + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/kiss/srcHitTotalCoverage
Test:coverage.info.cleanedLines:3412128.1 %
Date:2024-04-08 14:58:22Functions:92339.1 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
logger.cpp +
41.5%41.5%
+
41.5 %17 / 4162.5 %5 / 8
path.cpp +
24.5%24.5%
+
24.5 %13 / 5337.5 %3 / 8
string.cpp +
14.8%14.8%
+
14.8 %4 / 2714.3 %1 / 7
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/kiss/src/logger.cpp.func-sort-c.html b/doc/coverageReport/libs/kiss/src/logger.cpp.func-sort-c.html new file mode 100644 index 000000000..a72ea02f2 --- /dev/null +++ b/doc/coverageReport/libs/kiss/src/logger.cpp.func-sort-c.html @@ -0,0 +1,104 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/kiss/src/logger.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/kiss/src - logger.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:174141.5 %
Date:2024-04-08 14:58:22Functions:5862.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN4kiss6Logger11setLogLevelENS_9eLogLevelE0
_ZN4kiss6Logger12setLogStreamEPSo0
_ZN4kiss6Logger12setLogStreamERSo0
_ZN4kiss6LoggerC2ENS_9eLogLevelE12
_ZN4kiss6LoggerD2Ev12
_ZN4kiss6Logger15loadEnvLogLevelEv19
_ZN4kiss6Logger12getLogStreamEv26
_ZN4kiss6Logger11getLogLevelEv290
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/kiss/src/logger.cpp.func.html b/doc/coverageReport/libs/kiss/src/logger.cpp.func.html new file mode 100644 index 000000000..c740d5ca4 --- /dev/null +++ b/doc/coverageReport/libs/kiss/src/logger.cpp.func.html @@ -0,0 +1,104 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/kiss/src/logger.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/kiss/src - logger.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:174141.5 %
Date:2024-04-08 14:58:22Functions:5862.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN4kiss6Logger11getLogLevelEv290
_ZN4kiss6Logger11setLogLevelENS_9eLogLevelE0
_ZN4kiss6Logger12getLogStreamEv26
_ZN4kiss6Logger12setLogStreamEPSo0
_ZN4kiss6Logger12setLogStreamERSo0
_ZN4kiss6Logger15loadEnvLogLevelEv19
_ZN4kiss6LoggerC2ENS_9eLogLevelE12
_ZN4kiss6LoggerD2Ev12
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/kiss/src/logger.cpp.gcov.html b/doc/coverageReport/libs/kiss/src/logger.cpp.gcov.html new file mode 100644 index 000000000..212278290 --- /dev/null +++ b/doc/coverageReport/libs/kiss/src/logger.cpp.gcov.html @@ -0,0 +1,161 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/kiss/src/logger.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/kiss/src - logger.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:174141.5 %
Date:2024-04-08 14:58:22Functions:5862.5 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "kiss/logger.h"
+       2             : 
+       3             : #include <stdlib.h>
+       4             : #include <iostream>
+       5             : 
+       6             : namespace kiss {
+       7             : 
+       8             : std::ostream *Logger::stream = &std::cerr;
+       9             : eLogLevel Logger::level = LOG_LEVEL_WARNING;
+      10             : const char* sLoggerLevel[] = { " ERROR ", "WARNING", " INFO  ", " DEBUG " };
+      11             : 
+      12             : class EnvLogger {
+      13             : public:
+      14             :         EnvLogger() {
+      15             :                 Logger::loadEnvLogLevel();
+      16             :         }
+      17             : };
+      18             : static EnvLogger _env_log_;
+      19             : 
+      20          12 : Logger::Logger(eLogLevel level) {
+      21             :         time_t rawtime;
+      22             :         struct tm * timeinfo;
+      23             :         char buffer[80];
+      24             : 
+      25          12 :         time(&rawtime);
+      26          12 :         timeinfo = localtime(&rawtime);
+      27             : 
+      28          12 :         strftime(buffer, 80, "%Y-%m-%d %H:%M:%S ", timeinfo);
+      29          12 :         *stream << buffer;
+      30          12 :         *stream << "[" << sLoggerLevel[level] << "] ";
+      31          12 : }
+      32             : 
+      33          12 : Logger::~Logger() {
+      34          12 :         *stream << std::endl;
+      35          12 : }
+      36             : 
+      37          26 : std::ostream &Logger::getLogStream() {
+      38          26 :         return (*stream);
+      39             : }
+      40             : 
+      41           0 : void Logger::setLogStream(std::ostream *s) {
+      42           0 :         stream = s;
+      43           0 : }
+      44             : 
+      45           0 : void Logger::setLogStream(std::ostream &s) {
+      46           0 :         stream = &s;
+      47           0 : }
+      48             : 
+      49           0 : void Logger::setLogLevel(eLogLevel l) {
+      50           0 :         level = l;
+      51           0 : }
+      52         290 : eLogLevel Logger::getLogLevel() {
+      53         290 :         return (level);
+      54             : }
+      55             : 
+      56             : 
+      57             : 
+      58             : 
+      59          19 : void Logger::loadEnvLogLevel() {
+      60          19 :         if (::getenv("KISS_LOG_LEVEL")) {
+      61             :                 
+      62           0 :                 int level = atoi(::getenv("KISS_LOG_LEVEL"));
+      63           0 :                 switch (level) {
+      64           0 :                 case LOG_LEVEL_ERROR:
+      65           0 :                         Logger::setLogLevel(LOG_LEVEL_ERROR);
+      66           0 :                         break;
+      67           0 :                 case LOG_LEVEL_WARNING:
+      68           0 :                         Logger::setLogLevel(LOG_LEVEL_WARNING);
+      69           0 :                         break;
+      70           0 :                 case LOG_LEVEL_INFO:
+      71           0 :                         Logger::setLogLevel(LOG_LEVEL_INFO);
+      72           0 :                         break;
+      73           0 :                 case LOG_LEVEL_DEBUG:
+      74           0 :                         Logger::setLogLevel(LOG_LEVEL_DEBUG);
+      75           0 :                         break;
+      76             :                 default:
+      77             :                         std::cerr << "kiss::Logger: unknown log level in KISS_LOG_LEVEL '"
+      78           0 :                                         << level << " values from 0-3 expected." << std::endl;
+      79             :                         break;
+      80             :                 }
+      81             :         }
+      82          19 : }
+      83             : 
+      84             : } // namespace kiss
+      85             : 
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/kiss/src/path.cpp.func-sort-c.html b/doc/coverageReport/libs/kiss/src/path.cpp.func-sort-c.html new file mode 100644 index 000000000..496484b29 --- /dev/null +++ b/doc/coverageReport/libs/kiss/src/path.cpp.func-sort-c.html @@ -0,0 +1,104 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/kiss/src/path.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/kiss/src - path.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:135324.5 %
Date:2024-04-08 14:58:22Functions:3837.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_Z11append_fileRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_b0
_Z11concat_pathRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_S6_0
_Z14list_directoryRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt6vectorIS4_SaIS4_EE0
_Z16create_directoryRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmmm0
_Z26create_directory_recursiveRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmmm0
_Z15executable_pathB5cxx11v13
_Z12is_directoryRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE26
_Z11concat_pathRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_547
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/kiss/src/path.cpp.func.html b/doc/coverageReport/libs/kiss/src/path.cpp.func.html new file mode 100644 index 000000000..e354ac988 --- /dev/null +++ b/doc/coverageReport/libs/kiss/src/path.cpp.func.html @@ -0,0 +1,104 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/kiss/src/path.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/kiss/src - path.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:135324.5 %
Date:2024-04-08 14:58:22Functions:3837.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_Z11append_fileRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_b0
_Z11concat_pathRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_547
_Z11concat_pathRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_S6_0
_Z12is_directoryRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE26
_Z14list_directoryRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt6vectorIS4_SaIS4_EE0
_Z15executable_pathB5cxx11v13
_Z16create_directoryRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmmm0
_Z26create_directory_recursiveRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmmm0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/kiss/src/path.cpp.gcov.html b/doc/coverageReport/libs/kiss/src/path.cpp.gcov.html new file mode 100644 index 000000000..7cc7b933a --- /dev/null +++ b/doc/coverageReport/libs/kiss/src/path.cpp.gcov.html @@ -0,0 +1,245 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/kiss/src/path.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/kiss/src - path.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:135324.5 %
Date:2024-04-08 14:58:22Functions:3837.5 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "kiss/path.h"
+       2             : 
+       3             : #ifdef WIN32
+       4             : #  include "windows.h"
+       5             : #  ifndef S_ISREG
+       6             : #    define S_ISREG(x) (((x) & S_IFMT) == S_IFREG)
+       7             : #  endif
+       8             : #  ifndef S_ISDIR
+       9             : #    define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR)
+      10             : #  endif
+      11             : #  include "sys/stat.h"
+      12             : #else
+      13             : #include <sys/types.h>
+      14             : #include <fcntl.h>
+      15             : #include <unistd.h>
+      16             : #include <dirent.h>
+      17             : #include "sys/stat.h"
+      18             : #endif
+      19             : 
+      20             : #include <stdexcept>
+      21             : #include <cstdio>
+      22             : 
+      23           0 : bool create_directory(const std::string &path, size_t user_permission,
+      24             :                 size_t group_permission, size_t other_permission) {
+      25             : #ifdef WIN32
+      26             :         BOOL result = ::CreateDirectoryA(path.c_str(), 0);
+      27             :         return result == TRUE;
+      28             : #else
+      29             :         mode_t m = 0;
+      30           0 :         m |= (user_permission << 6);
+      31           0 :         m |= (group_permission << 3);
+      32           0 :         m |= (other_permission << 0);
+      33           0 :         int result = mkdir(path.c_str(), m);
+      34           0 :         return (result == 0);
+      35             : #endif
+      36             : }
+      37             : 
+      38          26 : bool is_directory(const std::string &path) {
+      39             : #ifdef WIN32
+      40             :         struct _stat buf;
+      41             :         int result = _stat(path.c_str(), &buf);
+      42             :         if (result == 0 && S_ISDIR(buf.st_mode))
+      43             :                 return true;
+      44             :         else
+      45             :                 return false;
+      46             : #else
+      47             :         struct stat buf;
+      48          26 :         int result = stat(path.c_str(), &buf);
+      49          26 :         if (result == 0 && S_ISDIR(buf.st_mode))
+      50             :         return true;
+      51             :         else
+      52          26 :         return false;
+      53             : #endif
+      54             : }
+      55             : 
+      56           0 : bool list_directory(const std::string &directory,
+      57             :                 std::vector<std::string> &elements) {
+      58             : #ifdef WIN32
+      59             :         WIN32_FIND_DATA findData;
+      60             :         HANDLE hFind = FindFirstFileA((directory + "\\*.*").c_str(), &findData);
+      61             :         if (hFind == INVALID_HANDLE_VALUE)
+      62             :                 throw std::runtime_error("Failed to get directory list");
+      63             :         for (;;) {
+      64             :                 if (findData.cFileName[0] != '.') {
+      65             :                         elements.push_back(findData.cFileName);
+      66             :                 }
+      67             :                 if (FindNextFileA(hFind, &findData) == 0)
+      68             :                         break;
+      69             :         }
+      70             :         FindClose(hFind);
+      71             : #else
+      72           0 :         DIR* dir = opendir(directory.c_str());
+      73           0 :         if (dir == NULL)
+      74             :         return false;
+      75             :         dirent* entry;
+      76           0 :         while ((entry = readdir(dir)) != NULL) {
+      77           0 :                 if (entry->d_name[0] != '.') {
+      78           0 :                         elements.push_back(entry->d_name);
+      79             :                 }
+      80             :         }
+      81           0 :         closedir(dir);
+      82             : #endif
+      83           0 :         return true;
+      84             : }
+      85             : 
+      86           0 : bool create_directory_recursive(const std::string &dir, size_t user_permission,
+      87             :                 size_t group_permission, size_t other_permission) {
+      88             :         // split path
+      89           0 :         const char seperators[] = "\\/";
+      90             :         std::vector<std::string> elements;
+      91             :         std::string::size_type a, b;
+      92             :         a = dir.find_first_not_of(seperators), b = dir.find_first_of(seperators, a);
+      93           0 :         while (a != std::string::npos) {
+      94           0 :                 elements.push_back(dir.substr(a, b - a));
+      95             :                 a = dir.find_first_not_of(seperators, b), b = dir.find_first_of(
+      96             :                                 seperators, a);
+      97             :         }
+      98             : 
+      99             :         // create all non existing parts
+     100             :         std::string path;
+     101           0 :         for (size_t i = 0; i < elements.size(); i++) {
+     102             :                 path += elements[i];
+     103             :                 path += path_seperator;
+     104           0 :                 if (is_directory(path) == false)
+     105           0 :                         create_directory(path);
+     106             :         }
+     107             : 
+     108           0 :         return is_directory(dir);
+     109           0 : }
+     110             : 
+     111         547 : std::string concat_path(const std::string &a, const std::string &b) {
+     112         547 :         char last = *a.rbegin();
+     113         547 :         if (last == '\\' || last == '/')
+     114           0 :                 return a + b;
+     115             :         else
+     116        1094 :                 return a + path_seperator + b;
+     117             : 
+     118             : }
+     119             : 
+     120           0 : std::string concat_path(const std::string &a, const std::string &b,
+     121             :                 const std::string &c) {
+     122             :         std::string p = a;
+     123           0 :         if (*p.rbegin() != '\\' && *p.rbegin() != '/')
+     124             :                 p += path_seperator;
+     125             :         p += b;
+     126           0 :         if (*p.rbegin() != '\\' && *p.rbegin() != '/')
+     127             :                 p += path_seperator;
+     128             :         p += c;
+     129           0 :         return p;
+     130             : }
+     131             : 
+     132           0 : void append_file(const std::string &target, const std::string &source,
+     133             :                 bool binary) {
+     134           0 :         FILE *t = fopen(target.c_str(), binary ? "wb+" : "w+");
+     135           0 :         if (t == NULL)
+     136           0 :                 return;
+     137             : 
+     138           0 :         FILE *s = fopen(source.c_str(), binary ? "rb" : "r");
+     139           0 :         if (s == NULL) {
+     140           0 :                 fclose(t);
+     141           0 :                 return;
+     142             :         }
+     143             : 
+     144             :         size_t size = 0;
+     145             :         char buffer[1 << 20];
+     146           0 :         while ((size = fread(buffer, 1, sizeof(buffer), s)) > 0) {
+     147           0 :                 fwrite(buffer, 1, size, t);
+     148             :         }
+     149             : 
+     150           0 :         fclose(t);
+     151           0 :         fclose(s);
+     152             : }
+     153             : 
+     154          13 : std::string executable_path() {
+     155             :         char buf[1024];
+     156             : 
+     157             : //#if linux
+     158          13 :         size_t len = readlink("/proc/self/exe", buf, sizeof(buf)-1);
+     159             : //#else
+     160             : //      size_t len = ::GetModuleFileName(NULL, buf, sizeof(buf)-1 );
+     161             : //#endif
+     162         192 :         for (size_t i = 1; i < len; i++) {
+     163         189 :                 if (buf[len - 1] == path_seperator)
+     164             :                         break;
+     165             :                 else
+     166             :                         len --;
+     167             :         }
+     168          13 :         return std::string(buf, len);
+     169             : }
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/kiss/src/string.cpp.func-sort-c.html b/doc/coverageReport/libs/kiss/src/string.cpp.func-sort-c.html new file mode 100644 index 000000000..43fcf0d21 --- /dev/null +++ b/doc/coverageReport/libs/kiss/src/string.cpp.func-sort-c.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/kiss/src/string.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/kiss/src - string.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:42714.8 %
Date:2024-04-08 14:58:22Functions:1714.3 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN4kiss10trim_rightERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_0
_ZN4kiss11starts_withERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_0
_ZN4kiss4trimERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_0
_ZN4kiss7explodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt6vectorIS5_SaIS5_EEbS7_0
_ZN4kiss7implodeERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS6_EERKS6_0
_ZN4kiss9trim_leftERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_0
_ZN4kiss9ends_withERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_3
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/kiss/src/string.cpp.func.html b/doc/coverageReport/libs/kiss/src/string.cpp.func.html new file mode 100644 index 000000000..a35b5f6ae --- /dev/null +++ b/doc/coverageReport/libs/kiss/src/string.cpp.func.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/kiss/src/string.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/kiss/src - string.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:42714.8 %
Date:2024-04-08 14:58:22Functions:1714.3 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN4kiss10trim_rightERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_0
_ZN4kiss11starts_withERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_0
_ZN4kiss4trimERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_0
_ZN4kiss7explodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt6vectorIS5_SaIS5_EEbS7_0
_ZN4kiss7implodeERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS6_EERKS6_0
_ZN4kiss9ends_withERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_3
_ZN4kiss9trim_leftERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/libs/kiss/src/string.cpp.gcov.html b/doc/coverageReport/libs/kiss/src/string.cpp.gcov.html new file mode 100644 index 000000000..af1671ddc --- /dev/null +++ b/doc/coverageReport/libs/kiss/src/string.cpp.gcov.html @@ -0,0 +1,165 @@ + + + + + + + LCOV - coverage.info.cleaned - libs/kiss/src/string.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - libs/kiss/src - string.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:42714.8 %
Date:2024-04-08 14:58:22Functions:1714.3 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "kiss/string.h"
+       2             : 
+       3             : #include <iostream>
+       4             : #include <string>
+       5             : #include <vector>
+       6             : 
+       7             : namespace kiss {
+       8             : 
+       9           0 : std::string trim_right(const std::string &s, const std::string &t) {
+      10             :         std::string::size_type i(s.find_last_not_of(t));
+      11             : 
+      12           0 :         if (i == std::string::npos)
+      13           0 :                 return "";
+      14             :         else
+      15           0 :                 return std::string(s, 0, i);
+      16             : }
+      17             : 
+      18           0 : std::string trim_left(const std::string &s, const std::string &t) {
+      19           0 :         return std::string(s, s.find_first_not_of(t));
+      20             : }
+      21             : 
+      22           0 : std::string trim(const std::string &s, const std::string &t) {
+      23             :         std::string::size_type a = s.find_first_not_of(t);
+      24             :         std::string::size_type b = s.find_last_not_of(t);
+      25             : 
+      26           0 :         if (a == std::string::npos || b == std::string::npos)
+      27           0 :                 return "";
+      28             : 
+      29           0 :         return std::string(s, a, b - a + 1);
+      30             : }
+      31             : 
+      32           0 : void explode(const std::string &s, std::vector<std::string> &v,
+      33             :                 const bool trim_spaces, const std::string &t) {
+      34             :         std::string::size_type a, b;
+      35             : 
+      36             :         a = s.find_first_not_of(t), b = s.find_first_of(t, a);
+      37             : 
+      38           0 :         while (a != std::string::npos) {
+      39           0 :                 if (trim_spaces)
+      40           0 :                         v.push_back(trim(s.substr(a, b - a)));
+      41             :                 else
+      42           0 :                         v.push_back(s.substr(a, b - a));
+      43             : 
+      44             :                 a = s.find_first_not_of(t, b), b = s.find_first_of(t, a);
+      45             :         }
+      46           0 : }
+      47             : 
+      48           0 : std::string implode(const std::vector<std::string> &v, const std::string &t) {
+      49             :         unsigned int i;
+      50             :         std::string s;
+      51             : 
+      52           0 :         for (i = 0; i < (v.size() - 1); i++) {
+      53             :                 s.append(v[i]);
+      54             :                 s.append(t);
+      55             :         }
+      56             : 
+      57           0 :         return s + v[i];
+      58             : }
+      59             : 
+      60           3 : bool ends_with(const std::string &s, const std::string &w) {
+      61           3 :         if (s.size() < w.size())
+      62             :                 return false;
+      63             :         std::string::const_reverse_iterator si = s.rbegin();
+      64             :         std::string::const_reverse_iterator wi = w.rbegin();
+      65           3 :         while (wi != w.rend()) {
+      66           3 :                 if (*wi != *si)
+      67             :                         return false;
+      68             :                 wi++;
+      69             :                 si++;
+      70             :         }
+      71             : 
+      72             :         return true;
+      73             : }
+      74             : 
+      75           0 : bool starts_with(const std::string &s, const std::string &w) {
+      76           0 :         if (s.size() < w.size())
+      77             :                 return false;
+      78             :         std::string::const_iterator si = s.begin();
+      79             :         std::string::const_iterator wi = w.begin();
+      80           0 :         while (wi != w.end()) {
+      81           0 :                 if (*wi != *si)
+      82             :                         return false;
+      83             :                 wi++;
+      84             :                 si++;
+      85             :         }
+      86             :         return true;
+      87             : }
+      88             : 
+      89             : } // namespace kiss
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/ruby.png b/doc/coverageReport/ruby.png new file mode 100644 index 0000000000000000000000000000000000000000..991b6d4ec9e78be165e3ef757eed1aada287364d GIT binary patch literal 141 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga>?NMQuI!iC1^FceV#7`HfI^%F z9+AZi4BSE>%y{W;-5;PJOS+@4BLl<6e(pbstUx|nfKQ0)e^Y%R^MdiLxj>4`)5S5Q b;#P73kj=!v_*DHKNFRfztDnm{r-UW|iOwIS literal 0 HcmV?d00001 diff --git a/doc/coverageReport/snow.png b/doc/coverageReport/snow.png new file mode 100644 index 0000000000000000000000000000000000000000..2cdae107fceec6e7f02ac7acb4a34a82a540caa5 GIT binary patch literal 141 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga>?NMQuI!iC1^MM!lvI6;R0X`wF|Ns97GD8ntt^-nBo-U3d c6}OTTfNUlP#;5A{K>8RwUHx3vIVCg!071?oo&W#< literal 0 HcmV?d00001 diff --git a/doc/coverageReport/src/Candidate.cpp.func-sort-c.html b/doc/coverageReport/src/Candidate.cpp.func-sort-c.html new file mode 100644 index 000000000..b34d8b8c1 --- /dev/null +++ b/doc/coverageReport/src/Candidate.cpp.func-sort-c.html @@ -0,0 +1,212 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Candidate.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Candidate.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:12914787.8 %
Date:2024-04-08 14:58:22Functions:333594.3 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa9Candidate16clearSecondariesEv0
_ZNK7crpropa9Candidate14getDescriptionB5cxx11Ev0
_ZN7crpropa9Candidate19setNextSerialNumberEm1
_ZN7crpropa9Candidate7restartEv1
_ZN7crpropa9Candidate12addSecondaryEiddNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE2
_ZN7crpropa9Candidate12addSecondaryEPS0_4
_ZN7crpropa9Candidate12updateWeightEd5
_ZN7crpropa9Candidate14removePropertyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE5
_ZN7crpropa9Candidate19getNextSerialNumberEv6
_ZN7crpropa9Candidate15setSerialNumberEm11
_ZNK7crpropa9Candidate11getPropertyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE11
_ZN7crpropa9CandidateC2ERKNS_13ParticleStateE20
_ZNK7crpropa9Candidate11hasPropertyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE30
_ZNK7crpropa9Candidate5cloneEb30
_ZNK7crpropa9Candidate22getCreatedSerialNumberEv48
_ZNK7crpropa9Candidate21getSourceSerialNumberEv49
_ZNK7crpropa9Candidate12getTagOriginB5cxx11Ev61
_ZNK7crpropa9Candidate15getSerialNumberEv84
_ZNK7crpropa9Candidate9getWeightEv1064
_ZN7crpropa9Candidate11setPropertyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_7VariantE1143
_ZN7crpropa9Candidate9setActiveEb1742
_ZNK7crpropa9Candidate8isActiveEv21336
_ZNK7crpropa9Candidate14getCurrentStepEv63001
_ZNK7crpropa9Candidate11getNextStepEv499385
_ZN7crpropa9Candidate11setNextStepEd499400
_ZN7crpropa9Candidate14setCurrentStepEd501076
_ZNK7crpropa9Candidate11getRedshiftEv529541
_ZN7crpropa9Candidate13limitNextStepEd530052
_ZNK7crpropa9Candidate19getTrajectoryLengthEv1011718
_ZN7crpropa9Candidate12addSecondaryEidNS_7Vector3IdEEdNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE3324908
_ZN7crpropa9Candidate12setTagOriginENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE3324912
_ZN7crpropa9Candidate19setTrajectoryLengthEd3324939
_ZN7crpropa9Candidate9setWeightEd3325923
_ZN7crpropa9Candidate11setRedshiftEd3332752
_ZN7crpropa9CandidateC2EidNS_7Vector3IdEES2_ddNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE3368851
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Candidate.cpp.func.html b/doc/coverageReport/src/Candidate.cpp.func.html new file mode 100644 index 000000000..4a0c5e726 --- /dev/null +++ b/doc/coverageReport/src/Candidate.cpp.func.html @@ -0,0 +1,212 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Candidate.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Candidate.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:12914787.8 %
Date:2024-04-08 14:58:22Functions:333594.3 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa9Candidate11setNextStepEd499400
_ZN7crpropa9Candidate11setPropertyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_7VariantE1143
_ZN7crpropa9Candidate11setRedshiftEd3332752
_ZN7crpropa9Candidate12addSecondaryEPS0_4
_ZN7crpropa9Candidate12addSecondaryEidNS_7Vector3IdEEdNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE3324908
_ZN7crpropa9Candidate12addSecondaryEiddNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE2
_ZN7crpropa9Candidate12setTagOriginENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE3324912
_ZN7crpropa9Candidate12updateWeightEd5
_ZN7crpropa9Candidate13limitNextStepEd530052
_ZN7crpropa9Candidate14removePropertyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE5
_ZN7crpropa9Candidate14setCurrentStepEd501076
_ZN7crpropa9Candidate15setSerialNumberEm11
_ZN7crpropa9Candidate16clearSecondariesEv0
_ZN7crpropa9Candidate19getNextSerialNumberEv6
_ZN7crpropa9Candidate19setNextSerialNumberEm1
_ZN7crpropa9Candidate19setTrajectoryLengthEd3324939
_ZN7crpropa9Candidate7restartEv1
_ZN7crpropa9Candidate9setActiveEb1742
_ZN7crpropa9Candidate9setWeightEd3325923
_ZN7crpropa9CandidateC2ERKNS_13ParticleStateE20
_ZN7crpropa9CandidateC2EidNS_7Vector3IdEES2_ddNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE3368851
_ZNK7crpropa9Candidate11getNextStepEv499385
_ZNK7crpropa9Candidate11getPropertyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE11
_ZNK7crpropa9Candidate11getRedshiftEv529541
_ZNK7crpropa9Candidate11hasPropertyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE30
_ZNK7crpropa9Candidate12getTagOriginB5cxx11Ev61
_ZNK7crpropa9Candidate14getCurrentStepEv63001
_ZNK7crpropa9Candidate14getDescriptionB5cxx11Ev0
_ZNK7crpropa9Candidate15getSerialNumberEv84
_ZNK7crpropa9Candidate19getTrajectoryLengthEv1011718
_ZNK7crpropa9Candidate21getSourceSerialNumberEv49
_ZNK7crpropa9Candidate22getCreatedSerialNumberEv48
_ZNK7crpropa9Candidate5cloneEb30
_ZNK7crpropa9Candidate8isActiveEv21336
_ZNK7crpropa9Candidate9getWeightEv1064
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Candidate.cpp.gcov.html b/doc/coverageReport/src/Candidate.cpp.gcov.html new file mode 100644 index 000000000..07a4b2a2a --- /dev/null +++ b/doc/coverageReport/src/Candidate.cpp.gcov.html @@ -0,0 +1,331 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Candidate.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Candidate.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:12914787.8 %
Date:2024-04-08 14:58:22Functions:333594.3 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/Candidate.h"
+       2             : #include "crpropa/ParticleID.h"
+       3             : #include "crpropa/Units.h"
+       4             : 
+       5             : #include <stdexcept>
+       6             : 
+       7             : namespace crpropa {
+       8             : 
+       9     3368851 : Candidate::Candidate(int id, double E, Vector3d pos, Vector3d dir, double z, double weight, std::string tagOrigin) :
+      10     3368851 :   redshift(z), trajectoryLength(0), weight(weight), currentStep(0), nextStep(0), active(true), parent(0), tagOrigin(tagOrigin) {
+      11     3368851 :         ParticleState state(id, E, pos, dir);
+      12             :         source = state;
+      13             :         created = state;
+      14             :         previous = state;
+      15             :         current = state;
+      16             : 
+      17             : #if defined(OPENMP_3_1)
+      18             :                 #pragma omp atomic capture
+      19             :                 {serialNumber = nextSerialNumber++;}
+      20             : #elif defined(__GNUC__)
+      21     3368851 :                 {serialNumber = __sync_add_and_fetch(&nextSerialNumber, 1);}
+      22             : #else
+      23             :                 #pragma omp critical
+      24             :                 {serialNumber = nextSerialNumber++;}
+      25             : #endif
+      26             : 
+      27     3368851 : }
+      28             : 
+      29          20 : Candidate::Candidate(const ParticleState &state) :
+      30          20 :                 source(state), created(state), current(state), previous(state), redshift(0), trajectoryLength(0), currentStep(0), nextStep(0), active(true), parent(0), tagOrigin ("PRIM") {
+      31             : 
+      32             : #if defined(OPENMP_3_1)
+      33             :                 #pragma omp atomic capture
+      34             :                 {serialNumber = nextSerialNumber++;}
+      35             : #elif defined(__GNUC__)
+      36          20 :                 {serialNumber = __sync_add_and_fetch(&nextSerialNumber, 1);}
+      37             : #else
+      38             :                 #pragma omp critical
+      39             :                 {serialNumber = nextSerialNumber++;}
+      40             : #endif
+      41             : 
+      42          20 : }
+      43             : 
+      44       21336 : bool Candidate::isActive() const {
+      45       21336 :         return active;
+      46             : }
+      47             : 
+      48        1742 : void Candidate::setActive(bool b) {
+      49        1742 :         active = b;
+      50        1742 : }
+      51             : 
+      52      529541 : double Candidate::getRedshift() const {
+      53      529541 :         return redshift;
+      54             : }
+      55             : 
+      56     1011718 : double Candidate::getTrajectoryLength() const {
+      57     1011718 :         return trajectoryLength;
+      58             : }
+      59             : 
+      60        1064 : double Candidate::getWeight() const {
+      61        1064 :         return weight;
+      62             : }
+      63             : 
+      64       63001 : double Candidate::getCurrentStep() const {
+      65       63001 :         return currentStep;
+      66             : }
+      67             : 
+      68      499385 : double Candidate::getNextStep() const {
+      69      499385 :         return nextStep;
+      70             : }
+      71             : 
+      72     3332752 : void Candidate::setRedshift(double z) {
+      73     3332752 :         redshift = z;
+      74     3332752 : }
+      75             : 
+      76     3324939 : void Candidate::setTrajectoryLength(double a) {
+      77     3324939 :         trajectoryLength = a;
+      78     3324939 : }
+      79             : 
+      80     3325923 : void Candidate::setWeight(double w) {
+      81     3325923 :         weight = w;
+      82     3325923 : }
+      83             : 
+      84           5 : void Candidate::updateWeight(double w) {
+      85           5 :   weight *= w;
+      86           5 : }
+      87             : 
+      88      501076 : void Candidate::setCurrentStep(double lstep) {
+      89      501076 :         currentStep = lstep;
+      90      501076 :         trajectoryLength += lstep;
+      91      501076 : }
+      92             : 
+      93      499400 : void Candidate::setNextStep(double step) {
+      94      499400 :         nextStep = step;
+      95      499400 : }
+      96             : 
+      97      530052 : void Candidate::limitNextStep(double step) {
+      98      530052 :         nextStep = std::min(nextStep, step);
+      99      530052 : }
+     100             : 
+     101        1143 : void Candidate::setProperty(const std::string &name, const Variant &value) {
+     102        1143 :         properties[name] = value;
+     103        1143 : }
+     104             : 
+     105     3324912 : void Candidate::setTagOrigin (std::string tagOrigin) {
+     106     3324912 :         this->tagOrigin = tagOrigin;
+     107     3324912 : }
+     108             : 
+     109          61 : std::string Candidate::getTagOrigin () const {
+     110          61 :         return tagOrigin;
+     111             : }
+     112             : 
+     113          11 : const Variant &Candidate::getProperty(const std::string &name) const {
+     114          11 :         PropertyMap::const_iterator i = properties.find(name);
+     115          11 :         if (i == properties.end())
+     116           0 :                 throw std::runtime_error("Unknown candidate property: " + name);
+     117          11 :         return i->second;
+     118             : }
+     119             : 
+     120           5 : bool Candidate::removeProperty(const std::string& name) {
+     121           5 :         PropertyMap::iterator i = properties.find(name);
+     122           5 :         if (i == properties.end())
+     123             :                 return false;
+     124             :         properties.erase(i);
+     125             :         return true;
+     126             : }
+     127             : 
+     128          30 : bool Candidate::hasProperty(const std::string &name) const {
+     129          30 :         PropertyMap::const_iterator i = properties.find(name);
+     130          30 :         if (i == properties.end())
+     131          10 :                 return false;
+     132             :         return true;
+     133             : }
+     134             : 
+     135           4 : void Candidate::addSecondary(Candidate *c) {
+     136           4 :         secondaries.push_back(c);
+     137           4 : }
+     138             : 
+     139           2 : void Candidate::addSecondary(int id, double energy, double w, std::string tagOrigin) {
+     140           4 :         ref_ptr<Candidate> secondary = new Candidate;
+     141           2 :         secondary->setRedshift(redshift);
+     142           2 :         secondary->setTrajectoryLength(trajectoryLength);
+     143           2 :         secondary->setWeight(weight * w);
+     144           4 :         secondary->setTagOrigin(tagOrigin);
+     145           2 :         for (PropertyMap::const_iterator it = properties.begin(); it != properties.end(); ++it) {
+     146           0 :                 secondary->setProperty(it->first, it->second);         
+     147             :         }
+     148             :         secondary->source = source;
+     149             :         secondary->previous = previous;
+     150             :         secondary->created = previous;
+     151           2 :         secondary->current = current;
+     152           2 :         secondary->current.setId(id);
+     153           2 :         secondary->current.setEnergy(energy);
+     154           2 :         secondary->parent = this;
+     155           2 :         secondaries.push_back(secondary);
+     156           2 : }
+     157             : 
+     158     3324908 : void Candidate::addSecondary(int id, double energy, Vector3d position, double w, std::string tagOrigin) {
+     159     6649816 :         ref_ptr<Candidate> secondary = new Candidate;
+     160     3324908 :         secondary->setRedshift(redshift);
+     161     3324908 :         secondary->setTrajectoryLength(trajectoryLength - (current.getPosition() - position).getR());
+     162     3324908 :         secondary->setWeight(weight * w);
+     163     6649816 :         secondary->setTagOrigin(tagOrigin);
+     164     3324908 :         for (PropertyMap::const_iterator it = properties.begin(); it != properties.end(); ++it) {
+     165           0 :                 secondary->setProperty(it->first, it->second);         
+     166             :         }
+     167             :         secondary->source = source;
+     168             :         secondary->previous = previous;
+     169     3324908 :         secondary->created = previous;
+     170     3324908 :         secondary->current = current;
+     171     3324908 :         secondary->current.setId(id);
+     172     3324908 :         secondary->current.setEnergy(energy);
+     173     3324908 :         secondary->current.setPosition(position);
+     174     3324908 :         secondary->created.setPosition(position);
+     175     3324908 :         secondary->parent = this;
+     176     3324908 :         secondaries.push_back(secondary);
+     177     3324908 : }
+     178             : 
+     179           0 : void Candidate::clearSecondaries() {
+     180           0 :         secondaries.clear();
+     181           0 : }
+     182             : 
+     183           0 : std::string Candidate::getDescription() const {
+     184           0 :         std::stringstream ss;
+     185           0 :         ss << "CosmicRay at z = " << getRedshift() << "\n";
+     186           0 :         ss << "  source:  " << source.getDescription() << "\n";
+     187           0 :         ss << "  current: " << current.getDescription();
+     188           0 :         return ss.str();
+     189           0 : }
+     190             : 
+     191          30 : ref_ptr<Candidate> Candidate::clone(bool recursive) const {
+     192          60 :         ref_ptr<Candidate> cloned = new Candidate;
+     193             :         cloned->source = source;
+     194             :         cloned->created = created;
+     195             :         cloned->current = current;
+     196             :         cloned->previous = previous;
+     197             : 
+     198          30 :         cloned->properties = properties;
+     199          30 :         cloned->active = active;
+     200          30 :         cloned->redshift = redshift;
+     201          30 :         cloned->weight = weight;
+     202          30 :         cloned->trajectoryLength = trajectoryLength;
+     203          30 :         cloned->currentStep = currentStep;
+     204          30 :         cloned->nextStep = nextStep;
+     205          30 :         if (recursive) {
+     206           0 :                 cloned->secondaries.reserve(secondaries.size());
+     207           0 :                 for (size_t i = 0; i < secondaries.size(); i++) {
+     208           0 :                         ref_ptr<Candidate> s = secondaries[i]->clone(recursive);
+     209           0 :                         s->parent = cloned;
+     210           0 :                         cloned->secondaries.push_back(s);
+     211             :                 }
+     212             :         }
+     213          30 :         return cloned;
+     214             : }
+     215             : 
+     216          84 : uint64_t Candidate::getSerialNumber() const {
+     217          84 :         return serialNumber;
+     218             : }
+     219             : 
+     220          11 : void Candidate::setSerialNumber(const uint64_t snr) {
+     221          11 :         serialNumber = snr;
+     222          11 : }
+     223             : 
+     224          49 : uint64_t Candidate::getSourceSerialNumber() const {
+     225          84 :         if (parent)
+     226             :                 return parent->getSourceSerialNumber();
+     227             :         else
+     228          49 :                 return serialNumber;
+     229             : }
+     230             : 
+     231          48 : uint64_t Candidate::getCreatedSerialNumber() const {
+     232          48 :         if (parent)
+     233          35 :                 return parent->getSerialNumber();
+     234             :         else
+     235          13 :                 return serialNumber;
+     236             : }
+     237             : 
+     238           1 : void Candidate::setNextSerialNumber(uint64_t snr) {
+     239           1 :         nextSerialNumber = snr;
+     240           1 : }
+     241             : 
+     242           6 : uint64_t Candidate::getNextSerialNumber() {
+     243           6 :         return nextSerialNumber;
+     244             : }
+     245             : 
+     246             : uint64_t Candidate::nextSerialNumber = 0;
+     247             : 
+     248           1 : void Candidate::restart() {
+     249           1 :         setActive(true);
+     250           1 :         setTrajectoryLength(0);
+     251             :         previous = source;
+     252             :         current = source;
+     253           1 : }
+     254             : 
+     255             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Clock.cpp.func-sort-c.html b/doc/coverageReport/src/Clock.cpp.func-sort-c.html new file mode 100644 index 000000000..3a192f2e6 --- /dev/null +++ b/doc/coverageReport/src/Clock.cpp.func-sort-c.html @@ -0,0 +1,104 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Clock.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Clock.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0270.0 %
Date:2024-04-08 14:58:22Functions:080.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa5Clock11getInstanceEv0
_ZN7crpropa5Clock14getMillisecondEv0
_ZN7crpropa5Clock4Impl7getTimeEv0
_ZN7crpropa5Clock5resetEv0
_ZN7crpropa5Clock9getSecondEv0
_ZN7crpropa5ClockC2Ev0
_ZN7crpropa5ClockD0Ev0
_ZN7crpropa5ClockD2Ev0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Clock.cpp.func.html b/doc/coverageReport/src/Clock.cpp.func.html new file mode 100644 index 000000000..5e2c004bd --- /dev/null +++ b/doc/coverageReport/src/Clock.cpp.func.html @@ -0,0 +1,104 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Clock.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Clock.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0270.0 %
Date:2024-04-08 14:58:22Functions:080.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa5Clock11getInstanceEv0
_ZN7crpropa5Clock14getMillisecondEv0
_ZN7crpropa5Clock4Impl7getTimeEv0
_ZN7crpropa5Clock5resetEv0
_ZN7crpropa5Clock9getSecondEv0
_ZN7crpropa5ClockC2Ev0
_ZN7crpropa5ClockD0Ev0
_ZN7crpropa5ClockD2Ev0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Clock.cpp.gcov.html b/doc/coverageReport/src/Clock.cpp.gcov.html new file mode 100644 index 000000000..1175dfb35 --- /dev/null +++ b/doc/coverageReport/src/Clock.cpp.gcov.html @@ -0,0 +1,231 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Clock.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Clock.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0270.0 %
Date:2024-04-08 14:58:22Functions:080.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/Clock.h"
+       2             : 
+       3             : #if defined(WIN32) || defined(_WIN32)
+       4             : 
+       5             : #define USE_WINDOWS_TIMERS
+       6             : #define WIN32_LEAN_AND_MEAN
+       7             : #define NOWINRES
+       8             : #define NOMCX
+       9             : #define NOIME
+      10             : #ifdef _XBOX
+      11             : #include <Xtl.h>
+      12             : #else
+      13             : #include <windows.h>
+      14             : #endif
+      15             : #include <ctime>
+      16             : 
+      17             : #else
+      18             : #include <sys/time.h>
+      19             : #endif
+      20             : 
+      21             : #include <algorithm>
+      22             : #ifdef _OPENMP
+      23             : #include <omp.h>
+      24             : #include <stdexcept>
+      25             : #endif
+      26             : 
+      27             : namespace crpropa {
+      28             : 
+      29             : #ifdef WIN32
+      30             : class Clock::Impl {
+      31             :         LARGE_INTEGER clockFrequency;
+      32             :         DWORD startTick;
+      33             :         LONGLONG prevElapsedTime;
+      34             :         LARGE_INTEGER startTime;
+      35             : public:
+      36             :         Impl() {
+      37             :                 QueryPerformanceFrequency(&clockFrequency);
+      38             :                 reset();
+      39             :         }
+      40             : 
+      41             :         void reset() {
+      42             :                 QueryPerformanceCounter(&startTime);
+      43             :                 startTick = GetTickCount();
+      44             :                 prevElapsedTime = 0;
+      45             :         }
+      46             : 
+      47             :         /// Returns the time in ms since the last call to reset or since
+      48             :         /// the btClock was created.
+      49             :         double getSecond() {
+      50             :                 LARGE_INTEGER currentTime;
+      51             :                 QueryPerformanceCounter(&currentTime);
+      52             :                 LONGLONG elapsedTime = currentTime.QuadPart - startTime.QuadPart;
+      53             : 
+      54             :                 // Compute the number of millisecond ticks elapsed.
+      55             :                 unsigned long msecTicks = (unsigned long) (1000 * elapsedTime
+      56             :                                 / clockFrequency.QuadPart);
+      57             : 
+      58             :                 // Check for unexpected leaps in the Win32 performance counter.
+      59             :                 // (This is caused by unexpected data across the PCI to ISA
+      60             :                 // bridge, aka south bridge.  See Microsoft KB274323.)
+      61             :                 unsigned long elapsedTicks = GetTickCount() - startTick;
+      62             :                 signed long msecOff = (signed long) (msecTicks - elapsedTicks);
+      63             :                 if (msecOff < -100 || msecOff > 100) {
+      64             :                         // Adjust the starting time forwards.
+      65             :                         LONGLONG msecAdjustment = std::min(
+      66             :                                         msecOff * clockFrequency.QuadPart / 1000,
+      67             :                                         elapsedTime - prevElapsedTime);
+      68             :                         startTime.QuadPart += msecAdjustment;
+      69             :                         elapsedTime -= msecAdjustment;
+      70             :                 }
+      71             : 
+      72             :                 // Store the current elapsed time for adjustments next time.
+      73             :                 prevElapsedTime = elapsedTime;
+      74             : 
+      75             :                 // Convert to microseconds.
+      76             :                 unsigned long usecTicks = (unsigned long) (1000000 * elapsedTime
+      77             :                                 / clockFrequency.QuadPart);
+      78             : 
+      79             :                 return double(usecTicks) / 1000000;
+      80             :         }
+      81             : };
+      82             : #else
+      83             : 
+      84             : class Clock::Impl {
+      85             :         struct timeval startTime;
+      86             : public:
+      87           0 :         Impl() {
+      88             :                 reset();
+      89             :         }
+      90             : 
+      91             :         void reset() {
+      92           0 :                 gettimeofday(&startTime, 0);
+      93             :         }
+      94             : 
+      95             :         /// Returns the time in since the last call to reset or since
+      96             :         /// the btClock was created.
+      97           0 :         double getTime() {
+      98             :                 struct timeval currentTime;
+      99           0 :                 gettimeofday(&currentTime, 0);
+     100           0 :                 double t = double(currentTime.tv_sec - startTime.tv_sec);
+     101           0 :                 t += double(currentTime.tv_usec - startTime.tv_usec) / 1000000.;
+     102           0 :                 return t;
+     103             :         }
+     104             : };
+     105             : #endif
+     106             : 
+     107           0 : Clock::Clock() {
+     108           0 :         impl = new Impl;
+     109           0 : }
+     110             : 
+     111           0 : Clock::~Clock() {
+     112           0 :         delete impl;
+     113           0 : }
+     114             : 
+     115           0 : void Clock::reset() {
+     116           0 :         impl->reset();
+     117           0 : }
+     118             : 
+     119           0 : double Clock::getSecond() {
+     120           0 :         return impl->getTime();
+     121             : }
+     122             : 
+     123           0 : double Clock::getMillisecond() {
+     124           0 :         return impl->getTime() * 1000;
+     125             : }
+     126             : 
+     127             : #ifdef _OPENMP
+     128             : 
+     129             : // see http://stackoverflow.com/questions/8051108/using-the-openmp-threadprivate-directive-on-static-instances-of-c-stl-types
+     130             : const static int MAX_THREAD = 256;
+     131             : 
+     132           0 : struct CLOCK_TLS_ITEM {
+     133             :         Clock r;
+     134             :         char padding[(sizeof(Clock) / 64 + 1) * 64 - sizeof(Clock)];
+     135             : };
+     136             : 
+     137           0 : Clock &Clock::getInstance() {
+     138             : #ifdef _MSC_VER
+     139             :         __declspec(align(64)) static CLOCK_TLS_ITEM tls[MAX_THREAD];
+     140             : #else
+     141           0 :         __attribute__ ((aligned(64))) static CLOCK_TLS_ITEM tls[MAX_THREAD];
+     142             : #endif
+     143           0 :         int i = omp_get_thread_num();
+     144           0 :         if (i >= MAX_THREAD)
+     145           0 :         throw std::runtime_error("crpropa::Clock: more than MAX_THREAD threads!");
+     146           0 :         return tls[i].r;
+     147             : }
+     148             : #else
+     149             : Clock &Clock::getInstance() {
+     150             :         static Clock r;
+     151             :         return r;
+     152             : }
+     153             : #endif
+     154             : 
+     155             : } /* namespace scs */
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Common.cpp.func-sort-c.html b/doc/coverageReport/src/Common.cpp.func-sort-c.html new file mode 100644 index 000000000..8b8e54c80 --- /dev/null +++ b/doc/coverageReport/src/Common.cpp.func-sort-c.html @@ -0,0 +1,96 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Common.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Common.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:486277.4 %
Date:2024-04-08 14:58:22Functions:5683.3 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16getInstallPrefixB5cxx11Ev0
_ZN7crpropa11getDataPathENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE547
_ZN7crpropa12closestIndexEdRKSt6vectorIdSaIdEE565
_ZN7crpropa22interpolateEquidistantEdddRKSt6vectorIdSaIdEE1528
_ZN7crpropa11interpolateEdRKSt6vectorIdSaIdEES4_158374
_ZN7crpropa13interpolate2dEddRKSt6vectorIdSaIdEES4_S4_9536930
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Common.cpp.func.html b/doc/coverageReport/src/Common.cpp.func.html new file mode 100644 index 000000000..b7cf2d004 --- /dev/null +++ b/doc/coverageReport/src/Common.cpp.func.html @@ -0,0 +1,96 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Common.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Common.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:486277.4 %
Date:2024-04-08 14:58:22Functions:5683.3 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11getDataPathENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE547
_ZN7crpropa11interpolateEdRKSt6vectorIdSaIdEES4_158374
_ZN7crpropa12closestIndexEdRKSt6vectorIdSaIdEE565
_ZN7crpropa13interpolate2dEddRKSt6vectorIdSaIdEES4_S4_9536930
_ZN7crpropa16getInstallPrefixB5cxx11Ev0
_ZN7crpropa22interpolateEquidistantEdddRKSt6vectorIdSaIdEE1528
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Common.cpp.gcov.html b/doc/coverageReport/src/Common.cpp.gcov.html new file mode 100644 index 000000000..485f15540 --- /dev/null +++ b/doc/coverageReport/src/Common.cpp.gcov.html @@ -0,0 +1,212 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Common.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Common.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:486277.4 %
Date:2024-04-08 14:58:22Functions:5683.3 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/Common.h"
+       2             : 
+       3             : #include "kiss/path.h"
+       4             : #include "kiss/logger.h"
+       5             : 
+       6             : #include <cstdlib>
+       7             : #include <fstream>
+       8             : #include <string>
+       9             : #include <cmath>
+      10             : #include <algorithm>
+      11             : 
+      12             : #define index(i,j) ((j)+(i)*Y.size())
+      13             : 
+      14             : namespace crpropa {
+      15             : 
+      16         547 : std::string getDataPath(std::string filename) {
+      17         547 :         static std::string dataPath;
+      18         547 :         if (dataPath.size())
+      19         534 :                 return concat_path(dataPath, filename);
+      20             : 
+      21          13 :         const char *env_path = getenv("CRPROPA_DATA_PATH");
+      22          13 :         if (env_path) {
+      23           0 :                 if (is_directory(env_path)) {
+      24             :                         dataPath = env_path;
+      25           0 :                         KISS_LOG_INFO << "getDataPath: use environment variable, "
+      26           0 :                                         << dataPath << std::endl;
+      27           0 :                         return concat_path(dataPath, filename);
+      28             :                 }
+      29             :         }
+      30             : 
+      31             : #ifdef CRPROPA_INSTALL_PREFIX
+      32             :         {
+      33          13 :                 std::string _path = CRPROPA_INSTALL_PREFIX "/share/crpropa";
+      34          13 :                 if (is_directory(_path)) {
+      35             :                         dataPath = _path;
+      36           0 :                         KISS_LOG_INFO
+      37           0 :                         << "getDataPath: use install prefix, " << dataPath << std::endl;
+      38           0 :                         return concat_path(dataPath, filename);
+      39             :                 }
+      40             :         }
+      41             : #endif
+      42             : 
+      43             :         {
+      44          13 :                 std::string _path = executable_path() + "../data";
+      45          13 :                 if (is_directory(_path)) {
+      46             :                         dataPath = _path;
+      47           0 :                         KISS_LOG_INFO << "getDataPath: use executable path, " << dataPath
+      48           0 :                                         << std::endl;
+      49           0 :                         return concat_path(dataPath, filename);
+      50             :                 }
+      51             :         }
+      52             : 
+      53             :         dataPath = "data";
+      54          13 :         KISS_LOG_INFO << "getDataPath: use default, " << dataPath << std::endl;
+      55          13 :         return concat_path(dataPath, filename);
+      56             : }
+      57             : 
+      58             : 
+      59           0 : std::string getInstallPrefix()
+      60             : {
+      61           0 :   std::string _path = "";
+      62             :   #ifdef CRPROPA_INSTALL_PREFIX
+      63             :     _path += CRPROPA_INSTALL_PREFIX;
+      64             :   #endif
+      65           0 :   return _path;
+      66             : };
+      67             : 
+      68      158374 : double interpolate(double x, const std::vector<double> &X,
+      69             :                 const std::vector<double> &Y) {
+      70             :         std::vector<double>::const_iterator it = std::upper_bound(X.begin(),
+      71             :                         X.end(), x);
+      72      158374 :         if (it == X.begin())
+      73           1 :                 return Y.front();
+      74      158373 :         if (it == X.end())
+      75           1 :                 return Y.back();
+      76             : 
+      77             :         size_t i = it - X.begin() - 1;
+      78      158372 :         return Y[i] + (x - X[i]) * (Y[i + 1] - Y[i]) / (X[i + 1] - X[i]);
+      79             : }
+      80             : 
+      81     9536930 : double interpolate2d(double x, double y, const std::vector<double> &X,
+      82             :                 const std::vector<double> &Y, const std::vector<double> &Z) {
+      83             : 
+      84             :         std::vector<double>::const_iterator itx = std::upper_bound(X.begin(), X.end(), x);
+      85             :         std::vector<double>::const_iterator ity = std::upper_bound(Y.begin(), Y.end(), y);
+      86             : 
+      87     9536930 :         if (x > X.back() || x < X.front())
+      88             :                 return 0;
+      89     9536930 :         if (y > Y.back() || y < Y.front())
+      90             :                 return 0;
+      91             : 
+      92     9536930 :         if (itx == X.begin() && ity == Y.begin())
+      93           0 :                 return Z.front();
+      94     9536930 :         if (itx == X.end() && ity == Y.end())
+      95          73 :                 return Z.back();
+      96             : 
+      97     9536857 :         size_t i = itx - X.begin() - 1;
+      98     9536857 :         size_t j = ity - Y.begin() - 1;
+      99             : 
+     100     9536857 :         double Q11 = Z[index(i,j)];
+     101     9536857 :         double Q12 = Z[index(i,j+1)];
+     102     9536857 :         double Q21 = Z[index(i+1,j)];
+     103     9536857 :         double Q22 = Z[index(i+1,j+1)];
+     104             : 
+     105     9536857 :         double R1 = ((X[i+1]-x)/(X[i+1]-X[i]))*Q11+((x-X[i])/(X[i+1]-X[i]))*Q21;
+     106     9536857 :         double R2 = ((X[i+1]-x)/(X[i+1]-X[i]))*Q12+((x-X[i])/(X[i+1]-X[i]))*Q22;
+     107             : 
+     108     9536857 :         return ((Y[j+1]-y)/(Y[j+1]-Y[j]))*R1+((y-Y[j])/(Y[j+1]-Y[j]))*R2;
+     109             : }
+     110             : 
+     111        1528 : double interpolateEquidistant(double x, double lo, double hi,
+     112             :                 const std::vector<double> &Y) {
+     113        1528 :         if (x <= lo)
+     114           1 :                 return Y.front();
+     115        1527 :         if (x >= hi)
+     116           1 :                 return Y.back();
+     117             : 
+     118        1526 :         double dx = (hi - lo) / (Y.size() - 1);
+     119        1526 :         double p = (x - lo) / dx;
+     120        1526 :         size_t i = floor(p);
+     121        1526 :         return Y[i] + (p - i) * (Y[i + 1] - Y[i]);
+     122             : }
+     123             : 
+     124         565 : size_t closestIndex(double x, const std::vector<double> &X) {
+     125         565 :         size_t i1 = std::lower_bound(X.begin(), X.end(), x) - X.begin();
+     126         565 :         if (i1 == 0)
+     127             :                 return i1;
+     128         565 :         size_t i0 = i1 - 1;
+     129         565 :         if (std::fabs(X[i0] - x) < std::fabs(X[i1] - x))
+     130             :                 return i0;
+     131             :         else
+     132         308 :                 return i1;
+     133             : }
+     134             : 
+     135             : } // namespace crpropa
+     136             : 
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Cosmology.cpp.func-sort-c.html b/doc/coverageReport/src/Cosmology.cpp.func-sort-c.html new file mode 100644 index 000000000..5faf01e27 --- /dev/null +++ b/doc/coverageReport/src/Cosmology.cpp.func-sort-c.html @@ -0,0 +1,132 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Cosmology.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Cosmology.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:449247.8 %
Date:2024-04-08 14:58:22Functions:61540.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa22setCosmologyParametersEdd0
_ZN7crpropa25redshift2ComovingDistanceEd0
_ZN7crpropa27luminosityDistance2RedshiftEd0
_ZN7crpropa27redshift2LuminosityDistanceEd0
_ZN7crpropa28lightTravelDistance2RedshiftEd0
_ZN7crpropa28redshift2LightTravelDistanceEd0
_ZN7crpropa2H0Ev0
_ZN7crpropa6omegaLEv0
_ZN7crpropa6omegaMEv0
_ZN7crpropa25comovingDistance2RedshiftEd1
_ZN7crpropa28lightTravel2ComovingDistanceEd1
_ZN7crpropa28comoving2LightTravelDistanceEd2
_ZN7crpropa9Cosmology6updateEv19
_ZN7crpropa9CosmologyC2Ev19
_ZN7crpropa10hubbleRateEd7623
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Cosmology.cpp.func.html b/doc/coverageReport/src/Cosmology.cpp.func.html new file mode 100644 index 000000000..ea101710d --- /dev/null +++ b/doc/coverageReport/src/Cosmology.cpp.func.html @@ -0,0 +1,132 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Cosmology.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Cosmology.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:449247.8 %
Date:2024-04-08 14:58:22Functions:61540.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa10hubbleRateEd7623
_ZN7crpropa22setCosmologyParametersEdd0
_ZN7crpropa25comovingDistance2RedshiftEd1
_ZN7crpropa25redshift2ComovingDistanceEd0
_ZN7crpropa27luminosityDistance2RedshiftEd0
_ZN7crpropa27redshift2LuminosityDistanceEd0
_ZN7crpropa28comoving2LightTravelDistanceEd2
_ZN7crpropa28lightTravel2ComovingDistanceEd1
_ZN7crpropa28lightTravelDistance2RedshiftEd0
_ZN7crpropa28redshift2LightTravelDistanceEd0
_ZN7crpropa2H0Ev0
_ZN7crpropa6omegaLEv0
_ZN7crpropa6omegaMEv0
_ZN7crpropa9Cosmology6updateEv19
_ZN7crpropa9CosmologyC2Ev19
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Cosmology.cpp.gcov.html b/doc/coverageReport/src/Cosmology.cpp.gcov.html new file mode 100644 index 000000000..f85d7609e --- /dev/null +++ b/doc/coverageReport/src/Cosmology.cpp.gcov.html @@ -0,0 +1,245 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Cosmology.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Cosmology.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:449247.8 %
Date:2024-04-08 14:58:22Functions:61540.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/Cosmology.h"
+       2             : #include "crpropa/Units.h"
+       3             : #include "crpropa/Common.h"
+       4             : 
+       5             : #include <vector>
+       6             : #include <cmath>
+       7             : #include <stdexcept>
+       8             : 
+       9             : namespace crpropa {
+      10             : 
+      11             : /**
+      12             :  @class Cosmology
+      13             :  @brief Cosmology calculations
+      14             :  */
+      15             : struct Cosmology {
+      16             :         double H0; // Hubble parameter at z=0
+      17             :         double omegaM; // matter density parameter
+      18             :         double omegaL; // vacuum energy parameter
+      19             : 
+      20             :         static const int n;
+      21             :         static const double zmin;
+      22             :         static const double zmax;
+      23             : 
+      24             :         std::vector<double> Z;  // redshift
+      25             :         std::vector<double> Dc; // comoving distance [m]
+      26             :         std::vector<double> Dl; // luminosity distance [m]
+      27             :         std::vector<double> Dt; // light travel distance [m]
+      28             : 
+      29          19 :         void update() {
+      30          19 :                 double dH = c_light / H0; // Hubble distance
+      31             : 
+      32          19 :                 std::vector<double> E(n);
+      33          19 :                 E[0] = 1;
+      34             : 
+      35             :                 // Relation between comoving distance r and redshift z (cf. J.A. Peacock, Cosmological physics, p. 89 eq. 3.76)
+      36             :                 // dr = c / H(z) dz, integration using midpoint rule
+      37             :                 double dlz = log10(zmax) - log10(zmin);
+      38       19000 :                 for (int i = 1; i < n; i++) {
+      39       18981 :                         Z[i] = zmin * pow(10, i * dlz / (n - 1)); // logarithmic even spacing
+      40       18981 :                         double dz = (Z[i] - Z[i - 1]); // redshift step
+      41       18981 :                         E[i] = sqrt(omegaL + omegaM * pow_integer<3>(1 + Z[i]));
+      42       18981 :                         Dc[i] = Dc[i - 1] + dH * dz * (1 / E[i] + 1 / E[i - 1]) / 2;
+      43       18981 :                         Dl[i] = (1 + Z[i]) * Dc[i];
+      44       18981 :                         Dt[i] = Dt[i - 1]
+      45       18981 :                                         + dH * dz
+      46       18981 :                                                         * (1 / ((1 + Z[i]) * E[i])
+      47       18981 :                                                                         + 1 / ((1 + Z[i - 1]) * E[i - 1])) / 2;
+      48             :                 }
+      49          19 :         }
+      50             : 
+      51          19 :         Cosmology() {
+      52             :         // Cosmological parameters (K.A. Olive et al. (Particle Data Group), Chin. Phys. C, 38, 090001 (2014))
+      53          19 :                 H0 = 67.3 * 1000 * meter / second / Mpc; // default values
+      54          19 :                 omegaM = 0.315;
+      55          19 :                 omegaL = 1 - omegaM;
+      56             : 
+      57          19 :                 Z.resize(n);
+      58          19 :                 Dc.resize(n);
+      59          19 :                 Dl.resize(n);
+      60          19 :                 Dt.resize(n);
+      61             : 
+      62          19 :                 Z[0] = 0;
+      63          19 :                 Dc[0] = 0;
+      64          19 :                 Dl[0] = 0;
+      65          19 :                 Dt[0] = 0;
+      66             : 
+      67          19 :                 update();
+      68          19 :         }
+      69             : 
+      70             :         void setParameters(double h, double oM) {
+      71           0 :                 H0 = h * 1e5 / Mpc;
+      72           0 :                 omegaM = oM;
+      73           0 :                 omegaL = 1 - oM;
+      74           0 :                 update();
+      75             :         }
+      76             : };
+      77             : 
+      78             : const int Cosmology::n = 1000;
+      79             : const double Cosmology::zmin = 0.0001;
+      80             : const double Cosmology::zmax = 100;
+      81             : 
+      82             : static Cosmology cosmology; // instance is created at runtime
+      83             : 
+      84           0 : void setCosmologyParameters(double h, double oM) {
+      85             :         cosmology.setParameters(h, oM);
+      86           0 : }
+      87             : 
+      88        7623 : double hubbleRate(double z) {
+      89        7623 :         return cosmology.H0
+      90        7623 :                         * sqrt(cosmology.omegaL + cosmology.omegaM * pow(1 + z, 3));
+      91             : }
+      92             : 
+      93           0 : double omegaL() {
+      94           0 :         return cosmology.omegaL;
+      95             : }
+      96             : 
+      97           0 : double omegaM() {
+      98           0 :         return cosmology.omegaM;
+      99             : }
+     100             : 
+     101           0 : double H0() {
+     102           0 :         return cosmology.H0;
+     103             : }
+     104             : 
+     105           1 : double comovingDistance2Redshift(double d) {
+     106           1 :         if (d < 0)
+     107           0 :                 throw std::runtime_error("Cosmology: d < 0");
+     108           1 :         if (d > cosmology.Dc.back())
+     109           0 :                 throw std::runtime_error("Cosmology: d > dmax");
+     110           1 :         return interpolate(d, cosmology.Dc, cosmology.Z);
+     111             : }
+     112             : 
+     113           0 : double redshift2ComovingDistance(double z) {
+     114           0 :         if (z < 0)
+     115           0 :                 throw std::runtime_error("Cosmology: z < 0");
+     116           0 :         if (z > cosmology.zmax)
+     117           0 :                 throw std::runtime_error("Cosmology: z > zmax");
+     118           0 :         return interpolate(z, cosmology.Z, cosmology.Dc);
+     119             : }
+     120             : 
+     121           0 : double luminosityDistance2Redshift(double d) {
+     122           0 :         if (d < 0)
+     123           0 :                 throw std::runtime_error("Cosmology: d < 0");
+     124           0 :         if (d > cosmology.Dl.back())
+     125           0 :                 throw std::runtime_error("Cosmology: d > dmax");
+     126           0 :         return interpolate(d, cosmology.Dl, cosmology.Z);
+     127             : }
+     128             : 
+     129           0 : double redshift2LuminosityDistance(double z) {
+     130           0 :         if (z < 0)
+     131           0 :                 throw std::runtime_error("Cosmology: z < 0");
+     132           0 :         if (z > cosmology.zmax)
+     133           0 :                 throw std::runtime_error("Cosmology: z > zmax");
+     134           0 :         return interpolate(z, cosmology.Z, cosmology.Dl);
+     135             : }
+     136             : 
+     137           0 : double lightTravelDistance2Redshift(double d) {
+     138           0 :         if (d < 0)
+     139           0 :                 throw std::runtime_error("Cosmology: d < 0");
+     140           0 :         if (d > cosmology.Dt.back())
+     141           0 :                 throw std::runtime_error("Cosmology: d > dmax");
+     142           0 :         return interpolate(d, cosmology.Dt, cosmology.Z);
+     143             : }
+     144             : 
+     145           0 : double redshift2LightTravelDistance(double z) {
+     146           0 :         if (z < 0)
+     147           0 :                 throw std::runtime_error("Cosmology: z < 0");
+     148           0 :         if (z > cosmology.zmax)
+     149           0 :                 throw std::runtime_error("Cosmology: z > zmax");
+     150           0 :         return interpolate(z, cosmology.Z, cosmology.Dt);
+     151             : }
+     152             : 
+     153           2 : double comoving2LightTravelDistance(double d) {
+     154           2 :         if (d < 0)
+     155           0 :                 throw std::runtime_error("Cosmology: d < 0");
+     156           2 :         if (d > cosmology.Dc.back())
+     157           0 :                 throw std::runtime_error("Cosmology: d > dmax");
+     158           2 :         return interpolate(d, cosmology.Dc, cosmology.Dt);
+     159             : }
+     160             : 
+     161           1 : double lightTravel2ComovingDistance(double d) {
+     162           1 :         if (d < 0)
+     163           0 :                 throw std::runtime_error("Cosmology: d < 0");
+     164           1 :         if (d > cosmology.Dt.back())
+     165           0 :                 throw std::runtime_error("Cosmology: d > dmax");
+     166           1 :         return interpolate(d, cosmology.Dt, cosmology.Dc);
+     167             : }
+     168             : 
+     169             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/EmissionMap.cpp.func-sort-c.html b/doc/coverageReport/src/EmissionMap.cpp.func-sort-c.html new file mode 100644 index 000000000..08e7db8aa --- /dev/null +++ b/doc/coverageReport/src/EmissionMap.cpp.func-sort-c.html @@ -0,0 +1,204 @@ + + + + + + + LCOV - coverage.info.cleaned - src/EmissionMap.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - EmissionMap.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8315653.2 %
Date:2024-04-08 14:58:22Functions:183354.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11EmissionMap4loadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa11EmissionMap4saveERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa11EmissionMap5mergeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa11EmissionMap6hasMapEid0
_ZN7crpropa11EmissionMap7fillMapERKNS_13ParticleStateEd0
_ZN7crpropa11EmissionMapC2Emmm0
_ZN7crpropa24CylindricalProjectionMap7getNPhiEv0
_ZN7crpropa24CylindricalProjectionMap9getNThetaEv0
_ZN7crpropa24CylindricalProjectionMapC2Ev0
_ZNK7crpropa11EmissionMap13drawDirectionERKNS_13ParticleStateERNS_7Vector3IdEE0
_ZNK7crpropa11EmissionMap14checkDirectionERKNS_13ParticleStateE0
_ZNK7crpropa11EmissionMap14checkDirectionEidRKNS_7Vector3IdEE0
_ZNK7crpropa24CylindricalProjectionMap14checkDirectionERKNS_7Vector3IdEE0
_ZNK7crpropa24CylindricalProjectionMap6getCdfEv0
_ZNK7crpropa24CylindricalProjectionMap6getPdfEv0
_ZN7crpropa11EmissionMap5mergeEPKS0_1
_ZN7crpropa11EmissionMap7getMapsEv1
_ZN7crpropa11EmissionMapC2Emmmdd1
_ZNK7crpropa11EmissionMap13energyFromBinEm1
_ZNK7crpropa24CylindricalProjectionMap13drawDirectionEv1
_ZNK7crpropa24CylindricalProjectionMap9updateCdfEv1
_ZN7crpropa11EmissionMapC2Ev2
_ZNK7crpropa11EmissionMap7getMapsEv2
_ZNK7crpropa24CylindricalProjectionMap16directionFromBinEm2
_ZNK7crpropa11EmissionMap13drawDirectionEidRNS_7Vector3IdEE3
_ZN7crpropa11EmissionMap7fillMapEidRKNS_7Vector3IdEEd4
_ZN7crpropa24CylindricalProjectionMap7fillBinERKNS_7Vector3IdEEd4
_ZN7crpropa24CylindricalProjectionMap6getPdfEv5
_ZN7crpropa24CylindricalProjectionMapC2Emm6
_ZNK7crpropa24CylindricalProjectionMap16binFromDirectionERKNS_7Vector3IdEE6
_ZN7crpropa11EmissionMap6getMapEid7
_ZNK7crpropa11EmissionMap13binFromEnergyEd11
_ZN7crpropa24CylindricalProjectionMap7fillBinEmd129604
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/EmissionMap.cpp.func.html b/doc/coverageReport/src/EmissionMap.cpp.func.html new file mode 100644 index 000000000..ca8986910 --- /dev/null +++ b/doc/coverageReport/src/EmissionMap.cpp.func.html @@ -0,0 +1,204 @@ + + + + + + + LCOV - coverage.info.cleaned - src/EmissionMap.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - EmissionMap.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8315653.2 %
Date:2024-04-08 14:58:22Functions:183354.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11EmissionMap4loadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa11EmissionMap4saveERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa11EmissionMap5mergeEPKS0_1
_ZN7crpropa11EmissionMap5mergeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa11EmissionMap6getMapEid7
_ZN7crpropa11EmissionMap6hasMapEid0
_ZN7crpropa11EmissionMap7fillMapERKNS_13ParticleStateEd0
_ZN7crpropa11EmissionMap7fillMapEidRKNS_7Vector3IdEEd4
_ZN7crpropa11EmissionMap7getMapsEv1
_ZN7crpropa11EmissionMapC2Emmm0
_ZN7crpropa11EmissionMapC2Emmmdd1
_ZN7crpropa11EmissionMapC2Ev2
_ZN7crpropa24CylindricalProjectionMap6getPdfEv5
_ZN7crpropa24CylindricalProjectionMap7fillBinERKNS_7Vector3IdEEd4
_ZN7crpropa24CylindricalProjectionMap7fillBinEmd129604
_ZN7crpropa24CylindricalProjectionMap7getNPhiEv0
_ZN7crpropa24CylindricalProjectionMap9getNThetaEv0
_ZN7crpropa24CylindricalProjectionMapC2Emm6
_ZN7crpropa24CylindricalProjectionMapC2Ev0
_ZNK7crpropa11EmissionMap13binFromEnergyEd11
_ZNK7crpropa11EmissionMap13drawDirectionERKNS_13ParticleStateERNS_7Vector3IdEE0
_ZNK7crpropa11EmissionMap13drawDirectionEidRNS_7Vector3IdEE3
_ZNK7crpropa11EmissionMap13energyFromBinEm1
_ZNK7crpropa11EmissionMap14checkDirectionERKNS_13ParticleStateE0
_ZNK7crpropa11EmissionMap14checkDirectionEidRKNS_7Vector3IdEE0
_ZNK7crpropa11EmissionMap7getMapsEv2
_ZNK7crpropa24CylindricalProjectionMap13drawDirectionEv1
_ZNK7crpropa24CylindricalProjectionMap14checkDirectionERKNS_7Vector3IdEE0
_ZNK7crpropa24CylindricalProjectionMap16binFromDirectionERKNS_7Vector3IdEE6
_ZNK7crpropa24CylindricalProjectionMap16directionFromBinEm2
_ZNK7crpropa24CylindricalProjectionMap6getCdfEv0
_ZNK7crpropa24CylindricalProjectionMap6getPdfEv0
_ZNK7crpropa24CylindricalProjectionMap9updateCdfEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/EmissionMap.cpp.gcov.html b/doc/coverageReport/src/EmissionMap.cpp.gcov.html new file mode 100644 index 000000000..59cbfc778 --- /dev/null +++ b/doc/coverageReport/src/EmissionMap.cpp.gcov.html @@ -0,0 +1,370 @@ + + + + + + + LCOV - coverage.info.cleaned - src/EmissionMap.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - EmissionMap.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8315653.2 %
Date:2024-04-08 14:58:22Functions:183354.5 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/EmissionMap.h"
+       2             : #include "crpropa/Random.h"
+       3             : #include "crpropa/Units.h"
+       4             : 
+       5             : #include "kiss/logger.h"
+       6             : 
+       7             : #include <fstream>
+       8             : 
+       9             : namespace crpropa {
+      10             : 
+      11           0 : CylindricalProjectionMap::CylindricalProjectionMap() : nPhi(360), nTheta(180), dirty(false), pdf(nPhi* nTheta, 0), cdf(nPhi* nTheta, 0) {
+      12           0 :         sPhi = 2. * M_PI / nPhi;
+      13           0 :         sTheta = 2. / nTheta;
+      14           0 : }
+      15             : 
+      16           6 : CylindricalProjectionMap::CylindricalProjectionMap(size_t nPhi, size_t nTheta) : nPhi(nPhi), nTheta(nTheta), dirty(false), pdf(nPhi* nTheta, 0), cdf(nPhi* nTheta, 0) {
+      17           6 :         sPhi = 2 * M_PI / nPhi;
+      18           6 :         sTheta = 2. / nTheta;
+      19           6 : }
+      20             : 
+      21           4 : void CylindricalProjectionMap::fillBin(const Vector3d& direction, double weight) {
+      22           4 :         size_t bin = binFromDirection(direction);
+      23           4 :         fillBin(bin, weight);
+      24           4 : }
+      25             : 
+      26      129604 : void CylindricalProjectionMap::fillBin(size_t bin, double weight) {
+      27      129604 :         pdf[bin] += weight;
+      28      129604 :         dirty = true;
+      29      129604 : }
+      30             : 
+      31           1 : Vector3d CylindricalProjectionMap::drawDirection() const {
+      32           1 :         if (dirty)
+      33           1 :                 updateCdf();
+      34             : 
+      35           1 :         size_t bin = Random::instance().randBin(cdf);
+      36             : 
+      37           1 :         return directionFromBin(bin);
+      38             : }
+      39             : 
+      40           0 : bool CylindricalProjectionMap::checkDirection(const Vector3d &direction) const {
+      41           0 :         size_t bin = binFromDirection(direction);
+      42           0 :         return pdf[bin];
+      43             : }
+      44             : 
+      45             : 
+      46           0 : const std::vector<double>& CylindricalProjectionMap::getPdf() const {
+      47           0 :         return pdf;
+      48             : }
+      49             : 
+      50           5 : std::vector<double>& CylindricalProjectionMap::getPdf() {
+      51           5 :         return pdf;
+      52             : }
+      53             : 
+      54           0 : const std::vector<double>& CylindricalProjectionMap::getCdf() const {
+      55           0 :         return cdf;
+      56             : }
+      57             : 
+      58           0 : size_t CylindricalProjectionMap::getNPhi() {
+      59           0 :         return nPhi;
+      60             : }
+      61             : 
+      62           0 : size_t CylindricalProjectionMap::getNTheta() {
+      63           0 :         return nTheta;
+      64             : }
+      65             : 
+      66             : /*
+      67             :  * Cylindrical Coordinates
+      68             :  * iPhi -> [0, 2*pi]
+      69             :  * iTheta -> [0, 2]
+      70             :  *
+      71             :  * Spherical Coordinates
+      72             :  * phi -> [-pi, pi]
+      73             :  * theta -> [0, pi]
+      74             :  */
+      75           6 : size_t CylindricalProjectionMap::binFromDirection(const Vector3d& direction) const {
+      76             :         // convert to cylindrical
+      77           6 :         double phi = direction.getPhi() + M_PI;
+      78           6 :         double theta = sin(M_PI_2 - direction.getTheta()) + 1;
+      79             : 
+      80             :         // to indices
+      81           6 :         size_t iPhi = phi / sPhi;
+      82           6 :         size_t iTheta = theta / sTheta;
+      83             : 
+      84             :         // interleave
+      85           6 :         size_t bin =  iTheta * nPhi + iPhi;
+      86           6 :         return bin;
+      87             : }
+      88             : 
+      89           2 : Vector3d CylindricalProjectionMap::directionFromBin(size_t bin) const {
+      90             :         // deinterleave
+      91           2 :         double iPhi = bin % nPhi;
+      92           2 :         double iTheta = bin / nPhi;
+      93             : 
+      94             :         // any where in the bin
+      95           2 :         iPhi += Random::instance().rand();
+      96           2 :         iTheta += Random::instance().rand();
+      97             : 
+      98             :         // cylindrical Coordinates
+      99           2 :         double phi = iPhi * sPhi;
+     100           2 :         double theta = iTheta * sTheta;
+     101             : 
+     102             :         // sphericala Coordinates
+     103           2 :         phi = phi - M_PI;
+     104           2 :         theta = M_PI_2 - asin(theta - 1);
+     105             : 
+     106             :         Vector3d v;
+     107           2 :         v.setRThetaPhi(1.0, theta, phi);
+     108           2 :         return v;
+     109             : }
+     110             : 
+     111           1 : void CylindricalProjectionMap::updateCdf() const {
+     112           1 :         if (dirty) {
+     113           1 :                 cdf[0] = pdf[0];
+     114       64800 :                 for (size_t i = 1; i < pdf.size(); i++) {
+     115       64799 :                         cdf[i] = cdf[i-1] + pdf[i];
+     116             :                 }
+     117           1 :                 dirty = false;
+     118             :         }
+     119           1 : }
+     120             : 
+     121           2 : EmissionMap::EmissionMap() : minEnergy(0.0001 * EeV), maxEnergy(10000 * EeV),
+     122           2 :         nEnergy(8*2), nPhi(360), nTheta(180) {
+     123           2 :         logStep = log10(maxEnergy / minEnergy) / nEnergy;
+     124           2 : }
+     125             : 
+     126           0 : EmissionMap::EmissionMap(size_t nPhi, size_t nTheta, size_t nEnergy) : minEnergy(0.0001 * EeV), maxEnergy(10000 * EeV),
+     127           0 :         nEnergy(nEnergy), nPhi(nPhi), nTheta(nTheta) {
+     128           0 :         logStep = log10(maxEnergy / minEnergy) / nEnergy;
+     129           0 : }
+     130             : 
+     131           1 : EmissionMap::EmissionMap(size_t nPhi, size_t nTheta, size_t nEnergy, double minEnergy, double maxEnergy) : minEnergy(minEnergy), maxEnergy(maxEnergy), nEnergy(nEnergy), nPhi(nPhi), nTheta(nTheta) {
+     132           1 :         logStep = log10(maxEnergy / minEnergy) / nEnergy;
+     133           1 : }
+     134             : 
+     135           1 : double EmissionMap::energyFromBin(size_t bin) const {
+     136           1 :         return pow(10, log10(minEnergy) + logStep * bin);
+     137             : }
+     138             : 
+     139          11 : size_t EmissionMap::binFromEnergy(double energy) const {
+     140          11 :         return log10(energy / minEnergy) / logStep;
+     141             : }
+     142             : 
+     143           4 : void EmissionMap::fillMap(int pid, double energy, const Vector3d& direction, double weight) {
+     144           4 :         getMap(pid, energy)->fillBin(direction, weight);
+     145           4 : }
+     146             : 
+     147           0 : void EmissionMap::fillMap(const ParticleState& state, double weight) {
+     148           0 :         fillMap(state.getId(), state.getEnergy(), state.getDirection(), weight);
+     149           0 : }
+     150             : 
+     151           1 : EmissionMap::map_t &EmissionMap::getMaps() {
+     152           1 :         return maps;
+     153             : }
+     154             : 
+     155           2 : const EmissionMap::map_t &EmissionMap::getMaps() const {
+     156           2 :         return maps;
+     157             : }
+     158             : 
+     159           3 : bool EmissionMap::drawDirection(int pid, double energy, Vector3d& direction) const {
+     160           3 :         key_t key(pid, binFromEnergy(energy));
+     161             :         map_t::const_iterator i = maps.find(key);
+     162             : 
+     163           3 :         if (i == maps.end() || !i->second.valid()) {
+     164             :                 return false;
+     165             :         } else {
+     166           1 :                 direction = i->second->drawDirection();
+     167           1 :                 return true;
+     168             :         }
+     169             : }
+     170             : 
+     171           0 : bool EmissionMap::drawDirection(const ParticleState& state, Vector3d& direction) const {
+     172           0 :         return drawDirection(state.getId(), state.getEnergy(), direction);
+     173             : }
+     174             : 
+     175           0 : bool EmissionMap::checkDirection(int pid, double energy, const Vector3d& direction) const {
+     176           0 :         key_t key(pid, binFromEnergy(energy));
+     177             :         map_t::const_iterator i = maps.find(key);
+     178             : 
+     179           0 :         if (i == maps.end() || !i->second.valid()) {
+     180             :                 return false;
+     181             :         } else {
+     182           0 :                 return i->second->checkDirection(direction);
+     183             :         }
+     184             : }
+     185             : 
+     186           0 : bool EmissionMap::checkDirection(const ParticleState& state) const {
+     187           0 :         return checkDirection(state.getId(), state.getEnergy(), state.getDirection());
+     188             : }
+     189             : 
+     190           0 : bool EmissionMap::hasMap(int pid, double energy) {
+     191           0 :     key_t key(pid, binFromEnergy(energy));
+     192             :     map_t::iterator i = maps.find(key);
+     193           0 :     if (i == maps.end() || !i->second.valid())
+     194             :                 return false;
+     195             :         else
+     196           0 :                 return true;
+     197             : }
+     198             : 
+     199           7 : ref_ptr<CylindricalProjectionMap> EmissionMap::getMap(int pid, double energy) {
+     200           7 :         key_t key(pid, binFromEnergy(energy));
+     201             :         map_t::iterator i = maps.find(key);
+     202           7 :         if (i == maps.end() || !i->second.valid()) {
+     203           5 :                 ref_ptr<CylindricalProjectionMap> cpm = new CylindricalProjectionMap(nPhi, nTheta);
+     204           5 :                 maps[key] = cpm;
+     205             :                 return cpm;
+     206             :         } else {
+     207             :                 return i->second;
+     208             :         }
+     209             : }
+     210             : 
+     211           0 : void EmissionMap::save(const std::string &filename) {
+     212           0 :         std::ofstream out(filename.c_str());
+     213           0 :         out.imbue(std::locale("C"));
+     214             : 
+     215           0 :         for (map_t::iterator i = maps.begin(); i != maps.end(); i++) {
+     216           0 :                 if (!i->second.valid())
+     217           0 :                         continue;
+     218           0 :                 out << i->first.first << " " << i->first.second << " " << energyFromBin(i->first.second) << " ";
+     219           0 :                 out << i->second->getNPhi() << " " << i->second->getNTheta();
+     220           0 :                 const std::vector<double> &pdf = i->second->getPdf();
+     221           0 :                 for (size_t i = 0; i < pdf.size(); i++)
+     222           0 :                         out << " " << pdf[i];
+     223             :                 out << std::endl;
+     224             :         }
+     225           0 : }
+     226             : 
+     227           1 : void EmissionMap::merge(const EmissionMap *other) {
+     228           1 :         if (other == 0)
+     229             :                 return;
+     230           1 :         map_t::const_iterator i = other->getMaps().begin();
+     231           1 :         map_t::const_iterator end = other->getMaps().end();
+     232           3 :         for(;i != end; i++) {
+     233           2 :                 if (!i->second.valid())
+     234           0 :                         continue;
+     235             : 
+     236           2 :                 std::vector<double> &otherpdf = i->second->getPdf();
+     237           2 :                 ref_ptr<CylindricalProjectionMap> cpm = getMap(i->first.first, i->first.second);
+     238             : 
+     239           2 :                 if (otherpdf.size() != cpm->getPdf().size()) {
+     240           0 :                         throw std::runtime_error("PDF size mismatch!");
+     241             :                         break;
+     242             :                 }
+     243             : 
+     244      129602 :                 for (size_t k = 0; k < otherpdf.size(); k++) {
+     245      129600 :                         cpm->fillBin(k, otherpdf[k]);
+     246             :                 }
+     247             :         }
+     248             : }
+     249             : 
+     250           0 : void EmissionMap::merge(const std::string &filename) {
+     251           0 :         EmissionMap em;
+     252           0 :         em.load(filename);
+     253           0 :         merge(&em);
+     254           0 : }
+     255             : 
+     256           0 : void EmissionMap::load(const std::string &filename) {
+     257           0 :         std::ifstream in(filename.c_str());
+     258           0 :         in.imbue(std::locale("C"));
+     259             : 
+     260           0 :         while(in.good()) {
+     261           0 :                 key_t key;
+     262             :                 double tmp;
+     263             :                 size_t nPhi_, nTheta_;
+     264           0 :                 in >> key.first >> key.second >> tmp;
+     265             :                 in >> nPhi_ >> nTheta_;
+     266             : 
+     267           0 :                 if (!in.good()) {
+     268           0 :                         KISS_LOG_ERROR << "Invalid line: " << key.first << " " << key.second << " " << nPhi_ << " " << nTheta_;
+     269           0 :                         break;
+     270             :                 }
+     271             : 
+     272           0 :                 if (nPhi != nPhi_) {
+     273           0 :                         KISS_LOG_WARNING << "nPhi mismatch: " << nPhi << " " << nPhi_;
+     274             :                 }
+     275           0 :                 if (nTheta != nTheta_) {
+     276           0 :                         KISS_LOG_WARNING << "nTheta mismatch: " << nTheta << " " << nTheta_;
+     277             :                 }
+     278             : 
+     279           0 :                 ref_ptr<CylindricalProjectionMap> cpm = new CylindricalProjectionMap(nPhi_, nTheta_);
+     280           0 :                 std::vector<double> &pdf = cpm->getPdf();
+     281           0 :                 for (size_t i = 0; i < pdf.size(); i++)
+     282             :                         in >> pdf[i];
+     283             : 
+     284           0 :                 if (in.good()) {
+     285           0 :                         maps[key] = cpm;
+     286             :                         // std::cout << "added " << key.first << " " << key.second << std::endl;
+     287             :                 } else {
+     288           0 :                         KISS_LOG_WARNING << "Invalid data in line: " << key.first << " " << key.second << " " << nPhi_ << " " << nTheta_ << "\n";
+     289             :                 }
+     290             :         }
+     291             : 
+     292           0 : }
+     293             : 
+     294             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Geometry.cpp.func-sort-c.html b/doc/coverageReport/src/Geometry.cpp.func-sort-c.html new file mode 100644 index 000000000..14ddef6d4 --- /dev/null +++ b/doc/coverageReport/src/Geometry.cpp.func-sort-c.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Geometry.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Geometry.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:185036.0 %
Date:2024-04-08 14:58:22Functions:61346.2 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa5PlaneC2ERKNS_7Vector3IdEES4_S4_0
_ZNK7crpropa11ParaxialBox14getDescriptionB5cxx11Ev0
_ZNK7crpropa11ParaxialBox6normalERKNS_7Vector3IdEE0
_ZNK7crpropa5Plane14getDescriptionB5cxx11Ev0
_ZNK7crpropa5Plane6normalERKNS_7Vector3IdEE0
_ZNK7crpropa6Sphere14getDescriptionB5cxx11Ev0
_ZNK7crpropa6Sphere6normalERKNS_7Vector3IdEE0
_ZN7crpropa11ParaxialBoxC2ERKNS_7Vector3IdEES4_1
_ZN7crpropa5PlaneC2ERKNS_7Vector3IdEES4_1
_ZNK7crpropa5Plane8distanceERKNS_7Vector3IdEE2
_ZN7crpropa6SphereC2ERKNS_7Vector3IdEEd4
_ZNK7crpropa11ParaxialBox8distanceERKNS_7Vector3IdEE6
_ZNK7crpropa6Sphere8distanceERKNS_7Vector3IdEE12
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Geometry.cpp.func.html b/doc/coverageReport/src/Geometry.cpp.func.html new file mode 100644 index 000000000..ced667ab2 --- /dev/null +++ b/doc/coverageReport/src/Geometry.cpp.func.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Geometry.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Geometry.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:185036.0 %
Date:2024-04-08 14:58:22Functions:61346.2 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11ParaxialBoxC2ERKNS_7Vector3IdEES4_1
_ZN7crpropa5PlaneC2ERKNS_7Vector3IdEES4_1
_ZN7crpropa5PlaneC2ERKNS_7Vector3IdEES4_S4_0
_ZN7crpropa6SphereC2ERKNS_7Vector3IdEEd4
_ZNK7crpropa11ParaxialBox14getDescriptionB5cxx11Ev0
_ZNK7crpropa11ParaxialBox6normalERKNS_7Vector3IdEE0
_ZNK7crpropa11ParaxialBox8distanceERKNS_7Vector3IdEE6
_ZNK7crpropa5Plane14getDescriptionB5cxx11Ev0
_ZNK7crpropa5Plane6normalERKNS_7Vector3IdEE0
_ZNK7crpropa5Plane8distanceERKNS_7Vector3IdEE2
_ZNK7crpropa6Sphere14getDescriptionB5cxx11Ev0
_ZNK7crpropa6Sphere6normalERKNS_7Vector3IdEE0
_ZNK7crpropa6Sphere8distanceERKNS_7Vector3IdEE12
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Geometry.cpp.gcov.html b/doc/coverageReport/src/Geometry.cpp.gcov.html new file mode 100644 index 000000000..23f52e359 --- /dev/null +++ b/doc/coverageReport/src/Geometry.cpp.gcov.html @@ -0,0 +1,200 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Geometry.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Geometry.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:185036.0 %
Date:2024-04-08 14:58:22Functions:61346.2 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include <limits>
+       2             : #include <cmath>
+       3             : #include "kiss/logger.h"
+       4             : #include "crpropa/Geometry.h"
+       5             : 
+       6             : #include <iostream>
+       7             : 
+       8             : namespace crpropa {
+       9             : 
+      10             : // Plane ------------------------------------------------------------------
+      11           1 : Plane::Plane(const Vector3d& _x0, const Vector3d& _n) : x0(_x0), n(_n) {
+      12           1 : };
+      13             : 
+      14           0 : Plane::Plane(const Vector3d& _x0, const Vector3d& v1,const Vector3d& v2) : x0(_x0), n(0,0,0) {
+      15             :         n = v1.cross(v2);
+      16             :         n /= n.getR();
+      17           0 : };
+      18             : 
+      19           2 : double Plane::distance(const Vector3d &x) const {
+      20             :         Vector3d dX = x - x0;
+      21           2 :         return n.dot(dX);
+      22             : };
+      23             : 
+      24           0 : std::string Plane::getDescription() const {
+      25           0 :         std::stringstream ss;
+      26             :         ss << "Plane: " << std::endl
+      27           0 :            << "   x0: " << x0 << std::endl
+      28           0 :            << "    n: " << n << std::endl;
+      29           0 :         return ss.str();
+      30           0 : };
+      31             : 
+      32           0 : Vector3d Plane::normal(const Vector3d& point) const {
+      33           0 :         return n;
+      34             : }
+      35             : 
+      36             : 
+      37             : // Sphere ------------------------------------------------------------------
+      38           4 : Sphere::Sphere(const Vector3d& _center, double _radius) : center(_center), radius(_radius) {
+      39           4 : };
+      40             : 
+      41          12 : double Sphere::distance(const Vector3d &point) const {
+      42             :         Vector3d dR = point - center;
+      43          12 :         return dR.getR() - radius;
+      44             : }
+      45             : 
+      46           0 : Vector3d Sphere::normal(const Vector3d& point) const {
+      47             :         Vector3d d = point - center;
+      48           0 :         return d.getUnitVector();
+      49             : }
+      50             : 
+      51           0 : std::string Sphere::getDescription() const {
+      52           0 :         std::stringstream ss;
+      53             :         ss << "Sphere: " << std::endl
+      54           0 :                         << "   Center: " << center << std::endl
+      55           0 :                         << "   Radius: " << radius << std::endl;
+      56           0 :         return ss.str();
+      57           0 : };
+      58             : 
+      59             : 
+      60             : // ParaxialBox -------------------------------------------------------------
+      61           1 : ParaxialBox::ParaxialBox(const Vector3d& _corner, const Vector3d& _size) : corner(_corner), size(_size) {
+      62           1 : };
+      63             : 
+      64           6 : double ParaxialBox::distance(const Vector3d &point) const {
+      65             :         Vector3d X = point - corner - size/2.;
+      66             : 
+      67             :         // inside the cube
+      68           6 :         if ((fabs(X.x) <= size.x/2.) and (fabs(X.y) <= size.y/2.) and (fabs(X.z) <= size.z/2.)) { 
+      69             :                 Vector3d Xp = size/2. - X.abs();
+      70           3 :                 double d = std::min(Xp.x, std::min(Xp.y, Xp.z));
+      71             : 
+      72           3 :                 return -1. * d;
+      73             :         }
+      74             : 
+      75           3 :         double a = std::max(0., fabs(X.x) - size.x/2.);
+      76           3 :         double b = std::max(0., fabs(X.y) - size.y/2.);
+      77           3 :         double c = std::max(0., fabs(X.z) - size.z/2.);
+      78             : 
+      79           3 :         return sqrt(a*a + b*b +c*c);
+      80             : }
+      81             : 
+      82           0 : Vector3d ParaxialBox::normal(const Vector3d& point) const {
+      83             :         Vector3d d = (point - corner).abs();
+      84             :         Vector3d d2 = d + size;
+      85             :         Vector3d n;
+      86             :         double dmin = std::numeric_limits<double>::infinity();
+      87           0 :         if (d.x < dmin) {
+      88             :                 dmin = d.x;
+      89             :                 n = Vector3d(-1, 0, 0);
+      90             :         }
+      91           0 :         if (d.y < dmin) {
+      92             :                 dmin = d.y;
+      93             :                 n = Vector3d(0, -1, 0);
+      94             :         }
+      95           0 :         if (d.z < dmin) {
+      96             :                 dmin = d.z;
+      97             :                 n = Vector3d(0, 0, -1);
+      98             :         }
+      99           0 :         if (d2.x < dmin) {
+     100             :                 dmin = d2.x;
+     101             :                 n = Vector3d(1, 0, 0);
+     102             :         }
+     103           0 :         if (d2.y < dmin) {
+     104             :                 dmin = d2.y;
+     105             :                 n = Vector3d(0, 1, 0);
+     106             :         }
+     107           0 :         if (d2.z < dmin) {
+     108             :                 // dmin = d2.z;
+     109             :                 n = Vector3d(0, 0, 1);
+     110             :         }
+     111             : 
+     112           0 :         return n;
+     113             : }
+     114             : 
+     115           0 : std::string ParaxialBox::getDescription() const {
+     116           0 :         std::stringstream ss;
+     117             :         ss << "ParaxialBox: " << std::endl
+     118           0 :                  << "   corner: " << corner << std::endl
+     119           0 :                  << "     size: " << size << std::endl;
+     120           0 :         return ss.str();
+     121           0 : };
+     122             : 
+     123             : 
+     124             : } // namespace
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/GridTools.cpp.func-sort-c.html b/doc/coverageReport/src/GridTools.cpp.func-sort-c.html new file mode 100644 index 000000000..14424d83d --- /dev/null +++ b/doc/coverageReport/src/GridTools.cpp.func-sort-c.html @@ -0,0 +1,148 @@ + + + + + + + LCOV - coverage.info.cleaned - src/GridTools.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - GridTools.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:6724527.3 %
Date:2024-04-08 14:58:22Functions:71936.8 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa13dumpGridToTxtENS_7ref_ptrINS_4GridIfEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd0
_ZN7crpropa15loadGridFromTxtENS_7ref_ptrINS_4GridIfEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd0
_ZN7crpropa16rmsFieldStrengthENS_7ref_ptrINS_4GridIfEEEE0
_ZN7crpropa17fromMagneticFieldENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEENS0_INS_13MagneticFieldEEE0
_ZN7crpropa17gridPowerSpectrumENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa17meanFieldStrengthENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa17meanFieldStrengthENS_7ref_ptrINS_4GridIfEEEE0
_ZN7crpropa23rmsFieldStrengthPerAxisENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa25fromMagneticFieldStrengthENS_7ref_ptrINS_4GridIfEEEENS0_INS_13MagneticFieldEEE0
_ZN7crpropa8dumpGridENS_7ref_ptrINS_4GridIfEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd0
_ZN7crpropa8loadGridENS_7ref_ptrINS_4GridIfEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd0
_ZN7crpropa9scaleGridENS_7ref_ptrINS_4GridIfEEEEd0
_ZN7crpropa13dumpGridToTxtENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd1
_ZN7crpropa15loadGridFromTxtENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd1
_ZN7crpropa15meanFieldVectorENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE1
_ZN7crpropa8dumpGridENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd1
_ZN7crpropa8loadGridENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd1
_ZN7crpropa16rmsFieldStrengthENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE11
_ZN7crpropa9scaleGridENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEd11
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/GridTools.cpp.func.html b/doc/coverageReport/src/GridTools.cpp.func.html new file mode 100644 index 000000000..0781b93b7 --- /dev/null +++ b/doc/coverageReport/src/GridTools.cpp.func.html @@ -0,0 +1,148 @@ + + + + + + + LCOV - coverage.info.cleaned - src/GridTools.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - GridTools.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:6724527.3 %
Date:2024-04-08 14:58:22Functions:71936.8 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa13dumpGridToTxtENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd1
_ZN7crpropa13dumpGridToTxtENS_7ref_ptrINS_4GridIfEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd0
_ZN7crpropa15loadGridFromTxtENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd1
_ZN7crpropa15loadGridFromTxtENS_7ref_ptrINS_4GridIfEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd0
_ZN7crpropa15meanFieldVectorENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE1
_ZN7crpropa16rmsFieldStrengthENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE11
_ZN7crpropa16rmsFieldStrengthENS_7ref_ptrINS_4GridIfEEEE0
_ZN7crpropa17fromMagneticFieldENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEENS0_INS_13MagneticFieldEEE0
_ZN7crpropa17gridPowerSpectrumENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa17meanFieldStrengthENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa17meanFieldStrengthENS_7ref_ptrINS_4GridIfEEEE0
_ZN7crpropa23rmsFieldStrengthPerAxisENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa25fromMagneticFieldStrengthENS_7ref_ptrINS_4GridIfEEEENS0_INS_13MagneticFieldEEE0
_ZN7crpropa8dumpGridENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd1
_ZN7crpropa8dumpGridENS_7ref_ptrINS_4GridIfEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd0
_ZN7crpropa8loadGridENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd1
_ZN7crpropa8loadGridENS_7ref_ptrINS_4GridIfEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd0
_ZN7crpropa9scaleGridENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEd11
_ZN7crpropa9scaleGridENS_7ref_ptrINS_4GridIfEEEEd0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/GridTools.cpp.gcov.html b/doc/coverageReport/src/GridTools.cpp.gcov.html new file mode 100644 index 000000000..20f0163b7 --- /dev/null +++ b/doc/coverageReport/src/GridTools.cpp.gcov.html @@ -0,0 +1,491 @@ + + + + + + + LCOV - coverage.info.cleaned - src/GridTools.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - GridTools.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:6724527.3 %
Date:2024-04-08 14:58:22Functions:71936.8 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/GridTools.h"
+       2             : #include "crpropa/magneticField/MagneticField.h"
+       3             : 
+       4             : #include <fstream>
+       5             : #include <sstream>
+       6             : 
+       7             : namespace crpropa {
+       8             : 
+       9           0 : void scaleGrid(ref_ptr<Grid1f> grid, double a) {
+      10           0 :         for (int ix = 0; ix < grid->getNx(); ix++)
+      11           0 :                 for (int iy = 0; iy < grid->getNy(); iy++)
+      12           0 :                         for (int iz = 0; iz < grid->getNz(); iz++)
+      13           0 :                                 grid->get(ix, iy, iz) *= a;
+      14           0 : }
+      15             : 
+      16          11 : void scaleGrid(ref_ptr<Grid3f> grid, double a) {
+      17         654 :         for (int ix = 0; ix < grid->getNx(); ix++)
+      18       41612 :                 for (int iy = 0; iy < grid->getNy(); iy++)
+      19     2662436 :                         for (int iz = 0; iz < grid->getNz(); iz++)
+      20     2621467 :                                 grid->get(ix, iy, iz) *= a;
+      21          11 : }
+      22             : 
+      23           1 : Vector3f meanFieldVector(ref_ptr<Grid3f> grid) {
+      24             :         size_t Nx = grid->getNx();
+      25             :         size_t Ny = grid->getNy();
+      26             :         size_t Nz = grid->getNz();
+      27             :         Vector3f mean(0.);
+      28          65 :         for (int ix = 0; ix < Nx; ix++)
+      29        4160 :                 for (int iy = 0; iy < Ny; iy++)
+      30      266240 :                         for (int iz = 0; iz < Nz; iz++)
+      31             :                                 mean += grid->get(ix, iy, iz);
+      32           1 :         return mean / Nx / Ny / Nz;
+      33             : }
+      34             : 
+      35           0 : double meanFieldStrength(ref_ptr<Grid3f> grid) {
+      36             :         size_t Nx = grid->getNx();
+      37             :         size_t Ny = grid->getNy();
+      38             :         size_t Nz = grid->getNz();
+      39             :         double mean = 0;
+      40           0 :         for (int ix = 0; ix < Nx; ix++)
+      41           0 :                 for (int iy = 0; iy < Ny; iy++)
+      42           0 :                         for (int iz = 0; iz < Nz; iz++)
+      43           0 :                                 mean += grid->get(ix, iy, iz).getR();
+      44           0 :         return mean / Nx / Ny / Nz;
+      45             : }
+      46             : 
+      47           0 : double meanFieldStrength(ref_ptr<Grid1f> grid) {
+      48             :         size_t Nx = grid->getNx();
+      49             :         size_t Ny = grid->getNy();
+      50             :         size_t Nz = grid->getNz();
+      51             :         double mean = 0;
+      52           0 :         for (int ix = 0; ix < Nx; ix++)
+      53           0 :                 for (int iy = 0; iy < Ny; iy++)
+      54           0 :                         for (int iz = 0; iz < Nz; iz++)
+      55           0 :                                 mean += grid->get(ix, iy, iz);
+      56           0 :         return mean / Nx / Ny / Nz;
+      57             : }
+      58             : 
+      59          11 : double rmsFieldStrength(ref_ptr<Grid3f> grid) {
+      60             :         size_t Nx = grid->getNx();
+      61             :         size_t Ny = grid->getNy();
+      62             :         size_t Nz = grid->getNz();
+      63             :         double sumV2 = 0;
+      64         715 :         for (int ix = 0; ix < Nx; ix++)
+      65       45760 :                 for (int iy = 0; iy < Ny; iy++)
+      66     2928640 :                         for (int iz = 0; iz < Nz; iz++)
+      67     2883584 :                                 sumV2 += grid->get(ix, iy, iz).getR2();
+      68          11 :         return std::sqrt(sumV2 / Nx / Ny / Nz);
+      69             : }
+      70             : 
+      71           0 : double rmsFieldStrength(ref_ptr<Grid1f> grid) {
+      72             :         size_t Nx = grid->getNx();
+      73             :         size_t Ny = grid->getNy();
+      74             :         size_t Nz = grid->getNz();
+      75             :         double sumV2 = 0;
+      76           0 :         for (int ix = 0; ix < Nx; ix++)
+      77           0 :                 for (int iy = 0; iy < Ny; iy++)
+      78           0 :                         for (int iz = 0; iz < Nz; iz++)
+      79           0 :                                 sumV2 += pow(grid->get(ix, iy, iz), 2);
+      80           0 :         return std::sqrt(sumV2 / Nx / Ny / Nz);
+      81             : }
+      82             : 
+      83           0 : std::array<float, 3> rmsFieldStrengthPerAxis(ref_ptr<Grid3f> grid) {
+      84             :     size_t Nx = grid->getNx();
+      85             :     size_t Ny = grid->getNy();
+      86             :     size_t Nz = grid->getNz();
+      87             :     float sumV2_x = 0;
+      88             :     float sumV2_y = 0;
+      89             :     float sumV2_z = 0;
+      90           0 :     for (int ix = 0; ix < Nx; ix++)
+      91           0 :         for (int iy = 0; iy < Ny; iy++)
+      92           0 :             for (int iz = 0; iz < Nz; iz++) {
+      93           0 :                 sumV2_x += pow(grid->get(ix, iy, iz).x, 2);
+      94           0 :                 sumV2_y += pow(grid->get(ix, iy, iz).y, 2);
+      95           0 :                 sumV2_z += pow(grid->get(ix, iy, iz).z, 2);
+      96             :             }
+      97             :     return {
+      98           0 :         std::sqrt(sumV2_x / Nx / Ny / Nz),
+      99           0 :         std::sqrt(sumV2_y / Nx / Ny / Nz),
+     100           0 :         std::sqrt(sumV2_z / Nx / Ny / Nz)
+     101           0 :     };
+     102             : }
+     103             : 
+     104           0 : void fromMagneticField(ref_ptr<Grid3f> grid, ref_ptr<MagneticField> field) {
+     105             :         Vector3d origin = grid->getOrigin();
+     106             :         Vector3d spacing = grid->getSpacing();
+     107             :         size_t Nx = grid->getNx();
+     108             :         size_t Ny = grid->getNy();
+     109             :         size_t Nz = grid->getNz();
+     110           0 :         for (size_t ix = 0; ix < Nx; ix++)
+     111           0 :                 for (size_t iy = 0; iy < Ny; iy++)
+     112           0 :                         for (size_t iz = 0; iz < Nz; iz++) {
+     113           0 :                                 Vector3d pos = Vector3d(double(ix) + 0.5, double(iy) + 0.5, double(iz) + 0.5) * spacing + origin;
+     114           0 :                                 Vector3d B = field->getField(pos);
+     115             :                                 grid->get(ix, iy, iz) = B;
+     116             :         }
+     117           0 : }
+     118             : 
+     119           0 : void fromMagneticFieldStrength(ref_ptr<Grid1f> grid, ref_ptr<MagneticField> field) {
+     120             :         Vector3d origin = grid->getOrigin();
+     121             :         Vector3d spacing = grid->getSpacing();
+     122             :         size_t Nx = grid->getNx();
+     123             :         size_t Ny = grid->getNy();
+     124             :         size_t Nz = grid->getNz();
+     125           0 :         for (size_t ix = 0; ix < Nx; ix++)
+     126           0 :                 for (size_t iy = 0; iy < Ny; iy++)
+     127           0 :                         for (size_t iz = 0; iz < Nz; iz++) {
+     128           0 :                                 Vector3d pos = Vector3d(double(ix) + 0.5, double(iy) + 0.5, double(iz) + 0.5) * spacing + origin;
+     129           0 :                                 double s = field->getField(pos).getR();
+     130           0 :                                 grid->get(ix, iy, iz) = s;
+     131             :         }
+     132           0 : }
+     133             : 
+     134           1 : void loadGrid(ref_ptr<Grid3f> grid, std::string filename, double c) {
+     135           1 :         std::ifstream fin(filename.c_str(), std::ios::binary);
+     136           1 :         if (!fin) {
+     137           0 :                 std::stringstream ss;
+     138           0 :                 ss << "load Grid3f: " << filename << " not found";
+     139           0 :                 throw std::runtime_error(ss.str());
+     140           0 :         }
+     141             : 
+     142             :         // get length of file and compare to size of grid
+     143           1 :         fin.seekg(0, fin.end);
+     144           1 :         size_t length = fin.tellg() / sizeof(float);
+     145           1 :         fin.seekg (0, fin.beg);
+     146             : 
+     147             :         size_t nx = grid->getNx();
+     148             :         size_t ny = grid->getNy();
+     149             :         size_t nz = grid->getNz();
+     150             : 
+     151           1 :         if (length != (3 * nx * ny * nz))
+     152           0 :                 throw std::runtime_error("loadGrid: file and grid size do not match");
+     153             : 
+     154           4 :         for (int ix = 0; ix < grid->getNx(); ix++) {
+     155          12 :                 for (int iy = 0; iy < grid->getNy(); iy++) {
+     156          36 :                         for (int iz = 0; iz < grid->getNz(); iz++) {
+     157             :                                 Vector3f &b = grid->get(ix, iy, iz);
+     158          27 :                                 fin.read((char*) &(b.x), sizeof(float));
+     159          27 :                                 fin.read((char*) &(b.y), sizeof(float));
+     160          27 :                                 fin.read((char*) &(b.z), sizeof(float));
+     161          27 :                                 b *= c;
+     162             :                         }
+     163             :                 }
+     164             :         }
+     165           1 :         fin.close();
+     166           1 : }
+     167             : 
+     168           0 : void loadGrid(ref_ptr<Grid1f> grid, std::string filename, double c) {
+     169           0 :         std::ifstream fin(filename.c_str(), std::ios::binary);
+     170           0 :         if (!fin) {
+     171           0 :                 std::stringstream ss;
+     172           0 :                 ss << "load Grid1f: " << filename << " not found";
+     173           0 :                 throw std::runtime_error(ss.str());
+     174           0 :         }
+     175             : 
+     176             :         // get length of file and compare to size of grid
+     177           0 :         fin.seekg(0, fin.end);
+     178           0 :         size_t length = fin.tellg() / sizeof(float);
+     179           0 :         fin.seekg (0, fin.beg);
+     180             : 
+     181             :         size_t nx = grid->getNx();
+     182             :         size_t ny = grid->getNy();
+     183             :         size_t nz = grid->getNz();
+     184             : 
+     185           0 :         if (length != (nx * ny * nz))
+     186           0 :                 throw std::runtime_error("loadGrid: file and grid size do not match");
+     187             : 
+     188           0 :         for (int ix = 0; ix < nx; ix++) {
+     189           0 :                 for (int iy = 0; iy < ny; iy++) {
+     190           0 :                         for (int iz = 0; iz < nz; iz++) {
+     191             :                                 float &b = grid->get(ix, iy, iz);
+     192           0 :                                 fin.read((char*) &b, sizeof(float));
+     193           0 :                                 b *= c;
+     194             :                         }
+     195             :                 }
+     196             :         }
+     197           0 :         fin.close();
+     198           0 : }
+     199             : 
+     200           1 : void dumpGrid(ref_ptr<Grid3f> grid, std::string filename, double c) {
+     201           1 :         std::ofstream fout(filename.c_str(), std::ios::binary);
+     202           1 :         if (!fout) {
+     203           0 :                 std::stringstream ss;
+     204           0 :                 ss << "dump Grid3f: " << filename << " not found";
+     205           0 :                 throw std::runtime_error(ss.str());
+     206           0 :         }
+     207           4 :         for (int ix = 0; ix < grid->getNx(); ix++) {
+     208          12 :                 for (int iy = 0; iy < grid->getNy(); iy++) {
+     209          36 :                         for (int iz = 0; iz < grid->getNz(); iz++) {
+     210          27 :                                 Vector3f b = grid->get(ix, iy, iz) * c;
+     211          27 :                                 fout.write((char*) &(b.x), sizeof(float));
+     212          27 :                                 fout.write((char*) &(b.y), sizeof(float));
+     213          27 :                                 fout.write((char*) &(b.z), sizeof(float));
+     214             :                         }
+     215             :                 }
+     216             :         }
+     217           1 :         fout.close();
+     218           1 : }
+     219             : 
+     220           0 : void dumpGrid(ref_ptr<Grid1f> grid, std::string filename, double c) {
+     221           0 :         std::ofstream fout(filename.c_str(), std::ios::binary);
+     222           0 :         if (!fout) {
+     223           0 :                 std::stringstream ss;
+     224           0 :                 ss << "dump Grid1f: " << filename << " not found";
+     225           0 :                 throw std::runtime_error(ss.str());
+     226           0 :         }
+     227           0 :         for (int ix = 0; ix < grid->getNx(); ix++) {
+     228           0 :                 for (int iy = 0; iy < grid->getNy(); iy++) {
+     229           0 :                         for (int iz = 0; iz < grid->getNz(); iz++) {
+     230           0 :                                 float b = grid->get(ix, iy, iz) * c;
+     231           0 :                                 fout.write((char*) &b, sizeof(float));
+     232             :                         }
+     233             :                 }
+     234             :         }
+     235           0 :         fout.close();
+     236           0 : }
+     237             : 
+     238           1 : void loadGridFromTxt(ref_ptr<Grid3f> grid, std::string filename, double c) {
+     239           1 :         std::ifstream fin(filename.c_str());
+     240           1 :         if (!fin) {
+     241           0 :                 std::stringstream ss;
+     242           0 :                 ss << "load Grid3f: " << filename << " not found";
+     243           0 :                 throw std::runtime_error(ss.str());
+     244           0 :         }
+     245             :         // skip header lines
+     246           1 :         while (fin.peek() == '#')
+     247           0 :                 fin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
+     248             : 
+     249           4 :         for (int ix = 0; ix < grid->getNx(); ix++) {
+     250          12 :                 for (int iy = 0; iy < grid->getNy(); iy++) {
+     251          36 :                         for (int iz = 0; iz < grid->getNz(); iz++) {
+     252             :                                 Vector3f &b = grid->get(ix, iy, iz);
+     253          27 :                                 fin >> b.x >> b.y >> b.z;
+     254          27 :                                 b *= c;
+     255          27 :                                 if (fin.eof())
+     256           0 :                                         throw std::runtime_error("load Grid3f: file too short");
+     257             :                         }
+     258             :                 }
+     259             :         }
+     260           1 :         fin.close();
+     261           1 : }
+     262             : 
+     263           0 : void loadGridFromTxt(ref_ptr<Grid1f> grid, std::string filename, double c) {
+     264           0 :         std::ifstream fin(filename.c_str());
+     265           0 :         if (!fin) {
+     266           0 :                 std::stringstream ss;
+     267           0 :                 ss << "load Grid1f: " << filename << " not found";
+     268           0 :                 throw std::runtime_error(ss.str());
+     269           0 :         }
+     270             :         // skip header lines
+     271           0 :         while (fin.peek() == '#')
+     272           0 :                 fin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
+     273             : 
+     274           0 :         for (int ix = 0; ix < grid->getNx(); ix++) {
+     275           0 :                 for (int iy = 0; iy < grid->getNy(); iy++) {
+     276           0 :                         for (int iz = 0; iz < grid->getNz(); iz++) {
+     277             :                                 float &b = grid->get(ix, iy, iz);
+     278             :                                 fin >> b;
+     279           0 :                                 b *= c;
+     280           0 :                                 if (fin.eof())
+     281           0 :                                         throw std::runtime_error("load Grid1f: file too short");
+     282             :                         }
+     283             :                 }
+     284             :         }
+     285           0 :         fin.close();
+     286           0 : }
+     287             : 
+     288           1 : void dumpGridToTxt(ref_ptr<Grid3f> grid, std::string filename, double c) {
+     289           1 :         std::ofstream fout(filename.c_str());
+     290           1 :         if (!fout) {
+     291           0 :                 std::stringstream ss;
+     292           0 :                 ss << "dump Grid3f: " << filename << " not found";
+     293           0 :                 throw std::runtime_error(ss.str());
+     294           0 :         }
+     295           4 :         for (int ix = 0; ix < grid->getNx(); ix++) {
+     296          12 :                 for (int iy = 0; iy < grid->getNy(); iy++) {
+     297          36 :                         for (int iz = 0; iz < grid->getNz(); iz++) {
+     298          27 :                                 Vector3f b = grid->get(ix, iy, iz) * c;
+     299          27 :                                 fout << b << "\n";
+     300             :                         }
+     301             :                 }
+     302             :         }
+     303           1 :         fout.close();
+     304           1 : }
+     305             : 
+     306           0 : void dumpGridToTxt(ref_ptr<Grid1f> grid, std::string filename, double c) {
+     307           0 :         std::ofstream fout(filename.c_str());
+     308           0 :         if (!fout) {
+     309           0 :                 std::stringstream ss;
+     310           0 :                 ss << "dump Grid1f: " << filename << " not found";
+     311           0 :                 throw std::runtime_error(ss.str());
+     312           0 :         }
+     313           0 :         for (int ix = 0; ix < grid->getNx(); ix++) {
+     314           0 :                 for (int iy = 0; iy < grid->getNy(); iy++) {
+     315           0 :                         for (int iz = 0; iz < grid->getNz(); iz++) {
+     316           0 :                                 float b = grid->get(ix, iy, iz) * c;
+     317           0 :                                 fout << b << "\n";
+     318             :                         }
+     319             :                 }
+     320             :         }
+     321           0 :         fout.close();
+     322           0 : }
+     323             : 
+     324             : #ifdef CRPROPA_HAVE_FFTW3F
+     325             : 
+     326           0 : std::vector<std::pair<int, float>> gridPowerSpectrum(ref_ptr<Grid3f> grid) {
+     327             : 
+     328           0 :   double rms = rmsFieldStrength(grid);
+     329             :   size_t n = grid->getNx(); // size of array
+     330             : 
+     331             :   // arrays to hold the complex vector components of the B(k)-field
+     332             :   fftwf_complex *Bkx, *Bky, *Bkz;
+     333           0 :   Bkx = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * n * n * n);
+     334           0 :   Bky = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * n * n * n);
+     335           0 :   Bkz = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * n * n * n);
+     336             : 
+     337             :   fftwf_complex *Bx = (fftwf_complex *)Bkx;
+     338             :   fftwf_complex *By = (fftwf_complex *)Bky;
+     339             :   fftwf_complex *Bz = (fftwf_complex *)Bkz;
+     340             : 
+     341             :   // save to temp
+     342             :   int i;
+     343           0 :   for (size_t ix = 0; ix < n; ix++) {
+     344           0 :     for (size_t iy = 0; iy < n; iy++) {
+     345           0 :       for (size_t iz = 0; iz < n; iz++) {
+     346           0 :         i = ix * n * n + iy * n + iz;
+     347             :         Vector3<float> &b = grid->get(ix, iy, iz);
+     348           0 :         Bx[i][0] = b.x / rms;
+     349           0 :         By[i][0] = b.y / rms;
+     350           0 :         Bz[i][0] = b.z / rms;
+     351             :       }
+     352             :     }
+     353             :   }
+     354             : 
+     355             :   // in-place, real to complex, inverse Fourier transformation on each component
+     356             :   // note that the last elements of B(x) are unused now
+     357             :   fftwf_plan plan_x =
+     358           0 :       fftwf_plan_dft_3d(n, n, n, Bx, Bkx, FFTW_FORWARD, FFTW_ESTIMATE);
+     359           0 :   fftwf_execute(plan_x);
+     360           0 :   fftwf_destroy_plan(plan_x);
+     361             : 
+     362             :   fftwf_plan plan_y =
+     363           0 :       fftwf_plan_dft_3d(n, n, n, By, Bky, FFTW_FORWARD, FFTW_ESTIMATE);
+     364           0 :   fftwf_execute(plan_y);
+     365           0 :   fftwf_destroy_plan(plan_y);
+     366             : 
+     367             :   fftwf_plan plan_z =
+     368           0 :       fftwf_plan_dft_3d(n, n, n, Bz, Bkz, FFTW_FORWARD, FFTW_ESTIMATE);
+     369           0 :   fftwf_execute(plan_z);
+     370           0 :   fftwf_destroy_plan(plan_z);
+     371             : 
+     372             :   float power;
+     373             :   std::map<size_t, std::pair<float, int>> spectrum;
+     374             :   int k;
+     375             : 
+     376           0 :   for (size_t ix = 0; ix < n; ix++) {
+     377           0 :     for (size_t iy = 0; iy < n; iy++) {
+     378           0 :       for (size_t iz = 0; iz < n; iz++) {
+     379           0 :         i = ix * n * n + iy * n + iz;
+     380           0 :         k = static_cast<int>(
+     381           0 :             std::floor(std::sqrt(ix * ix + iy * iy + iz * iz)));
+     382           0 :         if (k > n / 2. || k == 0)
+     383           0 :           continue;
+     384           0 :         power = ((Bkx[i][0] * Bkx[i][0] + Bkx[i][1] * Bkx[i][1]) +
+     385           0 :                  (Bky[i][0] * Bky[i][0] + Bky[i][1] * Bky[i][1]) +
+     386           0 :                  (Bkz[i][0] * Bkz[i][0] + Bkz[i][1] * Bkz[i][1]));
+     387           0 :         if (spectrum.find(k) == spectrum.end()) {
+     388           0 :           spectrum[k].first = power;
+     389           0 :           spectrum[k].second = 1;
+     390             :         } else {
+     391           0 :           spectrum[k].first += power;
+     392           0 :           spectrum[k].second += 1;
+     393             :         }
+     394             :       }
+     395             :     }
+     396             :   }
+     397             : 
+     398           0 :   fftwf_free(Bkx);
+     399           0 :   fftwf_free(Bky);
+     400           0 :   fftwf_free(Bkz);
+     401             : 
+     402             :   std::vector<std::pair<int, float>> points;
+     403           0 :   for (std::map<size_t, std::pair<float, int>>::iterator it = spectrum.begin();
+     404           0 :        it != spectrum.end(); ++it) {
+     405           0 :     points.push_back(
+     406           0 :         std::make_pair(it->first, (it->second).first / (it->second).second));
+     407             :   }
+     408             : 
+     409           0 :   return points;
+     410             : }
+     411             : 
+     412             : #endif // CRPROPA_HAVE_FFTW3F
+     413             : 
+     414             : 
+     415             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Module.cpp.func-sort-c.html b/doc/coverageReport/src/Module.cpp.func-sort-c.html new file mode 100644 index 000000000..16f3b25e6 --- /dev/null +++ b/doc/coverageReport/src/Module.cpp.func-sort-c.html @@ -0,0 +1,120 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Module.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Module.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:374877.1 %
Date:2024-04-08 14:58:22Functions:91275.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa17AbstractCondition13setAcceptFlagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_0
_ZN7crpropa17AbstractCondition23setMakeAcceptedInactiveEb0
_ZNK7crpropa6Module14getDescriptionB5cxx11Ev0
_ZN7crpropa17AbstractCondition13setRejectFlagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_1
_ZN7crpropa17AbstractCondition23setMakeRejectedInactiveEb1
_ZN7crpropa17AbstractCondition8onAcceptEPNS_6ModuleE1
_ZN7crpropa17AbstractCondition8onRejectEPNS_6ModuleE1
_ZNK7crpropa17AbstractCondition6acceptEPNS_9CandidateE2
_ZN7crpropa17AbstractConditionC2Ev33
_ZN7crpropa6ModuleC2Ev209
_ZN7crpropa6Module14setDescriptionERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE365
_ZNK7crpropa17AbstractCondition6rejectEPNS_9CandidateE1126
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Module.cpp.func.html b/doc/coverageReport/src/Module.cpp.func.html new file mode 100644 index 000000000..b0c8fb43e --- /dev/null +++ b/doc/coverageReport/src/Module.cpp.func.html @@ -0,0 +1,120 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Module.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Module.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:374877.1 %
Date:2024-04-08 14:58:22Functions:91275.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa17AbstractCondition13setAcceptFlagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_0
_ZN7crpropa17AbstractCondition13setRejectFlagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_1
_ZN7crpropa17AbstractCondition23setMakeAcceptedInactiveEb0
_ZN7crpropa17AbstractCondition23setMakeRejectedInactiveEb1
_ZN7crpropa17AbstractCondition8onAcceptEPNS_6ModuleE1
_ZN7crpropa17AbstractCondition8onRejectEPNS_6ModuleE1
_ZN7crpropa17AbstractConditionC2Ev33
_ZN7crpropa6Module14setDescriptionERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE365
_ZN7crpropa6ModuleC2Ev209
_ZNK7crpropa17AbstractCondition6acceptEPNS_9CandidateE2
_ZNK7crpropa17AbstractCondition6rejectEPNS_9CandidateE1126
_ZNK7crpropa6Module14getDescriptionB5cxx11Ev0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Module.cpp.gcov.html b/doc/coverageReport/src/Module.cpp.gcov.html new file mode 100644 index 000000000..3dc4592a3 --- /dev/null +++ b/doc/coverageReport/src/Module.cpp.gcov.html @@ -0,0 +1,156 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Module.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Module.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:374877.1 %
Date:2024-04-08 14:58:22Functions:91275.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/Module.h"
+       2             : 
+       3             : #include <typeinfo>
+       4             : 
+       5             : namespace crpropa {
+       6             : 
+       7         209 : Module::Module() {
+       8             :         const std::type_info &info = typeid(*this);
+       9         209 :         setDescription(info.name());
+      10         209 : }
+      11             : 
+      12           0 : std::string Module::getDescription() const {
+      13           0 :         return description;
+      14             : }
+      15             : 
+      16         365 : void Module::setDescription(const std::string &d) {
+      17         365 :         description = d;
+      18         365 : }
+      19             : 
+      20          33 : AbstractCondition::AbstractCondition() :
+      21          33 :                 makeRejectedInactive(true), makeAcceptedInactive(false), rejectFlagKey(
+      22          33 :                                 "Rejected") {
+      23             : 
+      24          33 : }
+      25             : 
+      26        1126 : void AbstractCondition::reject(Candidate *candidate) const {
+      27        1126 :         if (!candidate)
+      28             :                 return;
+      29             : 
+      30        1126 :         if (rejectAction.valid())
+      31           5 :                 rejectAction->process(candidate);
+      32             : 
+      33        1126 :         if (!rejectFlagKey.empty())
+      34        1126 :                 candidate->setProperty(rejectFlagKey, rejectFlagValue);
+      35             : 
+      36        1126 :         if (makeRejectedInactive)
+      37        1125 :                 candidate->setActive(false);
+      38             : }
+      39             : 
+      40           2 : void AbstractCondition::accept(Candidate *candidate) const {
+      41           2 :         if (!candidate)
+      42             :                 return;
+      43             : 
+      44           2 :         if (acceptAction.valid())
+      45           2 :                 acceptAction->process(candidate);
+      46             : 
+      47           2 :         if (!acceptFlagKey.empty())
+      48           0 :                 candidate->setProperty(acceptFlagKey, acceptFlagValue);
+      49             : 
+      50           2 :         if (makeAcceptedInactive)
+      51           0 :                 candidate->setActive(false);
+      52             : }
+      53             : 
+      54           1 : void AbstractCondition::setMakeRejectedInactive(bool deactivate) {
+      55           1 :         makeRejectedInactive = deactivate;
+      56           1 : }
+      57             : 
+      58           0 : void AbstractCondition::setMakeAcceptedInactive(bool deactivate) {
+      59           0 :         makeAcceptedInactive = deactivate;
+      60           0 : }
+      61             : 
+      62           1 : void AbstractCondition::onReject(Module *action) {
+      63           1 :         rejectAction = action;
+      64           1 : }
+      65             : 
+      66           1 : void AbstractCondition::onAccept(Module *action) {
+      67           1 :         acceptAction = action;
+      68           1 : }
+      69             : 
+      70           1 : void AbstractCondition::setRejectFlag(std::string key, std::string value) {
+      71           1 :         rejectFlagKey = key;
+      72           1 :         rejectFlagValue = value;
+      73           1 : }
+      74             : 
+      75           0 : void AbstractCondition::setAcceptFlag(std::string key, std::string value) {
+      76           0 :         acceptFlagKey = key;
+      77           0 :         acceptFlagValue = value;
+      78           0 : }
+      79             : 
+      80             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/ParticleID.cpp.func-sort-c.html b/doc/coverageReport/src/ParticleID.cpp.func-sort-c.html new file mode 100644 index 000000000..02a39f19f --- /dev/null +++ b/doc/coverageReport/src/ParticleID.cpp.func-sort-c.html @@ -0,0 +1,92 @@ + + + + + + + LCOV - coverage.info.cleaned - src/ParticleID.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - ParticleID.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:163053.3 %
Date:2024-04-08 14:58:22Functions:4580.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa15convertIdToNameB5cxx11Ei0
_ZN7crpropa9nucleusIdEii45149
_ZN7crpropa10massNumberEi202819
_ZN7crpropa12chargeNumberEi364529
_ZN7crpropa9isNucleusEi20370056
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/ParticleID.cpp.func.html b/doc/coverageReport/src/ParticleID.cpp.func.html new file mode 100644 index 000000000..70f77a588 --- /dev/null +++ b/doc/coverageReport/src/ParticleID.cpp.func.html @@ -0,0 +1,92 @@ + + + + + + + LCOV - coverage.info.cleaned - src/ParticleID.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - ParticleID.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:163053.3 %
Date:2024-04-08 14:58:22Functions:4580.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa10massNumberEi202819
_ZN7crpropa12chargeNumberEi364529
_ZN7crpropa15convertIdToNameB5cxx11Ei0
_ZN7crpropa9isNucleusEi20370056
_ZN7crpropa9nucleusIdEii45149
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/ParticleID.cpp.gcov.html b/doc/coverageReport/src/ParticleID.cpp.gcov.html new file mode 100644 index 000000000..917e4a925 --- /dev/null +++ b/doc/coverageReport/src/ParticleID.cpp.gcov.html @@ -0,0 +1,130 @@ + + + + + + + LCOV - coverage.info.cleaned - src/ParticleID.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - ParticleID.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:163053.3 %
Date:2024-04-08 14:58:22Functions:4580.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/ParticleID.h"
+       2             : 
+       3             : #include "HepPID/ParticleIDMethods.hh"
+       4             : #include "HepPID/ParticleName.hh"
+       5             : #include "kiss/convert.h"
+       6             : 
+       7             : #include <string>
+       8             : 
+       9             : namespace crpropa {
+      10             : 
+      11       45149 : int nucleusId(int a, int z) {
+      12       45149 :         if (z < 0)
+      13           0 :                 throw std::runtime_error(
+      14           0 :                                 "crpropa::Nucleus: no nucleus with Z < 0, A=" + kiss::str(a) + " Z="
+      15           0 :                                                 + kiss::str(z));
+      16       45149 :         if (a < 1)
+      17           0 :                 throw std::runtime_error(
+      18           0 :                                 "crpropa::Nucleus: no nucleus with A < 1, A=" + kiss::str(a) + " Z="
+      19           0 :                                                 + kiss::str(z));
+      20       45149 :         if (a < z)
+      21           1 :                 throw std::runtime_error(
+      22           2 :                                 "crpropa::Nucleus: no nucleus with A < Z, A=" + kiss::str(a) + " Z="
+      23           4 :                                                 + kiss::str(z));
+      24       45148 :         return 1000000000 + z * 10000 + a * 10;
+      25             : }
+      26             : 
+      27      364529 : int chargeNumber(int id) {
+      28      364529 :         return HepPID::Z(id);
+      29             : }
+      30             : 
+      31      202819 : int massNumber(int id) {
+      32      202819 :         if (id == 2112)
+      33             :                 return 1;
+      34      202818 :         return HepPID::A(id);
+      35             : }
+      36             : 
+      37    20370056 : bool isNucleus(int id) {
+      38    20370056 :         if (id == 2112)
+      39             :                 return true; // consider neutron as nucleus
+      40    20370056 :         return HepPID::isNucleus(id);
+      41             : }
+      42             : 
+      43           0 : std::string convertIdToName(int id) {
+      44             :         // handle a few extra cases that HepPID doesn't like
+      45           0 :         if (id == 1000000010) // neutron
+      46           0 :                 id = 2112;
+      47           0 :         if (id == -1000000010) // anti-neutron
+      48           0 :                 id = -2112;
+      49           0 :         if (id == -1000010010) // anti-proton
+      50           0 :                 id = -2212;
+      51           0 :         return HepPID::particleName(id);
+      52             : }
+      53             : 
+      54             : }
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/ParticleMass.cpp.func-sort-c.html b/doc/coverageReport/src/ParticleMass.cpp.func-sort-c.html new file mode 100644 index 000000000..684f8b4f6 --- /dev/null +++ b/doc/coverageReport/src/ParticleMass.cpp.func-sort-c.html @@ -0,0 +1,88 @@ + + + + + + + LCOV - coverage.info.cleaned - src/ParticleMass.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - ParticleMass.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:303196.8 %
Date:2024-04-08 14:58:22Functions:44100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16NuclearMassTable4initEv12
_ZN7crpropa11nuclearMassEi161184
_ZN7crpropa16NuclearMassTable7getMassEm161208
_ZN7crpropa11nuclearMassEii161209
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/ParticleMass.cpp.func.html b/doc/coverageReport/src/ParticleMass.cpp.func.html new file mode 100644 index 000000000..f0fe27c62 --- /dev/null +++ b/doc/coverageReport/src/ParticleMass.cpp.func.html @@ -0,0 +1,88 @@ + + + + + + + LCOV - coverage.info.cleaned - src/ParticleMass.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - ParticleMass.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:303196.8 %
Date:2024-04-08 14:58:22Functions:44100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11nuclearMassEi161184
_ZN7crpropa11nuclearMassEii161209
_ZN7crpropa16NuclearMassTable4initEv12
_ZN7crpropa16NuclearMassTable7getMassEm161208
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/ParticleMass.cpp.gcov.html b/doc/coverageReport/src/ParticleMass.cpp.gcov.html new file mode 100644 index 000000000..22315606f --- /dev/null +++ b/doc/coverageReport/src/ParticleMass.cpp.gcov.html @@ -0,0 +1,150 @@ + + + + + + + LCOV - coverage.info.cleaned - src/ParticleMass.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - ParticleMass.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:303196.8 %
Date:2024-04-08 14:58:22Functions:44100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/ParticleMass.h"
+       2             : #include "crpropa/ParticleID.h"
+       3             : #include "crpropa/Common.h"
+       4             : #include "crpropa/Units.h"
+       5             : 
+       6             : #include "kiss/convert.h"
+       7             : #include "kiss/logger.h"
+       8             : 
+       9             : #include <vector>
+      10             : #include <fstream>
+      11             : #include <stdexcept>
+      12             : #include <limits>
+      13             : 
+      14             : namespace crpropa {
+      15             : 
+      16             : struct NuclearMassTable {
+      17             :         bool initialized;
+      18             :         std::vector<double> table;
+      19             : 
+      20             :         NuclearMassTable() {
+      21             :                 initialized = false;
+      22             :         }
+      23             : 
+      24          12 :         void init() {
+      25          24 :                 std::string filename = getDataPath("nuclear_mass.txt");
+      26          12 :                 std::ifstream infile(filename.c_str());
+      27             : 
+      28          12 :                 if (!infile.good())
+      29           0 :                         throw std::runtime_error("crpropa: could not open file " + filename);
+      30             : 
+      31             :                 int Z, N;
+      32             :                 double mass;
+      33       10092 :                 while (infile.good()) {
+      34       10080 :                         if (infile.peek() != '#') {
+      35       10056 :                                 infile >> Z >> N >> mass;
+      36       10056 :                                 table.push_back(mass);
+      37             :                         }
+      38       10080 :                         infile.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
+      39             :                 }
+      40             : 
+      41          12 :                 infile.close();
+      42          12 :                 initialized = true;
+      43          24 :         }
+      44             : 
+      45      161208 :         double getMass(std::size_t idx) {
+      46      161208 :                 if (!initialized) {
+      47          12 : #pragma omp critical(init)
+      48          12 :                         init();
+      49             :                 }
+      50      161208 :                 return table[idx];
+      51             :         }
+      52             : };
+      53             : 
+      54             : static NuclearMassTable nuclearMassTable;
+      55             : 
+      56      161184 : double nuclearMass(int id) {
+      57      161184 :         int A = massNumber(id);
+      58      161184 :         int Z = chargeNumber(id);
+      59      161184 :         return nuclearMass(A, Z);
+      60             : }
+      61             : 
+      62      161209 : double nuclearMass(int A, int Z) {
+      63      161209 :         if ((A < 1) or (A > 56) or (Z < 0) or (Z > 26) or (Z > A)) {
+      64           2 :                 KISS_LOG_WARNING <<
+      65           1 :                 "nuclearMass: nuclear mass not found in the mass table for " <<
+      66           1 :                 "A = " << A << ", Z = " << Z << ". " <<
+      67           1 :                 "Approximated value used A * amu - Z * m_e instead.";
+      68           1 :                 return A * amu - Z * mass_electron;
+      69             :         }
+      70      161208 :         int N = A - Z;
+      71      161208 :         return nuclearMassTable.getMass(Z * 31 + N);
+      72             : }
+      73             : 
+      74             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/ParticleState.cpp.func-sort-c.html b/doc/coverageReport/src/ParticleState.cpp.func-sort-c.html new file mode 100644 index 000000000..c6897830a --- /dev/null +++ b/doc/coverageReport/src/ParticleState.cpp.func-sort-c.html @@ -0,0 +1,140 @@ + + + + + + + LCOV - coverage.info.cleaned - src/ParticleState.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - ParticleState.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:485685.7 %
Date:2024-04-08 14:58:22Functions:161794.1 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa13ParticleState14getDescriptionB5cxx11Ev0
_ZNK7crpropa13ParticleState11getRigidityEv1
_ZNK7crpropa13ParticleState11getVelocityEv1
_ZNK7crpropa13ParticleState11getMomentumEv2
_ZNK7crpropa13ParticleState7getMassEv4
_ZN7crpropa13ParticleState16setLorentzFactorEd15420
_ZNK7crpropa13ParticleState16getLorentzFactorEv33182
_ZNK7crpropa13ParticleState5getIdEv290682
_ZNK7crpropa13ParticleState12getDirectionEv500446
_ZNK7crpropa13ParticleState9getEnergyEv603581
_ZNK7crpropa13ParticleState9getChargeEv960335
_ZNK7crpropa13ParticleState11getPositionEv12488919
_ZN7crpropa13ParticleStateC2EidNS_7Vector3IdEES2_16844401
_ZN7crpropa13ParticleState12setDirectionERKNS_7Vector3IdEE17329639
_ZN7crpropa13ParticleState5setIdEi20314515
_ZN7crpropa13ParticleState9setEnergyEd20322799
_ZN7crpropa13ParticleState11setPositionERKNS_7Vector3IdEE24114998
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/ParticleState.cpp.func.html b/doc/coverageReport/src/ParticleState.cpp.func.html new file mode 100644 index 000000000..2ad881fd0 --- /dev/null +++ b/doc/coverageReport/src/ParticleState.cpp.func.html @@ -0,0 +1,140 @@ + + + + + + + LCOV - coverage.info.cleaned - src/ParticleState.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - ParticleState.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:485685.7 %
Date:2024-04-08 14:58:22Functions:161794.1 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa13ParticleState11setPositionERKNS_7Vector3IdEE24114998
_ZN7crpropa13ParticleState12setDirectionERKNS_7Vector3IdEE17329639
_ZN7crpropa13ParticleState16setLorentzFactorEd15420
_ZN7crpropa13ParticleState5setIdEi20314515
_ZN7crpropa13ParticleState9setEnergyEd20322799
_ZN7crpropa13ParticleStateC2EidNS_7Vector3IdEES2_16844401
_ZNK7crpropa13ParticleState11getMomentumEv2
_ZNK7crpropa13ParticleState11getPositionEv12488919
_ZNK7crpropa13ParticleState11getRigidityEv1
_ZNK7crpropa13ParticleState11getVelocityEv1
_ZNK7crpropa13ParticleState12getDirectionEv500446
_ZNK7crpropa13ParticleState14getDescriptionB5cxx11Ev0
_ZNK7crpropa13ParticleState16getLorentzFactorEv33182
_ZNK7crpropa13ParticleState5getIdEv290682
_ZNK7crpropa13ParticleState7getMassEv4
_ZNK7crpropa13ParticleState9getChargeEv960335
_ZNK7crpropa13ParticleState9getEnergyEv603581
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/ParticleState.cpp.gcov.html b/doc/coverageReport/src/ParticleState.cpp.gcov.html new file mode 100644 index 000000000..34ba83680 --- /dev/null +++ b/doc/coverageReport/src/ParticleState.cpp.gcov.html @@ -0,0 +1,178 @@ + + + + + + + LCOV - coverage.info.cleaned - src/ParticleState.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - ParticleState.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:485685.7 %
Date:2024-04-08 14:58:22Functions:161794.1 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/ParticleState.h"
+       2             : #include "crpropa/Units.h"
+       3             : #include "crpropa/Common.h"
+       4             : #include "crpropa/ParticleID.h"
+       5             : #include "crpropa/ParticleMass.h"
+       6             : 
+       7             : #include "HepPID/ParticleIDMethods.hh"
+       8             : 
+       9             : #include <cstdlib>
+      10             : #include <sstream>
+      11             : 
+      12             : namespace crpropa {
+      13             : 
+      14    16844401 : ParticleState::ParticleState(int id, double E, Vector3d pos, Vector3d dir): id(0), energy(0.), position(0.), direction(0.), pmass(0.), charge(0.)
+      15             : {
+      16    16844401 :         setId(id);
+      17    16844401 :         setEnergy(E);
+      18    16844401 :         setPosition(pos);
+      19    16844401 :         setDirection(dir);
+      20    16844401 : }
+      21             : 
+      22    24114998 : void ParticleState::setPosition(const Vector3d &pos) {
+      23             :         position = pos;
+      24    24114998 : }
+      25             : 
+      26    12488919 : const Vector3d &ParticleState::getPosition() const {
+      27    12488919 :         return position;
+      28             : }
+      29             : 
+      30    17329639 : void ParticleState::setDirection(const Vector3d &dir) {
+      31             :         direction = dir / dir.getR();
+      32    17329639 : }
+      33             : 
+      34      500446 : const Vector3d &ParticleState::getDirection() const {
+      35      500446 :         return direction;
+      36             : }
+      37             : 
+      38    20322799 : void ParticleState::setEnergy(double newEnergy) {
+      39    20322799 :         energy = std::max(0., newEnergy); // prevent negative energies
+      40    20322799 : }
+      41             : 
+      42      603581 : double ParticleState::getEnergy() const {
+      43      603581 :         return energy;
+      44             : }
+      45             : 
+      46           1 : double ParticleState::getRigidity() const {
+      47           1 :         return fabs(energy / charge);
+      48             : }
+      49             : 
+      50    20314515 : void ParticleState::setId(int newId) {
+      51    20314515 :         id = newId;
+      52    20314515 :         if (isNucleus(id)) {
+      53      146261 :                 pmass = nuclearMass(id);
+      54      146261 :                 charge = chargeNumber(id) * eplus;
+      55      146261 :                 if (id < 0)
+      56           4 :                         charge *= -1; // anti-nucleus
+      57             :         } else {
+      58    20168254 :                 if (abs(id) == 11)
+      59       15064 :                         pmass = mass_electron;
+      60    20168254 :                 charge = HepPID::charge(id) * eplus;
+      61             :         }
+      62    20314515 : }
+      63             : 
+      64      290682 : int ParticleState::getId() const {
+      65      290682 :         return id;
+      66             : }
+      67             : 
+      68           4 : double ParticleState::getMass() const {
+      69           4 :         return pmass;
+      70             : }
+      71             : 
+      72      960335 : double ParticleState::getCharge() const {
+      73      960335 :         return charge;
+      74             : }
+      75             : 
+      76       33182 : double ParticleState::getLorentzFactor() const {
+      77       33182 :         return energy / (pmass * c_squared);
+      78             : }
+      79             : 
+      80       15420 : void ParticleState::setLorentzFactor(double lf) {
+      81       15420 :         lf = std::max(0., lf); // prevent negative Lorentz factors
+      82       15420 :         energy = lf * pmass * c_squared;
+      83       15420 : }
+      84             : 
+      85           1 : Vector3d ParticleState::getVelocity() const {
+      86           1 :         return direction * c_light;
+      87             : }
+      88             : 
+      89           2 : Vector3d ParticleState::getMomentum() const {
+      90           2 :         return direction * (energy / c_light);
+      91             : }
+      92             : 
+      93           0 : std::string ParticleState::getDescription() const {
+      94           0 :         std::stringstream ss;
+      95           0 :         ss << "Particle " << id << ", ";
+      96           0 :         ss << "E = " << energy / EeV << " EeV, ";
+      97           0 :         ss << "x = " << position / Mpc << " Mpc, ";
+      98           0 :         ss << "p = " << direction;
+      99           0 :         return ss.str();
+     100           0 : }
+     101             : 
+     102             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/PhotonBackground.cpp.func-sort-c.html b/doc/coverageReport/src/PhotonBackground.cpp.func-sort-c.html new file mode 100644 index 000000000..eca58f129 --- /dev/null +++ b/doc/coverageReport/src/PhotonBackground.cpp.func-sort-c.html @@ -0,0 +1,132 @@ + + + + + + + LCOV - coverage.info.cleaned - src/PhotonBackground.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - PhotonBackground.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8812073.3 %
Date:2024-04-08 14:58:22Functions:121580.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa20BlackbodyPhotonField11setQuantileEd0
_ZNK7crpropa18TabularPhotonField22getMaximumPhotonEnergyEd0
_ZNK7crpropa18TabularPhotonField22getMinimumPhotonEnergyEd0
_ZNK7crpropa20BlackbodyPhotonField22getMaximumPhotonEnergyEd29
_ZNK7crpropa20BlackbodyPhotonField22getMinimumPhotonEnergyEd29
_ZN7crpropa20BlackbodyPhotonFieldC2ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd40
_ZN7crpropa18TabularPhotonField12readRedshiftENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE73
_ZN7crpropa18TabularPhotonField19initRedshiftScalingEv73
_ZN7crpropa18TabularPhotonField16readPhotonEnergyENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE94
_ZN7crpropa18TabularPhotonField17readPhotonDensityENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE94
_ZN7crpropa18TabularPhotonFieldC2ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb94
_ZNK7crpropa18TabularPhotonField14checkInputDataEv94
_ZNK7crpropa20BlackbodyPhotonField16getPhotonDensityEdd10689
_ZNK7crpropa18TabularPhotonField18getRedshiftScalingEd16757
_ZNK7crpropa18TabularPhotonField16getPhotonDensityEdd9536930
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/PhotonBackground.cpp.func.html b/doc/coverageReport/src/PhotonBackground.cpp.func.html new file mode 100644 index 000000000..c0525218b --- /dev/null +++ b/doc/coverageReport/src/PhotonBackground.cpp.func.html @@ -0,0 +1,132 @@ + + + + + + + LCOV - coverage.info.cleaned - src/PhotonBackground.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - PhotonBackground.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8812073.3 %
Date:2024-04-08 14:58:22Functions:121580.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa18TabularPhotonField12readRedshiftENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE73
_ZN7crpropa18TabularPhotonField16readPhotonEnergyENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE94
_ZN7crpropa18TabularPhotonField17readPhotonDensityENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE94
_ZN7crpropa18TabularPhotonField19initRedshiftScalingEv73
_ZN7crpropa18TabularPhotonFieldC2ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb94
_ZN7crpropa20BlackbodyPhotonField11setQuantileEd0
_ZN7crpropa20BlackbodyPhotonFieldC2ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd40
_ZNK7crpropa18TabularPhotonField14checkInputDataEv94
_ZNK7crpropa18TabularPhotonField16getPhotonDensityEdd9536930
_ZNK7crpropa18TabularPhotonField18getRedshiftScalingEd16757
_ZNK7crpropa18TabularPhotonField22getMaximumPhotonEnergyEd0
_ZNK7crpropa18TabularPhotonField22getMinimumPhotonEnergyEd0
_ZNK7crpropa20BlackbodyPhotonField16getPhotonDensityEdd10689
_ZNK7crpropa20BlackbodyPhotonField22getMaximumPhotonEnergyEd29
_ZNK7crpropa20BlackbodyPhotonField22getMinimumPhotonEnergyEd29
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/PhotonBackground.cpp.gcov.html b/doc/coverageReport/src/PhotonBackground.cpp.gcov.html new file mode 100644 index 000000000..7d90ae0f2 --- /dev/null +++ b/doc/coverageReport/src/PhotonBackground.cpp.gcov.html @@ -0,0 +1,291 @@ + + + + + + + LCOV - coverage.info.cleaned - src/PhotonBackground.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - PhotonBackground.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8812073.3 %
Date:2024-04-08 14:58:22Functions:121580.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/PhotonBackground.h"
+       2             : #include "crpropa/Units.h"
+       3             : #include "crpropa/Random.h"
+       4             : 
+       5             : #include "kiss/logger.h"
+       6             : 
+       7             : #include <fstream>
+       8             : #include <stdexcept>
+       9             : #include <limits>
+      10             : #include <cmath>
+      11             : 
+      12             : namespace crpropa {
+      13             : 
+      14          94 : TabularPhotonField::TabularPhotonField(std::string fieldName, bool isRedshiftDependent) {
+      15          94 :         this->fieldName = fieldName;
+      16          94 :         this->isRedshiftDependent = isRedshiftDependent;
+      17             : 
+      18         188 :         readPhotonEnergy(getDataPath("") + "Scaling/" + this->fieldName + "_photonEnergy.txt");
+      19         188 :         readPhotonDensity(getDataPath("") + "Scaling/" + this->fieldName + "_photonDensity.txt");
+      20          94 :         if (this->isRedshiftDependent)
+      21         146 :                 readRedshift(getDataPath("") + "Scaling/" + this->fieldName + "_redshift.txt");
+      22             : 
+      23          94 :         checkInputData();
+      24             : 
+      25          94 :         if (this->isRedshiftDependent)
+      26          73 :                 initRedshiftScaling();
+      27          94 : }
+      28             : 
+      29             : 
+      30     9536930 : double TabularPhotonField::getPhotonDensity(double Ephoton, double z) const {   
+      31     9536930 :         if ((this->isRedshiftDependent)) {
+      32             :                 // fix behaviour for future redshift. See issue #414
+      33             :                 // with redshift < 0 the photon density is set to 0 in interpolate2d. 
+      34             :                 // Therefore it is assumed that the photon density does not change from values at z = 0. This is only valid for small changes in redshift.
+      35     9536930 :                 double zMin = this->redshifts[0];
+      36     9536930 :                 if(z < zMin){
+      37           0 :                         if(z < -1) {
+      38           0 :                                 KISS_LOG_WARNING << "Photon Field " << fieldName << " uses FutureRedshift with z < -1. The photon density is set to n(Ephoton, z=0). \n";
+      39             :                         }
+      40           0 :                         return getPhotonDensity(Ephoton, zMin);
+      41             :                 } else {
+      42     9536930 :                         return interpolate2d(Ephoton, z, this->photonEnergies, this->redshifts, this->photonDensity);
+      43             :                 }
+      44             :         } else {
+      45           0 :                 return interpolate(Ephoton, this->photonEnergies, this->photonDensity);
+      46             :         }
+      47             : }
+      48             : 
+      49             : 
+      50       16757 : double TabularPhotonField::getRedshiftScaling(double z) const {
+      51       16757 :         if (!this->isRedshiftDependent)
+      52             :                 return 1.;
+      53             :  
+      54       16573 :         if (z < this->redshifts.front())
+      55             :                 return 1.;
+      56             :  
+      57       16573 :         if (z > this->redshifts.back())
+      58             :                 return 0.;
+      59             :  
+      60       16573 :         return interpolate(z, this->redshifts, this->redshiftScalings);
+      61             : }
+      62             : 
+      63           0 : double TabularPhotonField::getMinimumPhotonEnergy(double z) const{
+      64           0 :         return photonEnergies[0];
+      65             : }
+      66             : 
+      67           0 : double TabularPhotonField::getMaximumPhotonEnergy(double z) const{
+      68           0 :         return photonEnergies[photonEnergies.size() -1];
+      69             : }
+      70             : 
+      71          94 : void TabularPhotonField::readPhotonEnergy(std::string filePath) {
+      72          94 :         std::ifstream infile(filePath.c_str());
+      73          94 :         if (!infile.good())
+      74           0 :                 throw std::runtime_error("TabularPhotonField::readPhotonEnergy: could not open " + filePath);
+      75             : 
+      76             :         std::string line;
+      77       15320 :         while (std::getline(infile, line)) {
+      78       15226 :                 if ((line.size() > 0) & (line[0] != '#') )
+      79       14944 :                         this->photonEnergies.push_back(std::stod(line));
+      80             :         }
+      81          94 :         infile.close();
+      82          94 : }
+      83             : 
+      84          94 : void TabularPhotonField::readPhotonDensity(std::string filePath) {
+      85          94 :         std::ifstream infile(filePath.c_str());
+      86          94 :         if (!infile.good())
+      87           0 :                 throw std::runtime_error("TabularPhotonField::readPhotonDensity: could not open " + filePath);
+      88             : 
+      89             :         std::string line;
+      90     4772519 :         while (std::getline(infile, line)) {
+      91     4772425 :                 if ((line.size() > 0) & (line[0] != '#') )
+      92     4772143 :                         this->photonDensity.push_back(std::stod(line));
+      93             :         }
+      94          94 :         infile.close();
+      95          94 : }
+      96             : 
+      97          73 : void TabularPhotonField::readRedshift(std::string filePath) {
+      98          73 :         std::ifstream infile(filePath.c_str());
+      99          73 :         if (!infile.good())
+     100           0 :                 throw std::runtime_error("TabularPhotonField::initRedshift: could not open " + filePath);
+     101             : 
+     102             :         std::string line;
+     103       14599 :         while (std::getline(infile, line)) {
+     104       14526 :                 if ((line.size() > 0) & (line[0] != '#') )
+     105       14307 :                         this->redshifts.push_back(std::stod(line));
+     106             :         }
+     107          73 :         infile.close();
+     108          73 : }
+     109             : 
+     110          73 : void TabularPhotonField::initRedshiftScaling() {
+     111             :         double n0 = 0.;
+     112       14380 :         for (int i = 0; i < this->redshifts.size(); ++i) {
+     113       14307 :                 double z = this->redshifts[i];
+     114             :                 double n = 0.;
+     115     4770022 :                 for (int j = 0; j < this->photonEnergies.size()-1; ++j) {
+     116     4755715 :                         double e_j = this->photonEnergies[j];
+     117     4755715 :                         double e_j1 = this->photonEnergies[j+1];
+     118     4755715 :                         double deltaLogE = std::log10(e_j1) - std::log10(e_j);
+     119     4755715 :                         if (z == 0.)
+     120       12750 :                                 n0 += (getPhotonDensity(e_j, 0) + getPhotonDensity(e_j1, 0)) / 2. * deltaLogE;
+     121     4755715 :                         n += (getPhotonDensity(e_j, z) + getPhotonDensity(e_j1, z)) / 2. * deltaLogE;
+     122             :                 }
+     123       14307 :                 this->redshiftScalings.push_back(n / n0);
+     124             :         }
+     125          73 : }
+     126             : 
+     127          94 : void TabularPhotonField::checkInputData() const {
+     128          94 :         if (this->isRedshiftDependent) {
+     129          73 :                 if (this->photonDensity.size() != this->photonEnergies.size() * this-> redshifts.size())
+     130           0 :                         throw std::runtime_error("TabularPhotonField::checkInputData: length of photon density input is unequal to length of photon energy input times length of redshift input");
+     131             :         } else {
+     132          21 :                 if (this->photonEnergies.size() != this->photonDensity.size())
+     133           0 :                         throw std::runtime_error("TabularPhotonField::checkInputData: length of photon energy input is unequal to length of photon density input");
+     134             :         }
+     135             : 
+     136       15038 :         for (int i = 0; i < this->photonEnergies.size(); ++i) {
+     137             :                 double ePrevious = 0.;
+     138       14944 :                 double e = this->photonEnergies[i];
+     139       14944 :                 if (e <= 0.)
+     140           0 :                         throw std::runtime_error("TabularPhotonField::checkInputData: a value in the photon energy input is not positive");
+     141             :                 if (e <= ePrevious)
+     142             :                         throw std::runtime_error("TabularPhotonField::checkInputData: photon energy values are not strictly increasing");
+     143             :                 ePrevious = e;
+     144             :         }
+     145             : 
+     146     4772237 :         for (int i = 0; i < this->photonDensity.size(); ++i) {
+     147     4772143 :                 if (this->photonDensity[i] < 0.)
+     148           0 :                         throw std::runtime_error("TabularPhotonField::checkInputData: a value in the photon density input is negative");
+     149             :         }
+     150             : 
+     151          94 :         if (this->isRedshiftDependent) {
+     152          73 :                 if (this->redshifts[0] != 0.)
+     153           0 :                         throw std::runtime_error("TabularPhotonField::checkInputData: redshift input must start with zero");
+     154             : 
+     155       14380 :                 for (int i = 0; i < this->redshifts.size(); ++i) {
+     156             :                         double zPrevious = -1.;
+     157       14307 :                         double z = this->redshifts[i];
+     158       14307 :                         if (z < 0.)
+     159           0 :                                 throw std::runtime_error("TabularPhotonField::checkInputData: a value in the redshift input is negative");
+     160       14307 :                         if (z <= zPrevious)
+     161           0 :                                 throw std::runtime_error("TabularPhotonField::checkInputData: redshift values are not strictly increasing");
+     162             :                         zPrevious = z;
+     163             :                 }
+     164             : 
+     165          73 :                 for (int i = 0; i < this->redshiftScalings.size(); ++i) {
+     166           0 :                         double scalingFactor = this->redshiftScalings[i];
+     167           0 :                         if (scalingFactor <= 0.)
+     168           0 :                                 throw std::runtime_error("TabularPhotonField::checkInputData: initRedshiftScaling has created a non-positive scaling factor");
+     169             :                 }
+     170             :         }
+     171          94 : }
+     172             : 
+     173          40 : BlackbodyPhotonField::BlackbodyPhotonField(std::string fieldName, double blackbodyTemperature) {
+     174          40 :         this->fieldName = fieldName;
+     175          40 :         this->blackbodyTemperature = blackbodyTemperature;
+     176          40 :         this->quantile = 0.0001; // tested to be sufficient, only used for extreme values of primary energy or temperature
+     177          40 : }
+     178             : 
+     179       10689 : double BlackbodyPhotonField::getPhotonDensity(double Ephoton, double z) const {
+     180       10689 :         return 8 * M_PI * pow_integer<3>(Ephoton / (h_planck * c_light)) / std::expm1(Ephoton / (k_boltzmann * this->blackbodyTemperature));
+     181             : }
+     182             : 
+     183          29 : double BlackbodyPhotonField::getMinimumPhotonEnergy(double z) const {
+     184             :         double A;
+     185          29 :         int quantile_int = 10000 * quantile;
+     186          29 :         switch (quantile_int)
+     187             :         {
+     188             :         case 1: // 0.01 % percentil
+     189             :                 A = 1.093586e-5 * eV / kelvin;
+     190             :                 break;
+     191           0 :         case 10:                // 0.1 % percentil
+     192             :                 A = 2.402189e-5 * eV / kelvin;
+     193           0 :                 break;
+     194           0 :         case 100:               // 1 % percentil
+     195             :                 A = 5.417942e-5 * eV / kelvin;
+     196           0 :                 break;
+     197           0 :         default:
+     198           0 :                 throw std::runtime_error("Quantile not understood. Please use 0.01 (1%), 0.001 (0.1%) or 0.0001 (0.01%) \n");
+     199             :                 break;
+     200             :         }
+     201          29 :         return A * this -> blackbodyTemperature;
+     202             : }
+     203             : 
+     204          29 : double BlackbodyPhotonField::getMaximumPhotonEnergy(double z) const {
+     205          29 :         double factor = std::max(1., blackbodyTemperature / 2.73);
+     206          29 :         return 0.1 * factor * eV; // T dependent scaling, starting at 0.1 eV as suitable for CMB
+     207             : }
+     208             : 
+     209           0 : void BlackbodyPhotonField::setQuantile(double q) {
+     210           0 :         if(not ((q == 0.0001) or (q == 0.001) or (q == 0.01)))
+     211           0 :                 throw std::runtime_error("Quantile not understood. Please use 0.01 (1%), 0.001 (0.1%) or 0.0001 (0.01%) \n");
+     212           0 :         this -> quantile = q;
+     213           0 : }
+     214             : 
+     215             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/ProgressBar.cpp.func-sort-c.html b/doc/coverageReport/src/ProgressBar.cpp.func-sort-c.html new file mode 100644 index 000000000..5818e83f3 --- /dev/null +++ b/doc/coverageReport/src/ProgressBar.cpp.func-sort-c.html @@ -0,0 +1,92 @@ + + + + + + + LCOV - coverage.info.cleaned - src/ProgressBar.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - ProgressBar.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:395078.0 %
Date:2024-04-08 14:58:22Functions:4580.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11ProgressBar8setErrorEv0
_ZN7crpropa11ProgressBar5startERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa11ProgressBarC2Emm5
_ZN7crpropa11ProgressBar11setPositionEm100
_ZN7crpropa11ProgressBar6updateEv100
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/ProgressBar.cpp.func.html b/doc/coverageReport/src/ProgressBar.cpp.func.html new file mode 100644 index 000000000..eabab3799 --- /dev/null +++ b/doc/coverageReport/src/ProgressBar.cpp.func.html @@ -0,0 +1,92 @@ + + + + + + + LCOV - coverage.info.cleaned - src/ProgressBar.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - ProgressBar.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:395078.0 %
Date:2024-04-08 14:58:22Functions:4580.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11ProgressBar11setPositionEm100
_ZN7crpropa11ProgressBar5startERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa11ProgressBar6updateEv100
_ZN7crpropa11ProgressBar8setErrorEv0
_ZN7crpropa11ProgressBarC2Emm5
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/ProgressBar.cpp.gcov.html b/doc/coverageReport/src/ProgressBar.cpp.gcov.html new file mode 100644 index 000000000..4bcb4bfab --- /dev/null +++ b/doc/coverageReport/src/ProgressBar.cpp.gcov.html @@ -0,0 +1,153 @@ + + + + + + + LCOV - coverage.info.cleaned - src/ProgressBar.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - ProgressBar.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:395078.0 %
Date:2024-04-08 14:58:22Functions:4580.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/ProgressBar.h"
+       2             : 
+       3             : #include <cstdio>
+       4             : #include <iostream>
+       5             : 
+       6             : namespace crpropa {
+       7             : 
+       8             : /// Initialize a ProgressBar with [steps] number of steps, updated at [updateSteps] intervalls
+       9           5 : ProgressBar::ProgressBar(unsigned long steps, unsigned long updateSteps) :
+      10           5 :                 _steps(steps), _currentCount(0), _maxbarLength(10), _updateSteps(
+      11           5 :                                 updateSteps), _nextStep(1), _startTime(0) {
+      12           5 :         if (_updateSteps > _steps)
+      13           3 :                 _updateSteps = _steps;
+      14           5 :         arrow.append(">");
+      15           5 : }
+      16             : 
+      17           1 : void ProgressBar::start(const std::string &title) {
+      18           1 :         _startTime = time(NULL);
+      19           1 :         std::string s = ctime(&_startTime);
+      20           1 :         s.erase(s.end() - 1, s.end());
+      21           1 :         stringTmpl = "  Started ";
+      22             :         stringTmpl.append(s);
+      23           1 :         stringTmpl.append(" : [%-10s] %3i%%    %s: %02i:%02i:%02i %s\r");
+      24             :         std::cout << title << std::endl;
+      25             : 
+      26           1 : }
+      27             : /// update the progressbar
+      28             : /// should be called steps times in a loop
+      29         100 : void ProgressBar::update() {
+      30         100 :         _currentCount++;
+      31         100 :         if (_currentCount == _nextStep || _currentCount == _steps
+      32           0 :                         || _currentCount == 1000) {
+      33         100 :                                 _nextStep += long(_steps / float(_updateSteps));
+      34         100 :                         setPosition(_currentCount);
+      35             :                         }
+      36         100 : }
+      37             : 
+      38         100 : void ProgressBar::setPosition(unsigned long position) {
+      39         100 :         int percentage = int(100 * (position / float(_steps)));
+      40         100 :         time_t currentTime = time(NULL);
+      41         100 :         if (position < _steps) {
+      42          99 :                 if (arrow.size() <= (_maxbarLength) * (position) / (_steps))
+      43           9 :                         arrow.insert(0, "=");
+      44          99 :                 float tElapsed = currentTime - _startTime;
+      45          99 :                 float tToGo = (_steps - position) * tElapsed / position;
+      46          99 :                 std::printf(stringTmpl.c_str(), arrow.c_str(), percentage, "Finish in",
+      47          99 :                                 int(tToGo / 3600), (int(tToGo) % 3600) / 60,
+      48          99 :                                 int(tToGo) % 60, "");
+      49          99 :                 fflush(stdout);
+      50             :         } else {
+      51           1 :                 float tElapsed = currentTime - _startTime;
+      52           1 :                 std::string s = " - Finished at ";
+      53           1 :                 s.append(ctime(&currentTime));
+      54             :                 char fs[255];
+      55             :                 std::sprintf(fs, "%c[%d;%dm Finished %c[%dm", 27, 1, 32, 27, 0);
+      56           1 :                 std::printf(stringTmpl.c_str(), fs, 100, "Needed",
+      57           1 :                                 int(tElapsed / 3600), (int(tElapsed) % 3600) / 60,
+      58           1 :                                 int(tElapsed) % 60, s.c_str());
+      59             :         }
+      60         100 : }
+      61             : 
+      62             : 
+      63             : /// Mark the progressbar with an error
+      64           0 : void ProgressBar::setError() {
+      65           0 :         time_t currentTime = time(NULL);
+      66           0 :         _currentCount++;
+      67           0 :         float tElapsed = currentTime - _startTime;
+      68           0 :         std::string s = " - Finished at ";
+      69           0 :         s.append(ctime(&currentTime));
+      70             :         char fs[255];
+      71             :         std::sprintf(fs, "%c[%d;%dm  ERROR   %c[%dm", 27, 1, 31, 27, 0);
+      72           0 :         std::printf(stringTmpl.c_str(), fs, _currentCount, "Needed",
+      73           0 :                         int(tElapsed / 3600), (int(tElapsed) % 3600) / 60,
+      74           0 :                         int(tElapsed) % 60, s.c_str());
+      75           0 : }
+      76             : 
+      77             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Random.cpp.func-sort-c.html b/doc/coverageReport/src/Random.cpp.func-sort-c.html new file mode 100644 index 000000000..e9ea9e87a --- /dev/null +++ b/doc/coverageReport/src/Random.cpp.func-sort-c.html @@ -0,0 +1,256 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Random.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Random.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13924157.7 %
Date:2024-04-08 14:58:22Functions:264656.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa6Random10randDblExcERKd0
_ZN7crpropa6Random11seedThreadsEj0
_ZN7crpropa6Random12randRayleighEd0
_ZN7crpropa6Random14getSeedThreadsEv0
_ZN7crpropa6Random15randExponentialEv0
_ZN7crpropa6Random18randBrokenPowerLawEddddd0
_ZN7crpropa6Random18randVectorLambertsERKNS_7Vector3IdEE0
_ZN7crpropa6Random18randVectorLambertsEv0
_ZN7crpropa6Random4hashEll0
_ZN7crpropa6Random4loadEPj0
_ZN7crpropa6Random4randERKd0
_ZN7crpropa6Random6rand53Ev0
_ZN7crpropa6Random7randExcERKd0
_ZN7crpropa6Random7randIntERKj0
_ZN7crpropa6RandomC2EPjj0
_ZN7crpropa6RandomC2ERKj0
_ZN7crpropalsERSoRKNS_6RandomE0
_ZN7crproparsERSiRNS_6RandomE0
_ZNK7crpropa6Random14getSeed_base64B5cxx11Ev0
_ZNK7crpropa6Random4saveEPj0
_ZN7crpropa6Random4seedERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZNK7crpropa6Random7getSeedEv2
_ZN7crpropa6Random4seedEj13
_ZN7crpropa6Random9randInt64ERKm421
_ZN7crpropa6Random9randInt64Ev864
_ZN7crpropa6Random10randFisherEd1000
_ZN7crpropa6Random16randFisherVectorERKNS_7Vector3IdEEd1000
_ZN7crpropa6Random12randPowerLawEddd1104
_ZN7crpropa6Random4seedEv4881
_ZN7crpropa6RandomC2Ev4881
_ZN7crpropa6Random4seedEPjj4884
_ZN7crpropa6Random10initializeEj4897
_ZN7crpropa6Random7randBinERKSt6vectorIfSaIfEE10102
_ZN7crpropa6Random6reloadEv46321
_ZN7crpropa6Random14randConeVectorERKNS_7Vector3IdEEd480001
_ZN7crpropa6Random20randVectorAroundMeanERKNS_7Vector3IdEEd481001
_ZN7crpropa6Random10randVectorEv962203
_ZN7crpropa6Random10randDblExcEv1715954
_ZN7crpropa6Random7randExcEv1715954
_ZN7crpropa6Random8randNormERKdS2_1715954
_ZN7crpropa6Random11randUniformEdd2404687
_ZN7crpropa6Random8instanceEv2658589
_ZN7crpropa6Random26randomInterpolatedPositionERKNS_7Vector3IdEES4_3628723
_ZN7crpropa6Random7randBinERKSt6vectorIdSaIdEE3739276
_ZN7crpropa6Random4randEv22414108
_ZN7crpropa6Random7randIntEv25852694
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Random.cpp.func.html b/doc/coverageReport/src/Random.cpp.func.html new file mode 100644 index 000000000..c6e8901c8 --- /dev/null +++ b/doc/coverageReport/src/Random.cpp.func.html @@ -0,0 +1,256 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Random.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Random.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13924157.7 %
Date:2024-04-08 14:58:22Functions:264656.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa6Random10initializeEj4897
_ZN7crpropa6Random10randDblExcERKd0
_ZN7crpropa6Random10randDblExcEv1715954
_ZN7crpropa6Random10randFisherEd1000
_ZN7crpropa6Random10randVectorEv962203
_ZN7crpropa6Random11randUniformEdd2404687
_ZN7crpropa6Random11seedThreadsEj0
_ZN7crpropa6Random12randPowerLawEddd1104
_ZN7crpropa6Random12randRayleighEd0
_ZN7crpropa6Random14getSeedThreadsEv0
_ZN7crpropa6Random14randConeVectorERKNS_7Vector3IdEEd480001
_ZN7crpropa6Random15randExponentialEv0
_ZN7crpropa6Random16randFisherVectorERKNS_7Vector3IdEEd1000
_ZN7crpropa6Random18randBrokenPowerLawEddddd0
_ZN7crpropa6Random18randVectorLambertsERKNS_7Vector3IdEE0
_ZN7crpropa6Random18randVectorLambertsEv0
_ZN7crpropa6Random20randVectorAroundMeanERKNS_7Vector3IdEEd481001
_ZN7crpropa6Random26randomInterpolatedPositionERKNS_7Vector3IdEES4_3628723
_ZN7crpropa6Random4hashEll0
_ZN7crpropa6Random4loadEPj0
_ZN7crpropa6Random4randERKd0
_ZN7crpropa6Random4randEv22414108
_ZN7crpropa6Random4seedEPjj4884
_ZN7crpropa6Random4seedERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa6Random4seedEj13
_ZN7crpropa6Random4seedEv4881
_ZN7crpropa6Random6rand53Ev0
_ZN7crpropa6Random6reloadEv46321
_ZN7crpropa6Random7randBinERKSt6vectorIdSaIdEE3739276
_ZN7crpropa6Random7randBinERKSt6vectorIfSaIfEE10102
_ZN7crpropa6Random7randExcERKd0
_ZN7crpropa6Random7randExcEv1715954
_ZN7crpropa6Random7randIntERKj0
_ZN7crpropa6Random7randIntEv25852694
_ZN7crpropa6Random8instanceEv2658589
_ZN7crpropa6Random8randNormERKdS2_1715954
_ZN7crpropa6Random9randInt64ERKm421
_ZN7crpropa6Random9randInt64Ev864
_ZN7crpropa6RandomC2EPjj0
_ZN7crpropa6RandomC2ERKj0
_ZN7crpropa6RandomC2Ev4881
_ZN7crpropalsERSoRKNS_6RandomE0
_ZN7crproparsERSiRNS_6RandomE0
_ZNK7crpropa6Random14getSeed_base64B5cxx11Ev0
_ZNK7crpropa6Random4saveEPj0
_ZNK7crpropa6Random7getSeedEv2
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Random.cpp.gcov.html b/doc/coverageReport/src/Random.cpp.gcov.html new file mode 100644 index 000000000..4aaef80c6 --- /dev/null +++ b/doc/coverageReport/src/Random.cpp.gcov.html @@ -0,0 +1,605 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Random.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Random.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13924157.7 %
Date:2024-04-08 14:58:22Functions:264656.5 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : // Random.cpp is based on Random.h
+       2             : // Mersenne Twister random number generator -- a C++ class Random
+       3             : // Based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus
+       4             : // Richard J. Wagner  v1.0  15 May 2003  rjwagner@writeme.com
+       5             : 
+       6             : // The Mersenne Twister is an algorithm for generating random numbers.  It
+       7             : // was designed with consideration of the flaws in various other generators.
+       8             : // The period, 2^19937-1, and the order of equidistribution, 623 dimensions,
+       9             : // are far greater.  The generator is also fast; it avoids multiplication and
+      10             : // division, and it benefits from caches and pipelines.  For more information
+      11             : // see the inventors' web page at http://www.math.keio.ac.jp/~matumoto/emt.html
+      12             : 
+      13             : // Reference
+      14             : // M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-Dimensionally
+      15             : // Equidistributed Uniform Pseudo-Random Number Generator", ACM Transactions on
+      16             : // Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3-30.
+      17             : 
+      18             : // Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
+      19             : // Copyright (C) 2000 - 2003, Richard J. Wagner
+      20             : // All rights reserved.                          
+      21             : //
+      22             : // Redistribution and use in source and binary forms, with or without
+      23             : // modification, are permitted provided that the following conditions
+      24             : // are met:
+      25             : //
+      26             : //   1. Redistributions of source code must retain the above copyright
+      27             : //      notice, this list of conditions and the following disclaimer.
+      28             : //
+      29             : //   2. Redistributions in binary form must reproduce the above copyright
+      30             : //      notice, this list of conditions and the following disclaimer in the
+      31             : //      documentation and/or other materials provided with the distribution.
+      32             : //
+      33             : //   3. The names of its contributors may not be used to endorse or promote 
+      34             : //      products derived from this software without specific prior written 
+      35             : //      permission.
+      36             : //
+      37             : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+      38             : // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+      39             : // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+      40             : // A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+      41             : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+      42             : // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+      43             : // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+      44             : // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+      45             : // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+      46             : // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+      47             : // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+      48             : 
+      49             : // The original code included the following notice:
+      50             : //
+      51             : //     When you use this, send an email to: matumoto@math.keio.ac.jp
+      52             : //     with an appropriate reference to your work.
+      53             : //
+      54             : // It would be nice to CC: rjwagner@writeme.com and Cokus@math.washington.edu
+      55             : // when you write.
+      56             : 
+      57             : // Parts of this file are modified beginning in 29.10.09 for adaption in PXL.
+      58             : // Parts of this file are modified beginning in 10.02.12 for adaption in CRPropa.
+      59             : 
+      60             : #include "crpropa/Random.h"
+      61             : 
+      62             : #include "crpropa/base64.h"
+      63             : 
+      64             : #include <cstdio>
+      65             : 
+      66             : namespace crpropa {
+      67             : 
+      68           0 : Random::Random(const uint32_t& oneSeed) {
+      69           0 :         seed(oneSeed);
+      70           0 : }
+      71             : 
+      72           0 : Random::Random(uint32_t * const bigSeed, const uint32_t seedLength) {
+      73           0 :         seed(bigSeed, seedLength);
+      74           0 : }
+      75             : 
+      76        4881 : Random::Random() {
+      77        4881 :         seed();
+      78        4881 : }
+      79             : 
+      80    22414108 : double Random::rand() {
+      81    22414108 :         return double(randInt()) * (1.0 / 4294967295.0);
+      82             : }
+      83             : 
+      84           0 : double Random::rand(const double& n) {
+      85           0 :         return rand() * n;
+      86             : }
+      87             : 
+      88     1715954 : double Random::randExc() {
+      89     1715954 :         return double(randInt()) * (1.0 / 4294967296.0);
+      90             : }
+      91             : 
+      92           0 : double Random::randExc(const double& n) {
+      93           0 :         return randExc() * n;
+      94             : }
+      95             : 
+      96     1715954 : double Random::randDblExc() {
+      97     1715954 :         return (double(randInt()) + 0.5) * (1.0 / 4294967296.0);
+      98             : }
+      99             : 
+     100           0 : double Random::randDblExc(const double& n) {
+     101           0 :         return randDblExc() * n;
+     102             : }
+     103             : 
+     104           0 : double Random::rand53() {
+     105           0 :         uint32_t a = randInt() >> 5, b = randInt() >> 6;
+     106           0 :         return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0); // by Isaku Wada
+     107             : }
+     108             : 
+     109             : // Return a real number from a normal (Gaussian) distribution with given
+     110             : // mean and variance by Box-Muller method
+     111     1715954 : double Random::randNorm(const double& mean, const double& variance) {
+     112     1715954 :         double r = sqrt(-2.0 * log(1.0 - randDblExc())) * variance;
+     113     1715954 :         double phi = 2.0 * 3.14159265358979323846264338328 * randExc();
+     114     1715954 :         return mean + r * cos(phi);
+     115             : }
+     116             : 
+     117     2404687 : double Random::randUniform(double min, double max) {
+     118     2404687 :         return min + (max - min) * rand();
+     119             : }
+     120             : 
+     121           0 : double Random::randRayleigh(double sigma) {
+     122           0 :         return sigma * sqrt(-2.0 * log(1 - rand()));
+     123             : }
+     124             : 
+     125        1000 : double Random::randFisher(double kappa) {
+     126        1000 :         return acos(1. + 1. / kappa * log(1 - rand() * (1 - exp(-2 * kappa))));
+     127             : }
+     128             : 
+     129       10102 : size_t Random::randBin(const std::vector<float> &cdf) {
+     130             :         std::vector<float>::const_iterator it = std::lower_bound(cdf.begin(),
+     131       10102 :                         cdf.end(), rand() * cdf.back());
+     132       10102 :         return it - cdf.begin();
+     133             : }
+     134             : 
+     135     3739276 : size_t Random::randBin(const std::vector<double> &cdf) {
+     136             :         std::vector<double>::const_iterator it = std::lower_bound(cdf.begin(),
+     137     3739276 :                         cdf.end(), rand() * cdf.back());
+     138     3739276 :         return it - cdf.begin();
+     139             : }
+     140             : 
+     141      962203 : Vector3d Random::randVector() {
+     142      962203 :         double z = randUniform(-1.0, 1.0);
+     143      962203 :         double t = randUniform(-1.0 * M_PI, M_PI);
+     144      962203 :         double r = sqrt(1 - z * z);
+     145      962203 :         return Vector3d(r * cos(t), r * sin(t), z);
+     146             : }
+     147             : 
+     148      481001 : Vector3d Random::randVectorAroundMean(const Vector3d &meanDirection,
+     149             :                 double angle) {
+     150      481001 :         Vector3d axis = meanDirection.cross(randVector());
+     151             :         Vector3d v = meanDirection;
+     152      481001 :         return v.getRotated(axis, angle);
+     153             : }
+     154             : 
+     155        1000 : Vector3d Random::randFisherVector(const Vector3d &meanDirection, double kappa) {
+     156        1000 :         return randVectorAroundMean(meanDirection, randFisher(kappa));
+     157             : }
+     158             : 
+     159      480001 : Vector3d Random::randConeVector(const Vector3d &meanDirection, double angularRadius) {
+     160      480001 :         const double theta = acos(randUniform(1, cos(angularRadius)));
+     161      480001 :         return randVectorAroundMean(meanDirection, theta);
+     162             : }
+     163             : 
+     164           0 : Vector3d Random::randVectorLamberts() {
+     165             :         // random vector following Lamberts cosine law (https://en.wikipedia.org/wiki/Lambert%27s_cosine_law)
+     166             :         // for a surface element with normal vector pointing in positive z-axis (0, 0, 1)
+     167           0 :         double phi = randUniform(-1.0 * M_PI, M_PI);
+     168           0 :         double theta = M_PI / 2.0 - acos(sqrt(randUniform(0, 1)));
+     169           0 :         return Vector3d(cos(phi) * cos(theta), sin(phi) * cos(theta), sin(theta));
+     170             : }
+     171             : 
+     172           0 : Vector3d Random::randVectorLamberts(const Vector3d &normalVector) {
+     173             :         // random vector following Lamberts cosine law for a surface element described by normalVector
+     174           0 :         Vector3d vLambertz = randVectorLamberts();
+     175             :         // find rotation axis that rotates the z-axis to the normalVector of the surface element
+     176             :         Vector3d axis = normalVector.cross(Vector3d(0, 0, 1));
+     177           0 :         if (axis.getR() < std::numeric_limits<double>::epsilon()) {
+     178             :                 axis = Vector3d(0, 0, 1);
+     179             :         }
+     180           0 :         double angle = normalVector.getAngleTo(Vector3d(0, 0, 1));
+     181             :         // rotate the random Lamberts vector from z-axis to respective surface element
+     182           0 :         return vLambertz.getRotated(axis / axis.getR(), -angle);
+     183             : }
+     184             : 
+     185     3628723 : Vector3d Random::randomInterpolatedPosition(const Vector3d &a, const Vector3d &b) {
+     186     3628723 :         return a + rand() * (b - a);
+     187             : }
+     188             : 
+     189        1104 : double Random::randPowerLaw(double index, double min, double max) {
+     190        1104 :         if ((min < 0) || (max < min)) {
+     191           0 :                 throw std::runtime_error(
+     192           0 :                                 "Power law distribution only possible for 0 <= min <= max");
+     193             :         }
+     194             :         //check for index -1!
+     195        1104 :         if ((std::abs(index + 1.0)) < std::numeric_limits<double>::epsilon()) {
+     196           2 :                 double part1 = log(max);
+     197           2 :                 double part2 = log(min);
+     198           2 :                 return exp((part1 - part2) * rand() + part2);
+     199             :         } else {
+     200        1102 :                 double part1 = pow(max, index + 1);
+     201        1102 :                 double part2 = pow(min, index + 1);
+     202        1102 :                 double ex = 1 / (index + 1);
+     203        1102 :                 return pow((part1 - part2) * rand() + part2, ex);
+     204             :         }
+     205             : }
+     206             : 
+     207           0 : double Random::randBrokenPowerLaw(double index1, double index2,
+     208             :                 double breakpoint, double min, double max) {
+     209           0 :         if ((min <= 0) || (max < min)) {
+     210           0 :                 throw std::runtime_error(
+     211           0 :                                 "Power law distribution only possible for 0 < min <= max");
+     212             :         }
+     213           0 :         if (min >= breakpoint) {
+     214           0 :                 return this->randPowerLaw(index2, min, max);
+     215           0 :         } else if (max <= breakpoint) {
+     216           0 :                 return this->randPowerLaw(index2, min, max);
+     217             :         } else {
+     218             :                 double intPL1;
+     219             :                 // check if index1 = -1
+     220           0 :                 if ((std::abs(index1 + 1.0)) < std::numeric_limits<double>::epsilon()) {
+     221           0 :                         intPL1 = log(breakpoint / min);
+     222             :                 } else {
+     223           0 :                         intPL1 = (pow(breakpoint, index1 + 1) - pow(min, index1 + 1))
+     224             :                                         / (index1 + 1);
+     225             :                 }
+     226             :                 double intPL2;
+     227             :                 // check if index2 = -1
+     228           0 :                 if ((std::abs(index2 + 1.0)) < std::numeric_limits<double>::epsilon()) {
+     229           0 :                         intPL2 = log(max / breakpoint) * pow(breakpoint, index1 - index2);
+     230             :                 } else {
+     231           0 :                         intPL2 = (pow(max, index2 + 1) - pow(breakpoint, index2 + 1))
+     232           0 :                                         * pow(breakpoint, index1 - index2) / (index2 + 1);
+     233             :                 }
+     234           0 :                 if (rand() > intPL1 / (intPL1 + intPL2))
+     235           0 :                         return randPowerLaw(index2, breakpoint, max);
+     236             :                 else
+     237           0 :                         return randPowerLaw(index1, min, breakpoint);
+     238             :         }
+     239             : }
+     240             : 
+     241           0 : double Random::randExponential() {
+     242             :         double dum;
+     243             :         do {
+     244           0 :                 dum = rand();
+     245           0 :         } while (dum < std::numeric_limits<double>::epsilon());
+     246           0 :         return -1.0 * log(dum);
+     247             : }
+     248             : 
+     249    25852694 : uint32_t Random::randInt() {
+     250    25852694 :         if (left == 0)
+     251       41424 :                 reload();
+     252    25852694 :         --left;
+     253             : 
+     254             :         uint32_t s1;
+     255    25852694 :         s1 = *pNext++;
+     256    25852694 :         s1 ^= (s1 >> 11);
+     257    25852694 :         s1 ^= (s1 << 7) & 0x9d2c5680UL;
+     258    25852694 :         s1 ^= (s1 << 15) & 0xefc60000UL;
+     259    25852694 :         return (s1 ^ (s1 >> 18));
+     260             : }
+     261             : 
+     262           0 : uint32_t Random::randInt(const uint32_t& n) {
+     263             : // Find which bits are used in n
+     264             : // Optimized by Magnus Jonsson (magnus@smartelectronix.com)
+     265           0 :         uint32_t used = n;
+     266           0 :         used |= used >> 1;
+     267           0 :         used |= used >> 2;
+     268           0 :         used |= used >> 4;
+     269           0 :         used |= used >> 8;
+     270           0 :         used |= used >> 16;
+     271             : 
+     272             : // Draw numbers until one is found in [0,n]
+     273             :         uint32_t i;
+     274             :         do
+     275           0 :                 i = randInt() & used; // toss unused bits to shorten search
+     276           0 :         while (i > n);
+     277           0 :         return i;
+     278             : }
+     279             : 
+     280             : 
+     281         864 : uint64_t Random::randInt64()
+     282             : {
+     283         864 :         int64_t a = randInt();
+     284         864 :         int64_t b = randInt();
+     285         864 :         return (b + a << 32);
+     286             : }
+     287             : 
+     288             : 
+     289         421 : uint64_t Random::randInt64(const uint64_t &n)
+     290             : {
+     291         421 :         uint64_t used = n;
+     292         421 :         used |= used >> 1;
+     293         421 :         used |= used >> 2;
+     294         421 :         used |= used >> 4;
+     295         421 :         used |= used >> 8;
+     296         421 :         used |= used >> 16;
+     297         421 :         used |= used >> 32;
+     298             : 
+     299             :         // Draw numbers until one is found in [0,n]
+     300             :         uint64_t i;
+     301             :         do
+     302         864 :                 i = randInt64() & used; // toss unused bits to shorten search
+     303         864 :         while (i > n);
+     304         421 :         return i;
+     305             : }
+     306             : 
+     307             : 
+     308             : 
+     309          13 : void Random::seed(const uint32_t oneSeed) {
+     310          13 :         initial_seed.resize(1);
+     311          13 :         initial_seed[0] = oneSeed;
+     312          13 :         initialize(oneSeed);
+     313          13 :         reload();
+     314          13 : }
+     315             : 
+     316        4884 : void Random::seed(uint32_t * const bigSeed, const uint32_t seedLength) {
+     317             : 
+     318        4884 :         initial_seed.resize(seedLength);
+     319     3051260 :         for (size_t i =0; i< seedLength; i++)
+     320             :         {
+     321     3046376 :                 initial_seed[i] = bigSeed[i];
+     322             :         }
+     323             : 
+     324        4884 :         initialize(19650218UL);
+     325             :         int i = 1;
+     326             :         uint32_t j = 0;
+     327        4884 :         int k = (N > seedLength ? N : seedLength);
+     328     3052500 :         for (; k; --k) {
+     329     3047616 :                 state[i] = state[i]
+     330     3047616 :                                 ^ ((state[i - 1] ^ (state[i - 1] >> 30)) * 1664525UL);
+     331     3047616 :                 state[i] += (bigSeed[j] & 0xffffffffUL) + j;
+     332             :                 state[i] &= 0xffffffffUL;
+     333     3047616 :                 ++i;
+     334     3047616 :                 ++j;
+     335     3047616 :                 if (i >= N) {
+     336        4884 :                         state[0] = state[N - 1];
+     337             :                         i = 1;
+     338             :                 }
+     339     3047616 :                 if (j >= seedLength)
+     340             :                         j = 0;
+     341             :         }
+     342     3047616 :         for (k = N - 1; k; --k) {
+     343     3042732 :                 state[i] = state[i]
+     344     3042732 :                                 ^ ((state[i - 1] ^ (state[i - 1] >> 30)) * 1566083941UL);
+     345     3042732 :                 state[i] -= i;
+     346             :                 state[i] &= 0xffffffffUL;
+     347     3042732 :                 ++i;
+     348     3042732 :                 if (i >= N) {
+     349        4884 :                         state[0] = state[N - 1];
+     350             :                         i = 1;
+     351             :                 }
+     352             :         }
+     353        4884 :         state[0] = 0x80000000UL; // MSB is 1, assuring non-zero initial array
+     354        4884 :         reload();
+     355        4884 : }
+     356             : 
+     357        4881 : void Random::seed() {
+     358             : // First try getting an array from /dev/urandom
+     359        4881 :         FILE* urandom = std::fopen("/dev/urandom", "rb");
+     360        4881 :         if (urandom) {
+     361             :                 uint32_t bigSeed[N];
+     362             :                 uint32_t *s = bigSeed;
+     363             :                 int i = N;
+     364             :                 bool success = true;
+     365     3050625 :                 while (success && i--)
+     366     6091488 :                         success = std::fread(s++, sizeof(uint32_t), 1, urandom) != 0;
+     367        4881 :                 std::fclose(urandom);
+     368        4881 :                 if (success) {
+     369        4881 :                         seed(bigSeed, N);
+     370        4881 :                         return;
+     371             :                 }
+     372             :         }
+     373             : 
+     374             : // Was not successful, so use time() and clock() instead
+     375           0 :         seed(hash(time(NULL), clock()));
+     376             : }
+     377             : 
+     378             : 
+     379        4897 : void Random::initialize(const uint32_t seed) {
+     380        4897 :         uint32_t *s = state;
+     381             :         uint32_t *r = state;
+     382             :         int i = 1;
+     383        4897 :         *s++ = seed & 0xffffffffUL;
+     384     3055728 :         for (; i < N; ++i) {
+     385     3050831 :                 *s++ = (1812433253UL * (*r ^ (*r >> 30)) + i) & 0xffffffffUL;
+     386     3050831 :                 r++;
+     387             :         }
+     388        4897 : }
+     389             : 
+     390       46321 : void Random::reload() {
+     391       46321 :         uint32_t *p = state;
+     392             :         int i;
+     393    10561188 :         for (i = N - M; i--; ++p)
+     394    10514867 :                 *p = twist(p[M], p[0], p[1]);
+     395    18389437 :         for (i = M; --i; ++p)
+     396    18343116 :                 *p = twist(p[M - N], p[0], p[1]);
+     397       46321 :         *p = twist(p[M - N], p[0], state[0]);
+     398             : 
+     399       46321 :         left = N, pNext = state;
+     400       46321 : }
+     401             : 
+     402           0 : uint32_t Random::hash(time_t t, clock_t c) {
+     403             :         static uint32_t differ = 0; // guarantee time-based seeds will change
+     404             : 
+     405             :         uint32_t h1 = 0;
+     406             :         unsigned char *p = (unsigned char *) &t;
+     407           0 :         for (size_t i = 0; i < sizeof(t); ++i) {
+     408           0 :                 h1 *= std::numeric_limits<unsigned char>::max() + 2U;
+     409           0 :                 h1 += p[i];
+     410             :         }
+     411             :         uint32_t h2 = 0;
+     412             :         p = (unsigned char *) &c;
+     413           0 :         for (size_t j = 0; j < sizeof(c); ++j) {
+     414           0 :                 h2 *= std::numeric_limits<unsigned char>::max() + 2U;
+     415           0 :                 h2 += p[j];
+     416             :         }
+     417           0 :         return (h1 + differ++) ^ h2;
+     418             : }
+     419             : 
+     420           0 : void Random::save(uint32_t* saveArray) const {
+     421             :         uint32_t *sa = saveArray;
+     422           0 :         const uint32_t *s = state;
+     423             :         int i = N;
+     424           0 :         for (; i--; *sa++ = *s++) {
+     425             :         }
+     426           0 :         *sa = left;
+     427           0 : }
+     428             : 
+     429           2 : const std::vector<uint32_t> &Random::getSeed() const
+     430             : {
+     431           2 :         return initial_seed;
+     432             : }
+     433             : 
+     434           0 : void Random::load(uint32_t * const loadArray) {
+     435           0 :         uint32_t *s = state;
+     436             :         uint32_t *la = loadArray;
+     437             :         int i = N;
+     438           0 :         for (; i--; *s++ = *la++) {
+     439             :         }
+     440           0 :         left = *la;
+     441           0 :         pNext = &state[N - left];
+     442           0 : }
+     443             : 
+     444           0 : std::ostream& operator<<(std::ostream& os, const Random& mtrand) {
+     445           0 :         const uint32_t *s = mtrand.state;
+     446             :         int i = mtrand.N;
+     447           0 :         for (; i--; os << *s++ << "\t") {
+     448             :         }
+     449           0 :         return os << mtrand.left;
+     450             : }
+     451             : 
+     452           0 : std::istream& operator>>(std::istream& is, Random& mtrand) {
+     453           0 :         uint32_t *s = mtrand.state;
+     454             :         int i = mtrand.N;
+     455           0 :         for (; i--; is >> *s++) {
+     456             :         }
+     457           0 :         is >> mtrand.left;
+     458           0 :         mtrand.pNext = &mtrand.state[mtrand.N - mtrand.left];
+     459           0 :         return is;
+     460             : }
+     461             : 
+     462             : #ifdef _OPENMP
+     463             : #include <omp.h>
+     464             : #include <stdexcept>
+     465             : 
+     466             : // see http://stackoverflow.com/questions/8051108/using-the-openmp-threadprivate-directive-on-static-instances-of-c-stl-types
+     467             : const static int MAX_THREAD = 256;
+     468             : 
+     469             : struct RANDOM_TLS_ITEM {
+     470             :         Random r;
+     471             :         char padding[(sizeof(Random) / 64 + 1) * 64 - sizeof(Random)];
+     472             : };
+     473             : 
+     474             : #ifdef _MSC_VER
+     475             : __declspec(align(64)) static RANDOM_TLS_ITEM _tls[MAX_THREAD];
+     476             : #else
+     477             : __attribute__ ((aligned(64))) static RANDOM_TLS_ITEM _tls[MAX_THREAD];
+     478             : #endif
+     479             : 
+     480     2658589 : Random &Random::instance() {
+     481     2658589 :         int i = omp_get_thread_num();
+     482     2658589 :         if (i >= MAX_THREAD)
+     483           0 :         throw std::runtime_error("crpropa::Random: more than MAX_THREAD threads!");
+     484     2658589 :         return _tls[i].r;
+     485             : }
+     486             : 
+     487           0 : void Random::seedThreads(const uint32_t oneSeed) {
+     488           0 :         for(size_t i = 0; i < MAX_THREAD; ++i)
+     489           0 :         _tls[i].r.seed(oneSeed + i);
+     490           0 : }
+     491             : 
+     492           0 : std::vector< std::vector<uint32_t> > Random::getSeedThreads()
+     493             : {
+     494             :         std::vector< std::vector<uint32_t> > seeds;
+     495           0 :         for(size_t i = 0; i < omp_get_num_threads(); ++i)
+     496           0 :                 seeds.push_back(_tls[i].r.getSeed() ); 
+     497           0 :         return seeds;
+     498           0 : }
+     499             : 
+     500             : #else
+     501             : static Random _random;
+     502             : Random &Random::instance() {
+     503             :         return _random;
+     504             : }
+     505             : void Random::seedThreads(const uint32_t oneSeed) {
+     506             :         _random.seed(oneSeed);
+     507             : }
+     508             : std::vector< std::vector<uint32_t> > Random::getSeedThreads()
+     509             : {
+     510             :         std::vector< std::vector<uint32_t> > seeds;
+     511             :                 seeds.push_back(_random.getSeed() ); 
+     512             :         return seeds;
+     513             : }
+     514             : #endif
+     515             : 
+     516           0 : const std::string Random::getSeed_base64() const
+     517             : {
+     518           0 :         return Base64::encode((unsigned char*) &initial_seed[0], sizeof(initial_seed[0]) * initial_seed.size() / sizeof(unsigned char));
+     519             : }
+     520             : 
+     521           1 : void Random::seed(const std::string &b64Seed)
+     522             : {
+     523           1 :         std::string decoded_data = Base64::decode(b64Seed);
+     524           1 :         size_t seedSize = decoded_data.size() * sizeof(decoded_data[0]) / sizeof(uint32_t);
+     525           1 :         seed((uint32_t*)decoded_data.c_str(), seedSize );
+     526           1 : }
+     527             : 
+     528             : } // namespace crpropa
+     529             : 
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Source.cpp.func-sort-c.html b/doc/coverageReport/src/Source.cpp.func-sort-c.html new file mode 100644 index 000000000..34e0bcd2a --- /dev/null +++ b/doc/coverageReport/src/Source.cpp.func-sort-c.html @@ -0,0 +1,656 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Source.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Source.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:45978458.5 %
Date:2024-04-08 14:58:22Functions:8114655.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa14SourcePositionC2Ed0
_ZN7crpropa15SourceDirection14setDescriptionEv0
_ZN7crpropa15SourceDirectionC2ENS_7Vector3IdEE0
_ZN7crpropa17SourceEmissionMap14setDescriptionEv0
_ZN7crpropa17SourceEmissionMap14setEmissionMapEPNS_11EmissionMapE0
_ZN7crpropa17SourceEmissionMapC2EPNS_11EmissionMapE0
_ZN7crpropa18SourceUniformShell14setDescriptionEv0
_ZN7crpropa18SourceUniformShellC2ENS_7Vector3IdEEd0
_ZN7crpropa21SourceSNRDistribution14setDescriptionEv0
_ZN7crpropa21SourceSNRDistribution7setBetaEd0
_ZN7crpropa21SourceSNRDistributionC2Ev0
_ZN7crpropa21SourceUniformCylinder14setDescriptionEv0
_ZN7crpropa21SourceUniformRedshift14setDescriptionEv0
_ZN7crpropa21SourceUniformRedshiftC2Edd0
_ZN7crpropa22SourceMassDistribution14getDescriptionB5cxx11Ev0
_ZN7crpropa22SourceMassDistribution15setMaximalTriesEi0
_ZN7crpropa22SourceMassDistribution17setMaximalDensityEd0
_ZN7crpropa22SourceMassDistribution9setXrangeEdd0
_ZN7crpropa22SourceMassDistribution9setYrangeEdd0
_ZN7crpropa22SourceMassDistribution9setZrangeEdd0
_ZN7crpropa22SourceMassDistributionC2ENS_7ref_ptrINS_7DensityEEEdddd0
_ZN7crpropa24SourceGenericComposition3addEiid0
_ZN7crpropa24SourcePulsarDistribution12getThetaBlurEv0
_ZN7crpropa24SourcePulsarDistribution12setThetaBlurEd0
_ZN7crpropa24SourcePulsarDistribution14setDescriptionEv0
_ZN7crpropa24SourcePulsarDistribution7getRMaxEv0
_ZN7crpropa24SourcePulsarDistribution7getZMaxEv0
_ZN7crpropa24SourcePulsarDistribution7setRMaxEd0
_ZN7crpropa24SourcePulsarDistribution7setZMaxEd0
_ZN7crpropa24SourcePulsarDistribution8getFrMaxEv0
_ZN7crpropa24SourcePulsarDistribution8getFzMaxEv0
_ZN7crpropa24SourcePulsarDistribution8getRBlurEv0
_ZN7crpropa24SourcePulsarDistribution8setFrMaxEdd0
_ZN7crpropa24SourcePulsarDistribution8setFzMaxEd0
_ZN7crpropa24SourcePulsarDistribution8setRBlurEd0
_ZN7crpropa24SourcePulsarDistributionC2Eddddd0
_ZN7crpropa24SourcePulsarDistributionC2Ev0
_ZN7crpropa27SourceMultipleParticleTypes14setDescriptionEv0
_ZN7crpropa27SourceMultipleParticleTypes3addEid0
_ZN7crpropa27SourceMultipleParticleTypesC2Ev0
_ZN7crpropa33SourceLambertDistributionOnSphere14setDescriptionEv0
_ZN7crpropa33SourceLambertDistributionOnSphereC2ERKNS_7Vector3IdEEdb0
_ZNK7crpropa10SourceList14getDescriptionB5cxx11Ev0
_ZNK7crpropa13SourceFeature14getDescriptionB5cxx11Ev0
_ZNK7crpropa15SourceDirection15prepareParticleERNS_13ParticleStateE0
_ZNK7crpropa17SourceEmissionMap16prepareCandidateERNS_9CandidateE0
_ZNK7crpropa18SourceUniformShell15prepareParticleERNS_13ParticleStateE0
_ZNK7crpropa21SourceSNRDistribution7getBetaEv0
_ZNK7crpropa21SourceSNRDistribution7getRMaxEv0
_ZNK7crpropa21SourceSNRDistribution7getZMaxEv0
_ZNK7crpropa21SourceSNRDistribution8getAlphaEv0
_ZNK7crpropa21SourceSNRDistribution8getFrMaxEv0
_ZNK7crpropa21SourceSNRDistribution8getFzMaxEv0
_ZNK7crpropa21SourceUniformRedshift16prepareCandidateERNS_9CandidateE0
_ZNK7crpropa22SourceMassDistribution14samplePositionEv0
_ZNK7crpropa22SourceMassDistribution15prepareParticleERNS_13ParticleStateE0
_ZNK7crpropa24SourcePulsarDistribution15prepareParticleERNS_13ParticleStateE0
_ZNK7crpropa24SourcePulsarDistribution2frEd0
_ZNK7crpropa24SourcePulsarDistribution2fzEd0
_ZNK7crpropa24SourcePulsarDistribution5blurREd0
_ZNK7crpropa24SourcePulsarDistribution6fthetaEid0
_ZNK7crpropa24SourcePulsarDistribution9blurThetaEdd0
_ZNK7crpropa27SourceMultipleParticleTypes15prepareParticleERNS_13ParticleStateE0
_ZNK7crpropa33SourceLambertDistributionOnSphere15prepareParticleERNS_13ParticleStateE0
_ZNK7crpropa6Source14getDescriptionB5cxx11Ev0
_ZN7crpropa14SourceRedshift14setDescriptionEv1
_ZN7crpropa14SourceRedshiftC2Ed1
_ZN7crpropa15SourceUniform1D14setDescriptionEv1
_ZN7crpropa15SourceUniform1DC2Eddb1
_ZN7crpropa16SourceRedshift1D14setDescriptionEv1
_ZN7crpropa16SourceRedshift1DC2Ev1
_ZN7crpropa16SourceUniformBox14setDescriptionEv1
_ZN7crpropa16SourceUniformBoxC2ENS_7Vector3IdEES2_1
_ZN7crpropa18SourceEmissionCone12setDirectionENS_7Vector3IdEE1
_ZN7crpropa18SourceEmissionCone14setDescriptionEv1
_ZN7crpropa18SourceEmissionConeC2ENS_7Vector3IdEEd1
_ZN7crpropa19SourceUniformSphere14setDescriptionEv1
_ZN7crpropa19SourceUniformSphereC2ENS_7Vector3IdEEd1
_ZN7crpropa21SourceSNRDistribution7setZMaxEd1
_ZN7crpropa21SourceSNRDistribution8setAlphaEd1
_ZN7crpropa21SourceSNRDistribution8setFzMaxEd1
_ZN7crpropa21SourceSNRDistributionC2Edddd1
_ZN7crpropa21SourceUniformCylinderC2ENS_7Vector3IdEEdd1
_ZN7crpropa22SourceDirectedEmission14setDescriptionEv1
_ZN7crpropa22SourceDirectedEmissionC2ENS_7Vector3IdEEd1
_ZN7crpropa23SourceMultiplePositions14setDescriptionEv1
_ZN7crpropa23SourceMultiplePositionsC2Ev1
_ZN7crpropa24SourceGenericComposition14setDescriptionEv1
_ZN7crpropa24SourceGenericCompositionC2EddNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm1
_ZN7crpropa25SourceUniformHollowSphere14setDescriptionEv1
_ZN7crpropa25SourceUniformHollowSphereC2ENS_7Vector3IdEEdd1
_ZN7crpropa9SourceTag14setDescriptionEv1
_ZN7crpropa9SourceTag6setTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa9SourceTagC2ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZNK7crpropa14SourceRedshift16prepareCandidateERNS_9CandidateE1
_ZNK7crpropa15SourceUniform1D15prepareParticleERNS_13ParticleStateE1
_ZNK7crpropa16SourceRedshift1D16prepareCandidateERNS_9CandidateE1
_ZNK7crpropa16SourceUniformBox15prepareParticleERNS_13ParticleStateE1
_ZNK7crpropa18SourceEmissionCone15prepareParticleERNS_13ParticleStateE1
_ZNK7crpropa19SourceUniformSphere15prepareParticleERNS_13ParticleStateE1
_ZNK7crpropa21SourceUniformCylinder15prepareParticleERNS_13ParticleStateE1
_ZNK7crpropa9SourceTag16prepareCandidateERNS_9CandidateE1
_ZN7crpropa12SourceEnergy14setDescriptionEv2
_ZN7crpropa12SourceEnergyC2Ed2
_ZN7crpropa17SourceDensityGrid14setDescriptionEv2
_ZN7crpropa17SourceDensityGridC2ENS_7ref_ptrINS_4GridIfEEEE2
_ZN7crpropa19SourceDensityGrid1D14setDescriptionEv2
_ZN7crpropa19SourceDensityGrid1DC2ENS_7ref_ptrINS_4GridIfEEEE2
_ZN7crpropa21SourceSNRDistribution7setRMaxEd2
_ZN7crpropa21SourceSNRDistribution8setFrMaxEv2
_ZN7crpropa23SourceMultiplePositions3addENS_7Vector3IdEEd2
_ZN7crpropa23SourceRedshiftEvolutionC2Eddd2
_ZN7crpropa24SourceGenericComposition3addEid2
_ZN7crpropa10SourceList3addEPNS_6SourceEd3
_ZN7crpropa17SourceCompositionC2Eddd3
_ZN7crpropa18SourceParticleType14setDescriptionEv3
_ZN7crpropa18SourceParticleTypeC2Ei3
_ZN7crpropa23SourceIsotropicEmission14setDescriptionEv3
_ZN7crpropa23SourceIsotropicEmissionC2Ev3
_ZNK7crpropa17SourceComposition15prepareParticleERNS_13ParticleStateE3
_ZN7crpropa17SourceComposition3addEiid4
_ZN7crpropa22SourcePowerLawSpectrum14setDescriptionEv4
_ZN7crpropa22SourcePowerLawSpectrumC2Eddd4
_ZN7crpropa14SourcePosition14setDescriptionEv5
_ZN7crpropa14SourcePositionC2ENS_7Vector3IdEE5
_ZN7crpropa17SourceComposition3addEid5
_ZN7crpropa17SourceComposition14setDescriptionEv8
_ZN7crpropa6Source3addEPNS_13SourceFeatureE19
_ZNK7crpropa25SourceUniformHollowSphere15prepareParticleERNS_13ParticleStateE100
_ZNK7crpropa19SourceDensityGrid1D15prepareParticleERNS_13ParticleStateE101
_ZNK7crpropa23SourceRedshiftEvolution16prepareCandidateERNS_9CandidateE200
_ZNK7crpropa12SourceEnergy15prepareParticleERNS_13ParticleStateE1000
_ZNK7crpropa22SourceDirectedEmission16prepareCandidateERNS_9CandidateE1000
_ZNK7crpropa10SourceList12getCandidateEv1002
_ZNK7crpropa18SourceParticleType15prepareParticleERNS_13ParticleStateE1101
_ZNK7crpropa23SourceIsotropicEmission15prepareParticleERNS_13ParticleStateE1101
_ZNK7crpropa22SourcePowerLawSpectrum15prepareParticleERNS_13ParticleStateE1102
_ZNK7crpropa14SourcePosition15prepareParticleERNS_13ParticleStateE1103
_ZNK7crpropa6Source12getCandidateEv2103
_ZNK7crpropa13SourceFeature16prepareCandidateERNS_9CandidateE5407
_ZNK7crpropa23SourceMultiplePositions15prepareParticleERNS_13ParticleStateE10000
_ZNK7crpropa17SourceDensityGrid15prepareParticleERNS_13ParticleStateE10001
_ZNK7crpropa24SourceGenericComposition15prepareParticleERNS_13ParticleStateE100000
_ZNK7crpropa21SourceSNRDistribution15prepareParticleERNS_13ParticleStateE100001
_ZNK7crpropa21SourceSNRDistribution2frEd193272
_ZNK7crpropa21SourceSNRDistribution2fzEd1663640
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Source.cpp.func.html b/doc/coverageReport/src/Source.cpp.func.html new file mode 100644 index 000000000..cbdfefa59 --- /dev/null +++ b/doc/coverageReport/src/Source.cpp.func.html @@ -0,0 +1,656 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Source.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Source.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:45978458.5 %
Date:2024-04-08 14:58:22Functions:8114655.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa10SourceList3addEPNS_6SourceEd3
_ZN7crpropa12SourceEnergy14setDescriptionEv2
_ZN7crpropa12SourceEnergyC2Ed2
_ZN7crpropa14SourcePosition14setDescriptionEv5
_ZN7crpropa14SourcePositionC2ENS_7Vector3IdEE5
_ZN7crpropa14SourcePositionC2Ed0
_ZN7crpropa14SourceRedshift14setDescriptionEv1
_ZN7crpropa14SourceRedshiftC2Ed1
_ZN7crpropa15SourceDirection14setDescriptionEv0
_ZN7crpropa15SourceDirectionC2ENS_7Vector3IdEE0
_ZN7crpropa15SourceUniform1D14setDescriptionEv1
_ZN7crpropa15SourceUniform1DC2Eddb1
_ZN7crpropa16SourceRedshift1D14setDescriptionEv1
_ZN7crpropa16SourceRedshift1DC2Ev1
_ZN7crpropa16SourceUniformBox14setDescriptionEv1
_ZN7crpropa16SourceUniformBoxC2ENS_7Vector3IdEES2_1
_ZN7crpropa17SourceComposition14setDescriptionEv8
_ZN7crpropa17SourceComposition3addEid5
_ZN7crpropa17SourceComposition3addEiid4
_ZN7crpropa17SourceCompositionC2Eddd3
_ZN7crpropa17SourceDensityGrid14setDescriptionEv2
_ZN7crpropa17SourceDensityGridC2ENS_7ref_ptrINS_4GridIfEEEE2
_ZN7crpropa17SourceEmissionMap14setDescriptionEv0
_ZN7crpropa17SourceEmissionMap14setEmissionMapEPNS_11EmissionMapE0
_ZN7crpropa17SourceEmissionMapC2EPNS_11EmissionMapE0
_ZN7crpropa18SourceEmissionCone12setDirectionENS_7Vector3IdEE1
_ZN7crpropa18SourceEmissionCone14setDescriptionEv1
_ZN7crpropa18SourceEmissionConeC2ENS_7Vector3IdEEd1
_ZN7crpropa18SourceParticleType14setDescriptionEv3
_ZN7crpropa18SourceParticleTypeC2Ei3
_ZN7crpropa18SourceUniformShell14setDescriptionEv0
_ZN7crpropa18SourceUniformShellC2ENS_7Vector3IdEEd0
_ZN7crpropa19SourceDensityGrid1D14setDescriptionEv2
_ZN7crpropa19SourceDensityGrid1DC2ENS_7ref_ptrINS_4GridIfEEEE2
_ZN7crpropa19SourceUniformSphere14setDescriptionEv1
_ZN7crpropa19SourceUniformSphereC2ENS_7Vector3IdEEd1
_ZN7crpropa21SourceSNRDistribution14setDescriptionEv0
_ZN7crpropa21SourceSNRDistribution7setBetaEd0
_ZN7crpropa21SourceSNRDistribution7setRMaxEd2
_ZN7crpropa21SourceSNRDistribution7setZMaxEd1
_ZN7crpropa21SourceSNRDistribution8setAlphaEd1
_ZN7crpropa21SourceSNRDistribution8setFrMaxEv2
_ZN7crpropa21SourceSNRDistribution8setFzMaxEd1
_ZN7crpropa21SourceSNRDistributionC2Edddd1
_ZN7crpropa21SourceSNRDistributionC2Ev0
_ZN7crpropa21SourceUniformCylinder14setDescriptionEv0
_ZN7crpropa21SourceUniformCylinderC2ENS_7Vector3IdEEdd1
_ZN7crpropa21SourceUniformRedshift14setDescriptionEv0
_ZN7crpropa21SourceUniformRedshiftC2Edd0
_ZN7crpropa22SourceDirectedEmission14setDescriptionEv1
_ZN7crpropa22SourceDirectedEmissionC2ENS_7Vector3IdEEd1
_ZN7crpropa22SourceMassDistribution14getDescriptionB5cxx11Ev0
_ZN7crpropa22SourceMassDistribution15setMaximalTriesEi0
_ZN7crpropa22SourceMassDistribution17setMaximalDensityEd0
_ZN7crpropa22SourceMassDistribution9setXrangeEdd0
_ZN7crpropa22SourceMassDistribution9setYrangeEdd0
_ZN7crpropa22SourceMassDistribution9setZrangeEdd0
_ZN7crpropa22SourceMassDistributionC2ENS_7ref_ptrINS_7DensityEEEdddd0
_ZN7crpropa22SourcePowerLawSpectrum14setDescriptionEv4
_ZN7crpropa22SourcePowerLawSpectrumC2Eddd4
_ZN7crpropa23SourceIsotropicEmission14setDescriptionEv3
_ZN7crpropa23SourceIsotropicEmissionC2Ev3
_ZN7crpropa23SourceMultiplePositions14setDescriptionEv1
_ZN7crpropa23SourceMultiplePositions3addENS_7Vector3IdEEd2
_ZN7crpropa23SourceMultiplePositionsC2Ev1
_ZN7crpropa23SourceRedshiftEvolutionC2Eddd2
_ZN7crpropa24SourceGenericComposition14setDescriptionEv1
_ZN7crpropa24SourceGenericComposition3addEid2
_ZN7crpropa24SourceGenericComposition3addEiid0
_ZN7crpropa24SourceGenericCompositionC2EddNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm1
_ZN7crpropa24SourcePulsarDistribution12getThetaBlurEv0
_ZN7crpropa24SourcePulsarDistribution12setThetaBlurEd0
_ZN7crpropa24SourcePulsarDistribution14setDescriptionEv0
_ZN7crpropa24SourcePulsarDistribution7getRMaxEv0
_ZN7crpropa24SourcePulsarDistribution7getZMaxEv0
_ZN7crpropa24SourcePulsarDistribution7setRMaxEd0
_ZN7crpropa24SourcePulsarDistribution7setZMaxEd0
_ZN7crpropa24SourcePulsarDistribution8getFrMaxEv0
_ZN7crpropa24SourcePulsarDistribution8getFzMaxEv0
_ZN7crpropa24SourcePulsarDistribution8getRBlurEv0
_ZN7crpropa24SourcePulsarDistribution8setFrMaxEdd0
_ZN7crpropa24SourcePulsarDistribution8setFzMaxEd0
_ZN7crpropa24SourcePulsarDistribution8setRBlurEd0
_ZN7crpropa24SourcePulsarDistributionC2Eddddd0
_ZN7crpropa24SourcePulsarDistributionC2Ev0
_ZN7crpropa25SourceUniformHollowSphere14setDescriptionEv1
_ZN7crpropa25SourceUniformHollowSphereC2ENS_7Vector3IdEEdd1
_ZN7crpropa27SourceMultipleParticleTypes14setDescriptionEv0
_ZN7crpropa27SourceMultipleParticleTypes3addEid0
_ZN7crpropa27SourceMultipleParticleTypesC2Ev0
_ZN7crpropa33SourceLambertDistributionOnSphere14setDescriptionEv0
_ZN7crpropa33SourceLambertDistributionOnSphereC2ERKNS_7Vector3IdEEdb0
_ZN7crpropa6Source3addEPNS_13SourceFeatureE19
_ZN7crpropa9SourceTag14setDescriptionEv1
_ZN7crpropa9SourceTag6setTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa9SourceTagC2ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZNK7crpropa10SourceList12getCandidateEv1002
_ZNK7crpropa10SourceList14getDescriptionB5cxx11Ev0
_ZNK7crpropa12SourceEnergy15prepareParticleERNS_13ParticleStateE1000
_ZNK7crpropa13SourceFeature14getDescriptionB5cxx11Ev0
_ZNK7crpropa13SourceFeature16prepareCandidateERNS_9CandidateE5407
_ZNK7crpropa14SourcePosition15prepareParticleERNS_13ParticleStateE1103
_ZNK7crpropa14SourceRedshift16prepareCandidateERNS_9CandidateE1
_ZNK7crpropa15SourceDirection15prepareParticleERNS_13ParticleStateE0
_ZNK7crpropa15SourceUniform1D15prepareParticleERNS_13ParticleStateE1
_ZNK7crpropa16SourceRedshift1D16prepareCandidateERNS_9CandidateE1
_ZNK7crpropa16SourceUniformBox15prepareParticleERNS_13ParticleStateE1
_ZNK7crpropa17SourceComposition15prepareParticleERNS_13ParticleStateE3
_ZNK7crpropa17SourceDensityGrid15prepareParticleERNS_13ParticleStateE10001
_ZNK7crpropa17SourceEmissionMap16prepareCandidateERNS_9CandidateE0
_ZNK7crpropa18SourceEmissionCone15prepareParticleERNS_13ParticleStateE1
_ZNK7crpropa18SourceParticleType15prepareParticleERNS_13ParticleStateE1101
_ZNK7crpropa18SourceUniformShell15prepareParticleERNS_13ParticleStateE0
_ZNK7crpropa19SourceDensityGrid1D15prepareParticleERNS_13ParticleStateE101
_ZNK7crpropa19SourceUniformSphere15prepareParticleERNS_13ParticleStateE1
_ZNK7crpropa21SourceSNRDistribution15prepareParticleERNS_13ParticleStateE100001
_ZNK7crpropa21SourceSNRDistribution2frEd193272
_ZNK7crpropa21SourceSNRDistribution2fzEd1663640
_ZNK7crpropa21SourceSNRDistribution7getBetaEv0
_ZNK7crpropa21SourceSNRDistribution7getRMaxEv0
_ZNK7crpropa21SourceSNRDistribution7getZMaxEv0
_ZNK7crpropa21SourceSNRDistribution8getAlphaEv0
_ZNK7crpropa21SourceSNRDistribution8getFrMaxEv0
_ZNK7crpropa21SourceSNRDistribution8getFzMaxEv0
_ZNK7crpropa21SourceUniformCylinder15prepareParticleERNS_13ParticleStateE1
_ZNK7crpropa21SourceUniformRedshift16prepareCandidateERNS_9CandidateE0
_ZNK7crpropa22SourceDirectedEmission16prepareCandidateERNS_9CandidateE1000
_ZNK7crpropa22SourceMassDistribution14samplePositionEv0
_ZNK7crpropa22SourceMassDistribution15prepareParticleERNS_13ParticleStateE0
_ZNK7crpropa22SourcePowerLawSpectrum15prepareParticleERNS_13ParticleStateE1102
_ZNK7crpropa23SourceIsotropicEmission15prepareParticleERNS_13ParticleStateE1101
_ZNK7crpropa23SourceMultiplePositions15prepareParticleERNS_13ParticleStateE10000
_ZNK7crpropa23SourceRedshiftEvolution16prepareCandidateERNS_9CandidateE200
_ZNK7crpropa24SourceGenericComposition15prepareParticleERNS_13ParticleStateE100000
_ZNK7crpropa24SourcePulsarDistribution15prepareParticleERNS_13ParticleStateE0
_ZNK7crpropa24SourcePulsarDistribution2frEd0
_ZNK7crpropa24SourcePulsarDistribution2fzEd0
_ZNK7crpropa24SourcePulsarDistribution5blurREd0
_ZNK7crpropa24SourcePulsarDistribution6fthetaEid0
_ZNK7crpropa24SourcePulsarDistribution9blurThetaEdd0
_ZNK7crpropa25SourceUniformHollowSphere15prepareParticleERNS_13ParticleStateE100
_ZNK7crpropa27SourceMultipleParticleTypes15prepareParticleERNS_13ParticleStateE0
_ZNK7crpropa33SourceLambertDistributionOnSphere15prepareParticleERNS_13ParticleStateE0
_ZNK7crpropa6Source12getCandidateEv2103
_ZNK7crpropa6Source14getDescriptionB5cxx11Ev0
_ZNK7crpropa9SourceTag16prepareCandidateERNS_9CandidateE1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Source.cpp.gcov.html b/doc/coverageReport/src/Source.cpp.gcov.html new file mode 100644 index 000000000..6cc5e6642 --- /dev/null +++ b/doc/coverageReport/src/Source.cpp.gcov.html @@ -0,0 +1,1218 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Source.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Source.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:45978458.5 %
Date:2024-04-08 14:58:22Functions:8114655.5 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/Source.h"
+       2             : #include "crpropa/Random.h"
+       3             : #include "crpropa/Cosmology.h"
+       4             : #include "crpropa/Common.h"
+       5             : #include "crpropa/Units.h"
+       6             : #include "crpropa/ParticleID.h"
+       7             : 
+       8             : #ifdef CRPROPA_HAVE_MUPARSER
+       9             : #include "muParser.h"
+      10             : #endif
+      11             : 
+      12             : #include <sstream>
+      13             : #include <stdexcept>
+      14             : 
+      15             : namespace crpropa {
+      16             : 
+      17             : // Source ---------------------------------------------------------------------
+      18          19 : void Source::add(SourceFeature* property) {
+      19          19 :         features.push_back(property);
+      20          19 : }
+      21             : 
+      22        2103 : ref_ptr<Candidate> Source::getCandidate() const {
+      23        4206 :         ref_ptr<Candidate> candidate = new Candidate();
+      24        7512 :         for (int i = 0; i < features.size(); i++)
+      25        5409 :                 (*features[i]).prepareCandidate(*candidate);
+      26        2103 :         return candidate;
+      27             : }
+      28             : 
+      29           0 : std::string Source::getDescription() const {
+      30           0 :         std::stringstream ss;
+      31           0 :         ss << "Cosmic ray source\n";
+      32           0 :         for (int i = 0; i < features.size(); i++)
+      33           0 :                 ss << "    " << features[i]->getDescription();
+      34           0 :         return ss.str();
+      35           0 : }
+      36             : 
+      37             : // SourceList------------------------------------------------------------------
+      38           3 : void SourceList::add(Source* source, double weight) {
+      39           6 :         sources.push_back(source);
+      40           3 :         if (cdf.size() > 0)
+      41           1 :                 weight += cdf.back();
+      42           3 :         cdf.push_back(weight);
+      43           3 : }
+      44             : 
+      45        1002 : ref_ptr<Candidate> SourceList::getCandidate() const {
+      46        1002 :         if (sources.size() == 0)
+      47           1 :                 throw std::runtime_error("SourceList: no sources set");
+      48        1001 :         size_t i = Random::instance().randBin(cdf);
+      49        1001 :         return (sources[i])->getCandidate();
+      50             : }
+      51             : 
+      52           0 : std::string SourceList::getDescription() const {
+      53           0 :         std::stringstream ss;
+      54           0 :         ss << "List of cosmic ray sources\n";
+      55           0 :         for (int i = 0; i < sources.size(); i++)
+      56           0 :                 ss << "  " << sources[i]->getDescription();
+      57           0 :         return ss.str();
+      58           0 : }
+      59             : 
+      60             : // SourceFeature---------------------------------------------------------------
+      61        5407 : void SourceFeature::prepareCandidate(Candidate& candidate) const {
+      62        5407 :         ParticleState &source = candidate.source;
+      63        5407 :         prepareParticle(source);
+      64             :         candidate.created = source;
+      65             :         candidate.current = source;
+      66             :         candidate.previous = source;
+      67        5407 : }
+      68             : 
+      69           0 : std::string SourceFeature::getDescription() const {
+      70           0 :         return description;
+      71             : }
+      72             : 
+      73             : // ----------------------------------------------------------------------------
+      74           3 : SourceParticleType::SourceParticleType(int id) :
+      75           3 :                 id(id) {
+      76           3 :         setDescription();
+      77           3 : }
+      78             : 
+      79        1101 : void SourceParticleType::prepareParticle(ParticleState& particle) const {
+      80        1101 :         particle.setId(id);
+      81        1101 : }
+      82             : 
+      83           3 : void SourceParticleType::setDescription() {
+      84           3 :         std::stringstream ss;
+      85           3 :         ss << "SourceParticleType: " << id << "\n";
+      86           3 :         description = ss.str();
+      87           3 : }
+      88             : 
+      89             : // ----------------------------------------------------------------------------
+      90           0 : SourceMultipleParticleTypes::SourceMultipleParticleTypes() {
+      91           0 :         setDescription();
+      92           0 : }
+      93             : 
+      94           0 : void SourceMultipleParticleTypes::add(int id, double a) {
+      95           0 :         particleTypes.push_back(id);
+      96           0 :         if (cdf.size() > 0)
+      97           0 :                 a += cdf.back();
+      98           0 :         cdf.push_back(a);
+      99           0 :         setDescription();
+     100           0 : }
+     101             : 
+     102           0 : void SourceMultipleParticleTypes::prepareParticle(ParticleState& particle) const {
+     103           0 :         if (particleTypes.size() == 0)
+     104           0 :                 throw std::runtime_error("SourceMultipleParticleTypes: no nuclei set");
+     105           0 :         size_t i = Random::instance().randBin(cdf);
+     106           0 :         particle.setId(particleTypes[i]);
+     107           0 : }
+     108             : 
+     109           0 : void SourceMultipleParticleTypes::setDescription() {
+     110           0 :         std::stringstream ss;
+     111           0 :         ss << "SourceMultipleParticleTypes: Random particle type\n";
+     112           0 :         for (int i = 0; i < particleTypes.size(); i++)
+     113           0 :                 ss << "      ID = " << particleTypes[i] << "\n";
+     114           0 :         description = ss.str();
+     115           0 : }
+     116             : 
+     117             : // ----------------------------------------------------------------------------
+     118           2 : SourceEnergy::SourceEnergy(double energy) :
+     119           2 :                 E(energy) {
+     120           2 :         setDescription();
+     121           2 : }
+     122             : 
+     123        1000 : void SourceEnergy::prepareParticle(ParticleState& p) const {
+     124        1000 :         p.setEnergy(E);
+     125        1000 : }
+     126             : 
+     127           2 : void SourceEnergy::setDescription() {
+     128           2 :         std::stringstream ss;
+     129           2 :         ss << "SourceEnergy: " << E / EeV << " EeV\n";
+     130           2 :         description = ss.str();
+     131           2 : }
+     132             : 
+     133             : // ----------------------------------------------------------------------------
+     134           4 : SourcePowerLawSpectrum::SourcePowerLawSpectrum(double Emin, double Emax,
+     135           4 :                 double index) :
+     136           4 :                 Emin(Emin), Emax(Emax), index(index) {
+     137           4 :         setDescription();
+     138           4 : }
+     139             : 
+     140        1102 : void SourcePowerLawSpectrum::prepareParticle(ParticleState& particle) const {
+     141        1102 :         Random &random = Random::instance();
+     142        1102 :         double E = random.randPowerLaw(index, Emin, Emax);
+     143        1102 :         particle.setEnergy(E);
+     144        1102 : }
+     145             : 
+     146           4 : void SourcePowerLawSpectrum::setDescription() {
+     147           4 :         std::stringstream ss;
+     148           4 :         ss << "SourcePowerLawSpectrum: Random energy ";
+     149           8 :         ss << "E = " << Emin / EeV << " - " << Emax / EeV << " EeV, ";
+     150           4 :         ss << "dN/dE ~ E^" << index  << "\n";
+     151           4 :         description = ss.str();
+     152           4 : }
+     153             : 
+     154             : // ----------------------------------------------------------------------------
+     155           3 : SourceComposition::SourceComposition(double Emin, double Rmax, double index) :
+     156           3 :                 Emin(Emin), Rmax(Rmax), index(index) {
+     157           3 :         setDescription();
+     158           3 : }
+     159             : 
+     160           5 : void SourceComposition::add(int id, double weight) {
+     161           5 :         nuclei.push_back(id);
+     162           5 :         int A = massNumber(id);
+     163           5 :         int Z = chargeNumber(id);
+     164             : 
+     165           5 :         double a = 1 + index;
+     166           5 :         if (std::abs(a) < std::numeric_limits<double>::min())
+     167           5 :                 weight *= log(Z * Rmax / Emin);
+     168             :         else
+     169           0 :                 weight *= (pow(Z * Rmax, a) - pow(Emin, a)) / a;
+     170             : 
+     171           5 :         weight *= pow(A, -a);
+     172             : 
+     173           5 :         if (cdf.size() > 0)
+     174           3 :                 weight += cdf.back();
+     175           5 :         cdf.push_back(weight);
+     176           5 :         setDescription();
+     177           5 : }
+     178             : 
+     179           4 : void SourceComposition::add(int A, int Z, double a) {
+     180           4 :         add(nucleusId(A, Z), a);
+     181           4 : }
+     182             : 
+     183           3 : void SourceComposition::prepareParticle(ParticleState& particle) const {
+     184           3 :         if (nuclei.size() == 0)
+     185           1 :                 throw std::runtime_error("SourceComposition: No source isotope set");
+     186             : 
+     187           2 :         Random &random = Random::instance();
+     188             : 
+     189             :         // draw random particle type
+     190           2 :         size_t i = random.randBin(cdf);
+     191           2 :         int id = nuclei[i];
+     192           2 :         particle.setId(id);
+     193             : 
+     194             :         // random energy from power law
+     195           2 :         int Z = chargeNumber(id);
+     196           2 :         particle.setEnergy(random.randPowerLaw(index, Emin, Z * Rmax));
+     197           2 : }
+     198             : 
+     199           8 : void SourceComposition::setDescription() {
+     200           8 :         std::stringstream ss;
+     201           8 :         ss << "SourceComposition: Random element and energy ";
+     202          16 :         ss << "E = " << Emin / EeV << " - Z*" << Rmax / EeV << " EeV, ";
+     203           8 :         ss << "dN/dE ~ E^" << index << "\n";
+     204          19 :         for (int i = 0; i < nuclei.size(); i++)
+     205          11 :                 ss << "      ID = " << nuclei[i] << "\n";
+     206           8 :         description = ss.str();
+     207           8 : }
+     208             : 
+     209             : // ----------------------------------------------------------------------------
+     210           5 : SourcePosition::SourcePosition(Vector3d position) :
+     211           5 :                 position(position) {
+     212           5 :         setDescription();
+     213           5 : }
+     214             : 
+     215           0 : SourcePosition::SourcePosition(double d) :
+     216           0 :                 position(Vector3d(d, 0, 0)) {
+     217           0 :         setDescription();
+     218           0 : }
+     219             : 
+     220        1103 : void SourcePosition::prepareParticle(ParticleState& particle) const {
+     221        1103 :         particle.setPosition(position);
+     222        1103 : }
+     223             : 
+     224           5 : void SourcePosition::setDescription() {
+     225           5 :         std::stringstream ss;
+     226           5 :         ss << "SourcePosition: " << position / Mpc << " Mpc\n";
+     227           5 :         description = ss.str();
+     228           5 : }
+     229             : 
+     230             : // ----------------------------------------------------------------------------
+     231           1 : SourceMultiplePositions::SourceMultiplePositions() {
+     232           1 :         setDescription();
+     233           1 : }
+     234             : 
+     235           2 : void SourceMultiplePositions::add(Vector3d pos, double weight) {
+     236           2 :         positions.push_back(pos);
+     237           2 :         if (cdf.size() > 0)
+     238           1 :                 weight += cdf.back();
+     239           2 :         cdf.push_back(weight);
+     240           2 : }
+     241             : 
+     242       10000 : void SourceMultiplePositions::prepareParticle(ParticleState& particle) const {
+     243       10000 :         if (positions.size() == 0)
+     244           0 :                 throw std::runtime_error("SourceMultiplePositions: no position set");
+     245       10000 :         size_t i = Random::instance().randBin(cdf);
+     246       10000 :         particle.setPosition(positions[i]);
+     247       10000 : }
+     248             : 
+     249           1 : void SourceMultiplePositions::setDescription() {
+     250           1 :         std::stringstream ss;
+     251           1 :         ss << "SourceMultiplePositions: Random position from list\n";
+     252           1 :         for (int i = 0; i < positions.size(); i++)
+     253           0 :                 ss << "  " << positions[i] / Mpc << " Mpc\n";
+     254           1 :         description = ss.str();
+     255           1 : }
+     256             : 
+     257             : // ----------------------------------------------------------------------------
+     258           1 : SourceUniformSphere::SourceUniformSphere(Vector3d center, double radius) :
+     259           1 :                 center(center), radius(radius) {
+     260           1 :         setDescription();
+     261           1 : }
+     262             : 
+     263           1 : void SourceUniformSphere::prepareParticle(ParticleState& particle) const {
+     264           1 :         Random &random = Random::instance();
+     265           1 :         double r = pow(random.rand(), 1. / 3.) * radius;
+     266           1 :         particle.setPosition(center + random.randVector() * r);
+     267           1 : }
+     268             : 
+     269           1 : void SourceUniformSphere::setDescription() {
+     270           1 :         std::stringstream ss;
+     271           1 :         ss << "SourceUniformSphere: Random position within a sphere at ";
+     272           1 :         ss << center / Mpc << " Mpc with";
+     273           1 :         ss  << radius / Mpc << " Mpc radius\n";
+     274           1 :         description = ss.str();
+     275           1 : }
+     276             : 
+     277             : // ----------------------------------------------------------------------------
+     278           1 : SourceUniformHollowSphere::SourceUniformHollowSphere(
+     279             :                 Vector3d center,
+     280             :                 double radius_inner,
+     281           1 :                 double radius_outer) :
+     282           1 :                 center(center), radius_inner(radius_inner),
+     283           1 :                 radius_outer(radius_outer) {
+     284           1 :         setDescription();
+     285           1 : }
+     286             : 
+     287         100 : void SourceUniformHollowSphere::prepareParticle(ParticleState& particle) const {
+     288         100 :         Random &random = Random::instance();
+     289         100 :         double r = radius_inner + pow(random.rand(), 1. / 3.) * (radius_outer - radius_inner);
+     290         100 :         particle.setPosition(center + random.randVector() * r);
+     291         100 : }
+     292             : 
+     293           1 : void SourceUniformHollowSphere::setDescription() {
+     294           1 :         std::stringstream ss;
+     295           1 :         ss << "SourceUniformHollowSphere: Random position within a sphere at ";
+     296           1 :         ss << center / Mpc << " Mpc with";
+     297           1 :         ss << radius_inner / Mpc << " Mpc inner radius\n";
+     298           1 :         ss << radius_outer / Mpc << " Mpc outer radius\n";
+     299           1 :         description = ss.str();
+     300           1 : }
+     301             : 
+     302             : // ----------------------------------------------------------------------------
+     303           0 : SourceUniformShell::SourceUniformShell(Vector3d center, double radius) :
+     304           0 :                 center(center), radius(radius) {
+     305           0 :         setDescription();
+     306           0 : }
+     307             : 
+     308           0 : void SourceUniformShell::prepareParticle(ParticleState& particle) const {
+     309           0 :         Random &random = Random::instance();
+     310           0 :         particle.setPosition(center + random.randVector() * radius);
+     311           0 : }
+     312             : 
+     313           0 : void SourceUniformShell::setDescription() {
+     314           0 :         std::stringstream ss;
+     315           0 :         ss << "SourceUniformShell: Random position on a spherical shell at ";
+     316           0 :         ss << center / Mpc << " Mpc with ";
+     317           0 :         ss << radius / Mpc << " Mpc radius\n";
+     318           0 :         description = ss.str();
+     319           0 : }
+     320             : 
+     321             : // ----------------------------------------------------------------------------
+     322           1 : SourceUniformBox::SourceUniformBox(Vector3d origin, Vector3d size) :
+     323           1 :                 origin(origin), size(size) {
+     324           1 :         setDescription();
+     325           1 : }
+     326             : 
+     327           1 : void SourceUniformBox::prepareParticle(ParticleState& particle) const {
+     328           1 :         Random &random = Random::instance();
+     329           1 :         Vector3d pos(random.rand(), random.rand(), random.rand());
+     330           1 :         particle.setPosition(pos * size + origin);
+     331           1 : }
+     332             : 
+     333           1 : void SourceUniformBox::setDescription() {
+     334           1 :         std::stringstream ss;
+     335           1 :         ss << "SourceUniformBox: Random uniform position in box with ";
+     336           1 :         ss << "origin = " << origin / Mpc << " Mpc and ";
+     337           1 :         ss << "size = " << size / Mpc << " Mpc\n";
+     338           1 :         description = ss.str();
+     339           1 : }
+     340             : 
+     341             : // ---------------------------------------------------------------------------
+     342           1 : SourceUniformCylinder::SourceUniformCylinder(Vector3d origin, double height, double radius) :
+     343           1 :     origin(origin), height(height), radius(radius) {
+     344           1 : }
+     345             : 
+     346           1 : void SourceUniformCylinder::prepareParticle(ParticleState& particle) const {
+     347           1 :   Random &random = Random::instance();
+     348           1 :   double phi = 2*M_PI*random.rand();
+     349           1 :   double RandRadius = radius*pow(random.rand(), 1. / 2.);
+     350           1 :   Vector3d pos(cos(phi)*RandRadius, sin(phi)*RandRadius, (-0.5+random.rand())*height);
+     351           1 :   particle.setPosition(pos + origin);
+     352           1 :   }
+     353             : 
+     354           0 : void SourceUniformCylinder::setDescription() {
+     355           0 :         std::stringstream ss;
+     356           0 :         ss << "SourceUniformCylinder: Random uniform position in cylinder with ";
+     357           0 :         ss << "origin = " << origin / Mpc << " Mpc and ";
+     358           0 :         ss << "radius = " << radius / Mpc << " Mpc and";
+     359           0 :         ss << "height = " << height / Mpc << " Mpc\n";
+     360           0 :         description = ss.str();
+     361           0 : }
+     362             : 
+     363             : // ---------------------------------------------------------------------------
+     364           0 : SourceSNRDistribution::SourceSNRDistribution() :
+     365           0 :     rEarth(8.5 * kpc), beta(3.53), zg(0.3 * kpc) {
+     366           0 :         setAlpha(2.);
+     367           0 :         setFrMax();
+     368           0 :         setFzMax(0.3 * kpc);
+     369           0 :         setRMax(20 * kpc);
+     370           0 :         setZMax(5 * kpc);
+     371           0 : }
+     372             : 
+     373           1 : SourceSNRDistribution::SourceSNRDistribution(double rEarth, double alpha, double beta, double zg) :
+     374           1 :     rEarth(rEarth), beta(beta), zg(zg) {
+     375           1 :         setAlpha(alpha);
+     376           1 :         setFrMax();
+     377           1 :         setFzMax(zg);
+     378           1 :         setRMax(20 * kpc);
+     379           1 :         setZMax(5 * kpc);
+     380           1 : }
+     381             : 
+     382      100001 : void SourceSNRDistribution::prepareParticle(ParticleState& particle) const {
+     383      100001 :         Random &random = Random::instance();
+     384             :         double RPos;
+     385             :         while (true) {
+     386      193272 :                 RPos = random.rand() * rMax;
+     387      193272 :                 double fTest = random.rand() * frMax;
+     388      193272 :                 double fR = fr(RPos);
+     389      193272 :                 if (fTest <= fR) {
+     390             :                         break;
+     391             :                 }
+     392             :         }
+     393             :         double ZPos;
+     394             :         while (true) {
+     395     1663640 :                 ZPos = (random.rand() - 0.5) * 2 * zMax;
+     396     1663640 :                 double fTest = random.rand() * fzMax;
+     397     1663640 :                 double fZ=fz(ZPos);
+     398     1663640 :                 if (fTest<=fZ) {
+     399             :                         break;
+     400             :                 }
+     401             :         }
+     402      100001 :         double phi = random.rand() * 2 * M_PI;
+     403      100001 :         Vector3d pos(cos(phi) * RPos, sin(phi) * RPos, ZPos);
+     404      100001 :         particle.setPosition(pos);
+     405      100001 : }
+     406             : 
+     407      193272 : double SourceSNRDistribution::fr(double r) const {
+     408      193272 :         return pow(r / rEarth, alpha) * exp(- beta * (r - rEarth) / rEarth);
+     409             : }
+     410             : 
+     411     1663640 : double SourceSNRDistribution::fz(double z) const{
+     412             :         double Az = 1.;
+     413     1663640 :         double f = 1. / zg * exp(- fabs(z) / zg);
+     414             :         double fz = Az * f;
+     415     1663640 :         return fz;
+     416             : }
+     417             : 
+     418           0 : double SourceSNRDistribution::getAlpha() const {
+     419           0 :         return alpha - 1;  // -1 to account for the R-term in the volume element dV = R * dR * dphi * dz
+     420             : }
+     421             : 
+     422           0 : double SourceSNRDistribution::getBeta() const {
+     423           0 :         return beta;
+     424             : }
+     425             : 
+     426           2 : void SourceSNRDistribution::setFrMax() {
+     427           2 :         frMax = pow(alpha / beta, alpha) * exp(beta - alpha);
+     428           2 :         return;
+     429             : }
+     430             : 
+     431           1 : void SourceSNRDistribution::setFzMax(double zg) {
+     432           1 :         fzMax = 1. / zg;
+     433           1 :         return;
+     434             : }
+     435             : 
+     436           2 : void SourceSNRDistribution::setRMax(double r) {
+     437           2 :         rMax = r;
+     438           2 :         return;
+     439             : }
+     440             : 
+     441           1 : void SourceSNRDistribution::setZMax(double z) {
+     442           1 :         zMax = z;
+     443           1 :         return;
+     444             : }
+     445             : 
+     446           0 : double SourceSNRDistribution::getFrMax() const {
+     447           0 :         return frMax;
+     448             : }
+     449             : 
+     450           0 : double SourceSNRDistribution::getFzMax() const {
+     451           0 :         return fzMax;
+     452             : }
+     453             : 
+     454           0 : double SourceSNRDistribution::getRMax() const {
+     455           0 :         return rMax;
+     456             : }
+     457             : 
+     458           0 : double SourceSNRDistribution::getZMax() const {
+     459           0 :         return zMax;
+     460             : }
+     461             : 
+     462           1 : void SourceSNRDistribution::setAlpha(double a) {
+     463           1 :         alpha = a + 1.; // add 1 for dV = r * dR * dphi * dz
+     464           1 :         setRMax(rMax);
+     465           1 :         setFrMax();
+     466           1 : }
+     467             : 
+     468           0 : void SourceSNRDistribution::setBeta(double b) {
+     469           0 :         beta = b;
+     470           0 :         setRMax(rMax);
+     471           0 :         setFrMax();
+     472           0 : }
+     473             : 
+     474           0 : void SourceSNRDistribution::setDescription() {
+     475           0 :         std::stringstream ss;
+     476           0 :         ss << "SourceSNRDistribution: Random position according to SNR distribution";
+     477           0 :         ss << "rEarth = " << rEarth / kpc << " kpc and ";
+     478           0 :         ss << "zg = " << zg / kpc << " kpc and";
+     479           0 :         ss << "beta = " << beta << " \n";
+     480           0 :         description = ss.str();
+     481           0 : }
+     482             : 
+     483             : // ---------------------------------------------------------------------------
+     484           0 : SourcePulsarDistribution::SourcePulsarDistribution() :
+     485           0 :     rEarth(8.5*kpc), beta(3.53), zg(0.3*kpc) {
+     486           0 :         setFrMax(8.5*kpc, 3.53);
+     487           0 :         setFzMax(0.3*kpc);
+     488           0 :         setRMax(22*kpc);
+     489           0 :         setZMax(5*kpc);
+     490           0 :         setRBlur(0.07);
+     491           0 :         setThetaBlur(0.35/kpc);
+     492           0 : }
+     493             : 
+     494           0 : SourcePulsarDistribution::SourcePulsarDistribution(double rEarth, double beta, double zg, double rB, double tB) :
+     495           0 :     rEarth(rEarth), beta(beta), zg(zg) {
+     496           0 :         setFrMax(rEarth, beta);
+     497           0 :         setFzMax(zg);
+     498           0 :         setRBlur(rB);
+     499           0 :         setThetaBlur(tB);
+     500           0 :         setRMax(22 * kpc);
+     501           0 :         setZMax(5 * kpc);
+     502           0 : }
+     503             : 
+     504           0 : void SourcePulsarDistribution::prepareParticle(ParticleState& particle) const {
+     505           0 :         Random &random = Random::instance();
+     506             :         double Rtilde;
+     507             :         while (true) {
+     508           0 :                 Rtilde = random.rand() * rMax;
+     509           0 :                 double fTest = random.rand() * frMax * 1.1;
+     510           0 :                 double fR = fr(Rtilde);
+     511           0 :                 if (fTest <= fR) {
+     512             :                         break;
+     513             :                 }
+     514             :         }
+     515             :         double ZPos;
+     516             :         while (true) {
+     517           0 :                 ZPos = (random.rand() - 0.5) * 2 * zMax;
+     518           0 :                 double fTest = random.rand() * fzMax;
+     519           0 :                 double fZ = fz(ZPos);
+     520           0 :                 if (fTest <= fZ) {
+     521             :                         break;
+     522             :                 }
+     523             :         }
+     524             : 
+     525           0 :         int i = random.randInt(3);
+     526           0 :         double thetaTilde = ftheta(i, Rtilde);
+     527           0 :         double RPos = blurR(Rtilde);
+     528           0 :         double phi = blurTheta(thetaTilde, Rtilde);
+     529           0 :         Vector3d pos(cos(phi) * RPos, sin(phi) * RPos, ZPos);
+     530             : 
+     531           0 :         particle.setPosition(pos);
+     532           0 :   }
+     533             : 
+     534           0 : double SourcePulsarDistribution::fr(double r) const {
+     535           0 :         double f = r * pow(r / rEarth, 2.) * exp(-beta * (r - rEarth) / rEarth);
+     536           0 :         return f;
+     537             : }
+     538             : 
+     539           0 : double SourcePulsarDistribution::fz(double z) const{
+     540             :         double Az = 1.;
+     541           0 :         double f = 1. / zg * exp(- fabs(z) / zg);
+     542             :         double fz = Az * f;
+     543           0 :         return fz;
+     544             : }
+     545             : 
+     546           0 : double SourcePulsarDistribution::ftheta(int i, double r) const {
+     547           0 :         const double k_0[] = {4.25, 4.25, 4.89, 4.89};
+     548           0 :         const double r_0[] = {3.48 * kpc, 3.48 * kpc, 4.9 * kpc, 4.9 * kpc};
+     549           0 :         const double theta_0[] = {0., 3.14, 2.52, -0.62};
+     550           0 :         double K = k_0[i];
+     551           0 :         double R = r_0[i];
+     552           0 :         double Theta = theta_0[i];
+     553             : 
+     554           0 :         double theta = K * log(r / R) + Theta;
+     555             : 
+     556           0 :         return theta;
+     557             : }
+     558             : 
+     559           0 : double SourcePulsarDistribution::blurR(double rTilde) const {
+     560           0 :         Random &random = Random::instance();
+     561           0 :         return random.randNorm(rTilde, rBlur * rTilde);
+     562             : }
+     563             : 
+     564           0 : double SourcePulsarDistribution::blurTheta(double thetaTilde, double rTilde) const {
+     565           0 :         Random &random = Random::instance();
+     566           0 :         double thetaCorr = (random.rand() - 0.5) * 2 * M_PI;
+     567           0 :         double tau = thetaCorr * exp(- thetaBlur * rTilde);
+     568           0 :         return thetaTilde + tau;
+     569             : }
+     570             : 
+     571           0 : void SourcePulsarDistribution::setFrMax(double R, double b) {
+     572           0 :         double r = 3 * R / b;
+     573           0 :         frMax = fr(r);
+     574           0 : }
+     575             : 
+     576           0 : void SourcePulsarDistribution::setFzMax(double zg) {
+     577           0 :         fzMax = 1. / zg;
+     578           0 :         return;
+     579             : }
+     580             : 
+     581           0 : void SourcePulsarDistribution::setRMax(double r) {
+     582           0 :         rMax = r;
+     583           0 :         return;
+     584             : }
+     585             : 
+     586           0 : void SourcePulsarDistribution::setZMax(double z) {
+     587           0 :         zMax = z;
+     588           0 :         return;
+     589             : }
+     590             : 
+     591           0 : void SourcePulsarDistribution::setRBlur(double r) {
+     592           0 :         rBlur = r;
+     593           0 :         return;
+     594             : }
+     595             : 
+     596           0 : void SourcePulsarDistribution::setThetaBlur(double theta) {
+     597           0 :         thetaBlur = theta;
+     598           0 :         return;
+     599             : }
+     600             : 
+     601           0 : double SourcePulsarDistribution::getFrMax() {
+     602           0 :         return frMax;
+     603             : }
+     604             : 
+     605           0 : double SourcePulsarDistribution::getFzMax() {
+     606           0 :         return fzMax;
+     607             : }
+     608             : 
+     609           0 : double SourcePulsarDistribution::getRMax() {
+     610           0 :         return rMax;
+     611             : }
+     612             : 
+     613           0 : double SourcePulsarDistribution::getZMax() {
+     614           0 :         return zMax;
+     615             : }
+     616             : 
+     617           0 : double SourcePulsarDistribution::getRBlur() {
+     618           0 :         return rBlur;
+     619             : }
+     620             : 
+     621           0 : double SourcePulsarDistribution::getThetaBlur() {
+     622           0 :         return thetaBlur;
+     623             : }
+     624             : 
+     625             : 
+     626           0 : void SourcePulsarDistribution::setDescription() {
+     627           0 :         std::stringstream ss;
+     628           0 :         ss << "SourcePulsarDistribution: Random position according to pulsar distribution";
+     629           0 :         ss << "rEarth = " << rEarth / kpc << " kpc and ";
+     630           0 :         ss << "zg = " << zg / kpc << " kpc and ";
+     631           0 :         ss << "beta = " << beta << " and ";
+     632           0 :         ss << "r_blur = " << rBlur << " and ";
+     633           0 :         ss << "theta blur = " << thetaBlur << "\n";
+     634           0 :         description = ss.str();
+     635           0 : }
+     636             : 
+     637             : // ----------------------------------------------------------------------------
+     638           1 : SourceUniform1D::SourceUniform1D(double minD, double maxD, bool withCosmology) {
+     639           1 :         this->withCosmology = withCosmology;
+     640           1 :         if (withCosmology) {
+     641           1 :                 this->minD = comoving2LightTravelDistance(minD);
+     642           1 :                 this->maxD = comoving2LightTravelDistance(maxD);
+     643             :         } else {
+     644           0 :                 this->minD = minD;
+     645           0 :                 this->maxD = maxD;
+     646             :         }
+     647           1 :         setDescription();
+     648           1 : }
+     649             : 
+     650           1 : void SourceUniform1D::prepareParticle(ParticleState& particle) const {
+     651           1 :         Random& random = Random::instance();
+     652           1 :         double d = random.rand() * (maxD - minD) + minD;
+     653           1 :         if (withCosmology)
+     654           1 :                 d = lightTravel2ComovingDistance(d);
+     655           1 :         particle.setPosition(Vector3d(d, 0, 0));
+     656           1 : }
+     657             : 
+     658           1 : void SourceUniform1D::setDescription() {
+     659           1 :         std::stringstream ss;
+     660           1 :         ss << "SourceUniform1D: Random uniform position in D = ";
+     661           2 :         ss << minD / Mpc << " - " << maxD / Mpc << " Mpc";
+     662           1 :         if (withCosmology)
+     663           1 :                 ss << " (including cosmology)";
+     664           1 :         ss << "\n";
+     665           1 :         description = ss.str();
+     666           1 : }
+     667             : 
+     668             : // ----------------------------------------------------------------------------
+     669           2 : SourceDensityGrid::SourceDensityGrid(ref_ptr<Grid1f> grid) :
+     670           2 :                 grid(grid) {
+     671             :         float sum = 0;
+     672          14 :         for (int ix = 0; ix < grid->getNx(); ix++) {
+     673         116 :                 for (int iy = 0; iy < grid->getNy(); iy++) {
+     674        1112 :                         for (int iz = 0; iz < grid->getNz(); iz++) {
+     675        1008 :                                 sum += grid->get(ix, iy, iz);
+     676        1008 :                                 grid->get(ix, iy, iz) = sum;
+     677             :                         }
+     678             :                 }
+     679             :         }
+     680           2 :         setDescription();
+     681           2 : }
+     682             : 
+     683       10001 : void SourceDensityGrid::prepareParticle(ParticleState& particle) const {
+     684       10001 :         Random &random = Random::instance();
+     685             : 
+     686             :         // draw random bin
+     687       10001 :         size_t i = random.randBin(grid->getGrid());
+     688       10001 :         Vector3d pos = grid->positionFromIndex(i);
+     689             : 
+     690             :         // draw uniform position within bin
+     691       10001 :         double dx = random.rand() - 0.5;
+     692       10001 :         double dy = random.rand() - 0.5;
+     693       10001 :         double dz = random.rand() - 0.5;
+     694             :         pos += Vector3d(dx, dy, dz) * grid->getSpacing();
+     695             : 
+     696       10001 :         particle.setPosition(pos);
+     697       10001 : }
+     698             : 
+     699           2 : void SourceDensityGrid::setDescription() {
+     700           2 :         description = "SourceDensityGrid: 3D source distribution according to density grid\n";
+     701           2 : }
+     702             : 
+     703             : // ----------------------------------------------------------------------------
+     704           2 : SourceDensityGrid1D::SourceDensityGrid1D(ref_ptr<Grid1f> grid) :
+     705           2 :                 grid(grid) {
+     706           2 :         if (grid->getNy() != 1)
+     707           0 :                 throw std::runtime_error("SourceDensityGrid1D: Ny != 1");
+     708           2 :         if (grid->getNz() != 1)
+     709           0 :                 throw std::runtime_error("SourceDensityGrid1D: Nz != 1");
+     710             : 
+     711             :         float sum = 0;
+     712          22 :         for (int ix = 0; ix < grid->getNx(); ix++) {
+     713          20 :                 sum += grid->get(ix, 0, 0);
+     714          20 :                 grid->get(ix, 0, 0) = sum;
+     715             :         }
+     716           2 :         setDescription();
+     717           2 : }
+     718             : 
+     719         101 : void SourceDensityGrid1D::prepareParticle(ParticleState& particle) const {
+     720         101 :         Random &random = Random::instance();
+     721             : 
+     722             :         // draw random bin
+     723         101 :         size_t i = random.randBin(grid->getGrid());
+     724         101 :         Vector3d pos = grid->positionFromIndex(i);
+     725             : 
+     726             :         // draw uniform position within bin
+     727         101 :         double dx = random.rand() - 0.5;
+     728         101 :         pos.x += dx * grid->getSpacing().x;
+     729             : 
+     730         101 :         particle.setPosition(pos);
+     731         101 : }
+     732             : 
+     733           2 : void SourceDensityGrid1D::setDescription() {
+     734           2 :         description = "SourceDensityGrid1D: 1D source distribution according to density grid\n";
+     735           2 : }
+     736             : 
+     737             : // ----------------------------------------------------------------------------
+     738           3 : SourceIsotropicEmission::SourceIsotropicEmission() {
+     739           3 :         setDescription();
+     740           3 : }
+     741             : 
+     742        1101 : void SourceIsotropicEmission::prepareParticle(ParticleState& particle) const {
+     743        1101 :         Random &random = Random::instance();
+     744        1101 :         particle.setDirection(random.randVector());
+     745        1101 : }
+     746             : 
+     747           3 : void SourceIsotropicEmission::setDescription() {
+     748           3 :         description = "SourceIsotropicEmission: Random isotropic direction\n";
+     749           3 : }
+     750             : 
+     751             : // ----------------------------------------------------------------------------
+     752           1 : SourceDirectedEmission::SourceDirectedEmission(Vector3d mu, double kappa): mu(mu), kappa(kappa) {
+     753           1 :         if (kappa <= 0)
+     754           0 :                 throw std::runtime_error("The concentration parameter kappa should be larger than 0.");
+     755           1 :         setDescription();
+     756           1 : }
+     757             : 
+     758        1000 : void SourceDirectedEmission::prepareCandidate(Candidate &candidate) const {
+     759        1000 :         Random &random = Random::instance();
+     760             : 
+     761             :         Vector3d muvec = mu / mu.getR();
+     762        1000 :         Vector3d v = random.randFisherVector(muvec, kappa);
+     763             : 
+     764        1000 :         v = v.getUnitVector();
+     765        1000 :         candidate.source.setDirection(v);
+     766        1000 :         candidate.created.setDirection(v);
+     767        1000 :         candidate.previous.setDirection(v);
+     768        1000 :         candidate.current.setDirection(v);
+     769             : 
+     770             :         //set the weight of the particle, see eq. 3.1 of PoS(ICRC2019)447
+     771        1000 :         double pdfVonMises = kappa / (2. * M_PI * (1. - exp(-2. * kappa))) * exp(-kappa * (1. - v.dot(mu)));
+     772        1000 :         double weight = 1. / (4. * M_PI * pdfVonMises);
+     773        1000 :         candidate.setWeight(weight);
+     774        1000 : }
+     775             : 
+     776           1 : void SourceDirectedEmission::setDescription() {
+     777           1 :         std::stringstream ss;
+     778           1 :         ss << "SourceDirectedEmission: Random directed emission following the von-Mises-Fisher distribution with mean direction ";
+     779           1 :         ss << mu << " and concentration parameter kappa = ";
+     780           1 :         ss << kappa << "\n";
+     781           1 :         description = ss.str();
+     782           1 : }
+     783             : 
+     784             : // ----------------------------------------------------------------------------
+     785           0 : SourceLambertDistributionOnSphere::SourceLambertDistributionOnSphere(const Vector3d &center, double radius, bool inward) :
+     786           0 :                 center(center), radius(radius) {
+     787           0 :         this->inward = inward;
+     788           0 :         setDescription();
+     789           0 : }
+     790             : 
+     791           0 : void SourceLambertDistributionOnSphere::prepareParticle(ParticleState& particle) const {
+     792           0 :         Random &random = Random::instance();
+     793           0 :         Vector3d normalVector = random.randVector();
+     794           0 :         particle.setPosition(center + normalVector * radius);
+     795           0 :         double sign = inward ? -1 : 1; // negative (positive) Lamberts vector for inward (outward) directed emission
+     796           0 :         particle.setDirection(Vector3d(0, 0, 0) + sign * random.randVectorLamberts(normalVector));
+     797           0 : }
+     798             : 
+     799           0 : void SourceLambertDistributionOnSphere::setDescription() {
+     800           0 :         std::stringstream ss;
+     801           0 :         ss << "SourceLambertDistributionOnSphere: Random position and direction on a Sphere with center ";
+     802           0 :         ss << center / kpc << " kpc and ";
+     803           0 :         ss << radius / kpc << " kpc radius\n";
+     804           0 :         description = ss.str();
+     805           0 : }
+     806             : 
+     807             : // ----------------------------------------------------------------------------
+     808           0 : SourceDirection::SourceDirection(Vector3d direction) :
+     809           0 :                 direction(direction) {
+     810           0 :         setDescription();
+     811           0 : }
+     812             : 
+     813           0 : void SourceDirection::prepareParticle(ParticleState& particle) const {
+     814           0 :         particle.setDirection(direction);
+     815           0 : }
+     816             : 
+     817           0 : void SourceDirection::setDescription() {
+     818           0 :         std::stringstream ss;
+     819           0 :         ss <<  "SourceDirection: Emission direction = " << direction << "\n";
+     820           0 :         description = ss.str();
+     821           0 : }
+     822             : 
+     823             : // ----------------------------------------------------------------------------
+     824           0 : SourceEmissionMap::SourceEmissionMap(EmissionMap *emissionMap) : emissionMap(emissionMap) {
+     825           0 :         setDescription();
+     826           0 : }
+     827             : 
+     828           0 : void SourceEmissionMap::prepareCandidate(Candidate &candidate) const {
+     829           0 :         if (emissionMap) {
+     830           0 :                 bool accept = emissionMap->checkDirection(candidate.source);
+     831           0 :                 candidate.setActive(accept);
+     832             :         }
+     833           0 : }
+     834             : 
+     835           0 : void SourceEmissionMap::setDescription() {
+     836           0 :         description = "SourceEmissionMap: accept only directions from emission map\n";
+     837           0 : }
+     838             : 
+     839           0 : void SourceEmissionMap::setEmissionMap(EmissionMap *emissionMap) {
+     840           0 :         this->emissionMap = emissionMap;
+     841           0 : }
+     842             : 
+     843             : // ----------------------------------------------------------------------------
+     844           1 : SourceEmissionCone::SourceEmissionCone(Vector3d direction, double aperture) :
+     845           1 :         aperture(aperture) {
+     846           1 :         setDirection(direction);
+     847           1 :         setDescription();
+     848             :         
+     849           1 : }
+     850             : 
+     851           1 : void SourceEmissionCone::prepareParticle(ParticleState& particle) const {
+     852           1 :         Random &random = Random::instance();
+     853           1 :         particle.setDirection(random.randConeVector(direction, aperture));
+     854           1 : }
+     855             : 
+     856           1 : void SourceEmissionCone::setDirection(Vector3d dir) {
+     857           1 :         if (dir.getR() == 0) {
+     858           0 :                 throw std::runtime_error("SourceEmissionCone: The direction vector was a null vector.");
+     859             :         } else {
+     860           1 :                 direction = dir.getUnitVector();
+     861             :         }
+     862           1 : }
+     863             : 
+     864           1 : void SourceEmissionCone::setDescription() {
+     865           1 :         std::stringstream ss;
+     866           1 :         ss << "SourceEmissionCone: Jetted emission in ";
+     867           1 :         ss << "direction = " << direction << " with ";
+     868           1 :         ss << "half-opening angle = " << aperture << " rad\n";
+     869           1 :         description = ss.str();
+     870           1 : }
+     871             : 
+     872             : // ----------------------------------------------------------------------------
+     873           1 : SourceRedshift::SourceRedshift(double z) :
+     874           1 :                 z(z) {
+     875           1 :         setDescription();
+     876           1 : }
+     877             : 
+     878           1 : void SourceRedshift::prepareCandidate(Candidate& candidate) const {
+     879           1 :         candidate.setRedshift(z);
+     880           1 : }
+     881             : 
+     882           1 : void SourceRedshift::setDescription() {
+     883           1 :         std::stringstream ss;
+     884           1 :         ss << "SourceRedshift: Redshift z = " << z << "\n";
+     885           1 :         description = ss.str();
+     886           1 : }
+     887             : 
+     888             : // ----------------------------------------------------------------------------
+     889           0 : SourceUniformRedshift::SourceUniformRedshift(double zmin, double zmax) :
+     890           0 :                 zmin(zmin), zmax(zmax) {
+     891           0 :         setDescription();
+     892           0 : }
+     893             : 
+     894           0 : void SourceUniformRedshift::prepareCandidate(Candidate& candidate) const {
+     895           0 :         double z = Random::instance().randUniform(zmin, zmax);
+     896           0 :         candidate.setRedshift(z);
+     897           0 : }
+     898             : 
+     899           0 : void SourceUniformRedshift::setDescription() {
+     900           0 :         std::stringstream ss;
+     901           0 :         ss << "SourceUniformRedshift: Uniform redshift in z = ";
+     902           0 :         ss << zmin << " - " << zmax << "\n";
+     903           0 :         description = ss.str();
+     904           0 : }
+     905             : 
+     906             : // ----------------------------------------------------------------------------
+     907           2 : SourceRedshiftEvolution::SourceRedshiftEvolution(double m, double zmin, double zmax) : m(m), zmin(zmin), zmax(zmax) {
+     908           2 :         std::stringstream ss;
+     909             :         ss << "SourceRedshiftEvolution: (1+z)^m, m = " << m;
+     910           2 :         ss << ", z = " << zmin << " - " << zmax << "\n";
+     911           2 :         description = ss.str();
+     912           2 : }
+     913             : 
+     914         200 : void SourceRedshiftEvolution::prepareCandidate(Candidate& candidate) const {
+     915         200 :         double x = Random::instance().randUniform(0, 1);
+     916             :         double norm, z;
+     917             : 
+     918             :         // special case: m=-1
+     919         200 :         if ((std::abs(m+1)) < std::numeric_limits<double>::epsilon()) {
+     920         100 :                 norm = log1p(zmax) - log1p(zmin);
+     921         100 :                 z = exp(norm*x) * (1+zmin) - 1;
+     922             :         } else {
+     923         100 :                 norm = ( pow(1+zmax, m+1) - pow(1+zmin, m+1) ) / (m+1);
+     924         100 :                 z = pow( norm*(m+1)*x + pow(1+zmin, m+1), 1./(m+1)) - 1;
+     925             :         }
+     926         200 :         candidate.setRedshift(z);
+     927         200 : }
+     928             : 
+     929             : // ----------------------------------------------------------------------------
+     930           1 : SourceRedshift1D::SourceRedshift1D() {
+     931           1 :         setDescription();
+     932           1 : }
+     933             : 
+     934           1 : void SourceRedshift1D::prepareCandidate(Candidate& candidate) const {
+     935           1 :         double d = candidate.source.getPosition().getR();
+     936           1 :         double z = comovingDistance2Redshift(d);
+     937           1 :         candidate.setRedshift(z);
+     938           1 : }
+     939             : 
+     940           1 : void SourceRedshift1D::setDescription() {
+     941           1 :         description = "SourceRedshift1D: Redshift according to source distance\n";
+     942           1 : }
+     943             : 
+     944             : // ----------------------------------------------------------------------------
+     945             : #ifdef CRPROPA_HAVE_MUPARSER
+     946           1 : SourceGenericComposition::SourceGenericComposition(double Emin, double Emax, std::string expression, size_t bins) :
+     947           2 :         Emin(Emin), Emax(Emax), expression(expression), bins(bins) {
+     948             : 
+     949             :         // precalculate energy bins
+     950           1 :         double logEmin = ::log10(Emin);
+     951           1 :         double logEmax = ::log10(Emax);
+     952           1 :         double logStep = (logEmax - logEmin) / bins;
+     953           1 :         energy.resize(bins + 1);
+     954        1026 :         for (size_t i = 0; i <= bins; i++) {
+     955        1025 :                 energy[i] = ::pow(10, logEmin + i * logStep);
+     956             :         }
+     957           1 :         setDescription();
+     958           1 : }
+     959             : 
+     960           2 : void SourceGenericComposition::add(int id, double weight) {
+     961           2 :         int A = massNumber(id);
+     962           2 :         int Z = chargeNumber(id);
+     963             : 
+     964             :         Nucleus n;
+     965           2 :         n.id = id;
+     966             : 
+     967             :         // calculate nuclei cdf
+     968           2 :         mu::Parser p;
+     969             :         double E;
+     970           2 :         p.DefineVar("E", &E);
+     971           2 :         p.DefineConst("Emin", Emin);
+     972           2 :         p.DefineConst("Emax", Emax);
+     973           2 :         p.DefineConst("bins", bins);
+     974           2 :         p.DefineConst("A", (double)A);
+     975           2 :         p.DefineConst("Z", (double)Z);
+     976             : 
+     977           2 :         p.DefineConst("MeV", MeV);
+     978           2 :         p.DefineConst("GeV", GeV);
+     979           2 :         p.DefineConst("TeV", TeV);
+     980           2 :         p.DefineConst("PeV", PeV);
+     981           2 :         p.DefineConst("EeV", EeV);
+     982             : 
+     983           2 :         p.SetExpr(expression);
+     984             : 
+     985             :         // calculate pdf
+     986           2 :         n.cdf.resize(bins + 1);
+     987             : 
+     988        2052 :         for (std::size_t i=0; i<=bins; ++i) {
+     989        2050 :                 E = energy[i];
+     990        2050 :                 n.cdf[i] = p.Eval();
+     991             :         }
+     992             : 
+     993             :         // integrate
+     994        2050 :         for (std::size_t i=bins; i>0; --i) {
+     995        2048 :                 n.cdf[i] = (n.cdf[i-1] + n.cdf[i]) * (energy[i] - energy[i-1]) / 2;
+     996             :         }
+     997           2 :         n.cdf[0] = 0;
+     998             : 
+     999             :         // cumulate
+    1000        2050 :         for (std::size_t i=1; i<=bins; ++i) {
+    1001        2048 :                 n.cdf[i] += n.cdf[i-1];
+    1002             :         }
+    1003             : 
+    1004           2 :         nuclei.push_back(n);
+    1005             : 
+    1006             :         // update composition cdf
+    1007           2 :         if (cdf.size() == 0)
+    1008           1 :                 cdf.push_back(weight * n.cdf.back());
+    1009             :         else
+    1010           1 :                 cdf.push_back(cdf.back() + weight * n.cdf.back());
+    1011           2 : }
+    1012             : 
+    1013           0 : void SourceGenericComposition::add(int A, int Z, double a) {
+    1014           0 :         add(nucleusId(A, Z), a);
+    1015           0 : }
+    1016             : 
+    1017      100000 : void SourceGenericComposition::prepareParticle(ParticleState& particle) const {
+    1018      100000 :         if (nuclei.size() == 0)
+    1019           0 :                 throw std::runtime_error("SourceComposition: No source isotope set");
+    1020             : 
+    1021      100000 :         Random &random = Random::instance();
+    1022             : 
+    1023             : 
+    1024             :         // draw random particle type
+    1025      100000 :         size_t iN = random.randBin(cdf);
+    1026             :         const Nucleus &n = nuclei.at(iN);
+    1027      100000 :         particle.setId(n.id);
+    1028             : 
+    1029             :         // random energy
+    1030      100000 :         double E = interpolate(random.rand() * n.cdf.back(), n.cdf, energy);
+    1031      100000 :         particle.setEnergy(E);
+    1032      100000 : }
+    1033             : 
+    1034           1 : void SourceGenericComposition::setDescription() {
+    1035           1 :         description = "Generice source composition" + expression;
+    1036           1 : }
+    1037             : 
+    1038             : #endif
+    1039             : 
+    1040             : // ----------------------------------------------------------------------------
+    1041             : 
+    1042           1 : SourceTag::SourceTag(std::string tag) {
+    1043           1 :         setTag(tag);
+    1044           1 : }
+    1045             : 
+    1046           1 : void SourceTag::prepareCandidate(Candidate &cand) const {
+    1047           1 :         cand.setTagOrigin(sourceTag);
+    1048           1 : }
+    1049             : 
+    1050           1 : void SourceTag::setDescription() {
+    1051           1 :         description = "SourceTag: " + sourceTag;
+    1052           1 : }
+    1053             : 
+    1054           1 : void SourceTag::setTag(std::string tag) {
+    1055           1 :         sourceTag = tag;
+    1056           1 :         setDescription();
+    1057           1 : }
+    1058             : 
+    1059             : // ----------------------------------------------------------------------------
+    1060             : 
+    1061           0 : SourceMassDistribution::SourceMassDistribution(ref_ptr<Density> density, double max, double x, double y, double z) : 
+    1062           0 :         density(density), maxDensity(max), xMin(-x), xMax(x), yMin(-y), yMax(y), zMin(-z), zMax(z) {}
+    1063             : 
+    1064           0 : void SourceMassDistribution::setMaximalDensity(double maxDensity) {
+    1065           0 :         if (maxDensity <= 0) {
+    1066           0 :                 KISS_LOG_WARNING << "SourceMassDistribution: maximal density must be larger than 0. Nothing changed.\n";
+    1067           0 :                 return;
+    1068             :         }
+    1069           0 :         this->maxDensity = maxDensity;
+    1070             : }
+    1071             : 
+    1072           0 : void SourceMassDistribution::setXrange(double xMin, double xMax) {
+    1073           0 :         if (xMin > xMax) {
+    1074           0 :                 KISS_LOG_WARNING << "SourceMassDistribution: minimal x-value must not exceed the maximal one\n";
+    1075           0 :                 return;
+    1076             :         }
+    1077           0 :         this -> xMin = xMin;
+    1078           0 :         this -> xMax = xMax;
+    1079             : }
+    1080             : 
+    1081           0 : void SourceMassDistribution::setYrange(double yMin, double yMax) {
+    1082           0 :         if (yMin > yMax) {
+    1083           0 :                 KISS_LOG_WARNING << "SourceMassDistribution: minimal y-value must not exceed the maximal one\n";
+    1084           0 :                 return;
+    1085             :         }
+    1086           0 :         this -> yMin = yMin;
+    1087           0 :         this -> yMax = yMax;
+    1088             : }
+    1089             : 
+    1090           0 : void SourceMassDistribution::setZrange(double zMin, double zMax) {
+    1091           0 :         if (zMin > zMax) {
+    1092           0 :                 KISS_LOG_WARNING << "SourceMassDistribution: minimal z-value must not exceed the maximal one\n";
+    1093           0 :                 return;
+    1094             :         }
+    1095           0 :         this -> zMin = zMin;
+    1096           0 :         this -> zMax = zMax;
+    1097             : }
+    1098             : 
+    1099           0 : Vector3d SourceMassDistribution::samplePosition() const {
+    1100             :         Vector3d pos; 
+    1101           0 :         Random &rand = Random::instance();
+    1102             : 
+    1103           0 :         for (int i = 0; i < maxTries; i++) {
+    1104           0 :                 pos.x = rand.randUniform(xMin, xMax);
+    1105           0 :                 pos.y = rand.randUniform(yMin, yMax);
+    1106           0 :                 pos.z = rand.randUniform(zMin, zMax);
+    1107             : 
+    1108           0 :                 double n_density = density->getDensity(pos) / maxDensity;
+    1109           0 :                 double n_test = rand.rand();
+    1110           0 :                 if (n_test < n_density) {
+    1111             :                         return pos;
+    1112             :                 }
+    1113             :         }
+    1114           0 :         KISS_LOG_WARNING << "SourceMassDistribution: sampling a position was not possible within " 
+    1115           0 :                 << maxTries << " tries. Please check the maximum density or increse the number of maximal tries. \n";
+    1116             :         return Vector3d(0.);
+    1117             : }       
+    1118             : 
+    1119           0 : void SourceMassDistribution::prepareParticle(ParticleState &state) const {
+    1120           0 :         Vector3d pos = samplePosition();
+    1121           0 :         state.setPosition(pos);
+    1122           0 : }
+    1123             : 
+    1124           0 : void SourceMassDistribution::setMaximalTries(int tries) {
+    1125           0 :         this -> maxTries = tries;
+    1126           0 : }
+    1127             : 
+    1128           0 : std::string SourceMassDistribution::getDescription() {
+    1129           0 :         std::stringstream ss;
+    1130           0 :         ss << "SourceMassDistribuion: following the density distribution :\n";
+    1131           0 :         ss << "\t" << density -> getDescription();
+    1132           0 :         ss << "with a maximal density of " << maxDensity << " / m^3 \n";
+    1133           0 :         ss << "using the sampling range: \n";
+    1134           0 :         ss << "\t x in [" << xMin / kpc << " ; " << xMax / kpc << "] kpc \n";
+    1135           0 :         ss << "\t y in [" << yMin / kpc << " ; " << yMax / kpc << "] kpc \n";
+    1136           0 :         ss << "\t z in [" << zMin / kpc << " ; " << zMax / kpc << "] kpc \n";
+    1137           0 :         ss << "with maximal number of tries for sampling of " << maxTries << "\n";
+    1138             : 
+    1139           0 :         return ss.str();
+    1140           0 : }
+    1141             : 
+    1142             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Variant.cpp.func-sort-c.html b/doc/coverageReport/src/Variant.cpp.func-sort-c.html new file mode 100644 index 000000000..3bcf5eae5 --- /dev/null +++ b/doc/coverageReport/src/Variant.cpp.func-sort-c.html @@ -0,0 +1,264 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Variant.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Variant.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:7151913.7 %
Date:2024-04-08 14:58:22Functions:184837.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa7Variant11getTypeNameENS0_4TypeE0
_ZN7crpropa7Variant6resizeEm0
_ZN7crpropa7Variant6toTypeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa7VariantC2ENS0_4TypeE0
_ZN7crpropa7VariantcvRSt6vectorIS0_SaIS0_EEEv0
_ZN7crpropa7VariantixEm0
_ZN7crpropalsERSoRKNS_7VariantE0
_ZNK7crpropa7Variant10toVector3cEv0
_ZNK7crpropa7Variant10toVector3dEv0
_ZNK7crpropa7Variant10toVector3fEv0
_ZNK7crpropa7Variant11getTypeNameEv0
_ZNK7crpropa7Variant12toLongDoubleEv0
_ZNK7crpropa7Variant14toComplexFloatEv0
_ZNK7crpropa7Variant15toComplexDoubleEv0
_ZNK7crpropa7Variant4sizeEv0
_ZNK7crpropa7Variant6toCharEv0
_ZNK7crpropa7Variant7getSizeEv0
_ZNK7crpropa7Variant7toFloatEv0
_ZNK7crpropa7Variant7toInt16Ev0
_ZNK7crpropa7Variant7toInt32Ev0
_ZNK7crpropa7Variant7toUCharEv0
_ZNK7crpropa7Variant8toUInt16Ev0
_ZNK7crpropa7Variant8toUInt32Ev0
_ZNK7crpropa7Variant8toUInt64Ev0
_ZNK7crpropa7Variant8toVectorEv0
_ZNK7crpropa7Variant9getSizeOfEv0
_ZNK7crpropa7VariantcvRKSt6vectorIS0_SaIS0_EEEv0
_ZNK7crpropa7VariantixEm0
_ZNK7crpropa7VariantneEPKc0
_ZNK7crpropa7VariantneERKS0_0
_ZN7crpropa7Variant12copyToBufferEPv1
_ZN7crpropa7Variant10fromStringERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS0_4TypeE2
_ZNK7crpropa7Variant5checkENS0_4TypeE2
_ZNK7crpropa7Variant6toBoolEv2
_ZNK7crpropa7Variant7toInt64Ev2
_ZN7crpropa7VariantC2EPKc3
_ZNK7crpropa7VarianteqERKS0_4
_ZNK7crpropa7Variant8toDoubleEv6
_ZNK7crpropa7Variant8toStringERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE6
_ZNK7crpropa7Variant7isValidEv8
_ZNK7crpropa7Variant11getTypeInfoEv60
_ZN7crpropa7VariantC2Ev1147
_ZN7crpropa7VariantaSERKS0_1153
_ZN7crpropa7VariantC2ERKS0_2306
_ZN7crpropa7Variant4copyERKS0_3459
_ZN7crpropa7VariantD2Ev4610
_ZN7crpropa7Variant5clearENS0_4TypeE5785
_ZN7crpropa7Variant5checkENS0_4TypeE5793
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Variant.cpp.func.html b/doc/coverageReport/src/Variant.cpp.func.html new file mode 100644 index 000000000..878d842c0 --- /dev/null +++ b/doc/coverageReport/src/Variant.cpp.func.html @@ -0,0 +1,264 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Variant.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Variant.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:7151913.7 %
Date:2024-04-08 14:58:22Functions:184837.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa7Variant10fromStringERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS0_4TypeE2
_ZN7crpropa7Variant11getTypeNameENS0_4TypeE0
_ZN7crpropa7Variant12copyToBufferEPv1
_ZN7crpropa7Variant4copyERKS0_3459
_ZN7crpropa7Variant5checkENS0_4TypeE5793
_ZN7crpropa7Variant5clearENS0_4TypeE5785
_ZN7crpropa7Variant6resizeEm0
_ZN7crpropa7Variant6toTypeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa7VariantC2ENS0_4TypeE0
_ZN7crpropa7VariantC2EPKc3
_ZN7crpropa7VariantC2ERKS0_2306
_ZN7crpropa7VariantC2Ev1147
_ZN7crpropa7VariantD2Ev4610
_ZN7crpropa7VariantaSERKS0_1153
_ZN7crpropa7VariantcvRSt6vectorIS0_SaIS0_EEEv0
_ZN7crpropa7VariantixEm0
_ZN7crpropalsERSoRKNS_7VariantE0
_ZNK7crpropa7Variant10toVector3cEv0
_ZNK7crpropa7Variant10toVector3dEv0
_ZNK7crpropa7Variant10toVector3fEv0
_ZNK7crpropa7Variant11getTypeInfoEv60
_ZNK7crpropa7Variant11getTypeNameEv0
_ZNK7crpropa7Variant12toLongDoubleEv0
_ZNK7crpropa7Variant14toComplexFloatEv0
_ZNK7crpropa7Variant15toComplexDoubleEv0
_ZNK7crpropa7Variant4sizeEv0
_ZNK7crpropa7Variant5checkENS0_4TypeE2
_ZNK7crpropa7Variant6toBoolEv2
_ZNK7crpropa7Variant6toCharEv0
_ZNK7crpropa7Variant7getSizeEv0
_ZNK7crpropa7Variant7isValidEv8
_ZNK7crpropa7Variant7toFloatEv0
_ZNK7crpropa7Variant7toInt16Ev0
_ZNK7crpropa7Variant7toInt32Ev0
_ZNK7crpropa7Variant7toInt64Ev2
_ZNK7crpropa7Variant7toUCharEv0
_ZNK7crpropa7Variant8toDoubleEv6
_ZNK7crpropa7Variant8toStringERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE6
_ZNK7crpropa7Variant8toUInt16Ev0
_ZNK7crpropa7Variant8toUInt32Ev0
_ZNK7crpropa7Variant8toUInt64Ev0
_ZNK7crpropa7Variant8toVectorEv0
_ZNK7crpropa7Variant9getSizeOfEv0
_ZNK7crpropa7VariantcvRKSt6vectorIS0_SaIS0_EEEv0
_ZNK7crpropa7VarianteqERKS0_4
_ZNK7crpropa7VariantixEm0
_ZNK7crpropa7VariantneEPKc0
_ZNK7crpropa7VariantneERKS0_0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/Variant.cpp.gcov.html b/doc/coverageReport/src/Variant.cpp.gcov.html new file mode 100644 index 000000000..b1925926a --- /dev/null +++ b/doc/coverageReport/src/Variant.cpp.gcov.html @@ -0,0 +1,1200 @@ + + + + + + + LCOV - coverage.info.cleaned - src/Variant.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - Variant.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:7151913.7 %
Date:2024-04-08 14:58:22Functions:184837.5 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : //-------------------------------------------------------------
+       2             : // Based on Variant.cc in the Physics eXtension Library (PXL) -
+       3             : // http://vispa.physik.rwth-aachen.de/                        -
+       4             : // Licensed under a LGPL-2 or later license                   -
+       5             : //-------------------------------------------------------------
+       6             : 
+       7             : #include "crpropa/Variant.h"
+       8             : 
+       9             : 
+      10             : namespace crpropa {
+      11             : 
+      12             : 
+      13        1147 : Variant::Variant() : type(TYPE_NONE) {
+      14        1147 : }
+      15             : 
+      16           0 : Variant::Variant(Type t) : type(TYPE_NONE) {
+      17           0 :         check(t);
+      18           0 : }
+      19             : 
+      20        2306 : Variant::Variant(const Variant& v) : type(TYPE_NONE) {
+      21        2306 :         copy(v);
+      22        2306 : }
+      23             : 
+      24           3 : Variant::Variant(const char* s) {
+      25           3 :         data._t_string = new std::string(s);
+      26           3 :         type = TYPE_STRING;
+      27           3 : }
+      28             : 
+      29        4610 : Variant::~Variant() {
+      30        4610 :         clear();
+      31        4610 : }
+      32             : 
+      33           0 : const char* Variant::getTypeName() const {
+      34           0 :         return getTypeName(type);
+      35             : }
+      36             : 
+      37           0 : const char* Variant::getTypeName(Type t) {
+      38             :         if (t == TYPE_NONE)
+      39             :                 return "none";
+      40             :         else if (t == TYPE_BOOL)
+      41           0 :                 return "bool";
+      42             :         else if (t == TYPE_CHAR)
+      43           0 :                 return "char";
+      44             :         else if (t == TYPE_UCHAR)
+      45           0 :                 return "uchar";
+      46             :         else if (t == TYPE_INT16)
+      47           0 :                 return "int16";
+      48             :         else if (t == TYPE_UINT16)
+      49           0 :                 return "uint16";
+      50             :         else if (t == TYPE_INT32)
+      51           0 :                 return "int32";
+      52             :         else if (t == TYPE_UINT32)
+      53           0 :                 return "uint32";
+      54             :         else if (t == TYPE_INT64)
+      55           0 :                 return "int64";
+      56             :         else if (t == TYPE_UINT64)
+      57           0 :                 return "uint64";
+      58             :         else if (t == TYPE_FLOAT)
+      59           0 :                 return "float";
+      60             :         else if (t == TYPE_DOUBLE)
+      61           0 :                 return "double";
+      62             :         else if (t == TYPE_LONGDOUBLE)
+      63           0 :                 return "ldouble";
+      64             :         else if (t == TYPE_COMPLEXF)
+      65           0 :                 return "complex_f";
+      66             :         else if (t == TYPE_COMPLEXD)
+      67           0 :                 return "complex_d";
+      68             :         else if (t == TYPE_STRING)
+      69           0 :                 return "string";
+      70             :         else if (t == TYPE_VECTOR3F)
+      71           0 :                 return "Vector3f";
+      72             :         else if (t == TYPE_VECTOR3D)
+      73           0 :                 return "Vector3d";
+      74             :         else if (t == TYPE_VECTOR3C)
+      75           0 :                 return "Vector3c";
+      76             :         else if (t == TYPE_VECTOR)
+      77           0 :                 return "vector";
+      78             :         else
+      79           0 :                 return "unknown";
+      80             : }
+      81             : 
+      82          60 : const std::type_info& Variant::getTypeInfo() const {
+      83          60 :         if (type == TYPE_BOOL) {
+      84             :                 const std::type_info& ti = typeid(data._t_bool);
+      85             :                 return ti;
+      86             :         } else if (type == TYPE_CHAR) {
+      87             :                 const std::type_info& ti = typeid(data._t_char);
+      88             :                 return ti;
+      89             :         } else if (type == TYPE_UCHAR) {
+      90             :                 const std::type_info& ti = typeid(data._t_uchar);
+      91           0 :                 return ti;
+      92             :         } else if (type == TYPE_INT16) {
+      93             :                 const std::type_info& ti = typeid(data._t_int16);
+      94           0 :                 return ti;
+      95             :         } else if (type == TYPE_UINT16) {
+      96             :                 const std::type_info& ti = typeid(data._t_uint16);
+      97           0 :                 return ti;
+      98             :         } else if (type == TYPE_INT32) {
+      99             :                 const std::type_info& ti = typeid(data._t_int32);
+     100          12 :                 return ti;
+     101             :         } else if (type == TYPE_UINT32) {
+     102             :                 const std::type_info& ti = typeid(data._t_uint32);
+     103           0 :                 return ti;
+     104             :         } else if (type == TYPE_INT64) {
+     105             :                 const std::type_info& ti = typeid(data._t_int64);
+     106           0 :                 return ti;
+     107             :         } else if (type == TYPE_UINT64) {
+     108             :                 const std::type_info& ti = typeid(data._t_uint64);
+     109           0 :                 return ti;
+     110             :         } else if (type == TYPE_FLOAT) {
+     111             :                 const std::type_info& ti = typeid(data._t_float);
+     112           0 :                 return ti;
+     113             :         } else if (type == TYPE_DOUBLE) {
+     114             :                 const std::type_info& ti = typeid(data._t_double);
+     115          22 :                 return ti;
+     116             :         } else if (type == TYPE_LONGDOUBLE)     {
+     117             :                 const std::type_info& ti = typeid(data._t_ldouble);
+     118           0 :                 return ti;
+     119             :         } else if (type == TYPE_STRING) {
+     120             :                 const std::type_info& ti = typeid(*data._t_string);
+     121          24 :                 return ti;
+     122             :         } else if (type == TYPE_COMPLEXF) { // pointer needed?
+     123             :                 const std::type_info& ti = typeid(*data._t_complex_f);
+     124           0 :                 return ti;
+     125             :         } else if (type == TYPE_COMPLEXD) {
+     126             :                 const std::type_info& ti = typeid(*data._t_complex_d);
+     127           0 :                 return ti;
+     128             :         } else if (type == TYPE_VECTOR3D) {
+     129             :                 const std::type_info& ti = typeid(data._t_vector3d);
+     130           0 :                 return ti;
+     131             :         } else if (type == TYPE_VECTOR3F) {
+     132             :                 const std::type_info& ti = typeid(data._t_vector3f);
+     133           0 :                 return ti;
+     134             :         } else if (type == TYPE_VECTOR) {
+     135             :                 const std::type_info& ti = typeid(*data._t_vector);
+     136           0 :                 return ti;
+     137             :         } else {
+     138             :                 const std::type_info& ti = typeid(0);
+     139           0 :                 return ti;
+     140             :         }
+     141             : }
+     142             : 
+     143           0 : Variant::Type Variant::toType(const std::string& name) {
+     144           0 :         if (name == "none")
+     145             :                 return TYPE_NONE;
+     146           0 :         else if (name == "bool")
+     147             :                 return TYPE_BOOL;
+     148           0 :         else if (name == "char") 
+     149             :                 return TYPE_CHAR;
+     150           0 :         else if (name == "uchar")
+     151             :                 return TYPE_UCHAR;
+     152           0 :         else if (name == "int16")
+     153             :                 return TYPE_INT16;
+     154           0 :         else if (name == "uint16")
+     155             :                 return TYPE_UINT16;
+     156           0 :         else if (name == "int32")
+     157             :                 return TYPE_INT32;
+     158           0 :         else if (name == "uint32")
+     159             :                 return TYPE_UINT32;
+     160           0 :         else if (name == "int64")
+     161             :                 return TYPE_INT64;
+     162           0 :         else if (name == "uint64")
+     163             :                 return TYPE_UINT64;
+     164           0 :         else if (name == "float")
+     165             :                 return TYPE_FLOAT;
+     166           0 :         else if (name == "double")
+     167             :                 return TYPE_DOUBLE;
+     168           0 :         else if (name == "long double")
+     169             :                 return TYPE_LONGDOUBLE;
+     170           0 :         else if (name == "complex_f")
+     171             :                 return TYPE_COMPLEXF;
+     172           0 :         else if (name == "complex_d")
+     173             :                 return TYPE_COMPLEXD;
+     174           0 :          else if (name == "string")
+     175             :                 return TYPE_STRING;
+     176           0 :         else if (name == "Vector3f")
+     177             :                 return TYPE_VECTOR3F;
+     178           0 :         else if (name == "Vector3d")
+     179             :                 return TYPE_VECTOR3D;
+     180           0 :         else if (name == "Vector3c")
+     181             :                 return TYPE_VECTOR3C;
+     182           0 :         else if (name == "vector")
+     183             :                 return TYPE_VECTOR;
+     184             :         else
+     185           0 :                 return TYPE_NONE;
+     186             : }
+     187             : 
+     188           2 : bool Variant::toBool() const {
+     189           2 :         switch (type) {
+     190           2 :                 case TYPE_BOOL:
+     191           2 :                         return data._t_bool;
+     192             :                         break;
+     193           0 :                 case TYPE_CHAR:
+     194           0 :                         return data._t_char != 0;
+     195             :                         break;
+     196           0 :                 case TYPE_UCHAR:
+     197           0 :                         return data._t_uchar != 0;
+     198             :                         break;
+     199           0 :                 case TYPE_INT16:
+     200           0 :                         return data._t_int16 != 0;
+     201             :                         break;
+     202           0 :                 case TYPE_UINT16:
+     203           0 :                         return data._t_uint16 != 0;
+     204             :                         break;
+     205           0 :                 case TYPE_INT32:
+     206           0 :                         return data._t_int32 != 0;
+     207             :                         break;
+     208           0 :                 case TYPE_UINT32:
+     209           0 :                         return data._t_uint32 != 0;
+     210             :                         break;
+     211           0 :                 case TYPE_INT64:
+     212           0 :                         return data._t_int64 != 0;
+     213             :                         break;
+     214           0 :                 case TYPE_UINT64:
+     215           0 :                         return data._t_uint64 != 0;
+     216             :                         break;
+     217           0 :                 case TYPE_STRING: {
+     218           0 :                                 std::string upperstr(*data._t_string);
+     219             :                                 std::transform(upperstr.begin(), upperstr.end(), upperstr.begin(), (int(*) (int)) toupper);
+     220           0 :                                 if (upperstr == "YES" || upperstr == "TRUE" || upperstr == "1")
+     221           0 :                                         return true;
+     222           0 :                                 else if (upperstr == "NO" || upperstr == "FALSE" || upperstr == "0")
+     223           0 :                                         return false;
+     224             :                                 else
+     225           0 :                                         throw bad_conversion(type, TYPE_BOOL);
+     226             :                         }
+     227             :                         break;
+     228           0 :                 case TYPE_COMPLEXF: {
+     229           0 :                                 if (data._t_complex_f->real() == 0 && data._t_complex_f->imag() == 0)
+     230           0 :                                         return true;
+     231             :                                 else
+     232             :                                         return false;
+     233             :                         }
+     234             :                         break;
+     235           0 :                 case TYPE_COMPLEXD: {
+     236           0 :                                 if (data._t_complex_d->real() == 0 && data._t_complex_d->imag() == 0)
+     237           0 :                                         return true;
+     238             :                                 else
+     239             :                                         return false;
+     240             :                         }
+     241             :                         break;
+     242           0 :                 case TYPE_VECTOR:
+     243           0 :                         return data._t_vector->size() != 0;
+     244             :                         break;
+     245           0 :                 case TYPE_FLOAT:
+     246             :                 case TYPE_DOUBLE:
+     247             :                 case TYPE_LONGDOUBLE:
+     248             :                 default:
+     249           0 :                         throw bad_conversion(type, TYPE_BOOL);
+     250             :                         break;
+     251             :         }
+     252             : 
+     253             :         return false;
+     254             : }
+     255             : 
+     256           0 : float Variant::toFloat() const {
+     257           0 :         switch (type) {
+     258           0 :                 case TYPE_BOOL:
+     259           0 :                         return data._t_bool ? (float) 1.0 : (float) 0.0; 
+     260             :                         break;
+     261           0 :                 case TYPE_CHAR:
+     262           0 :                         return static_cast<float>(data._t_char);
+     263             :                         break;
+     264           0 :                 case TYPE_UCHAR:
+     265           0 :                         return static_cast<float>(data._t_uchar);
+     266             :                         break;
+     267           0 :                 case TYPE_INT16:
+     268           0 :                         return static_cast<float>(data._t_int16);
+     269             :                         break;
+     270           0 :                 case TYPE_INT32:
+     271           0 :                         return static_cast<float>(data._t_int32);
+     272             :                         break;
+     273           0 :                 case TYPE_INT64:
+     274           0 :                         return static_cast<float>(data._t_int64);
+     275             :                         break;
+     276           0 :                 case TYPE_UINT16:
+     277           0 :                         return static_cast<float>(data._t_uint16);
+     278             :                         break;
+     279           0 :                 case TYPE_UINT32:
+     280           0 :                         return static_cast<float>(data._t_uint32);
+     281             :                         break;
+     282           0 :                 case TYPE_UINT64:
+     283           0 :                         return static_cast<float>(data._t_uint64);
+     284             :                         break;
+     285           0 :                 case TYPE_FLOAT:
+     286           0 :                         return static_cast<float>(data._t_float);
+     287             :                         break;
+     288           0 :                 case TYPE_DOUBLE:
+     289           0 :                         return static_cast<float>(data._t_double);
+     290             :                         break;
+     291           0 :                 case TYPE_LONGDOUBLE:
+     292           0 :                         return static_cast<float>(data._t_ldouble);
+     293             :                         break;
+     294           0 :                 case TYPE_STRING:
+     295           0 :                         return static_cast<float>(std::atof(data._t_string->c_str()));
+     296             :                         break;
+     297           0 :                 case TYPE_COMPLEXF: {
+     298           0 :                                 if (data._t_complex_f->imag() == 0)
+     299           0 :                                         return static_cast<float>(data._t_complex_f->real());
+     300             :                                 else
+     301           0 :                                         throw bad_conversion(type, TYPE_COMPLEXF);
+     302             :                         }
+     303             :                         break;
+     304           0 :                 case TYPE_COMPLEXD: {
+     305           0 :                                 if (data._t_complex_d->imag() == 0)
+     306           0 :                                         return static_cast<float>(data._t_complex_d->real());
+     307             :                                 else
+     308           0 :                                         throw bad_conversion(type, TYPE_COMPLEXD);
+     309             :                         }
+     310             :                         break;
+     311           0 :                 default:
+     312           0 :                         throw bad_conversion(type, TYPE_FLOAT);
+     313             :                         break;
+     314             :         }
+     315             : 
+     316             :         return 0.;
+     317             : }
+     318             : 
+     319           6 : double Variant::toDouble() const {
+     320           6 :         switch (type) {
+     321           0 :                 case TYPE_BOOL:
+     322           0 :                         return data._t_bool ? (double) 1.0 : (double) 0.0; 
+     323             :                         break;
+     324           0 :                 case TYPE_CHAR:
+     325           0 :                         return static_cast<double>(data._t_char);
+     326             :                         break;
+     327           0 :                 case TYPE_UCHAR:
+     328           0 :                         return static_cast<double>(data._t_uchar);
+     329             :                         break;
+     330           0 :                 case TYPE_INT16:
+     331           0 :                         return static_cast<double>(data._t_int16);
+     332             :                         break;
+     333           0 :                 case TYPE_INT32:
+     334           0 :                         return static_cast<double>(data._t_int32);
+     335             :                         break;
+     336           0 :                 case TYPE_INT64:
+     337           0 :                         return static_cast<double>(data._t_int64);
+     338             :                         break;
+     339           0 :                 case TYPE_UINT16:
+     340           0 :                         return static_cast<double>(data._t_uint16);
+     341             :                         break;
+     342           0 :                 case TYPE_UINT32:
+     343           0 :                         return static_cast<double>(data._t_uint32);
+     344             :                         break;
+     345           0 :                 case TYPE_UINT64:
+     346           0 :                         return static_cast<double>(data._t_uint64);
+     347             :                         break;
+     348           0 :                 case TYPE_FLOAT:
+     349           0 :                         return static_cast<double>(data._t_float);
+     350             :                         break;
+     351           6 :                 case TYPE_DOUBLE:
+     352           6 :                         return static_cast<double>(data._t_double);
+     353             :                         break;
+     354           0 :                 case TYPE_LONGDOUBLE:
+     355           0 :                         return static_cast<double>(data._t_ldouble);
+     356             :                         break;
+     357           0 :                 case TYPE_COMPLEXF: {
+     358           0 :                                 if (data._t_complex_f->imag() == 0)
+     359           0 :                                         return static_cast<double>(data._t_complex_f->real());
+     360             :                                 else
+     361           0 :                                         throw bad_conversion(type, TYPE_COMPLEXF);
+     362             :                         }
+     363             :                         break;
+     364           0 :                 case TYPE_COMPLEXD: {
+     365           0 :                                 if (data._t_complex_d->imag() == 0)
+     366           0 :                                         return static_cast<double>(data._t_complex_d->real());
+     367             :                                 else
+     368           0 :                                         throw bad_conversion(type, TYPE_COMPLEXD);
+     369             :                         }
+     370             :                         break;
+     371           0 :                 case TYPE_STRING:
+     372           0 :                         return static_cast<double>(std::atof(data._t_string->c_str()));
+     373             :                         break;
+     374           0 :                 default:
+     375           0 :                         throw bad_conversion(type, TYPE_DOUBLE);
+     376             :                         break;
+     377             :         }
+     378             : 
+     379             :         return 0.;
+     380             : }
+     381             : 
+     382           0 : long double Variant::toLongDouble() const {
+     383           0 :         switch (type) {
+     384           0 :                 case TYPE_BOOL:
+     385           0 :                         return data._t_bool ? (long double) 1.0 : (long double) 0.0; 
+     386             :                         break;
+     387           0 :                 case TYPE_CHAR:
+     388           0 :                         return static_cast<long double>(data._t_char);
+     389             :                         break;
+     390           0 :                 case TYPE_UCHAR:
+     391           0 :                         return static_cast<long double>(data._t_uchar);
+     392             :                         break;
+     393           0 :                 case TYPE_INT16:
+     394           0 :                         return static_cast<long double>(data._t_int16);
+     395             :                         break;
+     396           0 :                 case TYPE_INT32:
+     397           0 :                         return static_cast<long double>(data._t_int32);
+     398             :                         break;
+     399           0 :                 case TYPE_INT64:
+     400           0 :                         return static_cast<long double>(data._t_int64);
+     401             :                         break;
+     402           0 :                 case TYPE_UINT16:
+     403           0 :                         return static_cast<long double>(data._t_uint16);
+     404             :                         break;
+     405           0 :                 case TYPE_UINT32:
+     406           0 :                         return static_cast<long double>(data._t_uint32);
+     407             :                         break;
+     408           0 :                 case TYPE_UINT64:
+     409           0 :                         return static_cast<long double>(data._t_uint64);
+     410             :                         break;
+     411           0 :                 case TYPE_FLOAT:
+     412           0 :                         return static_cast<long double>(data._t_float);
+     413             :                         break;
+     414           0 :                 case TYPE_DOUBLE:
+     415           0 :                         return static_cast<long double>(data._t_double);
+     416             :                         break;
+     417           0 :                 case TYPE_LONGDOUBLE:
+     418           0 :                         return static_cast<long double>(data._t_ldouble);
+     419             :                         break;
+     420           0 :                 case TYPE_COMPLEXF: {
+     421           0 :                                 if (data._t_complex_f->imag() == 0)
+     422           0 :                                         return static_cast<long double>(data._t_complex_f->real());
+     423             :                                 else
+     424           0 :                                         throw bad_conversion(type, TYPE_COMPLEXF);
+     425             :                         }
+     426             :                         break;
+     427           0 :                 case TYPE_COMPLEXD: {
+     428           0 :                                 if (data._t_complex_d->imag() == 0)
+     429           0 :                                         return static_cast<long double>(data._t_complex_d->real());
+     430             :                                 else
+     431           0 :                                         throw bad_conversion(type, TYPE_COMPLEXD);
+     432             :                         }
+     433             :                         break;
+     434           0 :                 case TYPE_STRING:
+     435           0 :                         return static_cast<double>(std::atof(data._t_string->c_str()));
+     436             :                         break;
+     437           0 :                 default:
+     438           0 :                         throw bad_conversion(type, TYPE_LONGDOUBLE);
+     439             :                         break;
+     440             :         }
+     441             : 
+     442             :         return 0.;
+     443             : }
+     444             : 
+     445           0 : std::complex<float> Variant::toComplexFloat() const {
+     446           0 :         switch (type) {
+     447           0 :                 case TYPE_COMPLEXF:
+     448           0 :                         return static_cast<std::complex<float>>(*data._t_complex_f);
+     449             :                         break;
+     450           0 :                 case TYPE_COMPLEXD:
+     451           0 :                         return static_cast<std::complex<float>>(*data._t_complex_d);
+     452             :                         break;
+     453           0 :                 default:
+     454           0 :                         throw bad_conversion(type, TYPE_COMPLEXF);
+     455             :                         break;
+     456             :         }
+     457             : }  
+     458             : 
+     459           0 : std::complex<double> Variant::toComplexDouble() const {
+     460           0 :         switch (type) {
+     461           0 :                 case TYPE_COMPLEXF:
+     462           0 :                         return static_cast<std::complex<double>>(*data._t_complex_f);
+     463             :                         break;
+     464           0 :                 case TYPE_COMPLEXD:
+     465           0 :                         return static_cast<std::complex<double>>(*data._t_complex_d);
+     466             :                         break;
+     467           0 :                 default:
+     468           0 :                         throw bad_conversion(type, TYPE_COMPLEXD);
+     469             :                         break;
+     470             :         }
+     471             : }  
+     472             : 
+     473           0 : Vector3f Variant::toVector3f() const {
+     474           0 :         switch (type) {
+     475           0 :                 case TYPE_VECTOR3F:
+     476           0 :                         return static_cast<Vector3f>(*data._t_vector3f);
+     477             :                         break;
+     478           0 :                 case TYPE_VECTOR3D:
+     479           0 :                         return static_cast<Vector3f>(*data._t_vector3d);
+     480             :                         break;
+     481           0 :                 default:
+     482           0 :                         throw bad_conversion(type, TYPE_VECTOR3F);
+     483             :                         break;
+     484             :         }
+     485             : }
+     486             : 
+     487           0 : Vector3d Variant::toVector3d() const {
+     488           0 :         switch (type) {
+     489           0 :                 case TYPE_VECTOR3F:
+     490           0 :                         return static_cast<Vector3d>(*data._t_vector3f);
+     491             :                         break;
+     492           0 :                 case TYPE_VECTOR3D:
+     493           0 :                         return static_cast<Vector3d>(*data._t_vector3d);
+     494             :                         break;
+     495           0 :                 default:
+     496           0 :                         throw bad_conversion(type, TYPE_VECTOR3D);
+     497             :                         break;
+     498             :         }
+     499             : }
+     500             : 
+     501           0 : Vector3<std::complex<double>> Variant::toVector3c() const {
+     502           0 :         switch (type) {
+     503           0 :                 case TYPE_VECTOR3C:
+     504           0 :                         return static_cast<Vector3c>(*data._t_vector3c);
+     505             :                         break;
+     506           0 :                 default:
+     507           0 :                         throw bad_conversion(type, TYPE_VECTOR3C);
+     508             :                         break;
+     509             :         }
+     510             : }
+     511             : 
+     512           6 : std::string Variant::toString(const std::string& delimiter) const {
+     513           6 :         if (type == TYPE_STRING)
+     514           3 :                 return *data._t_string;
+     515             : 
+     516           3 :         std::stringstream ss;
+     517             : 
+     518           3 :         if (type == TYPE_BOOL) {
+     519           0 :                 ss << data._t_bool;
+     520             :         } else if (type == TYPE_CHAR) {
+     521           0 :                 ss << data._t_char;
+     522             :         } else if (type == TYPE_UCHAR) {
+     523           0 :                 ss << data._t_uchar;
+     524             :         } else if (type == TYPE_INT16) {
+     525           0 :                 ss << data._t_int16;
+     526             :         } else if (type == TYPE_UINT16) {
+     527           0 :                 ss << data._t_uint16;
+     528             :         } else if (type == TYPE_INT32) {
+     529           1 :                 ss << data._t_int32;
+     530             :         } else if (type == TYPE_UINT32) {
+     531           0 :                 ss << data._t_uint32;
+     532             :         } else if (type == TYPE_INT64) {
+     533           1 :                 ss << data._t_int64;
+     534             :         } else if (type == TYPE_UINT64) {
+     535           0 :                 ss << data._t_uint64;
+     536             :         } else if (type == TYPE_FLOAT) {
+     537           0 :                 ss << std::scientific << data._t_float;
+     538             :         } else if (type == TYPE_DOUBLE) {
+     539           1 :                 ss << std::scientific << data._t_double;
+     540             :         } else if (type == TYPE_LONGDOUBLE) {
+     541           0 :                 ss << std::scientific << data._t_ldouble;
+     542             :         } else if (type == TYPE_COMPLEXF) {
+     543           0 :                 ss << std::scientific << data._t_complex_f->real() << delimiter; 
+     544           0 :                 ss << std::scientific << data._t_complex_f->imag();
+     545             :         } else if (type == TYPE_COMPLEXD) {
+     546           0 :                 ss << std::scientific << data._t_complex_d->real() << delimiter; 
+     547           0 :                 ss << std::scientific << data._t_complex_d->imag();
+     548             :         } else if (type == TYPE_VECTOR3F) {
+     549           0 :                 ss << *data._t_vector3f;
+     550             :         } else if (type == TYPE_VECTOR3D) {
+     551           0 :                 ss << *data._t_vector3d;
+     552             :         } else if (type == TYPE_VECTOR) {
+     553           0 :                 ss << *data._t_vector;
+     554             :         }
+     555             : 
+     556             :         return ss.str();
+     557           3 : }
+     558             : 
+     559           0 : Variant::vector_t Variant::toVector() const {
+     560           0 :         if (type == TYPE_VECTOR)
+     561           0 :                 return *data._t_vector;
+     562             :         else
+     563           0 :                 throw bad_conversion(type, TYPE_VECTOR);
+     564             : }
+     565             : 
+     566           2 : Variant Variant::fromString(const std::string& s, Type t) {
+     567           2 :         std::stringstream ss(s);
+     568             : 
+     569             :         if (t == TYPE_BOOL) {
+     570             :                 std::string upperstr(s);
+     571             :                 std::transform(upperstr.begin(), upperstr.end(), upperstr.begin(), (int (*)(int)) toupper);
+     572           0 :                 if (upperstr == "YES" || upperstr == "TRUE" || upperstr == "1") 
+     573             :                         return Variant(true);
+     574           0 :                 else if (upperstr == "NO" || upperstr == "FALSE" || upperstr == "0")
+     575             :                         return Variant(false);
+     576           0 :                 throw bad_conversion(t, TYPE_BOOL);
+     577             :         } else if (t == TYPE_CHAR) {
+     578             :                 char c;
+     579           0 :                 ss >> c;
+     580             :                 return Variant(c);
+     581             :         } else if (t == TYPE_UCHAR) {
+     582             :                 unsigned char c;
+     583             :                 ss >> c;
+     584             :                 return Variant(c);
+     585             :         } else if (t == TYPE_INT16) {
+     586             :                 int16_t c;
+     587           0 :                 ss >> c;
+     588             :                 return Variant(c);
+     589             :         } else if (t == TYPE_INT32) {
+     590             :                 int32_t c;
+     591           1 :                 ss >> c;
+     592             :                 return Variant(c);
+     593             :         } else if (t == TYPE_INT64) {
+     594             :                 int64_t c;
+     595             :                 ss >> c;
+     596             :                 return Variant(c);
+     597             :         } else if (t == TYPE_UINT16) {
+     598             :                 uint16_t c;
+     599             :                 ss >> c;
+     600             :                 return Variant(c);
+     601             :         } else if (t == TYPE_UINT32) {
+     602             :                 uint32_t c;
+     603             :                 ss >> c;
+     604             :                 return Variant(c);
+     605             :         } else if (t == TYPE_UINT64) {
+     606             :                 uint64_t c;
+     607             :                 ss >> c;
+     608             :                 return Variant(c);
+     609             :         } else if (t == TYPE_FLOAT) {
+     610             :                 float c;
+     611             :                 ss >> c;
+     612             :                 return Variant(c);
+     613             :         } else if (t == TYPE_DOUBLE) {
+     614             :                 double c;
+     615             :                 ss >> c;
+     616             :                 return Variant(c);
+     617             :         } else if (t == TYPE_LONGDOUBLE) {
+     618             :                 long double c;
+     619             :                 ss >> c;
+     620             :                 return Variant(c);
+     621             :         } else if (t == TYPE_STRING) {
+     622           0 :                 return Variant(s);
+     623             :         } else if (t == TYPE_COMPLEXF) {
+     624             :                 float _vr, _vi;
+     625             :                 ss >> _vr >> _vi;
+     626           0 :                 complex_f v(_vr, _vi);
+     627             :                 return Variant(v);
+     628             :         } else if (t == TYPE_COMPLEXD) {
+     629             :                 double _vr, _vi;
+     630             :                 ss >> _vr >> _vi;
+     631           0 :                 complex_d v(_vr, _vi);
+     632             :                 return Variant(v);
+     633             :         } else if (t == TYPE_VECTOR3F) {
+     634             :                 Vector3f v;
+     635             :                 float _val;
+     636             :                 ss >> _val;
+     637           0 :                 v.setX(_val);
+     638             :                 ss >> _val;
+     639           0 :                 v.setY(_val);
+     640             :                 ss >> _val;
+     641           0 :                 v.setZ(_val);
+     642             :                 return Variant(v);
+     643             :         } else if (t == TYPE_VECTOR3D) {
+     644             :                 Vector3d v;
+     645             :                 double _val;
+     646             :                 ss >> _val;
+     647           0 :                 v.setX(_val);
+     648             :                 ss >> _val;
+     649           0 :                 v.setY(_val);
+     650             :                 ss >> _val;
+     651           0 :                 v.setZ(_val);
+     652             :                 return Variant(v);
+     653             :         } else if (t == TYPE_VECTOR3C) {
+     654             :                 Vector3c v;
+     655           0 :                 std::complex<double> _val;
+     656           0 :                 ss >> _val;
+     657             :                 v.setX(_val);
+     658           0 :                 ss >> _val;
+     659             :                 v.setY(_val);
+     660           0 :                 ss >> _val;
+     661             :                 v.setZ(_val);
+     662             :                 return Variant(v);
+     663             :         } else if (t == TYPE_VECTOR) {
+     664             :                 // std::regex useless("(|)|[|]| ");
+     665             :                 vector_t v;
+     666           0 :                 while (ss.good()) {
+     667             :                         std::string s;
+     668           0 :                         v.push_back(s);
+     669             :                 }
+     670           0 :         } else {
+     671             :                 std::string msg; 
+     672             :                 msg += "fromString not implemented for type ";
+     673           0 :         msg += getTypeName(t);
+     674           0 :         throw std::runtime_error("Variant: " + msg);
+     675             :         }
+     676           2 : }
+     677             : 
+     678        5785 : void Variant::clear(Type t) {
+     679             :         if (t == TYPE_STRING)
+     680           0 :                 safeDelete(data._t_string);
+     681             :         else if (t == TYPE_VECTOR3F)
+     682             :                 safeDelete(data._t_vector3f);
+     683             :         else if (t == TYPE_VECTOR3D)
+     684             :                 safeDelete(data._t_vector3d);
+     685             :         else if (t == TYPE_VECTOR3C)
+     686             :                 safeDelete(data._t_vector3c);
+     687             :         else if (t == TYPE_COMPLEXF)
+     688             :                 safeDelete(data._t_complex_f);
+     689             :         else if (t == TYPE_COMPLEXD)
+     690             :                 safeDelete(data._t_complex_d);
+     691             :         else if (t == TYPE_VECTOR)
+     692           0 :                 safeDelete(data._t_vector);
+     693             : 
+     694             :         // set the type to TYPE_NONE which will be used for checks
+     695        5785 :     type = TYPE_NONE;
+     696        5785 :     check(t);
+     697        5785 : }
+     698             : 
+     699        3459 : void Variant::copy(const Variant& v) {
+     700        3459 :         Type t = v.type;
+     701             : 
+     702        3459 :         if (t == TYPE_BOOL) 
+     703             :                 operator = (v.data._t_bool);
+     704             :         else if (t == TYPE_CHAR)
+     705             :                 operator = (v.data._t_char);
+     706             :         else if (t == TYPE_UCHAR)
+     707             :                 operator = (v.data._t_uchar);
+     708             :         else if (t == TYPE_INT16)
+     709             :                 operator = (v.data._t_int16);
+     710             :         else if (t == TYPE_UINT16)
+     711             :                 operator = (v.data._t_uint16);
+     712             :         else if (t == TYPE_INT32)
+     713             :                 operator = (v.data._t_int32);
+     714             :         else if (t == TYPE_UINT32)
+     715             :                 operator = (v.data._t_uint32);
+     716             :         else if (t == TYPE_INT64)
+     717             :                 operator = (v.data._t_int64);
+     718             :         else if (t == TYPE_UINT64)
+     719             :                 operator = (v.data._t_uint64);
+     720             :         else if (t == TYPE_FLOAT)
+     721             :                 operator = (v.data._t_float);
+     722             :         else if (t == TYPE_DOUBLE)
+     723             :                 operator = (v.data._t_double);
+     724             :         else if (t == TYPE_LONGDOUBLE)
+     725             :                 operator = (v.data._t_ldouble);
+     726             :         else if (t == TYPE_STRING)
+     727        1136 :                 operator = (*v.data._t_string);
+     728             :         else if (t == TYPE_COMPLEXF)
+     729           0 :                 operator = (*v.data._t_complex_f);
+     730             :         else if (t == TYPE_COMPLEXD)
+     731           0 :                 operator = (*v.data._t_complex_d);
+     732             :         else if (t == TYPE_VECTOR3F)
+     733           0 :                 operator = (*v.data._t_vector3f);
+     734             :         else if (t == TYPE_VECTOR3D)
+     735           0 :                 operator = (*v.data._t_vector3d);
+     736             :         else if (t == TYPE_VECTOR3C)
+     737           0 :                 operator = (*v.data._t_vector3c);
+     738             :         else if (t == TYPE_VECTOR)
+     739           0 :                 operator = (*v.data._t_vector);
+     740             :         else
+     741        2279 :                 type = TYPE_NONE;
+     742        3459 : }
+     743             : 
+     744           2 : void Variant::check(const Type t) const {
+     745           2 :         if (type != t) {
+     746           0 :                 throw bad_conversion(type, t);
+     747             :         }
+     748           2 : }
+     749             : 
+     750        5793 : void Variant::check(const Type t) {
+     751        5793 :         if (type == TYPE_NONE) {
+     752        5785 :                 memset(&data, 0, sizeof(data));
+     753        5785 :                 if (t == TYPE_VECTOR3F)
+     754           0 :                         data._t_vector3f = new Vector3f(); 
+     755             :                 else if (t == TYPE_VECTOR3D)
+     756           0 :                         data._t_vector3d = new Vector3d(); 
+     757             :                 else if (t == TYPE_VECTOR3C)
+     758           0 :                         data._t_vector3c = new Vector3c(); 
+     759             :                 else if (t == TYPE_COMPLEXF)
+     760           0 :                         data._t_complex_f = new complex_f(); 
+     761             :                 else if (t == TYPE_COMPLEXD)
+     762           0 :                         data._t_complex_d = new complex_d(); 
+     763             :                 else if (t == TYPE_STRING)
+     764           0 :                         data._t_string = new std::string();
+     765             :                 else if (t == TYPE_VECTOR)
+     766           0 :                         data._t_vector = new vector_t();
+     767             :                 else
+     768        5785 :                         type = t;
+     769           8 :         } else if (type != t)  {
+     770           0 :         throw bad_conversion(type, t);
+     771             :         }
+     772        5793 : }
+     773             : 
+     774           8 : bool Variant::isValid() const {
+     775           8 :         return (type != TYPE_NONE);
+     776             : }
+     777             : 
+     778           0 : size_t Variant::size() const {
+     779           0 :         if (type == TYPE_VECTOR) {
+     780           0 :                 return data._t_vector->size();
+     781             :         } else {
+     782             :                 std::string msg; 
+     783             :                 msg += "size() not implemented for type ";
+     784           0 :                 msg += getTypeName(type);
+     785           0 :                 throw std::runtime_error("Variant: " + msg);
+     786             :         }
+     787             : }
+     788             : 
+     789           0 : size_t Variant::getSizeOf() const {
+     790           0 :         switch (type) {
+     791             :                 case TYPE_BOOL:
+     792             :                         return sizeof(data._t_bool);
+     793             :                         break;
+     794             :                 case TYPE_CHAR:
+     795             :                         return sizeof(data._t_char);
+     796             :                         break;
+     797             :                 case TYPE_UCHAR:
+     798             :                         return sizeof(data._t_uchar);
+     799             :                         break;
+     800           0 :                 case TYPE_INT16:
+     801           0 :                         return sizeof(data._t_int16);
+     802             :                         break;
+     803           0 :                 case TYPE_UINT16:
+     804           0 :                         return sizeof(data._t_uint16);
+     805             :                         break;
+     806           0 :                 case TYPE_INT32:
+     807           0 :                         return sizeof(data._t_int32);
+     808             :                         break;
+     809           0 :                 case TYPE_UINT32:
+     810           0 :                         return sizeof(data._t_uint32);
+     811             :                         break;
+     812           0 :                 case TYPE_INT64:
+     813           0 :                         return sizeof(data._t_int64);
+     814             :                         break;
+     815           0 :                 case TYPE_UINT64:
+     816           0 :                         return sizeof(data._t_uint64);
+     817             :                         break;
+     818           0 :                 case TYPE_FLOAT:
+     819           0 :                         return sizeof(data._t_float);
+     820             :                         break;
+     821           0 :                 case TYPE_DOUBLE:
+     822           0 :                         return sizeof(data._t_double);
+     823             :                         break;
+     824           0 :                 case TYPE_LONGDOUBLE:
+     825           0 :                         return sizeof(data._t_ldouble);
+     826             :                         break;
+     827           0 :                 case TYPE_COMPLEXF:
+     828           0 :                         return sizeof(data._t_complex_f);
+     829             :                         break;
+     830           0 :                 case TYPE_COMPLEXD:
+     831           0 :                         return sizeof(data._t_complex_d);
+     832             :                         break;
+     833           0 :                 case TYPE_VECTOR3F:
+     834           0 :                         return sizeof(data._t_vector3f);
+     835             :                         break;
+     836           0 :                 case TYPE_VECTOR3D:
+     837           0 :                         return sizeof(data._t_vector3d);
+     838             :                         break;
+     839           0 :                 case TYPE_VECTOR3C:
+     840           0 :                         return sizeof(data._t_vector3c);
+     841             :                         break;
+     842           0 :                 case TYPE_STRING: {
+     843           0 :                                 size_t len = strlen(data._t_string->c_str() + 1);
+     844           0 :                                 return len;
+     845             :                         }
+     846             :                         break;
+     847           0 :                 case TYPE_NONE:
+     848           0 :                         return 0;
+     849             :                         break;
+     850           0 :                 default:
+     851           0 :                         throw std::runtime_error("Function getSize() cannot handle this type.");
+     852             :         }
+     853             : }
+     854             : 
+     855           0 : size_t Variant::getSize() const {
+     856           0 :         return getSizeOf();
+     857             : }
+     858             : 
+     859           0 : void Variant::resize(size_t i) {
+     860           0 :         check(TYPE_VECTOR);
+     861           0 :         return data._t_vector->resize(i);
+     862             : }
+     863             : 
+     864           1 : size_t Variant::copyToBuffer(void* buffer) {
+     865           1 :         if (type == TYPE_BOOL) {
+     866           0 :                 memcpy(buffer, &data._t_bool, sizeof(bool));
+     867           0 :                 return sizeof(data._t_bool);
+     868             :         } else if (type == TYPE_CHAR) {
+     869           0 :                 memcpy(buffer, &data._t_char, sizeof(char));
+     870           0 :                 return sizeof(data._t_char);
+     871             :         }  else if (type == TYPE_UCHAR) {
+     872           0 :                 memcpy(buffer, &data._t_uchar, sizeof(unsigned char));
+     873           0 :                 return sizeof(data._t_uchar);
+     874             :         } else if (type == TYPE_INT16) {
+     875           0 :                 memcpy(buffer, &data._t_int16, sizeof(int16_t));
+     876           0 :                 return sizeof(data._t_int16);
+     877             :         } else if (type == TYPE_UINT16) {
+     878           0 :                 memcpy(buffer, &data._t_uint16, sizeof(uint16_t));
+     879           0 :                 return sizeof(data._t_uint16);
+     880             :         } else if (type == TYPE_INT32) {
+     881           0 :                 memcpy(buffer, &data._t_int32, sizeof(int32_t));
+     882           0 :                 return sizeof(data._t_int32);
+     883             :         } else if (type == TYPE_UINT32) {
+     884           0 :                 memcpy(buffer, &data._t_uint32, sizeof(uint32_t));
+     885           0 :                 return sizeof(data._t_uint32);
+     886             :         } else if (type == TYPE_INT64) {
+     887           0 :                 memcpy(buffer, &data._t_int64, sizeof(int64_t));
+     888           0 :                 return sizeof(data._t_int64);
+     889             :         } else if (type == TYPE_UINT64) {
+     890           0 :                 memcpy(buffer, &data._t_uint64, sizeof(uint64_t));
+     891           0 :                 return sizeof(data._t_uint64);
+     892             :         } else if (type == TYPE_FLOAT) {
+     893           0 :                 memcpy(buffer, &data._t_float, sizeof(float));
+     894           0 :                 return sizeof(data._t_float);
+     895             :         } else if (type == TYPE_DOUBLE) {
+     896           1 :                 memcpy(buffer, &data._t_double, sizeof(double));
+     897           1 :                 return sizeof(data._t_double);
+     898             :         } else if (type == TYPE_LONGDOUBLE) {
+     899           0 :                 memcpy(buffer, &data._t_ldouble, sizeof(long double));
+     900           0 :                 return sizeof(data._t_ldouble);
+     901             :         }  else if (type == TYPE_STRING) {
+     902           0 :                 size_t len = data._t_string->size();
+     903             :                 memcpy(buffer, data._t_string->c_str(), len);
+     904           0 :                 return len;
+     905             :         } else if (type == TYPE_NONE) {
+     906             :                 return 0;
+     907             :         } else {
+     908           0 :                 throw std::runtime_error("This type cannot be handled by copyToBuffer().");
+     909             :         }
+     910             : }
+     911             : 
+     912        1153 : Variant& Variant::operator=(const Variant &v) {
+     913        1153 :         copy(v);
+     914        1153 :         return *this;
+     915             : }
+     916             : 
+     917           4 : bool Variant::operator==(const Variant& v) const {
+     918           4 :         if (type != v.type)
+     919             :                 return false;
+     920             : 
+     921             :         if (type == TYPE_BOOL) {
+     922           0 :                 return (data._t_bool == v.data._t_bool);
+     923             :         } else if (type == TYPE_CHAR) {
+     924           0 :                 return (data._t_char == v.data._t_char);
+     925             :         } else if (type == TYPE_UCHAR) {
+     926           0 :                 return (data._t_uchar == v.data._t_uchar);
+     927             :         } else if (type == TYPE_INT16) {
+     928           0 :                 return (data._t_int16 == v.data._t_int16);
+     929             :         } else if (type == TYPE_UINT16) {
+     930           0 :                 return (data._t_uint16 == v.data._t_uint16);
+     931             :         } else if (type == TYPE_INT32) {
+     932           0 :                 return (data._t_int32 == v.data._t_int32);
+     933             :         } else if (type == TYPE_UINT32) {
+     934           0 :                 return (data._t_uint32 == v.data._t_uint32);
+     935             :         } else if (type == TYPE_INT64) {
+     936           0 :                 return (data._t_int64 == v.data._t_int64);
+     937             :         } else if (type == TYPE_UINT64) {
+     938           0 :                 return (data._t_uint64 == v.data._t_uint64);
+     939             :         } else if (type == TYPE_FLOAT) {
+     940           0 :                 return (data._t_float == v.data._t_float);
+     941             :         } else if (type == TYPE_DOUBLE) {
+     942           4 :                 return (data._t_double == v.data._t_double);
+     943             :         } else if (type == TYPE_LONGDOUBLE) {
+     944           0 :                 return (data._t_ldouble == v.data._t_ldouble);
+     945             :         } else if (type == TYPE_STRING) {
+     946           0 :                 return (*data._t_string == *v.data._t_string);
+     947             :         } else if (type == TYPE_COMPLEXF) {
+     948           0 :                 return (*data._t_complex_f == *v.data._t_complex_f);
+     949             :         } else if (type == TYPE_COMPLEXD) {
+     950           0 :                 return (*data._t_complex_d == *v.data._t_complex_d);
+     951             :         } else if (type == TYPE_VECTOR3F) {
+     952           0 :                 return (*data._t_vector3f == *v.data._t_vector3f);
+     953             :         } else if (type == TYPE_VECTOR3D) {
+     954           0 :                 return (*data._t_vector3d == *v.data._t_vector3d);
+     955             :         } else if (type == TYPE_VECTOR3C) {
+     956           0 :                 return (*data._t_vector3c == *v.data._t_vector3c);
+     957             :         } else if (type == TYPE_VECTOR) {
+     958           0 :                 return (*data._t_vector == *v.data._t_vector);
+     959             :         } else {
+     960           0 :                 throw std::runtime_error("compare operator not implemented");
+     961             :         }
+     962             : }
+     963             : 
+     964           0 : bool Variant::operator!=(const Variant& v) const {
+     965           0 :         if (type != v.type)
+     966             :                 return true;
+     967             :         
+     968           0 :         if (*this == v)
+     969             :                 return false;
+     970             :         else
+     971           0 :                 return true;
+     972             : }
+     973             : 
+     974           0 : bool Variant::operator!=(const char* v) const {
+     975           0 :         check(TYPE_STRING);
+     976           0 :         return data._t_string->compare(v) != 0;
+     977             : }
+     978             : 
+     979           0 : Variant& Variant::operator[](size_t i) {
+     980           0 :         check(TYPE_VECTOR);
+     981           0 :         return (*data._t_vector)[i];
+     982             : }
+     983             : 
+     984           0 : const Variant& Variant::operator[](size_t i) const {
+     985           0 :         check(TYPE_VECTOR);
+     986           0 :         return (*data._t_vector)[i];
+     987             : }
+     988             : 
+     989           0 : Variant::operator std::vector<Variant>&() {
+     990           0 :         check(TYPE_VECTOR);
+     991           0 :         return *data._t_vector;
+     992             : }
+     993             : 
+     994           0 : Variant::operator const std::vector<Variant>&() const {
+     995           0 :         check(TYPE_VECTOR);
+     996           0 :         return *data._t_vector;
+     997             : }
+     998             : 
+     999             : 
+    1000             : 
+    1001             : #define INT_CASE(from_var, from_type, to_type, to)                                                                                                                         \
+    1002             :     case Variant::from_type: {                                                                                         \
+    1003             :                 if (data._t_##from_var <std::numeric_limits<to>::min() || data._t_##from_var> std::numeric_limits<to>::max())  \
+    1004             :                         throw bad_conversion(type, to_type);                                                                       \
+    1005             :                 else                                                                                                           \
+    1006             :                         return static_cast<to>(data._t_##from_var);                                                                \
+    1007             :                 }                                                                                                              \
+    1008             :         break;                                                                                                         \
+    1009             : 
+    1010             : #define INT_FUNCTION(to_type, fun, to)                                                                                 \
+    1011             :         to Variant::fun() const {                                                                                          \
+    1012             :                 switch (type) {                                                                                                \
+    1013             :                         case Variant::TYPE_BOOL:                                                                                   \
+    1014             :                                 return data._t_bool ? 1 : 0;                                                                           \
+    1015             :                                 break;                                                                                                 \
+    1016             :                                 INT_CASE(char, TYPE_CHAR, to_type, to)                                                                 \
+    1017             :                                 INT_CASE(uchar, TYPE_UCHAR, to_type, to)                                                               \
+    1018             :                                 INT_CASE(int16, TYPE_INT16, to_type, to)                                                               \
+    1019             :                                 INT_CASE(uint16, TYPE_UINT16, to_type, to)                                                             \
+    1020             :                                 INT_CASE(int32, TYPE_INT32, to_type, to)                                                               \
+    1021             :                                 INT_CASE(uint32, TYPE_UINT32, to_type, to)                                                             \
+    1022             :                                 INT_CASE(int64, TYPE_INT64, to_type, to)                                                               \
+    1023             :                                 INT_CASE(uint64, TYPE_UINT64, to_type, to)                                                             \
+    1024             :                                 INT_CASE(float, TYPE_FLOAT, to_type, to)                                                               \
+    1025             :                                 INT_CASE(double, TYPE_DOUBLE, to_type, to)                                                             \
+    1026             :                                 INT_CASE(ldouble, TYPE_LONGDOUBLE, to_type, to)                                                        \
+    1027             :                         case Variant::TYPE_STRING: {                                                                               \
+    1028             :                                 long l = atol(data._t_string->c_str());                                                                \
+    1029             :                                 if (l <std::numeric_limits<to>::min() || l > std::numeric_limits<to>::max())                           \
+    1030             :                                         throw bad_conversion(type, to_type);                                                               \
+    1031             :                                 else                                                                                                   \
+    1032             :                                         return l;                                                                                          \
+    1033             :                                 }                                                                                                      \
+    1034             :                                 break;                                                                                                 \
+    1035             :                         case Variant::TYPE_COMPLEXF:                                                                               \
+    1036             :                         case Variant::TYPE_COMPLEXD:                                                                               \
+    1037             :                         case Variant::TYPE_VECTOR3F:                                                                               \
+    1038             :                         case Variant::TYPE_VECTOR3D:                                                                               \
+    1039             :                         case Variant::TYPE_VECTOR3C:                                                                               \
+    1040             :                         case Variant::TYPE_VECTOR:                                                                                 \
+    1041             :                         case Variant::TYPE_NONE:                                                                                   \
+    1042             :                                 throw bad_conversion(type, to_type);                                                                   \
+    1043             :                                 break;                                                                                                 \
+    1044             :                 }                                                                                                              \
+    1045             :                 return 0;                                                                                                      \
+    1046             :         } 
+    1047             : 
+    1048           0 : INT_FUNCTION(TYPE_CHAR, toChar, char)
+    1049           0 : INT_FUNCTION(TYPE_UCHAR, toUChar, unsigned char)
+    1050           0 : INT_FUNCTION(TYPE_INT16, toInt16, int16_t)
+    1051           0 : INT_FUNCTION(TYPE_UINT16, toUInt16, uint16_t)
+    1052           0 : INT_FUNCTION(TYPE_INT32, toInt32, int32_t)
+    1053           0 : INT_FUNCTION(TYPE_UINT32, toUInt32, uint32_t)
+    1054           2 : INT_FUNCTION(TYPE_INT64, toInt64, int64_t)
+    1055           0 : INT_FUNCTION(TYPE_UINT64, toUInt64, uint64_t)
+    1056             : 
+    1057             : 
+    1058             : 
+    1059           0 : std::ostream& operator <<(std::ostream& os, const Variant& v) {
+    1060           0 :         switch (v.getType()) {
+    1061             :                 case Variant::TYPE_BOOL:
+    1062           0 :                         os << v.asBool();
+    1063             :                         break;
+    1064             :                 case Variant::TYPE_CHAR:
+    1065           0 :                         os << v.asChar();
+    1066           0 :                         break;
+    1067             :                 case Variant::TYPE_UCHAR:
+    1068           0 :                         os << v.asUChar();
+    1069             :                         break;
+    1070             :                 case Variant::TYPE_INT16:
+    1071           0 :                         os << v.asInt16();
+    1072           0 :                         break;
+    1073             :                 case Variant::TYPE_UINT16:
+    1074           0 :                         os << v.asUInt16();
+    1075             :                         break;
+    1076             :                 case Variant::TYPE_INT32:
+    1077           0 :                         os << v.asInt32();
+    1078           0 :                         break;
+    1079             :                 case Variant::TYPE_UINT32:
+    1080           0 :                         os << v.asUInt32();
+    1081             :                         break;
+    1082             :                 case Variant::TYPE_INT64:
+    1083           0 :                         os << v.asInt64();
+    1084             :                         break;
+    1085             :                 case Variant::TYPE_UINT64:
+    1086           0 :                         os << v.asUInt64();
+    1087             :                         break;
+    1088             :                 case Variant::TYPE_FLOAT:
+    1089           0 :                         os << v.asFloat();
+    1090             :                         break;
+    1091             :                 case Variant::TYPE_DOUBLE:
+    1092           0 :                         os << v.asDouble();
+    1093             :                         break;
+    1094             :                 case Variant::TYPE_LONGDOUBLE:
+    1095           0 :                         os << v.asLongDouble();
+    1096             :                         break;
+    1097             :                 case Variant::TYPE_COMPLEXF:
+    1098           0 :                         os << v.asComplexFloat();
+    1099           0 :                         break;
+    1100             :                 case Variant::TYPE_COMPLEXD:
+    1101           0 :                         os << v.asComplexDouble();
+    1102           0 :                         break;
+    1103             :                 case Variant::TYPE_STRING:
+    1104             :                         os << v.asString();
+    1105             :                         break;
+    1106             :                 case Variant::TYPE_VECTOR3F:
+    1107           0 :                         os << v.asVector3f();
+    1108           0 :                         break;
+    1109             :                 case Variant::TYPE_VECTOR3D:
+    1110           0 :                         os << v.asVector3d();
+    1111           0 :                         break;
+    1112             :                 case Variant::TYPE_VECTOR3C:
+    1113           0 :                         os << v.asVector3c();
+    1114           0 :                         break;
+    1115             :                 default:
+    1116             :                         break;
+    1117             :         }
+    1118             : 
+    1119           0 :         return os;
+    1120             : }
+    1121             : 
+    1122             : 
+    1123             : 
+    1124             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/advectionField/AdvectionField.cpp.func-sort-c.html b/doc/coverageReport/src/advectionField/AdvectionField.cpp.func-sort-c.html new file mode 100644 index 000000000..39a908092 --- /dev/null +++ b/doc/coverageReport/src/advectionField/AdvectionField.cpp.func-sort-c.html @@ -0,0 +1,408 @@ + + + + + + + LCOV - coverage.info.cleaned - src/advectionField/AdvectionField.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/advectionField - AdvectionField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13130842.5 %
Date:2024-04-08 14:58:22Functions:448452.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa21ObliqueAdvectionShock13setShockwidthEd0
_ZN7crpropa21ObliqueAdvectionShock5setVyEd0
_ZN7crpropa21ObliqueAdvectionShock6setVupEd0
_ZN7crpropa21ObliqueAdvectionShock7setCompEd0
_ZN7crpropa21ObliqueAdvectionShockC2Edddd0
_ZN7crpropa28OneDimensionalCartesianShock13setShockwidthEd0
_ZN7crpropa28OneDimensionalCartesianShock6setVupEd0
_ZN7crpropa28OneDimensionalCartesianShock7setCompEd0
_ZN7crpropa28OneDimensionalCartesianShockC2Eddd0
_ZN7crpropa28OneDimensionalSphericalShock10setCoolingEb0
_ZN7crpropa28OneDimensionalSphericalShock13setShockwidthEd0
_ZN7crpropa28OneDimensionalSphericalShock14setShockRadiusEd0
_ZN7crpropa28OneDimensionalSphericalShock6setVupEd0
_ZN7crpropa28OneDimensionalSphericalShock7setCompEd0
_ZN7crpropa28OneDimensionalSphericalShockC2Eddddb0
_ZNK7crpropa21ObliqueAdvectionShock13getDivergenceERKNS_7Vector3IdEE0
_ZNK7crpropa21ObliqueAdvectionShock13getShockwidthEv0
_ZNK7crpropa21ObliqueAdvectionShock14getDescriptionB5cxx11Ev0
_ZNK7crpropa21ObliqueAdvectionShock5getVyEv0
_ZNK7crpropa21ObliqueAdvectionShock6getVupEv0
_ZNK7crpropa21ObliqueAdvectionShock7getCompEv0
_ZNK7crpropa21ObliqueAdvectionShock8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa21UniformAdvectionField14getDescriptionB5cxx11Ev0
_ZNK7crpropa23SphericalAdvectionField14getDescriptionB5cxx11Ev0
_ZNK7crpropa23SphericalAdvectionShock14getDescriptionB5cxx11Ev0
_ZNK7crpropa28OneDimensionalCartesianShock13getDivergenceERKNS_7Vector3IdEE0
_ZNK7crpropa28OneDimensionalCartesianShock13getShockwidthEv0
_ZNK7crpropa28OneDimensionalCartesianShock14getDescriptionB5cxx11Ev0
_ZNK7crpropa28OneDimensionalCartesianShock6getVupEv0
_ZNK7crpropa28OneDimensionalCartesianShock7getCompEv0
_ZNK7crpropa28OneDimensionalCartesianShock8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa28OneDimensionalSphericalShock10getCoolingEv0
_ZNK7crpropa28OneDimensionalSphericalShock13getDivergenceERKNS_7Vector3IdEE0
_ZNK7crpropa28OneDimensionalSphericalShock13getShockwidthEv0
_ZNK7crpropa28OneDimensionalSphericalShock14getDescriptionB5cxx11Ev0
_ZNK7crpropa28OneDimensionalSphericalShock14getShockRadiusEv0
_ZNK7crpropa28OneDimensionalSphericalShock6getVupEv0
_ZNK7crpropa28OneDimensionalSphericalShock7getCompEv0
_ZNK7crpropa28OneDimensionalSphericalShock8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa31ConstantSphericalAdvectionField14getDescriptionB5cxx11Ev0
_ZN7crpropa23SphericalAdvectionField6setTauEd1
_ZN7crpropa23SphericalAdvectionField7setVMaxEd1
_ZN7crpropa23SphericalAdvectionField8setAlphaEd1
_ZN7crpropa23SphericalAdvectionField9setOriginENS_7Vector3IdEE1
_ZN7crpropa23SphericalAdvectionField9setRadiusEd1
_ZN7crpropa23SphericalAdvectionFieldC2ENS_7Vector3IdEEdddd1
_ZN7crpropa23SphericalAdvectionShock5setR0Ed1
_ZN7crpropa23SphericalAdvectionShock5setV0Ed1
_ZN7crpropa23SphericalAdvectionShock9setLambdaEd1
_ZN7crpropa23SphericalAdvectionShock9setOriginENS_7Vector3IdEE1
_ZN7crpropa23SphericalAdvectionShockC2ENS_7Vector3IdEEddd1
_ZNK7crpropa18AdvectionFieldList13getDivergenceERKNS_7Vector3IdEE1
_ZNK7crpropa18AdvectionFieldList8getFieldERKNS_7Vector3IdEE1
_ZNK7crpropa23SphericalAdvectionField6getTauEv1
_ZNK7crpropa23SphericalAdvectionField7getVMaxEv1
_ZNK7crpropa23SphericalAdvectionField8getAlphaEv1
_ZNK7crpropa23SphericalAdvectionField9getRadiusEv1
_ZNK7crpropa23SphericalAdvectionShock5getR0Ev1
_ZNK7crpropa23SphericalAdvectionShock5getV0Ev1
_ZNK7crpropa23SphericalAdvectionShock9getLambdaEv1
_ZNK7crpropa31ConstantSphericalAdvectionField8getFieldERKNS_7Vector3IdEE1
_ZNK7crpropa31ConstantSphericalAdvectionField8getVWindEv1
_ZN7crpropa23SphericalAdvectionShock17setAzimuthalSpeedEd2
_ZN7crpropa23SphericalAdvectionShock7setRRotEd2
_ZN7crpropa31ConstantSphericalAdvectionField8setVWindEd2
_ZN7crpropa31ConstantSphericalAdvectionField9setOriginENS_7Vector3IdEE2
_ZN7crpropa31ConstantSphericalAdvectionFieldC2ENS_7Vector3IdEEd2
_ZNK7crpropa23SphericalAdvectionField4getVERKd2
_ZNK7crpropa23SphericalAdvectionShock13getDivergenceERKNS_7Vector3IdEE2
_ZNK7crpropa23SphericalAdvectionShock17getAzimuthalSpeedEv2
_ZNK7crpropa23SphericalAdvectionShock7g_primeEd2
_ZNK7crpropa23SphericalAdvectionShock7getRRotEv2
_ZNK7crpropa31ConstantSphericalAdvectionField13getDivergenceERKNS_7Vector3IdEE2
_ZN7crpropa18AdvectionFieldList8addFieldENS_7ref_ptrINS_14AdvectionFieldEEE3
_ZNK7crpropa23SphericalAdvectionField13getDivergenceERKNS_7Vector3IdEE3
_ZNK7crpropa23SphericalAdvectionField8getFieldERKNS_7Vector3IdEE3
_ZNK7crpropa23SphericalAdvectionField9getOriginEv3
_ZNK7crpropa23SphericalAdvectionShock8getFieldERKNS_7Vector3IdEE3
_ZNK7crpropa23SphericalAdvectionShock9getOriginEv3
_ZNK7crpropa31ConstantSphericalAdvectionField9getOriginEv3
_ZNK7crpropa21UniformAdvectionField13getDivergenceERKNS_7Vector3IdEE5
_ZNK7crpropa23SphericalAdvectionShock1gEd5
_ZN7crpropa21UniformAdvectionFieldC2ERKNS_7Vector3IdEE8
_ZNK7crpropa21UniformAdvectionField8getFieldERKNS_7Vector3IdEE120005
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/advectionField/AdvectionField.cpp.func.html b/doc/coverageReport/src/advectionField/AdvectionField.cpp.func.html new file mode 100644 index 000000000..c7c1f546f --- /dev/null +++ b/doc/coverageReport/src/advectionField/AdvectionField.cpp.func.html @@ -0,0 +1,408 @@ + + + + + + + LCOV - coverage.info.cleaned - src/advectionField/AdvectionField.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/advectionField - AdvectionField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13130842.5 %
Date:2024-04-08 14:58:22Functions:448452.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa18AdvectionFieldList8addFieldENS_7ref_ptrINS_14AdvectionFieldEEE3
_ZN7crpropa21ObliqueAdvectionShock13setShockwidthEd0
_ZN7crpropa21ObliqueAdvectionShock5setVyEd0
_ZN7crpropa21ObliqueAdvectionShock6setVupEd0
_ZN7crpropa21ObliqueAdvectionShock7setCompEd0
_ZN7crpropa21ObliqueAdvectionShockC2Edddd0
_ZN7crpropa21UniformAdvectionFieldC2ERKNS_7Vector3IdEE8
_ZN7crpropa23SphericalAdvectionField6setTauEd1
_ZN7crpropa23SphericalAdvectionField7setVMaxEd1
_ZN7crpropa23SphericalAdvectionField8setAlphaEd1
_ZN7crpropa23SphericalAdvectionField9setOriginENS_7Vector3IdEE1
_ZN7crpropa23SphericalAdvectionField9setRadiusEd1
_ZN7crpropa23SphericalAdvectionFieldC2ENS_7Vector3IdEEdddd1
_ZN7crpropa23SphericalAdvectionShock17setAzimuthalSpeedEd2
_ZN7crpropa23SphericalAdvectionShock5setR0Ed1
_ZN7crpropa23SphericalAdvectionShock5setV0Ed1
_ZN7crpropa23SphericalAdvectionShock7setRRotEd2
_ZN7crpropa23SphericalAdvectionShock9setLambdaEd1
_ZN7crpropa23SphericalAdvectionShock9setOriginENS_7Vector3IdEE1
_ZN7crpropa23SphericalAdvectionShockC2ENS_7Vector3IdEEddd1
_ZN7crpropa28OneDimensionalCartesianShock13setShockwidthEd0
_ZN7crpropa28OneDimensionalCartesianShock6setVupEd0
_ZN7crpropa28OneDimensionalCartesianShock7setCompEd0
_ZN7crpropa28OneDimensionalCartesianShockC2Eddd0
_ZN7crpropa28OneDimensionalSphericalShock10setCoolingEb0
_ZN7crpropa28OneDimensionalSphericalShock13setShockwidthEd0
_ZN7crpropa28OneDimensionalSphericalShock14setShockRadiusEd0
_ZN7crpropa28OneDimensionalSphericalShock6setVupEd0
_ZN7crpropa28OneDimensionalSphericalShock7setCompEd0
_ZN7crpropa28OneDimensionalSphericalShockC2Eddddb0
_ZN7crpropa31ConstantSphericalAdvectionField8setVWindEd2
_ZN7crpropa31ConstantSphericalAdvectionField9setOriginENS_7Vector3IdEE2
_ZN7crpropa31ConstantSphericalAdvectionFieldC2ENS_7Vector3IdEEd2
_ZNK7crpropa18AdvectionFieldList13getDivergenceERKNS_7Vector3IdEE1
_ZNK7crpropa18AdvectionFieldList8getFieldERKNS_7Vector3IdEE1
_ZNK7crpropa21ObliqueAdvectionShock13getDivergenceERKNS_7Vector3IdEE0
_ZNK7crpropa21ObliqueAdvectionShock13getShockwidthEv0
_ZNK7crpropa21ObliqueAdvectionShock14getDescriptionB5cxx11Ev0
_ZNK7crpropa21ObliqueAdvectionShock5getVyEv0
_ZNK7crpropa21ObliqueAdvectionShock6getVupEv0
_ZNK7crpropa21ObliqueAdvectionShock7getCompEv0
_ZNK7crpropa21ObliqueAdvectionShock8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa21UniformAdvectionField13getDivergenceERKNS_7Vector3IdEE5
_ZNK7crpropa21UniformAdvectionField14getDescriptionB5cxx11Ev0
_ZNK7crpropa21UniformAdvectionField8getFieldERKNS_7Vector3IdEE120005
_ZNK7crpropa23SphericalAdvectionField13getDivergenceERKNS_7Vector3IdEE3
_ZNK7crpropa23SphericalAdvectionField14getDescriptionB5cxx11Ev0
_ZNK7crpropa23SphericalAdvectionField4getVERKd2
_ZNK7crpropa23SphericalAdvectionField6getTauEv1
_ZNK7crpropa23SphericalAdvectionField7getVMaxEv1
_ZNK7crpropa23SphericalAdvectionField8getAlphaEv1
_ZNK7crpropa23SphericalAdvectionField8getFieldERKNS_7Vector3IdEE3
_ZNK7crpropa23SphericalAdvectionField9getOriginEv3
_ZNK7crpropa23SphericalAdvectionField9getRadiusEv1
_ZNK7crpropa23SphericalAdvectionShock13getDivergenceERKNS_7Vector3IdEE2
_ZNK7crpropa23SphericalAdvectionShock14getDescriptionB5cxx11Ev0
_ZNK7crpropa23SphericalAdvectionShock17getAzimuthalSpeedEv2
_ZNK7crpropa23SphericalAdvectionShock1gEd5
_ZNK7crpropa23SphericalAdvectionShock5getR0Ev1
_ZNK7crpropa23SphericalAdvectionShock5getV0Ev1
_ZNK7crpropa23SphericalAdvectionShock7g_primeEd2
_ZNK7crpropa23SphericalAdvectionShock7getRRotEv2
_ZNK7crpropa23SphericalAdvectionShock8getFieldERKNS_7Vector3IdEE3
_ZNK7crpropa23SphericalAdvectionShock9getLambdaEv1
_ZNK7crpropa23SphericalAdvectionShock9getOriginEv3
_ZNK7crpropa28OneDimensionalCartesianShock13getDivergenceERKNS_7Vector3IdEE0
_ZNK7crpropa28OneDimensionalCartesianShock13getShockwidthEv0
_ZNK7crpropa28OneDimensionalCartesianShock14getDescriptionB5cxx11Ev0
_ZNK7crpropa28OneDimensionalCartesianShock6getVupEv0
_ZNK7crpropa28OneDimensionalCartesianShock7getCompEv0
_ZNK7crpropa28OneDimensionalCartesianShock8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa28OneDimensionalSphericalShock10getCoolingEv0
_ZNK7crpropa28OneDimensionalSphericalShock13getDivergenceERKNS_7Vector3IdEE0
_ZNK7crpropa28OneDimensionalSphericalShock13getShockwidthEv0
_ZNK7crpropa28OneDimensionalSphericalShock14getDescriptionB5cxx11Ev0
_ZNK7crpropa28OneDimensionalSphericalShock14getShockRadiusEv0
_ZNK7crpropa28OneDimensionalSphericalShock6getVupEv0
_ZNK7crpropa28OneDimensionalSphericalShock7getCompEv0
_ZNK7crpropa28OneDimensionalSphericalShock8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa31ConstantSphericalAdvectionField13getDivergenceERKNS_7Vector3IdEE2
_ZNK7crpropa31ConstantSphericalAdvectionField14getDescriptionB5cxx11Ev0
_ZNK7crpropa31ConstantSphericalAdvectionField8getFieldERKNS_7Vector3IdEE1
_ZNK7crpropa31ConstantSphericalAdvectionField8getVWindEv1
_ZNK7crpropa31ConstantSphericalAdvectionField9getOriginEv3
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/advectionField/AdvectionField.cpp.gcov.html b/doc/coverageReport/src/advectionField/AdvectionField.cpp.gcov.html new file mode 100644 index 000000000..69ab19d58 --- /dev/null +++ b/doc/coverageReport/src/advectionField/AdvectionField.cpp.gcov.html @@ -0,0 +1,610 @@ + + + + + + + LCOV - coverage.info.cleaned - src/advectionField/AdvectionField.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/advectionField - AdvectionField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13130842.5 %
Date:2024-04-08 14:58:22Functions:448452.4 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/advectionField/AdvectionField.h"
+       2             : 
+       3             : 
+       4             : namespace crpropa {
+       5             : 
+       6             : 
+       7             : 
+       8           3 : void AdvectionFieldList::addField(ref_ptr<AdvectionField> field) {
+       9           3 :         fields.push_back(field);
+      10           3 : }
+      11             : 
+      12           1 : Vector3d AdvectionFieldList::getField(const Vector3d &position) const {
+      13             :         Vector3d b(0.);
+      14           4 :         for (int i = 0; i < fields.size(); i++)
+      15           3 :                 b += fields[i]->getField(position);
+      16           1 :         return b;
+      17             : }
+      18             : 
+      19           1 : double AdvectionFieldList::getDivergence(const Vector3d &position) const {
+      20             :         double D=0.;
+      21             :         // Work on default values for divergence or an error handling
+      22           4 :         for (int i = 0; i < fields.size(); i++)
+      23           3 :                 D += fields[i]->getDivergence(position);
+      24           1 :         return D;
+      25             : }
+      26             : 
+      27             : 
+      28             : //----------------------------------------------------------------
+      29           8 : UniformAdvectionField::UniformAdvectionField(const Vector3d &value) :
+      30           8 :                         value(value) {
+      31           8 :         }
+      32             : 
+      33      120005 : Vector3d UniformAdvectionField::getField(const Vector3d &position) const {
+      34      120005 :         return value;
+      35             :         }
+      36             : 
+      37           5 : double UniformAdvectionField::getDivergence(const Vector3d &position) const {
+      38           5 :         return 0.;
+      39             :         }
+      40             : 
+      41           0 : std::string UniformAdvectionField::getDescription() const {
+      42           0 :         std::stringstream s;
+      43           0 :         s << "v0: " << value / km * sec << " km/s, ";
+      44           0 :         return s.str();
+      45           0 : }
+      46             : 
+      47             : //----------------------------------------------------------------
+      48             : 
+      49           2 : ConstantSphericalAdvectionField::ConstantSphericalAdvectionField(const Vector3d origin, double vWind) {
+      50           2 :         setOrigin(origin);
+      51           2 :         setVWind(vWind);
+      52           2 : }
+      53             : 
+      54           1 : Vector3d ConstantSphericalAdvectionField::getField(const Vector3d &position) const {
+      55             :         Vector3d Pos = position-origin;
+      56           1 :         return vWind * Pos.getUnitVector();
+      57             : }
+      58             : 
+      59           2 : double ConstantSphericalAdvectionField::getDivergence(const Vector3d &position) const {
+      60             :         double R = (position-origin).getR();    
+      61           2 :         return 2*vWind/R;
+      62             : }
+      63             : 
+      64           2 : void ConstantSphericalAdvectionField::setOrigin(const Vector3d o) {
+      65             :         origin=o;
+      66           2 :         return;
+      67             : }
+      68             : 
+      69           2 : void ConstantSphericalAdvectionField::setVWind(double v) {
+      70           2 :         vWind = v;
+      71           2 :         return;
+      72             : }
+      73             : 
+      74           3 : Vector3d ConstantSphericalAdvectionField::getOrigin() const {
+      75           3 :         return origin;
+      76             : }
+      77             : 
+      78           1 : double ConstantSphericalAdvectionField::getVWind() const {
+      79           1 :         return vWind;
+      80             : }
+      81             : 
+      82           0 : std::string ConstantSphericalAdvectionField::getDescription() const {
+      83           0 :         std::stringstream s;
+      84           0 :         s << "Origin: " << origin / kpc  << " kpc, ";
+      85           0 :         s << "v0: " << vWind / km * sec << " km/s, ";
+      86           0 :         return s.str();
+      87           0 : }
+      88             : 
+      89             : 
+      90             : 
+      91             : //----------------------------------------------------------------
+      92             : 
+      93           1 : SphericalAdvectionField::SphericalAdvectionField(const Vector3d origin, double radius, double vMax, double tau, double alpha) {
+      94           1 :         setOrigin(origin);
+      95           1 :         setRadius(radius);
+      96           1 :         setVMax(vMax);
+      97           1 :         setTau(tau);
+      98           1 :         setAlpha(alpha);
+      99           1 : }
+     100             : 
+     101           3 : Vector3d SphericalAdvectionField::getField(const Vector3d &position) const {
+     102             :         Vector3d Pos = position-origin;
+     103           3 :         double R = Pos.getR();
+     104           3 :         if (R>radius) {
+     105             :                 return Vector3d(0.);
+     106             :         }
+     107           2 :         double v_R = getV(R);
+     108           2 :         return v_R * Pos.getUnitVector();
+     109             : }
+     110             : 
+     111           3 : double SphericalAdvectionField::getDivergence(const Vector3d &position) const {
+     112             :         double R = (position-origin).getR();
+     113           3 :         if (R>radius) {
+     114             :                 return 0.;
+     115             :         }
+     116           2 :         double D = 2*vMax/R * ( 1-( 1-alpha*(pow(R, alpha)/(2*tau)) )*exp(-( pow(R, alpha)/tau )) );
+     117           2 :         return D;
+     118             : }
+     119             : 
+     120           2 : double SphericalAdvectionField::getV(const double &r) const {
+     121           2 :         double f = vMax * (1-exp(-(pow(r, alpha)/tau)));
+     122           2 :         return f;
+     123             : }
+     124             : 
+     125           1 : void SphericalAdvectionField::setOrigin(const Vector3d o) {
+     126             :         origin = o;
+     127           1 :         return;
+     128             : }
+     129             : 
+     130           1 : void SphericalAdvectionField::setRadius(double r) {
+     131           1 :         radius = r;
+     132           1 :         return;
+     133             : }
+     134             : 
+     135           1 : void SphericalAdvectionField::setVMax(double v) {
+     136           1 :         vMax = v;
+     137           1 :         return;
+     138             : }
+     139             : 
+     140           1 : void SphericalAdvectionField::setTau(double t) {
+     141           1 :         tau = t;
+     142           1 :         return;
+     143             : }
+     144             : 
+     145           1 : void SphericalAdvectionField::setAlpha(double a) {
+     146           1 :         alpha = a;
+     147           1 :         return;
+     148             : }
+     149             : 
+     150           3 : Vector3d SphericalAdvectionField::getOrigin() const {
+     151           3 :         return origin;
+     152             : }
+     153             : 
+     154           1 : double SphericalAdvectionField::getRadius() const {
+     155           1 :         return radius;
+     156             : }
+     157             : 
+     158           1 : double SphericalAdvectionField::getVMax() const {
+     159           1 :         return vMax;
+     160             : }
+     161             : 
+     162           1 : double SphericalAdvectionField::getTau() const {
+     163           1 :         return tau;
+     164             : }
+     165             : 
+     166           1 : double SphericalAdvectionField::getAlpha() const {
+     167           1 :         return alpha;
+     168             : }
+     169             : 
+     170           0 : std::string SphericalAdvectionField::getDescription() const {
+     171           0 :         std::stringstream s;
+     172           0 :         s << "Origin: " << origin / kpc  << " kpc, ";
+     173           0 :         s << "Radius: " << radius / kpc  << " kpc, ";
+     174           0 :         s << "vMax: " << vMax / km * sec << " km/s, ";
+     175           0 :         s << "tau: " << tau << ", ";
+     176           0 :         s << "alpha: " << alpha << "\n";
+     177           0 :         return s.str();
+     178           0 : }
+     179             : 
+     180             : //----------------------------------------------------------------
+     181             : 
+     182           0 : OneDimensionalCartesianShock::OneDimensionalCartesianShock(double compressionRatio, double vUp, double lShock){
+     183           0 :         setComp(compressionRatio);
+     184           0 :         setVup(vUp);
+     185           0 :         setShockwidth(lShock);
+     186           0 :         }
+     187             : 
+     188           0 : Vector3d OneDimensionalCartesianShock::getField(const Vector3d &position) const {
+     189           0 :         double x = position.x;
+     190           0 :         double vDown = vUp / compressionRatio;
+     191             : 
+     192           0 :         double a = (vUp + vDown) * 0.5;
+     193           0 :         double b = (vUp - vDown) * 0.5;
+     194             : 
+     195             :         Vector3d v(0.);
+     196           0 :         v.x = a - b * tanh(x / lShock);
+     197           0 :         return v;
+     198             : 
+     199             : }
+     200             : 
+     201           0 : double OneDimensionalCartesianShock::getDivergence(const Vector3d &position) const {
+     202           0 :         double x = position.x;
+     203           0 :         double vDown = vUp / compressionRatio;
+     204             : 
+     205             :         double a = (vUp + vDown) * 0.5;
+     206           0 :         double b = (vUp - vDown) * 0.5;
+     207           0 :         return -b / lShock * (1 - tanh(x / lShock) * tanh(x / lShock));
+     208             : }
+     209             : 
+     210           0 : void OneDimensionalCartesianShock::setComp(double r) {
+     211           0 :         compressionRatio = r;
+     212           0 :         return;
+     213             : }
+     214             : 
+     215           0 : void OneDimensionalCartesianShock::setVup(double v) {
+     216           0 :         vUp = v;
+     217           0 :         return;
+     218             : }
+     219           0 : void OneDimensionalCartesianShock::setShockwidth(double w) {
+     220           0 :         lShock = w;
+     221           0 :         return;
+     222             : }
+     223             : 
+     224           0 : double OneDimensionalCartesianShock::getComp() const {
+     225           0 :         return compressionRatio;
+     226             : }
+     227             : 
+     228           0 : double OneDimensionalCartesianShock::getVup() const {
+     229           0 :         return vUp;
+     230             : }
+     231             : 
+     232           0 : double OneDimensionalCartesianShock::getShockwidth() const {
+     233           0 :         return lShock;
+     234             : }
+     235             : 
+     236           0 : std::string OneDimensionalCartesianShock::getDescription() const {
+     237           0 :         std::stringstream s;
+     238           0 :         s << "Shock width: " << lShock / km  << " km, ";
+     239           0 :         s << "Vup: " << vUp / km * sec << " km/s, ";
+     240           0 :         s << "Compression: " << compressionRatio;
+     241           0 :         return s.str();
+     242           0 : }
+     243             : 
+     244             : //----------------------------------------------------------------
+     245             : 
+     246           0 : OneDimensionalSphericalShock::OneDimensionalSphericalShock(double rShock, double vUp, double compressionRatio, double lShock, bool coolUpstream ){
+     247           0 :         setComp(compressionRatio);
+     248           0 :         setVup(vUp);
+     249           0 :         setShockwidth(lShock);
+     250           0 :         setShockRadius(rShock);
+     251           0 :         setCooling(coolUpstream);
+     252           0 :         }
+     253             : 
+     254           0 : Vector3d OneDimensionalSphericalShock::getField(const Vector3d &position) const {
+     255             :         double r = position.getR();
+     256           0 :         Vector3d e_r = position.getUnitVector();
+     257             : 
+     258           0 :         double vDown = vUp / compressionRatio;
+     259           0 :         double a = (vUp + vDown) * 0.5;
+     260           0 :         double b = (vUp - vDown) * 0.5;
+     261             : 
+     262             :         double v;
+     263           0 :         if (coolUpstream == true){
+     264             :         
+     265           0 :                 if (r <= rShock)
+     266           0 :                 v = a - b * tanh((r-rShock) / lShock);
+     267             :                 else
+     268           0 :                         v = (a - b * tanh((r-rShock) / lShock)) * (rShock / r) * (rShock / r);
+     269             : 
+     270             :         }
+     271             :         else
+     272           0 :                 v = (a - b * tanh((r-rShock) / lShock)) * (rShock / r) * (rShock / r);
+     273             : 
+     274           0 :         return v * e_r;
+     275             :         }
+     276             : 
+     277           0 : double OneDimensionalSphericalShock::getDivergence(const Vector3d &position) const {
+     278             :         double r = position.getR();
+     279             :         
+     280           0 :         double vDown = vUp / compressionRatio;
+     281           0 :         double a = (vUp + vDown) * 0.5;
+     282           0 :         double b = (vUp - vDown) * 0.5;
+     283             : 
+     284           0 :         double c = tanh((r-rShock) / lShock);
+     285             : 
+     286           0 :         if (coolUpstream == true){
+     287           0 :                 if (r <= rShock)
+     288           0 :                         return 2 * a / r - 2 * b / r * c - b / lShock * (1 - c * c);
+     289             :                 else
+     290           0 :                         return -(rShock / r) * (rShock / r) * b / lShock * (1 - c * c);
+     291             :         }
+     292             :         else 
+     293           0 :                 return -(rShock / r) * (rShock / r) *  b / lShock * (1 - c * c);
+     294             : 
+     295             : }
+     296             : 
+     297           0 : void OneDimensionalSphericalShock::setComp(double r) {
+     298           0 :         compressionRatio = r;
+     299           0 :         return;
+     300             : }
+     301             : 
+     302           0 : void OneDimensionalSphericalShock::setVup(double v) {
+     303           0 :         vUp = v;
+     304           0 :         return;
+     305             : }
+     306           0 : void OneDimensionalSphericalShock::setShockwidth(double w) {
+     307           0 :         lShock = w;
+     308           0 :         return;
+     309             : }
+     310             : 
+     311           0 : void OneDimensionalSphericalShock::setShockRadius(double r) {
+     312           0 :         rShock = r;
+     313           0 :         return;
+     314             : }
+     315             : 
+     316           0 : void OneDimensionalSphericalShock::setCooling(bool c) {
+     317           0 :         coolUpstream = c;
+     318           0 :         return;
+     319             : }
+     320             : 
+     321           0 : double OneDimensionalSphericalShock::getComp() const {
+     322           0 :         return compressionRatio;
+     323             : }
+     324             : 
+     325           0 : double OneDimensionalSphericalShock::getVup() const {
+     326           0 :         return vUp;
+     327             : }
+     328             : 
+     329           0 : double OneDimensionalSphericalShock::getShockwidth() const {
+     330           0 :         return lShock;
+     331             : }
+     332             : 
+     333           0 : double OneDimensionalSphericalShock::getShockRadius() const {
+     334           0 :         return rShock;
+     335             : }
+     336             : 
+     337           0 : bool OneDimensionalSphericalShock::getCooling() const {
+     338           0 :         return coolUpstream;
+     339             : }
+     340             : 
+     341           0 : std::string OneDimensionalSphericalShock::getDescription() const {
+     342           0 :         std::stringstream s;
+     343           0 :         s << "Shock width: " << lShock / km  << " km, ";
+     344           0 :         s << "Shock radius: " << rShock / km  << " km, ";
+     345           0 :         s << "Vup: " << vUp / km * sec << " km/s, ";
+     346           0 :         s << "Comp: " << compressionRatio;
+     347             : 
+     348           0 :         return s.str();
+     349           0 : }
+     350             : 
+     351             : //----------------------------------------------------------------
+     352             : 
+     353           0 : ObliqueAdvectionShock::ObliqueAdvectionShock(double compressionRatio, double vXUp, double vY, double lShock) {
+     354           0 :         setComp(compressionRatio);
+     355           0 :         setVup(vXUp);
+     356           0 :         setVy(vY);
+     357           0 :         setShockwidth(lShock);
+     358           0 :         }
+     359             : 
+     360           0 : Vector3d ObliqueAdvectionShock::getField(const Vector3d &position) const {
+     361           0 :         double x = position.x;
+     362           0 :         double vXDown = vXUp / compressionRatio;
+     363             : 
+     364           0 :         double a = (vXUp + vXDown) * 0.5;
+     365           0 :         double b = (vXUp - vXDown) * 0.5;
+     366             : 
+     367             :         Vector3d v(0.);
+     368           0 :         v.x = a - b * tanh(x / lShock);
+     369           0 :         v.y = vY;
+     370             : 
+     371           0 :         return v;
+     372             :         }
+     373             : 
+     374           0 : double ObliqueAdvectionShock::getDivergence(const Vector3d &position) const {
+     375           0 :         double x = position.x;
+     376           0 :         double vXDown = vXUp / compressionRatio;
+     377             :         // vy = const
+     378             : 
+     379             :         double a = (vXUp + vXDown) * 0.5;
+     380           0 :         double b = (vXUp - vXDown) * 0.5;
+     381             : 
+     382           0 :         return -b / lShock * (1 - tanh(x / lShock) * tanh(x / lShock));
+     383             :         }
+     384             : 
+     385           0 : void ObliqueAdvectionShock::setComp(double r) {
+     386           0 :         compressionRatio = r;
+     387           0 :         return;
+     388             : }
+     389             : 
+     390           0 : void ObliqueAdvectionShock::setVup(double v) {
+     391           0 :         vXUp = v;
+     392           0 :         return;
+     393             : } 
+     394             : 
+     395           0 : void ObliqueAdvectionShock::setVy(double v) {
+     396           0 :         vY = v;
+     397           0 :         return;
+     398             : } 
+     399           0 : void ObliqueAdvectionShock::setShockwidth(double w) {
+     400           0 :         lShock = w;
+     401           0 :         return;
+     402             : }
+     403             : 
+     404           0 : double ObliqueAdvectionShock::getComp() const {
+     405           0 :         return compressionRatio;
+     406             : }
+     407             : 
+     408           0 : double ObliqueAdvectionShock::getVup() const {
+     409           0 :         return vXUp;
+     410             : }
+     411             : 
+     412           0 : double ObliqueAdvectionShock::getVy() const {
+     413           0 :         return vY;
+     414             : }
+     415             : 
+     416           0 : double ObliqueAdvectionShock::getShockwidth() const {
+     417           0 :         return lShock;
+     418             : }
+     419             : 
+     420           0 : std::string ObliqueAdvectionShock::getDescription() const {
+     421           0 :         std::stringstream s;
+     422           0 :         s << "Shock width: " << lShock / km  << " km, ";
+     423           0 :         s << "Vx_up: " << vXUp / km * sec << " km/s, ";
+     424           0 :         s << "Vy: " << vY / km * sec << " km/s, ";
+     425           0 :         s << "Comp: " << compressionRatio;
+     426             :         
+     427           0 :         return s.str();
+     428           0 : }
+     429             : 
+     430             : //-----------------------------------------------------------------
+     431             : 
+     432           1 : SphericalAdvectionShock::SphericalAdvectionShock(const Vector3d origin, double r_0, double v_0, double l) {
+     433           1 :         setOrigin(origin);
+     434           1 :         setR0(r_0);
+     435           1 :         setV0(v_0);
+     436           1 :         setLambda(l);
+     437           1 :         setRRot(r_0);
+     438           1 :         setAzimuthalSpeed(0.);
+     439           1 : }
+     440             : 
+     441             : 
+     442           3 : Vector3d SphericalAdvectionShock::getField(const Vector3d &pos) const {
+     443             :         Vector3d R = pos-origin;
+     444           3 :         Vector3d e_r = R.getUnitVector();
+     445           3 :         Vector3d e_phi = R.getUnitVectorPhi();
+     446             :         double r = R.getR();
+     447             : 
+     448           3 :         double v_r = v_0 * ( 1 + (pow(r_0/(2*r), 2.) -1 ) * g(r));
+     449           3 :         double v_p = v_phi * (r_rot/r); 
+     450             : 
+     451           3 :         return v_r * e_r + v_p * e_phi;
+     452             : }
+     453             : 
+     454             : 
+     455           2 : double SphericalAdvectionShock::getDivergence(const Vector3d &pos) const {
+     456             :         double r = (pos-origin).getR();
+     457             : 
+     458           2 :         double d1 = 2./r*(1-g(r));
+     459           2 :         double d2 = (pow(r_0/(2*r), 2.)-1)*g_prime(r);
+     460             : 
+     461           2 :         return v_0 * (d1+d2);
+     462             : }
+     463             : 
+     464             : 
+     465           5 : double SphericalAdvectionShock::g(double r) const {
+     466           5 :         double a = (r-r_0)/lambda;
+     467           5 :         return 1. / (1+exp(-a));
+     468             : }
+     469             : 
+     470           2 : double SphericalAdvectionShock::g_prime(double r) const {
+     471           2 :         double a = (r-r_0)/lambda;
+     472           2 :         return 1. / (2*lambda*(1+cosh(-a)));
+     473             : }       
+     474             : 
+     475           1 : void SphericalAdvectionShock::setOrigin(const Vector3d o) {
+     476             :         origin = o;
+     477           1 : }
+     478             : 
+     479           1 : void SphericalAdvectionShock::setR0(double r) {
+     480           1 :         r_0 = r;
+     481           1 : }
+     482             : 
+     483           1 : void SphericalAdvectionShock::setV0(double v) {
+     484           1 :         v_0 = v;
+     485           1 : }
+     486             : 
+     487           1 : void SphericalAdvectionShock::setLambda(double l) {
+     488           1 :         lambda = l;
+     489           1 : }
+     490             : 
+     491           2 : void SphericalAdvectionShock::setRRot(double r) {
+     492           2 :         r_rot = r;
+     493           2 : }
+     494             : 
+     495           2 : void SphericalAdvectionShock::setAzimuthalSpeed(double v) {
+     496           2 :         v_phi = v;
+     497           2 : }
+     498             : 
+     499           3 : Vector3d SphericalAdvectionShock::getOrigin() const {
+     500           3 :         return origin;
+     501             : }
+     502             : 
+     503           1 : double SphericalAdvectionShock::getR0() const {
+     504           1 :         return r_0;
+     505             : }
+     506             : 
+     507           1 : double SphericalAdvectionShock::getV0() const {
+     508           1 :         return v_0;
+     509             : }
+     510             : 
+     511           1 : double SphericalAdvectionShock::getLambda() const {
+     512           1 :         return lambda;
+     513             : }
+     514             : 
+     515           2 : double SphericalAdvectionShock::getRRot() const {
+     516           2 :         return r_rot;
+     517             : }
+     518             : 
+     519           2 : double SphericalAdvectionShock::getAzimuthalSpeed() const {
+     520           2 :         return v_phi;
+     521             : }
+     522             : 
+     523           0 : std::string SphericalAdvectionShock::getDescription() const {
+     524           0 :         std::stringstream s;
+     525           0 :         s << "Origin: " << origin / kpc  << " kpc, ";
+     526           0 :         s << "r0 (shock radius): " << r_0 / kpc  << " kpc, ";
+     527           0 :         s << "r_rot (norm. azimuthal velocity): " << r_rot / kpc  << " kpc, ";
+     528           0 :         s << "v0 (maximum radial speed): " << v_0 / km * sec << " km/s, ";
+     529           0 :         s << "v_phi (azimuthal speed @ r_rot): " << v_phi / km * sec << " km/s, ";
+     530           0 :         s << "lambda: " << lambda / pc << " pc";
+     531           0 :         return s.str();
+     532           0 : }
+     533             : 
+     534             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/advectionField/index-sort-f.html b/doc/coverageReport/src/advectionField/index-sort-f.html new file mode 100644 index 000000000..54baddead --- /dev/null +++ b/doc/coverageReport/src/advectionField/index-sort-f.html @@ -0,0 +1,93 @@ + + + + + + + LCOV - coverage.info.cleaned - src/advectionField + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/advectionFieldHitTotalCoverage
Test:coverage.info.cleanedLines:13130842.5 %
Date:2024-04-08 14:58:22Functions:448452.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
AdvectionField.cpp +
42.5%42.5%
+
42.5 %131 / 30852.4 %44 / 84
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/advectionField/index-sort-l.html b/doc/coverageReport/src/advectionField/index-sort-l.html new file mode 100644 index 000000000..5eed79af6 --- /dev/null +++ b/doc/coverageReport/src/advectionField/index-sort-l.html @@ -0,0 +1,93 @@ + + + + + + + LCOV - coverage.info.cleaned - src/advectionField + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/advectionFieldHitTotalCoverage
Test:coverage.info.cleanedLines:13130842.5 %
Date:2024-04-08 14:58:22Functions:448452.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
AdvectionField.cpp +
42.5%42.5%
+
42.5 %131 / 30852.4 %44 / 84
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/advectionField/index.html b/doc/coverageReport/src/advectionField/index.html new file mode 100644 index 000000000..c4f7d0da9 --- /dev/null +++ b/doc/coverageReport/src/advectionField/index.html @@ -0,0 +1,93 @@ + + + + + + + LCOV - coverage.info.cleaned - src/advectionField + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/advectionFieldHitTotalCoverage
Test:coverage.info.cleanedLines:13130842.5 %
Date:2024-04-08 14:58:22Functions:448452.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
AdvectionField.cpp +
42.5%42.5%
+
42.5 %131 / 30852.4 %44 / 84
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/base64.cpp.func-sort-c.html b/doc/coverageReport/src/base64.cpp.func-sort-c.html new file mode 100644 index 000000000..6dfadfd29 --- /dev/null +++ b/doc/coverageReport/src/base64.cpp.func-sort-c.html @@ -0,0 +1,80 @@ + + + + + + + LCOV - coverage.info.cleaned - src/base64.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - base64.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:454991.8 %
Date:2024-04-08 14:58:22Functions:22100.0 %
+
+ +
+ + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa6Base646encodeB5cxx11EPKhm99
_ZN7crpropa6Base646decodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE100
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/base64.cpp.func.html b/doc/coverageReport/src/base64.cpp.func.html new file mode 100644 index 000000000..d68b507b6 --- /dev/null +++ b/doc/coverageReport/src/base64.cpp.func.html @@ -0,0 +1,80 @@ + + + + + + + LCOV - coverage.info.cleaned - src/base64.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - base64.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:454991.8 %
Date:2024-04-08 14:58:22Functions:22100.0 %
+
+ +
+ + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa6Base646decodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE100
_ZN7crpropa6Base646encodeB5cxx11EPKhm99
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/base64.cpp.gcov.html b/doc/coverageReport/src/base64.cpp.gcov.html new file mode 100644 index 000000000..3e0cc494c --- /dev/null +++ b/doc/coverageReport/src/base64.cpp.gcov.html @@ -0,0 +1,205 @@ + + + + + + + LCOV - coverage.info.cleaned - src/base64.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - base64.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:454991.8 %
Date:2024-04-08 14:58:22Functions:22100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : // base64 encodig and decoding.
+       2             : //
+       3             : // Based on the implementations by
+       4             : // Jouni Malinen <j@w1.fi> and contributors from wpa_supplicant and hostapd in
+       5             : // http://web.mit.edu/freebsd/head/contrib/wpa/ and
+       6             : // http://web.mit.edu/freebsd/head/contrib/wpa/src/utils/base64.c and
+       7             : // http://web.mit.edu/freebsd/head/contrib/wpa/src/utils/base64.h
+       8             : //
+       9             : // Published under a 3-clause BSD license
+      10             : //
+      11             : 
+      12             : #include <string>
+      13             : #include <cstring>
+      14             : #include <stdexcept>
+      15             : 
+      16             : #include "crpropa/base64.h"
+      17             : 
+      18             : namespace crpropa
+      19             : {
+      20             : 
+      21             : //Alphabet used
+      22             : static const unsigned char encode_alphabet[65] =
+      23             : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+      24             : static int decode_alphabet[256] = {-1};
+      25             : 
+      26             : /// Encodes data
+      27          99 : std::string Base64::encode(const unsigned char *src, size_t len)
+      28             : {
+      29          99 :                 size_t olen = 4*((len + 2) / 3); /* 3-byte blocks to 4-byte */
+      30             : 
+      31          99 :                 if (olen < len)
+      32           0 :                         throw std::runtime_error("Integer overflow in Base64::encoding, data to large!");
+      33             : 
+      34             :                 std::string outStr;
+      35             :                 outStr.resize(olen);
+      36             : 
+      37             :                 unsigned char *out = (unsigned char*) outStr.c_str();
+      38             :                 unsigned char *pos = out;
+      39             :                 const unsigned char *end, *in;
+      40             : 
+      41          99 :                 end = src + len;
+      42             :                 in = src;
+      43        6666 :                 while (end - in >= 3) {
+      44        6567 :                                 *pos++ = encode_alphabet[in[0] >> 2];
+      45        6567 :                                 *pos++ = encode_alphabet[((in[0] & 0x03) << 4) | (in[1] >> 4)];
+      46        6567 :                                 *pos++ = encode_alphabet[((in[1] & 0x0f) << 2) | (in[2] >> 6)];
+      47        6567 :                                 *pos++ = encode_alphabet[in[2] & 0x3f];
+      48        6567 :                                 in += 3;
+      49             :                 }
+      50             : 
+      51          99 :                 if (end - in) {
+      52          66 :                                 *pos++ = encode_alphabet[in[0] >> 2];
+      53          66 :                                 if (end - in == 1) {
+      54          33 :                                                 *pos++ = encode_alphabet[(in[0] & 0x03) << 4];
+      55          33 :                                                 *pos++ = '=';
+      56             :                                 }
+      57             :                                 else {
+      58          33 :                                                 *pos++ = encode_alphabet[((in[0] & 0x03) << 4) |
+      59          33 :                                                                 (in[1] >> 4)];
+      60          33 :                                                 *pos++ = encode_alphabet[(in[1] & 0x0f) << 2];
+      61             :                                 }
+      62          66 :                                 *pos++ = '=';
+      63             :                 }
+      64             : 
+      65          99 :                 return outStr;
+      66             : }
+      67             : 
+      68             : 
+      69         100 : std::string Base64::decode(const std::string &data)
+      70             : {
+      71             : const unsigned char *src = (unsigned char*) data.c_str();
+      72             : size_t len = data.size();
+      73             : 
+      74         100 : if (decode_alphabet[0] == -1)
+      75             : { // build decode alphabet
+      76             :         std::memset(decode_alphabet, 0x80, 256);
+      77          65 :         for (size_t i = 0; i < sizeof(encode_alphabet) - 1; i++)
+      78          64 :                 decode_alphabet[encode_alphabet[i]] = (unsigned char) i;
+      79           1 :         decode_alphabet['='] = 0;
+      80             : }
+      81             : 
+      82             : size_t olen = 0;
+      83       26656 : for (size_t i = 0; i < len; i++) {
+      84       26556 :         if (decode_alphabet[src[i]] != 0x80)
+      85       26556 :                 olen++;
+      86             : }
+      87             : 
+      88         100 : if (olen == 0 || olen % 4)
+      89           0 :                         throw std::runtime_error("Base64 decode, invalid input size");
+      90             : 
+      91         100 : olen = olen / 4 * 3;
+      92             : std::string str;
+      93             : str.resize(olen);
+      94             : 
+      95             : unsigned char *out = (unsigned char*) str.c_str();
+      96             : unsigned char *pos = out;
+      97             : 
+      98             : size_t count = 0;
+      99             : int pad = 0;
+     100             : unsigned char block[4];
+     101       26589 : for (size_t i = 0; i < len; i++) {
+     102       26556 :         unsigned char tmp = decode_alphabet[src[i]];
+     103       26556 :         if (tmp == 0x80)
+     104           0 :                 continue;
+     105             : 
+     106       26556 :         if (src[i] == '=')
+     107         101 :                 pad++;
+     108       26556 :         block[count] = tmp;
+     109       26556 :         count++;
+     110       26556 :         if (count == 4) {
+     111        6639 :                 *pos++ = (block[0] << 2) | (block[1] >> 4);
+     112        6639 :                 *pos++ = (block[1] << 4) | (block[2] >> 2);
+     113        6639 :                 *pos++ = (block[2] << 6) | block[3];
+     114             :                 count = 0;
+     115        6639 :                 if (pad) {
+     116          67 :                         if (pad == 1)
+     117             :                                 pos--;
+     118          34 :                         else if (pad == 2)
+     119             :                                 pos -= 2;
+     120             :                         else {
+     121           0 :                                 throw std::runtime_error("Base64 decode, invalid padding");
+     122             :                         }
+     123             :                         break;
+     124             :                 }
+     125             :         }
+     126             : }
+     127         100 : return str;
+     128             : }
+     129             : };
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/index-sort-f.html b/doc/coverageReport/src/index-sort-f.html new file mode 100644 index 000000000..b4c3a6afb --- /dev/null +++ b/doc/coverageReport/src/index-sort-f.html @@ -0,0 +1,253 @@ + + + + + + + LCOV - coverage.info.cleaned - src + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - srcHitTotalCoverage
Test:coverage.info.cleanedLines:1361270750.3 %
Date:2024-04-08 14:58:22Functions:25142958.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Clock.cpp +
0.0%
+
0.0 %0 / 270.0 %0 / 8
GridTools.cpp +
27.3%27.3%
+
27.3 %67 / 24536.8 %7 / 19
Variant.cpp +
13.7%13.7%
+
13.7 %71 / 51937.5 %18 / 48
Cosmology.cpp +
47.8%47.8%
+
47.8 %44 / 9240.0 %6 / 15
Geometry.cpp +
36.0%36.0%
+
36.0 %18 / 5046.2 %6 / 13
EmissionMap.cpp +
53.2%53.2%
+
53.2 %83 / 15654.5 %18 / 33
Source.cpp +
58.5%58.5%
+
58.5 %459 / 78455.5 %81 / 146
Random.cpp +
57.7%57.7%
+
57.7 %139 / 24156.5 %26 / 46
Module.cpp +
77.1%77.1%
+
77.1 %37 / 4875.0 %9 / 12
ParticleID.cpp +
53.3%53.3%
+
53.3 %16 / 3080.0 %4 / 5
ProgressBar.cpp +
78.0%78.0%
+
78.0 %39 / 5080.0 %4 / 5
PhotonBackground.cpp +
73.3%73.3%
+
73.3 %88 / 12080.0 %12 / 15
Common.cpp +
77.4%77.4%
+
77.4 %48 / 6283.3 %5 / 6
ParticleState.cpp +
85.7%85.7%
+
85.7 %48 / 5694.1 %16 / 17
Candidate.cpp +
87.8%87.8%
+
87.8 %129 / 14794.3 %33 / 35
base64.cpp +
91.8%91.8%
+
91.8 %45 / 49100.0 %2 / 2
ParticleMass.cpp +
96.8%96.8%
+
96.8 %30 / 31100.0 %4 / 4
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/index-sort-l.html b/doc/coverageReport/src/index-sort-l.html new file mode 100644 index 000000000..f65520a55 --- /dev/null +++ b/doc/coverageReport/src/index-sort-l.html @@ -0,0 +1,253 @@ + + + + + + + LCOV - coverage.info.cleaned - src + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - srcHitTotalCoverage
Test:coverage.info.cleanedLines:1361270750.3 %
Date:2024-04-08 14:58:22Functions:25142958.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Clock.cpp +
0.0%
+
0.0 %0 / 270.0 %0 / 8
Variant.cpp +
13.7%13.7%
+
13.7 %71 / 51937.5 %18 / 48
GridTools.cpp +
27.3%27.3%
+
27.3 %67 / 24536.8 %7 / 19
Geometry.cpp +
36.0%36.0%
+
36.0 %18 / 5046.2 %6 / 13
Cosmology.cpp +
47.8%47.8%
+
47.8 %44 / 9240.0 %6 / 15
EmissionMap.cpp +
53.2%53.2%
+
53.2 %83 / 15654.5 %18 / 33
ParticleID.cpp +
53.3%53.3%
+
53.3 %16 / 3080.0 %4 / 5
Random.cpp +
57.7%57.7%
+
57.7 %139 / 24156.5 %26 / 46
Source.cpp +
58.5%58.5%
+
58.5 %459 / 78455.5 %81 / 146
PhotonBackground.cpp +
73.3%73.3%
+
73.3 %88 / 12080.0 %12 / 15
Module.cpp +
77.1%77.1%
+
77.1 %37 / 4875.0 %9 / 12
Common.cpp +
77.4%77.4%
+
77.4 %48 / 6283.3 %5 / 6
ProgressBar.cpp +
78.0%78.0%
+
78.0 %39 / 5080.0 %4 / 5
ParticleState.cpp +
85.7%85.7%
+
85.7 %48 / 5694.1 %16 / 17
Candidate.cpp +
87.8%87.8%
+
87.8 %129 / 14794.3 %33 / 35
base64.cpp +
91.8%91.8%
+
91.8 %45 / 49100.0 %2 / 2
ParticleMass.cpp +
96.8%96.8%
+
96.8 %30 / 31100.0 %4 / 4
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/index.html b/doc/coverageReport/src/index.html new file mode 100644 index 000000000..6e1fed226 --- /dev/null +++ b/doc/coverageReport/src/index.html @@ -0,0 +1,253 @@ + + + + + + + LCOV - coverage.info.cleaned - src + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - srcHitTotalCoverage
Test:coverage.info.cleanedLines:1361270750.3 %
Date:2024-04-08 14:58:22Functions:25142958.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Candidate.cpp +
87.8%87.8%
+
87.8 %129 / 14794.3 %33 / 35
Clock.cpp +
0.0%
+
0.0 %0 / 270.0 %0 / 8
Common.cpp +
77.4%77.4%
+
77.4 %48 / 6283.3 %5 / 6
Cosmology.cpp +
47.8%47.8%
+
47.8 %44 / 9240.0 %6 / 15
EmissionMap.cpp +
53.2%53.2%
+
53.2 %83 / 15654.5 %18 / 33
Geometry.cpp +
36.0%36.0%
+
36.0 %18 / 5046.2 %6 / 13
GridTools.cpp +
27.3%27.3%
+
27.3 %67 / 24536.8 %7 / 19
Module.cpp +
77.1%77.1%
+
77.1 %37 / 4875.0 %9 / 12
ParticleID.cpp +
53.3%53.3%
+
53.3 %16 / 3080.0 %4 / 5
ParticleMass.cpp +
96.8%96.8%
+
96.8 %30 / 31100.0 %4 / 4
ParticleState.cpp +
85.7%85.7%
+
85.7 %48 / 5694.1 %16 / 17
PhotonBackground.cpp +
73.3%73.3%
+
73.3 %88 / 12080.0 %12 / 15
ProgressBar.cpp +
78.0%78.0%
+
78.0 %39 / 5080.0 %4 / 5
Random.cpp +
57.7%57.7%
+
57.7 %139 / 24156.5 %26 / 46
Source.cpp +
58.5%58.5%
+
58.5 %459 / 78455.5 %81 / 146
Variant.cpp +
13.7%13.7%
+
13.7 %71 / 51937.5 %18 / 48
base64.cpp +
91.8%91.8%
+
91.8 %45 / 49100.0 %2 / 2
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/ArchimedeanSpiralField.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/ArchimedeanSpiralField.cpp.func-sort-c.html new file mode 100644 index 000000000..a7bc79210 --- /dev/null +++ b/doc/coverageReport/src/magneticField/ArchimedeanSpiralField.cpp.func-sort-c.html @@ -0,0 +1,112 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/ArchimedeanSpiralField.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - ArchimedeanSpiralField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0420.0 %
Date:2024-04-08 14:58:22Functions:0100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa22ArchimedeanSpiralField5setB0Ed0
_ZN7crpropa22ArchimedeanSpiralField5setR0Ed0
_ZN7crpropa22ArchimedeanSpiralField5setVwEd0
_ZN7crpropa22ArchimedeanSpiralField8setOmegaEd0
_ZN7crpropa22ArchimedeanSpiralFieldC2Edddd0
_ZNK7crpropa22ArchimedeanSpiralField5getB0Ev0
_ZNK7crpropa22ArchimedeanSpiralField5getR0Ev0
_ZNK7crpropa22ArchimedeanSpiralField5getVwEv0
_ZNK7crpropa22ArchimedeanSpiralField8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa22ArchimedeanSpiralField8getOmegaEv0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/ArchimedeanSpiralField.cpp.func.html b/doc/coverageReport/src/magneticField/ArchimedeanSpiralField.cpp.func.html new file mode 100644 index 000000000..547d3e58d --- /dev/null +++ b/doc/coverageReport/src/magneticField/ArchimedeanSpiralField.cpp.func.html @@ -0,0 +1,112 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/ArchimedeanSpiralField.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - ArchimedeanSpiralField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0420.0 %
Date:2024-04-08 14:58:22Functions:0100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa22ArchimedeanSpiralField5setB0Ed0
_ZN7crpropa22ArchimedeanSpiralField5setR0Ed0
_ZN7crpropa22ArchimedeanSpiralField5setVwEd0
_ZN7crpropa22ArchimedeanSpiralField8setOmegaEd0
_ZN7crpropa22ArchimedeanSpiralFieldC2Edddd0
_ZNK7crpropa22ArchimedeanSpiralField5getB0Ev0
_ZNK7crpropa22ArchimedeanSpiralField5getR0Ev0
_ZNK7crpropa22ArchimedeanSpiralField5getVwEv0
_ZNK7crpropa22ArchimedeanSpiralField8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa22ArchimedeanSpiralField8getOmegaEv0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/ArchimedeanSpiralField.cpp.gcov.html b/doc/coverageReport/src/magneticField/ArchimedeanSpiralField.cpp.gcov.html new file mode 100644 index 000000000..0b5c7b362 --- /dev/null +++ b/doc/coverageReport/src/magneticField/ArchimedeanSpiralField.cpp.gcov.html @@ -0,0 +1,162 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/ArchimedeanSpiralField.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - ArchimedeanSpiralField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0420.0 %
Date:2024-04-08 14:58:22Functions:0100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/magneticField/ArchimedeanSpiralField.h"
+       2             : 
+       3             : namespace crpropa {
+       4             : 
+       5           0 : ArchimedeanSpiralField::ArchimedeanSpiralField(double B_0, double R_0, double Omega, double V_w) {
+       6           0 :         setB0(B_0);
+       7           0 :         setR0(R_0);
+       8           0 :         setOmega(Omega);
+       9           0 :         setVw(V_w);
+      10           0 : }
+      11             : 
+      12           0 : Vector3d ArchimedeanSpiralField::getField(const Vector3d &pos) const {
+      13             :         
+      14             :         double r = pos.getR();
+      15           0 :         double theta = pos.getTheta();
+      16           0 :         double phi =pos.getPhi();
+      17             :         
+      18           0 :         double cos_phi = cos(phi);
+      19           0 :         double sin_phi = sin(phi);
+      20           0 :         double cos_theta = cos(theta);
+      21           0 :         double sin_theta = sin(theta);
+      22             : 
+      23             :         Vector3d B(0.);
+      24             : 
+      25             :         // radial direction
+      26           0 :         double C1 = R_0*R_0/r/r;
+      27           0 :         B.x += C1 * cos_phi * sin_theta;
+      28           0 :         B.y += C1 * sin_phi * sin_theta;
+      29           0 :         B.z += C1 * cos_theta;
+      30             :         
+      31             :         // azimuthal direction  
+      32           0 :         double C2 = - (Omega*R_0*R_0*sin_theta) / (r*V_w);
+      33           0 :         B.x += C2 * (-sin_phi);
+      34           0 :         B.y += C2 * cos_phi;
+      35             : 
+      36             :         // magnetic field switch at z = 0
+      37           0 :         if (pos.z<0.) {
+      38             :                 B *= -1;
+      39             :         }
+      40             : 
+      41             :         // overall scaling
+      42             :         B *= B_0;
+      43             :         
+      44             : 
+      45           0 :         return B;
+      46             : }
+      47             : 
+      48           0 : void ArchimedeanSpiralField::setR0(double R) {
+      49           0 :         R_0 = R;
+      50           0 :         return;
+      51             : }
+      52             : 
+      53           0 : void ArchimedeanSpiralField::setB0(double B) {
+      54           0 :         B_0 = B;
+      55           0 :         return;
+      56             : }
+      57             : 
+      58           0 : void ArchimedeanSpiralField::setOmega(double Om) {
+      59           0 :         Omega = Om;
+      60           0 :         return;
+      61             : }
+      62             : 
+      63           0 : void ArchimedeanSpiralField::setVw(double v) {
+      64           0 :         V_w = v;
+      65           0 :         return;
+      66             : }
+      67             : 
+      68             : 
+      69           0 : double ArchimedeanSpiralField::getR0() const {
+      70           0 :         return R_0;
+      71             : }
+      72             : 
+      73           0 : double ArchimedeanSpiralField::getB0() const{
+      74           0 :         return B_0;
+      75             : }
+      76             : 
+      77           0 : double ArchimedeanSpiralField::getOmega() const{
+      78           0 :         return Omega;
+      79             : }
+      80             : 
+      81           0 : double ArchimedeanSpiralField::getVw() const {
+      82           0 :         return V_w;
+      83             : }
+      84             : 
+      85             : 
+      86             : } //end namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/CMZField.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/CMZField.cpp.func-sort-c.html new file mode 100644 index 000000000..57aca7fcf --- /dev/null +++ b/doc/coverageReport/src/magneticField/CMZField.cpp.func-sort-c.html @@ -0,0 +1,144 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/CMZField.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - CMZField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:10310796.3 %
Date:2024-04-08 14:58:22Functions:1818100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa8CMZField13setUseICFieldEb1
_ZN7crpropa8CMZField13setUseMCFieldEb1
_ZN7crpropa8CMZField14setUseNTFFieldEb1
_ZN7crpropa8CMZField14setUseRadioArcEb1
_ZNK7crpropa8CMZField10getICFieldERKNS_7Vector3IdEE1
_ZNK7crpropa8CMZField10getMCFieldERKNS_7Vector3IdEE1
_ZNK7crpropa8CMZField11getNTFFieldERKNS_7Vector3IdEE1
_ZNK7crpropa8CMZField16getRadioArcFieldERKNS_7Vector3IdEE1
_ZNK7crpropa8CMZField8getFieldERKNS_7Vector3IdEE1
_ZNK7crpropa8CMZField13getUseICFieldEv2
_ZNK7crpropa8CMZField13getUseMCFieldEv2
_ZNK7crpropa8CMZField14getUseNTFFieldEv2
_ZNK7crpropa8CMZField14getUseRadioArcEv2
_ZN7crpropa8CMZFieldC2Ev5
_ZNK7crpropa8CMZField4getAEd8
_ZNK7crpropa8CMZField4getLEd8
_ZNK7crpropa8CMZField4BPolERKNS_7Vector3IdEES4_ddd9
_ZNK7crpropa8CMZField3BAzERKNS_7Vector3IdEES4_ddd14
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/CMZField.cpp.func.html b/doc/coverageReport/src/magneticField/CMZField.cpp.func.html new file mode 100644 index 000000000..d0edc51bc --- /dev/null +++ b/doc/coverageReport/src/magneticField/CMZField.cpp.func.html @@ -0,0 +1,144 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/CMZField.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - CMZField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:10310796.3 %
Date:2024-04-08 14:58:22Functions:1818100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa8CMZField13setUseICFieldEb1
_ZN7crpropa8CMZField13setUseMCFieldEb1
_ZN7crpropa8CMZField14setUseNTFFieldEb1
_ZN7crpropa8CMZField14setUseRadioArcEb1
_ZN7crpropa8CMZFieldC2Ev5
_ZNK7crpropa8CMZField10getICFieldERKNS_7Vector3IdEE1
_ZNK7crpropa8CMZField10getMCFieldERKNS_7Vector3IdEE1
_ZNK7crpropa8CMZField11getNTFFieldERKNS_7Vector3IdEE1
_ZNK7crpropa8CMZField13getUseICFieldEv2
_ZNK7crpropa8CMZField13getUseMCFieldEv2
_ZNK7crpropa8CMZField14getUseNTFFieldEv2
_ZNK7crpropa8CMZField14getUseRadioArcEv2
_ZNK7crpropa8CMZField16getRadioArcFieldERKNS_7Vector3IdEE1
_ZNK7crpropa8CMZField3BAzERKNS_7Vector3IdEES4_ddd14
_ZNK7crpropa8CMZField4BPolERKNS_7Vector3IdEES4_ddd9
_ZNK7crpropa8CMZField4getAEd8
_ZNK7crpropa8CMZField4getLEd8
_ZNK7crpropa8CMZField8getFieldERKNS_7Vector3IdEE1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/CMZField.cpp.gcov.html b/doc/coverageReport/src/magneticField/CMZField.cpp.gcov.html new file mode 100644 index 000000000..20cf216cb --- /dev/null +++ b/doc/coverageReport/src/magneticField/CMZField.cpp.gcov.html @@ -0,0 +1,382 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/CMZField.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - CMZField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:10310796.3 %
Date:2024-04-08 14:58:22Functions:1818100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/magneticField/CMZField.h"
+       2             : #include "crpropa/Units.h"
+       3             : 
+       4             : namespace crpropa {
+       5             : 
+       6           5 : CMZField::CMZField() {
+       7           5 :     useMCField = false;
+       8           5 :     useICField = true;
+       9           5 :     useNTFField = false;
+      10           5 :     useRadioArc = false;
+      11           5 : }
+      12             : 
+      13           8 : double CMZField::getA(double a1) const {
+      14           8 :     return 4*log(2)/a1/a1;  
+      15             : }
+      16             : 
+      17           8 : double CMZField::getL(double a2) const {
+      18           8 :     return a2/2*log(2);
+      19             : }
+      20             : 
+      21           9 : Vector3d CMZField::BPol(const Vector3d& position,const Vector3d& mid, double B1, double a, double L) const{
+      22             :     // cylindircal coordinates
+      23             :     Vector3d pos = position - mid;
+      24           9 :     double r = sqrt(pos.x*pos.x + pos.y*pos.y);
+      25           9 :     double phi = std::atan2(pos.y, pos.x);
+      26             : 
+      27           9 :     double r1 = 1/(1+a*pos.z*pos.z);
+      28           9 :     double Bs = B1*exp(-r1*r/L);
+      29           9 :     double Br = 2*a*pow_integer<3>(r1)*r*pos.z*Bs;
+      30             :     
+      31             :     Vector3d b = Vector3d(0.);
+      32           9 :     b.z = r1*r1*Bs;
+      33             :     // transform to cartesian coordinates
+      34           9 :     b.x = Br*cos(phi);
+      35           9 :     b.y = Br*sin(phi);
+      36           9 :     return b;
+      37             : }
+      38             : 
+      39          14 : Vector3d CMZField::BAz(const Vector3d& position, const Vector3d& mid, double B1, double eta, double R) const {
+      40             :     // cylindrical coordinates
+      41             :     Vector3d pos = position - mid;
+      42          14 :     double r = sqrt(pos.x*pos.x + pos.y*pos.y);
+      43          14 :     double phi = std::atan2(pos.y,pos.x);
+      44             : 
+      45             :     Vector3d bVec(0.);
+      46          14 :     double Hc = R/sqrt(log(2));
+      47             :     double b = 1.;
+      48             :     double m = 1;
+      49          14 :     double r1 = R/10;
+      50          14 :     double v = m/eta*log((r+b)/(R+b));
+      51          14 :     double cosV = cos(v + m*phi);
+      52             : 
+      53             :     double Br=0;
+      54             :     double Bphi=0;
+      55             :     
+      56          14 :     if(r>r1){
+      57          13 :         double Pre = B1*cosV*exp(-pos.z*pos.z/Hc/Hc);
+      58          13 :         Br = Pre*R/r;
+      59          13 :         Bphi=-Pre/eta*R/(r+b);
+      60             :     }
+      61             :     else{
+      62           1 :         double Pre = B1*exp(-pos.z*pos.z/Hc/Hc)*R/r1*(3*r/r1 - 2*r*r/r1/r1)*cosV;
+      63             :         Br = Pre;
+      64           1 :         Bphi = 1 + 6*(r-r1)/(2*r-3*r1)*(sin(v+m*phi)-sin(v))/cosV;
+      65           1 :         Bphi *= -Pre*r/eta/(r+b);
+      66             :     }
+      67             : 
+      68          14 :     bVec.x = Br*cos(phi) - Bphi*sin(phi);
+      69          14 :     bVec.y = Br*sin(phi) + Bphi*cos(phi);
+      70             : 
+      71          14 :     return bVec;
+      72             : }
+      73             : 
+      74           2 : bool CMZField::getUseMCField() const {
+      75           2 :     return useMCField;
+      76             : }
+      77           2 : bool CMZField::getUseICField() const {
+      78           2 :     return useICField;
+      79             : }
+      80           2 : bool CMZField::getUseNTFField() const {
+      81           2 :     return useNTFField;
+      82             : }
+      83           2 : bool CMZField::getUseRadioArc() const {
+      84           2 :     return useRadioArc;
+      85             : }
+      86             : 
+      87           1 : void CMZField::setUseMCField(bool use) {
+      88           1 :     useMCField = use;
+      89           1 : }
+      90           1 : void CMZField::setUseICField(bool use) {
+      91           1 :     useICField = use;
+      92           1 : }
+      93           1 : void CMZField::setUseNTFField(bool use) {
+      94           1 :     useNTFField = use;
+      95           1 : }
+      96           1 : void CMZField::setUseRadioArc(bool use) {
+      97           1 :     useRadioArc = use;
+      98           1 : }
+      99             : 
+     100           1 : Vector3d CMZField::getMCField(const Vector3d& pos) const {//Field in molecular clouds
+     101             :     Vector3d b(0.);
+     102             :     double eta=0.01;
+     103             :     double N=59; // normalization factor, depends on eta
+     104             : 
+     105             :         // azimuthal component in dense clouds
+     106             :     //A=SgrC 
+     107             :     Vector3d mid(0,-81.59*pc, -16.32*pc);
+     108             :     double R = 1.7*pc; 
+     109             :     double B1=2.1e-3/N;
+     110           1 :     b += BAz(pos, mid, B1, eta, R);
+     111             : 
+     112             :     // A=G0.253+0.016 Dust Ridge A
+     113             :     mid = Vector3d(0, 37.53*pc, -2.37*pc);
+     114             :     R=2.4*pc; 
+     115             :     B1=2.5e-3/N;
+     116           1 :     b += BAz(pos, mid, B1, eta, R);
+     117             : 
+     118             :     //A=Dust Ridge B
+     119             :     mid = Vector3d(0, 50.44, 8.16)*pc;
+     120             :     R=1.9*pc; 
+     121             :     B1=0.9e-3/N;
+     122           1 :     b += BAz(pos, mid, B1, eta, R);
+     123             :     
+     124             :     //A=Dust Ridge C
+     125             :     mid = Vector3d(0,56.37,7.71)*pc;
+     126             :     R=1.9*pc; 
+     127             :     B1=1.2e-3/N;
+     128           1 :     b += BAz(pos, mid, B1, eta, R);
+     129             : 
+     130             :     //A=Dust Ridge D
+     131             :     mid = Vector3d(0, 60.82, 7.42)*pc;
+     132             :     R=3.3*pc; 
+     133             :     B1=1.7e-3/N;
+     134           1 :     b += BAz(pos, mid, B1, eta, R);
+     135             :     
+     136             :     //A=Dust Ridge E
+     137             :     mid = Vector3d(0, 70.91, 0.74)*pc;
+     138             :     R=3.5*pc; 
+     139             :     B1=4.1e-3/N;
+     140           1 :     b += BAz(pos, mid, B1, eta, R);
+     141             :         
+     142             :     //A=Dust Ridge F
+     143             :     mid = Vector3d(0, 73.58, 2.97)*pc;
+     144             :     R=2.4*pc; 
+     145             :     B1=3.9e-3/N;
+     146           1 :     b += BAz(pos, mid, B1, eta, R);
+     147             : 
+     148             :     //Sgr D
+     149             :     mid = Vector3d(0, 166.14, -10.38)*pc;
+     150             :     R=1.8*pc;
+     151             :     B1=0.8e-3/N;
+     152           1 :     b += BAz(pos, mid, B1, eta, R);
+     153             : 
+     154             :     //Sgr B2
+     155             :     mid = Vector3d(0, 97.01, -5.93)*pc;
+     156             :     R=14*pc; 
+     157             :     B1=1.0e-3/N;
+     158           1 :     b += BAz(pos, mid, B1, eta, R);
+     159             :         
+     160             :     //A=Inner R=5pc
+     161             :     mid = Vector3d(0, -8.3, -6.9)*pc;
+     162             :     R=5*pc; 
+     163             :     B1=3.0e-3/0.91;    
+     164           1 :     b += BAz(pos, mid, B1, 0.77, R); // different eta value!
+     165             : 
+     166             :     //20 km s^-1
+     167             :     mid = Vector3d(0, -19.29,-11.87)*pc;
+     168             :     R=9.4*pc; 
+     169             :     B1=2.7e-3/N;
+     170           1 :     b += BAz(pos, mid, B1, eta, R);    
+     171             :     
+     172             :     //50 km s^-1
+     173             :     mid = Vector3d(0, -2.97, -10.38)*pc;
+     174             :     R=9.4*pc; 
+     175             :     B1=3.7e-3/N;
+     176           1 :     b += BAz(pos, mid, B1, eta, R);    
+     177             :     
+     178             :     //SgrA* is different orrientated! 
+     179             :     //only phi component
+     180           1 :     double x = pos.x;
+     181           1 :     double y = pos.y + 8.3*pc;
+     182           1 :     double z = pos.z + 6.9*pc;
+     183             :     R=1.2e12; 
+     184             :     B1=65./3.07;
+     185             :     double Hc = R/sqrt(log(2));
+     186           1 :     double r = sqrt(x*x + y*y);
+     187             :     double r1 = R/10;
+     188           1 :     double phi= std::atan2(y,x);
+     189             :     double Bphi;
+     190             : 
+     191           1 :     if(r>r1){
+     192           1 :         Bphi = - B1*exp(-z*z/Hc/Hc)*R/r;
+     193             :     }
+     194             :     else{
+     195           0 :         - B1*exp(-z*z/Hc/Hc)*R/r1*(3*r/r1- 2*r*r/r1*r1);
+     196             :     }
+     197             : 
+     198           1 :     b.x -= Bphi*sin(phi);
+     199           1 :     b.y += Bphi*cos(phi);
+     200             : 
+     201           1 :     return b*gauss;
+     202             : } 
+     203             : 
+     204           1 : Vector3d CMZField::getICField(const Vector3d& pos) const {//Field in intercloud medium--> poloidal field
+     205             :     Vector3d mid(0.,-8.3*pc,-6.9*pc);
+     206             : 
+     207             :     double eta = 0.85;
+     208             :     double B1 = 1e-5*gauss;
+     209             :     double B2 = B1/eta;
+     210             :     double a = 4*log(2)/pow(70*pc, 2); 
+     211             :     double L = 158*pc/log(2);
+     212             : 
+     213           1 :     return BPol(pos, mid, B2, a, L);
+     214             : }                                                         
+     215             :   
+     216           1 : Vector3d CMZField::getNTFField(const Vector3d& pos) const {//Field in the non-thermal filaments--> predominantly poloidal field (except "pelical"-> azimuthal)
+     217             :     Vector3d b(0.); 
+     218             :     Vector3d mid(0.);
+     219             : 
+     220             :     //A=SgrC
+     221             :     mid = Vector3d(0., -81.59,-1.48)*pc;
+     222             :     double a1=27.44*pc;
+     223             :     double a2=1.73*pc;
+     224             :     double eta=0.48;
+     225             :     double B1=1.e-4;
+     226           1 :     b += BPol(pos, mid, B1/eta, getA(a1), getL(a2));
+     227             : 
+     228             :     //A=G359.15-0.2 The Snake
+     229             :     mid = Vector3d(0, -126.1,-25.22)*pc;
+     230             :     a1=12.86*pc;
+     231             :     a2=2.22*pc;
+     232             :     B1=88.e-6;
+     233           1 :     b += BPol(pos, mid, B1/eta, getA(a1), getL(a2));
+     234             : 
+     235             :     //A=G359.54+0.18 Nonthermal Filament
+     236             :     mid = Vector3d(0, -68.24,25.22)*pc;
+     237             :     a1=15.08*pc;
+     238             :     a2=2.72;
+     239             :     B1=1.e-3;
+     240           1 :     b += BPol(pos, mid, B1/eta, getA(a1), getL(a2));
+     241             : 
+     242             :     //A=G359.79 +17 Nonthermal Filament
+     243             :     mid = Vector3d(0,-31.15,23.74)*pc;
+     244             :     a1=16.07*pc;
+     245             :     a2=3.46*pc;
+     246             :     B1=1.e-3;
+     247           1 :     b += BPol(pos, mid, B1/eta, getA(a1), getL(a2));
+     248             : 
+     249             :     //A=G359.96 +0.09  Nonthermal Filament Southern Thread
+     250             :     mid = Vector3d(0, 5.93, 16.32)*pc;
+     251             :     a1=28.68*pc;
+     252             :     a2=1.73*pc;
+     253             :     B1=1.e-4;
+     254           1 :     b += BPol(pos, mid, B1/eta, getA(a1), getL(a2));
+     255             : 
+     256             :     //A=G0.09 +0.17  Nonthermal Filament Northern thread
+     257             :     mid = Vector3d(0, 13.35, 25.22)*pc;
+     258             :     a1=29.42*pc;
+     259             :     a2=2.23*pc;
+     260             :     B1=140.e-6;
+     261           1 :     b += BPol(pos, mid, B1/eta, getA(a1), getL(a2));
+     262             : 
+     263             :     //A=G359.85+0.47  Nonthermal Filament The Pelican  is not poloidal but azimuthal
+     264             :     mid = Vector3d(0, -22.25, 69.73)*pc;
+     265             :     a1=11.37*pc;
+     266             :     a2=2.23*pc;
+     267             :     B1=70.e-6 /eta;
+     268             :     // by and bz switched because pelican is differently oriented
+     269           1 :     Vector3d bPelican = BPol(pos, mid, B1/eta, getA(a1), getL(a2));
+     270           1 :     b.x += bPelican.x;
+     271           1 :     b.y += bPelican.z;
+     272           1 :     b.z += bPelican.y;
+     273             :     
+     274           1 :         return b*gauss;
+     275             : }
+     276             :   
+     277           1 : Vector3d CMZField::getRadioArcField(const Vector3d& pos) const {//Field in the non-thermal filaments--> predominantly poloidal field
+     278             :     //poloidal field in the non-thermal filament region A=RadioArc
+     279             :     double eta=0.48;
+     280             :     Vector3d mid(0,26.7*pc,10.38*pc);
+     281             :     double a1=70.47*pc;// arcmin-> deg->cm
+     282             :     double a2=9.89*pc;// arcmin-> deg-> cm
+     283             :     double B1=1.e-3;
+     284           1 :     return BPol(pos, mid, B1/eta, getA(a1), getL(a2))*gauss;
+     285             : }
+     286             : 
+     287           1 : Vector3d CMZField::getField(const Vector3d& pos) const{
+     288             :     Vector3d b(0.);
+     289             : 
+     290           1 :     if(useMCField){
+     291           0 :         b += getMCField(pos);
+     292             :     }
+     293           1 :     if(useICField){
+     294           1 :         b += getICField(pos);
+     295             :     }
+     296           1 :     if(useNTFField){
+     297           0 :         b += getNTFField(pos);
+     298             :     }
+     299           1 :     if(useRadioArc){
+     300           0 :         b += getRadioArcField(pos);
+     301             :     }
+     302             : 
+     303           1 :     return b;
+     304             : }
+     305             : 
+     306             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/JF12Field.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/JF12Field.cpp.func-sort-c.html new file mode 100644 index 000000000..4cfb03c01 --- /dev/null +++ b/doc/coverageReport/src/magneticField/JF12Field.cpp.func-sort-c.html @@ -0,0 +1,188 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/JF12Field.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - JF12Field.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:02310.0 %
Date:2024-04-08 14:58:22Functions:0290.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16PlanckJF12bFieldC2Ev0
_ZN7crpropa9JF12Field12setUseXFieldEb0
_ZN7crpropa9JF12Field13isUsingXFieldEv0
_ZN7crpropa9JF12Field14randomStriatedEi0
_ZN7crpropa9JF12Field15getStriatedGridEv0
_ZN7crpropa9JF12Field15randomTurbulentEi0
_ZN7crpropa9JF12Field15setStriatedGridENS_7ref_ptrINS_4GridIfEEEE0
_ZN7crpropa9JF12Field15setUseDiskFieldEb0
_ZN7crpropa9JF12Field16getTurbulentGridEv0
_ZN7crpropa9JF12Field16isUsingDiskFieldEv0
_ZN7crpropa9JF12Field16setTurbulentGridENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa9JF12Field18setUseRegularFieldEb0
_ZN7crpropa9JF12Field19isUsingRegularFieldEv0
_ZN7crpropa9JF12Field19setUseStriatedFieldEb0
_ZN7crpropa9JF12Field20isUsingStriatedFieldEv0
_ZN7crpropa9JF12Field20setUseTurbulentFieldEb0
_ZN7crpropa9JF12Field21isUsingTurbulentFieldEv0
_ZN7crpropa9JF12Field23setUseToroidalHaloFieldEb0
_ZN7crpropa9JF12Field24isUsingToroidalHaloFieldEv0
_ZN7crpropa9JF12FieldC2Ev0
_ZNK7crpropa9JF12Field12getDiskFieldERKdS2_S2_S2_S2_0
_ZNK7crpropa9JF12Field15getRegularFieldERKNS_7Vector3IdEE0
_ZNK7crpropa9JF12Field16getStriatedFieldERKNS_7Vector3IdEE0
_ZNK7crpropa9JF12Field16logisticFunctionERKdS2_S2_0
_ZNK7crpropa9JF12Field17getTurbulentFieldERKNS_7Vector3IdEE0
_ZNK7crpropa9JF12Field20getToroidalHaloFieldERKdS2_S2_S2_0
_ZNK7crpropa9JF12Field20getTurbulentStrengthERKNS_7Vector3IdEE0
_ZNK7crpropa9JF12Field8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa9JF12Field9getXFieldERKdS2_S2_S2_0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/JF12Field.cpp.func.html b/doc/coverageReport/src/magneticField/JF12Field.cpp.func.html new file mode 100644 index 000000000..f4e99fdd5 --- /dev/null +++ b/doc/coverageReport/src/magneticField/JF12Field.cpp.func.html @@ -0,0 +1,188 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/JF12Field.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - JF12Field.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:02310.0 %
Date:2024-04-08 14:58:22Functions:0290.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16PlanckJF12bFieldC2Ev0
_ZN7crpropa9JF12Field12setUseXFieldEb0
_ZN7crpropa9JF12Field13isUsingXFieldEv0
_ZN7crpropa9JF12Field14randomStriatedEi0
_ZN7crpropa9JF12Field15getStriatedGridEv0
_ZN7crpropa9JF12Field15randomTurbulentEi0
_ZN7crpropa9JF12Field15setStriatedGridENS_7ref_ptrINS_4GridIfEEEE0
_ZN7crpropa9JF12Field15setUseDiskFieldEb0
_ZN7crpropa9JF12Field16getTurbulentGridEv0
_ZN7crpropa9JF12Field16isUsingDiskFieldEv0
_ZN7crpropa9JF12Field16setTurbulentGridENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa9JF12Field18setUseRegularFieldEb0
_ZN7crpropa9JF12Field19isUsingRegularFieldEv0
_ZN7crpropa9JF12Field19setUseStriatedFieldEb0
_ZN7crpropa9JF12Field20isUsingStriatedFieldEv0
_ZN7crpropa9JF12Field20setUseTurbulentFieldEb0
_ZN7crpropa9JF12Field21isUsingTurbulentFieldEv0
_ZN7crpropa9JF12Field23setUseToroidalHaloFieldEb0
_ZN7crpropa9JF12Field24isUsingToroidalHaloFieldEv0
_ZN7crpropa9JF12FieldC2Ev0
_ZNK7crpropa9JF12Field12getDiskFieldERKdS2_S2_S2_S2_0
_ZNK7crpropa9JF12Field15getRegularFieldERKNS_7Vector3IdEE0
_ZNK7crpropa9JF12Field16getStriatedFieldERKNS_7Vector3IdEE0
_ZNK7crpropa9JF12Field16logisticFunctionERKdS2_S2_0
_ZNK7crpropa9JF12Field17getTurbulentFieldERKNS_7Vector3IdEE0
_ZNK7crpropa9JF12Field20getToroidalHaloFieldERKdS2_S2_S2_0
_ZNK7crpropa9JF12Field20getTurbulentStrengthERKNS_7Vector3IdEE0
_ZNK7crpropa9JF12Field8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa9JF12Field9getXFieldERKdS2_S2_S2_0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/JF12Field.cpp.gcov.html b/doc/coverageReport/src/magneticField/JF12Field.cpp.gcov.html new file mode 100644 index 000000000..71e09d723 --- /dev/null +++ b/doc/coverageReport/src/magneticField/JF12Field.cpp.gcov.html @@ -0,0 +1,452 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/JF12Field.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - JF12Field.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:02310.0 %
Date:2024-04-08 14:58:22Functions:0290.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/magneticField/JF12Field.h"
+       2             : #include "crpropa/Units.h"
+       3             : #include "crpropa/magneticField/turbulentField/SimpleGridTurbulence.h"
+       4             : #include "crpropa/Random.h"
+       5             : 
+       6             : namespace crpropa {
+       7             : 
+       8           0 : JF12Field::JF12Field() {
+       9           0 :         useRegularField = true;
+      10           0 :         useStriatedField = false;
+      11           0 :         useTurbulentField = false;
+      12           0 :         useDiskField = true;
+      13           0 :         useToroidalHaloField = true;
+      14           0 :         useXField = true;
+      15             : 
+      16             :         // spiral arm parameters
+      17           0 :         pitch = 11.5 * M_PI / 180;
+      18           0 :         sinPitch = sin(pitch);
+      19           0 :         cosPitch = cos(pitch);
+      20           0 :         tanPitch = tan(pitch);
+      21           0 :         cotPitch =  1. / tanPitch;
+      22           0 :         tan90MinusPitch = tan(M_PI / 2 - pitch);
+      23             : 
+      24           0 :         rArms[0] = 5.1 * kpc;
+      25           0 :         rArms[1] = 6.3 * kpc;
+      26           0 :         rArms[2] = 7.1 * kpc;
+      27           0 :         rArms[3] = 8.3 * kpc;
+      28           0 :         rArms[4] = 9.8 * kpc;
+      29           0 :         rArms[5] = 11.4 * kpc;
+      30           0 :         rArms[6] = 12.7 * kpc;
+      31           0 :         rArms[7] = 15.5 * kpc;
+      32             : 
+      33             :         // regular field parameters
+      34           0 :         bRing = 0.1 * muG;
+      35           0 :         hDisk = 0.40 * kpc;
+      36           0 :         wDisk = 0.27 * kpc;
+      37             : 
+      38           0 :         bDisk[0] = 0.1 * muG;
+      39           0 :         bDisk[1] = 3.0 * muG;
+      40           0 :         bDisk[2] = -0.9 * muG;
+      41           0 :         bDisk[3] = -0.8 * muG;
+      42           0 :         bDisk[4] = -2.0 * muG;
+      43           0 :         bDisk[5] = -4.2 * muG;
+      44           0 :         bDisk[6] = 0.0 * muG;
+      45           0 :         bDisk[7] = 2.7 * muG;
+      46             : 
+      47           0 :         bNorth = 1.4 * muG;
+      48           0 :         bSouth = -1.1 * muG;
+      49           0 :         rNorth = 9.22 * kpc;
+      50           0 :         rSouth = 17 * kpc;
+      51           0 :         wHalo = 0.20 * kpc;
+      52           0 :         z0 = 5.3 * kpc;
+      53             : 
+      54           0 :         bX = 4.6 * muG;
+      55           0 :         thetaX0 = 49.0 * M_PI / 180;
+      56           0 :         sinThetaX0 = sin(thetaX0);
+      57           0 :         cosThetaX0 = cos(thetaX0);
+      58           0 :         tanThetaX0 = tan(thetaX0);
+      59           0 :         cotThetaX0 = 1. / tanThetaX0;
+      60           0 :         rXc = 4.8 * kpc;
+      61           0 :         rX = 2.9 * kpc;
+      62             : 
+      63             :         // striated field parameter
+      64           0 :         sqrtbeta = sqrt(1.36);
+      65             : 
+      66             :         // turbulent field parameters
+      67           0 :         bDiskTurb[0] = 10.81 * muG;
+      68           0 :         bDiskTurb[1] = 6.96 * muG;
+      69           0 :         bDiskTurb[2] = 9.59 * muG;
+      70           0 :         bDiskTurb[3] = 6.96 * muG;
+      71           0 :         bDiskTurb[4] = 1.96 * muG;
+      72           0 :         bDiskTurb[5] = 16.34 * muG;
+      73           0 :         bDiskTurb[6] = 37.29 * muG;
+      74           0 :         bDiskTurb[7] = 10.35 * muG;
+      75             : 
+      76           0 :         bDiskTurb5 = 7.63 * muG;
+      77           0 :         zDiskTurb = 0.61 * kpc;
+      78             : 
+      79           0 :         bHaloTurb = 4.68 * muG;
+      80           0 :         rHaloTurb = 10.97 * kpc;
+      81           0 :         zHaloTurb = 2.84 * kpc;
+      82           0 : }
+      83             : 
+      84           0 : void JF12Field::randomStriated(int seed) {
+      85           0 :         useStriatedField = true;
+      86             :         int N = 100;
+      87           0 :         striatedGrid = new Grid1f(Vector3d(0.), N, 0.1 * kpc);
+      88             : 
+      89           0 :         Random random;
+      90           0 :         if (seed != 0)
+      91           0 :                 random.seed(seed);
+      92             : 
+      93           0 :         for (int ix = 0; ix < N; ix++)
+      94           0 :                 for (int iy = 0; iy < N; iy++)
+      95           0 :                         for (int iz = 0; iz < N; iz++) {
+      96           0 :                                 float &f = striatedGrid->get(ix, iy, iz);
+      97           0 :                                 f = round(random.rand()) * 2 - 1;
+      98             :                         }
+      99           0 : }
+     100             : 
+     101             : #ifdef CRPROPA_HAVE_FFTW3F
+     102           0 : void JF12Field::randomTurbulent(int seed) {
+     103           0 :         useTurbulentField = true;
+     104             :         // turbulent field with Kolmogorov spectrum, B_rms = 1 (will be scaled) and Lc = 60 parsec, and 256 grid points.
+     105             :         // Note that the inertial range of the turbulence is less than 2 orders of magnitude.
+     106             :     const double lMin = 8 * parsec;
+     107             :     const double lMax = 272 * parsec;
+     108             :     const double Brms = 1;
+     109             :     const double spacing = 4 * parsec;
+     110             :     const double grid_n = 256;
+     111             : 
+     112             :     auto spectrum = SimpleTurbulenceSpectrum(Brms, lMin, lMax);
+     113             :     auto gp = GridProperties(Vector3d(0.), grid_n, spacing);
+     114           0 :     auto tf = SimpleGridTurbulence(spectrum, gp, seed);
+     115           0 :     turbulentGrid = tf.getGrid();
+     116             : 
+     117           0 : }
+     118             : #endif
+     119             : 
+     120           0 : void JF12Field::setStriatedGrid(ref_ptr<Grid1f> grid) {
+     121           0 :         useStriatedField = true;
+     122           0 :         striatedGrid = grid;
+     123           0 : }
+     124             : 
+     125           0 : void JF12Field::setTurbulentGrid(ref_ptr<Grid3f> grid) {
+     126           0 :         useTurbulentField = true;
+     127           0 :         turbulentGrid = grid;
+     128           0 : }
+     129             : 
+     130           0 : ref_ptr<Grid1f> JF12Field::getStriatedGrid() {
+     131           0 :         return striatedGrid;
+     132             : }
+     133             : 
+     134           0 : ref_ptr<Grid3f> JF12Field::getTurbulentGrid() {
+     135           0 :         return turbulentGrid;
+     136             : }
+     137             : 
+     138           0 : void JF12Field::setUseRegularField(bool use) {
+     139           0 :         useRegularField = use;
+     140           0 : }
+     141             : 
+     142           0 : void JF12Field::setUseDiskField(bool use) {
+     143           0 :         useDiskField = use;
+     144           0 : }
+     145             : 
+     146           0 : void JF12Field::setUseToroidalHaloField(bool use) {
+     147           0 :         useToroidalHaloField = use;
+     148           0 : }
+     149             : 
+     150           0 : void JF12Field::setUseXField(bool use) {
+     151           0 :         useXField = use;
+     152           0 : }
+     153             : 
+     154           0 : void JF12Field::setUseStriatedField(bool use) {
+     155           0 :         if ((use) and !(striatedGrid)) {
+     156           0 :                 KISS_LOG_WARNING << "JF12Field: No striated field set: ignored. Run e.g. randomStriated().";
+     157           0 :                 return;
+     158             :         }
+     159           0 :         useStriatedField = use;
+     160             : }
+     161             : 
+     162           0 : void JF12Field::setUseTurbulentField(bool use) {
+     163           0 :         if ((use) and !(turbulentGrid)) {
+     164           0 :                 KISS_LOG_WARNING << "JF12Field: No turbulent field set: ignored. Run e.g. randomTurbulent().";
+     165           0 :                 return;
+     166             :         }
+     167           0 :         useTurbulentField = use;
+     168             : }
+     169             : 
+     170           0 : bool JF12Field::isUsingRegularField() {
+     171           0 :         return useRegularField;
+     172             : }
+     173             : 
+     174           0 : bool JF12Field::isUsingDiskField() {
+     175           0 :         return useDiskField;
+     176             : }
+     177             : 
+     178           0 : bool JF12Field::isUsingToroidalHaloField() {
+     179           0 :         return useToroidalHaloField;
+     180             : }
+     181             : 
+     182           0 : bool JF12Field::isUsingXField() {
+     183           0 :         return useXField;
+     184             : }
+     185             : 
+     186           0 : bool JF12Field::isUsingStriatedField() {
+     187           0 :         return useStriatedField;
+     188             : }
+     189             : 
+     190           0 : bool JF12Field::isUsingTurbulentField() {
+     191           0 :         return useTurbulentField;
+     192             : }
+     193             : 
+     194           0 : double JF12Field::logisticFunction(const double& x, const double& x0, const double& w) const {
+     195           0 :         return 1. / (1. + exp(-2. * (fabs(x) - x0) / w));
+     196             : }
+     197             : 
+     198           0 : Vector3d JF12Field::getRegularField(const Vector3d& pos) const {
+     199             :         Vector3d b(0.);
+     200             : 
+     201             :         double d = pos.getR(); // distance to galactic center
+     202             : 
+     203           0 :         if (d < 20 * kpc) {
+     204           0 :                 double r = sqrt(pos.x * pos.x + pos.y * pos.y); // in-plane radius
+     205           0 :                 double phi = pos.getPhi(); // azimuth
+     206           0 :                 double sinPhi = sin(phi);
+     207           0 :                 double cosPhi = cos(phi);
+     208             : 
+     209           0 :                 b += getDiskField(r, pos.z, phi, sinPhi, cosPhi);
+     210           0 :                 b += getToroidalHaloField(r, pos.z, sinPhi, cosPhi);
+     211           0 :                 b += getXField(r, pos.z, sinPhi, cosPhi);
+     212             :         }
+     213             : 
+     214           0 :         return b;
+     215             : }
+     216             : 
+     217           0 : Vector3d JF12Field::getDiskField(const double& r, const double& z, const double& phi, const double& sinPhi, const double& cosPhi) const {
+     218             :         Vector3d b(0.);
+     219           0 :         if (useDiskField) {
+     220           0 :                 double lfDisk = logisticFunction(z, hDisk, wDisk);
+     221           0 :                 if (r > 3 * kpc) {
+     222             :                         double bMag;
+     223           0 :                         if (r < 5 * kpc) {
+     224             :                                 // molecular ring
+     225           0 :                                 bMag = bRing * (5 * kpc / r) * (1 - lfDisk);
+     226           0 :                                 b.x += -bMag * sinPhi;
+     227           0 :                                 b.y += bMag * cosPhi;
+     228             :                         } else {
+     229             :                                 // spiral region
+     230           0 :                                 double r_negx = r * exp(-(phi - M_PI) / tan90MinusPitch);
+     231           0 :                                 if (r_negx > rArms[7])
+     232           0 :                                         r_negx = r * exp(-(phi + M_PI) / tan90MinusPitch);
+     233           0 :                                 if (r_negx > rArms[7])
+     234           0 :                                         r_negx = r * exp(-(phi + 3 * M_PI) / tan90MinusPitch);
+     235             : 
+     236           0 :                                 for (int i = 7; i >= 0; i--)
+     237           0 :                                         if (r_negx < rArms[i])
+     238           0 :                                                 bMag = bDisk[i];
+     239             : 
+     240           0 :                                 bMag *= (5 * kpc / r) * (1 - lfDisk);
+     241           0 :                                 b.x += bMag * (sinPitch * cosPhi - cosPitch * sinPhi);
+     242           0 :                                 b.y += bMag * (sinPitch * sinPhi + cosPitch * cosPhi);
+     243             :                         }
+     244             :                 }
+     245             :         }
+     246           0 :         return b;
+     247             : }
+     248             : 
+     249           0 : Vector3d JF12Field::getToroidalHaloField(const double& r, const double& z, const double& sinPhi, const double& cosPhi) const {
+     250             :         Vector3d b(0.);
+     251             : 
+     252           0 :         if (useToroidalHaloField && (r * r + z * z > 1 * kpc * kpc)){
+     253             : 
+     254           0 :                 double lfDisk = logisticFunction(z, hDisk, wDisk);
+     255           0 :                 double bMagH = exp(-fabs(z) / z0) * lfDisk;
+     256             : 
+     257           0 :                 if (z >= 0)
+     258           0 :                         bMagH *= bNorth * (1 - logisticFunction(r, rNorth, wHalo));
+     259             :                 else
+     260           0 :                         bMagH *= bSouth * (1 - logisticFunction(r, rSouth, wHalo));
+     261           0 :                 b.x += -bMagH * sinPhi;
+     262           0 :                 b.y += bMagH * cosPhi;
+     263             :         }
+     264           0 :         return b;
+     265             : }
+     266             : 
+     267           0 : Vector3d JF12Field::getXField(const double& r, const double& z, const double& sinPhi, const double& cosPhi) const {
+     268             :         Vector3d b(0.);
+     269             : 
+     270           0 :         if (useXField && (r * r + z * z > 1 * kpc * kpc)){
+     271             :                 double bMagX;
+     272             :                 double sinThetaX, cosThetaX;
+     273             :                 double rp;
+     274           0 :                 double rc = rXc + fabs(z) / tanThetaX0;
+     275           0 :                 if (r < rc) {
+     276             :                         // varying elevation region
+     277           0 :                         rp = r * rXc / rc;
+     278           0 :                         bMagX = bX * exp(-1 * rp / rX) * pow(rXc / rc, 2.);
+     279           0 :                         double thetaX = atan2(fabs(z), (r - rp));
+     280           0 :                         if (z == 0)
+     281             :                                 thetaX = M_PI / 2.;
+     282           0 :                         sinThetaX = sin(thetaX);
+     283           0 :                         cosThetaX = cos(thetaX);
+     284             :                 } else {
+     285             :                         // constant elevation region
+     286           0 :                         rp = r - fabs(z) / tanThetaX0;
+     287           0 :                         bMagX = bX * exp(-rp / rX) * (rp / r);
+     288           0 :                         sinThetaX = sinThetaX0;
+     289           0 :                         cosThetaX = cosThetaX0;
+     290             :                 }
+     291           0 :                 double zsign = z < 0 ? -1 : 1;
+     292           0 :                 b.x += zsign * bMagX * cosThetaX * cosPhi;
+     293           0 :                 b.y += zsign * bMagX * cosThetaX * sinPhi;
+     294           0 :                 b.z += bMagX * sinThetaX;
+     295             :         }
+     296           0 :         return b;
+     297             : }
+     298             : 
+     299           0 : Vector3d JF12Field::getStriatedField(const Vector3d& pos) const {
+     300           0 :         return (getRegularField(pos)
+     301           0 :                         * (1. + sqrtbeta * striatedGrid->closestValue(pos)));
+     302             : }
+     303             : 
+     304           0 : double JF12Field::getTurbulentStrength(const Vector3d& pos) const {
+     305           0 :         if (pos.getR() > 20 * kpc)
+     306             :                 return 0;
+     307             : 
+     308           0 :         double r = sqrt(pos.x * pos.x + pos.y * pos.y); // in-plane radius
+     309           0 :         double phi = pos.getPhi(); // azimuth
+     310             : 
+     311             :         // disk
+     312             :         double bDisk = 0;
+     313           0 :         if (r < 5 * kpc) {
+     314           0 :                 bDisk = bDiskTurb5;
+     315             :         } else {
+     316             :                 // spiral region
+     317           0 :                 double r_negx = r * exp(-(phi - M_PI) / tan90MinusPitch);
+     318           0 :                 if (r_negx > rArms[7])
+     319           0 :                         r_negx = r * exp(-(phi + M_PI) / tan90MinusPitch);
+     320           0 :                 if (r_negx > rArms[7])
+     321           0 :                         r_negx = r * exp(-(phi + 3 * M_PI) / tan90MinusPitch);
+     322             : 
+     323           0 :                 for (int i = 7; i >= 0; i--)
+     324           0 :                         if (r_negx < rArms[i])
+     325           0 :                                 bDisk = bDiskTurb[i];
+     326             : 
+     327           0 :                 bDisk *= (5 * kpc) / r;
+     328             :         }
+     329           0 :         bDisk *= exp(-0.5 * pow(pos.z / zDiskTurb, 2));
+     330             : 
+     331             :         // halo
+     332           0 :         double bHalo = bHaloTurb * exp(-r / rHaloTurb)
+     333           0 :                         * exp(-0.5 * pow(pos.z / zHaloTurb, 2));
+     334             : 
+     335             :         // modulate turbulent field
+     336           0 :         return sqrt(pow(bDisk, 2) + pow(bHalo, 2));
+     337             : }
+     338             : 
+     339           0 : Vector3d JF12Field::getTurbulentField(const Vector3d& pos) const {
+     340           0 :         return (turbulentGrid->interpolate(pos) * getTurbulentStrength(pos));
+     341             : }
+     342             : 
+     343           0 : Vector3d JF12Field::getField(const Vector3d& pos) const {
+     344             :         Vector3d b(0.);
+     345           0 :         if (useTurbulentField)
+     346           0 :                 b += getTurbulentField(pos);
+     347           0 :         if (useStriatedField)
+     348           0 :                 b += getStriatedField(pos);
+     349           0 :         else if (useRegularField)
+     350           0 :                 b += getRegularField(pos);
+     351           0 :         return b;
+     352             : }
+     353             : 
+     354             : 
+     355             : 
+     356           0 : PlanckJF12bField::PlanckJF12bField() : JF12Field::JF12Field(){
+     357             :         // regular field parameters
+     358           0 :         bDisk[5] = -3.5 * muG;
+     359           0 :         bX = 1.8 * muG;
+     360             : 
+     361             :         // turbulent field parameters;
+     362           0 :         bDiskTurb[0] = 3.12 * muG;
+     363           0 :         bDiskTurb[1] = 6.24 * muG;
+     364           0 :         bDiskTurb[2] = 3.12 * muG;
+     365           0 :         bDiskTurb[3] = 6.24 * muG;
+     366           0 :         bDiskTurb[4] = 3.12 * muG;
+     367           0 :         bDiskTurb[5] = 6.24 * muG;
+     368           0 :         bDiskTurb[6] = 3.12 * muG;
+     369           0 :         bDiskTurb[7] = 6.24 * muG;
+     370             : 
+     371           0 :         bDiskTurb5 = 3.90 * muG;
+     372             : 
+     373           0 :         bHaloTurb = 7.332 * muG;
+     374           0 : }
+     375             : 
+     376             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/JF12FieldSolenoidal.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/JF12FieldSolenoidal.cpp.func-sort-c.html new file mode 100644 index 000000000..5057574e8 --- /dev/null +++ b/doc/coverageReport/src/magneticField/JF12FieldSolenoidal.cpp.func-sort-c.html @@ -0,0 +1,128 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/JF12FieldSolenoidal.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - JF12FieldSolenoidal.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:01420.0 %
Date:2024-04-08 14:58:22Functions:0140.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa19JF12FieldSolenoidal15setXScaleHeightEd0
_ZN7crpropa19JF12FieldSolenoidal19setUseStriatedFieldEb0
_ZN7crpropa19JF12FieldSolenoidal20setUseTurbulentFieldEb0
_ZN7crpropa19JF12FieldSolenoidal22setDiskTransitionWidthEd0
_ZN7crpropa19JF12FieldSolenoidal25deactivateOuterTransitionEv0
_ZN7crpropa19JF12FieldSolenoidalC2Edd0
_ZNK7crpropa19JF12FieldSolenoidal12getDiskFieldERKdS2_S2_S2_S2_0
_ZNK7crpropa19JF12FieldSolenoidal15getHPhiIntegralERKdS2_0
_ZNK7crpropa19JF12FieldSolenoidal15getXScaleHeightEv0
_ZNK7crpropa19JF12FieldSolenoidal22getDiskTransitionWidthEv0
_ZNK7crpropa19JF12FieldSolenoidal27getDiskTransitionPolynomialERKd0
_ZNK7crpropa19JF12FieldSolenoidal30getSpiralFieldStrengthConstantERKdS2_0
_ZNK7crpropa19JF12FieldSolenoidal37getDiskTransitionPolynomialDerivativeERKd0
_ZNK7crpropa19JF12FieldSolenoidal9getXFieldERKdS2_S2_S2_0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/JF12FieldSolenoidal.cpp.func.html b/doc/coverageReport/src/magneticField/JF12FieldSolenoidal.cpp.func.html new file mode 100644 index 000000000..539e7551e --- /dev/null +++ b/doc/coverageReport/src/magneticField/JF12FieldSolenoidal.cpp.func.html @@ -0,0 +1,128 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/JF12FieldSolenoidal.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - JF12FieldSolenoidal.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:01420.0 %
Date:2024-04-08 14:58:22Functions:0140.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa19JF12FieldSolenoidal15setXScaleHeightEd0
_ZN7crpropa19JF12FieldSolenoidal19setUseStriatedFieldEb0
_ZN7crpropa19JF12FieldSolenoidal20setUseTurbulentFieldEb0
_ZN7crpropa19JF12FieldSolenoidal22setDiskTransitionWidthEd0
_ZN7crpropa19JF12FieldSolenoidal25deactivateOuterTransitionEv0
_ZN7crpropa19JF12FieldSolenoidalC2Edd0
_ZNK7crpropa19JF12FieldSolenoidal12getDiskFieldERKdS2_S2_S2_S2_0
_ZNK7crpropa19JF12FieldSolenoidal15getHPhiIntegralERKdS2_0
_ZNK7crpropa19JF12FieldSolenoidal15getXScaleHeightEv0
_ZNK7crpropa19JF12FieldSolenoidal22getDiskTransitionWidthEv0
_ZNK7crpropa19JF12FieldSolenoidal27getDiskTransitionPolynomialERKd0
_ZNK7crpropa19JF12FieldSolenoidal30getSpiralFieldStrengthConstantERKdS2_0
_ZNK7crpropa19JF12FieldSolenoidal37getDiskTransitionPolynomialDerivativeERKd0
_ZNK7crpropa19JF12FieldSolenoidal9getXFieldERKdS2_S2_S2_0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/JF12FieldSolenoidal.cpp.gcov.html b/doc/coverageReport/src/magneticField/JF12FieldSolenoidal.cpp.gcov.html new file mode 100644 index 000000000..ae5d894a4 --- /dev/null +++ b/doc/coverageReport/src/magneticField/JF12FieldSolenoidal.cpp.gcov.html @@ -0,0 +1,378 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/JF12FieldSolenoidal.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - JF12FieldSolenoidal.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:01420.0 %
Date:2024-04-08 14:58:22Functions:0140.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/magneticField/JF12FieldSolenoidal.h"
+       2             : #include "crpropa/Units.h"
+       3             : #include "crpropa/GridTools.h"
+       4             : #include "crpropa/Random.h"
+       5             : 
+       6             : namespace crpropa {
+       7             : 
+       8           0 : JF12FieldSolenoidal::JF12FieldSolenoidal(double delta, double zs) {
+       9           0 :         zS = zs; // set scale heigth for the parabolic X field lines
+      10           0 :         r1 = 5 * kpc; // inner boundary of the disk field
+      11           0 :         r2 = 20 * kpc; // outer boudary of the disk field
+      12           0 :         r1s = r1 + delta; // the magnetic flux of the spirals is redirected for r in [r1,r1s]
+      13           0 :         r2s = r2 - delta; // same here at outer boundary between r2s and r2
+      14           0 :         phi0 = 0.; // somewhat arbitrary choice, has to be chosen in [-pi,pi]
+      15             : 
+      16           0 :         for (int i = 1;i < 9; i++){
+      17             :                 // fill the array with angles in [-pi,pi] where the 8 spiral arms intersect the r1 - ring
+      18             :                 // indexing starts at 1 to match the indexing in the papers on the JF12 field!
+      19           0 :                 phi0Arms[i] = M_PI - cotPitch * log(rArms[i-1] / r1);
+      20             :         }
+      21             : 
+      22             :         // cyclic closure of the array, with next values periodically continued
+      23             :         // outside [-pi,pi] to simplify looping and searching for correct spiral arms
+      24           0 :         phi0Arms[0] = phi0Arms[8] + 2 * M_PI;
+      25           0 :         phi0Arms[9] = phi0Arms[1] - 2 * M_PI;
+      26           0 :         phi0Arms[10] = phi0Arms[2] - 2 *M_PI;
+      27             : 
+      28             :         // determine the position of phi0 in the array, i.e. find the correct spiral arm.
+      29             :         int idx0 = 1; // corresponding index in phi0Arms such that phi0Arms[idx0] < phi0 < phi0Arms[idx0-1]
+      30           0 :         while (phi0 < phi0Arms[idx0]){
+      31           0 :                 idx0 += 1; // search clockwise, starting with the check if phi0Arms[1] < phi0 < phi0Arms[0]
+      32             :         }
+      33             : 
+      34             :         // fill the bDisk array with spiral field strengths at r = r1.
+      35             :         // note the indexing starting with 1 here to match the indexing in the JF12 papers!
+      36             :         // for a position (r1,phi), phi in [-pi,pi], the correct field strength is given by
+      37             :         // bDisk[i] if phi0Arms[i] < phi0 < phi0Arms[i-1].
+      38           0 :         bDisk[1] = 0.1 * muG;
+      39           0 :         bDisk[2] = 3.0 * muG;
+      40           0 :         bDisk[3] = -0.9 * muG;
+      41           0 :         bDisk[4] = -0.8 * muG;
+      42           0 :         bDisk[5] = -2.0 * muG;
+      43           0 :         bDisk[6] = -4.2 * muG;
+      44           0 :         bDisk[7] = 0.0 * muG;
+      45             : 
+      46             :         // re-compute b_8 for actual (net flux = 0)-correction of the spiral field with minimal round-off errors
+      47             :         double flux1to7 = 0.;
+      48           0 :         for (int i = 1; i < 8; i++){
+      49           0 :                 flux1to7 += (phi0Arms[i-1] - phi0Arms[i]) * bDisk[i];
+      50             :         }
+      51           0 :         bDisk[8] = -flux1to7 / (phi0Arms[7] - phi0Arms[8]);
+      52             : 
+      53           0 :         bDisk[0] = bDisk[8]; // again close the array periodically
+      54           0 :         bDisk[9] = bDisk[1];
+      55           0 :         bDisk[10] = bDisk[2];
+      56             : 
+      57             :         // set coefficients for the evaluation of the phi-integral over the piecewise constant field strengths at r=r1
+      58             :         // such that it may be evaluated as H(phi) = phiCoeff[j] + bDisk[j] * phi later on
+      59             :         // start integration at phi0Arms[0] first, shift to lower integration boundary phi0 later
+      60           0 :         phiCoeff[0] = 0;
+      61           0 :         for (int i = 1; i < 10; i++){
+      62           0 :                 phiCoeff[i] = phiCoeff[i-1] + (bDisk[i-1] - bDisk[i]) * phi0Arms[i-1];
+      63             :         }
+      64             : 
+      65             :         // correct for H(phi0) = 0
+      66           0 :         corr = phiCoeff[idx0] + bDisk[idx0] * phi0;
+      67           0 :         for (int i = 1; i < 10; i++){
+      68           0 :                 phiCoeff[i] = phiCoeff[i] - corr;
+      69             :         }
+      70           0 : }
+      71             : 
+      72           0 : void JF12FieldSolenoidal::setDiskTransitionWidth(double delta) {
+      73           0 :         r1s = r1 + delta;
+      74           0 :         r2s = r2 - delta;
+      75           0 : }
+      76             : 
+      77           0 : void JF12FieldSolenoidal::setXScaleHeight(double zs) {
+      78           0 :         zS = zs;
+      79           0 : }
+      80             : 
+      81           0 : double JF12FieldSolenoidal::getDiskTransitionWidth() const {
+      82           0 :         return (r1s - r1);
+      83             : }
+      84             : 
+      85           0 : double JF12FieldSolenoidal::getXScaleHeight() const {
+      86           0 :         return zS;
+      87             : }
+      88             : 
+      89           0 : void JF12FieldSolenoidal::deactivateOuterTransition() {
+      90           0 :         r2s = r2;
+      91           0 : }
+      92             : 
+      93           0 : void JF12FieldSolenoidal::setUseStriatedField(bool use) {
+      94           0 :         if ((use) and (striatedGrid)) {
+      95           0 :                 KISS_LOG_WARNING << "JF12FieldSolenoidal: No striated field set: ignored.";
+      96           0 :                 return;
+      97             :         }
+      98           0 :         useStriatedField = use;
+      99             : }
+     100             : 
+     101           0 : void JF12FieldSolenoidal::setUseTurbulentField(bool use) {
+     102           0 :         if ((use) and (turbulentGrid)) {
+     103           0 :                 KISS_LOG_WARNING << "JF12FieldSolenoidal: No turbulent field set: ignored.";
+     104           0 :                 return;
+     105             :         }
+     106           0 :         useTurbulentField = use;
+     107             : }
+     108             : 
+     109           0 : Vector3d JF12FieldSolenoidal::getDiskField(const double& r, const double& z, const double& phi, const double& sinPhi, const double& cosPhi) const {
+     110             :         Vector3d b(0.);
+     111             : 
+     112           0 :         if (useDiskField){
+     113           0 :                 double lfDisk = logisticFunction(z, hDisk, wDisk); // for vertical scaling as in initial JF12
+     114             : 
+     115           0 :                 double hint = getHPhiIntegral(r, phi); // phi integral to restore solenoidality in transition region, only enters if r is in [r1,r1s] or [r2s,r2]
+     116           0 :                 double mag1 = getSpiralFieldStrengthConstant(r, phi); // returns bDisk[j] for the current spiral arm
+     117             : 
+     118           0 :                 if ((r1 < r) && (r < r2)) {
+     119           0 :                         double pdelta = getDiskTransitionPolynomial(r);
+     120           0 :                         double qdelta = getDiskTransitionPolynomialDerivative(r);
+     121           0 :                         double br = pdelta * mag1 * sinPitch;
+     122           0 :                         double bphi = pdelta * mag1 * cosPitch - qdelta * hint * sinPitch;
+     123             : 
+     124           0 :                         b.x += br * cosPhi - bphi * sinPhi;
+     125           0 :                         b.y += br * sinPhi + bphi * cosPhi;
+     126             : 
+     127           0 :                         b *= (1 - lfDisk);
+     128             :                 }
+     129             :         }
+     130           0 :         return b;
+     131             : }
+     132             : 
+     133           0 : Vector3d JF12FieldSolenoidal::getXField(const double& r, const double& z, const double& sinPhi, const double& cosPhi) const {
+     134             :         Vector3d b(0.);
+     135             : 
+     136           0 :         if (useXField){
+     137             :                 double bMagX;
+     138             :                 double sinThetaX, cosThetaX;
+     139             :                 double rp; // radius where current intial field line passes z = 0
+     140           0 :                 double rc = rXc + fabs(z) / tanThetaX0;
+     141           0 :                 double r0c = rXc + zS / tanThetaX0; // radius where field line through rXc passes z = zS
+     142             :                 double f, r0, br0, bz0;
+     143             :                 bool inner = true; // distinguish between inner and outer region
+     144             : 
+     145             :                 // return intial field if z>=zS
+     146           0 :                 if (fabs(z) > zS){
+     147           0 :                         if ((r == 0.)){
+     148           0 :                                 b.z = bX / ((1. + fabs(z) * cotThetaX0 / rXc) * (1. + fabs(z) * cotThetaX0 / rXc));
+     149           0 :                                 return b;
+     150             :                         }
+     151             : 
+     152           0 :                         if (r < rc) {
+     153             :                         // inner varying elevation region
+     154           0 :                                 rp = r * rXc / rc;
+     155           0 :                                 bMagX = bX * exp(-1 * rp / rX) * (rXc / rc) * (rXc / rc);
+     156             : 
+     157           0 :                                 double thetaX = atan(fabs(z) / (r - rp));
+     158             : 
+     159           0 :                                 if (z == 0)
+     160             :                                         thetaX = M_PI / 2.;
+     161             : 
+     162           0 :                                 sinThetaX = sin(thetaX);
+     163           0 :                                 cosThetaX = cos(thetaX);
+     164             :                         }
+     165             :                         else {
+     166             :                         // outer constant elevation region
+     167           0 :                                 rp = r - fabs(z) / tanThetaX0;
+     168           0 :                                 bMagX = bX * exp(-rp / rX) * (rp / r);
+     169             : 
+     170           0 :                                 sinThetaX = sinThetaX0;
+     171           0 :                                 cosThetaX = cosThetaX0;
+     172             :                         }
+     173           0 :                         double zsign = z < 0 ? -1 : 1;
+     174           0 :                         b.x += zsign * bMagX * cosThetaX * cosPhi;
+     175           0 :                         b.y += zsign * bMagX * cosThetaX * sinPhi;
+     176           0 :                         b.z += bMagX * sinThetaX;
+     177             :                 }
+     178             :                 // parabolic field lines for z<zS
+     179             :                 else {
+     180             :                                 // determine r at which parabolic field line through (r,z) passes z = zS
+     181           0 :                                 r0 = r * 1. / (1.- 1./ (2. * (zS + rXc * tanThetaX0)) * (zS - z * z / zS));
+     182             : 
+     183             :                                 // determine correct region (inner/outer)
+     184             :                                 // and compute factor F for solenoidality
+     185           0 :                                 if (r0 >= r0c){
+     186           0 :                                         r0 = r + 1. / (2. * tanThetaX0) * (zS - z * z / zS);
+     187           0 :                                         f = 1. + 1/ (2 * r * tanThetaX0/ zS) * (1. - (z / zS) * (z / zS));
+     188             :                                 }
+     189             :                                 else
+     190             :                                 {
+     191           0 :                                          f = 1. / ((1. - 1./( 2. + 2. * (rXc * tanThetaX0/ zS)) * (1. - (z / zS) * (z / zS))) * (1. - 1./( 2. + 2. * (rXc * tanThetaX0/ zS)) * (1. - (z / zS) * (z / zS))));
+     192             :                                 }
+     193             : 
+     194             :                                 // field strength at that position
+     195           0 :                                 if (r0 < r0c){
+     196           0 :                                          rp = r0 * rXc / r0c;
+     197           0 :                                          double thetaX = atan(zS / (r0 - rp));
+     198             : 
+     199             :                                          // field strength at (r0,zS) for inner region
+     200           0 :                                          br0 = bX * exp(- rp / rX) * (rXc/ r0c) * (rXc/ r0c) * cos(thetaX);
+     201           0 :                                          bz0 = bX * exp(- rp / rX) * (rXc/ r0c) * (rXc/ r0c) * sin(thetaX);
+     202             :                                  }
+     203             :                                  else {
+     204             :                                          // field strength at (r0,zS) for outer region
+     205           0 :                                          rp = r0 - zS / tanThetaX0;
+     206           0 :                                          br0 =  bX * exp(- rp / rX) * (rp/r0) * cosThetaX0;
+     207           0 :                                          bz0 =  bX * exp(- rp / rX) * (rp/r0) * sinThetaX0;
+     208             :                                  }
+     209             : 
+     210           0 :                                  double br = z / zS * f * br0;
+     211           0 :                                  double bz = bz0 * f;
+     212             : 
+     213           0 :                                  b.x += br * cosPhi;
+     214           0 :                                  b.y += br * sinPhi;
+     215           0 :                                  b.z += bz;
+     216             :                 }
+     217             :         }
+     218             :         return b;
+     219             : }
+     220             : 
+     221           0 : double JF12FieldSolenoidal::getDiskTransitionPolynomial(const double& r) const {
+     222             :         // 0 disk field outside
+     223           0 :         if ((r < r1) || (r > r2)) {
+     224             :                 return 0.;
+     225             :         }
+     226             :         // unchanged field
+     227           0 :         if ((r > r1s) && (r < r2s)) {
+     228           0 :                 return r1/r;
+     229             :         }
+     230             :         // transitions region parameters
+     231             :         double r_a = r1;
+     232             :         double r_b = r1s;
+     233             : 
+     234           0 :         if (r >= r2s) {
+     235             :                 r_a = r2;
+     236             :                 r_b = r2s;
+     237             :         }
+     238             :         // differentiable transition at r_s, continous at r_a
+     239           0 :         double fakt = (r_a / r_b - 2.) / ((r_a - r_b) *  (r_a - r_b));
+     240           0 :         return (r1/r_b) * (2. - r / r_b + fakt * (r-r_b) * (r-r_b));
+     241             : }
+     242             : 
+     243           0 : double JF12FieldSolenoidal::getDiskTransitionPolynomialDerivative(const double& r) const {
+     244             :         // 0 disk field outside
+     245           0 :         if ((r < r1) || (r > r2)) {
+     246             :                 return 0.;
+     247             :         }
+     248             :         // unchanged field
+     249           0 :         if ((r > r1s) && (r < r2s)) {
+     250             :                 return 0.;
+     251             :         }
+     252             :         // transitions region parameters
+     253             :         double r_a = r1;
+     254             :         double r_b = r1s;
+     255             : 
+     256           0 :         if (r >= r2s) {
+     257             :                 r_a = r2;
+     258             :                 r_b = r2s;
+     259             :         }
+     260             :         // differentiable transition polynomial at r_s, continous at r_a
+     261           0 :         double fakt = (r_a / r_b - 2.) / ((r_a - r_b) * (r_a - r_b));
+     262           0 :         return (r1/r_b) * (2. - 2. * r/r_b + fakt * (3. * r * r - 4. * r * r_b + r_b * r_b));
+     263             : }
+     264             : 
+     265           0 : double JF12FieldSolenoidal::getHPhiIntegral(const double& r, const double& phi) const {
+     266             :         // Evaluates the H(phi1) integral for solenoidality for the position (r,phi) which is mapped back to (r1=5kpc,phi1)
+     267             :         // along the spiral field line.
+     268             :         double H_ret = 0.;
+     269             : 
+     270           0 :         if ((r1 < r) && (r < r2)){
+     271             :                 // find index of the correct spiral arm for (r1,phi1) just like in getSpiralFieldStrengthConstant
+     272             :                 int idx = 1;
+     273           0 :                 double phi1 = phi - log(r/r1) * cotPitch;
+     274           0 :                 phi1 = atan2(sin(phi1), cos(phi1));
+     275           0 :                 while (phi1 < phi0Arms[idx]){
+     276           0 :                         idx += 1;
+     277             :                 }
+     278           0 :                 H_ret = phi1 * bDisk[idx] + phiCoeff[idx];
+     279             :         }
+     280           0 :         return H_ret;
+     281             : }
+     282             : 
+     283           0 : double JF12FieldSolenoidal::getSpiralFieldStrengthConstant(const double& r, const double& phi) const {
+     284             :         // For a given position (r, phi) in polar coordinates, this method returns the field strength
+     285             :         // of the spiral field at r1 = 5 kpc for the magnetic spiral arm where (r, phi) is located.
+     286             :         // The method first computes the angle phi1 at which the spiral field line passing through (r, phi) intersects
+     287             :         // the circle with radius r1 = 5 kpc. Afterwards, the correct spiral arm is found by searching the index idx
+     288             :         // such that phi0Arms[idx] < phi1 < phi0Arms[idx-1]. The correct field strength of the respective spiral arm
+     289             :         // where (r, phi) is located is then given as bDisk[idx].
+     290             :         double b_ret = 0.;
+     291             :         int idx = 1;
+     292           0 :         if ((r1 < r) && (r < r2)){
+     293           0 :                 double phi1 = phi - log(r/r1) * cotPitch; // map the position (r, phi) to (5 kpc, phi1) along the logarithmic spiral field line
+     294           0 :                 phi1 = atan2(sin(phi1), cos(phi1)); // map this angle to [-pi,+pi]
+     295           0 :                 while (phi1 < phi0Arms[idx]){
+     296           0 :                         idx += 1; // run clockwise through the spiral arms; the cyclic closure of phi0Arms[9] = phi0Arms[1] - 2 pi is needed if -pi <= phi1 <= phi0Arms[8].
+     297             :                 }
+     298           0 :                 b_ret = bDisk[idx];
+     299             :         }
+     300           0 :         return b_ret;
+     301             : }
+     302             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/MagneticField.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/MagneticField.cpp.func-sort-c.html new file mode 100644 index 000000000..b8384f639 --- /dev/null +++ b/doc/coverageReport/src/magneticField/MagneticField.cpp.func-sort-c.html @@ -0,0 +1,136 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/MagneticField.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - MagneticField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:486672.7 %
Date:2024-04-08 14:58:22Functions:91656.2 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa21PeriodicMagneticField10getExtendsEv0
_ZN7crpropa21PeriodicMagneticField10setExtendsERKNS_7Vector3IdEE0
_ZN7crpropa21PeriodicMagneticField12isReflectiveEv0
_ZN7crpropa21PeriodicMagneticField13setReflectiveEb0
_ZN7crpropa21PeriodicMagneticField9getOriginEv0
_ZN7crpropa21PeriodicMagneticField9setOriginERKNS_7Vector3IdEE0
_ZN7crpropa21PeriodicMagneticFieldC2ENS_7ref_ptrINS_13MagneticFieldEEERKNS_7Vector3IdEE0
_ZN7crpropa21PeriodicMagneticFieldC2ENS_7ref_ptrINS_13MagneticFieldEEERKNS_7Vector3IdEES7_b1
_ZN7crpropa22MagneticFieldEvolutionC2ENS_7ref_ptrINS_13MagneticFieldEEEd1
_ZN7crpropa24RenormalizeMagneticField8getFieldERKNS_7Vector3IdEE1
_ZN7crpropa24RenormalizeMagneticFieldC2ENS_7ref_ptrINS_13MagneticFieldEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZNK7crpropa17MagneticFieldList8getFieldERKNS_7Vector3IdEE1
_ZNK7crpropa19MagneticDipoleField8getFieldERKNS_7Vector3IdEE2
_ZNK7crpropa22MagneticFieldEvolution8getFieldERKNS_7Vector3IdEEd2
_ZN7crpropa17MagneticFieldList8addFieldENS_7ref_ptrINS_13MagneticFieldEEE3
_ZNK7crpropa21PeriodicMagneticField8getFieldERKNS_7Vector3IdEE3
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/MagneticField.cpp.func.html b/doc/coverageReport/src/magneticField/MagneticField.cpp.func.html new file mode 100644 index 000000000..2a5f1bfd3 --- /dev/null +++ b/doc/coverageReport/src/magneticField/MagneticField.cpp.func.html @@ -0,0 +1,136 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/MagneticField.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - MagneticField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:486672.7 %
Date:2024-04-08 14:58:22Functions:91656.2 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa17MagneticFieldList8addFieldENS_7ref_ptrINS_13MagneticFieldEEE3
_ZN7crpropa21PeriodicMagneticField10getExtendsEv0
_ZN7crpropa21PeriodicMagneticField10setExtendsERKNS_7Vector3IdEE0
_ZN7crpropa21PeriodicMagneticField12isReflectiveEv0
_ZN7crpropa21PeriodicMagneticField13setReflectiveEb0
_ZN7crpropa21PeriodicMagneticField9getOriginEv0
_ZN7crpropa21PeriodicMagneticField9setOriginERKNS_7Vector3IdEE0
_ZN7crpropa21PeriodicMagneticFieldC2ENS_7ref_ptrINS_13MagneticFieldEEERKNS_7Vector3IdEE0
_ZN7crpropa21PeriodicMagneticFieldC2ENS_7ref_ptrINS_13MagneticFieldEEERKNS_7Vector3IdEES7_b1
_ZN7crpropa22MagneticFieldEvolutionC2ENS_7ref_ptrINS_13MagneticFieldEEEd1
_ZN7crpropa24RenormalizeMagneticField8getFieldERKNS_7Vector3IdEE1
_ZN7crpropa24RenormalizeMagneticFieldC2ENS_7ref_ptrINS_13MagneticFieldEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZNK7crpropa17MagneticFieldList8getFieldERKNS_7Vector3IdEE1
_ZNK7crpropa19MagneticDipoleField8getFieldERKNS_7Vector3IdEE2
_ZNK7crpropa21PeriodicMagneticField8getFieldERKNS_7Vector3IdEE3
_ZNK7crpropa22MagneticFieldEvolution8getFieldERKNS_7Vector3IdEEd2
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/MagneticField.cpp.gcov.html b/doc/coverageReport/src/magneticField/MagneticField.cpp.gcov.html new file mode 100644 index 000000000..086759e57 --- /dev/null +++ b/doc/coverageReport/src/magneticField/MagneticField.cpp.gcov.html @@ -0,0 +1,188 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/MagneticField.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - MagneticField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:486672.7 %
Date:2024-04-08 14:58:22Functions:91656.2 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/magneticField/MagneticField.h"
+       2             : 
+       3             : namespace crpropa {
+       4             : 
+       5           0 : PeriodicMagneticField::PeriodicMagneticField(ref_ptr<MagneticField> field,
+       6           0 :                 const Vector3d &extends) :
+       7           0 :                 field(field), extends(extends), origin(0, 0, 0), reflective(false) {
+       8             : 
+       9           0 : }
+      10             : 
+      11           1 : PeriodicMagneticField::PeriodicMagneticField(ref_ptr<MagneticField> field,
+      12           1 :                 const Vector3d &extends, const Vector3d &origin, bool reflective) :
+      13           1 :                 field(field), extends(extends), origin(origin), reflective(reflective) {
+      14             : 
+      15           1 : }
+      16             : 
+      17           0 : Vector3d &PeriodicMagneticField::getOrigin() {
+      18           0 :         return origin;
+      19             : }
+      20             : 
+      21           0 : void PeriodicMagneticField::setOrigin(const Vector3d &origin) {
+      22             :         this->origin = origin;
+      23           0 : }
+      24             : 
+      25           0 : Vector3d &PeriodicMagneticField::getExtends() {
+      26           0 :         return extends;
+      27             : }
+      28             : 
+      29           0 : void PeriodicMagneticField::setExtends(const Vector3d &origin) {
+      30             :         this->extends = extends;
+      31           0 : }
+      32             : 
+      33           0 : bool PeriodicMagneticField::isReflective() {
+      34           0 :         return reflective;
+      35             : }
+      36             : 
+      37           0 : void PeriodicMagneticField::setReflective(bool reflective) {
+      38           0 :         this->reflective = reflective;
+      39           0 : }
+      40             : 
+      41           3 : Vector3d PeriodicMagneticField::getField(const Vector3d &position) const {
+      42           3 :         Vector3d n = ((position - origin) / extends).floor();
+      43             :         Vector3d p = position - origin - n * extends;
+      44             : 
+      45           3 :         if (reflective) {
+      46           3 :                 long mx = (long) ::fabs(n.x) % 2;
+      47           3 :                 if (mx == 1)
+      48           2 :                         p.x = extends.x - p.x;
+      49           3 :                 long my = (long) ::fabs(n.y) % 2;
+      50           3 :                 if (my == 1)
+      51           0 :                         p.y = extends.y - p.y;
+      52           3 :                 long mz = (long) ::fabs(n.z) % 2;
+      53           3 :                 if (mz == 1)
+      54           2 :                         p.z = extends.z - p.z;
+      55             :         }
+      56             : 
+      57           3 :         return field->getField(p);
+      58             : }
+      59             : 
+      60           3 : void MagneticFieldList::addField(ref_ptr<MagneticField> field) {
+      61           3 :         fields.push_back(field);
+      62           3 : }
+      63             : 
+      64           1 : Vector3d MagneticFieldList::getField(const Vector3d &position) const {
+      65             :         Vector3d b;
+      66           4 :         for (int i = 0; i < fields.size(); i++)
+      67           3 :                 b += fields[i]->getField(position);
+      68           1 :         return b;
+      69             : }
+      70             : 
+      71           1 : MagneticFieldEvolution::MagneticFieldEvolution(ref_ptr<MagneticField> field,
+      72           1 :         double m) :
+      73           1 :         field(field), m(m) {
+      74           1 : }
+      75             : 
+      76           2 : Vector3d MagneticFieldEvolution::getField(const Vector3d &position,
+      77             :         double z) const {
+      78           2 :         return field->getField(position) * pow(1+z, m);
+      79             : }
+      80             : 
+      81           2 : Vector3d MagneticDipoleField::getField(const Vector3d &position) const {
+      82             :                 Vector3d r = (position - origin);
+      83           2 :                 Vector3d unit_r = r.getUnitVector();
+      84             :                 
+      85           2 :                 if (r.getR() == 0) { // singularity
+      86             :                         return moment * 2 * mu0 / 3;
+      87             :                 }
+      88           2 :                 return (unit_r * (unit_r.dot(moment)) * 3 - moment) / pow(r.getR() / radius, 3) * mu0 / (4*M_PI);
+      89             : }
+      90             : 
+      91             : #ifdef CRPROPA_HAVE_MUPARSER
+      92           1 : RenormalizeMagneticField::RenormalizeMagneticField(ref_ptr<MagneticField> field,
+      93           1 :                 std::string expression) :
+      94           2 :                 field(field), expression(expression) {
+      95             : 
+      96           1 :         p =  new mu::Parser();
+      97           1 :         p->DefineVar("B", &Bmag);
+      98           1 :         p->DefineConst("tesla", tesla);
+      99           1 :         p->DefineConst("gauss", gauss);
+     100           1 :         p->DefineConst("muG", muG);
+     101           1 :         p->DefineConst("nG", nG);
+     102           1 :         p->SetExpr(expression);
+     103           1 : }
+     104             : 
+     105           1 : Vector3d RenormalizeMagneticField::getField(const Vector3d &position) {
+     106           1 :         Vector3d B = field->getField(position);
+     107           1 :         Bmag = B.getR();
+     108           1 :         return B * p->Eval();
+     109             : }
+     110             : #endif
+     111             : 
+     112             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/MagneticFieldGrid.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/MagneticFieldGrid.cpp.func-sort-c.html new file mode 100644 index 000000000..6c98862d1 --- /dev/null +++ b/doc/coverageReport/src/magneticField/MagneticFieldGrid.cpp.func-sort-c.html @@ -0,0 +1,116 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/MagneticFieldGrid.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - MagneticFieldGrid.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0310.0 %
Date:2024-04-08 14:58:22Functions:0110.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa17MagneticFieldGrid7getGridEv0
_ZN7crpropa17MagneticFieldGrid7setGridENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa17MagneticFieldGridC2ENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa26ModulatedMagneticFieldGrid13setReflectiveEbb0
_ZN7crpropa26ModulatedMagneticFieldGrid17getModulationGridEv0
_ZN7crpropa26ModulatedMagneticFieldGrid17setModulationGridENS_7ref_ptrINS_4GridIfEEEE0
_ZN7crpropa26ModulatedMagneticFieldGrid7getGridEv0
_ZN7crpropa26ModulatedMagneticFieldGrid7setGridENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa26ModulatedMagneticFieldGridC2ENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEENS1_INS2_IfEEEE0
_ZNK7crpropa17MagneticFieldGrid8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa26ModulatedMagneticFieldGrid8getFieldERKNS_7Vector3IdEE0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/MagneticFieldGrid.cpp.func.html b/doc/coverageReport/src/magneticField/MagneticFieldGrid.cpp.func.html new file mode 100644 index 000000000..10a3651e7 --- /dev/null +++ b/doc/coverageReport/src/magneticField/MagneticFieldGrid.cpp.func.html @@ -0,0 +1,116 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/MagneticFieldGrid.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - MagneticFieldGrid.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0310.0 %
Date:2024-04-08 14:58:22Functions:0110.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa17MagneticFieldGrid7getGridEv0
_ZN7crpropa17MagneticFieldGrid7setGridENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa17MagneticFieldGridC2ENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa26ModulatedMagneticFieldGrid13setReflectiveEbb0
_ZN7crpropa26ModulatedMagneticFieldGrid17getModulationGridEv0
_ZN7crpropa26ModulatedMagneticFieldGrid17setModulationGridENS_7ref_ptrINS_4GridIfEEEE0
_ZN7crpropa26ModulatedMagneticFieldGrid7getGridEv0
_ZN7crpropa26ModulatedMagneticFieldGrid7setGridENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa26ModulatedMagneticFieldGridC2ENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEENS1_INS2_IfEEEE0
_ZNK7crpropa17MagneticFieldGrid8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa26ModulatedMagneticFieldGrid8getFieldERKNS_7Vector3IdEE0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/MagneticFieldGrid.cpp.gcov.html b/doc/coverageReport/src/magneticField/MagneticFieldGrid.cpp.gcov.html new file mode 100644 index 000000000..9a3f969fb --- /dev/null +++ b/doc/coverageReport/src/magneticField/MagneticFieldGrid.cpp.gcov.html @@ -0,0 +1,133 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/MagneticFieldGrid.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - MagneticFieldGrid.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0310.0 %
Date:2024-04-08 14:58:22Functions:0110.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/magneticField/MagneticFieldGrid.h"
+       2             : 
+       3             : namespace crpropa {
+       4             : 
+       5           0 : MagneticFieldGrid::MagneticFieldGrid(ref_ptr<Grid3f> grid) {
+       6           0 :         setGrid(grid);
+       7           0 : }
+       8             : 
+       9           0 : void MagneticFieldGrid::setGrid(ref_ptr<Grid3f> grid) {
+      10           0 :         this->grid = grid;
+      11           0 : }
+      12             : 
+      13           0 : ref_ptr<Grid3f> MagneticFieldGrid::getGrid() {
+      14           0 :         return grid;
+      15             : }
+      16             : 
+      17           0 : Vector3d MagneticFieldGrid::getField(const Vector3d &pos) const {
+      18           0 :         return grid->interpolate(pos);
+      19             : }
+      20             : 
+      21           0 : ModulatedMagneticFieldGrid::ModulatedMagneticFieldGrid(ref_ptr<Grid3f> grid,
+      22           0 :                 ref_ptr<Grid1f> modGrid) {
+      23             :         grid->setReflective(false);
+      24             :         modGrid->setReflective(true);
+      25           0 :         setGrid(grid);
+      26           0 :         setModulationGrid(modGrid);
+      27           0 : }
+      28             : 
+      29           0 : void ModulatedMagneticFieldGrid::setGrid(ref_ptr<Grid3f> g) {
+      30           0 :         grid = g;
+      31           0 : }
+      32             : 
+      33           0 : ref_ptr<Grid3f> ModulatedMagneticFieldGrid::getGrid() {
+      34           0 :         return grid;
+      35             : }
+      36             : 
+      37           0 : void ModulatedMagneticFieldGrid::setModulationGrid(ref_ptr<Grid1f> g) {
+      38           0 :         modGrid = g;
+      39           0 : }
+      40             : 
+      41           0 : ref_ptr<Grid1f> ModulatedMagneticFieldGrid::getModulationGrid() {
+      42           0 :         return modGrid;
+      43             : }
+      44             : 
+      45           0 : void ModulatedMagneticFieldGrid::setReflective(bool gridReflective,
+      46             :                 bool modGridReflective) {
+      47             :         grid->setReflective(gridReflective);
+      48             :         modGrid->setReflective(modGridReflective);
+      49           0 : }
+      50             : 
+      51           0 : Vector3d ModulatedMagneticFieldGrid::getField(const Vector3d &pos) const {
+      52           0 :         float m = modGrid->interpolate(pos);
+      53           0 :         Vector3d b = grid->interpolate(pos);
+      54           0 :         return b * m;
+      55             : }
+      56             : 
+      57             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/PT11Field.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/PT11Field.cpp.func-sort-c.html new file mode 100644 index 000000000..1594ee831 --- /dev/null +++ b/doc/coverageReport/src/magneticField/PT11Field.cpp.func-sort-c.html @@ -0,0 +1,108 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/PT11Field.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - PT11Field.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0630.0 %
Date:2024-04-08 14:58:22Functions:090.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa9PT11Field10isUsingASSEv0
_ZN7crpropa9PT11Field10isUsingBSSEv0
_ZN7crpropa9PT11Field10setUseHaloEb0
_ZN7crpropa9PT11Field11isUsingHaloEv0
_ZN7crpropa9PT11Field9SetParamsEv0
_ZN7crpropa9PT11Field9setUseASSEb0
_ZN7crpropa9PT11Field9setUseBSSEb0
_ZN7crpropa9PT11FieldC2Ev0
_ZNK7crpropa9PT11Field8getFieldERKNS_7Vector3IdEE0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/PT11Field.cpp.func.html b/doc/coverageReport/src/magneticField/PT11Field.cpp.func.html new file mode 100644 index 000000000..62ece690d --- /dev/null +++ b/doc/coverageReport/src/magneticField/PT11Field.cpp.func.html @@ -0,0 +1,108 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/PT11Field.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - PT11Field.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0630.0 %
Date:2024-04-08 14:58:22Functions:090.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa9PT11Field10isUsingASSEv0
_ZN7crpropa9PT11Field10isUsingBSSEv0
_ZN7crpropa9PT11Field10setUseHaloEb0
_ZN7crpropa9PT11Field11isUsingHaloEv0
_ZN7crpropa9PT11Field9SetParamsEv0
_ZN7crpropa9PT11Field9setUseASSEb0
_ZN7crpropa9PT11Field9setUseBSSEb0
_ZN7crpropa9PT11FieldC2Ev0
_ZNK7crpropa9PT11Field8getFieldERKNS_7Vector3IdEE0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/PT11Field.cpp.gcov.html b/doc/coverageReport/src/magneticField/PT11Field.cpp.gcov.html new file mode 100644 index 000000000..36fdae7a3 --- /dev/null +++ b/doc/coverageReport/src/magneticField/PT11Field.cpp.gcov.html @@ -0,0 +1,206 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/PT11Field.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - PT11Field.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0630.0 %
Date:2024-04-08 14:58:22Functions:090.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/magneticField/PT11Field.h"
+       2             : #include "crpropa/Units.h"
+       3             : 
+       4             : #include <algorithm>
+       5             : 
+       6             : namespace crpropa {
+       7             : 
+       8           0 : PT11Field::PT11Field() : useASS(true), useBSS(false), useHalo(true) {
+       9             :         // disk parameters
+      10           0 :         d = - 0.6 * kpc;
+      11           0 :         R_sun = 8.5 * kpc;
+      12           0 :         R_c = 5.0 * kpc;
+      13           0 :         z0_D = 1.0 * kpc;
+      14           0 :         B0_D = 2.0 * muG;
+      15             : 
+      16             :         // halo parameters
+      17           0 :         z0_H = 1.3 * kpc;
+      18           0 :         R0_H = 8.0 * kpc;
+      19           0 :         B0_Hn = 4.0 * muG;
+      20           0 :         B0_Hs = 4.0 * muG;
+      21           0 :         z11_H = 0.25 * kpc;
+      22           0 :         z12_H = 0.4 * kpc;
+      23             : 
+      24             :         // set ASS specific parameters
+      25           0 :         setUseASS(true);
+      26           0 : }
+      27             : 
+      28           0 : void PT11Field::SetParams() {
+      29           0 :         cos_pitch = cos(pitch);
+      30           0 :         sin_pitch = sin(pitch);
+      31           0 :         PHI = cos_pitch / sin_pitch * log1p(d / R_sun) - M_PI / 2;
+      32           0 :         cos_PHI = cos(PHI);
+      33           0 : }
+      34             : 
+      35           0 : void PT11Field::setUseASS(bool use) {
+      36           0 :         useASS = use;
+      37           0 :         if (not(use))
+      38             :                 return;
+      39             : 
+      40           0 :         if (useBSS) {
+      41             :                 std::cout << "PT11Field: Disk field changed to ASS" << std::endl;
+      42           0 :                 useBSS = false;
+      43             :         }
+      44             : 
+      45           0 :         pitch = -5.0 * M_PI / 180;
+      46           0 :         B0_Hs = 2.0 * muG;
+      47           0 :         SetParams();
+      48             : }
+      49             : 
+      50           0 : void PT11Field::setUseBSS(bool use) {
+      51           0 :         useBSS = use;
+      52           0 :         if (not(use))
+      53             :                 return;
+      54             : 
+      55           0 :         if (useASS) {
+      56             :                 std::cout << "PT11Field: Disk field changed to BSS" << std::endl;
+      57           0 :                 useASS = false;
+      58             :         }
+      59             : 
+      60           0 :         pitch = -6.0 * M_PI / 180;
+      61           0 :         B0_Hs = 4.0 * muG;
+      62           0 :         SetParams();
+      63             : }
+      64             : 
+      65           0 : void PT11Field::setUseHalo(bool use) {
+      66           0 :         useHalo = use;
+      67           0 : }
+      68             : 
+      69           0 : bool PT11Field::isUsingASS() {
+      70           0 :         return useASS;
+      71             : }
+      72             : 
+      73           0 : bool PT11Field::isUsingBSS() {
+      74           0 :         return useBSS;
+      75             : }
+      76             : 
+      77           0 : bool PT11Field::isUsingHalo() {
+      78           0 :         return useHalo;
+      79             : }
+      80             : 
+      81           0 : Vector3d PT11Field::getField(const Vector3d& pos) const {
+      82           0 :         double r = sqrt(pos.x * pos.x + pos.y * pos.y);  // in-plane radius
+      83             : 
+      84             :         Vector3d b(0.);
+      85             : 
+      86             :         // disk field
+      87           0 :         if ((useASS) or (useBSS)) {
+      88             :                 // PT11 paper has B_theta = B * cos(p) but this seems because they define azimuth clockwise, while we have anticlockwise.
+      89             :                 // see Tinyakov 2002 APh 18,165: "local field points to l=90+p" so p=-5 deg gives l=85 and hence clockwise from above.
+      90             :                 // so to get local B clockwise in our system, need minus (like Sun etal).
+      91             :                 // Ps base their system on Han and Qiao 1994 A&A 288,759 which has a diagram with azimuth clockwise, hence confirmed.
+      92             : 
+      93             :                 // PT11 paper define Earth position at (+8.5, 0, 0) kpc; but usual convention is (-8.5, 0, 0)
+      94             :                 // thus we have to rotate our position by 180 degree in azimuth
+      95           0 :                 double theta = M_PI - pos.getPhi();  // azimuth angle theta: PT11 paper uses opposite convention for azimuth
+      96             :                 // the following is equivalent to sin(pi - phi) and cos(pi - phi) which is computationally slower
+      97           0 :                 double cos_theta = - pos.x / r;
+      98           0 :                 double sin_theta = pos.y / r;
+      99             : 
+     100             :                 // After some geometry calculations (on whiteboard) one finds:
+     101             :                 // Bx = +cos(theta) * B_r - sin(theta) * B_{theta}
+     102             :                 // By = -sin(theta) * B_r - cos(theta) * B_{theta}
+     103             :                 // Use from paper: B_theta = B * cos(pitch)     and B_r = B * sin(pitch)
+     104           0 :                 b.x = sin_pitch * cos_theta - cos_pitch * sin_theta;
+     105           0 :                 b.y = - sin_pitch * sin_theta - cos_pitch * cos_theta;
+     106             :                 b *= -1;        // flip magnetic field direction, as B_{theta} and B_{phi} refering to 180 degree rotated field
+     107             : 
+     108           0 :                 double bMag = cos(theta - cos_pitch / sin_pitch * log(r / R_sun) + PHI);
+     109           0 :                 if (useASS)
+     110           0 :                         bMag = fabs(bMag);
+     111           0 :                 bMag *= B0_D * R_sun / std::max(r, R_c) / cos_PHI * exp(-fabs(pos.z) / z0_D);
+     112             :                 b *= bMag;
+     113             :         }
+     114             : 
+     115             :         // halo field
+     116           0 :         if (useHalo) {
+     117           0 :                 double bMag = (pos.z > 0 ? B0_Hn : - B0_Hs);
+     118           0 :                 double z1 = (fabs(pos.z) < z0_H ? z11_H : z12_H);
+     119           0 :                 bMag *= r / R0_H * exp(1 - r / R0_H) / (1 + pow((fabs(pos.z) - z0_H) / z1, 2.));
+     120             :                 // equation (8) in paper: theta uses now the conventional azimuth definition in contrast to equation (3)
+     121             :                 // cos(phi) = pos.x / r (phi going counter-clockwise)
+     122             :                 // sin(phi) = pos.y / r
+     123             :                 // unitvector of phi in polar coordinates: (-sin(phi), cos(phi), 0)
+     124           0 :                 b += bMag * Vector3d(-pos.y / r, pos.x / r, 0);
+     125             :         }
+     126             : 
+     127           0 :         return b;
+     128             : }
+     129             : 
+     130             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/PolarizedSingleModeMagneticField.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/PolarizedSingleModeMagneticField.cpp.func-sort-c.html new file mode 100644 index 000000000..aa48a3251 --- /dev/null +++ b/doc/coverageReport/src/magneticField/PolarizedSingleModeMagneticField.cpp.func-sort-c.html @@ -0,0 +1,80 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/PolarizedSingleModeMagneticField.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - PolarizedSingleModeMagneticField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:153246.9 %
Date:2024-04-08 14:58:22Functions:22100.0 %
+
+ +
+ + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa32PolarizedSingleModeMagneticFieldC2ERKdS2_S2_RKNS_7Vector3IdEES6_S6_NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESC_SC_1
_ZNK7crpropa32PolarizedSingleModeMagneticField8getFieldERKNS_7Vector3IdEE1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/PolarizedSingleModeMagneticField.cpp.func.html b/doc/coverageReport/src/magneticField/PolarizedSingleModeMagneticField.cpp.func.html new file mode 100644 index 000000000..85b986750 --- /dev/null +++ b/doc/coverageReport/src/magneticField/PolarizedSingleModeMagneticField.cpp.func.html @@ -0,0 +1,80 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/PolarizedSingleModeMagneticField.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - PolarizedSingleModeMagneticField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:153246.9 %
Date:2024-04-08 14:58:22Functions:22100.0 %
+
+ +
+ + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa32PolarizedSingleModeMagneticFieldC2ERKdS2_S2_RKNS_7Vector3IdEES6_S6_NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESC_SC_1
_ZNK7crpropa32PolarizedSingleModeMagneticField8getFieldERKNS_7Vector3IdEE1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/PolarizedSingleModeMagneticField.cpp.gcov.html b/doc/coverageReport/src/magneticField/PolarizedSingleModeMagneticField.cpp.gcov.html new file mode 100644 index 000000000..9ac25d10b --- /dev/null +++ b/doc/coverageReport/src/magneticField/PolarizedSingleModeMagneticField.cpp.gcov.html @@ -0,0 +1,142 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/PolarizedSingleModeMagneticField.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - PolarizedSingleModeMagneticField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:153246.9 %
Date:2024-04-08 14:58:22Functions:22100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/magneticField/PolarizedSingleModeMagneticField.h"
+       2             : 
+       3             : namespace crpropa {
+       4             : 
+       5           1 : PolarizedSingleModeMagneticField::PolarizedSingleModeMagneticField( const double &B_0, const double &wavelength, const double &sigma, const Vector3d &r_0, const Vector3d &e_1, const Vector3d &e_2, std::string flagAmplitudeRms, std::string flagPolarizationHelicity, std::string flagMode ) {
+       6           1 :         if (flagMode == "elliptical") {
+       7           1 :                 if (abs(sigma) > 1)
+       8           0 :                         throw std::runtime_error("PolarizedSingleModeMagneticField: The value of the  polarization parameter has to lie in the range [-1;+1].");
+       9             :         }
+      10           0 :         else if (flagMode == "circular") {
+      11           0 :                 if (abs(sigma) != 1)
+      12           0 :                         throw std::runtime_error("PolarizedSingleModeMagneticField: For circular polarization the value of the polarization parameter has to be equal to -1 or +1.");
+      13             :         }
+      14           0 :         else if (flagMode == "linear") {
+      15           0 :                 if (abs(sigma) != 0)
+      16           0 :                         throw std::runtime_error("PolarizedSingleModeMagneticField: For linear polarization the value of the polarization parameter has to be equal to 0.");
+      17             :         }
+      18             :         else
+      19           0 :                 throw std::runtime_error("PolarizedSingleModeMagneticField: Wrong value for flagMode. Please choose \"elliptical\" or \"circular\" or \"linear\".");
+      20             : 
+      21           1 :         if (e_1.dot(e_2) != 0)
+      22           0 :                 throw std::runtime_error("PolarizedSingleModeMagneticField: e_1 and e_2 have to be orthogonal to each other.");
+      23             : 
+      24           1 :         if (e_1.getR() == 0)
+      25           0 :                 throw std::runtime_error("PolarizedSingleModeMagneticField: Vector e_1 cannot be zero.");
+      26             :         unitVector_1 = e_1 / e_1.getR();
+      27             : 
+      28           1 :         if (e_2.getR() == 0)
+      29           0 :                 throw std::runtime_error("PolarizedSingleModeMagneticField: Vector e_2 cannot be zero.");
+      30             :         unitVector_2 = e_2 / e_2.getR();
+      31             : 
+      32             :         wavevector = e_2.cross(e_1);
+      33             : 
+      34             :         //This check is necessary if a polarization with non-orthogonal spanning vectors is desired. This is not implemented in this version, so any corresponding modifications should be made with caution.
+      35             :         //if (wavevector.getR() == 0)
+      36             :         //        throw std::runtime_error("PolarizedSingleModeMagneticField: e_1 cannot be parallel to e_2.");
+      37             : 
+      38             :         wavevector = wavevector / wavevector.getR();
+      39             : 
+      40           1 :         if (wavelength == 0)
+      41           0 :                 throw std::runtime_error("PolarizedSingleModeMagneticField: The correlation length cannot be zero.");
+      42             :         wavevector = wavevector * 2 * M_PI / wavelength;
+      43             : 
+      44           2 :         if (!((flagPolarizationHelicity == "helicity") || (flagPolarizationHelicity == "polarization")))
+      45           0 :                 throw std::runtime_error("PolarizedSingleModeMagneticField: Wrong value for flagPolarizationHelicity. Please choose \"polarization\" or \"helicity\".");
+      46           1 :         if (flagPolarizationHelicity == "helicity" && abs(sigma) != 1)
+      47           0 :                 throw std::runtime_error("PolarizedSingleModeMagneticField: In helicity mode only the maximum helicity case (sigma = +1 or sigma = -1) may be chosen.");
+      48             : 
+      49           1 :         if (flagAmplitudeRms == "amplitude")
+      50           1 :                 B_max = B_0;
+      51           0 :         else if (flagAmplitudeRms == "rms")
+      52           0 :                 B_max = sqrt(2 / (1 + sigma * sigma)) * B_0;
+      53             :         else
+      54           0 :                 throw std::runtime_error("PolarizedSingleModeMagneticField: Wrong value for flagAmplitudeRms. Please choose \"amplitude\" or \"rms\".");
+      55             : 
+      56             :         this->r_0 = r_0;
+      57           1 :         this->sigma = sigma;
+      58           1 : }
+      59             : 
+      60           1 : Vector3d PolarizedSingleModeMagneticField::getField(const Vector3d &position) const {
+      61             :         Vector3d delta_r = position - r_0;
+      62             : 
+      63           1 :         return B_max * (unitVector_1 * cos(wavevector.dot(delta_r)) + unitVector_2 * sigma * sin(wavevector.dot(delta_r)));
+      64             : }
+      65             : 
+      66             : } //end namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/TF17Field.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/TF17Field.cpp.func-sort-c.html new file mode 100644 index 000000000..dbd5a2431 --- /dev/null +++ b/doc/coverageReport/src/magneticField/TF17Field.cpp.func-sort-c.html @@ -0,0 +1,188 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/TF17Field.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - TF17Field.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:01960.0 %
Date:2024-04-08 14:58:22Functions:0290.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa9TF17Field10set_H_diskEd0
_ZN7crpropa9TF17Field10set_L_diskEd0
_ZN7crpropa9TF17Field10set_L_haloEd0
_ZN7crpropa9TF17Field10set_a_diskEd0
_ZN7crpropa9TF17Field10set_a_haloEd0
_ZN7crpropa9TF17Field11set_B1_diskEd0
_ZN7crpropa9TF17Field11set_B1_haloEd0
_ZN7crpropa9TF17Field11set_r1_diskEd0
_ZN7crpropa9TF17Field11set_z1_diskEd0
_ZN7crpropa9TF17Field11set_z1_haloEd0
_ZN7crpropa9TF17Field15setUseDiskFieldEb0
_ZN7crpropa9TF17Field15setUseHaloFieldEb0
_ZN7crpropa9TF17Field16isUsingDiskFieldEv0
_ZN7crpropa9TF17Field16isUsingHaloFieldEv0
_ZN7crpropa9TF17Field17set_phi_star_diskEd0
_ZN7crpropa9TF17Field17set_phi_star_haloEd0
_ZN7crpropa9TF17Field6set_HpEd0
_ZN7crpropa9TF17Field6set_LpEd0
_ZN7crpropa9TF17Field6set_p0Ed0
_ZN7crpropa9TF17FieldC2ENS_13TF17DiskModelENS_13TF17HaloModelE0
_ZNK7crpropa9TF17Field12getDiskFieldERKdS2_S2_S2_S2_0
_ZNK7crpropa9TF17Field12getDiskModelB5cxx11Ev0
_ZNK7crpropa9TF17Field12getHaloFieldERKdS2_S2_S2_S2_0
_ZNK7crpropa9TF17Field12getHaloModelB5cxx11Ev0
_ZNK7crpropa9TF17Field16radialFieldScaleERKdS2_S2_S2_S2_S2_0
_ZNK7crpropa9TF17Field22shiftedWindingFunctionERKdS2_0
_ZNK7crpropa9TF17Field23azimuthalFieldComponentERKdS2_S2_S2_0
_ZNK7crpropa9TF17Field6zscaleERKd0
_ZNK7crpropa9TF17Field8getFieldERKNS_7Vector3IdEE0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/TF17Field.cpp.func.html b/doc/coverageReport/src/magneticField/TF17Field.cpp.func.html new file mode 100644 index 000000000..4c39636c6 --- /dev/null +++ b/doc/coverageReport/src/magneticField/TF17Field.cpp.func.html @@ -0,0 +1,188 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/TF17Field.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - TF17Field.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:01960.0 %
Date:2024-04-08 14:58:22Functions:0290.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa9TF17Field10set_H_diskEd0
_ZN7crpropa9TF17Field10set_L_diskEd0
_ZN7crpropa9TF17Field10set_L_haloEd0
_ZN7crpropa9TF17Field10set_a_diskEd0
_ZN7crpropa9TF17Field10set_a_haloEd0
_ZN7crpropa9TF17Field11set_B1_diskEd0
_ZN7crpropa9TF17Field11set_B1_haloEd0
_ZN7crpropa9TF17Field11set_r1_diskEd0
_ZN7crpropa9TF17Field11set_z1_diskEd0
_ZN7crpropa9TF17Field11set_z1_haloEd0
_ZN7crpropa9TF17Field15setUseDiskFieldEb0
_ZN7crpropa9TF17Field15setUseHaloFieldEb0
_ZN7crpropa9TF17Field16isUsingDiskFieldEv0
_ZN7crpropa9TF17Field16isUsingHaloFieldEv0
_ZN7crpropa9TF17Field17set_phi_star_diskEd0
_ZN7crpropa9TF17Field17set_phi_star_haloEd0
_ZN7crpropa9TF17Field6set_HpEd0
_ZN7crpropa9TF17Field6set_LpEd0
_ZN7crpropa9TF17Field6set_p0Ed0
_ZN7crpropa9TF17FieldC2ENS_13TF17DiskModelENS_13TF17HaloModelE0
_ZNK7crpropa9TF17Field12getDiskFieldERKdS2_S2_S2_S2_0
_ZNK7crpropa9TF17Field12getDiskModelB5cxx11Ev0
_ZNK7crpropa9TF17Field12getHaloFieldERKdS2_S2_S2_S2_0
_ZNK7crpropa9TF17Field12getHaloModelB5cxx11Ev0
_ZNK7crpropa9TF17Field16radialFieldScaleERKdS2_S2_S2_S2_S2_0
_ZNK7crpropa9TF17Field22shiftedWindingFunctionERKdS2_0
_ZNK7crpropa9TF17Field23azimuthalFieldComponentERKdS2_S2_S2_0
_ZNK7crpropa9TF17Field6zscaleERKd0
_ZNK7crpropa9TF17Field8getFieldERKNS_7Vector3IdEE0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/TF17Field.cpp.gcov.html b/doc/coverageReport/src/magneticField/TF17Field.cpp.gcov.html new file mode 100644 index 000000000..b277961c9 --- /dev/null +++ b/doc/coverageReport/src/magneticField/TF17Field.cpp.gcov.html @@ -0,0 +1,383 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/TF17Field.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField - TF17Field.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:01960.0 %
Date:2024-04-08 14:58:22Functions:0290.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/magneticField/TF17Field.h"
+       2             : #include "crpropa/Units.h"
+       3             : 
+       4             : #include <algorithm>
+       5             : #include <string>
+       6             : 
+       7             : namespace crpropa {
+       8             : using namespace std;
+       9             : 
+      10           0 : TF17Field::TF17Field(TF17DiskModel disk_model_, TF17HaloModel halo_model_) {
+      11           0 :     disk_model = disk_model_; 
+      12           0 :     halo_model = halo_model_;
+      13             : 
+      14           0 :     useHaloField = true;
+      15           0 :     useDiskField = true;
+      16             : 
+      17           0 :     if ((halo_model == TF17HaloModel::C0) && (disk_model == TF17DiskModel::Ad1)) {
+      18             :         // disk parameters
+      19           0 :         set_r1_disk(3 * kpc);
+      20           0 :         set_B1_disk(19.0 * muG);
+      21           0 :         set_H_disk(0.055 * kpc);
+      22           0 :         set_phi_star_disk(-54 * M_PI / 180);
+      23           0 :         set_a_disk(0.9 / kpc / kpc);
+      24             :         // halo parameters
+      25           0 :         set_z1_halo(0);
+      26           0 :         set_B1_halo(0.36 * muG);
+      27           0 :         set_L_halo(3.0 * kpc);
+      28           0 :         set_a_halo(1.17 / kpc / kpc);
+      29             :         // shared parameters
+      30           0 :         set_p0(-7.9 * M_PI / 180);
+      31           0 :         set_Hp(5 * kpc);
+      32           0 :         set_Lp(50 * kpc); // > 18 kpc
+      33             :             
+      34           0 :     } else if ((halo_model == TF17HaloModel::C0) && (disk_model == TF17DiskModel::Bd1)) {
+      35             :         // disk parameters
+      36           0 :         set_r1_disk(3 * kpc);
+      37           0 :         set_B1_disk(2.0 * muG);
+      38           0 :         set_H_disk(0.32 * kpc);
+      39           0 :         set_phi_star_disk(153 * M_PI / 180);
+      40             :         // halo parameters
+      41           0 :         set_z1_halo(0);
+      42           0 :         set_B1_halo(0.29 * muG);
+      43           0 :         set_L_halo(3.4 * kpc);
+      44           0 :         set_a_halo(0.88 / kpc / kpc);
+      45             :         // shared parameters
+      46           0 :         set_p0(-7.2 * M_PI / 180);
+      47           0 :         set_Hp(9 * kpc);
+      48           0 :         set_Lp(50 * kpc); // > 16 kpc
+      49             : 
+      50           0 :     } else if ((halo_model == TF17HaloModel::C0) && (disk_model == TF17DiskModel::Dd1)) {
+      51             :         // disk parameters
+      52           0 :         set_z1_disk(1.5 * kpc);
+      53           0 :         set_B1_disk(0.065 * muG);
+      54           0 :         set_L_disk(9.8 * kpc);
+      55           0 :         set_phi_star_disk(14 * M_PI / 180);
+      56             :         // halo parameters
+      57           0 :         set_z1_halo(0);
+      58           0 :         set_B1_halo(0.18 * muG);
+      59           0 :         set_L_halo(4.8 * kpc);
+      60           0 :         set_a_halo(0.61 / kpc / kpc);
+      61             :         // shared parameters
+      62           0 :         set_p0(-7.4 * M_PI / 180);
+      63           0 :         set_Hp(4.2 * kpc);
+      64           0 :         set_Lp(50 * kpc); // > 22 kpc
+      65             : 
+      66           0 :     } else if ((halo_model == TF17HaloModel::C1) && (disk_model == TF17DiskModel::Ad1)) {
+      67             :         // disk parameters
+      68           0 :         set_r1_disk(3 * kpc);
+      69           0 :         set_B1_disk(32.0 * muG);
+      70           0 :         set_H_disk(0.054 * kpc);
+      71           0 :         set_phi_star_disk(-31 * M_PI / 180);
+      72           0 :         set_a_disk(0.031 / kpc / kpc);
+      73             :         // halo parameters
+      74           0 :         set_z1_halo(0);
+      75           0 :         set_B1_halo(9.0 * muG);
+      76           0 :         set_L_halo(2.1 * kpc);
+      77           0 :         set_phi_star_halo(198 * M_PI / 180);
+      78           0 :         set_a_halo(0.33 / kpc / kpc);
+      79             :         // shared parameters
+      80           0 :         set_p0(-9.1 * M_PI / 180);
+      81           0 :         set_Hp(1.2 * kpc);
+      82           0 :         set_Lp(50 * kpc); // > 38 kpc
+      83             : 
+      84           0 :     } else if ((halo_model == TF17HaloModel::C1) && (disk_model == TF17DiskModel::Bd1)) {
+      85             :         // disk parameters
+      86           0 :         set_r1_disk(3 * kpc);
+      87           0 :         set_B1_disk(24 * muG);
+      88           0 :         set_H_disk(0.090 * kpc);
+      89           0 :         set_phi_star_disk(-34 * M_PI / 180);
+      90             :         // halo parameters
+      91           0 :         set_z1_halo(0);
+      92           0 :         set_B1_halo(8.2 * muG);
+      93           0 :         set_L_halo(2.2 * kpc);
+      94           0 :         set_phi_star_halo(197 * M_PI / 180);
+      95           0 :         set_a_halo(0.38 / kpc / kpc);
+      96             :         // shared parameters
+      97           0 :         set_p0(-9.0 * M_PI / 180);
+      98           0 :         set_Hp(1.2 * kpc);
+      99           0 :         set_Lp(50 * kpc); // > 38 kpc
+     100             : 
+     101           0 :     } else if ((halo_model == TF17HaloModel::C1) && (disk_model == TF17DiskModel::Dd1)) {
+     102             :         // disk parameters
+     103           0 :         set_z1_disk(1.5 * kpc);
+     104           0 :         set_B1_disk(0.40 * muG);
+     105           0 :         set_L_disk(2.9 * kpc);
+     106           0 :         set_phi_star_disk(120 * M_PI / 180);
+     107             :         // halo parameters
+     108           0 :         set_z1_halo(0);
+     109           0 :         set_B1_halo(9.5 * muG);
+     110           0 :         set_L_halo(2.1 * kpc);
+     111           0 :         set_phi_star_halo(179 * M_PI / 180);
+     112           0 :         set_a_halo(0.45 / kpc / kpc);
+     113             :         // shared parameters
+     114           0 :         set_p0(-8.4 * M_PI / 180);
+     115           0 :         set_Hp(1.2 * kpc);
+     116           0 :         set_Lp(50 * kpc); // > 30 kpc
+     117             :     }
+     118             : 
+     119           0 :     epsilon = std::numeric_limits<double>::epsilon();
+     120           0 : }
+     121             : 
+     122           0 : void TF17Field::setUseDiskField(bool use) {     useDiskField = use; }
+     123           0 : void TF17Field::setUseHaloField(bool use) { useHaloField = use; }
+     124             : 
+     125           0 : bool TF17Field::isUsingDiskField() { return useDiskField; }
+     126           0 : bool TF17Field::isUsingHaloField() { return useHaloField; }
+     127             : 
+     128           0 : void TF17Field::set_B1_disk(const double B1){ B1_disk = B1; }
+     129           0 : void TF17Field::set_z1_disk(const double z1){ z1_disk = z1; }
+     130           0 : void TF17Field::set_r1_disk(const double r1){ r1_disk = r1; }
+     131           0 : void TF17Field::set_H_disk(const double H){ H_disk = H; }
+     132           0 : void TF17Field::set_L_disk(const double L){ L_disk = L; }
+     133           0 : void TF17Field::set_a_disk(const double a){ a_disk = a; }
+     134           0 : void TF17Field::set_phi_star_disk(const double phi){ phi_star_disk = phi; }
+     135             : 
+     136           0 : void TF17Field::set_B1_halo(const double B1){ B1_halo = B1; }
+     137           0 : void TF17Field::set_z1_halo(const double z1){ z1_halo = z1; }
+     138           0 : void TF17Field::set_L_halo(const double L){ L_halo = L; }
+     139           0 : void TF17Field::set_a_halo(const double a){ a_halo = a; }
+     140           0 : void TF17Field::set_phi_star_halo(const double phi){ phi_star_halo = phi; }
+     141             : 
+     142           0 : void TF17Field::set_Hp(const double H){ H_p = H; }
+     143           0 : void TF17Field::set_Lp(const double L){ L_p = L; }
+     144           0 : void TF17Field::set_p0(const double p0){ 
+     145           0 :     p_0 = p0; 
+     146           0 :     cot_p0 = cos(p_0) / sin(p_0);
+     147           0 : }
+     148             : 
+     149           0 : string TF17Field::getDiskModel() const {
+     150             :     string model_name;
+     151           0 :     switch (disk_model) {
+     152             :         case TF17DiskModel::Ad1 : model_name = "Ad1"; break;
+     153             :         case TF17DiskModel::Bd1 : model_name = "Bd1"; break;
+     154             :         case TF17DiskModel::Dd1 : model_name = "Dd1"; break;
+     155             :     }
+     156           0 :     return model_name;
+     157             : }
+     158           0 : string TF17Field::getHaloModel() const {
+     159             :     string model_name;
+     160           0 :     switch (halo_model) {
+     161             :         case TF17HaloModel::C0 : model_name = "C0"; break;
+     162             :         case TF17HaloModel::C1 : model_name = "C1"; break;
+     163             :     }
+     164           0 :     return model_name;
+     165             : }
+     166             : 
+     167             : 
+     168           0 : Vector3d TF17Field::getField(const Vector3d& pos) const {
+     169           0 :         double r = sqrt(pos.x * pos.x + pos.y * pos.y);  // in-plane radius
+     170           0 :         double phi = M_PI - pos.getPhi(); // azimuth in our convention
+     171             :         // double cosPhi = pos.x / r;
+     172           0 :         double cosPhi = cos(phi);
+     173             :         // double sinPhi = pos.y / r;
+     174           0 :         double sinPhi = sin(phi);
+     175             : 
+     176             :         Vector3d b(0.);
+     177           0 :         if (useDiskField)
+     178           0 :                 b += getDiskField(r, pos.z, phi, sinPhi, cosPhi);       // disk field
+     179           0 :         if (useHaloField)
+     180           0 :                 b += getHaloField(r, pos.z, phi, sinPhi, cosPhi);       // halo field
+     181           0 :         return b;
+     182             : }
+     183             : 
+     184           0 : Vector3d TF17Field::getDiskField(const double& r, const double& z, const double& phi, const double& sinPhi, const double& cosPhi) const {
+     185             :         Vector3d b(0.);
+     186           0 :     double B_r = 0;
+     187             :     double B_phi = 0;
+     188           0 :     double B_z = 0;
+     189             : 
+     190           0 :     if (disk_model == TF17DiskModel::Ad1) { // ==========================================================
+     191           0 :         if (r > r1_disk) {
+     192           0 :             double z1_disk_z = (1. + a_disk * r1_disk * r1_disk) / (1. + a_disk * r * r); // z1_disk / z
+     193             :             // B components in (r, phi, z)
+     194           0 :             double B_r0 = radialFieldScale(B1_disk, phi_star_disk, z1_disk_z*z, phi, r, z);
+     195           0 :             B_r = (r1_disk / r) * z1_disk_z * B_r0;
+     196           0 :             B_z = 2 * a_disk * r1_disk * z1_disk_z*z / (1+ a_disk * r * r) * B_r0;
+     197           0 :             B_phi = azimuthalFieldComponent(r, z, B_r, B_z);
+     198             :         } else {
+     199             :             // within r = r1_disk, the field lines are straight in direction g_phi + phi_star_disk
+     200             :             // and thus z = z1
+     201           0 :             double phi1_disk = shiftedWindingFunction(r1_disk, z) + phi_star_disk;
+     202           0 :             double B_amp = B1_disk * exp(-fabs(z) / H_disk);
+     203           0 :             B_r = cos(phi1_disk - phi) * B_amp;
+     204           0 :             B_phi = sin(phi1_disk - phi) * B_amp;
+     205             :         }
+     206             : 
+     207           0 :     } else if (disk_model == TF17DiskModel::Bd1) { // ===================================================
+     208             :         // for model Bd1, best fit for n = 2 
+     209           0 :         if ( r > epsilon ) {
+     210           0 :             double r1_disk_r = r1_disk / r;     
+     211           0 :             double z1_disk_z = 5. / (r1_disk_r*r1_disk_r + 4./sqrt(r1_disk_r)); // z1_disk / z -> remove z dependancy 
+     212           0 :             double B_r0 = radialFieldScale(B1_disk, phi_star_disk, z1_disk_z*z, phi, r, z);
+     213           0 :             B_r = r1_disk_r * z1_disk_z * B_r0;
+     214           0 :             B_z = -0.4 * r1_disk_r / r * z1_disk_z* z1_disk_z * z * (r1_disk_r*r1_disk_r - 1./sqrt(r1_disk_r)) * B_r0;
+     215             :         } else {
+     216           0 :             double z1_disk_z = 5. * r*r / (r1_disk*r1_disk); // z1_disk / z -> remove z dependancy 
+     217           0 :             double B_r0 = radialFieldScale(B1_disk, phi_star_disk, z1_disk_z*z, phi, r, z);
+     218           0 :             B_r = 5. * r / r1_disk * B_r0;
+     219           0 :             B_z = -10. * z / r1_disk * B_r0;
+     220             :         }
+     221           0 :         B_phi = azimuthalFieldComponent(r, z, B_r, B_z);
+     222             : 
+     223           0 :     } else if (disk_model == TF17DiskModel::Dd1) { // ===================================================
+     224             :         // for model Dd1, best fit for n = 0.5 
+     225           0 :         double z_sign = z >= 0 ? 1. : -1.; 
+     226           0 :         double z_abs = fabs(z); 
+     227           0 :         if ( z_abs > epsilon ) {
+     228           0 :             double z1_disk_z = z1_disk / z_abs; 
+     229           0 :             double r1_disk_r = 1.5 / (sqrt(z1_disk_z) + 0.5/z1_disk_z); // r1_disk / r
+     230           0 :             double F_r = r1_disk_r*r  <= L_disk ? 1. : exp(1. - r1_disk_r*r/L_disk);
+     231             :         // simplication of the equation in the cosinus
+     232           0 :             double B_z0 = z_sign * B1_disk * F_r * cos(phi - shiftedWindingFunction(r, z) - phi_star_disk);
+     233           0 :             B_r = -0.5/1.5 * r1_disk_r * r1_disk_r * r1_disk_r * r / z_abs * (sqrt(z1_disk_z) - 1/z1_disk_z) * B_z0;
+     234           0 :             B_z = z_sign * r1_disk_r * r1_disk_r * B_z0;
+     235             :         } else {
+     236           0 :             double z_z1_disk = z_abs / z1_disk; 
+     237           0 :             double r1_disk_r = 1.5 * sqrt(z_abs / z1_disk); // r1_disk / r
+     238           0 :             double F_r = r1_disk_r*r  <= L_disk ? 1. : exp(1. - r1_disk_r*r/L_disk);
+     239           0 :             double B_z0 = z_sign * B1_disk * F_r * cos(phi - shiftedWindingFunction(r, z) - phi_star_disk);
+     240           0 :             B_r = -1.125 * r / z1_disk * (1 - 2.5 * z_z1_disk * sqrt(z_z1_disk)) * B_z0;
+     241           0 :             B_z = z_sign * r1_disk_r * r1_disk_r * B_z0;
+     242             :         }
+     243           0 :         B_phi = azimuthalFieldComponent(r, z, B_r, B_z);
+     244             :     }
+     245             : 
+     246             :     // Convert to (x, y, z) components
+     247           0 :     b.x = - (B_r * cosPhi - B_phi * sinPhi); // flip x-component at the end
+     248           0 :     b.y = B_r * sinPhi + B_phi * cosPhi;
+     249           0 :     b.z = B_z;
+     250           0 :         return b;
+     251             : }
+     252             : 
+     253           0 : Vector3d TF17Field::getHaloField(const double& r, const double& z, const double& phi, const double& sinPhi, const double& cosPhi) const {
+     254             :     int m;
+     255             : 
+     256             :         Vector3d b(0.);
+     257           0 :         double r1_halo_r =  (1. + a_halo * z1_halo * z1_halo) / (1. + a_halo * z * z);
+     258             :         // B components in (r, phi, z)
+     259             :     double B_z0;
+     260             : 
+     261           0 :     if (halo_model == TF17HaloModel::C0) { // m = 0
+     262           0 :         B_z0 = B1_halo * exp(-r1_halo_r*r / L_halo); 
+     263           0 :     } else if (halo_model == TF17HaloModel::C1) { // m = 1
+     264             :         // simplication of the equation in the cosinus
+     265           0 :         double phi_prime = phi - shiftedWindingFunction(r, z) - phi_star_halo;
+     266           0 :         B_z0 = B1_halo * exp(-r1_halo_r*r / L_halo) * cos(phi_prime); 
+     267             :     }
+     268             : 
+     269             :     // Contrary to article, Br has been rewriten to a little bit by replacing
+     270             :     // (2 * a * r1**3 * z) / (r**2) by (2 * a * r1**2 * z) / (r * (1+a*z**2))
+     271             :     // but that is strictly equivalent except we can reintroduce the z1 in the expression via r1
+     272           0 :         double B_r = 2 * a_halo * r1_halo_r * r1_halo_r * r * z / (1. + a_halo * z * z) * B_z0;
+     273           0 :         double B_z = r1_halo_r * r1_halo_r * B_z0; 
+     274           0 :         double B_phi = azimuthalFieldComponent(r, z, B_r, B_z);
+     275             : 
+     276             :         // Convert to (x, y, z) components
+     277           0 :         b.x = - (B_r * cosPhi - B_phi * sinPhi);        // flip x-component at the end
+     278           0 :         b.y = B_r * sinPhi + B_phi * cosPhi;
+     279           0 :         b.z = B_z;
+     280             : 
+     281           0 :         return b;
+     282             : }
+     283             : 
+     284           0 : double TF17Field::azimuthalFieldComponent(const double& r, const double& z, const double& B_r, const double& B_z) const {
+     285           0 :         double r_ = r / L_p;
+     286           0 :     double rscale = r > epsilon ? r_ * exp(-r_) / (1 - exp(-r_)) : 1 - r_/2. - r_*r_/12. ;
+     287           0 :         double B_phi = cot_p0 / zscale(z) * rscale * B_r;
+     288           0 :     B_phi = B_phi - 2 * z * r / (H_p * H_p) / zscale(z) * shiftedWindingFunction(r, z) * B_z;
+     289           0 :         return B_phi;
+     290             : }
+     291             : 
+     292           0 : double TF17Field::radialFieldScale(const double& B1, const double& phi_star, const double& z1, const double& phi, const double& r, const double& z) const {
+     293             :     // simplication of the equation in the cosinus
+     294           0 :     double phi_prime = phi - shiftedWindingFunction(r, z) - phi_star;
+     295             :         // This term occures is parameterizations of models A and B always bisymmetric (m = 1)
+     296           0 :         return B1 * exp(-fabs(z1) / H_disk) * cos(phi_prime);
+     297             : }
+     298             : 
+     299           0 : double TF17Field::shiftedWindingFunction(const double& r, const double& z) const {
+     300           0 :     return cot_p0 * log(1 - exp(-r / L_p) + epsilon) / zscale(z);
+     301             : }
+     302             : 
+     303           0 : double TF17Field::zscale(const double& z) const {
+     304           0 :         return 1 + z * z / H_p / H_p;
+     305             : }
+     306             : 
+     307             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/index-sort-f.html b/doc/coverageReport/src/magneticField/index-sort-f.html new file mode 100644 index 000000000..e6f4aee3b --- /dev/null +++ b/doc/coverageReport/src/magneticField/index-sort-f.html @@ -0,0 +1,173 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticFieldHitTotalCoverage
Test:coverage.info.cleanedLines:16691018.2 %
Date:2024-04-08 14:58:22Functions:2913821.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
PT11Field.cpp +
0.0%
+
0.0 %0 / 630.0 %0 / 9
ArchimedeanSpiralField.cpp +
0.0%
+
0.0 %0 / 420.0 %0 / 10
MagneticFieldGrid.cpp +
0.0%
+
0.0 %0 / 310.0 %0 / 11
JF12FieldSolenoidal.cpp +
0.0%
+
0.0 %0 / 1420.0 %0 / 14
TF17Field.cpp +
0.0%
+
0.0 %0 / 1960.0 %0 / 29
JF12Field.cpp +
0.0%
+
0.0 %0 / 2310.0 %0 / 29
MagneticField.cpp +
72.7%72.7%
+
72.7 %48 / 6656.2 %9 / 16
PolarizedSingleModeMagneticField.cpp +
46.9%46.9%
+
46.9 %15 / 32100.0 %2 / 2
CMZField.cpp +
96.3%96.3%
+
96.3 %103 / 107100.0 %18 / 18
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/index-sort-l.html b/doc/coverageReport/src/magneticField/index-sort-l.html new file mode 100644 index 000000000..2650220e6 --- /dev/null +++ b/doc/coverageReport/src/magneticField/index-sort-l.html @@ -0,0 +1,173 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticFieldHitTotalCoverage
Test:coverage.info.cleanedLines:16691018.2 %
Date:2024-04-08 14:58:22Functions:2913821.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
MagneticFieldGrid.cpp +
0.0%
+
0.0 %0 / 310.0 %0 / 11
ArchimedeanSpiralField.cpp +
0.0%
+
0.0 %0 / 420.0 %0 / 10
PT11Field.cpp +
0.0%
+
0.0 %0 / 630.0 %0 / 9
JF12FieldSolenoidal.cpp +
0.0%
+
0.0 %0 / 1420.0 %0 / 14
TF17Field.cpp +
0.0%
+
0.0 %0 / 1960.0 %0 / 29
JF12Field.cpp +
0.0%
+
0.0 %0 / 2310.0 %0 / 29
PolarizedSingleModeMagneticField.cpp +
46.9%46.9%
+
46.9 %15 / 32100.0 %2 / 2
MagneticField.cpp +
72.7%72.7%
+
72.7 %48 / 6656.2 %9 / 16
CMZField.cpp +
96.3%96.3%
+
96.3 %103 / 107100.0 %18 / 18
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/index.html b/doc/coverageReport/src/magneticField/index.html new file mode 100644 index 000000000..e4d6a01d2 --- /dev/null +++ b/doc/coverageReport/src/magneticField/index.html @@ -0,0 +1,173 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticFieldHitTotalCoverage
Test:coverage.info.cleanedLines:16691018.2 %
Date:2024-04-08 14:58:22Functions:2913821.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
ArchimedeanSpiralField.cpp +
0.0%
+
0.0 %0 / 420.0 %0 / 10
CMZField.cpp +
96.3%96.3%
+
96.3 %103 / 107100.0 %18 / 18
JF12Field.cpp +
0.0%
+
0.0 %0 / 2310.0 %0 / 29
JF12FieldSolenoidal.cpp +
0.0%
+
0.0 %0 / 1420.0 %0 / 14
MagneticField.cpp +
72.7%72.7%
+
72.7 %48 / 6656.2 %9 / 16
MagneticFieldGrid.cpp +
0.0%
+
0.0 %0 / 310.0 %0 / 11
PT11Field.cpp +
0.0%
+
0.0 %0 / 630.0 %0 / 9
PolarizedSingleModeMagneticField.cpp +
46.9%46.9%
+
46.9 %15 / 32100.0 %2 / 2
TF17Field.cpp +
0.0%
+
0.0 %0 / 1960.0 %0 / 29
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/turbulentField/GridTurbulence.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/turbulentField/GridTurbulence.cpp.func-sort-c.html new file mode 100644 index 000000000..166f69ed4 --- /dev/null +++ b/doc/coverageReport/src/magneticField/turbulentField/GridTurbulence.cpp.func-sort-c.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/turbulentField/GridTurbulence.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField/turbulentField - GridTurbulence.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8910485.6 %
Date:2024-04-08 14:58:22Functions:71353.8 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa14GridTurbulence10dumpToFileENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZNK7crpropa14GridTurbulence16getPowerSpectrumEv0
_ZNK7crpropa14GridTurbulence18getMeanFieldVectorEv0
_ZNK7crpropa14GridTurbulence19getRmsFieldStrengthEv0
_ZNK7crpropa14GridTurbulence20getMeanFieldStrengthEv0
_ZNK7crpropa14GridTurbulence26getRmsFieldStrengthPerAxisEv0
_ZNK7crpropa14GridTurbulence7getGridEv1
_ZNK7crpropa14GridTurbulence8getFieldERKNS_7Vector3IdEE4
_ZN7crpropa14GridTurbulence14initTurbulenceEv6
_ZN7crpropa14GridTurbulence8initGridERKNS_14GridPropertiesE6
_ZN7crpropa14GridTurbulenceC2ERKNS_18TurbulenceSpectrumERKNS_14GridPropertiesEj6
_ZN7crpropa14GridTurbulence24executeInverseFFTInplaceENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEPA2_fS8_S8_10
_ZN7crpropa14GridTurbulence21checkGridRequirementsENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEdd13
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/turbulentField/GridTurbulence.cpp.func.html b/doc/coverageReport/src/magneticField/turbulentField/GridTurbulence.cpp.func.html new file mode 100644 index 000000000..59602c105 --- /dev/null +++ b/doc/coverageReport/src/magneticField/turbulentField/GridTurbulence.cpp.func.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/turbulentField/GridTurbulence.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField/turbulentField - GridTurbulence.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8910485.6 %
Date:2024-04-08 14:58:22Functions:71353.8 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa14GridTurbulence14initTurbulenceEv6
_ZN7crpropa14GridTurbulence21checkGridRequirementsENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEdd13
_ZN7crpropa14GridTurbulence24executeInverseFFTInplaceENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEPA2_fS8_S8_10
_ZN7crpropa14GridTurbulence8initGridERKNS_14GridPropertiesE6
_ZN7crpropa14GridTurbulenceC2ERKNS_18TurbulenceSpectrumERKNS_14GridPropertiesEj6
_ZNK7crpropa14GridTurbulence10dumpToFileENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZNK7crpropa14GridTurbulence16getPowerSpectrumEv0
_ZNK7crpropa14GridTurbulence18getMeanFieldVectorEv0
_ZNK7crpropa14GridTurbulence19getRmsFieldStrengthEv0
_ZNK7crpropa14GridTurbulence20getMeanFieldStrengthEv0
_ZNK7crpropa14GridTurbulence26getRmsFieldStrengthPerAxisEv0
_ZNK7crpropa14GridTurbulence7getGridEv1
_ZNK7crpropa14GridTurbulence8getFieldERKNS_7Vector3IdEE4
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/turbulentField/GridTurbulence.cpp.gcov.html b/doc/coverageReport/src/magneticField/turbulentField/GridTurbulence.cpp.gcov.html new file mode 100644 index 000000000..fb8a58ac8 --- /dev/null +++ b/doc/coverageReport/src/magneticField/turbulentField/GridTurbulence.cpp.gcov.html @@ -0,0 +1,289 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/turbulentField/GridTurbulence.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField/turbulentField - GridTurbulence.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8910485.6 %
Date:2024-04-08 14:58:22Functions:71353.8 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/magneticField/turbulentField/GridTurbulence.h"
+       2             : #include "crpropa/GridTools.h"
+       3             : #include "crpropa/Random.h"
+       4             : 
+       5             : #ifdef CRPROPA_HAVE_FFTW3F
+       6             : 
+       7             : namespace crpropa {
+       8             : 
+       9             : 
+      10           6 : GridTurbulence::GridTurbulence(const TurbulenceSpectrum &spectrum,
+      11             :                                const GridProperties &gridProp,
+      12           6 :                                unsigned int seed)
+      13           6 :     : TurbulentField(spectrum), seed(seed) {
+      14           6 :         initGrid(gridProp);
+      15           6 :         checkGridRequirements(gridPtr, spectrum.getLmin(), spectrum.getLmax());
+      16           6 :         initTurbulence();
+      17           6 : }
+      18             : 
+      19           6 : void GridTurbulence::initGrid(const GridProperties &p) {
+      20           6 :         gridPtr = new Grid3f(p);
+      21           6 : }
+      22             : 
+      23           4 : Vector3d GridTurbulence::getField(const Vector3d &pos) const {
+      24           4 :         return gridPtr->interpolate(pos);
+      25             : }
+      26             : 
+      27           1 : const ref_ptr<Grid3f> &GridTurbulence::getGrid() const { return gridPtr; }
+      28             : 
+      29           6 : void GridTurbulence::initTurbulence() {
+      30             : 
+      31             :         Vector3d spacing = gridPtr->getSpacing();
+      32             :         size_t n = gridPtr->getNx(); // size of array
+      33           6 :         size_t n2 = (size_t)floor(n / 2) +
+      34             :                     1; // size array in z-direction in configuration space
+      35             : 
+      36             :         // arrays to hold the complex vector components of the B(k)-field
+      37             :         fftwf_complex *Bkx, *Bky, *Bkz;
+      38           6 :         Bkx = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * n * n * n2);
+      39           6 :         Bky = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * n * n * n2);
+      40           6 :         Bkz = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * n * n * n2);
+      41             : 
+      42           6 :         Random random;
+      43           6 :         if (seed != 0)
+      44           4 :                 random.seed(seed); // use given seed
+      45             : 
+      46             :         // calculate the n possible discrete wave numbers
+      47           6 :         double K[n];
+      48         390 :         for (size_t i = 0; i < n; i++)
+      49         384 :                 K[i] = ((double)i / n - i / (n / 2));
+      50             : 
+      51             :         // double kMin = 2*M_PI / lMax; // * 2 * spacing.x; // spacing.x / lMax;
+      52             :         // double kMax = 2*M_PI / lMin; // * 2 * spacing.x; // spacing.x / lMin;
+      53           6 :         double kMin = spacing.x / spectrum.getLmax();
+      54           6 :         double kMax = spacing.x / spectrum.getLmin();
+      55           6 :         auto lambda = 1 / spacing.x * 2 * M_PI;
+      56             : 
+      57             :         Vector3f n0(1, 1, 1); // arbitrary vector to construct orthogonal base
+      58             : 
+      59         390 :         for (size_t ix = 0; ix < n; ix++) {
+      60       24960 :                 for (size_t iy = 0; iy < n; iy++) {
+      61      835584 :                         for (size_t iz = 0; iz < n2; iz++) {
+      62             :         
+      63             :                                 Vector3f ek, e1, e2;  // orthogonal base
+      64             : 
+      65      811008 :                                 size_t i = ix * n * n2 + iy * n2 + iz;
+      66      811008 :                                 ek.setXYZ(K[ix], K[iy], K[iz]);
+      67      811008 :                                 double k = ek.getR();
+      68             : 
+      69             :                                 // wave outside of turbulent range -> B(k) = 0
+      70      811008 :                                 if ((k < kMin) || (k > kMax)) {
+      71      395939 :                                         Bkx[i][0] = 0;
+      72      395939 :                                         Bkx[i][1] = 0;
+      73      395939 :                                         Bky[i][0] = 0;
+      74      395939 :                                         Bky[i][1] = 0;
+      75      395939 :                                         Bkz[i][0] = 0;
+      76      395939 :                                         Bkz[i][1] = 0;
+      77             :                                         continue;
+      78             :                                 }
+      79             : 
+      80             :                                 // construct an orthogonal base ek, e1, e2
+      81      415069 :                                 if (ek.isParallelTo(n0, float(1e-3))) {
+      82             :                                         // ek parallel to (1,1,1)
+      83             :                                         e1.setXYZ(-1., 1., 0);
+      84             :                                         e2.setXYZ(1., 1., -2.);
+      85             :                                 } else {
+      86             :                                         // ek not parallel to (1,1,1)
+      87             :                                         e1 = n0.cross(ek);
+      88             :                                         e2 = ek.cross(e1);
+      89             :                                 }
+      90             :                                 e1 /= e1.getR();
+      91             :                                 e2 /= e2.getR();
+      92             : 
+      93             :                                 // random orientation perpendicular to k
+      94      415069 :                                 double theta = 2 * M_PI * random.rand();
+      95      415069 :                                 Vector3f b = e1 * std::cos(theta) + e2 * std::sin(theta); // real b-field vector
+      96             : 
+      97             :                                 // normal distributed amplitude with mean = 0
+      98      415069 :                                 b *= std::sqrt(spectrum.energySpectrum(k*lambda));
+      99             :                                 
+     100             :                                 // uniform random phase
+     101      415069 :                                 double phase = 2 * M_PI * random.rand();
+     102      415069 :                                 double cosPhase = std::cos(phase); // real part
+     103      415069 :                                 double sinPhase = std::sin(phase); // imaginary part
+     104             : 
+     105      415069 :                                 Bkx[i][0] = b.x * cosPhase;
+     106      415069 :                                 Bkx[i][1] = b.x * sinPhase;
+     107      415069 :                                 Bky[i][0] = b.y * cosPhase;
+     108      415069 :                                 Bky[i][1] = b.y * sinPhase;
+     109      415069 :                                 Bkz[i][0] = b.z * cosPhase;
+     110      415069 :                                 Bkz[i][1] = b.z * sinPhase;
+     111             :                         } // for iz
+     112             :                 }     // for iy
+     113             :         }         // for ix
+     114             : 
+     115           6 :         executeInverseFFTInplace(gridPtr, Bkx, Bky, Bkz);
+     116             : 
+     117           6 :         fftwf_free(Bkx);
+     118           6 :         fftwf_free(Bky);
+     119           6 :         fftwf_free(Bkz);
+     120             : 
+     121          24 :         scaleGrid(gridPtr, spectrum.getBrms() /
+     122          12 :                                rmsFieldStrength(gridPtr)); // normalize to Brms
+     123          12 : }
+     124             : 
+     125             : // Check the grid properties before the FFT procedure
+     126          13 : void GridTurbulence::checkGridRequirements(ref_ptr<Grid3f> grid, double lMin,
+     127             :                                            double lMax) {
+     128             :         size_t Nx = grid->getNx();
+     129             :         size_t Ny = grid->getNy();
+     130             :         size_t Nz = grid->getNz();
+     131             :         Vector3d spacing = grid->getSpacing();
+     132             : 
+     133          13 :         if ((Nx != Ny) or (Ny != Nz))
+     134           0 :                 throw std::runtime_error("turbulentField: only cubic grid supported");
+     135          13 :         if ((spacing.x != spacing.y) or (spacing.y != spacing.z))
+     136           0 :                 throw std::runtime_error("turbulentField: only equal spacing suported");
+     137          13 :         if (lMin < 2 * spacing.x)
+     138           1 :                 throw std::runtime_error("turbulentField: lMin < 2 * spacing");
+     139          12 :         if (lMax > Nx * spacing.x) // before was (lMax > Nx * spacing.x / 2), why?
+     140           1 :                 throw std::runtime_error("turbulentField: lMax > size");
+     141          11 :         if (lMax < lMin) 
+     142           1 :                 throw std::runtime_error("lMax < lMin");
+     143          10 : }
+     144             : 
+     145             : // Execute inverse discrete FFT in-place for a 3D grid, from complex to real
+     146             : // space
+     147          10 : void GridTurbulence::executeInverseFFTInplace(ref_ptr<Grid3f> grid,
+     148             :                                               fftwf_complex *Bkx,
+     149             :                                               fftwf_complex *Bky,
+     150             :                                               fftwf_complex *Bkz) {
+     151             : 
+     152             :         size_t n = grid->getNx(); // size of array
+     153          10 :         size_t n2 = (size_t)floor(n / 2) +
+     154             :                     1; // size array in z-direction in configuration space
+     155             : 
+     156             :         // in-place, complex to real, inverse Fourier transformation on each
+     157             :         // component note that the last elements of B(x) are unused now
+     158             :         float *Bx = (float *)Bkx;
+     159          10 :         fftwf_plan plan_x = fftwf_plan_dft_c2r_3d(n, n, n, Bkx, Bx, FFTW_ESTIMATE);
+     160          10 :         fftwf_execute(plan_x);
+     161          10 :         fftwf_destroy_plan(plan_x);
+     162             : 
+     163             :         float *By = (float *)Bky;
+     164          10 :         fftwf_plan plan_y = fftwf_plan_dft_c2r_3d(n, n, n, Bky, By, FFTW_ESTIMATE);
+     165          10 :         fftwf_execute(plan_y);
+     166          10 :         fftwf_destroy_plan(plan_y);
+     167             : 
+     168             :         float *Bz = (float *)Bkz;
+     169          10 :         fftwf_plan plan_z = fftwf_plan_dft_c2r_3d(n, n, n, Bkz, Bz, FFTW_ESTIMATE);
+     170          10 :         fftwf_execute(plan_z);
+     171          10 :         fftwf_destroy_plan(plan_z);
+     172             : 
+     173             :         // save to grid
+     174         650 :         for (size_t ix = 0; ix < n; ix++) {
+     175       41600 :                 for (size_t iy = 0; iy < n; iy++) {
+     176     2662400 :                         for (size_t iz = 0; iz < n; iz++) {
+     177     2621440 :                                 size_t i = ix * n * 2 * n2 + iy * 2 * n2 + iz;
+     178             :                                 Vector3f &b = grid->get(ix, iy, iz);
+     179     2621440 :                                 b.x = Bx[i];
+     180     2621440 :                                 b.y = By[i];
+     181     2621440 :                                 b.z = Bz[i];
+     182             :                         }
+     183             :                 }
+     184             :         }
+     185          10 : }
+     186             : 
+     187           0 : Vector3f GridTurbulence::getMeanFieldVector() const {
+     188           0 :         return meanFieldVector(gridPtr);
+     189             : }
+     190             : 
+     191           0 : double GridTurbulence::getMeanFieldStrength() const {
+     192           0 :         return meanFieldStrength(gridPtr);
+     193             : }
+     194             : 
+     195           0 : double GridTurbulence::getRmsFieldStrength() const {
+     196           0 :         return rmsFieldStrength(gridPtr);
+     197             : }
+     198             : 
+     199           0 : std::array<float, 3> GridTurbulence::getRmsFieldStrengthPerAxis() const {
+     200           0 :         return rmsFieldStrengthPerAxis(gridPtr);
+     201             : }
+     202             :         
+     203           0 : std::vector<std::pair<int, float>> GridTurbulence::getPowerSpectrum() const {
+     204           0 :         return gridPowerSpectrum(gridPtr);
+     205             : }
+     206             : 
+     207           0 : void GridTurbulence::dumpToFile(std::string filename) const {
+     208           0 :         dumpGrid(gridPtr, filename);
+     209           0 : }
+     210             : 
+     211             : } // namespace crpropa
+     212             : 
+     213             : #endif // CRPROPA_HAVE_FFTW3F
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/turbulentField/HelicalGridTurbulence.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/turbulentField/HelicalGridTurbulence.cpp.func-sort-c.html new file mode 100644 index 000000000..ce798a6be --- /dev/null +++ b/doc/coverageReport/src/magneticField/turbulentField/HelicalGridTurbulence.cpp.func-sort-c.html @@ -0,0 +1,80 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/turbulentField/HelicalGridTurbulence.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField/turbulentField - HelicalGridTurbulence.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0590.0 %
Date:2024-04-08 14:58:22Functions:020.0 %
+
+ +
+ + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa21HelicalGridTurbulence14initTurbulenceENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEddddid0
_ZN7crpropa21HelicalGridTurbulenceC2ERKNS_24SimpleTurbulenceSpectrumERKNS_14GridPropertiesEdj0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/turbulentField/HelicalGridTurbulence.cpp.func.html b/doc/coverageReport/src/magneticField/turbulentField/HelicalGridTurbulence.cpp.func.html new file mode 100644 index 000000000..3a300bc05 --- /dev/null +++ b/doc/coverageReport/src/magneticField/turbulentField/HelicalGridTurbulence.cpp.func.html @@ -0,0 +1,80 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/turbulentField/HelicalGridTurbulence.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField/turbulentField - HelicalGridTurbulence.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0590.0 %
Date:2024-04-08 14:58:22Functions:020.0 %
+
+ +
+ + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa21HelicalGridTurbulence14initTurbulenceENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEddddid0
_ZN7crpropa21HelicalGridTurbulenceC2ERKNS_24SimpleTurbulenceSpectrumERKNS_14GridPropertiesEdj0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/turbulentField/HelicalGridTurbulence.cpp.gcov.html b/doc/coverageReport/src/magneticField/turbulentField/HelicalGridTurbulence.cpp.gcov.html new file mode 100644 index 000000000..4a3415bc2 --- /dev/null +++ b/doc/coverageReport/src/magneticField/turbulentField/HelicalGridTurbulence.cpp.gcov.html @@ -0,0 +1,206 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/turbulentField/HelicalGridTurbulence.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField/turbulentField - HelicalGridTurbulence.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0590.0 %
Date:2024-04-08 14:58:22Functions:020.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/magneticField/turbulentField/HelicalGridTurbulence.h"
+       2             : #include "crpropa/GridTools.h"
+       3             : #include "crpropa/Random.h"
+       4             : 
+       5             : #ifdef CRPROPA_HAVE_FFTW3F
+       6             : #include "fftw3.h"
+       7             : 
+       8             : namespace crpropa {
+       9             : 
+      10           0 : HelicalGridTurbulence::HelicalGridTurbulence(const SimpleTurbulenceSpectrum &spectrum,
+      11             :                                              const GridProperties &gridProp,
+      12           0 :                                              double H, unsigned int seed)
+      13           0 :     : SimpleGridTurbulence(spectrum, gridProp, seed), H(H) {
+      14           0 :         initTurbulence(gridPtr, spectrum.getBrms(), spectrum.getLmin(),
+      15           0 :                        spectrum.getLmax(), -spectrum.getSindex() - 2, seed, H);
+      16           0 : }
+      17             : 
+      18           0 : void HelicalGridTurbulence::initTurbulence(ref_ptr<Grid3f> grid, double Brms,
+      19             :                                            double lMin, double lMax,
+      20             :                                            double alpha, int seed, double H) {
+      21             : 
+      22           0 :         checkGridRequirements(grid, lMin, lMax);
+      23             : 
+      24             :         Vector3d spacing = grid->getSpacing();
+      25             :         size_t n = grid->getNx(); // size of array
+      26           0 :         size_t n2 = (size_t)floor(n / 2) +
+      27             :                     1; // size array in z-direction in configuration space
+      28             : 
+      29             :         // arrays to hold the complex vector components of the B(k)-field
+      30             :         fftwf_complex *Bkx, *Bky, *Bkz;
+      31           0 :         Bkx = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * n * n * n2);
+      32           0 :         Bky = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * n * n * n2);
+      33           0 :         Bkz = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * n * n * n2);
+      34             : 
+      35           0 :         Random random;
+      36           0 :         if (seed != 0)
+      37           0 :                 random.seed(seed); // use given seed
+      38             : 
+      39             :         // calculate the n possible discrete wave numbers
+      40           0 :         double K[n];
+      41           0 :         for (size_t i = 0; i < n; i++)
+      42           0 :                 K[i] = (double)i / n - i / (n / 2);
+      43             : 
+      44             :         // only used if there is a helicity
+      45             :         double Bktot, Bkplus, Bkminus, thetaplus, thetaminus;
+      46             : 
+      47           0 :         double kMin = spacing.x / lMax;
+      48           0 :         double kMax = spacing.x / lMin;
+      49             :         Vector3f b;           // real b-field vector
+      50             :         Vector3f ek, e1, e2;  // orthogonal base
+      51             :         Vector3f n0(1, 1, 1); // arbitrary vector to construct orthogonal base
+      52             : 
+      53           0 :         for (size_t ix = 0; ix < n; ix++) {
+      54           0 :                 for (size_t iy = 0; iy < n; iy++) {
+      55           0 :                         for (size_t iz = 0; iz < n2; iz++) {
+      56             : 
+      57           0 :                                 size_t i = ix * n * n2 + iy * n2 + iz;
+      58           0 :                                 ek.setXYZ(K[ix], K[iy], K[iz]);
+      59           0 :                                 double k = ek.getR();
+      60             : 
+      61             :                                 // wave outside of turbulent range -> B(k) = 0
+      62           0 :                                 if ((k < kMin) || (k > kMax)) {
+      63           0 :                                         Bkx[i][0] = 0;
+      64           0 :                                         Bkx[i][1] = 0;
+      65           0 :                                         Bky[i][0] = 0;
+      66           0 :                                         Bky[i][1] = 0;
+      67           0 :                                         Bkz[i][0] = 0;
+      68           0 :                                         Bkz[i][1] = 0;
+      69             :                                         continue;
+      70             :                                 }
+      71             : 
+      72             :                                 // construct an orthogonal base ek, e1, e2
+      73             :                                 // (for helical fields together with the real transform the
+      74             :                                 // following convention must be used: e1(-k) = e1(k), e2(-k) = -
+      75             :                                 // e2(k)
+      76           0 :                                 if (ek.getAngleTo(n0) < 1e-3) { // ek parallel to (1,1,1)
+      77             :                                         e1.setXYZ(-1, 1, 0);
+      78             :                                         e2.setXYZ(1, 1, -2);
+      79             :                                 } else { // ek not parallel to (1,1,1)
+      80             :                                         e1 = n0.cross(ek);
+      81             :                                         e2 = ek.cross(e1);
+      82             :                                 }
+      83             :                                 e1 /= e1.getR();
+      84             :                                 e2 /= e2.getR();
+      85             : 
+      86             : 
+      87           0 :                                 double Bkprefactor = mu0 / (4 * M_PI * pow(k, 3));
+      88           0 :                                 Bktot = fabs(random.randNorm() * pow(k, alpha / 2));
+      89           0 :                                 Bkplus = Bkprefactor * sqrt((1 + H) / 2) * Bktot;
+      90           0 :                                 Bkminus = Bkprefactor * sqrt((1 - H) / 2) * Bktot;
+      91           0 :                                 thetaplus = 2 * M_PI * random.rand();
+      92           0 :                                 thetaminus = 2 * M_PI * random.rand();
+      93           0 :                                 double ctp = cos(thetaplus);
+      94           0 :                                 double stp = sin(thetaplus);
+      95           0 :                                 double ctm = cos(thetaminus);
+      96           0 :                                 double stm = sin(thetaminus);
+      97             : 
+      98           0 :                                 Bkx[i][0] = ((Bkplus * ctp + Bkminus * ctm) * e1.x +
+      99           0 :                                              (-Bkplus * stp + Bkminus * stm) * e2.x) /
+     100             :                                             sqrt(2);
+     101           0 :                                 Bkx[i][1] = ((Bkplus * stp + Bkminus * stm) * e1.x +
+     102           0 :                                              (Bkplus * ctp - Bkminus * ctm) * e2.x) /
+     103             :                                             sqrt(2);
+     104           0 :                                 Bky[i][0] = ((Bkplus * ctp + Bkminus * ctm) * e1.y +
+     105           0 :                                              (-Bkplus * stp + Bkminus * stm) * e2.y) /
+     106             :                                             sqrt(2);
+     107           0 :                                 Bky[i][1] = ((Bkplus * stp + Bkminus * stm) * e1.y +
+     108           0 :                                              (Bkplus * ctp - Bkminus * ctm) * e2.y) /
+     109             :                                             sqrt(2);
+     110           0 :                                 Bkz[i][0] = ((Bkplus * ctp + Bkminus * ctm) * e1.z +
+     111           0 :                                              (-Bkplus * stp + Bkminus * stm) * e2.z) /
+     112             :                                             sqrt(2);
+     113           0 :                                 Bkz[i][1] = ((Bkplus * stp + Bkminus * stm) * e1.z +
+     114           0 :                                              (Bkplus * ctp - Bkminus * ctm) * e2.z) /
+     115             :                                             sqrt(2);
+     116             : 
+     117             :                                 Vector3f BkRe(Bkx[i][0], Bky[i][0], Bkz[i][0]);
+     118             :                                 Vector3f BkIm(Bkx[i][1], Bky[i][1], Bkz[i][1]);
+     119             :                         } // for iz
+     120             :                 }     // for iy
+     121             :         }         // for ix
+     122             : 
+     123           0 :         executeInverseFFTInplace(grid, Bkx, Bky, Bkz);
+     124             : 
+     125           0 :         scaleGrid(grid, Brms / rmsFieldStrength(grid)); // normalize to Brms
+     126           0 : }
+     127             : 
+     128             : } // namespace crpropa
+     129             : 
+     130             : #endif // CRPROPA_HAVE_FFTW3F
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/turbulentField/PlaneWaveTurbulence.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/turbulentField/PlaneWaveTurbulence.cpp.func-sort-c.html new file mode 100644 index 000000000..ecbe74169 --- /dev/null +++ b/doc/coverageReport/src/magneticField/turbulentField/PlaneWaveTurbulence.cpp.func-sort-c.html @@ -0,0 +1,80 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/turbulentField/PlaneWaveTurbulence.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField/turbulentField - PlaneWaveTurbulence.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:464895.8 %
Date:2024-04-08 14:58:22Functions:22100.0 %
+
+ +
+ + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa19PlaneWaveTurbulenceC2ERKNS_18TurbulenceSpectrumEii2
_ZNK7crpropa19PlaneWaveTurbulence8getFieldERKNS_7Vector3IdEE45
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/turbulentField/PlaneWaveTurbulence.cpp.func.html b/doc/coverageReport/src/magneticField/turbulentField/PlaneWaveTurbulence.cpp.func.html new file mode 100644 index 000000000..3a3efe0af --- /dev/null +++ b/doc/coverageReport/src/magneticField/turbulentField/PlaneWaveTurbulence.cpp.func.html @@ -0,0 +1,80 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/turbulentField/PlaneWaveTurbulence.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField/turbulentField - PlaneWaveTurbulence.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:464895.8 %
Date:2024-04-08 14:58:22Functions:22100.0 %
+
+ +
+ + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa19PlaneWaveTurbulenceC2ERKNS_18TurbulenceSpectrumEii2
_ZNK7crpropa19PlaneWaveTurbulence8getFieldERKNS_7Vector3IdEE45
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/turbulentField/PlaneWaveTurbulence.cpp.gcov.html b/doc/coverageReport/src/magneticField/turbulentField/PlaneWaveTurbulence.cpp.gcov.html new file mode 100644 index 000000000..0344bde9e --- /dev/null +++ b/doc/coverageReport/src/magneticField/turbulentField/PlaneWaveTurbulence.cpp.gcov.html @@ -0,0 +1,517 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/turbulentField/PlaneWaveTurbulence.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField/turbulentField - PlaneWaveTurbulence.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:464895.8 %
Date:2024-04-08 14:58:22Functions:22100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : // This file contains an implementation of a vectorized cosine, which
+       2             : // is based in part on the implementations in the library "SLEEF" by
+       3             : // Naoki Shibata. SLEEF was used under the Boost Software License,
+       4             : // Version 1.0. The original source file contained the following
+       5             : // copyright notice:
+       6             : //
+       7             : //   //          Copyright Naoki Shibata 2010 - 2018.
+       8             : //   // Distributed under the Boost Software License, Version 1.0.
+       9             : //   //    (See accompanying file LICENSE.txt or copy at
+      10             : //   //          http://www.boost.org/LICENSE_1_0.txt)
+      11             : //
+      12             : // SLEEF was used under the following license, which is not necessarily the
+      13             : // license that applies to this file:
+      14             : //
+      15             : //         Boost Software License - Version 1.0 - August 17th, 2003
+      16             : //
+      17             : //         Permission is hereby granted, free of charge, to any person or
+      18             : //         organization obtaining a copy of the software and accompanying
+      19             : //         documentation covered by this license (the "Software") to use,
+      20             : //         reproduce, display, distribute, execute, and transmit the Software,
+      21             : //         and to prepare derivative works of the Software, and to permit
+      22             : //         third-parties to whom the Software is furnished to do so, all subject
+      23             : //         to the following:
+      24             : //
+      25             : //         The copyright notices in the Software and this entire statement,
+      26             : //         including the above license grant, this restriction and the following
+      27             : //         disclaimer, must be included in all copies of the Software, in whole
+      28             : //         or in part, and all derivative works of the Software, unless such
+      29             : //         copies or derivative works are solely in the form of
+      30             : //         machine-executable object code generated by a source language
+      31             : //         processor.
+      32             : //
+      33             : //         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+      34             : //         EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+      35             : //         MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
+      36             : //         NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE
+      37             : //         DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER
+      38             : //         LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
+      39             : //         OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+      40             : //         THE SOFTWARE.
+      41             : 
+      42             : #include "crpropa/magneticField/turbulentField/PlaneWaveTurbulence.h"
+      43             : #include "crpropa/GridTools.h"
+      44             : #include "crpropa/Random.h"
+      45             : #include "crpropa/Units.h"
+      46             : 
+      47             : #include "kiss/logger.h"
+      48             : 
+      49             : #include <iostream>
+      50             : 
+      51             : #if defined(FAST_WAVES)
+      52             : #if defined(__SSE__) && defined(__SSE2__) && defined(__SSE3__) && defined(__SSE4_1__) && defined(__SSE4_2__) && defined(__AVX__)
+      53             : #define ENABLE_FAST_WAVES
+      54             : #else
+      55             : #error "FAST_WAVES is enabled, but it appears that not all required SIMD extensions are enabled in the compiler. Without these extensions, the FAST_WAVES optimization cannot be used. Please make sure that the SIMD_EXTENSIONS option in cmake matches the capabilities of your target CPU, or (if your target CPU does not support the required extensions), disable the FAST_WAVES flag in cmake."
+      56             : #endif
+      57             : #endif
+      58             : 
+      59             : 
+      60             : #ifdef ENABLE_FAST_WAVES
+      61             : #include <immintrin.h>
+      62             : #endif
+      63             : 
+      64             : namespace crpropa {
+      65             : #ifdef ENABLE_FAST_WAVES
+      66             : // see
+      67             : // https://stackoverflow.com/questions/49941645/get-sum-of-values-stored-in-m256d-with-sse-avx
+      68             : double hsum_double_avx(__m256d v) {
+      69             :         __m128d vlow = _mm256_castpd256_pd128(v);
+      70             :         __m128d vhigh = _mm256_extractf128_pd(v, 1); // high 128
+      71             :         vlow = _mm_add_pd(vlow, vhigh);              // reduce down to 128
+      72             : 
+      73             :         __m128d high64 = _mm_unpackhi_pd(vlow, vlow);
+      74             :         return _mm_cvtsd_f64(_mm_add_sd(vlow, high64)); // reduce to scalar
+      75             : }
+      76             : #endif // defined(ENABLE_FAST_WAVES)
+      77             : 
+      78           2 : PlaneWaveTurbulence::PlaneWaveTurbulence(const TurbulenceSpectrum &spectrum,
+      79           2 :                                          int Nm, int seed)
+      80           2 :     : TurbulentField(spectrum), Nm(Nm) {
+      81             : 
+      82             : #ifdef ENABLE_FAST_WAVES
+      83             :         KISS_LOG_INFO << "PlaneWaveTurbulence: Using SIMD TD13 implementation"
+      84             :                       << std::endl;
+      85             : 
+      86             :         // There used to be a cpuid check here, to see if the cpu running
+      87             :         // this code would support SIMD (SSE + AVX). However, the library providing
+      88             :         // the relevant function is no longer being used, and doing this manually
+      89             :         // might be a bit too much work.
+      90             : #endif
+      91             : 
+      92           2 :         if (Nm <= 1) {
+      93           0 :                 throw std::runtime_error(
+      94             :                     "PlaneWaveTurbulence: Nm <= 1. Specify at least two wavemodes in "
+      95           0 :                     "order to generate the k distribution properly.");
+      96             :         }
+      97             : 
+      98           2 :         Random random;
+      99           2 :         if (seed != 0)
+     100           2 :                 random.seed(seed);
+     101             : 
+     102           2 :         double kmax = 2 * M_PI / spectrum.getLmin();
+     103           2 :         double kmin = 2 * M_PI / spectrum.getLmax();
+     104             : 
+     105           4 :         xi = std::vector<Vector3d>(Nm, Vector3d(0.));
+     106           4 :         kappa = std::vector<Vector3d>(Nm, Vector3d(0.));
+     107           2 :         phi = std::vector<double>(Nm, 0.);
+     108           2 :         costheta = std::vector<double>(Nm, 0.);
+     109           2 :         beta = std::vector<double>(Nm, 0.);
+     110           2 :         Ak = std::vector<double>(Nm, 0.);
+     111           2 :         k = std::vector<double>(Nm, 0.);
+     112             : 
+     113           2 :         double delta = log10(kmax / kmin);
+     114          22 :         for (int i = 0; i < Nm; i++) {
+     115          20 :                 k[i] = pow(10, log10(kmin) + ((double)i) / ((double)(Nm - 1)) * delta);
+     116             :         }
+     117             : 
+     118             :         // * compute Ak *
+     119             : 
+     120             :         double delta_k0 =
+     121           2 :             (k[1] - k[0]) / k[1]; // multiply this by k[i] to get delta_k[i]
+     122             :         // Note: this is probably unnecessary since it's just a factor
+     123             :         // and will get normalized out anyways. It's not like this is
+     124             :         // performance-sensitive code though, and I don't want to change
+     125             :         // anything numerical now.
+     126             : 
+     127             :         // For this loop, the Ak array actually contains Gk*delta_k (ie
+     128             :         // non-normalized Ak^2). Normalization happens in a second loop,
+     129             :         // once the total is known.
+     130             :         double Ak2_sum = 0; // sum of Ak^2 over all k
+     131          22 :         for (int i = 0; i < Nm; i++) {
+     132          20 :                 double k = this->k[i];
+     133          20 :                 double kHat = k * spectrum.getLbendover();
+     134          20 :                 double Gk = spectrum.energySpectrum(k) * (1 + kHat * kHat);     // correct different implementation in TD 13 (eq. 5, missing + 1 in the denuminators exponent)
+     135          20 :                 Ak[i] = Gk * delta_k0 * k;
+     136          20 :                 Ak2_sum += Ak[i];
+     137             : 
+     138             :                 // phi, costheta, and sintheta are for drawing vectors with
+     139             :                 // uniform distribution on the unit sphere.
+     140             :                 // This is similar to Random::randVector(): their t is our phi,
+     141             :                 // z is costheta, and r is sintheta. Our kappa is equivalent to
+     142             :                 // the return value of randVector(); however, TD13 then reuse
+     143             :                 // these values to generate a random vector perpendicular to kappa.
+     144          20 :                 double phi = random.randUniform(-M_PI, M_PI);
+     145          20 :                 double costheta = random.randUniform(-1., 1.);
+     146          20 :                 double sintheta = sqrt(1 - costheta * costheta);
+     147             : 
+     148          20 :                 double alpha = random.randUniform(0, 2 * M_PI);
+     149          20 :                 double beta = random.randUniform(0, 2 * M_PI);
+     150             : 
+     151             :                 Vector3d kappa =
+     152          20 :                     Vector3d(sintheta * cos(phi), sintheta * sin(phi), costheta);
+     153             : 
+     154             :                 // NOTE: all other variable names match the ones from the TD13 paper.
+     155             :                 // However, our xi is actually their psi, and their xi isn't used at
+     156             :                 // all. (Though both can be used for the polarization vector, according
+     157             :                 // to the paper.) The reason for this discrepancy is that this code
+     158             :                 // used to be based on the original GJ99 paper, which provided only a
+     159             :                 // xi vector, and this xi happens to be almost the same as TD13's psi.
+     160             :                 Vector3d xi =
+     161          20 :                     Vector3d(costheta * cos(phi) * cos(alpha) + sin(phi) * sin(alpha),
+     162          20 :                              costheta * sin(phi) * cos(alpha) - cos(phi) * sin(alpha),
+     163          20 :                              -sintheta * cos(alpha));
+     164             : 
+     165             :                 this->xi[i] = xi;
+     166             :                 this->kappa[i] = kappa;
+     167          20 :                 this->phi[i] = phi;
+     168          20 :                 this->costheta[i] = costheta;
+     169          20 :                 this->beta[i] = beta;
+     170             :         }
+     171             : 
+     172             :         // Only in this loop are the actual Ak computed and stored.
+     173             :         // This two-step process is necessary in order to normalize the values
+     174             :         // properly.
+     175          22 :         for (int i = 0; i < Nm; i++) {
+     176          20 :                 Ak[i] = sqrt(2 * Ak[i] / Ak2_sum) * spectrum.getBrms();
+     177             :         }
+     178             : 
+     179             : #ifdef ENABLE_FAST_WAVES
+     180             :         // * copy data into AVX-compatible arrays *
+     181             :         //
+     182             :         // AVX requires all data to be aligned to 256 bit, or 32 bytes, which is the
+     183             :         // same as 4 double precision floating point numbers. Since support for
+     184             :         // alignments this big seems to be somewhat tentative in C++ allocators,
+     185             :         // we're aligning them manually by allocating a normal double array, and
+     186             :         // then computing the offset to the first value with the correct alignment.
+     187             :         // This is a little bit of work, so instead of doing it separately for each
+     188             :         // of the individual data arrays, we're doing it once for one big array that
+     189             :         // all of the component arrays get packed into.
+     190             :         //
+     191             :         // The other thing to keep in mind is that AVX always reads in units of 256
+     192             :         // bits, or 4 doubles. This means that our number of wavemodes must be
+     193             :         // divisible by 4. If it isn't, we simply pad it out with zeros. Since the
+     194             :         // final step of the computation of each wavemode is multiplication by the
+     195             :         // amplitude, which will be set to 0, these padding wavemodes won't affect
+     196             :         // the result.
+     197             : 
+     198             :         avx_Nm = ((Nm + 4 - 1) / 4) * 4; // round up to next larger multiple of 4:
+     199             :                                          // align is 256 = 4 * sizeof(double) bit
+     200             :         avx_data = std::vector<double>(itotal * avx_Nm + 3, 0.);
+     201             : 
+     202             :         // get the first 256-bit aligned element
+     203             :         size_t size = avx_data.size() * sizeof(double);
+     204             :         void *pointer = avx_data.data();
+     205             :         align_offset =
+     206             :             (double *)std::align(32, 32, pointer, size) - avx_data.data();
+     207             : 
+     208             :         // copy into the AVX arrays
+     209             :         for (int i = 0; i < Nm; i++) {
+     210             :                 avx_data[i + align_offset + avx_Nm * iAxi0] = Ak[i] * xi[i].x;
+     211             :                 avx_data[i + align_offset + avx_Nm * iAxi1] = Ak[i] * xi[i].y;
+     212             :                 avx_data[i + align_offset + avx_Nm * iAxi2] = Ak[i] * xi[i].z;
+     213             : 
+     214             :                 // The cosine implementation computes cos(pi*x), so we'll divide out the
+     215             :                 // pi here.
+     216             :                 avx_data[i + align_offset + avx_Nm * ikkappa0] =
+     217             :                     k[i] / M_PI * kappa[i].x;
+     218             :                 avx_data[i + align_offset + avx_Nm * ikkappa1] =
+     219             :                     k[i] / M_PI * kappa[i].y;
+     220             :                 avx_data[i + align_offset + avx_Nm * ikkappa2] =
+     221             :                     k[i] / M_PI * kappa[i].z;
+     222             : 
+     223             :                 // We also need to divide beta by pi, since that goes into the argument
+     224             :                 // of the cosine as well.
+     225             :                 avx_data[i + align_offset + avx_Nm * ibeta] = beta[i] / M_PI;
+     226             :         }
+     227             : #endif // ENABLE_FAST_WAVES
+     228           2 : }
+     229             : 
+     230          45 : Vector3d PlaneWaveTurbulence::getField(const Vector3d &pos) const {
+     231             : 
+     232             : #ifndef ENABLE_FAST_WAVES
+     233             :         Vector3d B(0.);
+     234         495 :         for (int i = 0; i < Nm; i++) {
+     235         450 :                 double z_ = pos.dot(kappa[i]);
+     236         450 :                 B += xi[i] * Ak[i] * cos(k[i] * z_ + beta[i]);
+     237             :         }
+     238          45 :         return B;
+     239             : 
+     240             : #else  // ENABLE_FAST_WAVES
+     241             : 
+     242             :         // Initialize accumulators
+     243             :         //
+     244             :         // There is one accumulator per component of the result vector.
+     245             :         // Note that each accumulator contains four numbers. At the end of
+     246             :         // the loop, each of these numbers will contain the sum of every
+     247             :         // fourth wavemode, starting at a different offset. In the end, each
+     248             :         // of the accumulator's numbers are added together (using
+     249             :         // hsum_double_avx), resulting in the total sum for that component.
+     250             : 
+     251             :         __m256d acc0 = _mm256_setzero_pd();
+     252             :         __m256d acc1 = _mm256_setzero_pd();
+     253             :         __m256d acc2 = _mm256_setzero_pd();
+     254             : 
+     255             :         // broadcast position into AVX registers
+     256             :         __m256d pos0 = _mm256_set1_pd(pos.x);
+     257             :         __m256d pos1 = _mm256_set1_pd(pos.y);
+     258             :         __m256d pos2 = _mm256_set1_pd(pos.z);
+     259             : 
+     260             :         for (int i = 0; i < avx_Nm; i += 4) {
+     261             : 
+     262             :                 // Load data from memory into AVX registers:
+     263             :                 //  - the three components of the vector A * xi
+     264             :                 __m256d Axi0 =
+     265             :                     _mm256_load_pd(avx_data.data() + i + align_offset + avx_Nm * iAxi0);
+     266             :                 __m256d Axi1 =
+     267             :                     _mm256_load_pd(avx_data.data() + i + align_offset + avx_Nm * iAxi1);
+     268             :                 __m256d Axi2 =
+     269             :                     _mm256_load_pd(avx_data.data() + i + align_offset + avx_Nm * iAxi2);
+     270             : 
+     271             :                 //  - the three components of the vector k * kappa
+     272             :                 __m256d kkappa0 = _mm256_load_pd(avx_data.data() + i + align_offset +
+     273             :                                                  avx_Nm * ikkappa0);
+     274             :                 __m256d kkappa1 = _mm256_load_pd(avx_data.data() + i + align_offset +
+     275             :                                                  avx_Nm * ikkappa1);
+     276             :                 __m256d kkappa2 = _mm256_load_pd(avx_data.data() + i + align_offset +
+     277             :                                                  avx_Nm * ikkappa2);
+     278             : 
+     279             :                 //  - the phase beta.
+     280             :                 __m256d beta =
+     281             :                     _mm256_load_pd(avx_data.data() + i + align_offset + avx_Nm * ibeta);
+     282             : 
+     283             :                 // Then, do the computation.
+     284             : 
+     285             :                 // This is the scalar product between k*kappa and pos:
+     286             :                 __m256d z = _mm256_add_pd(_mm256_mul_pd(pos0, kkappa0),
+     287             :                                           _mm256_add_pd(_mm256_mul_pd(pos1, kkappa1),
+     288             :                                                         _mm256_mul_pd(pos2, kkappa2)));
+     289             : 
+     290             :                 // Here, the phase is added on. This is the argument of the cosine.
+     291             :                 __m256d cos_arg = _mm256_add_pd(z, beta);
+     292             : 
+     293             :                 // ********
+     294             :                 // * Computing the cosine
+     295             :                 // * Part 1: Argument reduction
+     296             :                 //
+     297             :                 //  To understand the computation of the cosine, first note that the
+     298             :                 //  cosine is periodic and we thus only need to model its behavior
+     299             :                 //  between 0 and 2*pi to be able compute the function anywhere. In
+     300             :                 //  fact, by mirroring the function along the x and y axes, even the
+     301             :                 //  range between 0 and pi/2 is sufficient for this purpose. In this
+     302             :                 //  range, the cosine can be efficiently evaluated with high precision
+     303             :                 //  by using a polynomial approximation. Thus, to compute the cosine,
+     304             :                 //  the input value is first reduced so that it lies within this range.
+     305             :                 //  Then, the polynomial approximation is evaluated. Finally, if
+     306             :                 //  necessary, the sign of the result is flipped (mirroring the function
+     307             :                 //  along the x axis).
+     308             :                 //
+     309             :                 //  The actual computation is slightly more involved. First, argument
+     310             :                 //  reduction can be simplified drastically by computing cos(pi*x),
+     311             :                 //  such that the values are reduced to the range [0, 0.5) instead of
+     312             :                 //  [0, pi/2). Since the cosine is even (independent of the sign), we
+     313             :                 //  can first reduce values to [-0.5, 0.5) – that is, a simple rounding
+     314             :                 //  operation – and then neutralize the sign. In fact, precisely because
+     315             :                 //  the cosine is even, all terms of the polynomial are powers of x^2,
+     316             :                 //  so the value of x^2 (computed as x*x) forms the basis for the
+     317             :                 //  polynomial approximation. If I understand things correctly, then (in
+     318             :                 //  IEEE-754 floating point) x*x and (-x)*(-x) will always result in the
+     319             :                 //  exact same value, which means that any error bound over [0, 0.5)
+     320             :                 //  automatically applies to (-0.5, 0] as well.
+     321             : 
+     322             :                 // First, compute round(x), and store it in q. If this value is odd,
+     323             :                 // we're looking at the negative half-wave of the cosine, and thus
+     324             :                 // will have to invert the sign of the result.
+     325             :                 __m256d q = _mm256_round_pd(
+     326             :                     cos_arg, (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC));
+     327             : 
+     328             :                 // Since we're computing cos(pi*x), round(x) always yields the center of
+     329             :                 // a half-wave (where cos(pi*x) achieves an extremum). This point
+     330             :                 // logically corresponds to x=0. Therefore, we subtract this center from
+     331             :                 // the actual input argument to find the corresponding point on the
+     332             :                 // half-wave that is centered around zero.
+     333             :                 __m256d s = _mm256_sub_pd(cos_arg, q);
+     334             : 
+     335             :                 // We now want to check whether q (the index of our half-wave) is even
+     336             :                 // or odd, since all of the odd-numbered half-waves are negative, so
+     337             :                 // we'll have to flip the final result. On an int, this is as simple as
+     338             :                 // checking the 0th bit. Idea: manipulate the double in such a way that
+     339             :                 // we can do this. So, we add 2^52, such that the last digit of the
+     340             :                 // mantissa is actually in the ones' position. Since q may be negative,
+     341             :                 // we'll also add 2^51 to make sure it's positive. Note that 2^51 is
+     342             :                 // even and thus leaves evenness invariant, which is the only thing we
+     343             :                 // care about here.
+     344             :                 //
+     345             :                 // This is based on the int extraction process described here:
+     346             :                 // https://stackoverflow.com/questions/41144668/how-to-efficiently-perform-double-int64-conversions-with-sse-avx/41223013
+     347             :                 //
+     348             :                 // We assume -2^51 <= q < 2^51 for this, which is unproblematic, as
+     349             :                 // double precision has decayed far enough at that point that the
+     350             :                 // usefulness of the cosine becomes limited.
+     351             :                 //
+     352             :                 // Explanation: The mantissa of a double-precision float has 52 bits
+     353             :                 // (excluding the implicit first bit, which is always one). If |q| >
+     354             :                 // 2^51, this implicit first bit has a place value of at least 2^51,
+     355             :                 // while the first stored bit of the mantissa has a place value of at
+     356             :                 // least 2^50. This means that the LSB of the mantissa has a place value
+     357             :                 // of at least 2^(-1), or 0.5. For a cos(pi*x), this corresponds to a
+     358             :                 // quarter of a cycle (pi/2), so at this point the precision of the
+     359             :                 // input argument is so low that going from one representable number to
+     360             :                 // the next causes the result to jump by +/-1.
+     361             : 
+     362             :                 q = _mm256_add_pd(q, _mm256_set1_pd(0x0018000000000000));
+     363             : 
+     364             :                 // Unfortunately, integer comparisons were only introduced in AVX2, so
+     365             :                 // we'll have to make do with a floating point comparison to check
+     366             :                 // whether the last bit is set. However, masking out all but the last
+     367             :                 // bit will result in a denormal float, which may either result in
+     368             :                 // performance problems or just be rounded down to zero, neither of
+     369             :                 // which is what we want here. To fix this, we'll mask in not only bit
+     370             :                 // 0, but also the exponent (and sign, but that doesn't matter) of q.
+     371             :                 // Luckily, the exponent of q is guaranteed to have the fixed value of
+     372             :                 // 1075 (corresponding to 2^52) after our addition.
+     373             : 
+     374             :                 __m256d invert = _mm256_and_pd(
+     375             :                     q, _mm256_castsi256_pd(_mm256_set1_epi64x(0xfff0000000000001)));
+     376             : 
+     377             :                 // If we did have a one in bit 0, our result will be equal to 2^52 + 1.
+     378             :                 invert = _mm256_cmp_pd(
+     379             :                     invert, _mm256_castsi256_pd(_mm256_set1_epi64x(0x4330000000000001)),
+     380             :                     _CMP_EQ_OQ);
+     381             : 
+     382             :                 // Now we know whether to flip the sign of the result. However, remember
+     383             :                 // that we're working on multiple values at a time, so an if statement
+     384             :                 // won't be of much use here (plus it might perform badly). Instead,
+     385             :                 // we'll make use of the fact that the result of the comparison is all
+     386             :                 // ones if the comparison was true (i.e. q is odd and we need to flip
+     387             :                 // the result), and all zeroes otherwise. If we now mask out all bits
+     388             :                 // except the sign bit, we get something that, when xor'ed into our
+     389             :                 // final result, will flip the sign exactly when q is odd.
+     390             :                 invert = _mm256_and_pd(invert, _mm256_set1_pd(-0.0));
+     391             :                 // (Note that the binary representation of -0.0 is all 0 bits, except
+     392             :                 // for the sign bit, which is set to 1.)
+     393             : 
+     394             :                 // TODO: clamp floats between 0 and 1? This would ensure that we never
+     395             :                 // see inf's, but maybe we want that, so that things dont just fail
+     396             :                 // silently...
+     397             : 
+     398             :                 // * end of argument reduction
+     399             :                 // *******
+     400             : 
+     401             :                 // ******
+     402             :                 // * Evaluate the cosine using a polynomial approximation for the zeroth
+     403             :                 // half-wave.
+     404             :                 // * The coefficients for this were generated using sleefs gencoef.c.
+     405             :                 // * These coefficients are probably far from optimal; however, they
+     406             :                 // should be sufficient for this case.
+     407             :                 s = _mm256_mul_pd(s, s);
+     408             : 
+     409             :                 __m256d u = _mm256_set1_pd(+0.2211852080653743946e+0);
+     410             : 
+     411             :                 u = _mm256_add_pd(_mm256_mul_pd(u, s),
+     412             :                                   _mm256_set1_pd(-0.1332560668688523853e+1));
+     413             :                 u = _mm256_add_pd(_mm256_mul_pd(u, s),
+     414             :                                   _mm256_set1_pd(+0.4058509506474178075e+1));
+     415             :                 u = _mm256_add_pd(_mm256_mul_pd(u, s),
+     416             :                                   _mm256_set1_pd(-0.4934797516664651162e+1));
+     417             :                 u = _mm256_add_pd(_mm256_mul_pd(u, s), _mm256_set1_pd(1.));
+     418             : 
+     419             :                 // Then, flip the sign of each double for which invert is not zero.
+     420             :                 // Since invert has only zero bits except for a possible one in bit 63,
+     421             :                 // we can xor it onto our result to selectively invert the 63rd (sign)
+     422             :                 // bit in each double where invert is set.
+     423             :                 u = _mm256_xor_pd(u, invert);
+     424             : 
+     425             :                 // * end computation of cosine
+     426             :                 // **********
+     427             : 
+     428             :                 // Finally, Ak*xi is multiplied on. Since this is a vector, the
+     429             :                 // multiplication needs to be done for each of the three
+     430             :                 // components, so it happens separately.
+     431             :                 acc0 = _mm256_add_pd(_mm256_mul_pd(u, Axi0), acc0);
+     432             :                 acc1 = _mm256_add_pd(_mm256_mul_pd(u, Axi1), acc1);
+     433             :                 acc2 = _mm256_add_pd(_mm256_mul_pd(u, Axi2), acc2);
+     434             :         }
+     435             : 
+     436             :         return Vector3d(hsum_double_avx(acc0), hsum_double_avx(acc1),
+     437             :                         hsum_double_avx(acc2));
+     438             : #endif // ENABLE_FAST_WAVES
+     439             : }
+     440             : 
+     441             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/turbulentField/SimpleGridTurbulence.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/turbulentField/SimpleGridTurbulence.cpp.func-sort-c.html new file mode 100644 index 000000000..02289b77c --- /dev/null +++ b/doc/coverageReport/src/magneticField/turbulentField/SimpleGridTurbulence.cpp.func-sort-c.html @@ -0,0 +1,80 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/turbulentField/SimpleGridTurbulence.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField/turbulentField - SimpleGridTurbulence.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:5252100.0 %
Date:2024-04-08 14:58:22Functions:22100.0 %
+
+ +
+ + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa20SimpleGridTurbulenceC2ERKNS_24SimpleTurbulenceSpectrumERKNS_14GridPropertiesEj3
_ZN7crpropa20SimpleGridTurbulence14initTurbulenceENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEddddi7
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/turbulentField/SimpleGridTurbulence.cpp.func.html b/doc/coverageReport/src/magneticField/turbulentField/SimpleGridTurbulence.cpp.func.html new file mode 100644 index 000000000..55d106e43 --- /dev/null +++ b/doc/coverageReport/src/magneticField/turbulentField/SimpleGridTurbulence.cpp.func.html @@ -0,0 +1,80 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/turbulentField/SimpleGridTurbulence.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField/turbulentField - SimpleGridTurbulence.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:5252100.0 %
Date:2024-04-08 14:58:22Functions:22100.0 %
+
+ +
+ + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa20SimpleGridTurbulence14initTurbulenceENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEddddi7
_ZN7crpropa20SimpleGridTurbulenceC2ERKNS_24SimpleTurbulenceSpectrumERKNS_14GridPropertiesEj3
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/turbulentField/SimpleGridTurbulence.cpp.gcov.html b/doc/coverageReport/src/magneticField/turbulentField/SimpleGridTurbulence.cpp.gcov.html new file mode 100644 index 000000000..a0b831617 --- /dev/null +++ b/doc/coverageReport/src/magneticField/turbulentField/SimpleGridTurbulence.cpp.gcov.html @@ -0,0 +1,193 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/turbulentField/SimpleGridTurbulence.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField/turbulentField - SimpleGridTurbulence.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:5252100.0 %
Date:2024-04-08 14:58:22Functions:22100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/magneticField/turbulentField/SimpleGridTurbulence.h"
+       2             : #include "crpropa/GridTools.h"
+       3             : #include "crpropa/Random.h"
+       4             : 
+       5             : #ifdef CRPROPA_HAVE_FFTW3F
+       6             : #include "fftw3.h"
+       7             : 
+       8             : namespace crpropa {
+       9             : 
+      10           3 : SimpleGridTurbulence::SimpleGridTurbulence(const SimpleTurbulenceSpectrum &spectrum,
+      11             :                                            const GridProperties &gridProp,
+      12           3 :                                            unsigned int seed)
+      13           3 :     : GridTurbulence(spectrum, gridProp, seed) {
+      14           6 :         initTurbulence(gridPtr, spectrum.getBrms(), spectrum.getLmin(),
+      15           3 :                        spectrum.getLmax(), -spectrum.getSindex() - 2, seed);
+      16           3 : }
+      17             : 
+      18           7 : void SimpleGridTurbulence::initTurbulence(ref_ptr<Grid3f> grid, double Brms,
+      19             :                                           double lMin, double lMax,
+      20             :                                           double alpha, int seed) {
+      21             :         
+      22             :         Vector3d spacing = grid->getSpacing();
+      23             : 
+      24          11 :         checkGridRequirements(grid, lMin, lMax);
+      25             : 
+      26             :         size_t n = grid->getNx(); // size of array
+      27           4 :         size_t n2 = (size_t)floor(n / 2) +
+      28             :                     1; // size array in z-direction in configuration space
+      29             : 
+      30             :         // arrays to hold the complex vector components of the B(k)-field
+      31             :         fftwf_complex *Bkx, *Bky, *Bkz;
+      32           4 :         Bkx = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * n * n * n2);
+      33           4 :         Bky = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * n * n * n2);
+      34           4 :         Bkz = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * n * n * n2);
+      35             : 
+      36           4 :         Random random;
+      37           4 :         if (seed != 0)
+      38           2 :                 random.seed(seed); // use given seed
+      39             : 
+      40             :         // calculate the n possible discrete wave numbers
+      41           4 :         double K[n];
+      42         260 :         for (size_t i = 0; i < n; i++)
+      43         256 :                 K[i] = (double)i / n - i / (n / 2);
+      44             : 
+      45           4 :         double kMin = spacing.x / lMax;
+      46           4 :         double kMax = spacing.x / lMin;
+      47             :         Vector3f n0(1, 1, 1); // arbitrary vector to construct orthogonal base
+      48             : 
+      49         260 :         for (size_t ix = 0; ix < n; ix++) {
+      50       16640 :                 for (size_t iy = 0; iy < n; iy++) {
+      51      557056 :                         for (size_t iz = 0; iz < n2; iz++) {
+      52             :         
+      53             :                                 Vector3f ek, e1, e2;  // orthogonal base
+      54             : 
+      55      540672 :                                 size_t i = ix * n * n2 + iy * n2 + iz;
+      56      540672 :                                 ek.setXYZ(K[ix], K[iy], K[iz]);
+      57      540672 :                                 double k = ek.getR();
+      58             : 
+      59             :                                 // wave outside of turbulent range -> B(k) = 0
+      60      540672 :                                 if ((k < kMin) || (k > kMax)) {
+      61      264724 :                                         Bkx[i][0] = 0;
+      62      264724 :                                         Bkx[i][1] = 0;
+      63      264724 :                                         Bky[i][0] = 0;
+      64      264724 :                                         Bky[i][1] = 0;
+      65      264724 :                                         Bkz[i][0] = 0;
+      66      264724 :                                         Bkz[i][1] = 0;
+      67             :                                         continue;
+      68             :                                 }
+      69             : 
+      70             :                                 // construct an orthogonal base ek, e1, e2
+      71      275948 :                                 if (ek.isParallelTo(n0, float(1e-3))) {
+      72             :                                         // ek parallel to (1,1,1)
+      73             :                                         e1.setXYZ(-1., 1., 0);
+      74             :                                         e2.setXYZ(1., 1., -2.);
+      75             :                                 } else {
+      76             :                                         // ek not parallel to (1,1,1)
+      77             :                                         e1 = n0.cross(ek);
+      78             :                                         e2 = ek.cross(e1);
+      79             :                                 }
+      80             :                                 e1 /= e1.getR();
+      81             :                                 e2 /= e2.getR();
+      82             : 
+      83             :                                 // random orientation perpendicular to k
+      84      275948 :                                 double theta = 2 * M_PI * random.rand();
+      85      275948 :                                 Vector3f b = e1 * cos(theta) + e2 * sin(theta); // real b-field vector
+      86             : 
+      87             :                                 // normal distributed amplitude with mean = 0 and sigma =
+      88             :                                 // k^alpha/2
+      89      275948 :                                 b *= random.randNorm() * pow(k, alpha / 2);
+      90             : 
+      91             :                                 // uniform random phase
+      92      275948 :                                 double phase = 2 * M_PI * random.rand();
+      93      275948 :                                 double cosPhase = cos(phase); // real part
+      94      275948 :                                 double sinPhase = sin(phase); // imaginary part
+      95             : 
+      96      275948 :                                 Bkx[i][0] = b.x * cosPhase;
+      97      275948 :                                 Bkx[i][1] = b.x * sinPhase;
+      98      275948 :                                 Bky[i][0] = b.y * cosPhase;
+      99      275948 :                                 Bky[i][1] = b.y * sinPhase;
+     100      275948 :                                 Bkz[i][0] = b.z * cosPhase;
+     101      275948 :                                 Bkz[i][1] = b.z * sinPhase;
+     102             :                         } // for iz
+     103             :                 }     // for iy
+     104             :         }         // for ix
+     105             : 
+     106           4 :         executeInverseFFTInplace(grid, Bkx, Bky, Bkz);
+     107             : 
+     108           4 :         fftwf_free(Bkx);
+     109           4 :         fftwf_free(Bky);
+     110           4 :         fftwf_free(Bkz);
+     111             : 
+     112          16 :         scaleGrid(grid, Brms / rmsFieldStrength(grid)); // normalize to Brms
+     113          11 : }
+     114             : 
+     115             : } // namespace crpropa
+     116             : 
+     117             : #endif // CRPROPA_HAVE_FFTW3F
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/turbulentField/index-sort-f.html b/doc/coverageReport/src/magneticField/turbulentField/index-sort-f.html new file mode 100644 index 000000000..4bb56e51d --- /dev/null +++ b/doc/coverageReport/src/magneticField/turbulentField/index-sort-f.html @@ -0,0 +1,123 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/turbulentField + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField/turbulentFieldHitTotalCoverage
Test:coverage.info.cleanedLines:18726371.1 %
Date:2024-04-08 14:58:22Functions:111957.9 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
HelicalGridTurbulence.cpp +
0.0%
+
0.0 %0 / 590.0 %0 / 2
GridTurbulence.cpp +
85.6%85.6%
+
85.6 %89 / 10453.8 %7 / 13
SimpleGridTurbulence.cpp +
100.0%
+
100.0 %52 / 52100.0 %2 / 2
PlaneWaveTurbulence.cpp +
95.8%95.8%
+
95.8 %46 / 48100.0 %2 / 2
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/turbulentField/index-sort-l.html b/doc/coverageReport/src/magneticField/turbulentField/index-sort-l.html new file mode 100644 index 000000000..1a7102ae5 --- /dev/null +++ b/doc/coverageReport/src/magneticField/turbulentField/index-sort-l.html @@ -0,0 +1,123 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/turbulentField + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField/turbulentFieldHitTotalCoverage
Test:coverage.info.cleanedLines:18726371.1 %
Date:2024-04-08 14:58:22Functions:111957.9 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
HelicalGridTurbulence.cpp +
0.0%
+
0.0 %0 / 590.0 %0 / 2
GridTurbulence.cpp +
85.6%85.6%
+
85.6 %89 / 10453.8 %7 / 13
PlaneWaveTurbulence.cpp +
95.8%95.8%
+
95.8 %46 / 48100.0 %2 / 2
SimpleGridTurbulence.cpp +
100.0%
+
100.0 %52 / 52100.0 %2 / 2
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticField/turbulentField/index.html b/doc/coverageReport/src/magneticField/turbulentField/index.html new file mode 100644 index 000000000..2bfdfdefa --- /dev/null +++ b/doc/coverageReport/src/magneticField/turbulentField/index.html @@ -0,0 +1,123 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticField/turbulentField + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticField/turbulentFieldHitTotalCoverage
Test:coverage.info.cleanedLines:18726371.1 %
Date:2024-04-08 14:58:22Functions:111957.9 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
GridTurbulence.cpp +
85.6%85.6%
+
85.6 %89 / 10453.8 %7 / 13
HelicalGridTurbulence.cpp +
0.0%
+
0.0 %0 / 590.0 %0 / 2
PlaneWaveTurbulence.cpp +
95.8%95.8%
+
95.8 %46 / 48100.0 %2 / 2
SimpleGridTurbulence.cpp +
100.0%
+
100.0 %52 / 52100.0 %2 / 2
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticLens/MagneticLens.cpp.func-sort-c.html b/doc/coverageReport/src/magneticLens/MagneticLens.cpp.func-sort-c.html new file mode 100644 index 000000000..6962e0d0c --- /dev/null +++ b/doc/coverageReport/src/magneticLens/MagneticLens.cpp.func-sort-c.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticLens/MagneticLens.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticLens - MagneticLens.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:4310441.3 %
Date:2024-04-08 14:58:22Functions:61346.2 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa12MagneticLens12loadLensPartERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEdd0
_ZN7crpropa12MagneticLens13normalizeLensEv0
_ZN7crpropa12MagneticLens18normalizeLenspartsEv0
_ZN7crpropa12MagneticLens22normalizeMatrixColumnsEv0
_ZN7crpropa12MagneticLens8loadLensERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZNK7crpropa12MagneticLens15rigidityCoveredEd0
_ZNK7crpropa12MagneticLens20transformModelVectorEPdd0
_ZN7crpropa12MagneticLens11setLensPartERKN5Eigen12SparseMatrixIdLi0EiEEdd3
_ZN7crpropa12MagneticLens12_checkMatrixERKN5Eigen12SparseMatrixIdLi0EiEE3
_ZN7crpropa12MagneticLens20updateRigidityBoundsEdd3
_ZN7crpropa12MagneticLens18transformCosmicRayEdRNS_7Vector3IdEE4
_ZN7crpropa12MagneticLens18transformCosmicRayEdRdS1_12293
_ZNK7crpropa12MagneticLens11getLensPartEd12293
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticLens/MagneticLens.cpp.func.html b/doc/coverageReport/src/magneticLens/MagneticLens.cpp.func.html new file mode 100644 index 000000000..291746429 --- /dev/null +++ b/doc/coverageReport/src/magneticLens/MagneticLens.cpp.func.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticLens/MagneticLens.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticLens - MagneticLens.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:4310441.3 %
Date:2024-04-08 14:58:22Functions:61346.2 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa12MagneticLens11setLensPartERKN5Eigen12SparseMatrixIdLi0EiEEdd3
_ZN7crpropa12MagneticLens12_checkMatrixERKN5Eigen12SparseMatrixIdLi0EiEE3
_ZN7crpropa12MagneticLens12loadLensPartERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEdd0
_ZN7crpropa12MagneticLens13normalizeLensEv0
_ZN7crpropa12MagneticLens18normalizeLenspartsEv0
_ZN7crpropa12MagneticLens18transformCosmicRayEdRNS_7Vector3IdEE4
_ZN7crpropa12MagneticLens18transformCosmicRayEdRdS1_12293
_ZN7crpropa12MagneticLens20updateRigidityBoundsEdd3
_ZN7crpropa12MagneticLens22normalizeMatrixColumnsEv0
_ZN7crpropa12MagneticLens8loadLensERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZNK7crpropa12MagneticLens11getLensPartEd12293
_ZNK7crpropa12MagneticLens15rigidityCoveredEd0
_ZNK7crpropa12MagneticLens20transformModelVectorEPdd0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticLens/MagneticLens.cpp.gcov.html b/doc/coverageReport/src/magneticLens/MagneticLens.cpp.gcov.html new file mode 100644 index 000000000..88d65754f --- /dev/null +++ b/doc/coverageReport/src/magneticLens/MagneticLens.cpp.gcov.html @@ -0,0 +1,353 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticLens/MagneticLens.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticLens - MagneticLens.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:4310441.3 %
Date:2024-04-08 14:58:22Functions:61346.2 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : //----------------------------------------------------------------------
+       2             : // This file is part of PARSEC (http://physik.rwth-aachen.de/parsec)
+       3             : // a parametrized simulation engine for cosmic rays.
+       4             : //
+       5             : // Copyright (C) 2011  Martin Erdmann, Peter Schiffer, Tobias Winchen
+       6             : //                     RWTH Aachen University, Germany
+       7             : // Contact: winchen@physik.rwth-aachen.de
+       8             : //
+       9             : //  This program is free software: you can redistribute it and/or
+      10             : //  modify it under the terms of the GNU General Public License as
+      11             : //  published by the Free Software Foundation, either version 3 of
+      12             : //  the License, or (at your option) any later version.
+      13             : //
+      14             : //  This program is distributed in the hope that it will be useful,
+      15             : //  but WITHOUT ANY WARRANTY; without even the implied warranty of
+      16             : //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+      17             : //  GNU General Public License for more details.
+      18             : //
+      19             : //  You should have received a copy of the GNU General Public License
+      20             : //  along with this program. If not, see <http://www.gnu.org/licenses/>.
+      21             : //----------------------------------------------------------------------
+      22             : 
+      23             : #include "crpropa/magneticLens/MagneticLens.h"
+      24             : 
+      25             : #include "crpropa/Random.h"
+      26             : #include "crpropa/Units.h"
+      27             : 
+      28             : // needed for memcpy in gcc 4.3.2
+      29             : #include <cstring>
+      30             : 
+      31             : namespace crpropa 
+      32             : {
+      33             : 
+      34           0 : void MagneticLens::loadLens(const string &filename)
+      35             : {
+      36           0 :         ifstream infile(filename.c_str());
+      37           0 :         if (!infile)
+      38             :         {
+      39           0 :                 throw std::runtime_error("Can't read file: " + filename);
+      40             :         }
+      41             :         string line;
+      42             : 
+      43             :         string prefix;
+      44           0 :         int sp = filename.find_last_of("/");
+      45           0 :         if (sp >= 0)
+      46             :         {
+      47           0 :                 prefix = filename.substr(0, sp);
+      48           0 :                 prefix.append("/");
+      49             :         }
+      50             :         string mfdatfile;
+      51             :         double emin, emax;
+      52             : 
+      53             :         int lineCounter = 0;
+      54           0 :         while (!infile.eof())
+      55             :         {
+      56           0 :                 getline(infile, line);
+      57           0 :                 lineCounter++;
+      58           0 :                 if (line.find('#') == string::npos)
+      59             :                 {
+      60           0 :                         stringstream ss;
+      61             :                         ss << line;
+      62           0 :                         ss >> mfdatfile >> emin >> emax;
+      63           0 :                         if (ss.fail())
+      64             :                         {
+      65           0 :                                 cerr << "WARNING! Cannot read line " << lineCounter << " of file " << filename << " :\n [" << lineCounter << " ]: " << line << " \n";
+      66           0 :                                 cerr << " ... Skipping line and continue\n";
+      67             :                         }
+      68             :                         else
+      69             :                         {
+      70           0 :                                 this->loadLensPart(prefix + mfdatfile, pow(10, emin) * eV, pow(10, emax) * eV);
+      71             :                         }
+      72           0 :                 }
+      73             :         }
+      74           0 : }
+      75             : 
+      76       12293 : bool MagneticLens::transformCosmicRay(double rigidity, double& phi,
+      77             :                 double& theta) 
+      78             : {
+      79       12293 :         uint32_t c = _pixelization->direction2Pix(phi, theta);
+      80       12293 :         LensPart *lenspart = getLensPart(rigidity);
+      81       12293 :         if (!lenspart)
+      82             :         {
+      83           1 :                 std::cerr << "Warning. Trying to transform cosmic ray with rigidity " << rigidity / eV << " eV which is not covered by this lens!.\n";
+      84           2 :                 std::cerr << " This lens covers the range " << _minimumRigidity /eV << " eV - " << _maximumRigidity << " eV.\n";
+      85           1 :                 return false;
+      86             :         }
+      87             : 
+      88       12292 :         ModelVectorType v = lenspart->getMatrix().col(c);
+      89             : 
+      90             :         uint32_t r;
+      91             : 
+      92             :         // the random number to compare with
+      93       12292 :         double rn = Random::instance().rand();
+      94             : 
+      95             :         ModelVectorType::InnerIterator i(v);
+      96             :   double cpv = 0;
+      97       12292 :   while (i)
+      98             :   {
+      99       12292 :                 cpv += i.value();
+     100       12292 :                 if (rn < cpv)
+     101             :                 {
+     102       12292 :                         _pixelization->pix2Direction(i.index(), phi, theta);
+     103             :                         return true;
+     104             :     }
+     105             :     else
+     106             :     {
+     107             :                         ++i;
+     108             :     }
+     109             :    }
+     110             :   return false;
+     111             : }
+     112             : 
+     113           4 : bool MagneticLens::transformCosmicRay(double rigidity, Vector3d &p){
+     114             : 
+     115           4 :                         double galacticLongitude = atan2(-p.y, -p.x);
+     116           4 :                         double galacticLatitude =       M_PI / 2 - acos(-p.z/ sqrt(p.x*p.x + p.y*p.y + p.z*p.z));
+     117           4 :                         bool result = transformCosmicRay(rigidity, galacticLongitude, galacticLatitude);
+     118             :                         
+     119           4 :                         p.x = -1 * cos(galacticLongitude) * sin(M_PI / 2 - galacticLatitude);
+     120           4 :                         p.y = -1 * sin(galacticLongitude) * sin(M_PI / 2 - galacticLatitude);
+     121           4 :                         p.z = -1. * cos(M_PI / 2 - galacticLatitude);
+     122             : 
+     123           4 :                         return result;
+     124             : }
+     125             : 
+     126           0 : void MagneticLens::loadLensPart(const string &filename, double rigidityMin,
+     127             :                 double rigidityMax)
+     128             : {
+     129           0 :         updateRigidityBounds(rigidityMin, rigidityMax);
+     130             : 
+     131           0 :         LensPart *p = new LensPart(filename, rigidityMin, rigidityMax);
+     132             :         p->loadMatrixFromFile();
+     133           0 :         _checkMatrix(p->getMatrix());
+     134             : 
+     135           0 :         _lensParts.push_back(p);
+     136           0 : }
+     137             : 
+     138           3 : void MagneticLens::_checkMatrix(const ModelMatrixType &M)
+     139             : {
+     140           3 :         if (M.rows() != M.cols())
+     141             :         {
+     142           0 :                 throw std::runtime_error("Not a square Matrix!");
+     143             :         }
+     144             : 
+     145           3 :         if (_pixelization)
+     146             :         {
+     147           3 :                 if (_pixelization->nPix() != M.cols())
+     148             :                 {
+     149             :                         std::cerr << "*** ERROR ***" << endl;
+     150           0 :                         std::cerr << "  Pixelization: " << _pixelization->nPix() << endl;
+     151             :                         std::cerr << "  Matrix Size : " << M.cols() << endl;
+     152           0 :                         throw std::runtime_error("Matrix doesn't fit into Lense");
+     153             :                 }
+     154             :         }
+     155             :         else
+     156             :         {
+     157           0 :                 uint32_t morder = Pixelization::pix2Order(M.cols());
+     158           0 :                 if (morder == 0)
+     159             :                 {
+     160           0 :                         throw std::runtime_error(
+     161           0 :                                         "Matrix size doesn't match healpix scheme!");
+     162             :                 }
+     163           0 :                 _pixelization = new Pixelization(morder);
+     164             :         }
+     165           3 : }
+     166             : 
+     167           3 : void MagneticLens::updateRigidityBounds(double rigidityMin, double rigidityMax)
+     168             : {
+     169           3 :         if (rigidityMin >= rigidityMax)
+     170             :         {
+     171           0 :                 throw std::runtime_error("rigidityMin >= rigidityMax");
+     172             :         }
+     173           3 :         if (rigidityMin < _minimumRigidity)
+     174             :         {
+     175           3 :                 _minimumRigidity = rigidityMin;
+     176             :         }
+     177             : 
+     178           3 :         if (_maximumRigidity < rigidityMin)
+     179             :         {
+     180           3 :                 _maximumRigidity = rigidityMax;
+     181             :         }
+     182           3 : }
+     183             : 
+     184           3 : void MagneticLens::setLensPart(const ModelMatrixType &M, double rigidityMin,
+     185             :                 double rigidityMax)
+     186             : {
+     187           3 :         updateRigidityBounds(rigidityMin, rigidityMax);
+     188           3 :         LensPart *p = new LensPart("Direct Input", rigidityMin, rigidityMax);
+     189             : 
+     190             :         p->setMatrix(M);
+     191             : 
+     192           3 :         _checkMatrix(p->getMatrix());
+     193           3 :         _lensParts.push_back(p);
+     194           3 : }
+     195             : 
+     196       12293 : LensPart* MagneticLens::getLensPart(double rigidity) const
+     197             : {
+     198             :         const_LensPartIter i = _lensParts.begin();
+     199       12294 :         while (i != _lensParts.end())
+     200             :         {
+     201       12293 :                 if (((*i)->getMinimumRigidity() < rigidity / eV)
+     202       12293 :                                 && ((*i)->getMaximumRigidity() >= rigidity / eV))
+     203             :                 {
+     204             :                         return (*i);
+     205             :                 }
+     206             :                 ++i;
+     207             :         }
+     208             :         return NULL;
+     209             : }
+     210             : 
+     211           0 : bool MagneticLens::rigidityCovered(double rigidity) const
+     212             : {
+     213           0 :         if (getLensPart(rigidity))
+     214             :                 return true;
+     215             :         else
+     216           0 :                 return false;
+     217             : }
+     218             : 
+     219             : 
+     220           0 : void MagneticLens::normalizeMatrixColumns()
+     221             : {
+     222           0 :         for (LensPartIter iter = _lensParts.begin(); iter != _lensParts.end();
+     223             :                         ++iter)
+     224             :         {
+     225           0 :                 normalizeColumns((*iter)->getMatrix());
+     226             :         }
+     227           0 : }
+     228             : 
+     229             : 
+     230           0 : void MagneticLens::normalizeLens()
+     231             : {
+     232             :         // get maximum of sums of columns, and normalize each matrix to that
+     233             :         double norm = 0;
+     234           0 :         for (LensPartIter iter = _lensParts.begin(); iter != _lensParts.end();
+     235             :                         ++iter)
+     236             :         {
+     237           0 :                 if ((*iter)->getMaximumOfSumsOfColumns() > norm)
+     238             :                 {
+     239           0 :                         norm = (*iter)->getMaximumOfSumsOfColumns();
+     240             :                 }
+     241             :         }
+     242           0 :         for (LensPartIter iter = _lensParts.begin(); iter != _lensParts.end();
+     243             :                         ++iter)
+     244             :         {
+     245           0 :                 normalizeMatrix((*iter)->getMatrix(), norm);
+     246             :         }
+     247           0 :   _norm = norm;
+     248           0 : }
+     249             : 
+     250           0 : void MagneticLens::normalizeLensparts()
+     251             : {
+     252           0 :         for (LensPartIter iter = _lensParts.begin(); iter != _lensParts.end();
+     253             :                         ++iter)
+     254             :         {
+     255           0 :                 double norm = (*iter)->getMaximumOfSumsOfColumns();
+     256           0 :                 normalizeMatrix((*iter)->getMatrix(), norm);
+     257             :         }
+     258           0 : }
+     259             : 
+     260           0 : void MagneticLens::transformModelVector(double* model, double rigidity) const
+     261             : {
+     262           0 :         LensPart* lenspart = getLensPart(rigidity);
+     263             :         
+     264           0 :         if (!lenspart)
+     265             :         {
+     266           0 :                 std::cerr << "Warning. Trying to transform vector with rigidity " << rigidity / eV << "eV which is not covered by this lens!.\n" << std::endl;
+     267           0 :                 return;
+     268             :         }
+     269             : 
+     270           0 :         prod_up(lenspart->getMatrix(), model);
+     271             : 
+     272             : }
+     273             : 
+     274             : 
+     275             : 
+     276             : } // namespace parsec
+     277             : 
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticLens/ModelMatrix.cpp.func-sort-c.html b/doc/coverageReport/src/magneticLens/ModelMatrix.cpp.func-sort-c.html new file mode 100644 index 000000000..0b636302b --- /dev/null +++ b/doc/coverageReport/src/magneticLens/ModelMatrix.cpp.func-sort-c.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticLens/ModelMatrix.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticLens - ModelMatrix.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0630.0 %
Date:2024-04-08 14:58:22Functions:070.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11deserializeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERN5Eigen12SparseMatrixIdLi0EiEE0
_ZN7crpropa15normalizeMatrixERN5Eigen12SparseMatrixIdLi0EiEEd0
_ZN7crpropa16normalizeColumnsERN5Eigen12SparseMatrixIdLi0EiEE0
_ZN7crpropa22maximumOfSumsOfColumnsERKN5Eigen12SparseMatrixIdLi0EiEE0
_ZN7crpropa6norm_1ERKN5Eigen12SparseVectorIdLi0EiEE0
_ZN7crpropa7prod_upERKN5Eigen12SparseMatrixIdLi0EiEEPd0
_ZN7crpropa9serializeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKN5Eigen12SparseMatrixIdLi0EiEE0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticLens/ModelMatrix.cpp.func.html b/doc/coverageReport/src/magneticLens/ModelMatrix.cpp.func.html new file mode 100644 index 000000000..9869c0266 --- /dev/null +++ b/doc/coverageReport/src/magneticLens/ModelMatrix.cpp.func.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticLens/ModelMatrix.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticLens - ModelMatrix.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0630.0 %
Date:2024-04-08 14:58:22Functions:070.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11deserializeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERN5Eigen12SparseMatrixIdLi0EiEE0
_ZN7crpropa15normalizeMatrixERN5Eigen12SparseMatrixIdLi0EiEEd0
_ZN7crpropa16normalizeColumnsERN5Eigen12SparseMatrixIdLi0EiEE0
_ZN7crpropa22maximumOfSumsOfColumnsERKN5Eigen12SparseMatrixIdLi0EiEE0
_ZN7crpropa6norm_1ERKN5Eigen12SparseVectorIdLi0EiEE0
_ZN7crpropa7prod_upERKN5Eigen12SparseMatrixIdLi0EiEEPd0
_ZN7crpropa9serializeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKN5Eigen12SparseMatrixIdLi0EiEE0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticLens/ModelMatrix.cpp.gcov.html b/doc/coverageReport/src/magneticLens/ModelMatrix.cpp.gcov.html new file mode 100644 index 000000000..e0c22d95b --- /dev/null +++ b/doc/coverageReport/src/magneticLens/ModelMatrix.cpp.gcov.html @@ -0,0 +1,237 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticLens/ModelMatrix.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticLens - ModelMatrix.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0630.0 %
Date:2024-04-08 14:58:22Functions:070.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : //----------------------------------------------------------------------
+       2             : // This file is part of PARSEC (http://physik.rwth-aachen.de/parsec)
+       3             : // a parametrized simulation engine for cosmic rays.
+       4             : //
+       5             : // Copyright (C) 2011  Martin Erdmann, Peter Schiffer, Tobias Winchen
+       6             : //                     RWTH Aachen University, Germany
+       7             : // Contact: winchen@physik.rwth-aachen.de
+       8             : //
+       9             : //  This program is free software: you can redistribute it and/or
+      10             : //  modify it under the terms of the GNU General Public License as
+      11             : //  published by the Free Software Foundation, either version 3 of
+      12             : //  the License, or (at your option) any later version.
+      13             : //
+      14             : //  This program is distributed in the hope that it will be useful,
+      15             : //  but WITHOUT ANY WARRANTY; without even the implied warranty of
+      16             : //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+      17             : //  GNU General Public License for more details.
+      18             : //
+      19             : //  You should have received a copy of the GNU General Public License
+      20             : //  along with this program. If not, see <http://www.gnu.org/licenses/>.
+      21             : //----------------------------------------------------------------------
+      22             : 
+      23             : #include "crpropa/magneticLens/ModelMatrix.h"
+      24             : #include <ctime>
+      25             : 
+      26             : #include <Eigen/Core>
+      27             : namespace crpropa 
+      28             : {
+      29             : 
+      30           0 : void serialize(const string &filename, const ModelMatrixType& matrix)
+      31             : {
+      32           0 :         ofstream outfile(filename.c_str(), ios::binary);
+      33           0 :         if (!outfile)
+      34             :         {
+      35           0 :                 throw runtime_error("Can't write file: " + filename);
+      36             :         }
+      37             : 
+      38           0 :         uint32_t C = 0;
+      39             :         double val;
+      40             : 
+      41           0 :         C = (uint32_t) (matrix.nonZeros());
+      42           0 :         outfile.write((char*) &C, sizeof(uint32_t));
+      43           0 :         C = (uint32_t) (matrix.rows());
+      44           0 :         outfile.write((char*) &C, sizeof(uint32_t));
+      45           0 :         C = (uint32_t) (matrix.cols());
+      46           0 :         outfile.write((char*) &C, sizeof(uint32_t));
+      47             : 
+      48             :         // serialize non zero elements
+      49           0 :         for (size_t col_idx = 0; col_idx < matrix.cols(); ++col_idx)
+      50             :         {
+      51           0 :                 for (ModelMatrixType::InnerIterator it(matrix,col_idx); it; ++it)
+      52             :                         {
+      53             :                                 it.value();
+      54           0 :                                 C = (uint32_t) it.row();
+      55           0 :                                 outfile.write((char*) &C, sizeof(uint32_t));
+      56             : 
+      57           0 :                                 C = (uint32_t) it.col();
+      58           0 :                                 outfile.write((char*) &C, sizeof(uint32_t));
+      59             : 
+      60           0 :                                 val = it.value();
+      61           0 :                                 outfile.write((char*) &val, sizeof(double));
+      62           0 :                                 if (outfile.fail())
+      63             :                                 {
+      64           0 :                                         throw runtime_error("Error writing file: " + filename);
+      65             :                                 }
+      66             :                         }
+      67             :         }
+      68             : 
+      69           0 :         outfile.close();
+      70           0 : }
+      71             : 
+      72             : 
+      73           0 : void deserialize(const string &filename, ModelMatrixType& matrix)
+      74             : {
+      75           0 :         ifstream infile(filename.c_str(), ios::binary);
+      76           0 :         if (!infile)
+      77             :         {
+      78           0 :                 throw runtime_error("Can't read file: " + filename);
+      79             :         }
+      80             : 
+      81             :         uint32_t nnz, nRows, nColumns;
+      82           0 :         infile.read((char*) &nnz, sizeof(uint32_t));
+      83           0 :         infile.read((char*) &nRows, sizeof(uint32_t));
+      84           0 :         infile.read((char*) &nColumns, sizeof(uint32_t));
+      85           0 :         matrix.resize(nRows, nColumns);
+      86           0 :         matrix.reserve(nnz);
+      87             : 
+      88             :         uint32_t row, column;
+      89             :         double val;
+      90             :         std::vector< Eigen::Triplet<double> > triplets;
+      91           0 :         triplets.resize(nnz);
+      92           0 :         for (size_t i = 0; i < nnz; i++)
+      93             :         {
+      94           0 :                 infile.read((char*) &row, sizeof(uint32_t));
+      95           0 :                 infile.read((char*) &column, sizeof(uint32_t));
+      96           0 :                 infile.read((char*) &val, sizeof(double));
+      97             :                 //M(size1,size2) = val;
+      98           0 :                 triplets[i] = Eigen::Triplet<double>(row, column, val);
+      99             :         }
+     100           0 :         matrix.setFromTriplets(triplets.begin(), triplets.end());
+     101           0 :         matrix.makeCompressed();
+     102           0 : }
+     103             : 
+     104             : 
+     105           0 : double norm_1(const ModelVectorType &v)
+     106             : {
+     107           0 :         return v.cwiseAbs().sum();
+     108             : }
+     109             : 
+     110             : 
+     111           0 : void normalizeColumns(ModelMatrixType &matrix){
+     112           0 :         for (size_t i=0; i< matrix.cols(); i++)
+     113             :         {
+     114           0 :                 ModelVectorType v = matrix.col(i);
+     115           0 :                 double rn = norm_1(v);
+     116           0 :                 matrix.col(i) = v/rn;
+     117             :         }
+     118           0 : }
+     119             : 
+     120             : 
+     121           0 : double maximumOfSumsOfColumns(const ModelMatrixType &matrix) 
+     122             : {
+     123             :         double summax = 0;
+     124           0 :         for (size_t i = 0; i < matrix.cols(); i++)
+     125             :         {
+     126           0 :                 double sum = matrix.col(i).sum();
+     127           0 :                 if (sum > summax)
+     128             :                         summax = sum;
+     129             :         }
+     130           0 :         return summax;
+     131             : }
+     132             : 
+     133           0 :         void normalizeMatrix(ModelMatrixType& matrix, double norm)
+     134             : {
+     135           0 :         matrix /= norm;
+     136           0 : }
+     137             : 
+     138           0 :         void prod_up(const ModelMatrixType& matrix, double* model)
+     139             : {
+     140             : 
+     141             :         // copy storage of model, as matrix vector product cannot be done
+     142             :         // in place
+     143             :         
+     144           0 :         const size_t mSize = matrix.cols();
+     145           0 :         double *origVectorStorage = new double[mSize];
+     146             :         memcpy(origVectorStorage, model, mSize * sizeof(double));
+     147             : 
+     148             : 
+     149             : 
+     150             :         Eigen::Map<Eigen::Matrix<double, Eigen::Dynamic, 1> > origVectorAdaptor(origVectorStorage, mSize);
+     151             :         Eigen::Map<Eigen::Matrix<double, Eigen::Dynamic, 1> > modelVectorAdaptor(model, mSize);
+     152             : 
+     153             :         // perform the optimized product
+     154           0 :         modelVectorAdaptor = matrix * origVectorAdaptor;
+     155             : 
+     156             :         // clean up
+     157           0 :         delete[] origVectorStorage;
+     158           0 : }
+     159             : 
+     160             : 
+     161             : } // namespace parsec
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticLens/ParticleMapsContainer.cpp.func-sort-c.html b/doc/coverageReport/src/magneticLens/ParticleMapsContainer.cpp.func-sort-c.html new file mode 100644 index 000000000..20670889d --- /dev/null +++ b/doc/coverageReport/src/magneticLens/ParticleMapsContainer.cpp.func-sort-c.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticLens/ParticleMapsContainer.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticLens - ParticleMapsContainer.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:7410570.5 %
Date:2024-04-08 14:58:22Functions:91369.2 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa21ParticleMapsContainer11addParticleEidRKNS_7Vector3IdEEd0
_ZN7crpropa21ParticleMapsContainer17forceWeightUpdateEv0
_ZN7crpropa21ParticleMapsContainer6getMapEid0
_ZN7crpropa21ParticleMapsContainer9applyLensERNS_12MagneticLensE0
_ZN7crpropa21ParticleMapsContainer11getEnergiesEi1
_ZN7crpropa21ParticleMapsContainer14getParticleIdsEv1
_ZN7crpropa21ParticleMapsContainer18getRandomParticlesEmRSt6vectorIiSaIiEERS1_IdSaIdEES7_S7_1
_ZN7crpropa21ParticleMapsContainer11addParticleEidddd2
_ZN7crpropa21ParticleMapsContainerD2Ev2
_ZN7crpropa21ParticleMapsContainer10placeOnMapEidRdS1_420
_ZN7crpropa21ParticleMapsContainer14_updateWeightsEv421
_ZNK7crpropa21ParticleMapsContainer10idx2EnergyEi421
_ZNK7crpropa21ParticleMapsContainer10energy2IdxEd422
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticLens/ParticleMapsContainer.cpp.func.html b/doc/coverageReport/src/magneticLens/ParticleMapsContainer.cpp.func.html new file mode 100644 index 000000000..fec3680af --- /dev/null +++ b/doc/coverageReport/src/magneticLens/ParticleMapsContainer.cpp.func.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticLens/ParticleMapsContainer.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticLens - ParticleMapsContainer.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:7410570.5 %
Date:2024-04-08 14:58:22Functions:91369.2 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa21ParticleMapsContainer10placeOnMapEidRdS1_420
_ZN7crpropa21ParticleMapsContainer11addParticleEidRKNS_7Vector3IdEEd0
_ZN7crpropa21ParticleMapsContainer11addParticleEidddd2
_ZN7crpropa21ParticleMapsContainer11getEnergiesEi1
_ZN7crpropa21ParticleMapsContainer14_updateWeightsEv421
_ZN7crpropa21ParticleMapsContainer14getParticleIdsEv1
_ZN7crpropa21ParticleMapsContainer17forceWeightUpdateEv0
_ZN7crpropa21ParticleMapsContainer18getRandomParticlesEmRSt6vectorIiSaIiEERS1_IdSaIdEES7_S7_1
_ZN7crpropa21ParticleMapsContainer6getMapEid0
_ZN7crpropa21ParticleMapsContainer9applyLensERNS_12MagneticLensE0
_ZN7crpropa21ParticleMapsContainerD2Ev2
_ZNK7crpropa21ParticleMapsContainer10energy2IdxEd422
_ZNK7crpropa21ParticleMapsContainer10idx2EnergyEi421
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticLens/ParticleMapsContainer.cpp.gcov.html b/doc/coverageReport/src/magneticLens/ParticleMapsContainer.cpp.gcov.html new file mode 100644 index 000000000..58e7fc9e5 --- /dev/null +++ b/doc/coverageReport/src/magneticLens/ParticleMapsContainer.cpp.gcov.html @@ -0,0 +1,275 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticLens/ParticleMapsContainer.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticLens - ParticleMapsContainer.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:7410570.5 %
Date:2024-04-08 14:58:22Functions:91369.2 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "HepPID/ParticleIDMethods.hh"
+       2             : #include "crpropa/Random.h"
+       3             : #include "crpropa/magneticLens/ParticleMapsContainer.h"
+       4             : #include "crpropa/Units.h"
+       5             : 
+       6             : #include <iostream>
+       7             : #include <fstream>
+       8             : 
+       9             : namespace crpropa  {
+      10             : 
+      11           2 : ParticleMapsContainer::~ParticleMapsContainer() {
+      12           2 :         for(std::map<int, std::map<int, double*> >::iterator pid_iter = _data.begin(); 
+      13           4 :                         pid_iter != _data.end(); ++pid_iter) {
+      14           2 :                 for(std::map<int, double*>::iterator energy_iter = pid_iter->second.begin();
+      15           4 :                         energy_iter != pid_iter->second.end(); ++energy_iter) {
+      16           2 :                         delete[] (energy_iter->second);
+      17             :                 }
+      18             :         }
+      19           2 : }
+      20             : 
+      21         422 : int ParticleMapsContainer::energy2Idx(double energy) const {
+      22         422 :         double lE = log10(energy / eV);
+      23         422 :         return int((lE - _bin0lowerEdge) / _deltaLogE);
+      24             : }
+      25             : 
+      26         421 : double ParticleMapsContainer::idx2Energy(int idx) const {
+      27         421 :         return pow(10, idx * _deltaLogE + _bin0lowerEdge + _deltaLogE / 2) * eV;
+      28             : }
+      29             : 
+      30             :                 
+      31           0 : double* ParticleMapsContainer::getMap(const int particleId, double energy) {
+      32           0 :         _weightsUpToDate = false;
+      33           0 :         if (_data.find(particleId) == _data.end()) {
+      34           0 :                 std::cerr << "No map for ParticleID " << particleId << std::endl;
+      35           0 :                 return NULL;
+      36             :         }
+      37           0 :         int energyIdx   = energy2Idx(energy);
+      38           0 :         if (_data[particleId].find(energyIdx) == _data[particleId].end()) {
+      39           0 :                 std::cerr << "No map for ParticleID and energy" << energy / eV << " eV" << std::endl;
+      40           0 :                 return NULL;
+      41             :         }
+      42           0 :         return _data[particleId][energy2Idx(energy)];
+      43             : }
+      44             :                         
+      45             :                         
+      46           2 : void ParticleMapsContainer::addParticle(const int particleId, double energy, double galacticLongitude, double galacticLatitude, double weight) {
+      47           2 :         _weightsUpToDate = false;
+      48           2 :         if (_data.find(particleId) == _data.end()) {
+      49             :                 map<int, double*> M;
+      50           2 :                 _data[particleId] = M;
+      51             :         }
+      52             : 
+      53           2 :         int energyIdx   = energy2Idx(energy);
+      54           4 :         if (_data[particleId].find(energyIdx) == _data[particleId].end()) {
+      55           2 :                 _data[particleId][energyIdx] = new double[_pixelization.getNumberOfPixels()];
+      56           2 :                 std::fill(_data[particleId][energyIdx], _data[particleId][energyIdx] + _pixelization.getNumberOfPixels(), 0);
+      57             :         }
+      58             : 
+      59           2 :         uint32_t pixel = _pixelization.direction2Pix(galacticLongitude, galacticLatitude);
+      60           2 :         _data[particleId][energyIdx][pixel] += weight;
+      61           2 : }
+      62             : 
+      63             : 
+      64           0 : void ParticleMapsContainer::addParticle(const int particleId, double energy, const Vector3d &p, double weight) {
+      65           0 :         double galacticLongitude = atan2(-p.y, -p.x);
+      66           0 :         double galacticLatitude =       M_PI / 2 - acos(-p.z / p.getR());
+      67           0 :         addParticle(particleId, energy, galacticLongitude, galacticLatitude, weight);
+      68           0 : }
+      69             : 
+      70             : 
+      71           1 : std::vector<int> ParticleMapsContainer::getParticleIds() {
+      72             :         std::vector<int> ids;
+      73           1 :         for(std::map<int, std::map<int, double*> >::iterator pid_iter = _data.begin(); 
+      74           2 :                         pid_iter != _data.end(); ++pid_iter) {
+      75           1 :                 ids.push_back(pid_iter->first);
+      76             :         }
+      77           1 :         return ids;
+      78             : }
+      79             : 
+      80             : 
+      81           1 : std::vector<double> ParticleMapsContainer::getEnergies(int pid) {
+      82             :         std::vector<double> energies;
+      83           1 :         if (_data.find(pid) != _data.end()) {
+      84           1 :                 for(std::map<int, double*>::iterator iter = _data[pid].begin(); 
+      85           2 :                         iter != _data[pid].end(); ++iter) {
+      86           1 :                         energies.push_back( idx2Energy(iter->first) / eV );
+      87             :                 }
+      88             :         }
+      89           1 :         return energies;
+      90             : }
+      91             : 
+      92             : 
+      93           0 : void ParticleMapsContainer::applyLens(MagneticLens &lens) {
+      94             :         // if lens is normalized, this should not be necessary.
+      95           0 :         _weightsUpToDate = false;
+      96             : 
+      97           0 :         for(std::map<int, std::map<int, double*> >::iterator pid_iter = _data.begin(); 
+      98           0 :                         pid_iter != _data.end(); ++pid_iter) {
+      99           0 :                 for(std::map<int, double*>::iterator energy_iter = pid_iter->second.begin();
+     100           0 :                         energy_iter != pid_iter->second.end(); ++energy_iter) {
+     101             :                         // transform only nuclei
+     102           0 :                         double energy = idx2Energy(energy_iter->first);
+     103           0 :                         int chargeNumber = HepPID::Z(pid_iter->first);
+     104           0 :                         if (chargeNumber != 0 && lens.rigidityCovered(energy / chargeNumber)) {
+     105           0 :                                 lens.transformModelVector(energy_iter->second, energy / chargeNumber);
+     106             :                         } else { // still normalize the vectors 
+     107           0 :                                 for(size_t j=0; j< _pixelization.getNumberOfPixels() ; j++) {
+     108           0 :                                         energy_iter->second[j] /= lens.getNorm();
+     109             :                                 }
+     110             :                         }
+     111             :                 }
+     112             :         }
+     113           0 : }
+     114             : 
+     115             : 
+     116         421 : void ParticleMapsContainer::_updateWeights() {
+     117         421 :         if (_weightsUpToDate)
+     118             :                 return;
+     119             : 
+     120           1 :         for(std::map<int, std::map<int, double*> >::iterator pid_iter = _data.begin(); 
+     121           2 :                         pid_iter != _data.end(); ++pid_iter) {
+     122           1 :                 _weightsPID[pid_iter->first] = 0;
+     123             : 
+     124           1 :                 for(std::map<int, double*>::iterator energy_iter = pid_iter->second.begin();
+     125           2 :                         energy_iter != pid_iter->second.end(); ++energy_iter)  {
+     126             : 
+     127           1 :                         _weights_pidEnergy[pid_iter->first][energy_iter->first] = 0;
+     128       49153 :                         for(size_t j = 0; j< _pixelization.getNumberOfPixels() ; j++) {
+     129       49152 :                                 _weights_pidEnergy[pid_iter->first][energy_iter->first] +=energy_iter->second[j];
+     130       49152 :                                 _weightsPID[pid_iter->first]+=energy_iter->second[j];
+     131             :                         }
+     132           1 :                         _sumOfWeights+=_weights_pidEnergy[pid_iter->first][energy_iter->first];
+     133             :                 }
+     134             :         }
+     135           1 :         _weightsUpToDate = true;
+     136             : }
+     137             : 
+     138             : 
+     139           1 : void ParticleMapsContainer::getRandomParticles(size_t N, vector<int> &particleId, 
+     140             :         vector<double> &energy, vector<double> &galacticLongitudes,
+     141             :         vector<double> &galacticLatitudes) {
+     142           1 :         _updateWeights();
+     143             : 
+     144           1 :         particleId.resize(N);
+     145           1 :         energy.resize(N);
+     146           1 :         galacticLongitudes.resize(N);
+     147           1 :         galacticLatitudes.resize(N);
+     148             : 
+     149         421 :         for(size_t i=0; i< N; i++) {
+     150             :                 //get particle
+     151         420 :                 double r = Random::instance().rand() * _sumOfWeights;
+     152             :                 std::map<int, double>::iterator iter = _weightsPID.begin();
+     153         420 :                 while ((r-= iter->second) > 0) {
+     154             :                         ++iter; 
+     155             :                 }
+     156         420 :                 particleId[i] = iter->first;
+     157             :         
+     158             :                 //get energy
+     159         420 :                 r = Random::instance().rand() * iter->second;
+     160         420 :                 iter = _weights_pidEnergy[particleId[i]].begin();
+     161         420 :                 while ((r-= iter->second) > 0) {
+     162             :                  ++iter; 
+     163             :                 }
+     164         420 :                 energy[i] = idx2Energy(iter->first) / eV;
+     165             : 
+     166         420 :                 placeOnMap(particleId[i], energy[i] * eV, galacticLongitudes[i], galacticLatitudes[i]);
+     167             :         }
+     168           1 : }
+     169             : 
+     170             : 
+     171         420 : bool ParticleMapsContainer::placeOnMap(int pid, double energy, double &galacticLongitude, double &galacticLatitude) {
+     172         420 :         _updateWeights();
+     173             : 
+     174         420 :         if (_data.find(pid) == _data.end()) {
+     175             :                 return false;
+     176             :         }
+     177         420 :         int energyIdx   = energy2Idx(energy);
+     178         840 :         if (_data[pid].find(energyIdx) == _data[pid].end()) {
+     179             :                 return false;
+     180             :         }
+     181             : 
+     182         420 :         double r = Random::instance().rand() * _weights_pidEnergy[pid][energyIdx];
+     183             : 
+     184    10268580 :         for(size_t j = 0; j< _pixelization.getNumberOfPixels(); j++) {
+     185    10268580 :                 r -= _data[pid][energyIdx][j];
+     186    10268580 :                 if (r <= 0) {
+     187         420 :                         _pixelization.getRandomDirectionInPixel(j, galacticLongitude, galacticLatitude);
+     188         420 :                         return true;
+     189             :                 }
+     190             :         }
+     191             :         return false;
+     192             : }
+     193             : 
+     194             : 
+     195           0 : void ParticleMapsContainer::forceWeightUpdate() {
+     196           0 :         _weightsUpToDate = false;
+     197           0 : }
+     198             : 
+     199             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticLens/Pixelization.cpp.func-sort-c.html b/doc/coverageReport/src/magneticLens/Pixelization.cpp.func-sort-c.html new file mode 100644 index 000000000..70dfc7376 --- /dev/null +++ b/doc/coverageReport/src/magneticLens/Pixelization.cpp.func-sort-c.html @@ -0,0 +1,104 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticLens/Pixelization.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticLens - Pixelization.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:305060.0 %
Date:2024-04-08 14:58:22Functions:6875.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa12Pixelization4nPixEh0
_ZN7crpropa12Pixelization9pix2OrderEj0
_ZN7crpropa12Pixelization25getRandomDirectionInPixelEjRdS1_421
_ZNK7crpropa12Pixelization11spherCo2VecEddRN7healpix6vec3_tIdEE24585
_ZNK7crpropa12Pixelization13direction2PixEdd24585
_ZNK7crpropa12Pixelization13pix2DirectionEjRdS1_36868
_ZNK7crpropa12Pixelization12vec2SphereCoERdS1_RKN7healpix6vec3_tIdEE37289
_ZNK7crpropa12Pixelization15angularDistanceEjj49152
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticLens/Pixelization.cpp.func.html b/doc/coverageReport/src/magneticLens/Pixelization.cpp.func.html new file mode 100644 index 000000000..d568a50f3 --- /dev/null +++ b/doc/coverageReport/src/magneticLens/Pixelization.cpp.func.html @@ -0,0 +1,104 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticLens/Pixelization.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticLens - Pixelization.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:305060.0 %
Date:2024-04-08 14:58:22Functions:6875.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa12Pixelization25getRandomDirectionInPixelEjRdS1_421
_ZN7crpropa12Pixelization4nPixEh0
_ZN7crpropa12Pixelization9pix2OrderEj0
_ZNK7crpropa12Pixelization11spherCo2VecEddRN7healpix6vec3_tIdEE24585
_ZNK7crpropa12Pixelization12vec2SphereCoERdS1_RKN7healpix6vec3_tIdEE37289
_ZNK7crpropa12Pixelization13direction2PixEdd24585
_ZNK7crpropa12Pixelization13pix2DirectionEjRdS1_36868
_ZNK7crpropa12Pixelization15angularDistanceEjj49152
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticLens/Pixelization.cpp.gcov.html b/doc/coverageReport/src/magneticLens/Pixelization.cpp.gcov.html new file mode 100644 index 000000000..26f97cb78 --- /dev/null +++ b/doc/coverageReport/src/magneticLens/Pixelization.cpp.gcov.html @@ -0,0 +1,205 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticLens/Pixelization.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticLens - Pixelization.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:305060.0 %
Date:2024-04-08 14:58:22Functions:6875.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : //----------------------------------------------------------------------
+       2             : // This file is part of PARSEC (http://physik.rwth-aachen.de/parsec)
+       3             : // a parametrized simulation engine for cosmic rays.
+       4             : //
+       5             : // Copyright (C) 2011  Martin Erdmann, Peter Schiffer, Tobias Winchen
+       6             : //                     RWTH Aachen University, Germany
+       7             : // Contact: winchen@physik.rwth-aachen.de
+       8             : //
+       9             : //  This program is free software: you can redistribute it and/or
+      10             : //  modify it under the terms of the GNU General Public License as
+      11             : //  published by the Free Software Foundation, either version 3 of
+      12             : //  the License, or (at your option) any later version.
+      13             : //
+      14             : //  This program is distributed in the hope that it will be useful,
+      15             : //  but WITHOUT ANY WARRANTY; without even the implied warranty of
+      16             : //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+      17             : //  GNU General Public License for more details.
+      18             : //
+      19             : //  You should have received a copy of the GNU General Public License
+      20             : //  along with this program. If not, see <http://www.gnu.org/licenses/>.
+      21             : //----------------------------------------------------------------------
+      22             : 
+      23             : #include "crpropa/magneticLens/Pixelization.h"
+      24             : #include "crpropa/Random.h"
+      25             : 
+      26             : namespace crpropa 
+      27             : {
+      28             : 
+      29             :         healpix::T_Healpix_Base<healpix::int64> Pixelization::_healpix_nest = healpix::T_Healpix_Base<healpix::int64>(29, healpix::NEST);
+      30             : 
+      31             : 
+      32           0 : uint8_t Pixelization::pix2Order(uint32_t pix)
+      33             : {
+      34           0 :         for (uint8_t i = 0; i < _nOrder_max; i++)
+      35             :         {
+      36           0 :                 if (pix == _nPix[i])
+      37           0 :                         return i + 1;
+      38             :         }
+      39             :         return 0;
+      40             : }
+      41             : 
+      42           0 : uint32_t Pixelization::nPix(uint8_t order)
+      43             : {
+      44           0 :         if (order > _nOrder_max)
+      45             :         {
+      46             :                 return 0;
+      47             :         }
+      48             :         else
+      49             :         {
+      50           0 :                 return _nPix[order - 1];
+      51             :         }
+      52             : }
+      53             : 
+      54       24585 : uint32_t Pixelization::direction2Pix(double longitude, double latitude) const
+      55             : {
+      56             :         healpix::vec3 v;
+      57       24585 :         spherCo2Vec(longitude, latitude, v);
+      58             :         try
+      59             :         {
+      60       24585 :                 uint32_t i = (uint32_t) _healpix->vec2pix(v);
+      61       24585 :                 return i;
+      62             :         }
+      63           0 :         catch (healpix::PlanckError &e)
+      64             :         {
+      65           0 :                 std::cerr << "Healpix error triggered from direction2Pix(" << longitude << ", " << latitude  << ")\n";
+      66           0 :                 std::cerr << " v = " << v.x <<", " << v.y << ", " <<  v.z << std::endl;
+      67           0 :                 std::cerr << "\n The original exception reads:\n";
+      68           0 :                 std::cerr << e.what() << std::endl;
+      69           0 :                 throw;
+      70           0 :         }
+      71             : }
+      72             : 
+      73       36868 : void Pixelization::pix2Direction(uint32_t i, double &longitude,
+      74             :                 double &latitude) const
+      75             : {
+      76             :         healpix::vec3 v;
+      77             :         try{
+      78       36868 :                 v = _healpix->pix2vec(i);
+      79             :         }
+      80           0 :         catch (healpix::PlanckError &e)
+      81             :         {
+      82           0 :                 std::cerr << "Healpix error triggered from pix2Direction(" << i << ", &longitude, &latitude " << ")\n";
+      83           0 :                 std::cerr << "The original exception reads:\n";
+      84           0 :                 std::cerr << e.what() << std::endl;
+      85           0 :                 throw;
+      86           0 :         }
+      87             : 
+      88       36868 :         vec2SphereCo(longitude, latitude, v);
+      89       36868 : }
+      90             : 
+      91       24585 : void Pixelization::spherCo2Vec(double phi, double theta,
+      92             :                 healpix::vec3 &V) const
+      93             : {
+      94       24585 :         V.x = cos(phi) * cos(theta);
+      95       24585 :         V.y = sin(phi) * cos(theta);
+      96       24585 :         V.z = sin(theta);
+      97       24585 : }
+      98             : 
+      99       37289 : void Pixelization::vec2SphereCo(double &phi, double &theta,
+     100             :                 const healpix::vec3 &V) const
+     101             : {
+     102       37289 :         theta = asin(V.z);
+     103       37289 :         phi = healpix::safe_atan2(V.y, V.x);
+     104       37289 : }
+     105             : 
+     106             : 
+     107       49152 : double Pixelization::angularDistance(uint32_t i, uint32_t j) const
+     108             : {
+     109             :         healpix::vec3 v1, v2;
+     110       49152 :         v1 = _healpix->pix2vec(i);
+     111       49152 :         v2 = _healpix->pix2vec(j);
+     112       49152 :         double s = v1.x * v2.x + v1.y * v2.y + v1.z * v2.z;
+     113             :         // Failsafe for numerical inaccuracies
+     114       49152 :         return ((s > 1) ? 0 : ((s < -1) ? M_PI : acos(s)));
+     115             : }
+     116             : 
+     117         421 : void Pixelization::getRandomDirectionInPixel(uint32_t i, double &longitude, double &latitude) 
+     118             : {
+     119             :         
+     120         421 :         uint64_t inest = _healpix->ring2nest(i);
+     121         421 :         uint64_t nUp = 29 - _healpix->Order();
+     122         421 :         uint64_t iUp = inest * pow(4, nUp);
+     123         421 :         iUp += Random::instance().randInt64(pow(4, nUp));
+     124             : 
+     125         421 :         healpix::vec3 v = _healpix_nest.pix2vec(iUp);
+     126             :         
+     127         421 :         vec2SphereCo(longitude, latitude, v);
+     128         421 : }
+     129             : } // namespace
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticLens/index-sort-f.html b/doc/coverageReport/src/magneticLens/index-sort-f.html new file mode 100644 index 000000000..2a95e9fb8 --- /dev/null +++ b/doc/coverageReport/src/magneticLens/index-sort-f.html @@ -0,0 +1,123 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticLens + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticLensHitTotalCoverage
Test:coverage.info.cleanedLines:14732245.7 %
Date:2024-04-08 14:58:22Functions:214151.2 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
ModelMatrix.cpp +
0.0%
+
0.0 %0 / 630.0 %0 / 7
MagneticLens.cpp +
41.3%41.3%
+
41.3 %43 / 10446.2 %6 / 13
ParticleMapsContainer.cpp +
70.5%70.5%
+
70.5 %74 / 10569.2 %9 / 13
Pixelization.cpp +
60.0%60.0%
+
60.0 %30 / 5075.0 %6 / 8
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticLens/index-sort-l.html b/doc/coverageReport/src/magneticLens/index-sort-l.html new file mode 100644 index 000000000..7bd0ec2a3 --- /dev/null +++ b/doc/coverageReport/src/magneticLens/index-sort-l.html @@ -0,0 +1,123 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticLens + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticLensHitTotalCoverage
Test:coverage.info.cleanedLines:14732245.7 %
Date:2024-04-08 14:58:22Functions:214151.2 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
ModelMatrix.cpp +
0.0%
+
0.0 %0 / 630.0 %0 / 7
MagneticLens.cpp +
41.3%41.3%
+
41.3 %43 / 10446.2 %6 / 13
Pixelization.cpp +
60.0%60.0%
+
60.0 %30 / 5075.0 %6 / 8
ParticleMapsContainer.cpp +
70.5%70.5%
+
70.5 %74 / 10569.2 %9 / 13
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/magneticLens/index.html b/doc/coverageReport/src/magneticLens/index.html new file mode 100644 index 000000000..bacc94ec2 --- /dev/null +++ b/doc/coverageReport/src/magneticLens/index.html @@ -0,0 +1,123 @@ + + + + + + + LCOV - coverage.info.cleaned - src/magneticLens + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/magneticLensHitTotalCoverage
Test:coverage.info.cleanedLines:14732245.7 %
Date:2024-04-08 14:58:22Functions:214151.2 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
MagneticLens.cpp +
41.3%41.3%
+
41.3 %43 / 10446.2 %6 / 13
ModelMatrix.cpp +
0.0%
+
0.0 %0 / 630.0 %0 / 7
ParticleMapsContainer.cpp +
70.5%70.5%
+
70.5 %74 / 10569.2 %9 / 13
Pixelization.cpp +
60.0%60.0%
+
60.0 %30 / 5075.0 %6 / 8
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/massDistribution/ConstantDensity.cpp.func-sort-c.html b/doc/coverageReport/src/massDistribution/ConstantDensity.cpp.func-sort-c.html new file mode 100644 index 000000000..506fe0201 --- /dev/null +++ b/doc/coverageReport/src/massDistribution/ConstantDensity.cpp.func-sort-c.html @@ -0,0 +1,148 @@ + + + + + + + LCOV - coverage.info.cleaned - src/massDistribution/ConstantDensity.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/massDistribution - ConstantDensity.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:748983.1 %
Date:2024-04-08 14:58:22Functions:181994.7 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa15ConstantDensity14getDescriptionB5cxx11Ev0
_ZN7crpropa15ConstantDensity5setH2Eb1
_ZN7crpropa15ConstantDensity5setH2Ed1
_ZN7crpropa15ConstantDensity5setHIEb1
_ZN7crpropa15ConstantDensity5setHIEd1
_ZN7crpropa15ConstantDensity6setHIIEb1
_ZN7crpropa15ConstantDensity6setHIIEd1
_ZN7crpropa15ConstantDensity10getIsForH2Ev2
_ZN7crpropa15ConstantDensity10getIsForHIEv2
_ZN7crpropa15ConstantDensity11getIsForHIIEv2
_ZN7crpropa15ConstantDensityC2Eddd3
_ZNK7crpropa15ConstantDensity10getDensityERKNS_7Vector3IdEE4
_ZNK7crpropa15ConstantDensity12getH2DensityERKNS_7Vector3IdEE4
_ZNK7crpropa15ConstantDensity12getHIDensityERKNS_7Vector3IdEE4
_ZNK7crpropa15ConstantDensity13getHIIDensityERKNS_7Vector3IdEE4
_ZNK7crpropa15ConstantDensity17getNucleonDensityERKNS_7Vector3IdEE4
_ZN7crpropa15ConstantDensity5setH2Ebd5
_ZN7crpropa15ConstantDensity5setHIEbd5
_ZN7crpropa15ConstantDensity6setHIIEbd5
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/massDistribution/ConstantDensity.cpp.func.html b/doc/coverageReport/src/massDistribution/ConstantDensity.cpp.func.html new file mode 100644 index 000000000..f0cb8a317 --- /dev/null +++ b/doc/coverageReport/src/massDistribution/ConstantDensity.cpp.func.html @@ -0,0 +1,148 @@ + + + + + + + LCOV - coverage.info.cleaned - src/massDistribution/ConstantDensity.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/massDistribution - ConstantDensity.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:748983.1 %
Date:2024-04-08 14:58:22Functions:181994.7 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa15ConstantDensity10getIsForH2Ev2
_ZN7crpropa15ConstantDensity10getIsForHIEv2
_ZN7crpropa15ConstantDensity11getIsForHIIEv2
_ZN7crpropa15ConstantDensity14getDescriptionB5cxx11Ev0
_ZN7crpropa15ConstantDensity5setH2Eb1
_ZN7crpropa15ConstantDensity5setH2Ebd5
_ZN7crpropa15ConstantDensity5setH2Ed1
_ZN7crpropa15ConstantDensity5setHIEb1
_ZN7crpropa15ConstantDensity5setHIEbd5
_ZN7crpropa15ConstantDensity5setHIEd1
_ZN7crpropa15ConstantDensity6setHIIEb1
_ZN7crpropa15ConstantDensity6setHIIEbd5
_ZN7crpropa15ConstantDensity6setHIIEd1
_ZN7crpropa15ConstantDensityC2Eddd3
_ZNK7crpropa15ConstantDensity10getDensityERKNS_7Vector3IdEE4
_ZNK7crpropa15ConstantDensity12getH2DensityERKNS_7Vector3IdEE4
_ZNK7crpropa15ConstantDensity12getHIDensityERKNS_7Vector3IdEE4
_ZNK7crpropa15ConstantDensity13getHIIDensityERKNS_7Vector3IdEE4
_ZNK7crpropa15ConstantDensity17getNucleonDensityERKNS_7Vector3IdEE4
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/massDistribution/ConstantDensity.cpp.gcov.html b/doc/coverageReport/src/massDistribution/ConstantDensity.cpp.gcov.html new file mode 100644 index 000000000..94c4d2718 --- /dev/null +++ b/doc/coverageReport/src/massDistribution/ConstantDensity.cpp.gcov.html @@ -0,0 +1,213 @@ + + + + + + + LCOV - coverage.info.cleaned - src/massDistribution/ConstantDensity.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/massDistribution - ConstantDensity.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:748983.1 %
Date:2024-04-08 14:58:22Functions:181994.7 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/massDistribution/ConstantDensity.h"
+       2             : 
+       3             : #include "kiss/logger.h"
+       4             : 
+       5             : #include <sstream>
+       6             : 
+       7             : namespace crpropa{
+       8             : 
+       9           3 : ConstantDensity::ConstantDensity(double HI, double HII, double H2) {
+      10             :         // set all types active which are not equal 0 and change number density
+      11           3 :         if(HI!=0)
+      12           3 :                 setHI(true, HI);
+      13           3 :         if(HII!=0)
+      14           3 :                 setHII(true, HII);
+      15           3 :         if(H2!=0)
+      16           3 :                 setH2(true, H2);
+      17           3 : }
+      18             : 
+      19           4 : double ConstantDensity::getDensity(const Vector3d &position) const {
+      20             :         double n = 0;
+      21             : 
+      22           4 :         if(isHI)
+      23           3 :                 n += HIdensitynumber;
+      24           4 :         if(isHII)
+      25           3 :                 n += HIIdensitynumber;
+      26           4 :         if(isH2)
+      27           3 :                 n += H2densitynumber;
+      28             : 
+      29             :         // check if all densities are deactivated and raise warning if so
+      30           4 :         if((isHI || isHII || isH2) == false){
+      31           2 :                 KISS_LOG_WARNING
+      32           1 :                         << "\nCalled getNucleonDensity on fully deactivated ConstantDensity "
+      33           1 :                         << "gas density model. In this case the density is allways set to 0. \n";
+      34             :         }
+      35             : 
+      36           4 :         return n;
+      37             : }
+      38             : 
+      39           4 : double ConstantDensity::getNucleonDensity(const Vector3d &position) const {
+      40             :         double n = 0;
+      41             : 
+      42           4 :         if(isHI)
+      43           3 :                 n += HIdensitynumber;
+      44           4 :         if(isHII)
+      45           3 :                 n += HIIdensitynumber;
+      46           4 :         if(isH2)
+      47           3 :                 n += 2*H2densitynumber;
+      48             : 
+      49             :         // check if all densities are deactivated and raise warning if so
+      50           4 :         if((isHI || isHII || isH2) == false){
+      51           2 :                 KISS_LOG_WARNING
+      52           1 :                         << "\nCalled getNucleonDensity on fully deactivated ConstantDensity "
+      53           1 :                         << "gas density model. In this case the density is allways set to 0. \n";
+      54             :         }
+      55           4 :         return n;
+      56             : }
+      57             : 
+      58           4 : double ConstantDensity::getHIDensity(const Vector3d &position) const {
+      59           4 :         return HIdensitynumber;
+      60             : }
+      61             : 
+      62           4 : double ConstantDensity::getHIIDensity(const Vector3d &position) const{
+      63           4 :         return HIIdensitynumber;
+      64             : }
+      65             : 
+      66           4 : double ConstantDensity::getH2Density(const Vector3d &position) const{
+      67           4 :         return H2densitynumber;
+      68             : }
+      69             : 
+      70           2 : bool ConstantDensity::getIsForHI() {
+      71           2 :         return isHI;
+      72             : }
+      73             : 
+      74           2 : bool ConstantDensity::getIsForHII() {
+      75           2 :         return isHII;
+      76             : }
+      77             : 
+      78           2 : bool ConstantDensity::getIsForH2() {
+      79           2 :         return isH2;
+      80             : }
+      81             : 
+      82           5 : void ConstantDensity::setHI(bool activate, double densitynumber) {
+      83           5 :         isHI = activate;
+      84           5 :         HIdensitynumber = densitynumber;
+      85           5 : }
+      86             : 
+      87           1 : void ConstantDensity::setHI(bool activate) {
+      88           1 :         setHI(activate, HIdensitynumber);
+      89           1 : }
+      90             : 
+      91           1 : void ConstantDensity::setHI(double densitynumber) {
+      92           1 :         setHI(isHI, densitynumber);
+      93           1 : }
+      94             : 
+      95           5 : void ConstantDensity::setHII(bool activate, double densitynumber) {
+      96           5 :         isHII = activate;
+      97           5 :         HIIdensitynumber = densitynumber;
+      98           5 : }
+      99             : 
+     100           1 : void ConstantDensity::setHII(bool activate) {
+     101           1 :         setHII(activate, HIIdensitynumber);
+     102           1 : }
+     103             : 
+     104           1 : void ConstantDensity::setHII(double densitynumber) {
+     105           1 :         setHII(isHII, densitynumber);
+     106           1 : }
+     107             : 
+     108           5 : void ConstantDensity::setH2(bool activate, double densitynumber) {
+     109           5 :         isH2 = activate;
+     110           5 :         H2densitynumber = densitynumber;
+     111           5 : }
+     112             : 
+     113           1 : void ConstantDensity::setH2(bool activate) {
+     114           1 :         setH2(activate, H2densitynumber);
+     115           1 : }
+     116             : 
+     117           1 : void ConstantDensity::setH2(double densitynumber) {
+     118           1 :         setH2(isH2, densitynumber);
+     119           1 : }
+     120             : 
+     121           0 : std::string ConstantDensity::getDescription() {
+     122           0 :         std::stringstream s;
+     123           0 :         s << "ConstantDensity:\n";
+     124           0 :         s<< "HI component is ";
+     125           0 :         if(!isHI)
+     126           0 :                 s<< "not ";
+     127           0 :         s<< "active and has a density of " << HIdensitynumber/ccm << " cm^-3" << "\nHII component is ";
+     128           0 :         if(!isHII)
+     129           0 :                 s<< "not ";
+     130           0 :         s<<"active and has a density of " << HIIdensitynumber/ccm<<" cm^-3" <<  "\nH2 component is ";
+     131           0 :         if(!isH2)
+     132           0 :                 s<<"not ";
+     133           0 :         s<<"active and has a density of " << H2densitynumber/ccm << " cm^-3";
+     134           0 :         return s.str();
+     135           0 : }
+     136             : 
+     137             : }  // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/massDistribution/Cordes.cpp.func-sort-c.html b/doc/coverageReport/src/massDistribution/Cordes.cpp.func-sort-c.html new file mode 100644 index 000000000..5ac34bc19 --- /dev/null +++ b/doc/coverageReport/src/massDistribution/Cordes.cpp.func-sort-c.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.info.cleaned - src/massDistribution/Cordes.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/massDistribution - Cordes.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:162176.2 %
Date:2024-04-08 14:58:22Functions:6785.7 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa6Cordes14getDescriptionB5cxx11Ev0
_ZN7crpropa6Cordes10getIsForH2Ev1
_ZN7crpropa6Cordes10getIsForHIEv1
_ZN7crpropa6Cordes11getIsForHIIEv1
_ZNK7crpropa6Cordes17getNucleonDensityERKNS_7Vector3IdEE1
_ZNK7crpropa6Cordes10getDensityERKNS_7Vector3IdEE2
_ZNK7crpropa6Cordes13getHIIDensityERKNS_7Vector3IdEE4
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/massDistribution/Cordes.cpp.func.html b/doc/coverageReport/src/massDistribution/Cordes.cpp.func.html new file mode 100644 index 000000000..6522e9bd4 --- /dev/null +++ b/doc/coverageReport/src/massDistribution/Cordes.cpp.func.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.info.cleaned - src/massDistribution/Cordes.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/massDistribution - Cordes.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:162176.2 %
Date:2024-04-08 14:58:22Functions:6785.7 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa6Cordes10getIsForH2Ev1
_ZN7crpropa6Cordes10getIsForHIEv1
_ZN7crpropa6Cordes11getIsForHIIEv1
_ZN7crpropa6Cordes14getDescriptionB5cxx11Ev0
_ZNK7crpropa6Cordes10getDensityERKNS_7Vector3IdEE2
_ZNK7crpropa6Cordes13getHIIDensityERKNS_7Vector3IdEE4
_ZNK7crpropa6Cordes17getNucleonDensityERKNS_7Vector3IdEE1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/massDistribution/Cordes.cpp.gcov.html b/doc/coverageReport/src/massDistribution/Cordes.cpp.gcov.html new file mode 100644 index 000000000..47a3e4fcf --- /dev/null +++ b/doc/coverageReport/src/massDistribution/Cordes.cpp.gcov.html @@ -0,0 +1,122 @@ + + + + + + + LCOV - coverage.info.cleaned - src/massDistribution/Cordes.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/massDistribution - Cordes.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:162176.2 %
Date:2024-04-08 14:58:22Functions:6785.7 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/massDistribution/Cordes.h"
+       2             : #include "crpropa/Common.h"
+       3             : 
+       4             : #include <sstream>
+       5             : 
+       6             : namespace crpropa {
+       7             : 
+       8           4 : double Cordes::getHIIDensity(const Vector3d &position) const {
+       9             :         double n=0;  // in m^-3
+      10             : 
+      11           4 :         double z=position.z;
+      12           4 :         double R = sqrt(position.x*position.x+position.y*position.y);  //radius in galactic disk
+      13             : 
+      14           4 :         n += 0.025/ccm*exp(-fabs(z)/(1*kpc))*exp(-pow_integer<2>(R/(20*kpc)));  // galactocentric component
+      15           4 :         n += 0.2/ccm*exp(-fabs(z)/(0.15*kpc))*exp(-pow_integer<2>((R-4*kpc)/(2*kpc)));  // anular component
+      16             : 
+      17           4 :         return n;
+      18             : }
+      19             : 
+      20           2 : double Cordes::getDensity(const Vector3d &position) const {
+      21           2 :         return Cordes::getHIIDensity(position);
+      22             : }
+      23             : 
+      24           1 : double Cordes::getNucleonDensity(const Vector3d &position) const {
+      25           1 :         return getHIIDensity(position);
+      26             : }
+      27             : 
+      28           1 : bool Cordes::getIsForHI() {
+      29           1 :         return isforHI;
+      30             : }
+      31             : 
+      32           1 : bool Cordes::getIsForHII() {
+      33           1 :         return isforHII;
+      34             : }
+      35             : 
+      36           1 : bool Cordes::getIsForH2() {
+      37           1 :         return isforH2;
+      38             : }
+      39             : 
+      40           0 : std::string Cordes::getDescription() {
+      41           0 :         std::stringstream s;
+      42           0 :         s << "Density Cordes: includes only an HII component";
+      43           0 :         return s.str();
+      44           0 : }
+      45             : 
+      46             : }  // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/massDistribution/Ferriere.cpp.func-sort-c.html b/doc/coverageReport/src/massDistribution/Ferriere.cpp.func-sort-c.html new file mode 100644 index 000000000..31d3bf13c --- /dev/null +++ b/doc/coverageReport/src/massDistribution/Ferriere.cpp.func-sort-c.html @@ -0,0 +1,128 @@ + + + + + + + LCOV - coverage.info.cleaned - src/massDistribution/Ferriere.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/massDistribution - Ferriere.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13615190.1 %
Date:2024-04-08 14:58:22Functions:131492.9 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa8Ferriere14getDescriptionB5cxx11Ev0
_ZN7crpropa8Ferriere10setIsForH2Eb1
_ZN7crpropa8Ferriere10setIsForHIEb1
_ZN7crpropa8Ferriere11setIsForHIIEb1
_ZN7crpropa8Ferriere10getIsForH2Ev4
_ZN7crpropa8Ferriere10getIsForHIEv4
_ZN7crpropa8Ferriere11getIsForHIIEv4
_ZNK7crpropa8Ferriere10getDensityERKNS_7Vector3IdEE5
_ZNK7crpropa8Ferriere17getNucleonDensityERKNS_7Vector3IdEE5
_ZNK7crpropa8Ferriere12getH2DensityERKNS_7Vector3IdEE12
_ZNK7crpropa8Ferriere12getHIDensityERKNS_7Vector3IdEE12
_ZNK7crpropa8Ferriere13getHIIDensityERKNS_7Vector3IdEE12
_ZNK7crpropa8Ferriere17CMZTransformationERKNS_7Vector3IdEE13
_ZNK7crpropa8Ferriere18DiskTransformationERKNS_7Vector3IdEE13
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/massDistribution/Ferriere.cpp.func.html b/doc/coverageReport/src/massDistribution/Ferriere.cpp.func.html new file mode 100644 index 000000000..0c1bd9d00 --- /dev/null +++ b/doc/coverageReport/src/massDistribution/Ferriere.cpp.func.html @@ -0,0 +1,128 @@ + + + + + + + LCOV - coverage.info.cleaned - src/massDistribution/Ferriere.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/massDistribution - Ferriere.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13615190.1 %
Date:2024-04-08 14:58:22Functions:131492.9 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa8Ferriere10getIsForH2Ev4
_ZN7crpropa8Ferriere10getIsForHIEv4
_ZN7crpropa8Ferriere10setIsForH2Eb1
_ZN7crpropa8Ferriere10setIsForHIEb1
_ZN7crpropa8Ferriere11getIsForHIIEv4
_ZN7crpropa8Ferriere11setIsForHIIEb1
_ZN7crpropa8Ferriere14getDescriptionB5cxx11Ev0
_ZNK7crpropa8Ferriere10getDensityERKNS_7Vector3IdEE5
_ZNK7crpropa8Ferriere12getH2DensityERKNS_7Vector3IdEE12
_ZNK7crpropa8Ferriere12getHIDensityERKNS_7Vector3IdEE12
_ZNK7crpropa8Ferriere13getHIIDensityERKNS_7Vector3IdEE12
_ZNK7crpropa8Ferriere17CMZTransformationERKNS_7Vector3IdEE13
_ZNK7crpropa8Ferriere17getNucleonDensityERKNS_7Vector3IdEE5
_ZNK7crpropa8Ferriere18DiskTransformationERKNS_7Vector3IdEE13
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/massDistribution/Ferriere.cpp.gcov.html b/doc/coverageReport/src/massDistribution/Ferriere.cpp.gcov.html new file mode 100644 index 000000000..b32294595 --- /dev/null +++ b/doc/coverageReport/src/massDistribution/Ferriere.cpp.gcov.html @@ -0,0 +1,349 @@ + + + + + + + LCOV - coverage.info.cleaned - src/massDistribution/Ferriere.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/massDistribution - Ferriere.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13615190.1 %
Date:2024-04-08 14:58:22Functions:131492.9 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/massDistribution/Ferriere.h"
+       2             : #include "crpropa/Common.h"
+       3             : 
+       4             : #include "kiss/logger.h"
+       5             : 
+       6             : #include <sstream>
+       7             : 
+       8             : namespace crpropa {
+       9             : 
+      10          13 : Vector3d Ferriere::CMZTransformation(const Vector3d &position) const {
+      11             :         // set galactocentric coordinate system with the Sun at (-8.5,0.,0.) instead of (8.5, 0, 0) to be consistand with JF12 implementation
+      12          13 :         double x = -position.x;
+      13          13 :         double y = -position.y;
+      14             : 
+      15             :         double xC = -50*pc;             //offset
+      16             :         double yC = 50*pc;
+      17             :         double sinTc = sin(70.*deg);
+      18             :         double cosTc = cos(70.*deg);
+      19             : 
+      20             :         Vector3d pos;
+      21          13 :         pos.x = (x - xC)*cosTc + (y - yC)*sinTc;
+      22          13 :         pos.y = -(x - xC)*sinTc + (y - yC)*cosTc;
+      23          13 :         pos.z = position.z;
+      24             : 
+      25          13 :         return pos;
+      26             : }
+      27             : 
+      28          13 : Vector3d Ferriere::DiskTransformation(const Vector3d &position) const {
+      29             :         // set galactocentric coordinate system with the Sun at (-8.5,0.,0.) instead of (8.5, 0, 0) to be consistand with JF12 implementation
+      30          13 :         double x = -position.x;
+      31          13 :         double y = - position.y;
+      32          13 :         double z = position.z;
+      33             : 
+      34             :         double alphaD = 13.5*deg;  // rotation arround x-axis
+      35             :         double sinAd = sin(alphaD);
+      36             :         double cosAd = cos(alphaD);
+      37             :         double betaD = 20.*deg;  // rotation arround y'-axis
+      38             :         double sinBd = sin(betaD);
+      39             :         double cosBd = cos(betaD);
+      40             :         double TettaD = 48.5*deg;  // rotation arround x"-axis
+      41             :         double sinTd = sin(TettaD);
+      42             :         double cosTd = cos(TettaD);
+      43             : 
+      44             :         Vector3d pos;
+      45             : 
+      46          13 :         pos.x = x*cosBd*cosTd - y*(sinAd*sinBd*cosTd -cosAd*sinTd)-z*(cosAd*sinBd*cosTd +sinAd*sinTd);
+      47             : 
+      48          13 :         pos.y =  -x*cosBd*sinTd;
+      49          13 :         pos.y += y*(sinAd*sinBd*sinTd +cosAd*cosTd);
+      50          13 :         pos.y += z*(cosAd*sinBd*sinTd -sinAd*cosTd);
+      51             : 
+      52          13 :         pos.z = x*sinBd;
+      53          13 :         pos.z += y*sinAd*cosBd;
+      54          13 :         pos.z += z*cosAd*cosBd;
+      55             : 
+      56          13 :         return pos;
+      57             : }
+      58             : 
+      59          12 : double Ferriere::getHIDensity(const Vector3d &position) const {
+      60             :         double n = 0;
+      61          12 :         double R = sqrt(position.x*position.x+position.y*position.y);
+      62             : 
+      63          12 :         if(R<3*kpc)
+      64             :         {
+      65             :                 // density at center
+      66           6 :                 Vector3d pos = CMZTransformation(position);  // coordinate trafo
+      67           6 :                 double x = pos.x/pc;  // all units in pc
+      68           6 :                 double y = pos.y/pc;
+      69           6 :                 double z = pos.z/pc;
+      70             : 
+      71           6 :                 double A = sqrt(x*x+2.5*2.5*y*y);
+      72           6 :                 double nCMZ = 8.8/ccm*exp(-pow_integer<4>((A-125.)/137))*exp(-pow_integer<2>(z/54.));
+      73             : 
+      74             :                 // density in disk
+      75           6 :                 pos = DiskTransformation(position);  // Corrdinate Trafo
+      76           6 :                 x = pos.x/pc;  // all units in pc
+      77           6 :                 y = pos.y/pc;
+      78           6 :                 z = pos.z/pc;
+      79             : 
+      80           6 :                 A = sqrt(x*x+3.1*3.1*y*y);
+      81           6 :                 double nDisk = 0.34/ccm*exp(-pow_integer<4>((A-1200.)/438.))*exp(-pow_integer<2>(z/120));
+      82             : 
+      83           6 :                 n = nCMZ + nDisk;
+      84             :         }
+      85             :         else{  // outer region
+      86           6 :                 double z = position.z/pc;
+      87             :                 double a;
+      88           6 :                 if(R<=Rsun){
+      89             :                         a = 1;
+      90             :                 } else {
+      91           3 :                         a = R/Rsun;
+      92             :                 }
+      93             : 
+      94           6 :                 double nCold = 0.859*exp(-pow_integer<2>(z/(127*a))); // cold HI
+      95           6 :                 nCold += 0.047*exp(-pow_integer<2>(z/(318*a)));
+      96           6 :                 nCold += 0.094*exp(-fabs(z)/(403*a));
+      97           6 :                 nCold *= 0.340/ccm/(a*a);
+      98             : 
+      99           6 :                 double nWarm = (1.745 - 1.289/a)*exp(-pow_integer<2>(z/(127*a)));  // warm HI
+     100           6 :                 nWarm += (0.473 - 0.070/a)*exp(-pow_integer<2>(z/(318*a)));
+     101           6 :                 nWarm += (0.283 - 0.142/a)*exp(-fabs(z)/(403*a));
+     102           6 :                 nWarm *= 0.226/ccm/a;
+     103             : 
+     104           6 :                 n = nWarm + nCold;
+     105             :         }
+     106             : 
+     107          12 :         return n;
+     108             : }
+     109             : 
+     110          12 : double Ferriere::getHIIDensity(const Vector3d &position) const {
+     111             :         double n = 0;
+     112          12 :         double R = sqrt(position.x*position.x+position.y*position.y);
+     113             : 
+     114          12 :         if(R< 3*kpc){   // inner
+     115           6 :                 double x = position.x/pc;
+     116           6 :                 double y = position.y/pc;
+     117           6 :                 double z = position.z/pc;
+     118             : 
+     119             :                 // warm interstellar matter
+     120           6 :                 double H = (x*x + pow_integer<2>(y+10.))/(145*145);
+     121           6 :                 double nWIM = exp(-H)* exp(-pow_integer<2>(z+20.)/(26*26));
+     122           6 :                 nWIM += 0.009*exp(-pow_integer<2>((R/pc-3700)/(0.5*3700)))*1/pow_integer<2>(cosh(z/140.));
+     123           6 :                 nWIM += 0.005*cos(M_PI*R/pc*0.5/17000)*1/pow_integer<2>(cosh(z/950.));
+     124           6 :                 nWIM *= 8.0/ccm;  // rescaling with density at center
+     125             : 
+     126             :                 //very hot interstellar matter
+     127             :                 double alphaVH = 21.*deg;  // angle for very hot IM in radiant
+     128             :                 double cosA = cos(alphaVH);
+     129             :                 double sinA = sin(alphaVH);
+     130           6 :                 double etta = y*cosA+z*sinA;  // coordinate transformation for VHIM along major axis
+     131           6 :                 double chi = -y*sinA+z*cosA;
+     132             : 
+     133           6 :                 double nVHIM = 0.29/ccm*exp(-((x*x+etta*etta)/(162.*162.)+chi*chi/(90*90)));
+     134             : 
+     135           6 :                 n = nWIM + nVHIM;
+     136             :         } else {  // outer region
+     137           6 :                 double z = position.z;
+     138             : 
+     139           6 :                 double nWarm = 0.0237/ccm*exp(-(R*R-Rsun*Rsun)/pow_integer<2>(37*kpc))*exp(-fabs(z)/(1*kpc));
+     140           6 :                 nWarm += 0.0013/ccm*exp(-(pow_integer<2>(R-4*kpc)-pow_integer<2>(Rsun-4*kpc))/pow_integer<2>(2*kpc))*exp(-fabs(z)/(150*pc));
+     141             : 
+     142           6 :                 double nHot = 0.12*exp(-(R-Rsun)/(4.9*kpc));
+     143           6 :                 nHot += 0.88*exp(-(pow_integer<2>(R-4.5*kpc)-pow_integer<2>(Rsun-4.5*kpc))/pow_integer<2>(2.9*kpc));
+     144           6 :                 nHot *= pow(R/Rsun, -1.65);
+     145           6 :                 nHot *= exp(-fabs(z)/((1500*pc)*pow(R/Rsun,1.65)));
+     146           6 :                 nHot *= 4.8e-4/ccm;
+     147             : 
+     148           6 :                 n= nWarm + nHot;
+     149             :         }
+     150          12 :         return n;
+     151             : }
+     152             : 
+     153          12 : double Ferriere::getH2Density(const Vector3d &position) const{
+     154             :         double n=0;
+     155          12 :         double R=sqrt(position.x*position.x+position.y*position.y);
+     156             : 
+     157          12 :         if(R<3*kpc) {
+     158             :                 // density at center
+     159           6 :                 Vector3d pos =CMZTransformation(position);  // coord trafo for CMZ
+     160           6 :                 double x = pos.x/pc;  // all units in pc
+     161           6 :                 double y = pos.y/pc;
+     162           6 :                 double z = pos.z/pc;
+     163             : 
+     164           6 :                 double A = sqrt(x*x+pow(2.5*y,2));  // ellipticity
+     165           6 :                 double nCMZ = exp(-pow((A-125.)/137.,4))*exp(-pow(z/18.,2));
+     166           6 :                 nCMZ *= 150/ccm;  // rescaling
+     167             : 
+     168             :                 // density in disk
+     169           6 :                 pos = DiskTransformation(position);  // coord trafo for disk
+     170           6 :                 x=pos.x/pc;
+     171           6 :                 y=pos.y/pc;
+     172           6 :                 z=pos.z/pc;
+     173             : 
+     174           6 :                 A = sqrt(x*x+pow_integer<2>(3.1*y));
+     175           6 :                 double nDISK = exp(-pow_integer<4>((A-1200)/438))*exp(-pow_integer<2>(z/42));
+     176           6 :                 nDISK *= 4.8/ccm;  // rescaling
+     177             : 
+     178           6 :                 n = nCMZ + nDISK;
+     179             :         } else {  // outer region
+     180           6 :                 double z = position.z/pc;
+     181           6 :                 n = pow(R/Rsun, -0.58);
+     182           6 :                 n *= exp(-(pow_integer<2>(R-4.5*kpc)-pow_integer<2>(Rsun-4.5*kpc))/pow_integer<2>(2.9*kpc));
+     183           6 :                 n *= exp(-pow_integer<2>(z/(81*pow(R/Rsun,0.58))));
+     184           6 :                 n *= 0.58/ccm;  // rescaling
+     185             :         }
+     186             : 
+     187          12 :         return n;
+     188             : }
+     189             : 
+     190           5 : double Ferriere::getDensity(const Vector3d &position) const{
+     191             :         double n=0;
+     192           5 :         if(isforHI){
+     193           4 :                 n += getHIDensity(position);
+     194             :         }
+     195           5 :         if(isforHII){
+     196           4 :                 n+=getHIIDensity(position);
+     197             :         }
+     198           5 :         if(isforH2){
+     199           4 :                 n+=getH2Density(position);
+     200             :         }
+     201             :         // check if all densities are deactivated and raise warning if so
+     202           5 :         if((isforHI || isforHII || isforH2) == false){
+     203           2 :                 KISS_LOG_WARNING
+     204           1 :                         << "\nCalled getDensity on fully deactivated Ferriere \n"
+     205           1 :                         << "gas density model. The total density is set to 0.";
+     206             :         }
+     207             : 
+     208           5 :         return n;
+     209             : }
+     210             : 
+     211           5 : double Ferriere::getNucleonDensity(const Vector3d &position) const{
+     212             :         double n=0;
+     213           5 :         if(isforHI){
+     214           4 :                 n += getHIDensity(position);
+     215             :         }
+     216           5 :         if(isforHII){
+     217           4 :                 n+=getHIIDensity(position);
+     218             :         }
+     219           5 :         if(isforH2){
+     220           4 :                 n+= 2*getH2Density(position);
+     221             :         }
+     222             : 
+     223             :         // check if all densities are deactivated and raise warning if so
+     224           5 :         if((isforHI || isforHII || isforH2) == false){
+     225           2 :                 KISS_LOG_WARNING
+     226           1 :                         << "\nCalled getNucleonDensity on fully deactivated Ferriere \n"
+     227           1 :                         << "gas density model. The total density is set to 0.";
+     228             :         }
+     229             : 
+     230           5 :         return n;
+     231             : }
+     232             : 
+     233           1 : void Ferriere::setIsForHI(bool HI){
+     234           1 :         isforHI = HI;
+     235           1 : }
+     236             : 
+     237           1 : void Ferriere::setIsForHII(bool HII){
+     238           1 :         isforHII = HII;
+     239           1 : }
+     240             : 
+     241           1 : void Ferriere::setIsForH2(bool H2){
+     242           1 :         isforH2 = H2;
+     243           1 : }
+     244             : 
+     245           4 : bool Ferriere::getIsForHI(){
+     246           4 :         return isforHI;
+     247             : }
+     248             : 
+     249           4 : bool Ferriere::getIsForHII(){
+     250           4 :         return isforHII;
+     251             : }
+     252             : 
+     253           4 : bool Ferriere::getIsForH2(){
+     254           4 :         return isforH2;
+     255             : }
+     256             : 
+     257           0 : std::string Ferriere::getDescription() {
+     258           0 :         std::stringstream s;
+     259           0 :         s << "Density model Ferriere 2007:\n";
+     260           0 :         s<< "HI component is ";
+     261           0 :         if(!isforHI)
+     262           0 :                 s<< "not ";
+     263           0 :         s<< "active.\nHII component is ";
+     264           0 :         if(!isforHII)
+     265           0 :                 s<< "not ";
+     266           0 :         s<<"active.\nH2 component is ";
+     267           0 :         if(!isforH2)
+     268           0 :                 s<<"not ";
+     269           0 :         s<<"active.";
+     270           0 :         return s.str();
+     271           0 : }
+     272             : 
+     273             : }  // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/massDistribution/Massdistribution.cpp.func-sort-c.html b/doc/coverageReport/src/massDistribution/Massdistribution.cpp.func-sort-c.html new file mode 100644 index 000000000..bf02e8f4f --- /dev/null +++ b/doc/coverageReport/src/massDistribution/Massdistribution.cpp.func-sort-c.html @@ -0,0 +1,160 @@ + + + + + + + LCOV - coverage.info.cleaned - src/massDistribution/Massdistribution.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/massDistribution - Massdistribution.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:658576.5 %
Date:2024-04-08 14:58:22Functions:192286.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11DensityGrid14getDescriptionB5cxx11Ev0
_ZN7crpropa11DensityGrid7setGridENS_7ref_ptrINS_4GridIfEEEE0
_ZN7crpropa11DensityList14getDescriptionB5cxx11Ev0
_ZN7crpropa11DensityGrid10setIsForH2Eb1
_ZN7crpropa11DensityGrid10setIsForHIEb1
_ZN7crpropa11DensityGrid11setIsForHIIEb1
_ZNK7crpropa11DensityGrid10getDensityERKNS_7Vector3IdEE1
_ZNK7crpropa11DensityGrid17getNucleonDensityERKNS_7Vector3IdEE1
_ZNK7crpropa11DensityList10getDensityERKNS_7Vector3IdEE1
_ZNK7crpropa11DensityList12getH2DensityERKNS_7Vector3IdEE1
_ZNK7crpropa11DensityList12getHIDensityERKNS_7Vector3IdEE1
_ZNK7crpropa11DensityList13getHIIDensityERKNS_7Vector3IdEE1
_ZNK7crpropa11DensityList17getNucleonDensityERKNS_7Vector3IdEE1
_ZN7crpropa11DensityGrid10getIsForH2Ev2
_ZN7crpropa11DensityGrid10getIsForHIEv2
_ZN7crpropa11DensityGrid11getIsForHIIEv2
_ZN7crpropa11DensityGridC2ENS_7ref_ptrINS_4GridIfEEEEbbb2
_ZN7crpropa11DensityList10addDensityENS_7ref_ptrINS_7DensityEEE2
_ZNK7crpropa11DensityGrid12getH2DensityERKNS_7Vector3IdEE3
_ZNK7crpropa11DensityGrid12getHIDensityERKNS_7Vector3IdEE3
_ZNK7crpropa11DensityGrid13getHIIDensityERKNS_7Vector3IdEE3
_ZN7crpropa11DensityGrid12checkAndWarnEv5
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/massDistribution/Massdistribution.cpp.func.html b/doc/coverageReport/src/massDistribution/Massdistribution.cpp.func.html new file mode 100644 index 000000000..350b48552 --- /dev/null +++ b/doc/coverageReport/src/massDistribution/Massdistribution.cpp.func.html @@ -0,0 +1,160 @@ + + + + + + + LCOV - coverage.info.cleaned - src/massDistribution/Massdistribution.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/massDistribution - Massdistribution.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:658576.5 %
Date:2024-04-08 14:58:22Functions:192286.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11DensityGrid10getIsForH2Ev2
_ZN7crpropa11DensityGrid10getIsForHIEv2
_ZN7crpropa11DensityGrid10setIsForH2Eb1
_ZN7crpropa11DensityGrid10setIsForHIEb1
_ZN7crpropa11DensityGrid11getIsForHIIEv2
_ZN7crpropa11DensityGrid11setIsForHIIEb1
_ZN7crpropa11DensityGrid12checkAndWarnEv5
_ZN7crpropa11DensityGrid14getDescriptionB5cxx11Ev0
_ZN7crpropa11DensityGrid7setGridENS_7ref_ptrINS_4GridIfEEEE0
_ZN7crpropa11DensityGridC2ENS_7ref_ptrINS_4GridIfEEEEbbb2
_ZN7crpropa11DensityList10addDensityENS_7ref_ptrINS_7DensityEEE2
_ZN7crpropa11DensityList14getDescriptionB5cxx11Ev0
_ZNK7crpropa11DensityGrid10getDensityERKNS_7Vector3IdEE1
_ZNK7crpropa11DensityGrid12getH2DensityERKNS_7Vector3IdEE3
_ZNK7crpropa11DensityGrid12getHIDensityERKNS_7Vector3IdEE3
_ZNK7crpropa11DensityGrid13getHIIDensityERKNS_7Vector3IdEE3
_ZNK7crpropa11DensityGrid17getNucleonDensityERKNS_7Vector3IdEE1
_ZNK7crpropa11DensityList10getDensityERKNS_7Vector3IdEE1
_ZNK7crpropa11DensityList12getH2DensityERKNS_7Vector3IdEE1
_ZNK7crpropa11DensityList12getHIDensityERKNS_7Vector3IdEE1
_ZNK7crpropa11DensityList13getHIIDensityERKNS_7Vector3IdEE1
_ZNK7crpropa11DensityList17getNucleonDensityERKNS_7Vector3IdEE1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/massDistribution/Massdistribution.cpp.gcov.html b/doc/coverageReport/src/massDistribution/Massdistribution.cpp.gcov.html new file mode 100644 index 000000000..8d925d1a5 --- /dev/null +++ b/doc/coverageReport/src/massDistribution/Massdistribution.cpp.gcov.html @@ -0,0 +1,222 @@ + + + + + + + LCOV - coverage.info.cleaned - src/massDistribution/Massdistribution.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/massDistribution - Massdistribution.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:658576.5 %
Date:2024-04-08 14:58:22Functions:192286.4 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/massDistribution/Massdistribution.h"
+       2             : #include <sstream>
+       3             : namespace crpropa {
+       4             : 
+       5           2 : void DensityList::addDensity(ref_ptr<Density> dens) {
+       6           2 :         DensityList.push_back(dens);
+       7           2 : }
+       8             : 
+       9           1 : double DensityList::getDensity(const Vector3d &position) const {
+      10             :         double n = 0.;
+      11           3 :         for (int i = 0; i < DensityList.size(); i++)
+      12           2 :                 n += DensityList[i]->getDensity(position);
+      13           1 :         return n;
+      14             : }
+      15             : 
+      16           1 : double DensityList::getHIDensity(const Vector3d &position) const {
+      17             :         double n = 0.;
+      18           3 :         for (int i = 0; i < DensityList.size(); i++)
+      19           2 :                 n += DensityList[i]->getHIDensity(position);
+      20           1 :         return n;
+      21             : }
+      22             : 
+      23           1 : double DensityList::getHIIDensity(const Vector3d &position) const {
+      24             :         double n = 0.;
+      25           3 :         for (int i = 0; i < DensityList.size(); i++)
+      26           2 :                 n += DensityList[i]->getHIIDensity(position);
+      27           1 :         return n;
+      28             : }
+      29             : 
+      30           1 : double DensityList::getH2Density(const Vector3d &position) const {
+      31             :         double n = 0.;
+      32           3 :         for (int i = 0; i < DensityList.size(); i++)
+      33           2 :                 n += DensityList[i]->getH2Density(position);
+      34           1 :         return n;
+      35             : }
+      36             : 
+      37           1 : double DensityList::getNucleonDensity(const Vector3d &position) const {
+      38             :         double n = 0.;
+      39           3 :         for (int i = 0; i < DensityList.size(); i++)
+      40           2 :                 n += DensityList[i]->getNucleonDensity(position);
+      41           1 :         return n;
+      42             : }
+      43             : 
+      44           0 : std::string DensityList::getDescription() {
+      45           0 :         std::stringstream ss; 
+      46           0 :         ss << "DensityList with " << DensityList.size() << " modules: \n";
+      47           0 :         for (int i = 0; i < DensityList.size(); i++) {
+      48           0 :                 ss << "density " << i + 1 << ": " << DensityList[i] -> getDescription();
+      49             :         }
+      50             :         
+      51           0 :         return ss.str();
+      52           0 : }
+      53             : 
+      54             : // ----------- DensityGrid -----------------------------------------------------------------
+      55             : 
+      56           2 : DensityGrid::DensityGrid(ref_ptr<Grid1f> grid, bool isForHI, bool isForHII, bool isForH2) : 
+      57           2 :         grid(grid), isForHI(isForHI), isForHII(isForHII), isForH2(isForH2) {
+      58           2 :                 checkAndWarn();
+      59           2 :         }
+      60             : 
+      61           5 : void DensityGrid::checkAndWarn() {
+      62           5 :         bool allDeactivated = (isForHI == false) && (isForHII == false) && (isForH2 == false);
+      63             :         if (allDeactivated) {
+      64           0 :                 KISS_LOG_WARNING << "DensityGrid has all types deactivated."
+      65           0 :                         << "In this case all output will be n = 0. \n"
+      66           0 :                         << "Please activate the intended particle type. \n";
+      67             :         }
+      68           5 : }
+      69             : 
+      70           3 : double DensityGrid::getHIDensity(const Vector3d &position) const {
+      71           3 :         if (isForHI)
+      72           3 :                 return grid -> interpolate(position);
+      73             :         else 
+      74             :                 return 0.;
+      75             : }
+      76             : 
+      77           3 : double DensityGrid::getHIIDensity(const Vector3d &position) const {
+      78           3 :         if (isForHII) 
+      79           0 :                 return grid -> interpolate(position);
+      80             :         else
+      81             :                 return 0.;
+      82             : }
+      83             : 
+      84           3 : double DensityGrid::getH2Density(const Vector3d &position) const {
+      85           3 :         if (isForH2)
+      86           0 :                 return grid -> interpolate(position);
+      87             :         else
+      88             :                 return 0.;
+      89             : }
+      90             : 
+      91           1 : double DensityGrid::getDensity(const Vector3d &position) const {
+      92             :         double n = 0;
+      93           1 :         n += getHIDensity(position);
+      94           1 :         n += getHIIDensity(position);
+      95           1 :         n += getH2Density(position);
+      96             : 
+      97           1 :         return n;
+      98             : }
+      99             : 
+     100           1 : double DensityGrid::getNucleonDensity(const Vector3d &position) const {
+     101             :         double n = 0;
+     102           1 :         n += getHIDensity(position);
+     103           1 :         n += getHIIDensity(position);
+     104           1 :         n += 2 * getH2Density(position);
+     105             : 
+     106           1 :         return n;
+     107             : }
+     108             : 
+     109           2 : bool DensityGrid::getIsForHI() {
+     110           2 :         return isForHI;
+     111             : }
+     112             : 
+     113           2 : bool DensityGrid::getIsForHII() {
+     114           2 :         return isForHII;
+     115             : }
+     116             : 
+     117           2 : bool DensityGrid::getIsForH2() {
+     118           2 :         return isForH2;
+     119             : }
+     120             : 
+     121           1 : void DensityGrid::setIsForHI(bool b) {
+     122           1 :         isForHI = b;
+     123           1 :         checkAndWarn();
+     124           1 : }
+     125             : 
+     126           1 : void DensityGrid::setIsForHII(bool b) {
+     127           1 :         isForHII = b;
+     128           1 :         checkAndWarn();
+     129           1 : }
+     130             : 
+     131           1 : void DensityGrid::setIsForH2(bool b) {
+     132           1 :         isForH2 = b;
+     133           1 :         checkAndWarn();
+     134           1 : }
+     135             : 
+     136           0 : void DensityGrid::setGrid(ref_ptr<Grid1f> grid) {
+     137           0 :         this->grid = grid;
+     138           0 : }
+     139             : 
+     140           0 : std::string DensityGrid::getDescription() {
+     141           0 :         std::stringstream ss;
+     142           0 :         ss << "Density in a given grid \n"; 
+     143           0 :         return ss.str();
+     144           0 : }
+     145             : 
+     146             : } //namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/massDistribution/Nakanishi.cpp.func-sort-c.html b/doc/coverageReport/src/massDistribution/Nakanishi.cpp.func-sort-c.html new file mode 100644 index 000000000..6cf5bc02a --- /dev/null +++ b/doc/coverageReport/src/massDistribution/Nakanishi.cpp.func-sort-c.html @@ -0,0 +1,128 @@ + + + + + + + LCOV - coverage.info.cleaned - src/massDistribution/Nakanishi.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/massDistribution - Nakanishi.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:587082.9 %
Date:2024-04-08 14:58:22Functions:131492.9 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa9Nakanishi14getDescriptionB5cxx11Ev0
_ZN7crpropa9Nakanishi10setIsForH2Eb1
_ZN7crpropa9Nakanishi10setIsForHIEb1
_ZN7crpropa9Nakanishi11getIsForHIIEv1
_ZN7crpropa9Nakanishi10getIsForH2Ev3
_ZN7crpropa9Nakanishi10getIsForHIEv3
_ZNK7crpropa9Nakanishi10getDensityERKNS_7Vector3IdEE3
_ZNK7crpropa9Nakanishi17getNucleonDensityERKNS_7Vector3IdEE3
_ZNK7crpropa9Nakanishi12getH2DensityERKNS_7Vector3IdEE6
_ZNK7crpropa9Nakanishi12getHIDensityERKNS_7Vector3IdEE6
_ZNK7crpropa9Nakanishi16getH2ScaleheightERKNS_7Vector3IdEE8
_ZNK7crpropa9Nakanishi16getHIScaleheightERKNS_7Vector3IdEE8
_ZNK7crpropa9Nakanishi17getH2PlanedensityERKNS_7Vector3IdEE8
_ZNK7crpropa9Nakanishi17getHIPlanedensityERKNS_7Vector3IdEE8
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/massDistribution/Nakanishi.cpp.func.html b/doc/coverageReport/src/massDistribution/Nakanishi.cpp.func.html new file mode 100644 index 000000000..13484a861 --- /dev/null +++ b/doc/coverageReport/src/massDistribution/Nakanishi.cpp.func.html @@ -0,0 +1,128 @@ + + + + + + + LCOV - coverage.info.cleaned - src/massDistribution/Nakanishi.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/massDistribution - Nakanishi.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:587082.9 %
Date:2024-04-08 14:58:22Functions:131492.9 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa9Nakanishi10getIsForH2Ev3
_ZN7crpropa9Nakanishi10getIsForHIEv3
_ZN7crpropa9Nakanishi10setIsForH2Eb1
_ZN7crpropa9Nakanishi10setIsForHIEb1
_ZN7crpropa9Nakanishi11getIsForHIIEv1
_ZN7crpropa9Nakanishi14getDescriptionB5cxx11Ev0
_ZNK7crpropa9Nakanishi10getDensityERKNS_7Vector3IdEE3
_ZNK7crpropa9Nakanishi12getH2DensityERKNS_7Vector3IdEE6
_ZNK7crpropa9Nakanishi12getHIDensityERKNS_7Vector3IdEE6
_ZNK7crpropa9Nakanishi16getH2ScaleheightERKNS_7Vector3IdEE8
_ZNK7crpropa9Nakanishi16getHIScaleheightERKNS_7Vector3IdEE8
_ZNK7crpropa9Nakanishi17getH2PlanedensityERKNS_7Vector3IdEE8
_ZNK7crpropa9Nakanishi17getHIPlanedensityERKNS_7Vector3IdEE8
_ZNK7crpropa9Nakanishi17getNucleonDensityERKNS_7Vector3IdEE3
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/massDistribution/Nakanishi.cpp.gcov.html b/doc/coverageReport/src/massDistribution/Nakanishi.cpp.gcov.html new file mode 100644 index 000000000..79649cf3d --- /dev/null +++ b/doc/coverageReport/src/massDistribution/Nakanishi.cpp.gcov.html @@ -0,0 +1,195 @@ + + + + + + + LCOV - coverage.info.cleaned - src/massDistribution/Nakanishi.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/massDistribution - Nakanishi.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:587082.9 %
Date:2024-04-08 14:58:22Functions:131492.9 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/massDistribution/Nakanishi.h"
+       2             : #include "crpropa/Common.h"
+       3             : 
+       4             : #include "kiss/logger.h"
+       5             : 
+       6             : #include <sstream>
+       7             : 
+       8             : namespace crpropa {
+       9             : 
+      10           8 : double Nakanishi::getHIScaleheight(const Vector3d &position) const {
+      11           8 :         double R = sqrt(pow_integer<2>(position.x)+pow_integer<2>(position.y));      // radius in galactic plane
+      12           8 :         double scaleheight = 1.06*pc*(116.3 +19.3*R/kpc+4.1*pow_integer<2>(R/kpc)-0.05*pow_integer<3>(R/kpc));
+      13           8 :         return scaleheight;
+      14             :         }
+      15             : 
+      16           8 : double Nakanishi::getHIPlanedensity(const Vector3d &position) const {
+      17           8 :         double R = sqrt(pow_integer<2>(position.x)+pow_integer<2>(position.y));      // radius in galactic plane
+      18           8 :         double planedensity = 0.94/ccm*(0.6*exp(-R/(2.4*kpc))+0.24*exp(-pow_integer<2>((R-9.5*kpc)/(4.8*kpc))));
+      19           8 :         return planedensity;
+      20             :         }
+      21             : 
+      22             : 
+      23           8 : double Nakanishi::getH2Scaleheight(const Vector3d &position) const {
+      24           8 :         double R = sqrt(pow_integer<2>(position.x)+ pow_integer<2>(position.y));  // radius in galactic plane
+      25           8 :         double scaleheight = 1.06*pc*( 10.8*exp(0.28*R/kpc)+42.78);
+      26           8 :         return scaleheight;
+      27             : }
+      28             : 
+      29           8 : double Nakanishi::getH2Planedensity(const Vector3d &position) const {
+      30           8 :         double R = sqrt(pow_integer<2>(position.x)+pow_integer<2>(position.y));  // radius in galactic plane
+      31           8 :         double planedensity =0.94/ccm*(11.2*exp(-R*R/(0.874*kpc*kpc)) +0.83*exp(-pow_integer<2>((R-4*kpc)/(3.2*kpc))));
+      32           8 :         return planedensity;
+      33             : }
+      34             : 
+      35           6 : double Nakanishi::getHIDensity(const Vector3d &position) const {
+      36             :         double n = 0;  // density
+      37           6 :         double planedensity = getHIPlanedensity(position);
+      38           6 :         double scaleheight = getHIScaleheight(position);
+      39           6 :         n = planedensity*pow(0.5,pow_integer<2>(position.z/scaleheight));
+      40             : 
+      41           6 :         return n;
+      42             : }
+      43             : 
+      44           6 : double Nakanishi::getH2Density(const Vector3d &position) const {
+      45             :         double n = 0;  // density
+      46           6 :         double planedensity = getH2Planedensity(position);
+      47           6 :         double scaleheight = getH2Scaleheight(position);
+      48           6 :         n = planedensity*pow(0.5,pow_integer<2>(position.z/scaleheight));
+      49             : 
+      50           6 :         return n;
+      51             : }
+      52             : 
+      53           3 : double Nakanishi::getDensity(const Vector3d &position) const {
+      54             :         double n = 0;
+      55           3 :         if(isforHI)
+      56           2 :                 n += getHIDensity(position);
+      57           3 :         if(isforH2)
+      58           2 :                 n += getH2Density(position);
+      59             :         
+      60             :         // check if all densities are deactivated and raise warning if so
+      61           3 :         if((isforHI || isforH2) == false){
+      62           2 :                 KISS_LOG_WARNING
+      63           1 :                         << "\n"<<"Called getDensity on fully deactivated Nakanishi \n"
+      64           1 :                         << "gas density model. The total density is set to 0.";
+      65             :         }
+      66           3 :         return n;
+      67             : }
+      68             : 
+      69           3 : double Nakanishi::getNucleonDensity(const Vector3d &position) const {
+      70             :         double n = 0;
+      71           3 :         if(isforHI)
+      72           2 :                 n += getHIDensity(position);
+      73           3 :         if(isforH2)
+      74           2 :                 n += 2*getH2Density(position);  // weight 2 for molecular hydrogen
+      75             : 
+      76             :         // check if all densities are deactivated and raise warning if so
+      77           3 :         if((isforHI || isforH2) == false){
+      78           2 :                 KISS_LOG_WARNING
+      79           1 :                         << "\n"<<"Called getNucleonDensity on fully deactivated Nakanishi \n"
+      80           1 :                         << "gas density model. The total density is set to 0.";
+      81             :         }
+      82             : 
+      83           3 :         return n;
+      84             : }
+      85             : 
+      86           3 : bool Nakanishi::getIsForHI() {
+      87           3 :         return isforHI;
+      88             : }
+      89             : 
+      90           1 : bool Nakanishi::getIsForHII() {
+      91           1 :         return isforHII;
+      92             : }
+      93           3 : bool Nakanishi::getIsForH2() {
+      94           3 :         return isforH2;
+      95             : }
+      96             : 
+      97           1 : void Nakanishi::setIsForHI(bool HI) {
+      98           1 :         isforHI = HI;
+      99           1 : }
+     100             : 
+     101           1 : void Nakanishi::setIsForH2(bool H2) {
+     102           1 :         isforH2 = H2;
+     103           1 : }
+     104             : 
+     105           0 : std::string Nakanishi::getDescription() {
+     106           0 :         std::stringstream s;
+     107           0 :         s << "Density model Nakanishi:\n";
+     108           0 :         s<< "HI component is ";
+     109           0 :         if(isforHI==false)
+     110           0 :                 s<< "not ";
+     111           0 :         s<< "active.\nH2 component is ";
+     112           0 :         if(isforH2==false)
+     113           0 :                 s<<"not ";
+     114           0 :         s<<"active.\nNakanishi has no HII component.";
+     115             : 
+     116           0 :         return s.str();
+     117           0 : }
+     118             : 
+     119             : }  // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/massDistribution/index-sort-f.html b/doc/coverageReport/src/massDistribution/index-sort-f.html new file mode 100644 index 000000000..8608e5fe2 --- /dev/null +++ b/doc/coverageReport/src/massDistribution/index-sort-f.html @@ -0,0 +1,133 @@ + + + + + + + LCOV - coverage.info.cleaned - src/massDistribution + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/massDistributionHitTotalCoverage
Test:coverage.info.cleanedLines:34941683.9 %
Date:2024-04-08 14:58:22Functions:697690.8 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Cordes.cpp +
76.2%76.2%
+
76.2 %16 / 2185.7 %6 / 7
Massdistribution.cpp +
76.5%76.5%
+
76.5 %65 / 8586.4 %19 / 22
Ferriere.cpp +
90.1%90.1%
+
90.1 %136 / 15192.9 %13 / 14
Nakanishi.cpp +
82.9%82.9%
+
82.9 %58 / 7092.9 %13 / 14
ConstantDensity.cpp +
83.1%83.1%
+
83.1 %74 / 8994.7 %18 / 19
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/massDistribution/index-sort-l.html b/doc/coverageReport/src/massDistribution/index-sort-l.html new file mode 100644 index 000000000..9ce5836f7 --- /dev/null +++ b/doc/coverageReport/src/massDistribution/index-sort-l.html @@ -0,0 +1,133 @@ + + + + + + + LCOV - coverage.info.cleaned - src/massDistribution + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/massDistributionHitTotalCoverage
Test:coverage.info.cleanedLines:34941683.9 %
Date:2024-04-08 14:58:22Functions:697690.8 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Cordes.cpp +
76.2%76.2%
+
76.2 %16 / 2185.7 %6 / 7
Massdistribution.cpp +
76.5%76.5%
+
76.5 %65 / 8586.4 %19 / 22
Nakanishi.cpp +
82.9%82.9%
+
82.9 %58 / 7092.9 %13 / 14
ConstantDensity.cpp +
83.1%83.1%
+
83.1 %74 / 8994.7 %18 / 19
Ferriere.cpp +
90.1%90.1%
+
90.1 %136 / 15192.9 %13 / 14
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/massDistribution/index.html b/doc/coverageReport/src/massDistribution/index.html new file mode 100644 index 000000000..dbbcaaf42 --- /dev/null +++ b/doc/coverageReport/src/massDistribution/index.html @@ -0,0 +1,133 @@ + + + + + + + LCOV - coverage.info.cleaned - src/massDistribution + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/massDistributionHitTotalCoverage
Test:coverage.info.cleanedLines:34941683.9 %
Date:2024-04-08 14:58:22Functions:697690.8 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
ConstantDensity.cpp +
83.1%83.1%
+
83.1 %74 / 8994.7 %18 / 19
Cordes.cpp +
76.2%76.2%
+
76.2 %16 / 2185.7 %6 / 7
Ferriere.cpp +
90.1%90.1%
+
90.1 %136 / 15192.9 %13 / 14
Massdistribution.cpp +
76.5%76.5%
+
76.5 %65 / 8586.4 %19 / 22
Nakanishi.cpp +
82.9%82.9%
+
82.9 %58 / 7092.9 %13 / 14
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/Acceleration.cpp.func-sort-c.html b/doc/coverageReport/src/module/Acceleration.cpp.func-sort-c.html new file mode 100644 index 000000000..dcbc5453c --- /dev/null +++ b/doc/coverageReport/src/module/Acceleration.cpp.func-sort-c.html @@ -0,0 +1,128 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/Acceleration.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - Acceleration.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0890.0 %
Date:2024-04-08 14:58:22Functions:0140.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16SecondOrderFermiC2Eddj0
_ZN7crpropa17ParticleSplittingC2EPNS_7SurfaceEiidNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa17QuasiLinearTheory6modifyEdPNS_9CandidateE0
_ZN7crpropa17QuasiLinearTheoryC2Eddd0
_ZN7crpropa22DirectedFlowScatteringC2ENS_7Vector3IdEEd0
_ZN7crpropa26AbstractAccelerationModule3addEPNS_18StepLengthModifierE0
_ZN7crpropa26AbstractAccelerationModuleC2Ed0
_ZN7crpropa28DirectedFlowOfScatterCenters6modifyEdPNS_9CandidateE0
_ZN7crpropa28DirectedFlowOfScatterCentersC2ERKNS_7Vector3IdEE0
_ZNK7crpropa16SecondOrderFermi21scatterCenterVelocityEPNS_9CandidateE0
_ZNK7crpropa17ParticleSplitting7processEPNS_9CandidateE0
_ZNK7crpropa22DirectedFlowScattering21scatterCenterVelocityEPNS_9CandidateE0
_ZNK7crpropa26AbstractAccelerationModule7processEPNS_9CandidateE0
_ZNK7crpropa26AbstractAccelerationModule7scatterEPNS_9CandidateERKNS_7Vector3IdEE0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/Acceleration.cpp.func.html b/doc/coverageReport/src/module/Acceleration.cpp.func.html new file mode 100644 index 000000000..d528f5cfc --- /dev/null +++ b/doc/coverageReport/src/module/Acceleration.cpp.func.html @@ -0,0 +1,128 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/Acceleration.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - Acceleration.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0890.0 %
Date:2024-04-08 14:58:22Functions:0140.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16SecondOrderFermiC2Eddj0
_ZN7crpropa17ParticleSplittingC2EPNS_7SurfaceEiidNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa17QuasiLinearTheory6modifyEdPNS_9CandidateE0
_ZN7crpropa17QuasiLinearTheoryC2Eddd0
_ZN7crpropa22DirectedFlowScatteringC2ENS_7Vector3IdEEd0
_ZN7crpropa26AbstractAccelerationModule3addEPNS_18StepLengthModifierE0
_ZN7crpropa26AbstractAccelerationModuleC2Ed0
_ZN7crpropa28DirectedFlowOfScatterCenters6modifyEdPNS_9CandidateE0
_ZN7crpropa28DirectedFlowOfScatterCentersC2ERKNS_7Vector3IdEE0
_ZNK7crpropa16SecondOrderFermi21scatterCenterVelocityEPNS_9CandidateE0
_ZNK7crpropa17ParticleSplitting7processEPNS_9CandidateE0
_ZNK7crpropa22DirectedFlowScattering21scatterCenterVelocityEPNS_9CandidateE0
_ZNK7crpropa26AbstractAccelerationModule7processEPNS_9CandidateE0
_ZNK7crpropa26AbstractAccelerationModule7scatterEPNS_9CandidateERKNS_7Vector3IdEE0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/Acceleration.cpp.gcov.html b/doc/coverageReport/src/module/Acceleration.cpp.gcov.html new file mode 100644 index 000000000..11ea17011 --- /dev/null +++ b/doc/coverageReport/src/module/Acceleration.cpp.gcov.html @@ -0,0 +1,260 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/Acceleration.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - Acceleration.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0890.0 %
Date:2024-04-08 14:58:22Functions:0140.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/Acceleration.h"
+       2             : #include <crpropa/Common.h>
+       3             : #include <crpropa/Random.h>
+       4             : #include <cmath>
+       5             : 
+       6             : namespace crpropa {
+       7             : 
+       8           0 : AbstractAccelerationModule::AbstractAccelerationModule(double _stepLength)
+       9           0 :         : crpropa::Module(), stepLength(_stepLength) {}
+      10             : 
+      11             : 
+      12           0 : void AbstractAccelerationModule::add(StepLengthModifier *modifier) {
+      13           0 :         modifiers.push_back(modifier);
+      14           0 : }
+      15             : 
+      16             : 
+      17           0 : void AbstractAccelerationModule::scatter(
+      18             :         crpropa::Candidate *candidate,
+      19             :         const crpropa::Vector3d &scatter_center_velocity) const {
+      20             :         // particle momentum in lab frame
+      21           0 :         const double E = candidate->current.getEnergy();
+      22           0 :         const crpropa::Vector3d p = candidate->current.getMomentum();
+      23             : 
+      24             :         // transform to rest frame of scatter center (p: prime)
+      25           0 :         const double beta = scatter_center_velocity.getR() / crpropa::c_light;
+      26           0 :         const double gamma = 1. / sqrt(1 - beta * beta);
+      27           0 :         const double Ep = gamma * (E - scatter_center_velocity.dot(p));
+      28             :         const crpropa::Vector3d pp = (p - scatter_center_velocity* E /
+      29             :                 (crpropa::c_light * crpropa::c_light)) * gamma;
+      30             : 
+      31             :         // scatter into random direction
+      32           0 :         const crpropa::Vector3d pp_new = crpropa::Random::instance().randVector() * pp.getR();
+      33             : 
+      34             :         // transform back
+      35           0 :         const double E_new = gamma * (Ep + scatter_center_velocity.dot(pp_new));
+      36             :         const crpropa::Vector3d p_new = (pp_new + scatter_center_velocity * Ep /
+      37             :                 (crpropa::c_light * crpropa::c_light)) * gamma;
+      38             : 
+      39             :         // update candidate properties
+      40           0 :         candidate->current.setEnergy(E_new);
+      41           0 :         candidate->current.setDirection(p_new / p_new.getR());
+      42           0 : }
+      43             : 
+      44             : 
+      45           0 : void AbstractAccelerationModule::process(crpropa::Candidate *candidate) const {
+      46           0 :         double currentStepLength = stepLength;
+      47           0 :         for (auto m : modifiers) {
+      48           0 :                 currentStepLength = m->modify(currentStepLength, candidate);
+      49             :         }
+      50             : 
+      51           0 :         double step = candidate->getCurrentStep();
+      52           0 :         while (step > 0) {
+      53           0 :                 double randDistance = -1. * log(crpropa::Random::instance().rand()) * currentStepLength;
+      54             : 
+      55           0 :                 if (step < randDistance) {
+      56           0 :                         candidate->limitNextStep(0.1 * currentStepLength);
+      57           0 :                         return;
+      58             :                 }
+      59           0 :                 scatter(candidate, scatterCenterVelocity(candidate));
+      60           0 :                 step -= randDistance;
+      61             :         }
+      62             : }
+      63             : 
+      64             : 
+      65           0 : SecondOrderFermi::SecondOrderFermi(double scatterVelocity, double stepLength,
+      66           0 :                                                                    unsigned int sizeOfPitchangleTable)
+      67             :         : AbstractAccelerationModule(stepLength),
+      68           0 :           scatterVelocity(scatterVelocity) {
+      69           0 :         setDescription("SecondOrderFermi Acceleration");
+      70           0 :         angle.resize(sizeOfPitchangleTable);
+      71           0 :         angleCDF.resize(sizeOfPitchangleTable);
+      72             : 
+      73             :         // have a discretized table of beamed pitch angles
+      74           0 :         for (unsigned int i =0; i < sizeOfPitchangleTable; i++) {
+      75           0 :                 angle[i] = i * M_PI / (sizeOfPitchangleTable-1);
+      76           0 :                 angleCDF[i] = (angle[i] +scatterVelocity / crpropa::c_light * sin(angle[i])) / M_PI;
+      77             :         }
+      78           0 : }
+      79             : 
+      80             : 
+      81           0 : crpropa::Vector3d SecondOrderFermi::scatterCenterVelocity(crpropa::Candidate *candidate) const
+      82             : {
+      83           0 :         size_t idx = crpropa::closestIndex(crpropa::Random::instance().rand(), angleCDF);
+      84           0 :         crpropa::Vector3d rv = crpropa::Random::instance().randVector();
+      85           0 :         crpropa::Vector3d rotationAxis = candidate->current.getDirection().cross(rv);
+      86             : 
+      87           0 :         rv = candidate->current.getDirection().getRotated(rotationAxis, M_PI - angle[idx]);
+      88           0 :         return rv * scatterVelocity;
+      89             : }
+      90             : 
+      91             : 
+      92           0 : DirectedFlowOfScatterCenters::DirectedFlowOfScatterCenters(
+      93           0 :         const Vector3d &scatterCenterVelocity)
+      94           0 :         : __scatterVelocity(scatterCenterVelocity) {}
+      95             : 
+      96             : 
+      97           0 : double DirectedFlowOfScatterCenters::modify(double steplength, Candidate* candidate)
+      98             : {
+      99           0 :         double directionModifier = (-1. * __scatterVelocity.dot(candidate->current.getDirection()) + c_light) / c_light;
+     100           0 :         return steplength / directionModifier;
+     101             : }
+     102             : 
+     103             : 
+     104           0 : DirectedFlowScattering::DirectedFlowScattering(
+     105           0 :         crpropa::Vector3d scatterCenterVelocity, double stepLength)
+     106           0 :         : __scatterVelocity(scatterCenterVelocity),
+     107           0 :           AbstractAccelerationModule(stepLength) {
+     108             : 
+     109             :         // In a directed field of scatter centers, the probability to encounter a
+     110             :         // scatter center depends on the direction of the candidate.
+     111           0 :         StepLengthModifier *mod = new DirectedFlowOfScatterCenters(__scatterVelocity);
+     112           0 :         this->add(mod);
+     113           0 : }
+     114             : 
+     115             : 
+     116           0 : crpropa::Vector3d DirectedFlowScattering::scatterCenterVelocity(
+     117             :         crpropa::Candidate *candidate) const { // does not depend on candidate here.
+     118           0 :         return __scatterVelocity;
+     119             : }
+     120             : 
+     121             : 
+     122           0 : QuasiLinearTheory::QuasiLinearTheory(double referenecEnergy,
+     123             :                                                                          double turbulenceIndex,
+     124           0 :                                                                          double minimumRigidity)
+     125           0 :         : __referenceEnergy(referenecEnergy), __turbulenceIndex(turbulenceIndex),
+     126           0 :           __minimumRigidity(minimumRigidity) {}
+     127             : 
+     128             : 
+     129           0 : double QuasiLinearTheory::modify(double steplength, Candidate* candidate)
+     130             : {
+     131           0 :         if (candidate->current.getRigidity() < __minimumRigidity)
+     132             :         {
+     133           0 :                 return steplength * std::pow(__minimumRigidity /
+     134           0 :                         (__referenceEnergy / eV), 2. - __turbulenceIndex);
+     135             :         }
+     136             :         else
+     137             :         {
+     138           0 :                 return steplength * std::pow(candidate->current.getRigidity() /
+     139           0 :                         (__referenceEnergy / eV), 2. - __turbulenceIndex);
+     140             :         }
+     141             : }
+     142             : 
+     143             : 
+     144           0 : ParticleSplitting::ParticleSplitting(Surface *surface, int      crossingThreshold, 
+     145           0 :         int numberSplits, double minWeight, std::string counterid)
+     146           0 :         : surface(surface), crossingThreshold(crossingThreshold),
+     147           0 :           numberSplits(numberSplits), minWeight(minWeight), counterid(counterid){};
+     148             : 
+     149           0 : void ParticleSplitting::process(Candidate *candidate) const {
+     150             :         const double currentDistance =
+     151           0 :                 surface->distance(candidate->current.getPosition());
+     152             :         const double previousDistance =
+     153           0 :                 surface->distance(candidate->previous.getPosition());
+     154             : 
+     155           0 :         if (currentDistance * previousDistance > 0)
+     156             :                 // candidate remains on the same side
+     157             :                 return;
+     158             : 
+     159           0 :         if (candidate->getWeight() < minWeight)
+     160             :                 return;
+     161             : 
+     162             :         int num_crossings = 1;
+     163           0 :         if (candidate->hasProperty(counterid))
+     164           0 :                 num_crossings = candidate->getProperty(counterid).toInt32() + 1;
+     165           0 :         candidate->setProperty(counterid, num_crossings);
+     166             : 
+     167           0 :         if (num_crossings % crossingThreshold != 0)
+     168             :                 return;
+     169             : 
+     170           0 :         candidate->updateWeight(1. / numberSplits);
+     171             : 
+     172           0 :         for (size_t i = 1; i < numberSplits; i++) {
+     173             :                 // No recursive split as the weights of the secondaries created
+     174             :                 // before the split are not affected
+     175           0 :                 ref_ptr<Candidate> new_candidate = candidate->clone(false);
+     176           0 :                 new_candidate->parent = candidate;
+     177           0 :                 uint64_t snr = Candidate::getNextSerialNumber();
+     178           0 :                 Candidate::setNextSerialNumber(snr + 1);
+     179           0 :                 new_candidate->setSerialNumber(snr);
+     180             :                 candidate->addSecondary(new_candidate);
+     181             :         }
+     182             : };
+     183             : 
+     184             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/AdiabaticCooling.cpp.func-sort-c.html b/doc/coverageReport/src/module/AdiabaticCooling.cpp.func-sort-c.html new file mode 100644 index 000000000..d39555576 --- /dev/null +++ b/doc/coverageReport/src/module/AdiabaticCooling.cpp.func-sort-c.html @@ -0,0 +1,92 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/AdiabaticCooling.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - AdiabaticCooling.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:232785.2 %
Date:2024-04-08 14:58:22Functions:55100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16AdiabaticCoolingC2ENS_7ref_ptrINS_14AdvectionFieldEEEd1
_ZNK7crpropa16AdiabaticCooling8getLimitEv1
_ZN7crpropa16AdiabaticCoolingC2ENS_7ref_ptrINS_14AdvectionFieldEEE2
_ZNK7crpropa16AdiabaticCooling7processEPNS_9CandidateE2
_ZN7crpropa16AdiabaticCooling8setLimitEd3
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/AdiabaticCooling.cpp.func.html b/doc/coverageReport/src/module/AdiabaticCooling.cpp.func.html new file mode 100644 index 000000000..c94a74943 --- /dev/null +++ b/doc/coverageReport/src/module/AdiabaticCooling.cpp.func.html @@ -0,0 +1,92 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/AdiabaticCooling.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - AdiabaticCooling.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:232785.2 %
Date:2024-04-08 14:58:22Functions:55100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16AdiabaticCooling8setLimitEd3
_ZN7crpropa16AdiabaticCoolingC2ENS_7ref_ptrINS_14AdvectionFieldEEE2
_ZN7crpropa16AdiabaticCoolingC2ENS_7ref_ptrINS_14AdvectionFieldEEEd1
_ZNK7crpropa16AdiabaticCooling7processEPNS_9CandidateE2
_ZNK7crpropa16AdiabaticCooling8getLimitEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/AdiabaticCooling.cpp.gcov.html b/doc/coverageReport/src/module/AdiabaticCooling.cpp.gcov.html new file mode 100644 index 000000000..1a9adcc18 --- /dev/null +++ b/doc/coverageReport/src/module/AdiabaticCooling.cpp.gcov.html @@ -0,0 +1,130 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/AdiabaticCooling.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - AdiabaticCooling.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:232785.2 %
Date:2024-04-08 14:58:22Functions:55100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/AdiabaticCooling.h"
+       2             : 
+       3             : namespace crpropa {
+       4             : 
+       5           2 : AdiabaticCooling::AdiabaticCooling(ref_ptr<AdvectionField> advectionField) :
+       6           2 :         advectionField(advectionField) {
+       7           2 :         setLimit(0.1);
+       8           2 : }
+       9             : 
+      10           1 : AdiabaticCooling::AdiabaticCooling(ref_ptr<AdvectionField> advectionField, double limit) :
+      11           1 :         advectionField(advectionField) {
+      12           1 :         setLimit(limit);
+      13           1 : }
+      14             : 
+      15           2 : void AdiabaticCooling::process(Candidate *c) const {
+      16             : 
+      17           2 :         Vector3d pos = c->current.getPosition();
+      18           2 :         double E = c->current.getEnergy(); // Note we use E=p/c (relativistic limit)
+      19             :         
+      20             :         double Div = 0.;        
+      21             :         try {
+      22           2 :                 Div +=  advectionField->getDivergence(pos);
+      23             :         } 
+      24           0 :         catch (std::exception &e) {
+      25           0 :                 KISS_LOG_ERROR  << "AdiabaticCooling: Exception in getDivergence.\n" 
+      26           0 :                                 << e.what();
+      27           0 :         }
+      28             :         
+      29           2 :         double dEdt = -E / 3. * Div;    // cooling due to advection -p/3 * div(V_wind)
+      30             :                                         // (see e.g. Kopp et al. Computer Physics Communication 183
+      31             :                                         // (2012) 530-542)
+      32           2 :         double dt = c->getCurrentStep() / c_light;
+      33           2 :         double dE = dEdt * dt;
+      34             :         
+      35           2 :         c->current.setEnergy(E + dE);
+      36           2 :         if (dEdt==0) {
+      37             :                 return;
+      38             :         }       
+      39           1 :         c->limitNextStep(limit * E / fabs(dEdt) *c_light);
+      40             : }
+      41             : 
+      42           3 : void AdiabaticCooling::setLimit(double l) {
+      43           3 :         limit = l;
+      44           3 : }
+      45             : 
+      46           1 : double AdiabaticCooling::getLimit() const {
+      47           1 :         return limit;
+      48             : }
+      49             :         
+      50             :         
+      51             : 
+      52             : 
+      53             : 
+      54             : } // end namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/Boundary.cpp.func-sort-c.html b/doc/coverageReport/src/module/Boundary.cpp.func-sort-c.html new file mode 100644 index 000000000..402ed01de --- /dev/null +++ b/doc/coverageReport/src/module/Boundary.cpp.func-sort-c.html @@ -0,0 +1,252 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/Boundary.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - Boundary.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:10621948.4 %
Date:2024-04-08 14:58:22Functions:204544.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11PeriodicBox7setSizeENS_7Vector3IdEE0
_ZN7crpropa11PeriodicBox9setOriginENS_7Vector3IdEE0
_ZN7crpropa11PeriodicBoxC2Ev0
_ZN7crpropa13CubicBoundary7setSizeEd0
_ZN7crpropa13CubicBoundary9setOriginENS_7Vector3IdEE0
_ZN7crpropa13CubicBoundaryC2Ev0
_ZN7crpropa13ReflectiveBox7setSizeENS_7Vector3IdEE0
_ZN7crpropa13ReflectiveBox9setOriginENS_7Vector3IdEE0
_ZN7crpropa13ReflectiveBoxC2Ev0
_ZN7crpropa17SphericalBoundary9setCenterENS_7Vector3IdEE0
_ZN7crpropa17SphericalBoundary9setRadiusEd0
_ZN7crpropa17SphericalBoundaryC2Ev0
_ZN7crpropa19CylindricalBoundary9setHeightEd0
_ZN7crpropa19CylindricalBoundary9setOriginENS_7Vector3IdEE0
_ZN7crpropa19CylindricalBoundary9setRadiusEd0
_ZN7crpropa19CylindricalBoundaryC2Ev0
_ZN7crpropa19EllipsoidalBoundary12setMajorAxisEd0
_ZN7crpropa19EllipsoidalBoundary14setFocalPointsENS_7Vector3IdEES2_0
_ZN7crpropa19EllipsoidalBoundaryC2Ev0
_ZNK7crpropa11PeriodicBox14getDescriptionB5cxx11Ev0
_ZNK7crpropa13CubicBoundary14getDescriptionB5cxx11Ev0
_ZNK7crpropa13ReflectiveBox14getDescriptionB5cxx11Ev0
_ZNK7crpropa17SphericalBoundary14getDescriptionB5cxx11Ev0
_ZNK7crpropa19CylindricalBoundary14getDescriptionB5cxx11Ev0
_ZNK7crpropa19EllipsoidalBoundary14getDescriptionB5cxx11Ev0
_ZN7crpropa13ReflectiveBoxC2ENS_7Vector3IdEES2_1
_ZN7crpropa17SphericalBoundary12setLimitStepEb1
_ZN7crpropa17SphericalBoundary9setMarginEd1
_ZN7crpropa19CylindricalBoundary12setLimitStepEb1
_ZN7crpropa19CylindricalBoundary9setMarginEd1
_ZN7crpropa19EllipsoidalBoundary12setLimitStepEb1
_ZN7crpropa19EllipsoidalBoundary9setMarginEd1
_ZNK7crpropa13ReflectiveBox7processEPNS_9CandidateE1
_ZN7crpropa11PeriodicBoxC2ENS_7Vector3IdEES2_2
_ZN7crpropa13CubicBoundary12setLimitStepEb2
_ZN7crpropa13CubicBoundary9setMarginEd2
_ZNK7crpropa11PeriodicBox7processEPNS_9CandidateE2
_ZN7crpropa17SphericalBoundaryC2ENS_7Vector3IdEEd3
_ZN7crpropa19CylindricalBoundaryC2ENS_7Vector3IdEEdd3
_ZN7crpropa19EllipsoidalBoundaryC2ENS_7Vector3IdEES2_d3
_ZNK7crpropa17SphericalBoundary7processEPNS_9CandidateE3
_ZNK7crpropa19CylindricalBoundary7processEPNS_9CandidateE3
_ZNK7crpropa19EllipsoidalBoundary7processEPNS_9CandidateE3
_ZN7crpropa13CubicBoundaryC2ENS_7Vector3IdEEd4
_ZNK7crpropa13CubicBoundary7processEPNS_9CandidateE4
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/Boundary.cpp.func.html b/doc/coverageReport/src/module/Boundary.cpp.func.html new file mode 100644 index 000000000..faa7abed3 --- /dev/null +++ b/doc/coverageReport/src/module/Boundary.cpp.func.html @@ -0,0 +1,252 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/Boundary.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - Boundary.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:10621948.4 %
Date:2024-04-08 14:58:22Functions:204544.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11PeriodicBox7setSizeENS_7Vector3IdEE0
_ZN7crpropa11PeriodicBox9setOriginENS_7Vector3IdEE0
_ZN7crpropa11PeriodicBoxC2ENS_7Vector3IdEES2_2
_ZN7crpropa11PeriodicBoxC2Ev0
_ZN7crpropa13CubicBoundary12setLimitStepEb2
_ZN7crpropa13CubicBoundary7setSizeEd0
_ZN7crpropa13CubicBoundary9setMarginEd2
_ZN7crpropa13CubicBoundary9setOriginENS_7Vector3IdEE0
_ZN7crpropa13CubicBoundaryC2ENS_7Vector3IdEEd4
_ZN7crpropa13CubicBoundaryC2Ev0
_ZN7crpropa13ReflectiveBox7setSizeENS_7Vector3IdEE0
_ZN7crpropa13ReflectiveBox9setOriginENS_7Vector3IdEE0
_ZN7crpropa13ReflectiveBoxC2ENS_7Vector3IdEES2_1
_ZN7crpropa13ReflectiveBoxC2Ev0
_ZN7crpropa17SphericalBoundary12setLimitStepEb1
_ZN7crpropa17SphericalBoundary9setCenterENS_7Vector3IdEE0
_ZN7crpropa17SphericalBoundary9setMarginEd1
_ZN7crpropa17SphericalBoundary9setRadiusEd0
_ZN7crpropa17SphericalBoundaryC2ENS_7Vector3IdEEd3
_ZN7crpropa17SphericalBoundaryC2Ev0
_ZN7crpropa19CylindricalBoundary12setLimitStepEb1
_ZN7crpropa19CylindricalBoundary9setHeightEd0
_ZN7crpropa19CylindricalBoundary9setMarginEd1
_ZN7crpropa19CylindricalBoundary9setOriginENS_7Vector3IdEE0
_ZN7crpropa19CylindricalBoundary9setRadiusEd0
_ZN7crpropa19CylindricalBoundaryC2ENS_7Vector3IdEEdd3
_ZN7crpropa19CylindricalBoundaryC2Ev0
_ZN7crpropa19EllipsoidalBoundary12setLimitStepEb1
_ZN7crpropa19EllipsoidalBoundary12setMajorAxisEd0
_ZN7crpropa19EllipsoidalBoundary14setFocalPointsENS_7Vector3IdEES2_0
_ZN7crpropa19EllipsoidalBoundary9setMarginEd1
_ZN7crpropa19EllipsoidalBoundaryC2ENS_7Vector3IdEES2_d3
_ZN7crpropa19EllipsoidalBoundaryC2Ev0
_ZNK7crpropa11PeriodicBox14getDescriptionB5cxx11Ev0
_ZNK7crpropa11PeriodicBox7processEPNS_9CandidateE2
_ZNK7crpropa13CubicBoundary14getDescriptionB5cxx11Ev0
_ZNK7crpropa13CubicBoundary7processEPNS_9CandidateE4
_ZNK7crpropa13ReflectiveBox14getDescriptionB5cxx11Ev0
_ZNK7crpropa13ReflectiveBox7processEPNS_9CandidateE1
_ZNK7crpropa17SphericalBoundary14getDescriptionB5cxx11Ev0
_ZNK7crpropa17SphericalBoundary7processEPNS_9CandidateE3
_ZNK7crpropa19CylindricalBoundary14getDescriptionB5cxx11Ev0
_ZNK7crpropa19CylindricalBoundary7processEPNS_9CandidateE3
_ZNK7crpropa19EllipsoidalBoundary14getDescriptionB5cxx11Ev0
_ZNK7crpropa19EllipsoidalBoundary7processEPNS_9CandidateE3
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/Boundary.cpp.gcov.html b/doc/coverageReport/src/module/Boundary.cpp.gcov.html new file mode 100644 index 000000000..0e651f732 --- /dev/null +++ b/doc/coverageReport/src/module/Boundary.cpp.gcov.html @@ -0,0 +1,370 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/Boundary.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - Boundary.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:10621948.4 %
Date:2024-04-08 14:58:22Functions:204544.4 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/Boundary.h"
+       2             : #include "crpropa/Units.h"
+       3             : 
+       4             : #include <sstream>
+       5             : 
+       6             : namespace crpropa {
+       7             : 
+       8           0 : PeriodicBox::PeriodicBox() :
+       9           0 :                 origin(Vector3d(0, 0, 0)), size(Vector3d(0, 0, 0)) {
+      10           0 : }
+      11             : 
+      12           2 : PeriodicBox::PeriodicBox(Vector3d o, Vector3d s) :
+      13           2 :                 origin(o), size(s) {
+      14           2 : }
+      15             : 
+      16           2 : void PeriodicBox::process(Candidate *c) const {
+      17           2 :         Vector3d pos = c->current.getPosition();
+      18           2 :         Vector3d n = ((pos - origin) / size).floor();
+      19             : 
+      20           2 :         if ((n.x == 0) and (n.y == 0) and (n.z == 0))
+      21             :                 return; // do nothing if candidate is inside the box
+      22             : 
+      23           2 :         c->current.setPosition(pos - n * size);
+      24           2 :         c->previous.setPosition(c->previous.getPosition() - n * size);
+      25           2 :         c->source.setPosition(c->source.getPosition() - n * size);
+      26           2 :         c->created.setPosition(c->created.getPosition() - n * size);
+      27             : }
+      28             : 
+      29           0 : void PeriodicBox::setOrigin(Vector3d o) {
+      30             :         origin = o;
+      31           0 : }
+      32           0 : void PeriodicBox::setSize(Vector3d s) {
+      33             :         size = s;
+      34           0 : }
+      35             : 
+      36           0 : std::string PeriodicBox::getDescription() const {
+      37           0 :         std::stringstream s;
+      38           0 :         s << "Periodic box: origin " << origin / Mpc << " Mpc, ";
+      39           0 :         s << "size " << size / Mpc << " Mpc";
+      40           0 :         return s.str();
+      41           0 : }
+      42             : 
+      43           0 : ReflectiveBox::ReflectiveBox() :
+      44           0 :                 origin(Vector3d(0, 0, 0)), size(Vector3d(0, 0, 0)) {
+      45           0 : }
+      46             : 
+      47           1 : ReflectiveBox::ReflectiveBox(Vector3d o, Vector3d s) :
+      48           1 :                 origin(o), size(s) {
+      49           1 : }
+      50             : 
+      51           1 : void ReflectiveBox::process(Candidate *c) const {
+      52           1 :         Vector3d cur = (c->current.getPosition() - origin) / size; // current position in cell units
+      53           1 :         Vector3d n = cur.floor();
+      54             : 
+      55           1 :         if ((n.x == 0) and (n.y == 0) and (n.z == 0))
+      56             :                 return; // do nothing if candidate is inside the box
+      57             : 
+      58             :         // flip direction
+      59           1 :         Vector3d nReflect(pow(-1, n.x), pow(-1, n.y), pow(-1, n.z));
+      60           1 :         c->current.setDirection(c->current.getDirection() * nReflect);
+      61           1 :         c->previous.setDirection(c->previous.getDirection() * nReflect);
+      62           1 :         c->created.setDirection(c->created.getDirection() * nReflect);
+      63           1 :         c->source.setDirection(c->source.getDirection() * nReflect);
+      64             : 
+      65           1 :         Vector3d src = (c->source.getPosition() - origin) / size; // initial position in cell units
+      66           1 :         Vector3d cre = (c->created.getPosition() - origin) / size; // initial position in cell units
+      67           1 :         Vector3d prv = (c->previous.getPosition() - origin) / size; // previous position in cell units
+      68             : 
+      69             :         // repeatedly translate until the current position is inside the cell
+      70           1 :         while ((cur.x < 0) or (cur.x > 1)) {
+      71           0 :                 double t = 2 * (cur.x > 1);
+      72           0 :                 src.x = t - src.x;
+      73           0 :                 cre.x = t - cre.x;
+      74           0 :                 prv.x = t - prv.x;
+      75           0 :                 cur.x = t - cur.x;
+      76             :         }
+      77           1 :         while ((cur.y < 0) or (cur.y > 1)) {
+      78           0 :                 double t = 2 * (cur.y > 1);
+      79           0 :                 src.y = t - src.y;
+      80           0 :                 cre.y = t - cre.y;
+      81           0 :                 prv.y = t - prv.y;
+      82           0 :                 cur.y = t - cur.y;
+      83             :         }
+      84           2 :         while ((cur.z < 0) or (cur.z > 1)) {
+      85           1 :                 double t = 2 * (cur.z > 1);
+      86           1 :                 src.z = t - src.z;
+      87           1 :                 cre.z = t - cre.z;
+      88           1 :                 prv.z = t - prv.z;
+      89           1 :                 cur.z = t - cur.z;
+      90             :         }
+      91             : 
+      92           1 :         c->current.setPosition(cur * size + origin);
+      93           1 :         c->source.setPosition(src * size + origin);
+      94           1 :         c->created.setPosition(cre * size + origin);
+      95           1 :         c->previous.setPosition(prv * size + origin);
+      96             : }
+      97             : 
+      98           0 : void ReflectiveBox::setOrigin(Vector3d o) {
+      99             :         origin = o;
+     100           0 : }
+     101           0 : void ReflectiveBox::setSize(Vector3d s) {
+     102             :         size = s;
+     103           0 : }
+     104             : 
+     105           0 : std::string ReflectiveBox::getDescription() const {
+     106           0 :         std::stringstream s;
+     107           0 :         s << "Reflective box: origin " << origin / Mpc << " Mpc, ";
+     108           0 :         s << "size " << size / Mpc << " Mpc";
+     109           0 :         return s.str();
+     110           0 : }
+     111             : 
+     112           0 : CubicBoundary::CubicBoundary() :
+     113           0 :                 origin(Vector3d(0, 0, 0)), size(0), limitStep(true), margin(0.1 * kpc) {
+     114           0 : }
+     115             : 
+     116           4 : CubicBoundary::CubicBoundary(Vector3d o, double s) :
+     117           4 :                 origin(o), size(s), limitStep(true), margin(0.1 * kpc) {
+     118           4 : }
+     119             : 
+     120           4 : void CubicBoundary::process(Candidate *c) const {
+     121           4 :         Vector3d r = c->current.getPosition() - origin;
+     122             :         double lo = r.min();
+     123             :         double hi = r.max();
+     124           4 :         if ((lo <= 0) or (hi >= size)) {
+     125           1 :                 reject(c);
+     126             :         }
+     127           4 :         if (limitStep) {
+     128           4 :                 c->limitNextStep(lo + margin);
+     129           4 :                 c->limitNextStep(size - hi + margin);
+     130             :         }
+     131           4 : }
+     132             : 
+     133           0 : void CubicBoundary::setOrigin(Vector3d o) {
+     134             :         origin = o;
+     135           0 : }
+     136           0 : void CubicBoundary::setSize(double s) {
+     137           0 :         size = s;
+     138           0 : }
+     139           2 : void CubicBoundary::setMargin(double m) {
+     140           2 :         margin = m;
+     141           2 : }
+     142           2 : void CubicBoundary::setLimitStep(bool b) {
+     143           2 :         limitStep = b;
+     144           2 : }
+     145             : 
+     146           0 : std::string CubicBoundary::getDescription() const {
+     147           0 :         std::stringstream s;
+     148           0 :         s << "Cubic Boundary: origin " << origin / Mpc << " Mpc, ";
+     149           0 :         s << "size " << size / Mpc << " Mpc, ";
+     150           0 :         s << "Flag: '" << rejectFlagKey << "' -> '" << rejectFlagValue << "', ";
+     151           0 :         s << "MakeInactive: " << (makeRejectedInactive ? "yes" : "no");
+     152           0 :         if (rejectAction.valid())
+     153           0 :                 s << ", Action: " << rejectAction->getDescription();
+     154           0 :         return s.str();
+     155           0 : }
+     156             : 
+     157           0 : SphericalBoundary::SphericalBoundary() :
+     158           0 :                 center(Vector3d(0, 0, 0)), radius(0), limitStep(true), margin(0.1 * kpc) {
+     159           0 : }
+     160             : 
+     161           3 : SphericalBoundary::SphericalBoundary(Vector3d c, double r) :
+     162           3 :                 center(c), radius(r), limitStep(true), margin(0.1 * kpc) {
+     163           3 : }
+     164             : 
+     165           3 : void SphericalBoundary::process(Candidate *c) const {
+     166           3 :         double d = (c->current.getPosition() - center).getR();
+     167           3 :         if (d >= radius) {
+     168           1 :                 reject(c);
+     169             :         }
+     170           3 :         if (limitStep)
+     171           3 :                 c->limitNextStep(radius - d + margin);
+     172           3 : }
+     173             : 
+     174           0 : void SphericalBoundary::setCenter(Vector3d c) {
+     175             :         center = c;
+     176           0 : }
+     177           0 : void SphericalBoundary::setRadius(double r) {
+     178           0 :         radius = r;
+     179           0 : }
+     180           1 : void SphericalBoundary::setMargin(double m) {
+     181           1 :         margin = m;
+     182           1 : }
+     183           1 : void SphericalBoundary::setLimitStep(bool b) {
+     184           1 :         limitStep = b;
+     185           1 : }
+     186             : 
+     187           0 : std::string SphericalBoundary::getDescription() const {
+     188           0 :         std::stringstream s;
+     189           0 :         s << "Spherical Boundary: radius " << radius / Mpc << " Mpc, ";
+     190           0 :         s << "around " << center / Mpc << " Mpc, ";
+     191           0 :         s << "Flag: '" << rejectFlagKey << "' -> '" << rejectFlagValue << "', ";
+     192           0 :         s << "MakeInactive: " << (makeRejectedInactive ? "yes" : "no");
+     193           0 :         if (rejectAction.valid())
+     194           0 :                 s << ", Action: " << rejectAction->getDescription();
+     195           0 :         return s.str();
+     196           0 : }
+     197             : 
+     198           0 : EllipsoidalBoundary::EllipsoidalBoundary() :
+     199             :                 focalPoint1(Vector3d(0, 0, 0)), focalPoint2(Vector3d(0, 0, 0)),
+     200           0 :                 majorAxis(0), limitStep(true), margin(0.1 * kpc) {
+     201           0 : }
+     202             : 
+     203           3 : EllipsoidalBoundary::EllipsoidalBoundary(Vector3d f1, Vector3d f2, double a) :
+     204           3 :                 focalPoint1(f1), focalPoint2(f2), majorAxis(a), limitStep(true),
+     205           3 :                 margin(0.1 * kpc) {
+     206           3 : }
+     207             : 
+     208           3 : void EllipsoidalBoundary::process(Candidate *c) const {
+     209           3 :         Vector3d pos = c->current.getPosition();
+     210           3 :         double d = pos.getDistanceTo(focalPoint1) + pos.getDistanceTo(focalPoint2);
+     211           3 :         if (d >= majorAxis) {
+     212           1 :                 reject(c);
+     213             :         }
+     214           3 :         if (limitStep)
+     215           3 :                 c->limitNextStep(majorAxis - d + margin);
+     216           3 : }
+     217             : 
+     218           0 : void EllipsoidalBoundary::setFocalPoints(Vector3d f1, Vector3d f2) {
+     219             :         focalPoint1 = f1;
+     220             :         focalPoint2 = f2;
+     221           0 : }
+     222           0 : void EllipsoidalBoundary::setMajorAxis(double a) {
+     223           0 :         majorAxis = a;
+     224           0 : }
+     225           1 : void EllipsoidalBoundary::setMargin(double m) {
+     226           1 :         margin = m;
+     227           1 : }
+     228           1 : void EllipsoidalBoundary::setLimitStep(bool b) {
+     229           1 :         limitStep = b;
+     230           1 : }
+     231             : 
+     232           0 : std::string EllipsoidalBoundary::getDescription() const {
+     233           0 :         std::stringstream s;
+     234           0 :         s << "Ellipsoidal Boundary: F1 = " << focalPoint1 / Mpc << " Mpc, ";
+     235           0 :         s << "F2 = " << focalPoint2 / Mpc << " Mpc, ";
+     236           0 :         s << "major axis " << majorAxis / Mpc << " Mpc; ";
+     237           0 :         s << "Flag: '" << rejectFlagKey << "' -> '" << rejectFlagValue << "', ";
+     238           0 :         s << "MakeInactive: " << (makeRejectedInactive ? "yes" : "no");
+     239           0 :         if (rejectAction.valid())
+     240           0 :                 s << ", Action: " << rejectAction->getDescription();
+     241           0 :         return s.str();
+     242           0 : }
+     243             : 
+     244           0 : CylindricalBoundary::CylindricalBoundary() :
+     245           0 :   origin(Vector3d(0,0,0)), height(0), radius(0), limitStep(false), margin(0) {
+     246           0 : }
+     247             : 
+     248           3 : CylindricalBoundary::CylindricalBoundary(Vector3d o, double h, double r) :
+     249           3 :   origin(o), height(h), radius(r), limitStep(false) , margin(0){
+     250           3 : }
+     251             : 
+     252           3 : void CylindricalBoundary::process(Candidate *c) const {
+     253           3 :         Vector3d d = c->current.getPosition() - origin;
+     254           3 :         double R2 = pow(d.x, 2.)+pow(d.y, 2.);
+     255           3 :         double Z = fabs(d.z);
+     256           3 :         if ( R2 < pow(radius, 2.) and Z < height/2.) {
+     257           2 :                 if(limitStep) {
+     258           2 :                         c->limitNextStep(std::min(radius - pow(R2, 0.5), height/2. - Z) + margin);   
+     259             :                 }
+     260             :           return;
+     261             :         }
+     262           1 :         reject(c);
+     263             : }
+     264             : 
+     265           0 : void CylindricalBoundary::setOrigin(Vector3d o) {
+     266             :         origin = o;
+     267           0 : }
+     268           0 : void CylindricalBoundary::setHeight(double h) {
+     269           0 :         height = h;
+     270           0 : }
+     271           0 : void CylindricalBoundary::setRadius(double r) {
+     272           0 :         radius = r;
+     273           0 : }
+     274           1 : void CylindricalBoundary::setLimitStep(bool b) {
+     275           1 :         limitStep = b;
+     276           1 : }
+     277           1 : void CylindricalBoundary::setMargin(double m) {
+     278           1 :         margin = m;
+     279           1 : }
+     280             : 
+     281             : 
+     282           0 : std::string CylindricalBoundary::getDescription() const {
+     283           0 :         std::stringstream s;
+     284           0 :         s << "Cylindrical Boundary: origin = " << origin / kpc << " kpc, ";
+     285           0 :         s << "radius = " << radius / kpc << " kpc, ";
+     286           0 :         s << "height" << height / kpc << " kpc; ";
+     287           0 :         s << "Flag: '" << rejectFlagKey << "' -> '" << rejectFlagValue << "', ";
+     288           0 :         s << "MakeInactive: " << (makeRejectedInactive ? "yes" : "no");
+     289           0 :         if (rejectAction.valid())
+     290           0 :                 s << ", Action: " << rejectAction->getDescription();
+     291           0 :         return s.str();
+     292           0 : }
+     293             : 
+     294             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/BreakCondition.cpp.func-sort-c.html b/doc/coverageReport/src/module/BreakCondition.cpp.func-sort-c.html new file mode 100644 index 000000000..59b7031c8 --- /dev/null +++ b/doc/coverageReport/src/module/BreakCondition.cpp.func-sort-c.html @@ -0,0 +1,224 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/BreakCondition.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - BreakCondition.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:6317236.6 %
Date:2024-04-08 14:58:22Functions:153839.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa13MinimumEnergy16setMinimumEnergyEd0
_ZN7crpropa15DetectionLength18setDetectionLengthEd0
_ZN7crpropa15MinimumRedshift18getMinimumRedshiftEv0
_ZN7crpropa15MinimumRedshift18setMinimumRedshiftEd0
_ZN7crpropa15MinimumRigidity18setMinimumRigidityEd0
_ZN7crpropa15MinimumRigidityC2Ed0
_ZN7crpropa19MinimumChargeNumber22setMinimumChargeNumberEi0
_ZN7crpropa23MaximumTrajectoryLength26setMaximumTrajectoryLengthEd0
_ZNK7crpropa13MinimumEnergy14getDescriptionB5cxx11Ev0
_ZNK7crpropa13MinimumEnergy16getMinimumEnergyEv0
_ZNK7crpropa15DetectionLength14getDescriptionB5cxx11Ev0
_ZNK7crpropa15DetectionLength18getDetectionLengthEv0
_ZNK7crpropa15MinimumRedshift14getDescriptionB5cxx11Ev0
_ZNK7crpropa15MinimumRigidity14getDescriptionB5cxx11Ev0
_ZNK7crpropa15MinimumRigidity18getMinimumRigidityEv0
_ZNK7crpropa15MinimumRigidity7processEPNS_9CandidateE0
_ZNK7crpropa19MinimumChargeNumber14getDescriptionB5cxx11Ev0
_ZNK7crpropa19MinimumChargeNumber22getMinimumChargeNumberEv0
_ZNK7crpropa23MaximumTrajectoryLength14getDescriptionB5cxx11Ev0
_ZNK7crpropa23MaximumTrajectoryLength20getObserverPositionsEv0
_ZNK7crpropa23MaximumTrajectoryLength26getMaximumTrajectoryLengthEv0
_ZNK7crpropa26MinimumEnergyPerParticleId14getDescriptionB5cxx11Ev0
_ZNK7crpropa26MinimumEnergyPerParticleId22getMinimumEnergyOthersEv0
_ZN7crpropa15DetectionLengthC2Ed1
_ZN7crpropa15MinimumRedshiftC2Ed1
_ZN7crpropa19MinimumChargeNumberC2Ei1
_ZN7crpropa23MaximumTrajectoryLength19addObserverPositionERKNS_7Vector3IdEE1
_ZN7crpropa26MinimumEnergyPerParticleId22setMinimumEnergyOthersEd1
_ZN7crpropa26MinimumEnergyPerParticleIdC2Ed1
_ZN7crpropa13MinimumEnergyC2Ed2
_ZNK7crpropa15DetectionLength7processEPNS_9CandidateE2
_ZNK7crpropa15MinimumRedshift7processEPNS_9CandidateE2
_ZN7crpropa26MinimumEnergyPerParticleId3addEid3
_ZNK7crpropa19MinimumChargeNumber7processEPNS_9CandidateE4
_ZNK7crpropa26MinimumEnergyPerParticleId7processEPNS_9CandidateE5
_ZN7crpropa23MaximumTrajectoryLengthC2Ed13
_ZNK7crpropa13MinimumEnergy7processEPNS_9CandidateE7644
_ZNK7crpropa23MaximumTrajectoryLength7processEPNS_9CandidateE491649
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/BreakCondition.cpp.func.html b/doc/coverageReport/src/module/BreakCondition.cpp.func.html new file mode 100644 index 000000000..9734252c0 --- /dev/null +++ b/doc/coverageReport/src/module/BreakCondition.cpp.func.html @@ -0,0 +1,224 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/BreakCondition.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - BreakCondition.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:6317236.6 %
Date:2024-04-08 14:58:22Functions:153839.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa13MinimumEnergy16setMinimumEnergyEd0
_ZN7crpropa13MinimumEnergyC2Ed2
_ZN7crpropa15DetectionLength18setDetectionLengthEd0
_ZN7crpropa15DetectionLengthC2Ed1
_ZN7crpropa15MinimumRedshift18getMinimumRedshiftEv0
_ZN7crpropa15MinimumRedshift18setMinimumRedshiftEd0
_ZN7crpropa15MinimumRedshiftC2Ed1
_ZN7crpropa15MinimumRigidity18setMinimumRigidityEd0
_ZN7crpropa15MinimumRigidityC2Ed0
_ZN7crpropa19MinimumChargeNumber22setMinimumChargeNumberEi0
_ZN7crpropa19MinimumChargeNumberC2Ei1
_ZN7crpropa23MaximumTrajectoryLength19addObserverPositionERKNS_7Vector3IdEE1
_ZN7crpropa23MaximumTrajectoryLength26setMaximumTrajectoryLengthEd0
_ZN7crpropa23MaximumTrajectoryLengthC2Ed13
_ZN7crpropa26MinimumEnergyPerParticleId22setMinimumEnergyOthersEd1
_ZN7crpropa26MinimumEnergyPerParticleId3addEid3
_ZN7crpropa26MinimumEnergyPerParticleIdC2Ed1
_ZNK7crpropa13MinimumEnergy14getDescriptionB5cxx11Ev0
_ZNK7crpropa13MinimumEnergy16getMinimumEnergyEv0
_ZNK7crpropa13MinimumEnergy7processEPNS_9CandidateE7644
_ZNK7crpropa15DetectionLength14getDescriptionB5cxx11Ev0
_ZNK7crpropa15DetectionLength18getDetectionLengthEv0
_ZNK7crpropa15DetectionLength7processEPNS_9CandidateE2
_ZNK7crpropa15MinimumRedshift14getDescriptionB5cxx11Ev0
_ZNK7crpropa15MinimumRedshift7processEPNS_9CandidateE2
_ZNK7crpropa15MinimumRigidity14getDescriptionB5cxx11Ev0
_ZNK7crpropa15MinimumRigidity18getMinimumRigidityEv0
_ZNK7crpropa15MinimumRigidity7processEPNS_9CandidateE0
_ZNK7crpropa19MinimumChargeNumber14getDescriptionB5cxx11Ev0
_ZNK7crpropa19MinimumChargeNumber22getMinimumChargeNumberEv0
_ZNK7crpropa19MinimumChargeNumber7processEPNS_9CandidateE4
_ZNK7crpropa23MaximumTrajectoryLength14getDescriptionB5cxx11Ev0
_ZNK7crpropa23MaximumTrajectoryLength20getObserverPositionsEv0
_ZNK7crpropa23MaximumTrajectoryLength26getMaximumTrajectoryLengthEv0
_ZNK7crpropa23MaximumTrajectoryLength7processEPNS_9CandidateE491649
_ZNK7crpropa26MinimumEnergyPerParticleId14getDescriptionB5cxx11Ev0
_ZNK7crpropa26MinimumEnergyPerParticleId22getMinimumEnergyOthersEv0
_ZNK7crpropa26MinimumEnergyPerParticleId7processEPNS_9CandidateE5
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/BreakCondition.cpp.gcov.html b/doc/coverageReport/src/module/BreakCondition.cpp.gcov.html new file mode 100644 index 000000000..315b82cba --- /dev/null +++ b/doc/coverageReport/src/module/BreakCondition.cpp.gcov.html @@ -0,0 +1,343 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/BreakCondition.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - BreakCondition.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:6317236.6 %
Date:2024-04-08 14:58:22Functions:153839.5 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/BreakCondition.h"
+       2             : #include "crpropa/ParticleID.h"
+       3             : #include "crpropa/Units.h"
+       4             : 
+       5             : #include <sstream>
+       6             : 
+       7             : namespace crpropa {
+       8             : 
+       9          13 : MaximumTrajectoryLength::MaximumTrajectoryLength(double maxLength) :
+      10          13 :                 maxLength(maxLength) {
+      11          13 : }
+      12             : 
+      13           0 : void MaximumTrajectoryLength::setMaximumTrajectoryLength(double length) {
+      14           0 :         maxLength = length;
+      15           0 : }
+      16             : 
+      17           0 : double MaximumTrajectoryLength::getMaximumTrajectoryLength() const {
+      18           0 :         return maxLength;
+      19             : }
+      20             : 
+      21           1 : void MaximumTrajectoryLength::addObserverPosition(const Vector3d& position) {
+      22           1 :         observerPositions.push_back(position);
+      23           1 : }
+      24             : 
+      25           0 : const std::vector<Vector3d>& MaximumTrajectoryLength::getObserverPositions() const {
+      26           0 :         return observerPositions;
+      27             : }
+      28             : 
+      29           0 : std::string MaximumTrajectoryLength::getDescription() const {
+      30           0 :         std::stringstream s;
+      31           0 :         s << "Maximum trajectory length: " << maxLength / Mpc << " Mpc, ";
+      32           0 :         s << "Flag: '" << rejectFlagKey << "' -> '" << rejectFlagValue << "', ";
+      33           0 :         s << "MakeInactive: " << (makeRejectedInactive ? "yes" : "no");
+      34           0 :         if (rejectAction.valid())
+      35           0 :                 s << ", Action: " << rejectAction->getDescription();
+      36           0 :         s << "\n  Observer positions: \n";
+      37           0 :         for (size_t i = 0; i < observerPositions.size(); i++)
+      38           0 :                 s << "    - " << observerPositions[i] / Mpc << " Mpc\n";
+      39           0 :         return s.str();
+      40           0 : }
+      41             : 
+      42      491649 : void MaximumTrajectoryLength::process(Candidate *c) const {
+      43      491649 :         double length = c->getTrajectoryLength();
+      44      491649 :         Vector3d position = c->current.getPosition();
+      45             : 
+      46      491649 :         if(observerPositions.size()) {
+      47             :                 bool inRange = false;
+      48           4 :                 for (size_t i = 0; i < observerPositions.size(); i++) {
+      49           2 :                         double distance = position.getDistanceTo(observerPositions[i]);
+      50           2 :                         if (distance + length < maxLength)
+      51             :                                 inRange = true;
+      52             :                 }
+      53           2 :                 if (!inRange) {
+      54           1 :                         reject(c);
+      55             :                         return;
+      56             :                 }
+      57             :         }
+      58             : 
+      59      491648 :         if (length >= maxLength) {
+      60        1107 :                 reject(c);
+      61             :         } else {
+      62      490541 :                 c->limitNextStep(maxLength - length);
+      63             :         }
+      64             : }
+      65             : 
+      66             : //*****************************************************************************
+      67           2 : MinimumEnergy::MinimumEnergy(double minEnergy) :
+      68           2 :                 minEnergy(minEnergy) {
+      69           2 : }
+      70             : 
+      71           0 : void MinimumEnergy::setMinimumEnergy(double energy) {
+      72           0 :         minEnergy = energy;
+      73           0 : }
+      74             : 
+      75           0 : double MinimumEnergy::getMinimumEnergy() const {
+      76           0 :         return minEnergy;
+      77             : }
+      78             : 
+      79        7644 : void MinimumEnergy::process(Candidate *c) const {
+      80        7644 :         if (c->current.getEnergy() > minEnergy)
+      81             :                 return;
+      82             :         else
+      83           1 :                 reject(c);
+      84             : }
+      85             : 
+      86           0 : std::string MinimumEnergy::getDescription() const {
+      87           0 :         std::stringstream s;
+      88           0 :         s << "Minimum energy: " << minEnergy / EeV << " EeV, ";
+      89           0 :         s << "Flag: '" << rejectFlagKey << "' -> '" << rejectFlagValue << "', ";
+      90           0 :         s << "MakeInactive: " << (makeRejectedInactive ? "yes" : "no");
+      91           0 :         if (rejectAction.valid())
+      92           0 :                 s << ", Action: " << rejectAction->getDescription();
+      93           0 :         return s.str();
+      94           0 : }
+      95             : 
+      96             : //*****************************************************************************
+      97           0 : MinimumRigidity::MinimumRigidity(double minRigidity) :
+      98           0 :                 minRigidity(minRigidity) {
+      99           0 : }
+     100             : 
+     101           0 : void MinimumRigidity::setMinimumRigidity(double minRigidity) {
+     102           0 :         this->minRigidity = minRigidity;
+     103           0 : }
+     104             : 
+     105           0 : double MinimumRigidity::getMinimumRigidity() const {
+     106           0 :         return minRigidity;
+     107             : }
+     108             : 
+     109           0 : void MinimumRigidity::process(Candidate *c) const {
+     110           0 :         if (c->current.getRigidity() < minRigidity)
+     111           0 :                 reject(c);
+     112           0 : }
+     113             : 
+     114           0 : std::string MinimumRigidity::getDescription() const {
+     115           0 :         std::stringstream s;
+     116           0 :         s << "Minimum rigidity: " << minRigidity / EeV << " EeV, ";
+     117           0 :         s << "Flag: '" << rejectFlagKey << "' -> '" << rejectFlagValue << "', ";
+     118           0 :         s << "MakeInactive: " << (makeRejectedInactive ? "yes" : "no");
+     119           0 :         if (rejectAction.valid())
+     120           0 :                 s << ", Action: " << rejectAction->getDescription();
+     121           0 :         return s.str();
+     122           0 : }
+     123             : 
+     124             : //*****************************************************************************
+     125           1 : MinimumRedshift::MinimumRedshift(double zmin) :
+     126           1 :                 zmin(zmin) {
+     127           1 : }
+     128             : 
+     129           0 : void MinimumRedshift::setMinimumRedshift(double z) {
+     130           0 :         zmin = z;
+     131           0 : }
+     132             : 
+     133           0 : double MinimumRedshift::getMinimumRedshift() {
+     134           0 :         return zmin;
+     135             : }
+     136             : 
+     137           2 : void MinimumRedshift::process(Candidate* c) const {
+     138           2 :         if (c->getRedshift() > zmin)
+     139             :                 return;
+     140             :         else
+     141           1 :                 reject(c);
+     142             : }
+     143             : 
+     144           0 : std::string MinimumRedshift::getDescription() const {
+     145           0 :         std::stringstream s;
+     146           0 :         s << "Minimum redshift: " << zmin << ", ";
+     147           0 :         s << "Flag: '" << rejectFlagKey << "' -> '" << rejectFlagValue << "', ";
+     148           0 :         s << "MakeInactive: " << (makeRejectedInactive ? "yes" : "no");
+     149           0 :         if (rejectAction.valid())
+     150           0 :                 s << ", Action: " << rejectAction->getDescription();
+     151           0 :         return s.str();
+     152           0 : }
+     153             : 
+     154             : //*****************************************************************************
+     155           1 : MinimumChargeNumber::MinimumChargeNumber(int minChargeNumber) :
+     156           1 :                 minChargeNumber(minChargeNumber) {
+     157           1 : }
+     158             : 
+     159           0 : void MinimumChargeNumber::setMinimumChargeNumber(int chargeNumber) {
+     160           0 :         minChargeNumber = chargeNumber;
+     161           0 : }
+     162             : 
+     163           0 : int MinimumChargeNumber::getMinimumChargeNumber() const {
+     164           0 :         return minChargeNumber;
+     165             : }
+     166             : 
+     167           4 : void MinimumChargeNumber::process(Candidate *c) const {
+     168           4 :         if (chargeNumber(c->current.getId()) > minChargeNumber)
+     169             :                 return;
+     170             :         else
+     171           2 :                 reject(c);
+     172             : }
+     173             : 
+     174           0 : std::string MinimumChargeNumber::getDescription() const {
+     175           0 :         std::stringstream s;
+     176           0 :         s << "Minimum charge number: " << minChargeNumber;
+     177           0 :         s << "Flag: '" << rejectFlagKey << "' -> '" << rejectFlagValue << "', ";
+     178           0 :         s << "MakeInactive: " << (makeRejectedInactive ? "yes" : "no");
+     179           0 :         if (rejectAction.valid())
+     180           0 :                 s << ", Action: " << rejectAction->getDescription();
+     181           0 :         return s.str();
+     182           0 : }
+     183             : 
+     184             : //*****************************************************************************
+     185           1 : MinimumEnergyPerParticleId::MinimumEnergyPerParticleId(double minEnergyOthers) {
+     186           1 :         setMinimumEnergyOthers(minEnergyOthers);
+     187           1 : }
+     188             : 
+     189           3 : void MinimumEnergyPerParticleId::add(int id, double energy) {
+     190           3 :         particleIds.push_back(id);
+     191           3 :         minEnergies.push_back(energy);
+     192           3 : }
+     193             : 
+     194           1 : void MinimumEnergyPerParticleId::setMinimumEnergyOthers(double energy) {
+     195           1 :         minEnergyOthers = energy;
+     196           1 : }
+     197             : 
+     198           0 : double MinimumEnergyPerParticleId::getMinimumEnergyOthers() const {
+     199           0 :         return minEnergyOthers;
+     200             : }
+     201             : 
+     202           5 : void MinimumEnergyPerParticleId::process(Candidate *c) const {
+     203          15 :         for (int i = 0; i < particleIds.size(); i++) {
+     204          12 :                 if (c->current.getId() == particleIds[i]) {
+     205           5 :                         if (c->current.getEnergy() < minEnergies[i])
+     206           3 :                                 reject(c);
+     207             :                         else
+     208             :                                 return;
+     209             :                 }
+     210             :         }
+     211             : 
+     212           3 :         if (c->current.getEnergy() < minEnergyOthers)
+     213           1 :                 reject(c);
+     214             :         else
+     215             :                 return;
+     216             : }
+     217             : 
+     218           0 : std::string MinimumEnergyPerParticleId::getDescription() const {
+     219           0 :         std::stringstream s;
+     220           0 :         s << "Minimum energy for non-specified particles: " << minEnergyOthers / eV << " eV";
+     221           0 :         for (int i = 0; i < minEnergies.size(); i++) {
+     222           0 :                 s << "  for particle " << particleIds[i] << " : " << minEnergies[i] / eV << " eV";
+     223             :         }
+     224           0 :         s << "Flag: '" << rejectFlagKey << "' -> '" << rejectFlagValue << "', ";
+     225           0 :         s << "MakeInactive: " << (makeRejectedInactive ? "yes" : "no");
+     226           0 :         if (rejectAction.valid())
+     227           0 :                 s << ", Action: " << rejectAction->getDescription();
+     228           0 :         return s.str();
+     229           0 : }
+     230             : 
+     231             : //*****************************************************************************
+     232           1 : DetectionLength::DetectionLength(double detLength) :
+     233           1 :                 detLength(detLength) {
+     234           1 : }
+     235             : 
+     236           0 : void DetectionLength::setDetectionLength(double length) {
+     237           0 :         detLength = length;
+     238           0 : }
+     239             : 
+     240           0 : double DetectionLength::getDetectionLength() const {
+     241           0 :         return detLength;
+     242             : }
+     243             : 
+     244             : 
+     245           0 : std::string DetectionLength::getDescription() const {
+     246           0 :         std::stringstream s;
+     247           0 :         s << "Detection length: " << detLength / kpc << " kpc, ";
+     248           0 :         s << "Flag: '" << rejectFlagKey << "' -> '" << rejectFlagValue << "', ";
+     249           0 :         s << "MakeInactive: " << (makeRejectedInactive ? "yes" : "no");
+     250           0 :         if (rejectAction.valid())
+     251           0 :                 s << ", Action: " << rejectAction->getDescription();
+     252           0 :         return s.str();
+     253           0 : }
+     254             : 
+     255           2 : void DetectionLength::process(Candidate *c) const {
+     256           2 :         double length = c->getTrajectoryLength();
+     257           2 :         double step = c->getCurrentStep();
+     258             : 
+     259           2 :         if (length >= detLength && length - step < detLength) {
+     260           1 :                 reject(c);
+     261             :         } else {
+     262           1 :                 c->limitNextStep(detLength - length);
+     263             :         }
+     264           2 : }
+     265             : 
+     266             : 
+     267             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/CandidateSplitting.cpp.func-sort-c.html b/doc/coverageReport/src/module/CandidateSplitting.cpp.func-sort-c.html new file mode 100644 index 000000000..d7f065f98 --- /dev/null +++ b/doc/coverageReport/src/module/CandidateSplitting.cpp.func-sort-c.html @@ -0,0 +1,116 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/CandidateSplitting.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - CandidateSplitting.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:536186.9 %
Date:2024-04-08 14:58:22Functions:101190.9 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa18CandidateSplittingC2Ev0
_ZN7crpropa18CandidateSplitting16setEnergyBinsDSAEddi1
_ZN7crpropa18CandidateSplittingC2Eddi1
_ZNK7crpropa18CandidateSplitting16getMinimalWeightEv1
_ZNK7crpropa18CandidateSplitting9getNsplitEv1
_ZN7crpropa18CandidateSplitting13setEnergyBinsEdddb3
_ZN7crpropa18CandidateSplittingC2Eiddddb3
_ZN7crpropa18CandidateSplitting16setMinimalWeightEd4
_ZN7crpropa18CandidateSplitting9setNsplitEi4
_ZNK7crpropa18CandidateSplitting13getEnergyBinsEv6
_ZNK7crpropa18CandidateSplitting7processEPNS_9CandidateE6
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/CandidateSplitting.cpp.func.html b/doc/coverageReport/src/module/CandidateSplitting.cpp.func.html new file mode 100644 index 000000000..8031c35f7 --- /dev/null +++ b/doc/coverageReport/src/module/CandidateSplitting.cpp.func.html @@ -0,0 +1,116 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/CandidateSplitting.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - CandidateSplitting.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:536186.9 %
Date:2024-04-08 14:58:22Functions:101190.9 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa18CandidateSplitting13setEnergyBinsEdddb3
_ZN7crpropa18CandidateSplitting16setEnergyBinsDSAEddi1
_ZN7crpropa18CandidateSplitting16setMinimalWeightEd4
_ZN7crpropa18CandidateSplitting9setNsplitEi4
_ZN7crpropa18CandidateSplittingC2Eddi1
_ZN7crpropa18CandidateSplittingC2Eiddddb3
_ZN7crpropa18CandidateSplittingC2Ev0
_ZNK7crpropa18CandidateSplitting13getEnergyBinsEv6
_ZNK7crpropa18CandidateSplitting16getMinimalWeightEv1
_ZNK7crpropa18CandidateSplitting7processEPNS_9CandidateE6
_ZNK7crpropa18CandidateSplitting9getNsplitEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/CandidateSplitting.cpp.gcov.html b/doc/coverageReport/src/module/CandidateSplitting.cpp.gcov.html new file mode 100644 index 000000000..c8cd11eb0 --- /dev/null +++ b/doc/coverageReport/src/module/CandidateSplitting.cpp.gcov.html @@ -0,0 +1,194 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/CandidateSplitting.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - CandidateSplitting.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:536186.9 %
Date:2024-04-08 14:58:22Functions:101190.9 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/CandidateSplitting.h"
+       2             : 
+       3             : namespace crpropa {
+       4             : 
+       5           0 : CandidateSplitting::CandidateSplitting() {
+       6             :         // no particle splitting if EnergyBins and NSplit are not specified
+       7           0 :         setNsplit(0);
+       8           0 :         setMinimalWeight(1.);
+       9           0 : }
+      10             : 
+      11           3 : CandidateSplitting::CandidateSplitting(int nSplit, double Emin, double Emax,  double nBins, double minWeight, bool log) {
+      12           3 :         setNsplit(nSplit);
+      13           3 :         setEnergyBins(Emin, Emax, nBins, log);
+      14           3 :         setMinimalWeight(minWeight);
+      15           3 : }
+      16             : 
+      17           1 : CandidateSplitting::CandidateSplitting(double spectralIndex, double Emin, int nBins)  {
+      18             :         // to use with Diffusive Shock Acceleration
+      19           1 :         if (spectralIndex > 0){
+      20           0 :                 throw std::runtime_error(
+      21           0 :                                 "CandidateSplitting: spectralIndex > 0 !"); 
+      22             :         }
+      23             : 
+      24           1 :         setNsplit(2); // always split in 2, calculate bins in energy for given spectrum:
+      25           1 :         double dE = pow(1. / 2, 1. / (spectralIndex + 1)); 
+      26           1 :         setEnergyBinsDSA(Emin, dE, nBins);
+      27           1 :         setMinimalWeight(1. / pow(2, nBins));
+      28           1 : }
+      29             : 
+      30           6 : void CandidateSplitting::process(Candidate *c) const {
+      31           6 :         double currE = c->current.getEnergy(); 
+      32           6 :         double prevE = c->previous.getEnergy();
+      33             : 
+      34           6 :         if (c->getWeight() <= minWeight){
+      35             :                 // minimal weight reached, no splitting
+      36             :                 return;
+      37             :         }
+      38           5 :         if (currE < Ebins[0] || nSplit == 0 ){
+      39             :                 // current energy is smaller than first bin -> no splitting
+      40             :                 // or, number of splits = 0
+      41             :                 return;
+      42             :         }
+      43           4 :         for (size_t i = 0; i < Ebins.size(); ++i){
+      44             :                 
+      45           4 :                 if( prevE < Ebins[i] ){
+      46             :                         // previous energy is in energy bin [i-1, i]
+      47           3 :                         if(currE < Ebins[i]){
+      48             :                                 //assuming that dE greater than 0, prevE and E in same energy bin -> no splitting
+      49             :                                 return;
+      50             :                         }
+      51             :                         // current energy is in energy bin [i,i+1] or higher -> particle splitting for each crossing
+      52           4 :                         for (size_t j = i; j < Ebins.size(); ++j ){
+      53             : 
+      54             :                                 // adapted from Acceleration Module:
+      55           4 :                                 c->updateWeight(1. / nSplit); // * 1/n_split
+      56             : 
+      57           8 :                                 for (int i = 1; i < nSplit; i++) {
+      58             :                                 
+      59           4 :                                         ref_ptr<Candidate> new_candidate = c->clone(false);
+      60           4 :                                         new_candidate->parent = c;
+      61           4 :                                         new_candidate->previous.setEnergy(currE); // so that new candidate is not split again in next step!
+      62             :                                         c->addSecondary(new_candidate);
+      63             :                                 }
+      64           4 :                                 if (j < Ebins.size()-1 && currE < Ebins[j+1]){
+      65             :                                         // candidate is in energy bin [j, j+1] -> no further splitting
+      66             :                                         return;
+      67             :                                 }
+      68             :                         }
+      69             :                         return;
+      70             :                 }
+      71             :         }
+      72             : }
+      73             : 
+      74           3 : void CandidateSplitting::setEnergyBins(double Emin, double Emax, double nBins, bool log) {
+      75           3 :         Ebins.resize(0);
+      76           3 :         if (Emin > Emax){
+      77           0 :                 throw std::runtime_error(
+      78           0 :                                 "CandidateSplitting: Emin > Emax!");
+      79             :         }
+      80           3 :         double dE = (Emax-Emin)/nBins;
+      81          14 :         for (size_t i = 0; i < nBins; ++i) {
+      82          11 :                 if (log == true) {
+      83           4 :                         Ebins.push_back(Emin * pow(Emax / Emin, i / (nBins - 1.0)));
+      84             :                 } else {
+      85           7 :                         Ebins.push_back(Emin + i * dE);
+      86             :                 }
+      87             :         }
+      88           3 : }
+      89             : 
+      90           1 : void CandidateSplitting::setEnergyBinsDSA(double Emin, double dE, int n) {
+      91           1 :         Ebins.resize(0);
+      92           5 :         for (size_t i = 1; i < n + 1; ++i) {
+      93           4 :                 Ebins.push_back(Emin * pow(dE, i));
+      94             :         }
+      95           1 : }
+      96             : 
+      97           6 : const std::vector<double>& CandidateSplitting::getEnergyBins() const {
+      98           6 :         return Ebins;
+      99             : }
+     100             : 
+     101           4 : void CandidateSplitting::setNsplit(int n) {
+     102           4 :         nSplit = n;
+     103           4 : }
+     104             : 
+     105           4 : void CandidateSplitting::setMinimalWeight(double w) {
+     106           4 :         minWeight = w;
+     107           4 : }
+     108             : 
+     109           1 : int CandidateSplitting::getNsplit() const {
+     110           1 :         return nSplit;
+     111             : }
+     112             : 
+     113           1 : double CandidateSplitting::getMinimalWeight() const {
+     114           1 :         return minWeight;
+     115             : }
+     116             : 
+     117             : } // end namespace crpropa
+     118             : 
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/DiffusionSDE.cpp.func-sort-c.html b/doc/coverageReport/src/module/DiffusionSDE.cpp.func-sort-c.html new file mode 100644 index 000000000..119a389bf --- /dev/null +++ b/doc/coverageReport/src/module/DiffusionSDE.cpp.func-sort-c.html @@ -0,0 +1,172 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/DiffusionSDE.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - DiffusionSDE.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:15420276.2 %
Date:2024-04-08 14:58:22Functions:222588.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa12DiffusionSDE14getDescriptionB5cxx11Ev0
_ZNK7crpropa12DiffusionSDE16getMagneticFieldEv0
_ZNK7crpropa12DiffusionSDE17getAdvectionFieldEv0
_ZNK7crpropa12DiffusionSDE10getEpsilonEv1
_ZNK7crpropa12DiffusionSDE12getToleranceEv1
_ZNK7crpropa12DiffusionSDE14getMaximumStepEv1
_ZNK7crpropa12DiffusionSDE14getMinimumStepEv1
_ZN7crpropa12DiffusionSDE17setAdvectionFieldENS_7ref_ptrINS_14AdvectionFieldEEE3
_ZN7crpropa12DiffusionSDEC2ENS_7ref_ptrINS_13MagneticFieldEEENS1_INS_14AdvectionFieldEEEdddd3
_ZN7crpropa12DiffusionSDEC2ENS_7ref_ptrINS_13MagneticFieldEEEdddd4
_ZNK7crpropa12DiffusionSDE8getAlphaEv5
_ZNK7crpropa12DiffusionSDE8getScaleEv5
_ZN7crpropa12DiffusionSDE10setEpsilonEd7
_ZN7crpropa12DiffusionSDE12setToleranceEd7
_ZN7crpropa12DiffusionSDE14setMaximumStepEd7
_ZN7crpropa12DiffusionSDE14setMinimumStepEd7
_ZN7crpropa12DiffusionSDE16setMagneticFieldENS_7ref_ptrINS_13MagneticFieldEEE7
_ZN7crpropa12DiffusionSDE8setAlphaEd7
_ZN7crpropa12DiffusionSDE8setScaleEd7
_ZNK7crpropa12DiffusionSDE9driftStepERKNS_7Vector3IdEERS2_d120001
_ZNK7crpropa12DiffusionSDE27getAdvectionFieldAtPositionENS_7Vector3IdEE120002
_ZNK7crpropa12DiffusionSDE16calculateBTensorEdPdNS_7Vector3IdEES3_d480002
_ZNK7crpropa12DiffusionSDE7processEPNS_9CandidateE480003
_ZNK7crpropa12DiffusionSDE7tryStepERKNS_7Vector3IdEERS2_S5_dd960004
_ZNK7crpropa12DiffusionSDE26getMagneticFieldAtPositionENS_7Vector3IdEEd5760025
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/DiffusionSDE.cpp.func.html b/doc/coverageReport/src/module/DiffusionSDE.cpp.func.html new file mode 100644 index 000000000..d4e981a1a --- /dev/null +++ b/doc/coverageReport/src/module/DiffusionSDE.cpp.func.html @@ -0,0 +1,172 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/DiffusionSDE.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - DiffusionSDE.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:15420276.2 %
Date:2024-04-08 14:58:22Functions:222588.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa12DiffusionSDE10setEpsilonEd7
_ZN7crpropa12DiffusionSDE12setToleranceEd7
_ZN7crpropa12DiffusionSDE14setMaximumStepEd7
_ZN7crpropa12DiffusionSDE14setMinimumStepEd7
_ZN7crpropa12DiffusionSDE16setMagneticFieldENS_7ref_ptrINS_13MagneticFieldEEE7
_ZN7crpropa12DiffusionSDE17setAdvectionFieldENS_7ref_ptrINS_14AdvectionFieldEEE3
_ZN7crpropa12DiffusionSDE8setAlphaEd7
_ZN7crpropa12DiffusionSDE8setScaleEd7
_ZN7crpropa12DiffusionSDEC2ENS_7ref_ptrINS_13MagneticFieldEEENS1_INS_14AdvectionFieldEEEdddd3
_ZN7crpropa12DiffusionSDEC2ENS_7ref_ptrINS_13MagneticFieldEEEdddd4
_ZNK7crpropa12DiffusionSDE10getEpsilonEv1
_ZNK7crpropa12DiffusionSDE12getToleranceEv1
_ZNK7crpropa12DiffusionSDE14getDescriptionB5cxx11Ev0
_ZNK7crpropa12DiffusionSDE14getMaximumStepEv1
_ZNK7crpropa12DiffusionSDE14getMinimumStepEv1
_ZNK7crpropa12DiffusionSDE16calculateBTensorEdPdNS_7Vector3IdEES3_d480002
_ZNK7crpropa12DiffusionSDE16getMagneticFieldEv0
_ZNK7crpropa12DiffusionSDE17getAdvectionFieldEv0
_ZNK7crpropa12DiffusionSDE26getMagneticFieldAtPositionENS_7Vector3IdEEd5760025
_ZNK7crpropa12DiffusionSDE27getAdvectionFieldAtPositionENS_7Vector3IdEE120002
_ZNK7crpropa12DiffusionSDE7processEPNS_9CandidateE480003
_ZNK7crpropa12DiffusionSDE7tryStepERKNS_7Vector3IdEERS2_S5_dd960004
_ZNK7crpropa12DiffusionSDE8getAlphaEv5
_ZNK7crpropa12DiffusionSDE8getScaleEv5
_ZNK7crpropa12DiffusionSDE9driftStepERKNS_7Vector3IdEERS2_d120001
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/DiffusionSDE.cpp.gcov.html b/doc/coverageReport/src/module/DiffusionSDE.cpp.gcov.html new file mode 100644 index 000000000..51ca09aab --- /dev/null +++ b/doc/coverageReport/src/module/DiffusionSDE.cpp.gcov.html @@ -0,0 +1,480 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/DiffusionSDE.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - DiffusionSDE.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:15420276.2 %
Date:2024-04-08 14:58:22Functions:222588.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/DiffusionSDE.h"
+       2             : 
+       3             : 
+       4             : using namespace crpropa;
+       5             : 
+       6             : // Defining Cash-Karp coefficients
+       7             : const double a[] = { 0., 0., 0., 0., 0., 0., 1. / 5., 0., 0., 0., 0.,
+       8             :                 0., 3. / 40., 9. / 40., 0., 0., 0., 0., 3. / 10., -9. / 10., 6. / 5.,
+       9             :                 0., 0., 0., -11. / 54., 5. / 2., -70. / 27., 35. / 27., 0., 0., 1631.
+      10             :                                 / 55296., 175. / 512., 575. / 13824., 44275. / 110592., 253.
+      11             :                                 / 4096., 0. };
+      12             : 
+      13             : const double b[] = { 37. / 378., 0, 250. / 621., 125. / 594., 0., 512.
+      14             :                 / 1771. };
+      15             : 
+      16             : const double bs[] = { 2825. / 27648., 0., 18575. / 48384., 13525.
+      17             :                 / 55296., 277. / 14336., 1. / 4. };
+      18             : 
+      19             : 
+      20             : 
+      21           4 : DiffusionSDE::DiffusionSDE(ref_ptr<MagneticField> magneticField, double tolerance,
+      22           4 :                                  double minStep, double maxStep, double epsilon) :
+      23           4 :         minStep(0)
+      24             : {
+      25           4 :         setMagneticField(magneticField);
+      26           4 :         setMaximumStep(maxStep);
+      27           4 :         setMinimumStep(minStep);
+      28           4 :         setTolerance(tolerance);
+      29           4 :         setEpsilon(epsilon);
+      30           4 :         setScale(1.);
+      31           4 :         setAlpha(1./3.);
+      32           4 :         }
+      33             : 
+      34           3 : DiffusionSDE::DiffusionSDE(ref_ptr<MagneticField> magneticField, ref_ptr<AdvectionField> advectionField, double tolerance, double minStep, double maxStep, double epsilon) :
+      35           3 :         minStep(0)
+      36             : {
+      37           6 :         setMagneticField(magneticField);
+      38           3 :         setAdvectionField(advectionField);
+      39           3 :         setMaximumStep(maxStep);
+      40           3 :         setMinimumStep(minStep);
+      41           3 :         setTolerance(tolerance);
+      42           3 :         setEpsilon(epsilon);
+      43           3 :         setScale(1.);
+      44           3 :         setAlpha(1./3.);
+      45           3 :         }
+      46             : 
+      47      480003 : void DiffusionSDE::process(Candidate *candidate) const {
+      48             : 
+      49             :     // save the new previous particle state
+      50             : 
+      51      480003 :         ParticleState &current = candidate->current;
+      52             :         candidate->previous = current;
+      53             : 
+      54      480003 :         double h = clip(candidate->getNextStep(), minStep, maxStep) / c_light;
+      55      480003 :         Vector3d PosIn = current.getPosition();
+      56      480003 :         Vector3d DirIn = current.getDirection();
+      57             : 
+      58             :     // rectilinear propagation for neutral particles
+      59             :     // If an advection field is provided the drift is also included
+      60      480003 :         if (current.getCharge() == 0) {
+      61           1 :                 Vector3d dir = current.getDirection();
+      62           1 :                 Vector3d Pos = current.getPosition();
+      63             : 
+      64             :                 Vector3d LinProp(0.);
+      65           1 :                 if (advectionField){
+      66           0 :                         driftStep(Pos, LinProp, h);
+      67             :                 }
+      68             : 
+      69           1 :                 current.setPosition(Pos + LinProp + dir*h*c_light);
+      70           1 :                 candidate->setCurrentStep(h * c_light);
+      71           1 :                 candidate->setNextStep(maxStep);
+      72             :                 return;
+      73             :         }
+      74             : 
+      75      480002 :         double z = candidate->getRedshift();
+      76      480002 :         double rig = current.getEnergy() / current.getCharge();
+      77             : 
+      78             : 
+      79             :     // Calculate the Diffusion tensor
+      80      480002 :         double BTensor[] = {0., 0., 0., 0., 0., 0., 0., 0., 0.};
+      81      480002 :         calculateBTensor(rig, BTensor, PosIn, DirIn, z);
+      82             : 
+      83             : 
+      84             :     // Generate random numbers
+      85      480002 :         double eta[] = {0., 0., 0.};
+      86     1920008 :         for(size_t i=0; i < 3; i++) {
+      87     1440006 :                 eta[i] =  Random::instance().randNorm();
+      88             :         }
+      89             : 
+      90      480002 :         double TStep = BTensor[0] * eta[0];
+      91      480002 :         double NStep = BTensor[4] * eta[1];
+      92      480002 :         double BStep = BTensor[8] * eta[2];
+      93             : 
+      94             :         Vector3d TVec(0.);
+      95             :         Vector3d NVec(0.);
+      96             :         Vector3d BVec(0.);
+      97             : 
+      98             :         Vector3d DirOut = Vector3d(0.);
+      99             : 
+     100             : 
+     101      480002 :         double propTime = TStep * sqrt(h) / c_light;
+     102             :         size_t counter = 0;
+     103             :         double r=42.; //arbitrary number larger than one
+     104             : 
+     105             :         do {
+     106             :                 Vector3d PosOut = Vector3d(0.);
+     107             :                 Vector3d PosErr = Vector3d(0.);
+     108      480002 :                 tryStep(PosIn, PosOut, PosErr, z, propTime);
+     109             :             // calculate the relative position error r and the next time step h
+     110      480002 :                 r = PosErr.getR() / tolerance;
+     111      480002 :                 propTime *= 0.5;
+     112      480002 :                 counter += 1;
+     113             : 
+     114             :     // Check for better break condition
+     115      480002 :         } while (r > 1 && fabs(propTime) >= minStep/c_light);
+     116             : 
+     117             : 
+     118      480002 :         size_t stepNumber = pow(2, counter-1);
+     119      480002 :         double allowedTime = TStep * sqrt(h) / c_light / stepNumber;
+     120             :         Vector3d Start = PosIn;
+     121             :         Vector3d PosOut = Vector3d(0.);
+     122             :         Vector3d PosErr = Vector3d(0.);
+     123      960004 :         for (size_t j=0; j<stepNumber; j++) {
+     124      480002 :                 tryStep(Start, PosOut, PosErr, z, allowedTime);
+     125             :                 Start = PosOut;
+     126             :         }
+     127             : 
+     128             :     // Normalize the tangent vector
+     129      480002 :         TVec = (PosOut-PosIn).getUnitVector();
+     130             :     // Exception: If the magnetic field vanishes: Use only advection.
+     131             :     // If an advection field is not provided --> rectilinear propagation.
+     132             :         double tTest = TVec.getR();
+     133      480002 :         if (tTest != tTest) {
+     134           2 :                 Vector3d dir = current.getDirection();
+     135           2 :                 Vector3d Pos = current.getPosition();
+     136             :                 Vector3d LinProp(0.);
+     137           2 :                 if (advectionField){
+     138           1 :                         driftStep(Pos, LinProp, h);
+     139           1 :                         current.setPosition(Pos + LinProp);
+     140           1 :                         candidate->setCurrentStep(h*c_light);
+     141           1 :                         double newStep = 5*h*c_light;
+     142             :                         newStep = clip(newStep, minStep, maxStep);
+     143           1 :                         candidate->setNextStep(newStep);
+     144             :                         return;
+     145             :                 }
+     146           1 :                 current.setPosition(Pos + dir*h*c_light);
+     147           1 :                 candidate->setCurrentStep(h*c_light);
+     148           1 :                 double newStep = 5*h*c_light;
+     149           1 :                 newStep = clip(newStep, minStep, maxStep);
+     150           1 :                 candidate->setNextStep(newStep);
+     151           1 :                 return;
+     152             :         }
+     153             : 
+     154             :     // Choose a random perpendicular vector as the Normal-vector.
+     155             :     // Prevent 'nan's in the NVec-vector in the case of <TVec, NVec> = 0.
+     156      960000 :         while (NVec.getR()==0.){
+     157      480000 :                 Vector3d RandomVector = Random::instance().randVector();
+     158             :                 NVec = TVec.cross( RandomVector );
+     159             :         }
+     160      480000 :         NVec = NVec.getUnitVector();
+     161             : 
+     162             :     // Calculate the Binormal-vector
+     163      480000 :         BVec = (TVec.cross(NVec)).getUnitVector();
+     164             : 
+     165             :     // Calculate the advection step
+     166             :         Vector3d LinProp(0.);
+     167      480000 :         if (advectionField){
+     168      120000 :                 driftStep(PosIn, LinProp, h);
+     169             :         }
+     170             : 
+     171             :     // Integration of the SDE with a Mayorama-Euler-method
+     172      480000 :         Vector3d PO = PosOut + LinProp + (NVec * NStep + BVec * BStep) * sqrt(h) ;
+     173             : 
+     174             :     // Throw error message if something went wrong with propagation.
+     175             :     // Deactivate candidate.
+     176             :         bool NaN = std::isnan(PO.getR());
+     177      480000 :         if (NaN == true){
+     178           0 :                   candidate->setActive(false);
+     179           0 :                   KISS_LOG_WARNING
+     180           0 :                         << "\nCandidate with 'nan'-position occured: \n"
+     181           0 :                         << "position = " << PO << "\n"
+     182           0 :                         << "PosIn = " << PosIn << "\n"
+     183           0 :                         << "TVec = " << TVec << "\n"
+     184           0 :                         << "TStep = " << std::abs(TStep) << "\n"
+     185           0 :                         << "NVec = " << NVec << "\n"
+     186             :                         << "NStep = " << NStep << "\n"
+     187           0 :                         << "BVec = " << BVec << "\n"
+     188             :                         << "BStep = " << BStep << "\n"
+     189           0 :                         << "Candidate is deactivated!\n";
+     190             :                   return;
+     191             :         }
+     192             : 
+     193             :         //DirOut = (PO - PosIn - LinProp).getUnitVector(); //Advection does not change the momentum vector
+     194             :         // Random direction around the tangential direction accounts for the pitch angle average.
+     195      480000 :         DirOut = Random::instance().randConeVector(TVec, M_PI/2.);
+     196      480000 :         current.setPosition(PO);
+     197      480000 :         current.setDirection(DirOut);
+     198      480000 :         candidate->setCurrentStep(h * c_light);
+     199             : 
+     200             :         double nextStep;
+     201      480000 :         if (stepNumber>1){
+     202           0 :                 nextStep = h*pow(stepNumber, -2.)*c_light;
+     203             :         }
+     204             :         else {
+     205      480000 :                 nextStep = 4 * h*c_light;
+     206             :         }
+     207             : 
+     208      480000 :         candidate->setNextStep(nextStep);
+     209             : 
+     210             :         // Debugging and Testing
+     211             :         // Delete comments if additional information should be stored in candidate
+     212             :         // This property "arcLength" can be interpreted as the effective arclength
+     213             :         // of the propagation along a magnetic field line.
+     214             : 
+     215             : /*
+     216             :         const std::string AL = "arcLength";
+     217             :         if (candidate->hasProperty(AL) == false){
+     218             :           double arcLen = (TStep + NStep + BStep) * sqrt(h);
+     219             :           candidate->setProperty(AL, arcLen);
+     220             :           return;
+     221             :         }
+     222             :         else {
+     223             :           double arcLen = candidate->getProperty(AL);
+     224             :           arcLen += (TStep + NStep + BStep) * sqrt(h);
+     225             :           candidate->setProperty(AL, arcLen);
+     226             :         }
+     227             : */
+     228             : 
+     229             : }
+     230             : 
+     231             : 
+     232      960004 : void DiffusionSDE::tryStep(const Vector3d &PosIn, Vector3d &POut, Vector3d &PosErr,double z, double propStep) const {
+     233             : 
+     234             :         Vector3d k[] = {Vector3d(0.),Vector3d(0.),Vector3d(0.),Vector3d(0.),Vector3d(0.),Vector3d(0.)};
+     235             :         POut = PosIn;
+     236             :         //calculate the sum k_i * b_i
+     237     6720028 :         for (size_t i = 0; i < 6; i++) {
+     238             : 
+     239             :                 Vector3d y_n = PosIn;
+     240    20160084 :                 for (size_t j = 0; j < i; j++)
+     241    14400060 :                   y_n += k[j] * a[i * 6 + j] * propStep;
+     242             : 
+     243             :                 // update k_i = direction of the regular magnetic mean field
+     244     5760024 :                 Vector3d BField = getMagneticFieldAtPosition(y_n, z);
+     245             : 
+     246     5760024 :                 k[i] = BField.getUnitVector() * c_light;
+     247             : 
+     248     5760024 :                 POut += k[i] * b[i] * propStep;
+     249     5760024 :                 PosErr +=  (k[i] * (b[i] - bs[i])) * propStep / kpc;
+     250             : 
+     251             :         }
+     252      960004 : }
+     253             : 
+     254      120001 : void DiffusionSDE::driftStep(const Vector3d &pos, Vector3d &linProp, double h) const {
+     255      120001 :         Vector3d advField = getAdvectionFieldAtPosition(pos);
+     256             :         linProp += advField * h;
+     257      120001 :         return;
+     258             : }
+     259             : 
+     260      480002 : void DiffusionSDE::calculateBTensor(double r, double BTen[], Vector3d pos, Vector3d dir, double z) const {
+     261             : 
+     262      480002 :     double DifCoeff = scale * 6.1e24 * pow((std::abs(r) / 4.0e9), alpha);
+     263      480002 :     BTen[0] = pow( 2  * DifCoeff, 0.5);
+     264      480002 :     BTen[4] = pow(2 * epsilon * DifCoeff, 0.5);
+     265      480002 :     BTen[8] = pow(2 * epsilon * DifCoeff, 0.5);
+     266      480002 :     return;
+     267             : 
+     268             : }
+     269             : 
+     270             : 
+     271           7 : void DiffusionSDE::setMinimumStep(double min) {
+     272           7 :         if (min < 0)
+     273           0 :                 throw std::runtime_error("DiffusionSDE: minStep < 0 ");
+     274           7 :         if (min > maxStep)
+     275           0 :                 throw std::runtime_error("DiffusionSDE: minStep > maxStep");
+     276           7 :         minStep = min;
+     277           7 : }
+     278             : 
+     279           7 : void DiffusionSDE::setMaximumStep(double max) {
+     280           7 :         if (max < minStep)
+     281           0 :                 throw std::runtime_error("DiffusionSDE: maxStep < minStep");
+     282           7 :         maxStep = max;
+     283           7 : }
+     284             : 
+     285             : 
+     286           7 : void DiffusionSDE::setTolerance(double tol) {
+     287           7 :         if ((tol > 1) or (tol < 0))
+     288           0 :                 throw std::runtime_error(
+     289           0 :                                 "DiffusionSDE: tolerance error not in range 0-1");
+     290           7 :         tolerance = tol;
+     291           7 : }
+     292             : 
+     293           7 : void DiffusionSDE::setEpsilon(double e) {
+     294           7 :         if ((e > 1) or (e < 0))
+     295           0 :                 throw std::runtime_error(
+     296           0 :                                 "DiffusionSDE: epsilon not in range 0-1");
+     297           7 :         epsilon = e;
+     298           7 : }
+     299             : 
+     300             : 
+     301           7 : void DiffusionSDE::setAlpha(double a) {
+     302           7 :         if ((a > 2.) or (a < 0))
+     303           0 :                 throw std::runtime_error(
+     304           0 :                                 "DiffusionSDE: alpha not in range 0-2");
+     305           7 :         alpha = a;
+     306           7 : }
+     307             : 
+     308           7 : void DiffusionSDE::setScale(double s) {
+     309           7 :         if (s < 0)
+     310           0 :                 throw std::runtime_error(
+     311           0 :                                 "DiffusionSDE: Scale error: Scale < 0");
+     312           7 :         scale = s;
+     313           7 : }
+     314             : 
+     315           7 : void DiffusionSDE::setMagneticField(ref_ptr<MagneticField> f) {
+     316           7 :         magneticField = f;
+     317           7 : }
+     318             : 
+     319           3 : void DiffusionSDE::setAdvectionField(ref_ptr<AdvectionField> f) {
+     320           3 :         advectionField = f;
+     321           3 : }
+     322             : 
+     323           1 : double DiffusionSDE::getMinimumStep() const {
+     324           1 :         return minStep;
+     325             : }
+     326             : 
+     327           1 : double DiffusionSDE::getMaximumStep() const {
+     328           1 :         return maxStep;
+     329             : }
+     330             : 
+     331           1 : double DiffusionSDE::getTolerance() const {
+     332           1 :         return tolerance;
+     333             : }
+     334             : 
+     335           1 : double DiffusionSDE::getEpsilon() const {
+     336           1 :         return epsilon;
+     337             : }
+     338             : 
+     339           5 : double DiffusionSDE::getAlpha() const {
+     340           5 :         return alpha;
+     341             : }
+     342             : 
+     343           5 : double DiffusionSDE::getScale() const {
+     344           5 :         return scale;
+     345             : }
+     346             : 
+     347           0 : ref_ptr<MagneticField> DiffusionSDE::getMagneticField() const {
+     348           0 :         return magneticField;
+     349             : }
+     350             : 
+     351     5760025 : Vector3d DiffusionSDE::getMagneticFieldAtPosition(Vector3d pos, double z) const {
+     352             :         Vector3d B(0, 0, 0);
+     353             :         try {
+     354             :                 // check if field is valid and use the field vector at the
+     355             :                 // position pos with the redshift z
+     356     5760025 :                 if (magneticField.valid())
+     357     5760025 :                         B = magneticField->getField(pos, z);
+     358             :         }
+     359           0 :         catch (std::exception &e) {
+     360           0 :                 KISS_LOG_ERROR  << "DiffusionSDE: Exception in DiffusionSDE::getMagneticFieldAtPosition.\n"
+     361           0 :                                 << e.what();
+     362           0 :         }       
+     363     5760025 :         return B;
+     364             : }
+     365             : 
+     366           0 : ref_ptr<AdvectionField> DiffusionSDE::getAdvectionField() const {
+     367           0 :         return advectionField;
+     368             : }
+     369             : 
+     370      120002 : Vector3d DiffusionSDE::getAdvectionFieldAtPosition(Vector3d pos) const {
+     371             :         Vector3d AdvField(0.);
+     372             :         try {
+     373             :                 // check if field is valid and use the field vector at the
+     374             :                 // position pos
+     375      120002 :                 if (advectionField.valid())
+     376      120002 :                         AdvField = advectionField->getField(pos);
+     377             :         }
+     378           0 :         catch (std::exception &e) {
+     379           0 :                 KISS_LOG_ERROR  << "DiffusionSDE: Exception in DiffusionSDE::getAdvectionFieldAtPosition.\n"
+     380           0 :                                 << e.what();
+     381           0 :         }
+     382      120002 :         return AdvField;
+     383             : }
+     384             : 
+     385           0 : std::string DiffusionSDE::getDescription() const {
+     386           0 :         std::stringstream s;
+     387           0 :         s << "minStep: " << minStep / kpc  << " kpc, ";
+     388           0 :         s << "maxStep: " << maxStep / kpc  << " kpc, ";
+     389           0 :         s << "tolerance: " << tolerance << "\n";
+     390             : 
+     391           0 :         if (epsilon != 0.1) {
+     392           0 :           s << "epsilon: " << epsilon << ", ";
+     393             :           }
+     394             : 
+     395           0 :         if (alpha != 1./3.) {
+     396           0 :           s << "alpha: " << alpha << "\n";
+     397             :           }
+     398             : 
+     399           0 :         if (scale != 1.) {
+     400           0 :           s << "D_0: " << scale*6.1e24 << " m^2/s" << "\n";
+     401             :           }
+     402             : 
+     403           0 :         return s.str();
+     404           0 : }
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/EMDoublePairProduction.cpp.func-sort-c.html b/doc/coverageReport/src/module/EMDoublePairProduction.cpp.func-sort-c.html new file mode 100644 index 000000000..a80dbd404 --- /dev/null +++ b/doc/coverageReport/src/module/EMDoublePairProduction.cpp.func-sort-c.html @@ -0,0 +1,112 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/EMDoublePairProduction.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - EMDoublePairProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:687294.4 %
Date:2024-04-08 14:58:22Functions:1010100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa22EMDoublePairProduction17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZNK7crpropa22EMDoublePairProduction18performInteractionEPNS_9CandidateE1
_ZNK7crpropa22EMDoublePairProduction7processEPNS_9CandidateE1
_ZNK7crpropa22EMDoublePairProduction17getInteractionTagB5cxx11Ev2
_ZN7crpropa22EMDoublePairProduction11setThinningEd3
_ZN7crpropa22EMDoublePairProduction8setLimitEd3
_ZN7crpropa22EMDoublePairProductionC2ENS_7ref_ptrINS_11PhotonFieldEEEbdd3
_ZN7crpropa22EMDoublePairProduction16setHaveElectronsEb4
_ZN7crpropa22EMDoublePairProduction14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE15
_ZN7crpropa22EMDoublePairProduction8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE15
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/EMDoublePairProduction.cpp.func.html b/doc/coverageReport/src/module/EMDoublePairProduction.cpp.func.html new file mode 100644 index 000000000..4e691a3a6 --- /dev/null +++ b/doc/coverageReport/src/module/EMDoublePairProduction.cpp.func.html @@ -0,0 +1,112 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/EMDoublePairProduction.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - EMDoublePairProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:687294.4 %
Date:2024-04-08 14:58:22Functions:1010100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa22EMDoublePairProduction11setThinningEd3
_ZN7crpropa22EMDoublePairProduction14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE15
_ZN7crpropa22EMDoublePairProduction16setHaveElectronsEb4
_ZN7crpropa22EMDoublePairProduction17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa22EMDoublePairProduction8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE15
_ZN7crpropa22EMDoublePairProduction8setLimitEd3
_ZN7crpropa22EMDoublePairProductionC2ENS_7ref_ptrINS_11PhotonFieldEEEbdd3
_ZNK7crpropa22EMDoublePairProduction17getInteractionTagB5cxx11Ev2
_ZNK7crpropa22EMDoublePairProduction18performInteractionEPNS_9CandidateE1
_ZNK7crpropa22EMDoublePairProduction7processEPNS_9CandidateE1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/EMDoublePairProduction.cpp.gcov.html b/doc/coverageReport/src/module/EMDoublePairProduction.cpp.gcov.html new file mode 100644 index 000000000..5469562c6 --- /dev/null +++ b/doc/coverageReport/src/module/EMDoublePairProduction.cpp.gcov.html @@ -0,0 +1,209 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/EMDoublePairProduction.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - EMDoublePairProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:687294.4 %
Date:2024-04-08 14:58:22Functions:1010100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/EMDoublePairProduction.h"
+       2             : #include "crpropa/Units.h"
+       3             : #include "crpropa/Random.h"
+       4             : 
+       5             : #include <fstream>
+       6             : #include <limits>
+       7             : #include <stdexcept>
+       8             : 
+       9             : namespace crpropa {
+      10             : 
+      11           3 : EMDoublePairProduction::EMDoublePairProduction(ref_ptr<PhotonField> photonField, bool haveElectrons, double thinning, double limit) {
+      12           3 :         setPhotonField(photonField);
+      13           3 :         setHaveElectrons(haveElectrons);
+      14           3 :         setLimit(limit);
+      15           3 :         setThinning(thinning);
+      16           3 : }
+      17             : 
+      18          15 : void EMDoublePairProduction::setPhotonField(ref_ptr<PhotonField> photonField) {
+      19          15 :         this->photonField = photonField;
+      20          15 :         std::string fname = photonField->getFieldName();
+      21          15 :         setDescription("EMDoublePairProduction: " + fname);
+      22          45 :         initRate(getDataPath("EMDoublePairProduction/rate_" + fname + ".txt"));
+      23          15 : }
+      24             : 
+      25           4 : void EMDoublePairProduction::setHaveElectrons(bool haveElectrons) {
+      26           4 :         this->haveElectrons = haveElectrons;
+      27           4 : }
+      28             : 
+      29           3 : void EMDoublePairProduction::setLimit(double limit) {
+      30           3 :         this->limit = limit;
+      31           3 : }
+      32             : 
+      33           3 : void EMDoublePairProduction::setThinning(double thinning) {
+      34           3 :         this->thinning = thinning;
+      35           3 : }
+      36             : 
+      37          15 : void EMDoublePairProduction::initRate(std::string filename) {
+      38          15 :         std::ifstream infile(filename.c_str());
+      39             : 
+      40          15 :         if (!infile.good())
+      41           0 :                 throw std::runtime_error("EMDoublePairProduction: could not open file " + filename);
+      42             : 
+      43             :         // clear previously loaded interaction rates
+      44          15 :         tabEnergy.clear();
+      45          15 :         tabRate.clear();
+      46             : 
+      47        3306 :         while (infile.good()) {
+      48        3291 :                 if (infile.peek() != '#') {
+      49             :                         double a, b;
+      50             :                         infile >> a >> b;
+      51        3231 :                         if (infile) {
+      52        3216 :                                 tabEnergy.push_back(pow(10, a) * eV);
+      53        3216 :                                 tabRate.push_back(b / Mpc);
+      54             :                         }
+      55             :                 }
+      56        3291 :                 infile.ignore(std::numeric_limits < std::streamsize > ::max(), '\n');
+      57             :         }
+      58          15 :         infile.close();
+      59          15 : }
+      60             : 
+      61             : 
+      62           1 : void EMDoublePairProduction::performInteraction(Candidate *candidate) const {
+      63             :         // the photon is lost after the interaction
+      64           1 :         candidate->setActive(false);
+      65             : 
+      66           1 :         if (not haveElectrons)
+      67           0 :                 return;
+      68             : 
+      69             :         // Use assumption of Lee 96 arXiv:9604098
+      70             :         // Energy is equally shared between one e+e- pair, but take mass of second e+e- pair into account.
+      71             :         // This approximation has been shown to be valid within -1.5%.
+      72           1 :         double z = candidate->getRedshift();
+      73           1 :         double E = candidate->current.getEnergy() * (1 + z);
+      74           1 :         double Ee = (E - 2 * mass_electron * c_squared) / 2;
+      75             : 
+      76           1 :         Random &random = Random::instance();
+      77           1 :         Vector3d pos = random.randomInterpolatedPosition(candidate->previous.getPosition(), candidate->current.getPosition());
+      78             : 
+      79           1 :         double f = Ee / E;
+      80             : 
+      81           1 :         if (haveElectrons) {
+      82           1 :                 if (random.rand() < pow(1 - f, thinning)) {
+      83           1 :                         double w = 1. / pow(1 - f, thinning);
+      84           1 :                         candidate->addSecondary( 11, Ee / (1 + z), pos, w, interactionTag);
+      85             :                 } 
+      86           1 :                 if (random.rand() < pow(f, thinning)) {
+      87           1 :                         double w = 1. / pow(f, thinning);
+      88           1 :                         candidate->addSecondary(-11, Ee / (1 + z), pos, w, interactionTag);
+      89             :                 }
+      90             :         }
+      91             : }
+      92             : 
+      93           1 : void EMDoublePairProduction::process(Candidate *candidate) const {
+      94             :         // check if photon
+      95           1 :         if (candidate->current.getId() != 22)
+      96             :                 return;
+      97             : 
+      98             :         // scale the electron energy instead of background photons
+      99           1 :         double z = candidate->getRedshift();
+     100           1 :         double E = (1 + z) * candidate->current.getEnergy();
+     101             : 
+     102             :         // check if in tabulated energy range
+     103           1 :         if (E < tabEnergy.front() or (E > tabEnergy.back()))
+     104             :                 return;
+     105             : 
+     106             :         // interaction rate
+     107           1 :         double rate = interpolate(E, tabEnergy, tabRate);
+     108           1 :         rate *= pow_integer<2>(1 + z) * photonField->getRedshiftScaling(z);
+     109             : 
+     110             :         // check for interaction
+     111           1 :         Random &random = Random::instance();
+     112           1 :         double randDistance = -log(random.rand()) / rate;
+     113           1 :         double step = candidate->getCurrentStep();
+     114           1 :         if (step < randDistance) {
+     115           1 :                 candidate->limitNextStep(limit / rate);
+     116           1 :                 return;
+     117             :         } else { // after performing interaction photon ceases to exist (hence return)
+     118           0 :                 performInteraction(candidate);
+     119           0 :                 return;
+     120             :         }
+     121             : 
+     122             : }
+     123             : 
+     124           1 : void EMDoublePairProduction::setInteractionTag(std::string tag) {
+     125           1 :         interactionTag = tag;
+     126           1 : }
+     127             : 
+     128           2 : std::string EMDoublePairProduction::getInteractionTag() const {
+     129           2 :         return interactionTag;
+     130             : }
+     131             : 
+     132             : 
+     133             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/EMInverseComptonScattering.cpp.func-sort-c.html b/doc/coverageReport/src/module/EMInverseComptonScattering.cpp.func-sort-c.html new file mode 100644 index 000000000..8878c9d70 --- /dev/null +++ b/doc/coverageReport/src/module/EMInverseComptonScattering.cpp.func-sort-c.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/EMInverseComptonScattering.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - EMInverseComptonScattering.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:12813396.2 %
Date:2024-04-08 14:58:22Functions:1313100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa26EMInverseComptonScattering17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa32ICSSecondariesEnergyDistribution6sampleEdd1
_ZN7crpropa32ICSSecondariesEnergyDistributionC2Ev1
_ZNK7crpropa26EMInverseComptonScattering18performInteractionEPNS_9CandidateE1
_ZNK7crpropa26EMInverseComptonScattering17getInteractionTagB5cxx11Ev2
_ZN7crpropa26EMInverseComptonScattering11setThinningEd5
_ZN7crpropa26EMInverseComptonScattering8setLimitEd5
_ZN7crpropa26EMInverseComptonScatteringC2ENS_7ref_ptrINS_11PhotonFieldEEEbdd5
_ZN7crpropa26EMInverseComptonScattering14setHavePhotonsEb6
_ZN7crpropa26EMInverseComptonScattering14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE17
_ZN7crpropa26EMInverseComptonScattering18initCumulativeRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE17
_ZN7crpropa26EMInverseComptonScattering8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE17
_ZNK7crpropa26EMInverseComptonScattering7processEPNS_9CandidateE15285
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/EMInverseComptonScattering.cpp.func.html b/doc/coverageReport/src/module/EMInverseComptonScattering.cpp.func.html new file mode 100644 index 000000000..aa4472145 --- /dev/null +++ b/doc/coverageReport/src/module/EMInverseComptonScattering.cpp.func.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/EMInverseComptonScattering.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - EMInverseComptonScattering.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:12813396.2 %
Date:2024-04-08 14:58:22Functions:1313100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa26EMInverseComptonScattering11setThinningEd5
_ZN7crpropa26EMInverseComptonScattering14setHavePhotonsEb6
_ZN7crpropa26EMInverseComptonScattering14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE17
_ZN7crpropa26EMInverseComptonScattering17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa26EMInverseComptonScattering18initCumulativeRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE17
_ZN7crpropa26EMInverseComptonScattering8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE17
_ZN7crpropa26EMInverseComptonScattering8setLimitEd5
_ZN7crpropa26EMInverseComptonScatteringC2ENS_7ref_ptrINS_11PhotonFieldEEEbdd5
_ZN7crpropa32ICSSecondariesEnergyDistribution6sampleEdd1
_ZN7crpropa32ICSSecondariesEnergyDistributionC2Ev1
_ZNK7crpropa26EMInverseComptonScattering17getInteractionTagB5cxx11Ev2
_ZNK7crpropa26EMInverseComptonScattering18performInteractionEPNS_9CandidateE1
_ZNK7crpropa26EMInverseComptonScattering7processEPNS_9CandidateE15285
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/EMInverseComptonScattering.cpp.gcov.html b/doc/coverageReport/src/module/EMInverseComptonScattering.cpp.gcov.html new file mode 100644 index 000000000..c5f4dfec4 --- /dev/null +++ b/doc/coverageReport/src/module/EMInverseComptonScattering.cpp.gcov.html @@ -0,0 +1,325 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/EMInverseComptonScattering.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - EMInverseComptonScattering.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:12813396.2 %
Date:2024-04-08 14:58:22Functions:1313100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/EMInverseComptonScattering.h"
+       2             : #include "crpropa/Units.h"
+       3             : #include "crpropa/Random.h"
+       4             : #include "crpropa/Common.h"
+       5             : 
+       6             : #include <fstream>
+       7             : #include <limits>
+       8             : #include <stdexcept>
+       9             : 
+      10             : namespace crpropa {
+      11             : 
+      12             : static const double mec2 = mass_electron * c_squared;
+      13             : 
+      14           5 : EMInverseComptonScattering::EMInverseComptonScattering(ref_ptr<PhotonField> photonField, bool havePhotons, double thinning, double limit) {
+      15           5 :         setPhotonField(photonField);
+      16           5 :         setHavePhotons(havePhotons);
+      17           5 :         setLimit(limit);
+      18           5 :         setThinning(thinning);
+      19           5 : }
+      20             : 
+      21          17 : void EMInverseComptonScattering::setPhotonField(ref_ptr<PhotonField> photonField) {
+      22          17 :         this->photonField = photonField;
+      23          17 :         std::string fname = photonField->getFieldName();
+      24          17 :         setDescription("EMInverseComptonScattering: " + fname);
+      25          51 :         initRate(getDataPath("EMInverseComptonScattering/rate_" + fname + ".txt"));
+      26          51 :         initCumulativeRate(getDataPath("EMInverseComptonScattering/cdf_" + fname + ".txt"));
+      27          17 : }
+      28             : 
+      29           6 : void EMInverseComptonScattering::setHavePhotons(bool havePhotons) {
+      30           6 :         this->havePhotons = havePhotons;
+      31           6 : }
+      32             : 
+      33           5 : void EMInverseComptonScattering::setLimit(double limit) {
+      34           5 :         this->limit = limit;
+      35           5 : }
+      36             : 
+      37           5 : void EMInverseComptonScattering::setThinning(double thinning) {
+      38           5 :         this->thinning = thinning;
+      39           5 : }
+      40             : 
+      41          17 : void EMInverseComptonScattering::initRate(std::string filename) {
+      42          17 :         std::ifstream infile(filename.c_str());
+      43             : 
+      44          17 :         if (!infile.good())
+      45           0 :                 throw std::runtime_error("EMInverseComptonScattering: could not open file " + filename);
+      46             : 
+      47             :         // clear previously loaded tables
+      48          17 :         tabEnergy.clear();
+      49          17 :         tabRate.clear();
+      50             : 
+      51        4879 :         while (infile.good()) {
+      52        4862 :                 if (infile.peek() != '#') {
+      53             :                         double a, b;
+      54             :                         infile >> a >> b;
+      55        4794 :                         if (infile) {
+      56        4777 :                                 tabEnergy.push_back(pow(10, a) * eV);
+      57        4777 :                                 tabRate.push_back(b / Mpc);
+      58             :                         }
+      59             :                 }
+      60        4862 :                 infile.ignore(std::numeric_limits < std::streamsize > ::max(), '\n');
+      61             :         }
+      62          17 :         infile.close();
+      63          17 : }
+      64             : 
+      65          17 : void EMInverseComptonScattering::initCumulativeRate(std::string filename) {
+      66          17 :         std::ifstream infile(filename.c_str());
+      67             : 
+      68          17 :         if (!infile.good())
+      69           0 :                 throw std::runtime_error("EMInverseComptonScattering: could not open file " + filename);
+      70             : 
+      71             :         // clear previously loaded tables
+      72          17 :         tabE.clear();
+      73          17 :         tabs.clear();
+      74          17 :         tabCDF.clear();
+      75             :         
+      76             :         // skip header
+      77          85 :         while (infile.peek() == '#')
+      78          68 :                 infile.ignore(std::numeric_limits < std::streamsize > ::max(), '\n');
+      79             : 
+      80             :         // read s values in first line
+      81             :         double a;
+      82             :         infile >> a; // skip first value
+      83        3000 :         while (infile.good() and (infile.peek() != '\n')) {
+      84             :                 infile >> a;
+      85        2983 :                 tabs.push_back(pow(10, a) * eV * eV);
+      86             :         }
+      87             : 
+      88             :         // read all following lines: E, cdf values
+      89        4794 :         while (infile.good()) {
+      90             :                 infile >> a;
+      91        4794 :                 if (!infile)
+      92             :                         break;  // end of file
+      93        4777 :                 tabE.push_back(pow(10, a) * eV);
+      94             :                 std::vector<double> cdf;
+      95      843000 :                 for (int i = 0; i < tabs.size(); i++) {
+      96             :                         infile >> a;
+      97      838223 :                         cdf.push_back(a / Mpc);
+      98             :                 }
+      99        4777 :                 tabCDF.push_back(cdf);
+     100             :         }
+     101          17 :         infile.close();
+     102          17 : }
+     103             : 
+     104             : // Class to calculate the energy distribution of the ICS photon and to sample from it
+     105             : class ICSSecondariesEnergyDistribution {
+     106             :         private:
+     107             :                 std::vector< std::vector<double> > data;
+     108             :                 std::vector<double> s_values;
+     109             :                 size_t Ns;
+     110             :                 size_t Nrer;
+     111             :                 double s_min;
+     112             :                 double s_max;
+     113             :                 double dls;
+     114             : 
+     115             :         public:
+     116             :                 // differential cross-section, see Lee '96 (arXiv:9604098), eq. 23 for x = Ee'/Ee
+     117             :                 double dSigmadE(double x, double beta) {
+     118     1000000 :                         double q = ((1 - beta) / beta) * (1 - 1./x);
+     119     1000000 :                         return ((1 + beta) / beta) * (x + 1./x + 2 * q + q * q);
+     120             :                 }
+     121             : 
+     122             :                 // create the cumulative energy distribution of the up-scattered photon
+     123           1 :                 ICSSecondariesEnergyDistribution() {
+     124           1 :                         Ns = 1000;
+     125           1 :                         Nrer = 1000;
+     126           1 :                         s_min = mec2 * mec2;
+     127           1 :                         s_max = 2e23 * eV * eV;
+     128           1 :                         dls = (log(s_max) - log(s_min)) / Ns;
+     129           1 :                         data = std::vector< std::vector<double> >(1000, std::vector<double>(1000));
+     130           1 :                         std::vector<double> data_i(1000);
+     131             : 
+     132             :                         // tabulate s bin borders
+     133           1 :                         s_values = std::vector<double>(1001);
+     134        1002 :                         for (size_t i = 0; i < Ns + 1; ++i)
+     135        1001 :                                 s_values[i] = s_min * exp(i*dls);
+     136             : 
+     137             : 
+     138             :                         // for each s tabulate cumulative differential cross section
+     139        1001 :                         for (size_t i = 0; i < Ns; i++) {
+     140        1000 :                                 double s = s_min * exp((i+0.5) * dls);
+     141        1000 :                                 double beta = (s - s_min) / (s + s_min);
+     142        1000 :                                 double x0 = (1 - beta) / (1 + beta);
+     143        1000 :                                 double dlx = -log(x0) / Nrer;
+     144             : 
+     145             :                                 // cumulative midpoint integration
+     146        1000 :                                 data_i[0] = dSigmadE(x0, beta) * expm1(dlx);
+     147     1000000 :                                 for (size_t j = 1; j < Nrer; j++) {
+     148      999000 :                                         double x = x0 * exp((j+0.5) * dlx);
+     149      999000 :                                         double dx = exp((j+1) * dlx) - exp(j * dlx);
+     150      999000 :                                         data_i[j] = dSigmadE(x, beta) * dx;
+     151      999000 :                                         data_i[j] += data_i[j-1];
+     152             :                                 }
+     153        1000 :                                 data[i] = data_i;
+     154             :                         }
+     155           1 :                 }
+     156             : 
+     157             :                 // draw random energy for the up-scattered photon Ep(Ee, s)
+     158           1 :                 double sample(double Ee, double s) {
+     159           1 :                         size_t idx = std::lower_bound(s_values.begin(), s_values.end(), s) - s_values.begin();
+     160           1 :                         std::vector<double> s0 = data[idx];
+     161           1 :                         Random &random = Random::instance();
+     162           1 :                         size_t j = random.randBin(s0) + 1; // draw random bin (upper bin boundary returned)
+     163           1 :                         double beta = (s - s_min) / (s + s_min);
+     164           1 :                         double x0 = (1 - beta) / (1 + beta);
+     165           1 :                         double dlx = -log(x0) / Nrer;
+     166           1 :                         double binWidth = x0 * (exp(j * dlx) - exp((j-1) * dlx));
+     167           1 :                         double Ep = (x0 * exp((j-1) * dlx) + binWidth) * Ee;
+     168           2 :                         return std::min(Ee, Ep); // prevent Ep > Ee from numerical inaccuracies
+     169             :                 }
+     170             : };
+     171             : 
+     172           1 : void EMInverseComptonScattering::performInteraction(Candidate *candidate) const {
+     173             :         // scale the particle energy instead of background photons
+     174           1 :         double z = candidate->getRedshift();
+     175           1 :         double E = candidate->current.getEnergy() * (1 + z);
+     176             : 
+     177           1 :         if (E < tabE.front() or E > tabE.back())
+     178             :                 return;
+     179             : 
+     180             :         // sample the value of s
+     181           1 :         Random &random = Random::instance();
+     182           1 :         size_t i = closestIndex(E, tabE);
+     183           1 :         size_t j = random.randBin(tabCDF[i]);
+     184           1 :         double s_kin = pow(10, log10(tabs[j]) + (random.rand() - 0.5) * 0.1);
+     185           1 :         double s = s_kin + mec2 * mec2;
+     186             : 
+     187             :         // sample electron energy after scattering
+     188           1 :         static ICSSecondariesEnergyDistribution distribution;
+     189           1 :         double Enew = distribution.sample(E, s);
+     190             : 
+     191             :         // add up-scattered photon
+     192           1 :         double Esecondary = E - Enew;
+     193           1 :         double f = Enew / E;
+     194           1 :         if (havePhotons) {
+     195           1 :                 if (random.rand() < pow(1 - f, thinning)) {
+     196           1 :                         double w = 1. / pow(1 - f, thinning);
+     197           1 :                         Vector3d pos = random.randomInterpolatedPosition(candidate->previous.getPosition(), candidate->current.getPosition());
+     198           1 :                         candidate->addSecondary(22, Esecondary / (1 + z), pos, w, interactionTag);
+     199             :                 }
+     200             :         }
+     201             : 
+     202             :         // update the primary particle energy; do this after adding the secondary to correctly set the secondary's parent
+     203           1 :         candidate->current.setEnergy(Enew / (1 + z));
+     204             : }
+     205             : 
+     206       15285 : void EMInverseComptonScattering::process(Candidate *candidate) const {
+     207             :         // check if electron / positron
+     208       15285 :         int id = candidate->current.getId();
+     209       15285 :         if (abs(id) != 11)
+     210             :                 return;
+     211             : 
+     212             :         // scale the particle energy instead of background photons
+     213           1 :         double z = candidate->getRedshift();
+     214           1 :         double E = candidate->current.getEnergy() * (1 + z);
+     215             : 
+     216           1 :         if (E < tabEnergy.front() or (E > tabEnergy.back()))
+     217             :                 return;
+     218             : 
+     219             :         // interaction rate
+     220           1 :         double rate = interpolate(E, tabEnergy, tabRate);
+     221           1 :         rate *= pow_integer<2>(1 + z) * photonField->getRedshiftScaling(z);
+     222             : 
+     223             :         // run this loop at least once to limit the step size
+     224           1 :         double step = candidate->getCurrentStep();
+     225           1 :         Random &random = Random::instance();
+     226             :         do {
+     227           1 :                 double randDistance = -log(random.rand()) / rate;
+     228             : 
+     229             :                 // check for interaction; if it doesn't ocurr, limit next step
+     230           1 :                 if (step < randDistance) {
+     231           1 :                         candidate->limitNextStep(limit / rate);
+     232           1 :                         return;
+     233             :                 }
+     234           0 :                 performInteraction(candidate);
+     235             : 
+     236             :                 // repeat with remaining step
+     237           0 :                 step -= randDistance;
+     238           0 :         } while (step > 0);
+     239             : }
+     240             : 
+     241           1 : void EMInverseComptonScattering::setInteractionTag(std::string tag) {
+     242           1 :         interactionTag = tag;
+     243           1 : }
+     244             : 
+     245           2 : std::string EMInverseComptonScattering::getInteractionTag() const {
+     246           2 :         return interactionTag;
+     247             : }
+     248             : 
+     249             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/EMPairProduction.cpp.func-sort-c.html b/doc/coverageReport/src/module/EMPairProduction.cpp.func-sort-c.html new file mode 100644 index 000000000..084270148 --- /dev/null +++ b/doc/coverageReport/src/module/EMPairProduction.cpp.func-sort-c.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/EMPairProduction.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - EMPairProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13413797.8 %
Date:2024-04-08 14:58:22Functions:1313100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16EMPairProduction17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa31PPSecondariesEnergyDistributionC2Ev1
_ZNK7crpropa16EMPairProduction17getInteractionTagB5cxx11Ev2
_ZN7crpropa16EMPairProduction8setLimitEd9
_ZN7crpropa16EMPairProductionC2ENS_7ref_ptrINS_11PhotonFieldEEEbdd9
_ZN7crpropa16EMPairProduction11setThinningEd13
_ZN7crpropa16EMPairProduction16setHaveElectronsEb14
_ZN7crpropa16EMPairProduction14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE33
_ZN7crpropa16EMPairProduction18initCumulativeRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE33
_ZN7crpropa16EMPairProduction8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE33
_ZN7crpropa31PPSecondariesEnergyDistribution6sampleEdd563
_ZNK7crpropa16EMPairProduction18performInteractionEPNS_9CandidateE563
_ZNK7crpropa16EMPairProduction7processEPNS_9CandidateE16965
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/EMPairProduction.cpp.func.html b/doc/coverageReport/src/module/EMPairProduction.cpp.func.html new file mode 100644 index 000000000..082cd9399 --- /dev/null +++ b/doc/coverageReport/src/module/EMPairProduction.cpp.func.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/EMPairProduction.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - EMPairProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13413797.8 %
Date:2024-04-08 14:58:22Functions:1313100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16EMPairProduction11setThinningEd13
_ZN7crpropa16EMPairProduction14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE33
_ZN7crpropa16EMPairProduction16setHaveElectronsEb14
_ZN7crpropa16EMPairProduction17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa16EMPairProduction18initCumulativeRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE33
_ZN7crpropa16EMPairProduction8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE33
_ZN7crpropa16EMPairProduction8setLimitEd9
_ZN7crpropa16EMPairProductionC2ENS_7ref_ptrINS_11PhotonFieldEEEbdd9
_ZN7crpropa31PPSecondariesEnergyDistribution6sampleEdd563
_ZN7crpropa31PPSecondariesEnergyDistributionC2Ev1
_ZNK7crpropa16EMPairProduction17getInteractionTagB5cxx11Ev2
_ZNK7crpropa16EMPairProduction18performInteractionEPNS_9CandidateE563
_ZNK7crpropa16EMPairProduction7processEPNS_9CandidateE16965
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/EMPairProduction.cpp.gcov.html b/doc/coverageReport/src/module/EMPairProduction.cpp.gcov.html new file mode 100644 index 000000000..b3986bf74 --- /dev/null +++ b/doc/coverageReport/src/module/EMPairProduction.cpp.gcov.html @@ -0,0 +1,340 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/EMPairProduction.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - EMPairProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13413797.8 %
Date:2024-04-08 14:58:22Functions:1313100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/EMPairProduction.h"
+       2             : #include "crpropa/Units.h"
+       3             : #include "crpropa/Random.h"
+       4             : 
+       5             : #include <fstream>
+       6             : #include <limits>
+       7             : #include <stdexcept>
+       8             : 
+       9             : 
+      10             : namespace crpropa {
+      11             : 
+      12             : static const double mec2 = mass_electron * c_squared;
+      13             : 
+      14           9 : EMPairProduction::EMPairProduction(ref_ptr<PhotonField> photonField, bool haveElectrons, double thinning, double limit) {
+      15           9 :         setPhotonField(photonField);
+      16           9 :         setThinning(thinning);
+      17           9 :         setLimit(limit);
+      18           9 :         setHaveElectrons(haveElectrons);
+      19           9 : }
+      20             : 
+      21          33 : void EMPairProduction::setPhotonField(ref_ptr<PhotonField> photonField) {
+      22          33 :         this->photonField = photonField;
+      23          33 :         std::string fname = photonField->getFieldName();
+      24          33 :         setDescription("EMPairProduction: " + fname);
+      25          99 :         initRate(getDataPath("EMPairProduction/rate_" + fname + ".txt"));
+      26          99 :         initCumulativeRate(getDataPath("EMPairProduction/cdf_" + fname + ".txt"));
+      27          33 : }
+      28             : 
+      29          14 : void EMPairProduction::setHaveElectrons(bool haveElectrons) {
+      30          14 :         this->haveElectrons = haveElectrons;
+      31          14 : }
+      32             : 
+      33           9 : void EMPairProduction::setLimit(double limit) {
+      34           9 :         this->limit = limit;
+      35           9 : }
+      36             : 
+      37          13 : void EMPairProduction::setThinning(double thinning) {
+      38          13 :         this->thinning = thinning;
+      39          13 : }
+      40             : 
+      41          33 : void EMPairProduction::initRate(std::string filename) {
+      42          33 :         std::ifstream infile(filename.c_str());
+      43             : 
+      44          33 :         if (!infile.good())
+      45           0 :                 throw std::runtime_error("EMPairProduction: could not open file " + filename);
+      46             : 
+      47             :         // clear previously loaded interaction rates
+      48          33 :         tabEnergy.clear();
+      49          33 :         tabRate.clear();
+      50             : 
+      51        7510 :         while (infile.good()) {
+      52        7477 :                 if (infile.peek() != '#') {
+      53             :                         double a, b;
+      54             :                         infile >> a >> b;
+      55        7345 :                         if (infile) {
+      56        7312 :                                 tabEnergy.push_back(pow(10, a) * eV);
+      57        7312 :                                 tabRate.push_back(b / Mpc);
+      58             :                         }
+      59             :                 }
+      60        7477 :                 infile.ignore(std::numeric_limits < std::streamsize > ::max(), '\n');
+      61             :         }
+      62          33 :         infile.close();
+      63          33 : }
+      64             : 
+      65          33 : void EMPairProduction::initCumulativeRate(std::string filename) {
+      66          33 :         std::ifstream infile(filename.c_str());
+      67             : 
+      68          33 :         if (!infile.good())
+      69           0 :                 throw std::runtime_error("EMPairProduction: could not open file " + filename);
+      70             : 
+      71             :         // clear previously loaded tables
+      72          33 :         tabE.clear();
+      73          33 :         tabs.clear();
+      74          33 :         tabCDF.clear();
+      75             :         
+      76             :         // skip header
+      77         165 :         while (infile.peek() == '#')
+      78         132 :                 infile.ignore(std::numeric_limits < std::streamsize > ::max(), '\n');
+      79             : 
+      80             :         // read s values in first line
+      81             :         double a;
+      82             :         infile >> a; // skip first value
+      83        3663 :         while (infile.good() and (infile.peek() != '\n')) {
+      84             :                 infile >> a;
+      85        3630 :                 tabs.push_back(pow(10, a) * eV * eV);
+      86             :         }
+      87             : 
+      88             :         // read all following lines: E, cdf values
+      89        7345 :         while (infile.good()) {
+      90             :                 infile >> a;
+      91        7345 :                 if (!infile)
+      92             :                         break;  // end of file
+      93        7312 :                 tabE.push_back(pow(10, a) * eV);
+      94             :                 std::vector<double> cdf;
+      95      811632 :                 for (int i = 0; i < tabs.size(); i++) {
+      96             :                         infile >> a;
+      97      804320 :                         cdf.push_back(a / Mpc);
+      98             :                 }
+      99        7312 :                 tabCDF.push_back(cdf);
+     100             :         }
+     101          33 :         infile.close();
+     102          33 : }
+     103             : 
+     104             : // Hold an data array to interpolate the energy distribution on
+     105             : class PPSecondariesEnergyDistribution {
+     106             :         private:
+     107             :                 std::vector<double> tab_s;
+     108             :                 std::vector< std::vector<double> > data;
+     109             :                 size_t N;
+     110             : 
+     111             :         public:
+     112             :                 // differential cross section for pair production for x = Epositron/Egamma, compare Lee 96 arXiv:9604098
+     113             :                 double dSigmadE_PPx(double x, double beta) {
+     114     1000000 :                         double A = (x / (1. - x) + (1. - x) / x );
+     115     1000000 :                         double B =  (1. / x + 1. / (1. - x) );
+     116        1000 :                         double y = (1 - beta * beta);
+     117     1000000 :                         return A + y * B - y * y / 4 * B * B;
+     118             :                 }
+     119             : 
+     120           1 :                 PPSecondariesEnergyDistribution() {
+     121           1 :                         N = 1000;
+     122             :                         size_t Ns = 1000;
+     123             :                         double s_min = 4 * mec2 * mec2;
+     124             :                         double s_max = 1e23 * eV * eV;
+     125             :                         double dls = log(s_max / s_min) / Ns;
+     126           1 :                         data = std::vector< std::vector<double> >(Ns, std::vector<double>(N));
+     127           1 :                         tab_s = std::vector<double>(Ns + 1);
+     128             : 
+     129        1002 :                         for (size_t i = 0; i < Ns + 1; ++i)
+     130        1001 :                                 tab_s[i] = s_min * exp(i*dls); // tabulate s bin borders
+     131             : 
+     132        1001 :                         for (size_t i = 0; i < Ns; i++) {
+     133        1000 :                                 double s = s_min * exp(i*dls + 0.5*dls);
+     134        1000 :                                 double beta = sqrt(1 - s_min/s);
+     135        1000 :                                 double x0 = (1 - beta) / 2;
+     136        1000 :                                 double dx = log((1 + beta) / (1 - beta)) / N;
+     137             : 
+     138             :                                 // cumulative midpoint integration
+     139        1000 :                                 std::vector<double> data_i(1000);
+     140        1000 :                                 data_i[0] = dSigmadE_PPx(x0, beta) * expm1(dx);
+     141     1000000 :                                 for (size_t j = 1; j < N; j++) {
+     142      999000 :                                         double x = x0 * exp(j*dx + 0.5*dx);
+     143      999000 :                                         double binWidth = exp((j+1)*dx)-exp(j*dx);
+     144      999000 :                                         data_i[j] = dSigmadE_PPx(x, beta) * binWidth + data_i[j-1];
+     145             :                                 }
+     146        1000 :                                 data[i] = data_i;
+     147             :                         }
+     148           1 :                 }
+     149             : 
+     150             :                 // sample positron energy from cdf(E, s_kin)
+     151         563 :                 double sample(double E0, double s) {
+     152             :                         // get distribution for given s
+     153         563 :                         size_t idx = std::lower_bound(tab_s.begin(), tab_s.end(), s) - tab_s.begin();
+     154         563 :                         if (idx > data.size())
+     155             :                                 return NAN;
+     156             :                                 
+     157         563 :                         std::vector<double> s0 = data[idx];
+     158             : 
+     159             :                         // draw random bin
+     160         563 :                         Random &random = Random::instance();
+     161         563 :                         size_t j = random.randBin(s0) + 1;
+     162             : 
+     163             :                         double s_min = 4. * mec2 * mec2;
+     164         563 :                         double beta = sqrtl(1. - s_min / s);
+     165         563 :                         double x0 = (1. - beta) / 2.;
+     166         563 :                         double dx = log((1 + beta) / (1 - beta)) / N;
+     167         563 :                         double binWidth = x0 * (exp(j*dx) - exp((j-1)*dx));
+     168         563 :                         if (random.rand() < 0.5)
+     169         290 :                                 return E0 * (x0 * exp((j-1) * dx) + binWidth);
+     170             :                         else
+     171         273 :                                 return E0 * (1 - (x0 * exp((j-1) * dx) + binWidth));
+     172             :                 }
+     173             : };
+     174             : 
+     175         563 : void EMPairProduction::performInteraction(Candidate *candidate) const {
+     176             :         // scale particle energy instead of background photon energy
+     177         563 :         double z = candidate->getRedshift();
+     178         563 :         double E = candidate->current.getEnergy() * (1 + z);
+     179             : 
+     180             :         // check if secondary electron pair needs to be produced
+     181         563 :         if (not haveElectrons)
+     182           0 :                 return;
+     183             : 
+     184             :         // check if in tabulated energy range
+     185         563 :         if (E < tabE.front() or (E > tabE.back()))
+     186             :                 return;
+     187             : 
+     188             :         // sample the value of s
+     189         563 :         Random &random = Random::instance();
+     190         563 :         size_t i = closestIndex(E, tabE);  // find closest tabulation point
+     191         563 :         size_t j = random.randBin(tabCDF[i]);
+     192        1092 :         double lo = std::max(4 * mec2 * mec2, tabs[j-1]);  // first s-tabulation point below min(s_kin) = (2 me c^2)^2; ensure physical value
+     193         563 :         double hi = tabs[j];
+     194         563 :         double s = lo + random.rand() * (hi - lo);
+     195             : 
+     196             :         // sample electron / positron energy
+     197         563 :         static PPSecondariesEnergyDistribution interpolation;
+     198         563 :         double Ee = interpolation.sample(E, s);
+     199         563 :         double Ep = E - Ee;
+     200         563 :         double f = Ep / E;
+     201             : 
+     202             :         // for some backgrounds Ee=nan due to precision limitations.
+     203         563 :         if (not std::isfinite(Ee) || not std::isfinite(Ep))
+     204             :                 return;
+     205             : 
+     206             :         // photon is lost after interacting
+     207         563 :         candidate->setActive(false);
+     208             : 
+     209             :         // sample random position along current step
+     210         563 :         Vector3d pos = random.randomInterpolatedPosition(candidate->previous.getPosition(), candidate->current.getPosition());
+     211             :         // apply sampling
+     212         563 :         if (random.rand() < pow(f, thinning)) {
+     213         563 :                 double w = 1. / pow(f, thinning);
+     214         563 :                 candidate->addSecondary(11, Ep / (1 + z), pos, w, interactionTag);
+     215             :         }
+     216         563 :         if (random.rand() < pow(1 - f, thinning)){
+     217         563 :                 double w = 1. / pow(1 - f, thinning);
+     218         563 :                 candidate->addSecondary(-11, Ee / (1 + z), pos, w, interactionTag);  
+     219             :         }
+     220             : }
+     221             : 
+     222       16965 : void EMPairProduction::process(Candidate *candidate) const {
+     223             :         // check if photon
+     224       16965 :         if (candidate->current.getId() != 22)
+     225             :                 return;
+     226             : 
+     227             :         // scale particle energy instead of background photon energy
+     228         841 :         double z = candidate->getRedshift();
+     229         841 :         double E = candidate->current.getEnergy() * (1 + z);
+     230             : 
+     231             :         // check if in tabulated energy range
+     232         841 :         if ((E < tabEnergy.front()) or (E > tabEnergy.back()))
+     233             :                 return;
+     234             : 
+     235             :         // interaction rate
+     236         651 :         double rate = interpolate(E, tabEnergy, tabRate);
+     237         651 :         rate *= pow_integer<2>(1 + z) * photonField->getRedshiftScaling(z);
+     238             : 
+     239             :         // run this loop at least once to limit the step size 
+     240         651 :         double step = candidate->getCurrentStep();
+     241         651 :         Random &random = Random::instance();
+     242             :         do {
+     243         651 :                 double randDistance = -log(random.rand()) / rate;
+     244             :                 // check for interaction; if it doesn't ocurr, limit next step
+     245         651 :                 if (step < randDistance) { 
+     246          89 :                         candidate->limitNextStep(limit / rate);
+     247             :                 } else {
+     248         562 :                         performInteraction(candidate);
+     249         562 :                         return;
+     250             :                 }
+     251          89 :                 step -= randDistance; 
+     252          89 :         } while (step > 0.);
+     253             : 
+     254             : }
+     255             : 
+     256           1 : void EMPairProduction::setInteractionTag(std::string tag) {
+     257           1 :         interactionTag = tag;
+     258           1 : }
+     259             : 
+     260           2 : std::string EMPairProduction::getInteractionTag() const {
+     261           2 :         return interactionTag;
+     262             : }
+     263             : 
+     264             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/EMTripletPairProduction.cpp.func-sort-c.html b/doc/coverageReport/src/module/EMTripletPairProduction.cpp.func-sort-c.html new file mode 100644 index 000000000..bfb861b6b --- /dev/null +++ b/doc/coverageReport/src/module/EMTripletPairProduction.cpp.func-sort-c.html @@ -0,0 +1,116 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/EMTripletPairProduction.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - EMTripletPairProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:9410094.0 %
Date:2024-04-08 14:58:22Functions:1111100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa23EMTripletPairProduction17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZNK7crpropa23EMTripletPairProduction18performInteractionEPNS_9CandidateE1
_ZNK7crpropa23EMTripletPairProduction7processEPNS_9CandidateE1
_ZNK7crpropa23EMTripletPairProduction17getInteractionTagB5cxx11Ev2
_ZN7crpropa23EMTripletPairProduction11setThinningEd3
_ZN7crpropa23EMTripletPairProduction8setLimitEd3
_ZN7crpropa23EMTripletPairProductionC2ENS_7ref_ptrINS_11PhotonFieldEEEbdd3
_ZN7crpropa23EMTripletPairProduction16setHaveElectronsEb4
_ZN7crpropa23EMTripletPairProduction14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE15
_ZN7crpropa23EMTripletPairProduction18initCumulativeRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE15
_ZN7crpropa23EMTripletPairProduction8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE15
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/EMTripletPairProduction.cpp.func.html b/doc/coverageReport/src/module/EMTripletPairProduction.cpp.func.html new file mode 100644 index 000000000..bfa5c293f --- /dev/null +++ b/doc/coverageReport/src/module/EMTripletPairProduction.cpp.func.html @@ -0,0 +1,116 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/EMTripletPairProduction.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - EMTripletPairProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:9410094.0 %
Date:2024-04-08 14:58:22Functions:1111100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa23EMTripletPairProduction11setThinningEd3
_ZN7crpropa23EMTripletPairProduction14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE15
_ZN7crpropa23EMTripletPairProduction16setHaveElectronsEb4
_ZN7crpropa23EMTripletPairProduction17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa23EMTripletPairProduction18initCumulativeRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE15
_ZN7crpropa23EMTripletPairProduction8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE15
_ZN7crpropa23EMTripletPairProduction8setLimitEd3
_ZN7crpropa23EMTripletPairProductionC2ENS_7ref_ptrINS_11PhotonFieldEEEbdd3
_ZNK7crpropa23EMTripletPairProduction17getInteractionTagB5cxx11Ev2
_ZNK7crpropa23EMTripletPairProduction18performInteractionEPNS_9CandidateE1
_ZNK7crpropa23EMTripletPairProduction7processEPNS_9CandidateE1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/EMTripletPairProduction.cpp.gcov.html b/doc/coverageReport/src/module/EMTripletPairProduction.cpp.gcov.html new file mode 100644 index 000000000..a959e6b81 --- /dev/null +++ b/doc/coverageReport/src/module/EMTripletPairProduction.cpp.gcov.html @@ -0,0 +1,263 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/EMTripletPairProduction.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - EMTripletPairProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:9410094.0 %
Date:2024-04-08 14:58:22Functions:1111100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/EMTripletPairProduction.h"
+       2             : #include "crpropa/Units.h"
+       3             : #include "crpropa/Random.h"
+       4             : 
+       5             : #include <fstream>
+       6             : #include <limits>
+       7             : #include <stdexcept>
+       8             : 
+       9             : namespace crpropa {
+      10             : 
+      11             : static const double mec2 = mass_electron * c_squared;
+      12             : 
+      13           3 : EMTripletPairProduction::EMTripletPairProduction(ref_ptr<PhotonField> photonField, bool haveElectrons, double thinning, double limit) {
+      14           3 :         setPhotonField(photonField);
+      15           3 :         setHaveElectrons(haveElectrons);
+      16           3 :         setLimit(limit);
+      17           3 :         setThinning(thinning);
+      18           3 : }
+      19             : 
+      20          15 : void EMTripletPairProduction::setPhotonField(ref_ptr<PhotonField> photonField) {
+      21          15 :         this->photonField = photonField;
+      22          15 :         std::string fname = photonField->getFieldName();
+      23          15 :         setDescription("EMTripletPairProduction: " + fname);
+      24          45 :         initRate(getDataPath("EMTripletPairProduction/rate_" + fname + ".txt"));
+      25          45 :         initCumulativeRate(getDataPath("EMTripletPairProduction/cdf_" + fname + ".txt"));
+      26          15 : }
+      27             : 
+      28           4 : void EMTripletPairProduction::setHaveElectrons(bool haveElectrons) {
+      29           4 :         this->haveElectrons = haveElectrons;
+      30           4 : }
+      31             : 
+      32           3 : void EMTripletPairProduction::setLimit(double limit) {
+      33           3 :         this->limit = limit;
+      34           3 : }
+      35             : 
+      36           3 : void EMTripletPairProduction::setThinning(double thinning) {
+      37           3 :         this->thinning = thinning;
+      38           3 : }
+      39             : 
+      40          15 : void EMTripletPairProduction::initRate(std::string filename) {
+      41          15 :         std::ifstream infile(filename.c_str());
+      42             : 
+      43          15 :         if (!infile.good())
+      44           0 :                 throw std::runtime_error("EMTripletPairProduction: could not open file " + filename);
+      45             : 
+      46             :         // clear previously loaded interaction rates
+      47          15 :         tabEnergy.clear();
+      48          15 :         tabRate.clear();
+      49             : 
+      50        3340 :         while (infile.good()) {
+      51        3325 :                 if (infile.peek() != '#') {
+      52             :                         double a, b;
+      53             :                         infile >> a >> b;
+      54        3265 :                         if (infile) {
+      55        3250 :                                 tabEnergy.push_back(pow(10, a) * eV);
+      56        3250 :                                 tabRate.push_back(b / Mpc);
+      57             :                         }
+      58             :                 }
+      59        3325 :                 infile.ignore(std::numeric_limits < std::streamsize > ::max(), '\n');
+      60             :         }
+      61          15 :         infile.close();
+      62          15 : }
+      63             : 
+      64          15 : void EMTripletPairProduction::initCumulativeRate(std::string filename) {
+      65          15 :         std::ifstream infile(filename.c_str());
+      66             : 
+      67          15 :         if (!infile.good())
+      68           0 :                 throw std::runtime_error(
+      69           0 :                                 "EMTripletPairProduction: could not open file " + filename);
+      70             : 
+      71             :         // clear previously loaded tables
+      72          15 :         tabE.clear();
+      73          15 :         tabs.clear();
+      74          15 :         tabCDF.clear();
+      75             :         
+      76             :         // skip header
+      77          75 :         while (infile.peek() == '#')
+      78          60 :                 infile.ignore(std::numeric_limits < std::streamsize > ::max(), '\n');
+      79             : 
+      80             :         // read s values in first line
+      81             :         double a;
+      82             :         infile >> a; // skip first value
+      83        1590 :         while (infile.good() and (infile.peek() != '\n')) {
+      84             :                 infile >> a;
+      85        1575 :                 tabs.push_back(pow(10, a) * eV * eV);
+      86             :         }
+      87             : 
+      88             :         // read all following lines: E, cdf values
+      89        3265 :         while (infile.good()) {
+      90             :                 infile >> a;
+      91        3265 :                 if (!infile)
+      92             :                         break;  // end of file
+      93        3250 :                 tabE.push_back(pow(10, a) * eV);
+      94             :                 std::vector<double> cdf;
+      95      344500 :                 for (int i = 0; i < tabs.size(); i++) {
+      96             :                         infile >> a;
+      97      341250 :                         cdf.push_back(a / Mpc);
+      98             :                 }
+      99        3250 :                 tabCDF.push_back(cdf);
+     100             :         }
+     101          15 :         infile.close();
+     102          15 : }
+     103             : 
+     104           1 : void EMTripletPairProduction::performInteraction(Candidate *candidate) const {
+     105           1 :         int id = candidate->current.getId();
+     106           1 :         if  (abs(id) != 11)
+     107             :                 return;
+     108             : 
+     109             :         // scale the particle energy instead of background photons
+     110           1 :         double z = candidate->getRedshift();
+     111           1 :         double E = candidate->current.getEnergy() * (1 + z);
+     112             : 
+     113           1 :         if (E < tabE.front() or E > tabE.back())
+     114             :                 return;
+     115             : 
+     116             :         // sample the value of eps
+     117           1 :         Random &random = Random::instance();
+     118           1 :         size_t i = closestIndex(E, tabE);
+     119           1 :         size_t j = random.randBin(tabCDF[i]);
+     120           1 :         double s_kin = pow(10, log10(tabs[j]) + (random.rand() - 0.5) * 0.1);
+     121           1 :         double eps = s_kin / 4. / E; // random background photon energy
+     122             : 
+     123             :         // Use approximation from A. Mastichiadis et al., Astroph. Journ. 300:178-189 (1986), eq. 30.
+     124             :         // This approx is valid only for alpha >=100 where alpha = p0*eps*costheta - E0*eps
+     125             :         // For our purposes, me << E0 --> p0~E0 --> alpha = E0*eps*(costheta - 1) >= 100
+     126           1 :         double Epp = 5.7e-1 * pow(eps / mec2, -0.56) * pow(E / mec2, 0.44) * mec2;
+     127             : 
+     128           1 :         double f = Epp / E;
+     129             : 
+     130           1 :         if (haveElectrons) {
+     131           1 :                 Vector3d pos = random.randomInterpolatedPosition(candidate->previous.getPosition(), candidate->current.getPosition());
+     132           1 :                 if (random.rand() < pow(1 - f, thinning)) {
+     133           1 :                         double w = 1. / pow(1 - f, thinning);
+     134           1 :                         candidate->addSecondary(11, Epp / (1 + z), pos, w, interactionTag);
+     135             :                 }
+     136           1 :                 if (random.rand() < pow(f, thinning)) {
+     137           1 :                         double w = 1. / pow(f, thinning);
+     138           1 :                         candidate->addSecondary(-11, Epp / (1 + z), pos, w, interactionTag);
+     139             :                 }
+     140             :         }
+     141             :         // Update the primary particle energy.
+     142             :         // This is done after adding the secondaries to correctly set the secondaries parent
+     143           1 :         candidate->current.setEnergy((E - 2 * Epp) / (1. + z));
+     144             : }
+     145             : 
+     146           1 : void EMTripletPairProduction::process(Candidate *candidate) const {
+     147             :         // check if electron / positron
+     148           1 :         int id = candidate->current.getId();
+     149           1 :         if (abs(id) != 11)
+     150             :                 return;
+     151             : 
+     152             :         // scale the particle energy instead of background photons
+     153           1 :         double z = candidate->getRedshift();
+     154           1 :         double E = (1 + z) * candidate->current.getEnergy();
+     155             : 
+     156             :         // check if in tabulated energy range
+     157           1 :         if ((E < tabEnergy.front()) or (E > tabEnergy.back()))
+     158             :                 return;
+     159             : 
+     160             :         // cosmological scaling of interaction distance (comoving)
+     161           1 :         double scaling = pow_integer<2>(1 + z) * photonField->getRedshiftScaling(z);
+     162           1 :         double rate = scaling * interpolate(E, tabEnergy, tabRate);
+     163             : 
+     164             :         // run this loop at least once to limit the step size
+     165           1 :         double step = candidate->getCurrentStep();
+     166           1 :         Random &random = Random::instance();
+     167             :         do {
+     168           1 :                 double randDistance = -log(random.rand()) / rate;
+     169             :                 // check for interaction; if it doesn't occur, limit next step
+     170           1 :                 if (step < randDistance) { 
+     171           1 :                         candidate->limitNextStep(limit / rate);
+     172           1 :                         return;
+     173             :                 }
+     174           0 :                 performInteraction(candidate);
+     175           0 :                 step -= randDistance; 
+     176           0 :         } while (step > 0.);
+     177             : }
+     178             : 
+     179           1 : void EMTripletPairProduction::setInteractionTag(std::string tag) {
+     180           1 :         interactionTag = tag;
+     181           1 : }
+     182             : 
+     183           2 : std::string EMTripletPairProduction::getInteractionTag() const {
+     184           2 :         return interactionTag;
+     185             : }
+     186             : 
+     187             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/ElasticScattering.cpp.func-sort-c.html b/doc/coverageReport/src/module/ElasticScattering.cpp.func-sort-c.html new file mode 100644 index 000000000..222b6680f --- /dev/null +++ b/doc/coverageReport/src/module/ElasticScattering.cpp.func-sort-c.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/ElasticScattering.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - ElasticScattering.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:637090.0 %
Date:2024-04-08 14:58:22Functions:5771.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa17ElasticScattering17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZNK7crpropa17ElasticScattering17getInteractionTagB5cxx11Ev0
_ZNK7crpropa17ElasticScattering7processEPNS_9CandidateE1
_ZN7crpropa17ElasticScatteringC2ENS_7ref_ptrINS_11PhotonFieldEEE2
_ZN7crpropa17ElasticScattering14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE4
_ZN7crpropa17ElasticScattering7initCDFENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE4
_ZN7crpropa17ElasticScattering8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE4
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/ElasticScattering.cpp.func.html b/doc/coverageReport/src/module/ElasticScattering.cpp.func.html new file mode 100644 index 000000000..8ecf24e21 --- /dev/null +++ b/doc/coverageReport/src/module/ElasticScattering.cpp.func.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/ElasticScattering.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - ElasticScattering.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:637090.0 %
Date:2024-04-08 14:58:22Functions:5771.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa17ElasticScattering14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE4
_ZN7crpropa17ElasticScattering17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa17ElasticScattering7initCDFENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE4
_ZN7crpropa17ElasticScattering8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE4
_ZN7crpropa17ElasticScatteringC2ENS_7ref_ptrINS_11PhotonFieldEEE2
_ZNK7crpropa17ElasticScattering17getInteractionTagB5cxx11Ev0
_ZNK7crpropa17ElasticScattering7processEPNS_9CandidateE1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/ElasticScattering.cpp.gcov.html b/doc/coverageReport/src/module/ElasticScattering.cpp.gcov.html new file mode 100644 index 000000000..f5b2d7a8c --- /dev/null +++ b/doc/coverageReport/src/module/ElasticScattering.cpp.gcov.html @@ -0,0 +1,212 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/ElasticScattering.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - ElasticScattering.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:637090.0 %
Date:2024-04-08 14:58:22Functions:5771.4 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/ElasticScattering.h"
+       2             : #include "crpropa/Units.h"
+       3             : #include "crpropa/ParticleID.h"
+       4             : #include "crpropa/ParticleMass.h"
+       5             : #include "crpropa/Random.h"
+       6             : 
+       7             : #include <cmath>
+       8             : #include <limits>
+       9             : #include <sstream>
+      10             : #include <fstream>
+      11             : #include <stdexcept>
+      12             : 
+      13             : namespace crpropa {
+      14             : 
+      15             : const double ElasticScattering::lgmin = 6.;  // minimum log10(Lorentz-factor)
+      16             : const double ElasticScattering::lgmax = 14.; // maximum log10(Lorentz-factor)
+      17             : const size_t ElasticScattering::nlg = 201;   // number of Lorentz-factor steps
+      18             : const double ElasticScattering::epsmin = log10(2 * eV) + 3;    // log10 minimum photon background energy in nucleus rest frame for elastic scattering
+      19             : const double ElasticScattering::epsmax = log10(2 * eV) + 8.12; // log10 maximum photon background energy in nucleus rest frame for elastic scattering
+      20             : const size_t ElasticScattering::neps = 513; // number of photon background energies in nucleus rest frame
+      21             : 
+      22           2 : ElasticScattering::ElasticScattering(ref_ptr<PhotonField> f) {
+      23           2 :         setPhotonField(f);
+      24           2 : }
+      25             : 
+      26           4 : void ElasticScattering::setPhotonField(ref_ptr<PhotonField> photonField) {
+      27           4 :         this->photonField = photonField;
+      28           4 :         std::string fname = photonField->getFieldName();
+      29           4 :         setDescription("ElasticScattering: " + fname);
+      30          12 :         initRate(getDataPath("ElasticScattering/rate_" + fname.substr(0,3) + ".txt"));
+      31          12 :         initCDF(getDataPath("ElasticScattering/cdf_" + fname.substr(0,3) + ".txt"));
+      32           4 : }
+      33             : 
+      34           4 : void ElasticScattering::initRate(std::string filename) {
+      35           4 :         std::ifstream infile(filename.c_str());
+      36           4 :         if (not infile.good())
+      37           0 :                 throw std::runtime_error("ElasticScattering: could not open file " + filename);
+      38             : 
+      39           4 :         tabRate.clear();
+      40             : 
+      41         824 :         while (infile.good()) {
+      42         824 :                 if (infile.peek() == '#') {
+      43          16 :                         infile.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
+      44          16 :                         continue;
+      45             :                 }
+      46             :                 double r;
+      47             :                 infile >> r;
+      48         808 :                 if (!infile)
+      49             :                         break;
+      50         804 :                 tabRate.push_back(r / Mpc);
+      51             :         }
+      52             : 
+      53           4 :         infile.close();
+      54           4 : }
+      55             : 
+      56           4 : void ElasticScattering::initCDF(std::string filename) {
+      57           4 :         std::ifstream infile(filename.c_str());
+      58           4 :         if (not infile.good())
+      59           0 :                 throw std::runtime_error("ElasticScattering: could not open file " + filename);
+      60             : 
+      61           4 :         tabCDF.clear();
+      62             :         std::string line;
+      63             :         double a;
+      64         820 :         while (std::getline(infile, line)) {
+      65         816 :                 if (line[0] == '#')
+      66          12 :                         continue;
+      67             : 
+      68         804 :                 std::stringstream lineStream(line);
+      69             :                 lineStream >> a;
+      70             : 
+      71         804 :                 std::vector<double> cdf(neps);
+      72      413256 :                 for (size_t i = 0; i < neps; i++) {
+      73             :                         lineStream >> a;
+      74      412452 :                         cdf[i] = a;
+      75             :                 }
+      76         804 :                 tabCDF.push_back(cdf);
+      77         804 :         }
+      78             : 
+      79           4 :         infile.close();
+      80           4 : }
+      81             : 
+      82           1 : void ElasticScattering::process(Candidate *candidate) const {
+      83           1 :         int id = candidate->current.getId();
+      84           1 :         double z = candidate->getRedshift();
+      85             : 
+      86           1 :         if (not isNucleus(id))
+      87             :                 return;
+      88             : 
+      89           1 :         double lg = log10(candidate->current.getLorentzFactor() * (1 + z));
+      90           1 :         if ((lg < lgmin) or (lg > lgmax))
+      91             :                 return;
+      92             : 
+      93           1 :         int A = massNumber(id);
+      94           1 :         int Z = chargeNumber(id);
+      95           1 :         int N = A - Z;
+      96             : 
+      97           1 :         double step = candidate->getCurrentStep();
+      98           8 :         while (step > 0) {
+      99             : 
+     100           8 :                 double rate = interpolateEquidistant(lg, lgmin, lgmax, tabRate);
+     101           8 :                 rate *= Z * N / double(A);  // TRK scaling
+     102           8 :                 rate *= pow_integer<2>(1 + z) * photonField->getRedshiftScaling(z);  // cosmological scaling
+     103             : 
+     104             :                 // check for interaction
+     105           8 :                 Random &random = Random::instance();
+     106           8 :                 double randDist = -log(random.rand()) / rate;
+     107           8 :                 if (step < randDist)
+     108           1 :                         return;
+     109             : 
+     110             :                 // draw random background photon energy from CDF
+     111           7 :                 size_t i = floor((lg - lgmin) / (lgmax - lgmin) * (nlg - 1)); // index of closest gamma tabulation point
+     112           7 :                 size_t j = random.randBin(tabCDF[i]) - 1; // index of next lower tabulated eps value
+     113             :                 double binWidth = (epsmax - epsmin) / (neps - 1); // logarithmic bin width
+     114           7 :                 double eps = pow(10, epsmin + (j + random.rand()) * binWidth);
+     115             : 
+     116             :                 // boost to lab frame
+     117           7 :                 double cosTheta = 2 * random.rand() - 1;
+     118           7 :                 double E = eps * candidate->current.getLorentzFactor() * (1. - cosTheta);
+     119             : 
+     120           7 :                 Vector3d pos = random.randomInterpolatedPosition(candidate->previous.getPosition(), candidate->current.getPosition());
+     121           7 :                 candidate->addSecondary(22, E, pos, 1., interactionTag);
+     122             : 
+     123             :                 // repeat with remaining step
+     124           7 :                 step -= randDist;
+     125             :         }
+     126             : }
+     127             : 
+     128           0 : void ElasticScattering::setInteractionTag(std::string tag) {
+     129           0 :         this -> interactionTag = tag;
+     130           0 : }
+     131             : 
+     132           0 : std::string ElasticScattering::getInteractionTag() const {
+     133           0 :         return interactionTag;
+     134             : }
+     135             : 
+     136             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/ElectronPairProduction.cpp.func-sort-c.html b/doc/coverageReport/src/module/ElectronPairProduction.cpp.func-sort-c.html new file mode 100644 index 000000000..03ac203cf --- /dev/null +++ b/doc/coverageReport/src/module/ElectronPairProduction.cpp.func-sort-c.html @@ -0,0 +1,112 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/ElectronPairProduction.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - ElectronPairProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:859292.4 %
Date:2024-04-08 14:58:22Functions:91090.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa22ElectronPairProduction8setLimitEd0
_ZN7crpropa22ElectronPairProduction12initSpectrumENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa22ElectronPairProduction16setHaveElectronsEb1
_ZN7crpropa22ElectronPairProduction17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZNK7crpropa22ElectronPairProduction17getInteractionTagB5cxx11Ev2
_ZN7crpropa22ElectronPairProductionC2ENS_7ref_ptrINS_11PhotonFieldEEEbd10
_ZN7crpropa22ElectronPairProduction14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE19
_ZN7crpropa22ElectronPairProduction8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE19
_ZNK7crpropa22ElectronPairProduction10lossLengthEidd15446
_ZNK7crpropa22ElectronPairProduction7processEPNS_9CandidateE15447
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/ElectronPairProduction.cpp.func.html b/doc/coverageReport/src/module/ElectronPairProduction.cpp.func.html new file mode 100644 index 000000000..5da0c6c27 --- /dev/null +++ b/doc/coverageReport/src/module/ElectronPairProduction.cpp.func.html @@ -0,0 +1,112 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/ElectronPairProduction.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - ElectronPairProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:859292.4 %
Date:2024-04-08 14:58:22Functions:91090.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa22ElectronPairProduction12initSpectrumENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa22ElectronPairProduction14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE19
_ZN7crpropa22ElectronPairProduction16setHaveElectronsEb1
_ZN7crpropa22ElectronPairProduction17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa22ElectronPairProduction8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE19
_ZN7crpropa22ElectronPairProduction8setLimitEd0
_ZN7crpropa22ElectronPairProductionC2ENS_7ref_ptrINS_11PhotonFieldEEEbd10
_ZNK7crpropa22ElectronPairProduction10lossLengthEidd15446
_ZNK7crpropa22ElectronPairProduction17getInteractionTagB5cxx11Ev2
_ZNK7crpropa22ElectronPairProduction7processEPNS_9CandidateE15447
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/ElectronPairProduction.cpp.gcov.html b/doc/coverageReport/src/module/ElectronPairProduction.cpp.gcov.html new file mode 100644 index 000000000..5204a21c0 --- /dev/null +++ b/doc/coverageReport/src/module/ElectronPairProduction.cpp.gcov.html @@ -0,0 +1,233 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/ElectronPairProduction.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - ElectronPairProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:859292.4 %
Date:2024-04-08 14:58:22Functions:91090.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/ElectronPairProduction.h"
+       2             : #include "crpropa/Units.h"
+       3             : #include "crpropa/ParticleID.h"
+       4             : #include "crpropa/ParticleMass.h"
+       5             : #include "crpropa/Random.h"
+       6             : 
+       7             : #include <fstream>
+       8             : #include <limits>
+       9             : #include <stdexcept>
+      10             : 
+      11             : namespace crpropa {
+      12             : 
+      13          10 : ElectronPairProduction::ElectronPairProduction(ref_ptr<PhotonField> photonField,
+      14          10 :                 bool haveElectrons, double limit) {
+      15          10 :         this->haveElectrons = haveElectrons;
+      16          10 :         this->limit = limit;
+      17          10 :         setPhotonField(photonField);
+      18          10 : }
+      19             : 
+      20          19 : void ElectronPairProduction::setPhotonField(ref_ptr<PhotonField> photonField) {
+      21          19 :         this->photonField = photonField;
+      22          19 :         std::string fname = photonField->getFieldName();
+      23          19 :         setDescription("ElectronPairProduction: " + fname);
+      24          57 :         initRate(getDataPath("ElectronPairProduction/lossrate_" + fname + ".txt"));
+      25          19 :         if (haveElectrons) { // Load secondary spectra only if electrons should be produced
+      26           0 :                 initSpectrum(getDataPath("ElectronPairProduction/spectrum_" + fname.substr(0,3) + ".txt"));
+      27             :         }
+      28          19 : }
+      29             : 
+      30           1 : void ElectronPairProduction::setHaveElectrons(bool haveElectrons) {
+      31           1 :         this->haveElectrons = haveElectrons;
+      32           1 :         if (haveElectrons) { // Load secondary spectra in case haveElectrons was changed to true
+      33           1 :                 std::string fname = photonField->getFieldName();
+      34           3 :                 initSpectrum(getDataPath("ElectronPairProduction/spectrum_" + fname.substr(0,3) + ".txt"));
+      35             :         }
+      36           1 : }
+      37             : 
+      38           0 : void ElectronPairProduction::setLimit(double limit) {
+      39           0 :         this->limit = limit;
+      40           0 : }
+      41             : 
+      42          19 : void ElectronPairProduction::initRate(std::string filename) {
+      43          19 :         std::ifstream infile(filename.c_str());
+      44             : 
+      45          19 :         if (!infile.good())
+      46           0 :                 throw std::runtime_error("ElectronPairProduction: could not open file " + filename);
+      47             : 
+      48             :         // clear previously loaded interaction rates
+      49          19 :         tabLorentzFactor.clear();
+      50          19 :         tabLossRate.clear();
+      51             : 
+      52        2853 :         while (infile.good()) {
+      53        2834 :                 if (infile.peek() != '#') {
+      54             :                         double a, b;
+      55             :                         infile >> a >> b;
+      56        2777 :                         if (infile) {
+      57        2758 :                                 tabLorentzFactor.push_back(pow(10, a));
+      58        2758 :                                 tabLossRate.push_back(b / Mpc);
+      59             :                         }
+      60             :                 }
+      61        2834 :                 infile.ignore(std::numeric_limits < std::streamsize > ::max(), '\n');
+      62             :         }
+      63          19 :         infile.close();
+      64          19 : }
+      65             : 
+      66           1 : void ElectronPairProduction::initSpectrum(std::string filename) {
+      67           1 :         std::ifstream infile(filename.c_str());
+      68           1 :         if (!infile.good())
+      69           0 :                 throw std::runtime_error("ElectronPairProduction: could not open file " + filename);
+      70             : 
+      71             :         double dNdE;
+      72           1 :         tabSpectrum.resize(70);
+      73          71 :         for (size_t i = 0; i < 70; i++) {
+      74          70 :                 tabSpectrum[i].resize(170);
+      75       11970 :                 for (size_t j = 0; j < 170; j++) {
+      76             :                         infile >> dNdE;
+      77       11900 :                         tabSpectrum[i][j] = dNdE * pow(10, (7 + 0.1 * j)); // read electron distribution pdf(Ee) ~ dN/dEe * Ee
+      78             :                 }
+      79       11900 :                 for (size_t j = 1; j < 170; j++) {
+      80       11830 :                         tabSpectrum[i][j] += tabSpectrum[i][j - 1]; // cdf(Ee), unnormalized
+      81             :                 }
+      82             :         }
+      83           1 :         infile.close();
+      84           1 : }
+      85             : 
+      86       15446 : double ElectronPairProduction::lossLength(int id, double lf, double z) const {
+      87       15446 :         double Z = chargeNumber(id);
+      88       15446 :         if (Z == 0)
+      89             :                 return std::numeric_limits<double>::max(); // no pair production on uncharged particles
+      90             : 
+      91       14944 :         lf *= (1 + z);
+      92       14944 :         if (lf < tabLorentzFactor.front())
+      93             :                 return std::numeric_limits<double>::max(); // below energy threshold
+      94             : 
+      95             :         double rate;
+      96       14921 :         if (lf < tabLorentzFactor.back())
+      97       14921 :                 rate = interpolate(lf, tabLorentzFactor, tabLossRate); // interpolation
+      98             :         else
+      99           0 :                 rate = tabLossRate.back() * pow(lf / tabLorentzFactor.back(), -0.6); // extrapolation
+     100             : 
+     101       14921 :         double A = nuclearMass(id) / mass_proton; // more accurate than massNumber(Id)
+     102       14921 :         rate *= Z * Z / A * pow_integer<3>(1 + z) * photonField->getRedshiftScaling(z);
+     103       14921 :         return 1. / rate;
+     104             : }
+     105             : 
+     106       15447 : void ElectronPairProduction::process(Candidate *c) const {
+     107       15447 :         int id = c->current.getId();
+     108       15447 :         if (not (isNucleus(id)))
+     109             :                 return; // only nuclei
+     110             : 
+     111       15446 :         double lf = c->current.getLorentzFactor();
+     112       15446 :         double z = c->getRedshift();
+     113       15446 :         double losslen = lossLength(id, lf, z);  // energy loss length
+     114       15446 :         if (losslen >= std::numeric_limits<double>::max())
+     115             :                 return;
+     116             : 
+     117       14921 :         double step = c->getCurrentStep() / (1 + z); // step size in local frame
+     118       14921 :         double loss = step / losslen;  // relative energy loss
+     119             : 
+     120       14921 :         if (haveElectrons) {
+     121           1 :                 double dE = c->current.getEnergy() * loss;  // energy loss
+     122           1 :                 int i = round((log10(lf) - 6.05) * 10);  // find closest cdf(Ee|log10(gamma))
+     123           1 :                 i = std::min(std::max(i, 0), 69);
+     124           1 :                 Random &random = Random::instance();
+     125             : 
+     126             :                 // draw pairs as long as their energy is smaller than the pair production energy loss
+     127        6534 :                 while (dE > 0) {
+     128        6534 :                         size_t j = random.randBin(tabSpectrum[i]);
+     129        6534 :                         double Ee = pow(10, 6.95 + (j + random.rand()) * 0.1) * eV;
+     130        6534 :                         double Epair = 2 * Ee; // NOTE: electron and positron in general don't have same lab frame energy, but averaged over many draws the result is consistent
+     131             :                         // if the remaining energy is not sufficient check for random accepting
+     132        6534 :                         if (Epair > dE)
+     133           1 :                                 if (random.rand() > (dE / Epair))
+     134             :                                         break; // not accepted
+     135             : 
+     136             :                         // create pair and repeat with remaining energy
+     137        6533 :                         dE -= Epair;
+     138        6533 :                         Vector3d pos = random.randomInterpolatedPosition(c->previous.getPosition(), c->current.getPosition());
+     139        6533 :                         c->addSecondary( 11, Ee, pos, 1., interactionTag);
+     140        6533 :                         c->addSecondary(-11, Ee, pos, 1., interactionTag);
+     141             :                 }
+     142             :         }
+     143             : 
+     144       14921 :         c->current.setLorentzFactor(lf * (1 - loss));
+     145       14921 :         c->limitNextStep(limit * losslen);
+     146             : }
+     147             : 
+     148           1 : void ElectronPairProduction::setInteractionTag(std::string tag) {
+     149           1 :         interactionTag = tag;
+     150           1 : }
+     151             : 
+     152           2 : std::string ElectronPairProduction::getInteractionTag() const {
+     153           2 :         return interactionTag;
+     154             : }
+     155             : 
+     156             : 
+     157             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/HDF5Output.cpp.func-sort-c.html b/doc/coverageReport/src/module/HDF5Output.cpp.func-sort-c.html new file mode 100644 index 000000000..7c1102518 --- /dev/null +++ b/doc/coverageReport/src/module/HDF5Output.cpp.func-sort-c.html @@ -0,0 +1,128 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/HDF5Output.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - HDF5Output.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:122415.0 %
Date:2024-04-08 14:58:22Functions:41428.6 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa10HDF5Output13setFlushLimitEj0
_ZN7crpropa10HDF5Output21insertDoubleAttributeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKd0
_ZN7crpropa10HDF5Output21insertStringAttributeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_0
_ZN7crpropa10HDF5OutputC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa10HDF5OutputC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_6Output10OutputTypeE0
_ZN7crpropa10HDF5OutputD0Ev0
_ZN7crpropa23variantTypeToH5T_NATIVEENS_7Variant4TypeE0
_ZNK7crpropa10HDF5Output14getDescriptionB5cxx11Ev0
_ZNK7crpropa10HDF5Output5flushEv0
_ZNK7crpropa10HDF5Output7processEPNS_9CandidateE0
_ZN7crpropa10HDF5Output4openERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa10HDF5Output5closeEv1
_ZN7crpropa10HDF5OutputC2Ev1
_ZN7crpropa10HDF5OutputD2Ev1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/HDF5Output.cpp.func.html b/doc/coverageReport/src/module/HDF5Output.cpp.func.html new file mode 100644 index 000000000..23798cfed --- /dev/null +++ b/doc/coverageReport/src/module/HDF5Output.cpp.func.html @@ -0,0 +1,128 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/HDF5Output.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - HDF5Output.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:122415.0 %
Date:2024-04-08 14:58:22Functions:41428.6 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa10HDF5Output13setFlushLimitEj0
_ZN7crpropa10HDF5Output21insertDoubleAttributeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKd0
_ZN7crpropa10HDF5Output21insertStringAttributeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_0
_ZN7crpropa10HDF5Output4openERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa10HDF5Output5closeEv1
_ZN7crpropa10HDF5OutputC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa10HDF5OutputC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_6Output10OutputTypeE0
_ZN7crpropa10HDF5OutputC2Ev1
_ZN7crpropa10HDF5OutputD0Ev0
_ZN7crpropa10HDF5OutputD2Ev1
_ZN7crpropa23variantTypeToH5T_NATIVEENS_7Variant4TypeE0
_ZNK7crpropa10HDF5Output14getDescriptionB5cxx11Ev0
_ZNK7crpropa10HDF5Output5flushEv0
_ZNK7crpropa10HDF5Output7processEPNS_9CandidateE0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/HDF5Output.cpp.gcov.html b/doc/coverageReport/src/module/HDF5Output.cpp.gcov.html new file mode 100644 index 000000000..653ba85ea --- /dev/null +++ b/doc/coverageReport/src/module/HDF5Output.cpp.gcov.html @@ -0,0 +1,468 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/HDF5Output.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - HDF5Output.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:122415.0 %
Date:2024-04-08 14:58:22Functions:41428.6 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #ifdef CRPROPA_HAVE_HDF5
+       2             : 
+       3             : #include "crpropa/module/HDF5Output.h"
+       4             : #include "crpropa/Version.h"
+       5             : #include "crpropa/Random.h"
+       6             : #include "kiss/logger.h"
+       7             : 
+       8             : #include <hdf5.h>
+       9             : #include <cstring>
+      10             : 
+      11             : const hsize_t RANK = 1;
+      12             : const hsize_t BUFFER_SIZE = 1024 * 16;
+      13             : 
+      14             : namespace crpropa {
+      15             : 
+      16             : // map variant types to H5T_NATIVE
+      17           0 : hid_t variantTypeToH5T_NATIVE(Variant::Type type) {
+      18             :         if (type == Variant::TYPE_INT64)
+      19           0 :                 return H5T_NATIVE_INT64;
+      20             :         else if(type == Variant::TYPE_BOOL)
+      21           0 :                 return H5T_NATIVE_HBOOL;
+      22             :         else if(type == Variant::TYPE_CHAR)
+      23           0 :                 return H5T_NATIVE_CHAR;
+      24             :         else if(type == Variant::TYPE_UCHAR)
+      25           0 :                 return H5T_NATIVE_UCHAR;
+      26             :         else if(type == Variant::TYPE_INT16)
+      27           0 :                 return H5T_NATIVE_INT16;
+      28             :         else if(type == Variant::TYPE_UINT16)
+      29           0 :                 return H5T_NATIVE_UINT16;
+      30             :         else if(type == Variant::TYPE_INT32)
+      31           0 :                 return H5T_NATIVE_INT32;
+      32             :         else if(type == Variant::TYPE_UINT32)
+      33           0 :                 return H5T_NATIVE_UINT32;
+      34             :         else if(type == Variant::TYPE_INT64)
+      35             :                 return H5T_NATIVE_INT64;
+      36             :         else if(type == Variant::TYPE_UINT64)
+      37           0 :                 return H5T_NATIVE_UINT64;
+      38             :         else if(type == Variant::TYPE_FLOAT)
+      39           0 :                 return H5T_NATIVE_FLOAT;
+      40             :         else if(type == Variant::TYPE_DOUBLE)
+      41           0 :                 return H5T_NATIVE_DOUBLE;
+      42             :         else if(type == Variant::TYPE_STRING)
+      43           0 :                 return H5T_C_S1;
+      44             :         else
+      45             :         {
+      46           0 :                 KISS_LOG_ERROR << "variantTypeToH5T_NATIVE:: Type: " << Variant::getTypeName(type) << " unknown.";
+      47           0 :                 throw std::runtime_error("No matching HDF type for Variant type");
+      48             :         }
+      49             : }
+      50             : 
+      51           1 : HDF5Output::HDF5Output() :  Output(), filename(), file(-1), sid(-1), dset(-1), dataspace(-1), candidatesSinceFlush(0), flushLimit(std::numeric_limits<unsigned int>::max()) {
+      52           1 : }
+      53             : 
+      54           0 : HDF5Output::HDF5Output(const std::string& filename) :  Output(), filename(filename), file(-1), sid(-1), dset(-1), dataspace(-1), candidatesSinceFlush(0), flushLimit(std::numeric_limits<unsigned int>::max()) {
+      55           0 : }
+      56             : 
+      57           0 : HDF5Output::HDF5Output(const std::string& filename, OutputType outputtype) :  Output(outputtype), filename(filename), file(-1), sid(-1), dset(-1), dataspace(-1), candidatesSinceFlush(0), flushLimit(std::numeric_limits<unsigned int>::max()) {
+      58             :         outputtype = outputtype;
+      59           0 : }
+      60             : 
+      61           1 : HDF5Output::~HDF5Output() {
+      62           1 :         close();
+      63           2 : }
+      64             : 
+      65           0 : herr_t HDF5Output::insertStringAttribute(const std::string &key, const std::string &value){
+      66             :         hid_t   strtype, attr_space, version_attr;
+      67           0 :         hsize_t dims = 0;
+      68             :         herr_t  status;
+      69             : 
+      70           0 :         strtype = H5Tcopy(H5T_C_S1);
+      71           0 :         status = H5Tset_size(strtype, value.size());
+      72             : 
+      73           0 :         attr_space = H5Screate_simple(0, &dims, NULL);
+      74           0 :         version_attr = H5Acreate2(dset, key.c_str(), strtype, attr_space, H5P_DEFAULT, H5P_DEFAULT);
+      75           0 :         status = H5Awrite(version_attr, strtype, value.c_str());
+      76           0 :         status = H5Aclose(version_attr);
+      77           0 :         status = H5Sclose(attr_space);
+      78             : 
+      79           0 :         return status;
+      80             : }
+      81             : 
+      82           0 : herr_t HDF5Output::insertDoubleAttribute(const std::string &key, const double &value){
+      83             :         hid_t   type, attr_space, version_attr;
+      84           0 :         hsize_t dims = 0;
+      85             :         herr_t  status;
+      86             : 
+      87           0 :         type = H5Tcopy(H5T_NATIVE_DOUBLE);
+      88             : 
+      89           0 :         attr_space = H5Screate_simple(0, &dims, NULL);
+      90           0 :         version_attr = H5Acreate2(dset, key.c_str(), type, attr_space, H5P_DEFAULT, H5P_DEFAULT);
+      91           0 :         status = H5Awrite(version_attr, type, &value);
+      92           0 :         status = H5Aclose(version_attr);
+      93           0 :         status = H5Sclose(attr_space);
+      94             : 
+      95           0 :         return status;
+      96             : }
+      97             : 
+      98             : 
+      99             : 
+     100           1 : void HDF5Output::open(const std::string& filename) {
+     101           1 :         file = H5Fcreate(filename.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+     102           1 :         if (file < 0)
+     103           2 :                 throw std::runtime_error(std::string("Cannot create file: ") + filename);
+     104             : 
+     105             : 
+     106           0 :         sid = H5Tcreate(H5T_COMPOUND, sizeof(OutputRow));
+     107           0 :         if (fields.test(TrajectoryLengthColumn))
+     108           0 :                 H5Tinsert(sid, "D", HOFFSET(OutputRow, D), H5T_NATIVE_DOUBLE);
+     109           0 :         if (fields.test(RedshiftColumn))
+     110           0 :                 H5Tinsert(sid, "z", HOFFSET(OutputRow, z), H5T_NATIVE_DOUBLE);
+     111           0 :         if (fields.test(SerialNumberColumn))
+     112           0 :                 H5Tinsert(sid, "SN", HOFFSET(OutputRow, SN), H5T_NATIVE_UINT64);
+     113           0 :         if (fields.test(CurrentIdColumn))
+     114           0 :                 H5Tinsert(sid, "ID", HOFFSET(OutputRow, ID), H5T_NATIVE_INT32);
+     115           0 :         if (fields.test(CurrentEnergyColumn))
+     116           0 :                 H5Tinsert(sid, "E", HOFFSET(OutputRow, E), H5T_NATIVE_DOUBLE);
+     117           0 :         if (fields.test(CurrentPositionColumn) && oneDimensional)
+     118           0 :                 H5Tinsert(sid, "X", HOFFSET(OutputRow, X), H5T_NATIVE_DOUBLE);
+     119           0 :         if (fields.test(CurrentPositionColumn) && not oneDimensional) {
+     120           0 :                 H5Tinsert(sid, "X", HOFFSET(OutputRow, X), H5T_NATIVE_DOUBLE);
+     121           0 :                 H5Tinsert(sid, "Y", HOFFSET(OutputRow, Y), H5T_NATIVE_DOUBLE);
+     122           0 :                 H5Tinsert(sid, "Z", HOFFSET(OutputRow, Z), H5T_NATIVE_DOUBLE);
+     123             :         }
+     124           0 :         if (fields.test(CurrentDirectionColumn) && not oneDimensional) {
+     125           0 :                 H5Tinsert(sid, "Px", HOFFSET(OutputRow, Px), H5T_NATIVE_DOUBLE);
+     126           0 :                 H5Tinsert(sid, "Py", HOFFSET(OutputRow, Py), H5T_NATIVE_DOUBLE);
+     127           0 :                 H5Tinsert(sid, "Pz", HOFFSET(OutputRow, Pz), H5T_NATIVE_DOUBLE);
+     128             :         }
+     129           0 :         if (fields.test(SerialNumberColumn))
+     130           0 :                 H5Tinsert(sid, "SN0", HOFFSET(OutputRow, SN0), H5T_NATIVE_UINT64);
+     131           0 :         if (fields.test(SourceIdColumn))
+     132           0 :                 H5Tinsert(sid, "ID0", HOFFSET(OutputRow, ID0), H5T_NATIVE_INT32);
+     133           0 :         if (fields.test(SourceEnergyColumn))
+     134           0 :                 H5Tinsert(sid, "E0", HOFFSET(OutputRow, E0), H5T_NATIVE_DOUBLE);
+     135           0 :         if (fields.test(SourcePositionColumn) && oneDimensional)
+     136           0 :                 H5Tinsert(sid, "X0", HOFFSET(OutputRow, X0), H5T_NATIVE_DOUBLE);
+     137           0 :         if (fields.test(SourcePositionColumn) && not oneDimensional){
+     138           0 :                 H5Tinsert(sid, "X0", HOFFSET(OutputRow, X0), H5T_NATIVE_DOUBLE);
+     139           0 :                 H5Tinsert(sid, "Y0", HOFFSET(OutputRow, Y0), H5T_NATIVE_DOUBLE);
+     140           0 :                 H5Tinsert(sid, "Z0", HOFFSET(OutputRow, Z0), H5T_NATIVE_DOUBLE);
+     141             :         }
+     142           0 :         if (fields.test(SourceDirectionColumn) && not oneDimensional) {
+     143           0 :                 H5Tinsert(sid, "P0x", HOFFSET(OutputRow, P0x), H5T_NATIVE_DOUBLE);
+     144           0 :                 H5Tinsert(sid, "P0y", HOFFSET(OutputRow, P0y), H5T_NATIVE_DOUBLE);
+     145           0 :                 H5Tinsert(sid, "P0z", HOFFSET(OutputRow, P0z), H5T_NATIVE_DOUBLE);
+     146             :         }
+     147           0 :         if (fields.test(SerialNumberColumn))
+     148           0 :                 H5Tinsert(sid, "SN1", HOFFSET(OutputRow, SN1), H5T_NATIVE_UINT64);
+     149           0 :         if (fields.test(CreatedIdColumn))
+     150           0 :                 H5Tinsert(sid, "ID1", HOFFSET(OutputRow, ID1), H5T_NATIVE_INT32);
+     151           0 :         if (fields.test(CreatedEnergyColumn))
+     152           0 :                 H5Tinsert(sid, "E1", HOFFSET(OutputRow, E1), H5T_NATIVE_DOUBLE);
+     153           0 :         if (fields.test(CreatedPositionColumn) && oneDimensional)
+     154           0 :                 H5Tinsert(sid, "X1", HOFFSET(OutputRow, X1), H5T_NATIVE_DOUBLE);
+     155           0 :         if (fields.test(CreatedPositionColumn) && not oneDimensional) {
+     156           0 :                 H5Tinsert(sid, "X1", HOFFSET(OutputRow, X1), H5T_NATIVE_DOUBLE);
+     157           0 :                 H5Tinsert(sid, "Y1", HOFFSET(OutputRow, Y1), H5T_NATIVE_DOUBLE);
+     158           0 :                 H5Tinsert(sid, "Z1", HOFFSET(OutputRow, Z1), H5T_NATIVE_DOUBLE);
+     159             :         }
+     160           0 :         if (fields.test(CreatedDirectionColumn) && not oneDimensional) {
+     161           0 :                 H5Tinsert(sid, "P1x", HOFFSET(OutputRow, P1x), H5T_NATIVE_DOUBLE);
+     162           0 :                 H5Tinsert(sid, "P1y", HOFFSET(OutputRow, P1y), H5T_NATIVE_DOUBLE);
+     163           0 :                 H5Tinsert(sid, "P1z", HOFFSET(OutputRow, P1z), H5T_NATIVE_DOUBLE);
+     164             :         }
+     165           0 :         if (fields.test(WeightColumn))
+     166           0 :                 H5Tinsert(sid, "W", HOFFSET(OutputRow, weight), H5T_NATIVE_DOUBLE);
+     167             :         
+     168           0 :         if (fields.test(CandidateTagColumn)) 
+     169           0 :                 H5Tinsert(sid, "tag", HOFFSET(OutputRow, tag), H5T_C_S1);
+     170             : 
+     171           0 :         size_t pos = 0;
+     172           0 :         for(std::vector<Output::Property>::const_iterator iter = properties.begin();
+     173           0 :                         iter != properties.end(); ++iter)
+     174             :         {
+     175           0 :                         hid_t type = variantTypeToH5T_NATIVE((*iter).defaultValue.getType());
+     176           0 :                         if (type == H5T_C_S1)
+     177             :                         { // set size of string field to size of default value!
+     178           0 :                                 type = H5Tcopy(H5T_C_S1);
+     179           0 :                                 H5Tset_size(type, (*iter).defaultValue.toString().size());
+     180             :                         }
+     181             : 
+     182           0 :                         H5Tinsert(sid, (*iter).name.c_str(), HOFFSET(OutputRow, propertyBuffer) + pos, type);
+     183           0 :                   pos += (*iter).defaultValue.getSize();
+     184             :         }
+     185           0 :         if (pos >= propertyBufferSize)
+     186             :         {
+     187           0 :                 KISS_LOG_ERROR << "Using " << pos << " bytes for properties output. Maximum is " << propertyBufferSize << " bytes.";
+     188           0 :                 throw std::runtime_error("Size of property buffer exceeded");
+     189             :         }
+     190             : 
+     191             :         // chunked prop
+     192           0 :         hid_t plist = H5Pcreate(H5P_DATASET_CREATE);
+     193           0 :         H5Pset_layout(plist, H5D_CHUNKED);
+     194           0 :         hsize_t chunk_dims[RANK] = {BUFFER_SIZE};
+     195           0 :         H5Pset_chunk(plist, RANK, chunk_dims);
+     196           0 :         H5Pset_deflate(plist, 5);
+     197             : 
+     198           0 :         hsize_t dims[RANK] = {0};
+     199           0 :         hsize_t max_dims[RANK] = {H5S_UNLIMITED};
+     200           0 :         dataspace = H5Screate_simple(RANK, dims, max_dims);
+     201             : 
+     202           0 :         dset = H5Dcreate2(file, "CRPROPA3", sid, dataspace, H5P_DEFAULT, plist, H5P_DEFAULT);
+     203             : 
+     204           0 :         insertStringAttribute("OutputType", outputName);
+     205           0 :         insertStringAttribute("Version", g_GIT_DESC);
+     206           0 :         insertDoubleAttribute("LengthScale", this->lengthScale);
+     207           0 :         insertDoubleAttribute("EnergyScale", this->energyScale);
+     208             : 
+     209             :         // add ranom seeds
+     210           0 :         std::vector< std::vector<uint32_t> > seeds = Random::getSeedThreads();
+     211           0 :         for (size_t i = 0; i < seeds.size(); i++)
+     212             :         {
+     213             :                 hid_t   type, attr_space, version_attr;
+     214             :                 herr_t  status;
+     215           0 :                 hsize_t dims[] = {1, 0};
+     216           0 :                 dims[1] = seeds[i].size();
+     217             : 
+     218           0 :                 type = H5Tarray_create(H5T_NATIVE_ULONG, 2, dims);
+     219             : 
+     220           0 :                 attr_space = H5Screate_simple(0, dims, NULL);
+     221             :                 char nameBuffer[256];
+     222             :                 sprintf(nameBuffer, "SEED_%03lu", i);
+     223           0 :                 KISS_LOG_DEBUG << "Creating HDF5 attribute: " << nameBuffer << " with dimensions " << dims[0] << "x" << dims[1] ;
+     224             : 
+     225           0 :                 version_attr = H5Acreate2(dset, nameBuffer, type, attr_space, H5P_DEFAULT, H5P_DEFAULT);
+     226           0 :                 status = H5Awrite(version_attr, type, &seeds[i][0]);
+     227           0 :                 status = H5Aclose(version_attr);
+     228           0 :                 status = H5Sclose(attr_space);
+     229             : 
+     230             :         }
+     231             : 
+     232             : 
+     233           0 :         H5Pclose(plist);
+     234             : 
+     235           0 :         buffer.reserve(BUFFER_SIZE);
+     236           0 :         time(&lastFlush);
+     237           0 : }
+     238             : 
+     239           1 : void HDF5Output::close() {
+     240           1 :         if (file >= 0) {
+     241           0 :                 flush();
+     242           0 :                 H5Dclose(dset);
+     243           0 :                 H5Tclose(sid);
+     244           0 :                 H5Sclose(dataspace);
+     245           0 :                 H5Fclose(file);
+     246           0 :                 file = -1;
+     247             :         }
+     248           1 : }
+     249             : 
+     250           0 : void HDF5Output::process(Candidate* candidate) const {
+     251           0 :         #pragma omp critical
+     252             :         {
+     253           0 :         if (file == -1)
+     254             :                 // This is ugly, but necesary as otherwise the user has to manually open the
+     255             :                 // file before processing the first candidate
+     256           0 :                 const_cast<HDF5Output*>(this)->open(filename);
+     257             :         }
+     258             : 
+     259             :         OutputRow r;
+     260           0 :         r.D = candidate->getTrajectoryLength() / lengthScale;
+     261           0 :         r.z = candidate->getRedshift();
+     262             : 
+     263           0 :         r.SN = candidate->getSerialNumber();
+     264           0 :         r.ID = candidate->current.getId();
+     265           0 :         r.E = candidate->current.getEnergy() / energyScale;
+     266           0 :         Vector3d v = candidate->current.getPosition() / lengthScale;
+     267           0 :         r.X = v.x;
+     268           0 :         r.Y = v.y;
+     269           0 :         r.Z = v.z;
+     270           0 :         v = candidate->current.getDirection();
+     271           0 :         r.Px = v.x;
+     272           0 :         r.Py = v.y;
+     273           0 :         r.Pz = v.z;
+     274             : 
+     275           0 :         r.SN0 = candidate->getSourceSerialNumber();
+     276           0 :         r.ID0 = candidate->source.getId();
+     277           0 :         r.E0 = candidate->source.getEnergy() / energyScale;
+     278           0 :         v = candidate->source.getPosition() / lengthScale;
+     279           0 :         r.X0 = v.x;
+     280           0 :         r.Y0 = v.y;
+     281           0 :         r.Z0 = v.z;
+     282           0 :         v = candidate->source.getDirection();
+     283           0 :         r.P0x = v.x;
+     284           0 :         r.P0y = v.y;
+     285           0 :         r.P0z = v.z;
+     286             : 
+     287           0 :         r.SN1 = candidate->getCreatedSerialNumber();
+     288           0 :         r.ID1 = candidate->created.getId();
+     289           0 :         r.E1 = candidate->created.getEnergy() / energyScale;
+     290           0 :         v = candidate->created.getPosition() / lengthScale;
+     291           0 :         r.X1 = v.x;
+     292           0 :         r.Y1 = v.y;
+     293           0 :         r.Z1 = v.z;
+     294           0 :         v = candidate->created.getDirection();
+     295           0 :         r.P1x = v.x;
+     296           0 :         r.P1y = v.y;
+     297           0 :         r.P1z = v.z;
+     298             : 
+     299           0 :         r.weight= candidate->getWeight();
+     300             : 
+     301           0 :         r.tag = candidate->getTagOrigin();
+     302             : 
+     303             :         size_t pos = 0;
+     304           0 :         for(std::vector<Output::Property>::const_iterator iter = properties.begin();
+     305           0 :                         iter != properties.end(); ++iter)
+     306             :         {
+     307           0 :                   Variant v;
+     308           0 :                         if (candidate->hasProperty((*iter).name))
+     309             :                         {
+     310           0 :                                 v = candidate->getProperty((*iter).name);
+     311             :                         }
+     312             :                         else
+     313             :                         {
+     314           0 :                                 v = (*iter).defaultValue;
+     315             :                         }
+     316           0 :                         pos += v.copyToBuffer(&r.propertyBuffer[pos]);
+     317           0 :         }
+     318             : 
+     319           0 :         #pragma omp critical
+     320             :         {
+     321           0 :                 const_cast<HDF5Output*>(this)->candidatesSinceFlush++;
+     322           0 :                 Output::process(candidate);
+     323             : 
+     324           0 :                 buffer.push_back(r);
+     325             : 
+     326             : 
+     327           0 :                 if (buffer.size() >= buffer.capacity())
+     328             :                 {
+     329           0 :                         KISS_LOG_DEBUG << "HDF5Output: Flush due to buffer capacity exceeded";
+     330           0 :                         flush();
+     331             :                 }
+     332           0 :                 else if (candidatesSinceFlush >= flushLimit)
+     333             :                 {
+     334           0 :                         KISS_LOG_DEBUG << "HDF5Output: Flush due to number of candidates";
+     335           0 :                         flush();
+     336             :                 }
+     337           0 :                 else if (difftime(time(NULL), lastFlush) > 60*10)
+     338             :                 {
+     339           0 :                         KISS_LOG_DEBUG << "HDF5Output: Flush due to time exceeded";
+     340           0 :                         flush();
+     341             :                 }
+     342             :         }
+     343           0 : }
+     344             : 
+     345           0 : void HDF5Output::flush() const {
+     346           0 :         const_cast<HDF5Output*>(this)->lastFlush = time(NULL);
+     347           0 :         const_cast<HDF5Output*>(this)->candidatesSinceFlush = 0;
+     348             : 
+     349             :         hsize_t n = buffer.size();
+     350             : 
+     351           0 :         if (n == 0)
+     352           0 :                 return;
+     353             : 
+     354           0 :         hid_t file_space = H5Dget_space(dset);
+     355           0 :         hsize_t count = H5Sget_simple_extent_npoints(file_space);
+     356             : 
+     357             :         // resize dataset
+     358           0 :         hsize_t new_size[RANK] = {count + n};
+     359           0 :         H5Dset_extent(dset, new_size);
+     360             : 
+     361             :         // get updated filespace
+     362           0 :         H5Sclose(file_space);
+     363           0 :         file_space = H5Dget_space(dset);
+     364             : 
+     365           0 :         hsize_t offset[RANK] = {count};
+     366           0 :         hsize_t cnt[RANK] = {n};
+     367             : 
+     368           0 :         H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, cnt, NULL);
+     369           0 :         hid_t mspace_id = H5Screate_simple(RANK, cnt, NULL);
+     370             : 
+     371           0 :         H5Dwrite(dset, sid, mspace_id, file_space, H5P_DEFAULT, buffer.data());
+     372             : 
+     373           0 :         H5Sclose(mspace_id);
+     374           0 :         H5Sclose(file_space);
+     375             : 
+     376           0 :         buffer.clear();
+     377             : 
+     378           0 :         H5Fflush(file, H5F_SCOPE_GLOBAL);
+     379             : }
+     380             : 
+     381           0 : std::string HDF5Output::getDescription() const  {
+     382           0 :         return "HDF5Output";
+     383             : }
+     384             : 
+     385           0 : void HDF5Output::setFlushLimit(unsigned int N)
+     386             : {
+     387           0 :         flushLimit = N;
+     388           0 : }
+     389             : 
+     390             : } // namespace crpropa
+     391             : 
+     392             : #endif // CRPROPA_HAVE_HDF5
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/MomentumDiffusion.cpp.func-sort-c.html b/doc/coverageReport/src/module/MomentumDiffusion.cpp.func-sort-c.html new file mode 100644 index 000000000..8f9c1026b --- /dev/null +++ b/doc/coverageReport/src/module/MomentumDiffusion.cpp.func-sort-c.html @@ -0,0 +1,112 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/MomentumDiffusion.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - MomentumDiffusion.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:114524.4 %
Date:2024-04-08 14:58:22Functions:31030.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa25ConstantMomentumDiffusionC2Edd0
_ZNK7crpropa25ConstantMomentumDiffusion14getDescriptionB5cxx11Ev0
_ZNK7crpropa25ConstantMomentumDiffusion16calculateAScalarEd0
_ZNK7crpropa25ConstantMomentumDiffusion16calculateBScalarEv0
_ZNK7crpropa25ConstantMomentumDiffusion6getDppEv0
_ZNK7crpropa25ConstantMomentumDiffusion7processEPNS_9CandidateE0
_ZNK7crpropa25ConstantMomentumDiffusion8getLimitEv0
_ZN7crpropa25ConstantMomentumDiffusion6setDppEd1
_ZN7crpropa25ConstantMomentumDiffusionC2Ed1
_ZN7crpropa25ConstantMomentumDiffusion8setLimitEd2
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/MomentumDiffusion.cpp.func.html b/doc/coverageReport/src/module/MomentumDiffusion.cpp.func.html new file mode 100644 index 000000000..377203fb6 --- /dev/null +++ b/doc/coverageReport/src/module/MomentumDiffusion.cpp.func.html @@ -0,0 +1,112 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/MomentumDiffusion.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - MomentumDiffusion.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:114524.4 %
Date:2024-04-08 14:58:22Functions:31030.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa25ConstantMomentumDiffusion6setDppEd1
_ZN7crpropa25ConstantMomentumDiffusion8setLimitEd2
_ZN7crpropa25ConstantMomentumDiffusionC2Ed1
_ZN7crpropa25ConstantMomentumDiffusionC2Edd0
_ZNK7crpropa25ConstantMomentumDiffusion14getDescriptionB5cxx11Ev0
_ZNK7crpropa25ConstantMomentumDiffusion16calculateAScalarEd0
_ZNK7crpropa25ConstantMomentumDiffusion16calculateBScalarEv0
_ZNK7crpropa25ConstantMomentumDiffusion6getDppEv0
_ZNK7crpropa25ConstantMomentumDiffusion7processEPNS_9CandidateE0
_ZNK7crpropa25ConstantMomentumDiffusion8getLimitEv0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/MomentumDiffusion.cpp.gcov.html b/doc/coverageReport/src/module/MomentumDiffusion.cpp.gcov.html new file mode 100644 index 000000000..926f0af54 --- /dev/null +++ b/doc/coverageReport/src/module/MomentumDiffusion.cpp.gcov.html @@ -0,0 +1,147 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/MomentumDiffusion.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - MomentumDiffusion.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:114524.4 %
Date:2024-04-08 14:58:22Functions:31030.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/MomentumDiffusion.h"
+       2             : 
+       3             : using namespace crpropa;
+       4             : 
+       5           1 : ConstantMomentumDiffusion::ConstantMomentumDiffusion(double Dpp) {
+       6           1 :         setLimit(0.1);
+       7           1 :         setDpp(Dpp);
+       8           1 : }
+       9             : 
+      10           0 : ConstantMomentumDiffusion::ConstantMomentumDiffusion(double Dpp, double limit) {
+      11           0 :         setLimit(limit);
+      12           0 :         setDpp(Dpp);
+      13           0 : }
+      14             : 
+      15           0 : void ConstantMomentumDiffusion::process(Candidate *c) const {
+      16           0 :         double rig = c->current.getRigidity();
+      17           0 :         if (std::isinf(rig)) {
+      18             :                 return; // Only charged particles
+      19             :         }
+      20             :         
+      21           0 :         double p = c->current.getEnergy() / c_light; // Note we use E=p/c (relativistic limit)
+      22           0 :         double dt = c->getCurrentStep() / c_light;
+      23             :         
+      24           0 :         double eta =  Random::instance().randNorm();
+      25           0 :         double domega = eta * sqrt(dt);
+      26             :         
+      27           0 :         double AScal = calculateAScalar(p);
+      28           0 :         double BScal = calculateBScalar();
+      29             : 
+      30           0 :         double dp = AScal * dt + BScal * domega;
+      31           0 :         c->current.setEnergy((p + dp) * c_light);
+      32             :         
+      33           0 :         c->limitNextStep(limit * p / AScal * c_light);
+      34             : }
+      35             : 
+      36           0 : double ConstantMomentumDiffusion::calculateAScalar(double p) const {
+      37           0 :         double a = + 2. / p * Dpp;
+      38           0 :         return a; 
+      39             : }
+      40             : 
+      41           0 : double ConstantMomentumDiffusion::calculateBScalar() const {
+      42           0 :         double b = sqrt(2 * Dpp);
+      43           0 :         return b;
+      44             : }
+      45             : 
+      46           1 : void ConstantMomentumDiffusion::setDpp(double d) {
+      47           1 :         if (d < 0 )
+      48           0 :                 throw std::runtime_error(
+      49           0 :                                 "ConstantMomentumDiffusion: Dpp must be non-negative");
+      50           1 :         Dpp = d;
+      51           1 : }
+      52             : 
+      53           2 : void ConstantMomentumDiffusion::setLimit(double l) {
+      54           2 :         limit = l;
+      55           2 : }
+      56             : 
+      57           0 : double ConstantMomentumDiffusion::getDpp() const {
+      58           0 :         return Dpp;
+      59             : }
+      60             : 
+      61           0 : double ConstantMomentumDiffusion::getLimit() const {
+      62           0 :         return limit;
+      63             : }
+      64             : 
+      65           0 : std::string ConstantMomentumDiffusion::getDescription() const {
+      66           0 :         std::stringstream s;
+      67           0 :         s << "limit: " << limit << "\n";
+      68           0 :         s << "Dpp: " << Dpp / (meter * meter / second) << " m^2/s";
+      69             : 
+      70           0 :         return s.str();
+      71           0 : }
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/NuclearDecay.cpp.func-sort-c.html b/doc/coverageReport/src/module/NuclearDecay.cpp.func-sort-c.html new file mode 100644 index 000000000..dde7b40eb --- /dev/null +++ b/doc/coverageReport/src/module/NuclearDecay.cpp.func-sort-c.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/NuclearDecay.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - NuclearDecay.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13716881.5 %
Date:2024-04-08 14:58:22Functions:111384.6 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa12NuclearDecay12meanFreePathEid0
_ZN7crpropa12NuclearDecay8setLimitEd0
_ZN7crpropa12NuclearDecay14setHavePhotonsEb1
_ZN7crpropa12NuclearDecay16setHaveNeutrinosEb1
_ZN7crpropa12NuclearDecay17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa12NuclearDecay16setHaveElectronsEb2
_ZNK7crpropa12NuclearDecay17getInteractionTagB5cxx11Ev2
_ZN7crpropa12NuclearDecayC2Ebbbd9
_ZNK7crpropa12NuclearDecay13gammaEmissionEPNS_9CandidateEi11
_ZNK7crpropa12NuclearDecay9betaDecayEPNS_9CandidateEb499
_ZNK7crpropa12NuclearDecay15nucleonEmissionEPNS_9CandidateEii699
_ZNK7crpropa12NuclearDecay18performInteractionEPNS_9CandidateEi984
_ZNK7crpropa12NuclearDecay7processEPNS_9CandidateE7647
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/NuclearDecay.cpp.func.html b/doc/coverageReport/src/module/NuclearDecay.cpp.func.html new file mode 100644 index 000000000..2adf42079 --- /dev/null +++ b/doc/coverageReport/src/module/NuclearDecay.cpp.func.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/NuclearDecay.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - NuclearDecay.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13716881.5 %
Date:2024-04-08 14:58:22Functions:111384.6 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa12NuclearDecay12meanFreePathEid0
_ZN7crpropa12NuclearDecay14setHavePhotonsEb1
_ZN7crpropa12NuclearDecay16setHaveElectronsEb2
_ZN7crpropa12NuclearDecay16setHaveNeutrinosEb1
_ZN7crpropa12NuclearDecay17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa12NuclearDecay8setLimitEd0
_ZN7crpropa12NuclearDecayC2Ebbbd9
_ZNK7crpropa12NuclearDecay13gammaEmissionEPNS_9CandidateEi11
_ZNK7crpropa12NuclearDecay15nucleonEmissionEPNS_9CandidateEii699
_ZNK7crpropa12NuclearDecay17getInteractionTagB5cxx11Ev2
_ZNK7crpropa12NuclearDecay18performInteractionEPNS_9CandidateEi984
_ZNK7crpropa12NuclearDecay7processEPNS_9CandidateE7647
_ZNK7crpropa12NuclearDecay9betaDecayEPNS_9CandidateEb499
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/NuclearDecay.cpp.gcov.html b/doc/coverageReport/src/module/NuclearDecay.cpp.gcov.html new file mode 100644 index 000000000..a9a87ffa4 --- /dev/null +++ b/doc/coverageReport/src/module/NuclearDecay.cpp.gcov.html @@ -0,0 +1,395 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/NuclearDecay.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - NuclearDecay.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13716881.5 %
Date:2024-04-08 14:58:22Functions:111384.6 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/NuclearDecay.h"
+       2             : #include "crpropa/Units.h"
+       3             : #include "crpropa/ParticleID.h"
+       4             : #include "crpropa/ParticleMass.h"
+       5             : #include "crpropa/Random.h"
+       6             : 
+       7             : #include <fstream>
+       8             : #include <limits>
+       9             : #include <cmath>
+      10             : #include <stdexcept>
+      11             : 
+      12             : #include "kiss/logger.h"
+      13             : 
+      14             : namespace crpropa {
+      15             : 
+      16           9 : NuclearDecay::NuclearDecay(bool electrons, bool photons, bool neutrinos, double l) {
+      17           9 :         haveElectrons = electrons;
+      18           9 :         havePhotons = photons;
+      19           9 :         haveNeutrinos = neutrinos;
+      20           9 :         limit = l;
+      21           9 :         setDescription("NuclearDecay");
+      22             : 
+      23             :         // load decay table
+      24          18 :         std::string filename = getDataPath("nuclear_decay.txt");
+      25           9 :         std::ifstream infile(filename.c_str());
+      26           9 :         if (!infile.good())
+      27           0 :                 throw std::runtime_error(
+      28           0 :                                 "crpropa::NuclearDecay: could not open file " + filename);
+      29             : 
+      30           9 :         decayTable.resize(27 * 31);
+      31             :         std::string line;
+      32        8550 :         while (std::getline(infile,line)) {
+      33        8541 :                 std::stringstream stream(line);
+      34        8541 :                 if (stream.peek() == '#')
+      35             :                         continue;
+      36             :                 DecayMode decay;
+      37             :                 int Z, N;
+      38             :                 double lifetime;
+      39        8523 :                 stream >> Z >> N >> decay.channel >> lifetime;
+      40        8523 :                 decay.rate = 1. / lifetime / c_light; // decay rate in [1/m]
+      41             :                 std::vector<double> gamma;
+      42             :                 double val;
+      43       34227 :                 while (stream >> val)
+      44       25704 :                         gamma.push_back(val);
+      45       21375 :                 for (int i = 0; i < gamma.size(); i += 2) {
+      46       12852 :                         decay.energy.push_back(gamma[i] * keV);
+      47       12852 :                         decay.intensity.push_back(gamma[i+1]);
+      48             :                 }
+      49        8523 :                 if (infile)
+      50        8523 :                         decayTable[Z * 31 + N].push_back(decay);
+      51        8541 :         }
+      52           9 :         infile.close();
+      53          18 : }
+      54             : 
+      55           2 : void NuclearDecay::setHaveElectrons(bool b) {
+      56           2 :         haveElectrons = b;
+      57           2 : }
+      58             : 
+      59           1 : void NuclearDecay::setHavePhotons(bool b) {
+      60           1 :         havePhotons = b;
+      61           1 : }
+      62             : 
+      63           1 : void NuclearDecay::setHaveNeutrinos(bool b) {
+      64           1 :         haveNeutrinos = b;
+      65           1 : }
+      66             : 
+      67           0 : void NuclearDecay::setLimit(double l) {
+      68           0 :         limit = l;
+      69           0 : }
+      70             : 
+      71        7647 : void NuclearDecay::process(Candidate *candidate) const {
+      72             :         // the loop should be processed at least once for limiting the next step
+      73        7647 :         double step = candidate->getCurrentStep();
+      74        7647 :         double z = candidate->getRedshift();
+      75             :         do {
+      76             :                 // check if nucleus
+      77        7672 :                 int id = candidate->current.getId();
+      78        7672 :                 if (not (isNucleus(id)))
+      79             :                         return;
+      80             : 
+      81        7671 :                 int A = massNumber(id);
+      82        7671 :                 int Z = chargeNumber(id);
+      83        7671 :                 int N = A - Z;
+      84             : 
+      85             :                 // check if particle can decay
+      86        7671 :                 const std::vector<DecayMode> &decays = decayTable[Z * 31 + N];
+      87        7671 :                 if (decays.size() == 0)
+      88             :                         return;
+      89             : 
+      90             :                 // find interaction mode with minimum random decay distance
+      91         328 :                 Random &random = Random::instance();
+      92             :                 double randDistance = std::numeric_limits<double>::max();
+      93             :                 int channel;
+      94             :                 double totalRate = 0;
+      95             : 
+      96         656 :                 for (size_t i = 0; i < decays.size(); i++) {
+      97         328 :                         double rate = decays[i].rate;
+      98         328 :                         rate /= candidate->current.getLorentzFactor();  // relativistic time dilation
+      99         328 :                         rate /= (1 + z);  // rate per light travel distance -> rate per comoving distance
+     100         328 :                         totalRate += rate;
+     101         328 :                         double d = -log(random.rand()) / rate;
+     102         328 :                         if (d > randDistance)
+     103           0 :                                 continue;
+     104             :                         randDistance = d;
+     105         328 :                         channel = decays[i].channel;
+     106             :                 }
+     107             : 
+     108             :                 // check if interaction doesn't happen
+     109         328 :                 if (step < randDistance) {
+     110             :                         // limit next step to a fraction of the mean free path
+     111         303 :                         candidate->limitNextStep(limit / totalRate);
+     112         303 :                         return;
+     113             :                 }
+     114             : 
+     115             :                 // interact and repeat with remaining step
+     116          25 :                 performInteraction(candidate, channel);
+     117          25 :                 step -= randDistance;
+     118          25 :         } while (step > 0);
+     119             : }
+     120             : 
+     121         984 : void NuclearDecay::performInteraction(Candidate *candidate, int channel) const {
+     122             :         // interpret decay channel
+     123             :         int nBetaMinus = digit(channel, 10000);
+     124             :         int nBetaPlus = digit(channel, 1000);
+     125             :         int nAlpha = digit(channel, 100);
+     126             :         int nProton = digit(channel, 10);
+     127             :         int nNeutron = digit(channel, 1);
+     128             : 
+     129             :         // perform decays
+     130         984 :         if (havePhotons)
+     131          11 :                 gammaEmission(candidate,channel);
+     132        1314 :         for (size_t i = 0; i < nBetaMinus; i++)
+     133         330 :                 betaDecay(candidate, false);
+     134        1153 :         for (size_t i = 0; i < nBetaPlus; i++)
+     135         169 :                 betaDecay(candidate, true);
+     136        1008 :         for (size_t i = 0; i < nAlpha; i++)
+     137          24 :                 nucleonEmission(candidate, 4, 2);
+     138        1319 :         for (size_t i = 0; i < nProton; i++)
+     139         335 :                 nucleonEmission(candidate, 1, 1);
+     140        1324 :         for (size_t i = 0; i < nNeutron; i++)
+     141         340 :                 nucleonEmission(candidate, 1, 0);
+     142         984 : }
+     143             : 
+     144          11 : void NuclearDecay::gammaEmission(Candidate *candidate, int channel) const {
+     145          11 :         int id = candidate->current.getId();
+     146          11 :         int Z = chargeNumber(id);
+     147          11 :         int N = massNumber(id) - Z;
+     148             : 
+     149             :         // get photon energies and emission probabilities for decay channel
+     150          11 :         const std::vector<DecayMode> &decays = decayTable[Z * 31 + N];
+     151             :         size_t idecay = decays.size();
+     152          21 :         while (idecay-- != 0) {
+     153          21 :                 if (decays[idecay].channel == channel)
+     154             :                         break;
+     155             :         }
+     156             : 
+     157             :         const std::vector<double> &energy = decays[idecay].energy;
+     158             :         const std::vector<double> &intensity = decays[idecay].intensity;
+     159             : 
+     160             :         // check if photon emission available
+     161          11 :         if (energy.size() == 0)
+     162           0 :                 return;
+     163             : 
+     164          11 :         Random &random = Random::instance();
+     165          11 :         Vector3d pos = random.randomInterpolatedPosition(candidate->previous.getPosition(), candidate->current.getPosition());
+     166             : 
+     167          26 :         for (int i = 0; i < energy.size(); ++i) {
+     168             :                 // check if photon of specific energy is emitted
+     169          15 :                 if (random.rand() > intensity[i])
+     170           5 :                         continue;
+     171             :                 // create secondary photon; boost to lab frame
+     172          10 :                 double cosTheta = 2 * random.rand() - 1;
+     173          10 :                 double E = energy[i] * candidate->current.getLorentzFactor() * (1. - cosTheta);
+     174          10 :                 candidate->addSecondary(22, E, pos, 1., interactionTag);
+     175             :         }
+     176             : }
+     177             : 
+     178         499 : void NuclearDecay::betaDecay(Candidate *candidate, bool isBetaPlus) const {
+     179         499 :         double gamma = candidate->current.getLorentzFactor();
+     180         499 :         int id = candidate->current.getId();
+     181         499 :         int A = massNumber(id);
+     182         499 :         int Z = chargeNumber(id);
+     183             : 
+     184             :         // beta- decay
+     185             :         int electronId = 11; // electron
+     186             :         int neutrinoId = -12; // anti-electron neutrino
+     187             :         int dZ = 1;
+     188             :         // beta+ decay
+     189         499 :         if (isBetaPlus) {
+     190             :                 electronId = -11; // positron
+     191             :                 neutrinoId = 12; // electron neutrino
+     192             :                 dZ = -1;
+     193             :         }
+     194             : 
+     195             :         // update candidate, nuclear recoil negligible
+     196             :         try
+     197             :         {
+     198         499 :                 candidate->current.setId(nucleusId(A, Z + dZ));
+     199             :         }
+     200           0 :         catch (std::runtime_error &e)
+     201             :         {
+     202           0 :                 KISS_LOG_ERROR<< "Something went wrong in the NuclearDecay\n" << "Please report this error on https://github.com/CRPropa/CRPropa3/issues including your simulation setup and the following random seed:\n" << Random::instance().getSeed_base64();
+     203           0 :                 throw;
+     204           0 :         }
+     205             : 
+     206         499 :         candidate->current.setLorentzFactor(gamma);
+     207             : 
+     208         499 :         if (not (haveElectrons or haveNeutrinos))
+     209         487 :                 return;
+     210             : 
+     211             :         // Q-value of the decay, subtract total energy of emitted photons
+     212          12 :         double m1 = nuclearMass(A, Z);
+     213          12 :         double m2 = nuclearMass(A, Z+dZ);
+     214          12 :         double Q = (m1 - m2 - mass_electron) * c_squared;
+     215             : 
+     216             :         // generate cdf of electron energy, neglecting Coulomb correction
+     217             :         // see Basdevant, Fundamentals in Nuclear Physics, eq. (4.92)
+     218             :         // This leads to deviations from theoretical expectations at low 
+     219             :         // primary energies.
+     220             :         std::vector<double> energies;
+     221             :         std::vector<double> densities; // cdf(E), unnormalized
+     222             : 
+     223          12 :         energies.reserve(51);
+     224          12 :         densities.reserve(51);
+     225             : 
+     226             :         double me = mass_electron * c_squared;
+     227          12 :         double cdf = 0;
+     228         624 :         for (int i = 0; i <= 50; i++) {
+     229         612 :                 double E = me + i / 50. * Q;
+     230         612 :                 cdf += E * sqrt(E * E - me * me) * pow(Q + me - E, 2);
+     231         612 :                 energies.push_back(E);
+     232         612 :                 densities.push_back(cdf);
+     233             :         }
+     234             : 
+     235             :         // draw random electron energy and angle
+     236             :         // assumption of ultra-relativistic particles 
+     237             :         // leads to deviations from theoretical predictions
+     238             :         // is not problematic for usual CRPropa energies E>~TeV
+     239          12 :         Random &random = Random::instance();
+     240          12 :         double E = interpolate(random.rand() * cdf, densities, energies);
+     241          12 :         double p = sqrt(E * E - me * me);  // p*c
+     242          12 :         double cosTheta = 2 * random.rand() - 1;
+     243             : 
+     244             :         // boost to lab frame
+     245          12 :         double Ee = gamma * (E - p * cosTheta);
+     246          12 :         double Enu = gamma * (Q + me - E) * (1 + cosTheta);  // pnu*c ~ Enu
+     247             : 
+     248          12 :         Vector3d pos = random.randomInterpolatedPosition(candidate->previous.getPosition(), candidate->current.getPosition());
+     249          12 :         if (haveElectrons)
+     250          12 :                 candidate->addSecondary(electronId, Ee, pos, 1., interactionTag);
+     251          12 :         if (haveNeutrinos)
+     252          10 :                 candidate->addSecondary(neutrinoId, Enu, pos, 1., interactionTag);
+     253             : }
+     254             : 
+     255         699 : void NuclearDecay::nucleonEmission(Candidate *candidate, int dA, int dZ) const {
+     256         699 :         Random &random = Random::instance();
+     257         699 :         int id = candidate->current.getId();
+     258         699 :         int A = massNumber(id);
+     259         699 :         int Z = chargeNumber(id);
+     260         699 :         double EpA = candidate->current.getEnergy() / double(A);
+     261             : 
+     262             :         try
+     263             :         {
+     264         699 :                 candidate->current.setId(nucleusId(A - dA, Z - dZ));
+     265             :         }
+     266           0 :         catch (std::runtime_error &e)
+     267             :         {
+     268           0 :                 KISS_LOG_ERROR<< "Something went wrong in the NuclearDecay\n" << "Please report this error on https://github.com/CRPropa/CRPropa3/issues including your simulation setup and the following random seed:\n" << Random::instance().getSeed_base64();
+     269           0 :                 throw;
+     270           0 :         }
+     271             : 
+     272         699 :         candidate->current.setEnergy(EpA * (A - dA));
+     273         699 :         Vector3d pos = random.randomInterpolatedPosition(candidate->previous.getPosition(),candidate->current.getPosition());
+     274             : 
+     275             :         try
+     276             :         {
+     277         699 :                 candidate->addSecondary(nucleusId(dA, dZ), EpA * dA, pos, 1., interactionTag);
+     278             :         }
+     279           0 :         catch (std::runtime_error &e)
+     280             :         {
+     281           0 :                 KISS_LOG_ERROR<< "Something went wrong in the NuclearDecay\n" << "Please report this error on https://github.com/CRPropa/CRPropa3/issues including your simulation setup and the following random seed:\n" << Random::instance().getSeed_base64();
+     282           0 :                 throw;
+     283           0 :         }
+     284             : 
+     285         699 : }
+     286             : 
+     287           0 : double NuclearDecay::meanFreePath(int id, double gamma) {
+     288           0 :         if (not (isNucleus(id)))
+     289             :                 return std::numeric_limits<double>::max();
+     290             : 
+     291           0 :         int A = massNumber(id);
+     292           0 :         int Z = chargeNumber(id);
+     293           0 :         int N = A - Z;
+     294             : 
+     295             :         // check if particle can decay
+     296           0 :         const std::vector<DecayMode> &decays = decayTable[Z * 31 + N];
+     297           0 :         if (decays.size() == 0)
+     298             :                 return std::numeric_limits<double>::max();
+     299             : 
+     300             :         double totalRate = 0;
+     301             : 
+     302           0 :         for (size_t i = 0; i < decays.size(); i++) {
+     303           0 :                 double rate = decays[i].rate;
+     304           0 :                 rate /= gamma;
+     305           0 :                 totalRate += rate;
+     306             :         }
+     307             : 
+     308           0 :         return 1. / totalRate;
+     309             : }
+     310             : 
+     311           1 : void NuclearDecay::setInteractionTag(std::string tag) {
+     312           1 :         interactionTag = tag;
+     313           1 : }
+     314             : 
+     315           2 : std::string NuclearDecay::getInteractionTag() const {
+     316           2 :         return interactionTag;
+     317             : }
+     318             : 
+     319             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/Observer.cpp.func-sort-c.html b/doc/coverageReport/src/module/Observer.cpp.func-sort-c.html new file mode 100644 index 000000000..7bf409276 --- /dev/null +++ b/doc/coverageReport/src/module/Observer.cpp.func-sort-c.html @@ -0,0 +1,248 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/Observer.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - Observer.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8018044.4 %
Date:2024-04-08 14:58:22Functions:164436.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16ObserverTrackingC2ENS_7Vector3IdEEdd0
_ZN7crpropa21ObserverTimeEvolutionC2Ev0
_ZN7crpropa22ObserverParticleIdVetoC2Ei0
_ZN7crpropa22ObserverRedshiftWindowC2Edd0
_ZNK7crpropa10Observer1D14getDescriptionB5cxx11Ev0
_ZNK7crpropa15ObserverFeature14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa15ObserverFeature14getDescriptionB5cxx11Ev0
_ZNK7crpropa15ObserverSurface14getDescriptionB5cxx11Ev0
_ZNK7crpropa16ObserverTracking14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa16ObserverTracking14getDescriptionB5cxx11Ev0
_ZNK7crpropa17ObserverDetectAll14getDescriptionB5cxx11Ev0
_ZNK7crpropa18ObserverPhotonVeto14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa18ObserverPhotonVeto14getDescriptionB5cxx11Ev0
_ZNK7crpropa19ObserverNucleusVeto14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa19ObserverNucleusVeto14getDescriptionB5cxx11Ev0
_ZNK7crpropa20ObserverElectronVeto14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa20ObserverElectronVeto14getDescriptionB5cxx11Ev0
_ZNK7crpropa20ObserverInactiveVeto14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa20ObserverInactiveVeto14getDescriptionB5cxx11Ev0
_ZNK7crpropa20ObserverNeutrinoVeto14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa20ObserverNeutrinoVeto14getDescriptionB5cxx11Ev0
_ZNK7crpropa21ObserverTimeEvolution14getDescriptionB5cxx11Ev0
_ZNK7crpropa21ObserverTimeEvolution8getTimesEv0
_ZNK7crpropa22ObserverParticleIdVeto14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa22ObserverParticleIdVeto14getDescriptionB5cxx11Ev0
_ZNK7crpropa22ObserverRedshiftWindow14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa22ObserverRedshiftWindow14getDescriptionB5cxx11Ev0
_ZNK7crpropa8Observer14getDescriptionB5cxx11Ev0
_ZN7crpropa21ObserverTimeEvolutionC2Eddd1
_ZN7crpropa21ObserverTimeEvolutionC2Edddb1
_ZN7crpropa15ObserverSurfaceC2EPNS_7SurfaceE2
_ZN7crpropa21ObserverTimeEvolution12addTimeRangeEdddb2
_ZN7crpropa8Observer11onDetectionEPNS_6ModuleEb2
_ZN7crpropa8Observer24setDeactivateOnDetectionEb2
_ZN7crpropa8Observer7setFlagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_2
_ZNK7crpropa17ObserverDetectAll14checkDetectionEPNS_9CandidateE2
_ZN7crpropa21ObserverTimeEvolution7addTimeERKd4
_ZNK7crpropa15ObserverSurface14checkDetectionEPNS_9CandidateE4
_ZNK7crpropa21ObserverTimeEvolution14checkDetectionEPNS_9CandidateE6
_ZN7crpropa8Observer3addEPNS_15ObserverFeatureE10
_ZN7crpropa8ObserverC2Ev10
_ZNK7crpropa15ObserverFeature11onDetectionEPNS_9CandidateE52
_ZNK7crpropa10Observer1D14checkDetectionEPNS_9CandidateE7664
_ZNK7crpropa8Observer7processEPNS_9CandidateE7681
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/Observer.cpp.func.html b/doc/coverageReport/src/module/Observer.cpp.func.html new file mode 100644 index 000000000..d3bea8de7 --- /dev/null +++ b/doc/coverageReport/src/module/Observer.cpp.func.html @@ -0,0 +1,248 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/Observer.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - Observer.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8018044.4 %
Date:2024-04-08 14:58:22Functions:164436.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa15ObserverSurfaceC2EPNS_7SurfaceE2
_ZN7crpropa16ObserverTrackingC2ENS_7Vector3IdEEdd0
_ZN7crpropa21ObserverTimeEvolution12addTimeRangeEdddb2
_ZN7crpropa21ObserverTimeEvolution7addTimeERKd4
_ZN7crpropa21ObserverTimeEvolutionC2Eddd1
_ZN7crpropa21ObserverTimeEvolutionC2Edddb1
_ZN7crpropa21ObserverTimeEvolutionC2Ev0
_ZN7crpropa22ObserverParticleIdVetoC2Ei0
_ZN7crpropa22ObserverRedshiftWindowC2Edd0
_ZN7crpropa8Observer11onDetectionEPNS_6ModuleEb2
_ZN7crpropa8Observer24setDeactivateOnDetectionEb2
_ZN7crpropa8Observer3addEPNS_15ObserverFeatureE10
_ZN7crpropa8Observer7setFlagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_2
_ZN7crpropa8ObserverC2Ev10
_ZNK7crpropa10Observer1D14checkDetectionEPNS_9CandidateE7664
_ZNK7crpropa10Observer1D14getDescriptionB5cxx11Ev0
_ZNK7crpropa15ObserverFeature11onDetectionEPNS_9CandidateE52
_ZNK7crpropa15ObserverFeature14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa15ObserverFeature14getDescriptionB5cxx11Ev0
_ZNK7crpropa15ObserverSurface14checkDetectionEPNS_9CandidateE4
_ZNK7crpropa15ObserverSurface14getDescriptionB5cxx11Ev0
_ZNK7crpropa16ObserverTracking14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa16ObserverTracking14getDescriptionB5cxx11Ev0
_ZNK7crpropa17ObserverDetectAll14checkDetectionEPNS_9CandidateE2
_ZNK7crpropa17ObserverDetectAll14getDescriptionB5cxx11Ev0
_ZNK7crpropa18ObserverPhotonVeto14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa18ObserverPhotonVeto14getDescriptionB5cxx11Ev0
_ZNK7crpropa19ObserverNucleusVeto14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa19ObserverNucleusVeto14getDescriptionB5cxx11Ev0
_ZNK7crpropa20ObserverElectronVeto14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa20ObserverElectronVeto14getDescriptionB5cxx11Ev0
_ZNK7crpropa20ObserverInactiveVeto14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa20ObserverInactiveVeto14getDescriptionB5cxx11Ev0
_ZNK7crpropa20ObserverNeutrinoVeto14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa20ObserverNeutrinoVeto14getDescriptionB5cxx11Ev0
_ZNK7crpropa21ObserverTimeEvolution14checkDetectionEPNS_9CandidateE6
_ZNK7crpropa21ObserverTimeEvolution14getDescriptionB5cxx11Ev0
_ZNK7crpropa21ObserverTimeEvolution8getTimesEv0
_ZNK7crpropa22ObserverParticleIdVeto14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa22ObserverParticleIdVeto14getDescriptionB5cxx11Ev0
_ZNK7crpropa22ObserverRedshiftWindow14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa22ObserverRedshiftWindow14getDescriptionB5cxx11Ev0
_ZNK7crpropa8Observer14getDescriptionB5cxx11Ev0
_ZNK7crpropa8Observer7processEPNS_9CandidateE7681
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/Observer.cpp.gcov.html b/doc/coverageReport/src/module/Observer.cpp.gcov.html new file mode 100644 index 000000000..e54a180c9 --- /dev/null +++ b/doc/coverageReport/src/module/Observer.cpp.gcov.html @@ -0,0 +1,427 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/Observer.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - Observer.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8018044.4 %
Date:2024-04-08 14:58:22Functions:164436.4 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/Observer.h"
+       2             : #include "crpropa/Units.h"
+       3             : #include "crpropa/ParticleID.h"
+       4             : #include "crpropa/Cosmology.h"
+       5             : 
+       6             : #include "kiss/logger.h"
+       7             : 
+       8             : #include <iostream>
+       9             : #include <cmath>
+      10             : 
+      11             : namespace crpropa {
+      12             : 
+      13             : // Observer -------------------------------------------------------------------
+      14          10 : Observer::Observer() :
+      15          10 :                 makeInactive(true), clone(false) {
+      16          10 : }
+      17             : 
+      18          10 : void Observer::add(ObserverFeature *feature) {
+      19          10 :         features.push_back(feature);
+      20          10 : }
+      21             : 
+      22           2 : void Observer::onDetection(Module *action, bool clone_) {
+      23           2 :         detectionAction = action;
+      24           2 :         clone = clone_;
+      25           2 : }
+      26             : 
+      27        7681 : void Observer::process(Candidate *candidate) const {
+      28             :         // loop over all features and have them check the particle
+      29             :         DetectionState state = NOTHING;
+      30       15362 :         for (int i = 0; i < features.size(); i++) {
+      31        7681 :                 DetectionState s = features[i]->checkDetection(candidate);
+      32        7681 :                 if (s == VETO)
+      33             :                         state = VETO;
+      34        7681 :                 else if ((s == DETECTED) && (state != VETO))
+      35             :                         state = DETECTED;
+      36             :         }
+      37             : 
+      38        7681 :         if (state == DETECTED) {
+      39         104 :                 for (int i = 0; i < features.size(); i++) {
+      40          52 :                         features[i]->onDetection(candidate);
+      41             :                 }
+      42             : 
+      43          52 :                 if (detectionAction.valid()) {
+      44          38 :                         if (clone)
+      45           0 :                                 detectionAction->process(candidate->clone(false));
+      46             :                         else
+      47          38 :                                 detectionAction->process(candidate);
+      48             :                 }
+      49             : 
+      50          52 :                 if (!flagKey.empty())
+      51           4 :                         candidate->setProperty(flagKey, flagValue);
+      52             : 
+      53          52 :                 if (makeInactive)
+      54          48 :                         candidate->setActive(false);
+      55             :         }
+      56        7681 : }
+      57             : 
+      58           2 : void Observer::setFlag(std::string key, std::string value) {
+      59           2 :         flagKey = key;
+      60           2 :         flagValue = value;
+      61           2 : }
+      62             : 
+      63           0 : std::string Observer::getDescription() const {
+      64           0 :         std::stringstream ss;
+      65           0 :         ss << "Observer";
+      66           0 :         for (int i = 0; i < features.size(); i++)
+      67           0 :                 ss << "\n    " << features[i]->getDescription() << "\n";
+      68           0 :         ss << "    Flag: '" << flagKey << "' -> '" << flagValue << "'\n";
+      69           0 :         ss << "    MakeInactive: " << (makeInactive ? "yes\n" : "no\n");
+      70           0 :         if (detectionAction.valid())
+      71           0 :                 ss << "    Action: " << detectionAction->getDescription() << ", clone: " << (clone ? "yes" : "no");
+      72             : 
+      73           0 :         return ss.str();
+      74           0 : }
+      75             : 
+      76           2 : void Observer::setDeactivateOnDetection(bool deactivate) {
+      77           2 :         makeInactive = deactivate;
+      78           2 : }
+      79             : 
+      80             : // ObserverFeature ------------------------------------------------------------
+      81           0 : DetectionState ObserverFeature::checkDetection(Candidate *candidate) const {
+      82           0 :         return NOTHING;
+      83             : }
+      84             : 
+      85          52 : void ObserverFeature::onDetection(Candidate *candidate) const {
+      86          52 : }
+      87             : 
+      88           0 : std::string ObserverFeature::getDescription() const {
+      89           0 :         return description;
+      90             : }
+      91             : 
+      92             : // ObserverDetectAll ----------------------------------------------------------
+      93           2 : DetectionState ObserverDetectAll::checkDetection(Candidate *candidate) const {
+      94           2 :         return DETECTED;
+      95             : }
+      96             : 
+      97           0 : std::string ObserverDetectAll::getDescription() const {
+      98           0 :         return description;
+      99             : }
+     100             : 
+     101             : // ObserverTracking --------------------------------------------------------
+     102           0 : ObserverTracking::ObserverTracking(Vector3d center, double radius, double stepSize) :
+     103           0 :                 center(center), radius(radius), stepSize(stepSize) {
+     104             :         if (stepSize == 0) {
+     105             :                 stepSize = radius / 10.;
+     106             :         }
+     107           0 : }
+     108             : 
+     109           0 : DetectionState ObserverTracking::checkDetection(Candidate *candidate) const {
+     110             :         // current distance to observer sphere center
+     111           0 :         double d = (candidate->current.getPosition() - center).getR();
+     112             : 
+     113             :         // no detection if outside of observer sphere
+     114           0 :         if (d > radius) {
+     115             :                 // conservatively limit next step to prevent overshooting
+     116           0 :                 candidate->limitNextStep(fabs(d - radius));
+     117             : 
+     118           0 :                 return NOTHING;
+     119             :         } else {
+     120             :                 // limit next step
+     121           0 :                 candidate->limitNextStep(stepSize);
+     122             : 
+     123           0 :                 return DETECTED;
+     124             :         }
+     125             : }
+     126             : 
+     127           0 : std::string ObserverTracking::getDescription() const {
+     128           0 :         std::stringstream ss;
+     129           0 :         ss << "ObserverTracking: ";
+     130           0 :         ss << "center = " << center / Mpc << " Mpc, ";
+     131           0 :         ss << "radius = " << radius / Mpc << " Mpc";
+     132           0 :         ss << "stepSize = " << stepSize / Mpc << " Mpc";
+     133           0 :         return ss.str();
+     134           0 : }
+     135             : 
+     136             : // Observer1D --------------------------------------------------------------
+     137        7664 : DetectionState Observer1D::checkDetection(Candidate *candidate) const {
+     138        7664 :         double x = candidate->current.getPosition().x;
+     139        7664 :         if (x > 0) {
+     140             :                 // Limits the next step size to prevent candidates from overshooting in case of non-detection
+     141        7625 :                 candidate->limitNextStep(x);
+     142        7625 :                 return NOTHING;
+     143             :         }
+     144             :         // Detects particles when reaching x = 0
+     145             :         return DETECTED;
+     146             : }
+     147             : 
+     148           0 : std::string Observer1D::getDescription() const {
+     149           0 :         return "Observer1D: observer at x = 0";
+     150             : }
+     151             : 
+     152             : // ObserverRedshiftWindow -----------------------------------------------------
+     153           0 : ObserverRedshiftWindow::ObserverRedshiftWindow(double zmin, double zmax) :
+     154           0 :                 zmin(zmin), zmax(zmax) {
+     155           0 : }
+     156             : 
+     157           0 : DetectionState ObserverRedshiftWindow::checkDetection(
+     158             :                 Candidate *candidate) const {
+     159           0 :         double z = candidate->getRedshift();
+     160           0 :         if (z > zmax)
+     161             :                 return VETO;
+     162           0 :         if (z < zmin)
+     163           0 :                 return VETO;
+     164             :         return NOTHING;
+     165             : }
+     166             : 
+     167           0 : std::string ObserverRedshiftWindow::getDescription() const {
+     168           0 :         std::stringstream ss;
+     169           0 :         ss << "ObserverRedshiftWindow: z = " << zmin << " - " << zmax;
+     170           0 :         return ss.str();
+     171           0 : }
+     172             : 
+     173             : // ObserverInactiveVeto -------------------------------------------------------
+     174           0 : DetectionState ObserverInactiveVeto::checkDetection(Candidate *c) const {
+     175           0 :         if (not(c->isActive()))
+     176           0 :                 return VETO;
+     177             :         return NOTHING;
+     178             : }
+     179             : 
+     180           0 : std::string ObserverInactiveVeto::getDescription() const {
+     181           0 :         return "ObserverInactiveVeto";
+     182             : }
+     183             : 
+     184             : // ObserverNucleusVeto --------------------------------------------------------
+     185           0 : DetectionState ObserverNucleusVeto::checkDetection(Candidate *c) const {
+     186           0 :         if (isNucleus(c->current.getId()))
+     187           0 :                 return VETO;
+     188             :         return NOTHING;
+     189             : }
+     190             : 
+     191           0 : std::string ObserverNucleusVeto::getDescription() const {
+     192           0 :         return "ObserverNucleusVeto";
+     193             : }
+     194             : 
+     195             : // ObserverNeutrinoVeto -------------------------------------------------------
+     196           0 : DetectionState ObserverNeutrinoVeto::checkDetection(Candidate *c) const {
+     197           0 :         int id = abs(c->current.getId());
+     198           0 :         if ((id == 12) or (id == 14) or (id == 16))
+     199           0 :                 return VETO;
+     200             :         return NOTHING;
+     201             : }
+     202             : 
+     203           0 : std::string ObserverNeutrinoVeto::getDescription() const {
+     204           0 :         return "ObserverNeutrinoVeto";
+     205             : }
+     206             : 
+     207             : // ObserverPhotonVeto ---------------------------------------------------------
+     208           0 : DetectionState ObserverPhotonVeto::checkDetection(Candidate *c) const {
+     209           0 :         if (c->current.getId() == 22)
+     210           0 :                 return VETO;
+     211             :         return NOTHING;
+     212             : }
+     213             : 
+     214           0 : std::string ObserverPhotonVeto::getDescription() const {
+     215           0 :         return "ObserverPhotonVeto";
+     216             : }
+     217             : 
+     218             : // ObserverElectronVeto ---------------------------------------------------------
+     219           0 : DetectionState ObserverElectronVeto::checkDetection(Candidate *c) const {
+     220           0 :         if (abs(c->current.getId()) == 11)
+     221           0 :                 return VETO;
+     222             :         return NOTHING;
+     223             : }
+     224             : 
+     225           0 : std::string ObserverElectronVeto::getDescription() const {
+     226           0 :         return "ObserverElectronVeto";
+     227             : }
+     228             : 
+     229             : // ObserverCustomVeto -------------------------------------------------------
+     230           0 : ObserverParticleIdVeto::ObserverParticleIdVeto(int pId) {
+     231           0 :         vetoParticleId = pId;
+     232           0 : }
+     233             : 
+     234           0 : DetectionState ObserverParticleIdVeto::checkDetection(Candidate *c) const {
+     235           0 :         if (c->current.getId() == vetoParticleId)
+     236           0 :                 return VETO;
+     237             :         return NOTHING;
+     238             : }
+     239             : 
+     240           0 : std::string ObserverParticleIdVeto::getDescription() const {
+     241           0 :         return "ObserverParticleIdVeto";
+     242             : }
+     243             : 
+     244             : 
+     245             : // ObserverTimeEvolution --------------------------------------------------------
+     246           0 : ObserverTimeEvolution::ObserverTimeEvolution() {}
+     247             : 
+     248           1 : ObserverTimeEvolution::ObserverTimeEvolution(double min, double dist, double numb) {
+     249           1 :         double max = min + numb * dist;
+     250             :         bool log = false;
+     251           1 :         addTimeRange(min, max, numb, log);
+     252           1 : }
+     253             : 
+     254           1 : ObserverTimeEvolution::ObserverTimeEvolution(double min, double max, double numb, bool log) {
+     255           1 :         addTimeRange(min, max, numb, log);
+     256           1 : }
+     257             : 
+     258             : 
+     259           6 : DetectionState ObserverTimeEvolution::checkDetection(Candidate *c) const {
+     260             : 
+     261           6 :         if (detList.size()) {
+     262           6 :                 double length = c->getTrajectoryLength();
+     263             :                 size_t index;
+     264           6 :                 const std::string DI = "DetectionIndex";
+     265             :                 std::string value;
+     266             : 
+     267             :                 // Load the last detection index
+     268           6 :                 if (c->hasProperty(DI)) {
+     269           4 :                         index = c->getProperty(DI).asUInt64();
+     270             :                 }
+     271             :                 else {
+     272             :                         index = 0;
+     273             :                 }
+     274             : 
+     275             :                 // Break if the particle has been detected once for all detList entries.
+     276           6 :                 if (index > detList.size()) {
+     277             :                         return NOTHING;
+     278             :                 }
+     279             : 
+     280             :                 // Calculate the distance to next detection
+     281           6 :                 double distance = length - detList[index];
+     282             : 
+     283             :                 // Limit next step and detect candidate.
+     284             :                 // Increase the index by one in case of detection
+     285           6 :                 if (distance < 0.) {
+     286           2 :                         c->limitNextStep(-distance);
+     287             :                         return NOTHING;
+     288             :                 }
+     289             :                 else {
+     290             : 
+     291           4 :                         if (index < detList.size()-1) {
+     292           2 :                                 c->limitNextStep(detList[index+1]-length);
+     293             :                         }
+     294           4 :                         c->setProperty(DI, Variant::fromUInt64(index+1));
+     295             : 
+     296           4 :                         return DETECTED;
+     297             :                 }
+     298             :         }
+     299             :         return NOTHING;
+     300             : }
+     301             : 
+     302           4 : void ObserverTimeEvolution::addTime(const double& t) {
+     303           4 :         detList.push_back(t);
+     304           4 : }
+     305             : 
+     306           2 : void ObserverTimeEvolution::addTimeRange(double min, double max, double numb, bool log) {
+     307           6 :         for (size_t i = 0; i < numb; i++) {
+     308           4 :                 if (log == true) {
+     309           2 :                         addTime(min * pow(max / min, i / (numb - 1.0)));
+     310             :                 } else {
+     311           2 :                         addTime(min + i * (max - min) / numb);
+     312             :                 }
+     313             :         }
+     314           2 : }
+     315             : 
+     316           0 : const std::vector<double>& ObserverTimeEvolution::getTimes() const {
+     317           0 :         return detList;
+     318             : }
+     319             : 
+     320           0 : std::string ObserverTimeEvolution::getDescription() const {
+     321           0 :         std::stringstream s;
+     322           0 :         s << "List of Detection lengths in kpc";
+     323           0 :         for (size_t i = 0; i < detList.size(); i++)
+     324           0 :           s << "  - " << detList[i] / kpc;
+     325           0 :         return s.str();
+     326           0 : }
+     327             : 
+     328             : // ObserverSurface--------------------------------------------------------------
+     329           2 : ObserverSurface::ObserverSurface(Surface* _surface) : surface(_surface) { }
+     330             : 
+     331           4 : DetectionState ObserverSurface::checkDetection(Candidate *candidate) const
+     332             : {
+     333           4 :                 double currentDistance = surface->distance(candidate->current.getPosition());
+     334           4 :                 double previousDistance = surface->distance(candidate->previous.getPosition());
+     335           4 :                 candidate->limitNextStep(fabs(currentDistance));
+     336             : 
+     337           4 :                 if (currentDistance * previousDistance > 0)
+     338             :                         return NOTHING;
+     339           2 :                 else if (previousDistance == 0)
+     340             :                         return NOTHING;
+     341             :                 else
+     342           2 :                         return DETECTED;
+     343             : }
+     344             : 
+     345           0 : std::string ObserverSurface::getDescription() const {
+     346           0 :         std::stringstream ss;
+     347           0 :         ss << "ObserverSurface: << " << surface->getDescription();
+     348           0 :         return ss.str();
+     349           0 : }
+     350             : 
+     351             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/Output.cpp.func-sort-c.html b/doc/coverageReport/src/module/Output.cpp.func-sort-c.html new file mode 100644 index 000000000..8aa2d21bc --- /dev/null +++ b/doc/coverageReport/src/module/Output.cpp.func-sort-c.html @@ -0,0 +1,136 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/Output.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - Output.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:889889.8 %
Date:2024-04-08 14:58:22Functions:141687.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa6Output14setEnergyScaleEd0
_ZN7crpropa6Output14setLengthScaleEd0
_ZN7crpropa6Output10disableAllEv1
_ZN7crpropa6Output14enablePropertyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_7VariantES8_1
_ZN7crpropa6Output7disableENS0_12OutputColumnE1
_ZNK7crpropa6Output4sizeEv1
_ZN7crpropa6Output6enableENS0_12OutputColumnE2
_ZN7crpropa6OutputC2Ev4
_ZN7crpropa6Output9enableAllEv5
_ZN7crpropa6Output13setOutputTypeENS0_10OutputTypeE8
_ZN7crpropa6OutputC2ENS0_10OutputTypeE8
_ZN7crpropa6Output5set1DEb9
_ZN7crpropa6Output14OutputTypeNameB5cxx11ENS0_10OutputTypeE12
_ZN7crpropa6Output3setENS0_12OutputColumnEb38
_ZNK7crpropa6Output7processEPNS_9CandidateE59
_ZN7crpropa6Output6modifyEv65
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/Output.cpp.func.html b/doc/coverageReport/src/module/Output.cpp.func.html new file mode 100644 index 000000000..e967462c5 --- /dev/null +++ b/doc/coverageReport/src/module/Output.cpp.func.html @@ -0,0 +1,136 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/Output.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - Output.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:889889.8 %
Date:2024-04-08 14:58:22Functions:141687.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa6Output10disableAllEv1
_ZN7crpropa6Output13setOutputTypeENS0_10OutputTypeE8
_ZN7crpropa6Output14OutputTypeNameB5cxx11ENS0_10OutputTypeE12
_ZN7crpropa6Output14enablePropertyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_7VariantES8_1
_ZN7crpropa6Output14setEnergyScaleEd0
_ZN7crpropa6Output14setLengthScaleEd0
_ZN7crpropa6Output3setENS0_12OutputColumnEb38
_ZN7crpropa6Output5set1DEb9
_ZN7crpropa6Output6enableENS0_12OutputColumnE2
_ZN7crpropa6Output6modifyEv65
_ZN7crpropa6Output7disableENS0_12OutputColumnE1
_ZN7crpropa6Output9enableAllEv5
_ZN7crpropa6OutputC2ENS0_10OutputTypeE8
_ZN7crpropa6OutputC2Ev4
_ZNK7crpropa6Output4sizeEv1
_ZNK7crpropa6Output7processEPNS_9CandidateE59
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/Output.cpp.gcov.html b/doc/coverageReport/src/module/Output.cpp.gcov.html new file mode 100644 index 000000000..d08f567ad --- /dev/null +++ b/doc/coverageReport/src/module/Output.cpp.gcov.html @@ -0,0 +1,210 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/Output.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - Output.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:889889.8 %
Date:2024-04-08 14:58:22Functions:141687.5 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/Output.h"
+       2             : #include "crpropa/Units.h"
+       3             : 
+       4             : #include <stdexcept>
+       5             : 
+       6             : namespace crpropa {
+       7             : 
+       8           4 : Output::Output() : outputName(OutputTypeName(Everything)), lengthScale(Mpc), energyScale(EeV), oneDimensional(false), count(0) {
+       9           4 :         enableAll();
+      10           4 : }
+      11             : 
+      12           8 : Output::Output(OutputType outputType) : outputName(OutputTypeName(outputType)), lengthScale(Mpc), energyScale(EeV), oneDimensional(false), count(0) {
+      13           8 :         setOutputType(outputType);
+      14           8 : }
+      15             : 
+      16          12 : std::string Output::OutputTypeName(OutputType outputType) {
+      17          12 :         if (outputType == Trajectory1D)
+      18           1 :                 return "Trajectory1D";
+      19          11 :         if (outputType == Event1D)
+      20           4 :                 return "Event1D";
+      21           7 :         if (outputType == Trajectory3D)
+      22           1 :                 return "Trajectory3D";
+      23           6 :         if (outputType == Event3D)
+      24           1 :                 return "Event3D";
+      25           5 :         return "Everything";
+      26             : }
+      27             : 
+      28          65 : void Output::modify() {
+      29          65 :         if (count > 0)
+      30           0 :                 throw std::runtime_error("Output: cannot change Output parameters after data has been written to file.");
+      31          65 : }
+      32             : 
+      33          59 : void Output::process(Candidate *c) const {
+      34          59 :         count++;
+      35          59 : }
+      36             : 
+      37           8 : void Output::setOutputType(OutputType outputtype) {
+      38           8 :         modify();
+      39           8 :         if (outputtype == Trajectory1D) {
+      40             :                 // X, ID, E
+      41           1 :                 set(CurrentPositionColumn, true);
+      42           1 :                 set(CurrentIdColumn, true);
+      43           1 :                 set(CurrentEnergyColumn, true);
+      44           1 :                 set1D(true);
+      45           7 :         } else if (outputtype == Event1D) {
+      46             :                 // D, ID, E, ID0, E0
+      47           4 :                 set(TrajectoryLengthColumn, true);
+      48           4 :                 set(CurrentIdColumn, true);
+      49           4 :                 set(CurrentEnergyColumn, true);
+      50           4 :                 set(SourceIdColumn, true);
+      51           4 :                 set(SourceEnergyColumn, true);
+      52           4 :                 set1D(true);
+      53           3 :         } else if (outputtype == Trajectory3D) {
+      54             :                 // D, ID, E, X, Y, Z, Px, Py, Pz
+      55           1 :                 set(TrajectoryLengthColumn, true);
+      56           1 :                 set(CurrentIdColumn, true);
+      57           1 :                 set(CurrentEnergyColumn, true);
+      58           1 :                 set(CurrentPositionColumn, true);
+      59           1 :                 set(CurrentDirectionColumn, true);
+      60           1 :                 set1D(false);
+      61           2 :         } else if (outputtype == Event3D) {
+      62             :                 // D, ID, E, X, Y, Z, Px, Py, Pz, ID0, E0, X0, Y0, Z0, P0x, P0y, P0z
+      63           1 :                 set(TrajectoryLengthColumn, true);
+      64           1 :                 set(CurrentIdColumn, true);
+      65           1 :                 set(CurrentEnergyColumn, true);
+      66           1 :                 set(CurrentPositionColumn, true);
+      67           1 :                 set(CurrentDirectionColumn, true);
+      68           1 :                 set(SourceIdColumn, true);
+      69           1 :                 set(SourceEnergyColumn, true);
+      70           1 :                 set(SourcePositionColumn, true);
+      71           1 :                 set(SourceDirectionColumn, true);
+      72           1 :                 set1D(false);
+      73           1 :         } else if (outputtype == Everything) {
+      74           1 :                 enableAll();
+      75           1 :                 set1D(false);
+      76             :         } else {
+      77           0 :                 throw std::runtime_error("Output: unknown output type");
+      78             :         }
+      79           8 : }
+      80             : 
+      81           0 : void Output::setEnergyScale(double scale) {
+      82           0 :         modify();
+      83           0 :         energyScale = scale;
+      84           0 : }
+      85             : 
+      86           0 : void Output::setLengthScale(double scale) {
+      87           0 :         modify();
+      88           0 :         lengthScale = scale;
+      89           0 : }
+      90             : 
+      91           9 : void Output::set1D(bool value) {
+      92           9 :         modify();
+      93           9 :         oneDimensional = value;
+      94           9 : }
+      95             : 
+      96           2 : void Output::enable(OutputColumn field) {
+      97           2 :         modify();
+      98           2 :         fields.set(field, true);
+      99           2 : }
+     100             : 
+     101           1 : void Output::disable(OutputColumn field) {
+     102           1 :         modify();
+     103           1 :         fields.set(field, false);
+     104           1 : }
+     105             : 
+     106          38 : void Output::set(OutputColumn field, bool value) {
+     107          38 :         modify();
+     108          38 :         fields.set(field, value);
+     109          38 : }
+     110             : 
+     111           5 : void Output::enableAll() {
+     112           5 :         modify();
+     113             :         fields.set();
+     114           5 : }
+     115             : 
+     116           1 : void Output::disableAll() {
+     117           1 :         modify();
+     118             :         fields.reset();
+     119           1 : }
+     120             : 
+     121           1 : size_t Output::size() const {
+     122           1 :         return count;
+     123             : }
+     124             : 
+     125           1 : void Output::enableProperty(const std::string &property, const Variant &defaultValue, const std::string &comment) {
+     126           1 :         modify();
+     127           1 :         Property prop;
+     128             :         prop.name = property;
+     129             :         prop.comment = comment;
+     130           1 :         prop.defaultValue = defaultValue;
+     131           1 :         properties.push_back(prop);
+     132           1 : };
+     133             : 
+     134             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/OutputShell.cpp.func-sort-c.html b/doc/coverageReport/src/module/OutputShell.cpp.func-sort-c.html new file mode 100644 index 000000000..98f8d83aa --- /dev/null +++ b/doc/coverageReport/src/module/OutputShell.cpp.func-sort-c.html @@ -0,0 +1,96 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/OutputShell.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - OutputShell.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0270.0 %
Date:2024-04-08 14:58:22Functions:060.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa11ShellOutput14getDescriptionB5cxx11Ev0
_ZNK7crpropa11ShellOutput7processEPNS_9CandidateE0
_ZNK7crpropa13ShellOutput1D14getDescriptionB5cxx11Ev0
_ZNK7crpropa13ShellOutput1D7processEPNS_9CandidateE0
_ZNK7crpropa19ShellPropertyOutput14getDescriptionB5cxx11Ev0
_ZNK7crpropa19ShellPropertyOutput7processEPNS_9CandidateE0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/OutputShell.cpp.func.html b/doc/coverageReport/src/module/OutputShell.cpp.func.html new file mode 100644 index 000000000..2ba776c67 --- /dev/null +++ b/doc/coverageReport/src/module/OutputShell.cpp.func.html @@ -0,0 +1,96 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/OutputShell.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - OutputShell.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0270.0 %
Date:2024-04-08 14:58:22Functions:060.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa11ShellOutput14getDescriptionB5cxx11Ev0
_ZNK7crpropa11ShellOutput7processEPNS_9CandidateE0
_ZNK7crpropa13ShellOutput1D14getDescriptionB5cxx11Ev0
_ZNK7crpropa13ShellOutput1D7processEPNS_9CandidateE0
_ZNK7crpropa19ShellPropertyOutput14getDescriptionB5cxx11Ev0
_ZNK7crpropa19ShellPropertyOutput7processEPNS_9CandidateE0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/OutputShell.cpp.gcov.html b/doc/coverageReport/src/module/OutputShell.cpp.gcov.html new file mode 100644 index 000000000..5ac2e949a --- /dev/null +++ b/doc/coverageReport/src/module/OutputShell.cpp.gcov.html @@ -0,0 +1,134 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/OutputShell.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - OutputShell.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0270.0 %
Date:2024-04-08 14:58:22Functions:060.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/OutputShell.h"
+       2             : #include "crpropa/Units.h"
+       3             : 
+       4             : #include <iomanip>
+       5             : 
+       6             : namespace crpropa {
+       7             : 
+       8           0 : void ShellOutput::process(Candidate* c) const {
+       9           0 : #pragma omp critical
+      10             :         {
+      11             :                 std::cout << std::fixed << std::showpoint << std::setprecision(3)
+      12             :                                 << std::setw(6);
+      13           0 :                 std::cout << c->getTrajectoryLength() / Mpc << " Mpc,  ";
+      14           0 :                 std::cout << c->getRedshift() << ",  ";
+      15           0 :                 std::cout << c->current.getId() << ",  ";
+      16           0 :                 std::cout << c->current.getEnergy() / EeV << " EeV,  ";
+      17           0 :                 std::cout << c->current.getPosition() / Mpc << " Mpc,  ";
+      18           0 :                 std::cout << c->current.getDirection();
+      19             :                 std::cout << std::endl;
+      20             :         }
+      21           0 : }
+      22             : 
+      23           0 : std::string ShellOutput::getDescription() const {
+      24           0 :         return "Shell output";
+      25             : }
+      26             : 
+      27           0 : void ShellOutput1D::process(Candidate* c) const {
+      28           0 : #pragma omp critical
+      29             :         {
+      30             :                 std::cout << std::fixed << std::showpoint << std::setprecision(3)
+      31             :                                 << std::setw(6);
+      32           0 :                 std::cout << c->current.getPosition().x / Mpc << " Mpc,  ";
+      33           0 :                 std::cout << c->getRedshift() << ",  ";
+      34           0 :                 std::cout << c->current.getId() << ",  ";
+      35           0 :                 std::cout << c->current.getEnergy() / EeV << " EeV";
+      36             :                 std::cout << std::endl;
+      37             :         }
+      38           0 : }
+      39             : 
+      40           0 : std::string ShellOutput1D::getDescription() const {
+      41           0 :         return "Shell output for 1D";
+      42             : }
+      43             : 
+      44           0 : void ShellPropertyOutput::process(Candidate* c) const {
+      45             :         Candidate::PropertyMap::const_iterator i = c->properties.begin();
+      46           0 : #pragma omp critical
+      47             :         {
+      48           0 :                 for ( ; i != c->properties.end(); i++) {
+      49           0 :                         std::cout << "  " << i->first << ", " << i->second << std::endl;
+      50             :                 }
+      51             :         }
+      52           0 : }
+      53             : 
+      54           0 : std::string ShellPropertyOutput::getDescription() const {
+      55           0 :         return "Shell property output";
+      56             : }
+      57             : 
+      58             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/ParticleCollector.cpp.func-sort-c.html b/doc/coverageReport/src/module/ParticleCollector.cpp.func-sort-c.html new file mode 100644 index 000000000..066818d57 --- /dev/null +++ b/doc/coverageReport/src/module/ParticleCollector.cpp.func-sort-c.html @@ -0,0 +1,168 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/ParticleCollector.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - ParticleCollector.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:547275.0 %
Date:2024-04-08 14:58:22Functions:172470.8 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa17ParticleCollectorC2Em0
_ZN7crpropa17ParticleCollectorC2Emb0
_ZN7crpropa17ParticleCollectorC2Embb0
_ZNK7crpropa17ParticleCollector14getDescriptionB5cxx11Ev0
_ZNK7crpropa17ParticleCollector3endEv0
_ZNK7crpropa17ParticleCollector5beginEv0
_ZNK7crpropa17ParticleCollector8getCloneEv0
_ZN7crpropa17ParticleCollector4loadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZNK7crpropa17ParticleCollector13getTrajectoryENS_7ref_ptrINS_10ModuleListEEEmNS1_INS_6ModuleEEE1
_ZNK7crpropa17ParticleCollector13getTrajectoryEPNS_10ModuleListEmPNS_6ModuleE1
_ZNK7crpropa17ParticleCollector4dumpERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa17ParticleCollector8setCloneEb2
_ZNK7crpropa17ParticleCollector12getContainerEv2
_ZNK7crpropa17ParticleCollector9reprocessEPNS_6ModuleE2
_ZN7crpropa17ParticleCollector5beginEv5
_ZNK7crpropa17ParticleCollector4sizeEv6
_ZN7crpropa17ParticleCollectorD0Ev8
_ZNK7crpropa17ParticleCollectorixEm8
_ZN7crpropa17ParticleCollector14clearContainerEv14
_ZN7crpropa17ParticleCollectorC2Ev14
_ZN7crpropa17ParticleCollectorD2Ev14
_ZN7crpropa17ParticleCollector3endEv30
_ZNK7crpropa17ParticleCollector7processENS_7ref_ptrINS_9CandidateEEE30
_ZNK7crpropa17ParticleCollector7processEPNS_9CandidateE3206
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/ParticleCollector.cpp.func.html b/doc/coverageReport/src/module/ParticleCollector.cpp.func.html new file mode 100644 index 000000000..a393ca64a --- /dev/null +++ b/doc/coverageReport/src/module/ParticleCollector.cpp.func.html @@ -0,0 +1,168 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/ParticleCollector.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - ParticleCollector.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:547275.0 %
Date:2024-04-08 14:58:22Functions:172470.8 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa17ParticleCollector14clearContainerEv14
_ZN7crpropa17ParticleCollector3endEv30
_ZN7crpropa17ParticleCollector4loadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa17ParticleCollector5beginEv5
_ZN7crpropa17ParticleCollector8setCloneEb2
_ZN7crpropa17ParticleCollectorC2Em0
_ZN7crpropa17ParticleCollectorC2Emb0
_ZN7crpropa17ParticleCollectorC2Embb0
_ZN7crpropa17ParticleCollectorC2Ev14
_ZN7crpropa17ParticleCollectorD0Ev8
_ZN7crpropa17ParticleCollectorD2Ev14
_ZNK7crpropa17ParticleCollector12getContainerEv2
_ZNK7crpropa17ParticleCollector13getTrajectoryENS_7ref_ptrINS_10ModuleListEEEmNS1_INS_6ModuleEEE1
_ZNK7crpropa17ParticleCollector13getTrajectoryEPNS_10ModuleListEmPNS_6ModuleE1
_ZNK7crpropa17ParticleCollector14getDescriptionB5cxx11Ev0
_ZNK7crpropa17ParticleCollector3endEv0
_ZNK7crpropa17ParticleCollector4dumpERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZNK7crpropa17ParticleCollector4sizeEv6
_ZNK7crpropa17ParticleCollector5beginEv0
_ZNK7crpropa17ParticleCollector7processENS_7ref_ptrINS_9CandidateEEE30
_ZNK7crpropa17ParticleCollector7processEPNS_9CandidateE3206
_ZNK7crpropa17ParticleCollector8getCloneEv0
_ZNK7crpropa17ParticleCollector9reprocessEPNS_6ModuleE2
_ZNK7crpropa17ParticleCollectorixEm8
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/ParticleCollector.cpp.gcov.html b/doc/coverageReport/src/module/ParticleCollector.cpp.gcov.html new file mode 100644 index 000000000..b881f5f25 --- /dev/null +++ b/doc/coverageReport/src/module/ParticleCollector.cpp.gcov.html @@ -0,0 +1,194 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/ParticleCollector.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - ParticleCollector.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:547275.0 %
Date:2024-04-08 14:58:22Functions:172470.8 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/ParticleCollector.h"
+       2             : #include "crpropa/module/TextOutput.h"
+       3             : #include "crpropa/Units.h"
+       4             : 
+       5             : namespace crpropa {
+       6             : 
+       7          14 : ParticleCollector::ParticleCollector() : nBuffer(10e6), clone(false), recursive(false)  {
+       8          14 :         container.reserve(nBuffer); // for 1e6 candidates ~ 500MB of RAM
+       9          14 : }
+      10             : 
+      11           0 : ParticleCollector::ParticleCollector(const std::size_t nBuffer) : clone(false), recursive(false)  {
+      12           0 :         container.reserve(nBuffer);
+      13           0 : }
+      14             : 
+      15           0 : ParticleCollector::ParticleCollector(const std::size_t nBuffer, const bool clone) : recursive(false) {
+      16           0 :         container.reserve(nBuffer);
+      17           0 : }
+      18             : 
+      19           0 : ParticleCollector::ParticleCollector(const std::size_t nBuffer, const bool clone, const bool recursive) {
+      20           0 :         container.reserve(nBuffer);
+      21           0 : }
+      22             : 
+      23        3206 : void ParticleCollector::process(Candidate *c) const {
+      24        6412 : #pragma omp critical
+      25             :         {
+      26        3206 :                 if(clone)
+      27          50 :                         container.push_back(c->clone(recursive));
+      28             :                 else
+      29        6362 :                         container.push_back(c);
+      30             :         }
+      31        3206 : }
+      32             : 
+      33          30 : void ParticleCollector::process(ref_ptr<Candidate> c) const {
+      34          30 :         ParticleCollector::process((Candidate*) c);
+      35          30 : }
+      36             : 
+      37           2 : void ParticleCollector::reprocess(Module *action) const {
+      38          14 :         for (ParticleCollector::iterator itr = container.begin(); itr != container.end(); ++itr){
+      39          12 :                 if (clone)
+      40           0 :                         action->process((*(itr->get())).clone(false));
+      41             :                 else
+      42          12 :                         action->process(itr->get());
+      43             :         }
+      44           2 : }
+      45             : 
+      46           1 : void ParticleCollector::dump(const std::string &filename) const {
+      47           1 :         TextOutput output(filename.c_str(), Output::Everything);
+      48           1 :         reprocess(&output);
+      49           1 :         output.close();
+      50           1 : }
+      51             : 
+      52           1 : void ParticleCollector::load(const std::string &filename){
+      53           1 :         TextOutput::load(filename.c_str(), this);
+      54           1 : }
+      55             : 
+      56          22 : ParticleCollector::~ParticleCollector() {
+      57          14 :         clearContainer();
+      58          22 : }
+      59             : 
+      60           6 : std::size_t ParticleCollector::size() const {
+      61           6 :         return container.size();
+      62             : }
+      63             : 
+      64           8 : ref_ptr<Candidate> ParticleCollector::operator[](const std::size_t i) const {
+      65           8 :         return container[i];
+      66             : }
+      67             : 
+      68          14 : void ParticleCollector::clearContainer() {
+      69          14 :         container.clear();
+      70          14 : }
+      71             : 
+      72           2 : std::vector<ref_ptr<Candidate> >& ParticleCollector::getContainer() const {
+      73           2 :         return container;
+      74             : }
+      75             : 
+      76           2 : void ParticleCollector::setClone(bool b) {
+      77           2 :         clone = b;
+      78           2 : }
+      79             : 
+      80           0 : bool ParticleCollector::getClone() const {
+      81           0 :         return clone;
+      82             : }
+      83             : 
+      84           0 : std::string ParticleCollector::getDescription() const {
+      85           0 :         return "ParticleCollector";
+      86             : }
+      87             : 
+      88           5 : ParticleCollector::iterator ParticleCollector::begin() {
+      89           5 :         return container.begin();
+      90             : }
+      91             : 
+      92           0 : ParticleCollector::const_iterator ParticleCollector::begin() const {
+      93           0 :         return container.begin();
+      94             : }
+      95             : 
+      96          30 : ParticleCollector::iterator ParticleCollector::end() {
+      97          30 :         return container.end();
+      98             : }
+      99             : 
+     100           0 : ParticleCollector::const_iterator ParticleCollector::end() const {
+     101           0 :         return container.end();
+     102             : }
+     103             : 
+     104           1 : void ParticleCollector::getTrajectory(ModuleList* mlist, std::size_t i, Module *output) const {
+     105           1 :         ref_ptr<Candidate> c_tmp = container[i]->clone();
+     106             : 
+     107           1 :         c_tmp->restart();
+     108             : 
+     109           1 :         mlist->add(output);
+     110           1 :         mlist->run(c_tmp);
+     111           1 :         mlist->remove(mlist->size()-1);
+     112           1 : }
+     113             : 
+     114           1 : void ParticleCollector::getTrajectory(ref_ptr<ModuleList> mlist, std::size_t i, ref_ptr<Module> output) const {
+     115           1 :         ParticleCollector::getTrajectory((ModuleList*) mlist, i, (Module*) output);
+     116           1 : }
+     117             : 
+     118             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/PhotoDisintegration.cpp.func-sort-c.html b/doc/coverageReport/src/module/PhotoDisintegration.cpp.func-sort-c.html new file mode 100644 index 000000000..3a3f0982b --- /dev/null +++ b/doc/coverageReport/src/module/PhotoDisintegration.cpp.func-sort-c.html @@ -0,0 +1,120 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/PhotoDisintegration.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - PhotoDisintegration.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:14017580.0 %
Date:2024-04-08 14:58:22Functions:101283.3 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa19PhotoDisintegration10lossLengthEidd0
_ZN7crpropa19PhotoDisintegration8setLimitEd0
_ZN7crpropa19PhotoDisintegration14setHavePhotonsEb1
_ZN7crpropa19PhotoDisintegration17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZNK7crpropa19PhotoDisintegration17getInteractionTagB5cxx11Ev2
_ZN7crpropa19PhotoDisintegrationC2ENS_7ref_ptrINS_11PhotonFieldEEEbd11
_ZN7crpropa19PhotoDisintegration13initBranchingENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE22
_ZN7crpropa19PhotoDisintegration14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE22
_ZN7crpropa19PhotoDisintegration18initPhotonEmissionENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE22
_ZN7crpropa19PhotoDisintegration8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE22
_ZNK7crpropa19PhotoDisintegration18performInteractionEPNS_9CandidateEi265
_ZNK7crpropa19PhotoDisintegration7processEPNS_9CandidateE16849
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/PhotoDisintegration.cpp.func.html b/doc/coverageReport/src/module/PhotoDisintegration.cpp.func.html new file mode 100644 index 000000000..7207f6b5b --- /dev/null +++ b/doc/coverageReport/src/module/PhotoDisintegration.cpp.func.html @@ -0,0 +1,120 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/PhotoDisintegration.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - PhotoDisintegration.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:14017580.0 %
Date:2024-04-08 14:58:22Functions:101283.3 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa19PhotoDisintegration10lossLengthEidd0
_ZN7crpropa19PhotoDisintegration13initBranchingENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE22
_ZN7crpropa19PhotoDisintegration14setHavePhotonsEb1
_ZN7crpropa19PhotoDisintegration14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE22
_ZN7crpropa19PhotoDisintegration17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa19PhotoDisintegration18initPhotonEmissionENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE22
_ZN7crpropa19PhotoDisintegration8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE22
_ZN7crpropa19PhotoDisintegration8setLimitEd0
_ZN7crpropa19PhotoDisintegrationC2ENS_7ref_ptrINS_11PhotonFieldEEEbd11
_ZNK7crpropa19PhotoDisintegration17getInteractionTagB5cxx11Ev2
_ZNK7crpropa19PhotoDisintegration18performInteractionEPNS_9CandidateEi265
_ZNK7crpropa19PhotoDisintegration7processEPNS_9CandidateE16849
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/PhotoDisintegration.cpp.gcov.html b/doc/coverageReport/src/module/PhotoDisintegration.cpp.gcov.html new file mode 100644 index 000000000..9d6164c97 --- /dev/null +++ b/doc/coverageReport/src/module/PhotoDisintegration.cpp.gcov.html @@ -0,0 +1,406 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/PhotoDisintegration.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - PhotoDisintegration.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:14017580.0 %
Date:2024-04-08 14:58:22Functions:101283.3 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/PhotoDisintegration.h"
+       2             : #include "crpropa/Units.h"
+       3             : #include "crpropa/ParticleID.h"
+       4             : #include "crpropa/ParticleMass.h"
+       5             : #include "crpropa/Random.h"
+       6             : #include "kiss/logger.h"
+       7             : 
+       8             : #include <cmath>
+       9             : #include <limits>
+      10             : #include <sstream>
+      11             : #include <fstream>
+      12             : #include <stdexcept>
+      13             : 
+      14             : namespace crpropa {
+      15             : 
+      16             : const double PhotoDisintegration::lgmin = 6;  // minimum log10(Lorentz-factor)
+      17             : const double PhotoDisintegration::lgmax = 14; // maximum log10(Lorentz-factor)
+      18             : const size_t PhotoDisintegration::nlg = 201;  // number of Lorentz-factor steps
+      19             : 
+      20          11 : PhotoDisintegration::PhotoDisintegration(ref_ptr<PhotonField> f, bool havePhotons, double limit) {
+      21          11 :         setPhotonField(f);
+      22          11 :         this->havePhotons = havePhotons;
+      23          11 :         this->limit = limit;
+      24          11 : }
+      25             : 
+      26          22 : void PhotoDisintegration::setPhotonField(ref_ptr<PhotonField> photonField) {
+      27          22 :         this->photonField = photonField;
+      28          22 :         std::string fname = photonField->getFieldName();
+      29          22 :         setDescription("PhotoDisintegration: " + fname);
+      30          66 :         initRate(getDataPath("Photodisintegration/rate_" + fname + ".txt"));
+      31          66 :         initBranching(getDataPath("Photodisintegration/branching_" + fname + ".txt"));
+      32          66 :         initPhotonEmission(getDataPath("Photodisintegration/photon_emission_" + fname.substr(0,3) + ".txt"));
+      33          22 : }
+      34             : 
+      35           1 : void PhotoDisintegration::setHavePhotons(bool havePhotons) {
+      36           1 :         this->havePhotons = havePhotons;
+      37           1 : }
+      38             : 
+      39           0 : void PhotoDisintegration::setLimit(double limit) {
+      40           0 :         this->limit = limit;
+      41           0 : }
+      42             : 
+      43          22 : void PhotoDisintegration::initRate(std::string filename) {
+      44          22 :         std::ifstream infile(filename.c_str());
+      45          22 :         if (not infile.good())
+      46           0 :                 throw std::runtime_error("PhotoDisintegration: could not open file " + filename);
+      47             : 
+      48             :         // clear previously loaded interaction rates
+      49          22 :         pdRate.clear();
+      50          22 :         pdRate.resize(27 * 31);
+      51             : 
+      52             :         std::string line;
+      53        4158 :         while (std::getline(infile, line)) {
+      54        4136 :                 if (line[0] == '#')
+      55          66 :                         continue;
+      56        4070 :                 std::stringstream lineStream(line);
+      57             : 
+      58             :                 int Z, N;
+      59        4070 :                 lineStream >> Z;
+      60        4070 :                 lineStream >> N;
+      61             : 
+      62             :                 double r;
+      63      822140 :                 for (size_t i = 0; i < nlg; i++) {
+      64             :                         lineStream >> r;
+      65      818070 :                         pdRate[Z * 31 + N].push_back(r / Mpc);
+      66             :                 }
+      67        4070 :         }
+      68          22 :         infile.close();
+      69          22 : }
+      70             : 
+      71          22 : void PhotoDisintegration::initBranching(std::string filename) {
+      72          22 :         std::ifstream infile(filename.c_str());
+      73          22 :         if (not infile.good())
+      74           0 :                 throw std::runtime_error("PhotoDisintegration: could not open file " + filename);
+      75             : 
+      76             :         // clear previously loaded interaction rates
+      77          22 :         pdBranch.clear();
+      78          22 :         pdBranch.resize(27 * 31);
+      79             : 
+      80             :         std::string line;
+      81       48532 :         while (std::getline(infile, line)) {
+      82       48510 :                 if (line[0] == '#')
+      83          66 :                         continue;
+      84             : 
+      85       48444 :                 std::stringstream lineStream(line);
+      86             : 
+      87             :                 int Z, N;
+      88       48444 :                 lineStream >> Z;
+      89       48444 :                 lineStream >> N;
+      90             : 
+      91             :                 Branch branch;
+      92       48444 :                 lineStream >> branch.channel;
+      93             : 
+      94             :                 double r;
+      95     9785688 :                 for (size_t i = 0; i < nlg; i++) {
+      96             :                         lineStream >> r;
+      97     9737244 :                         branch.branchingRatio.push_back(r);
+      98             :                 }
+      99             : 
+     100       48444 :                 pdBranch[Z * 31 + N].push_back(branch);
+     101       48444 :         }
+     102             : 
+     103          22 :         infile.close();
+     104          22 : }
+     105             : 
+     106          22 : void PhotoDisintegration::initPhotonEmission(std::string filename) {
+     107          22 :         std::ifstream infile(filename.c_str());
+     108          22 :         if (not infile.good())
+     109           0 :                 throw std::runtime_error("PhotoDisintegration: could not open file " + filename);
+     110             : 
+     111             :         // clear previously loaded emission probabilities
+     112          22 :         pdPhoton.clear();
+     113             : 
+     114             :         std::string line;
+     115      209154 :         while (std::getline(infile, line)) {
+     116      209132 :                 if (line[0] == '#')
+     117          66 :                         continue;
+     118             : 
+     119      209066 :                 std::stringstream lineStream(line);
+     120             : 
+     121             :                 int Z, N, Zd, Nd;
+     122      209066 :                 lineStream >> Z;
+     123      209066 :                 lineStream >> N;
+     124      209066 :                 lineStream >> Zd;
+     125      209066 :                 lineStream >> Nd;
+     126             : 
+     127             :                 PhotonEmission em;
+     128             :                 lineStream >> em.energy;
+     129      209066 :                 em.energy *= eV;
+     130             : 
+     131             :                 double r;
+     132    42231332 :                 for (size_t i = 0; i < nlg; i++) {
+     133             :                         lineStream >> r;
+     134    42022266 :                         em.emissionProbability.push_back(r);
+     135             :                 }
+     136             : 
+     137      209066 :                 int key = Z * 1000000 + N * 10000 + Zd * 100 + Nd;
+     138      209066 :                 if (pdPhoton.find(key) == pdPhoton.end()) {
+     139             :                         std::vector<PhotonEmission> emissions;
+     140       41096 :                         pdPhoton[key] = emissions;
+     141       41096 :                 }
+     142      209066 :                 pdPhoton[key].push_back(em);
+     143      209066 :         }
+     144             : 
+     145          22 :         infile.close();
+     146          22 : }
+     147             : 
+     148       16849 : void PhotoDisintegration::process(Candidate *candidate) const {
+     149             :         // execute the loop at least once for limiting the next step
+     150       16849 :         double step = candidate->getCurrentStep();
+     151             :         do {
+     152             :                 // check if nucleus
+     153       17112 :                 int id = candidate->current.getId();
+     154       17112 :                 if (not isNucleus(id))
+     155             :                         return;
+     156             : 
+     157       17111 :                 int A = massNumber(id);
+     158       17111 :                 int Z = chargeNumber(id);
+     159       17111 :                 int N = A - Z;
+     160       17111 :                 size_t idx = Z * 31 + N;
+     161             : 
+     162             :                 // check if disintegration data available
+     163       17111 :                 if ((Z > 26) or (N > 30))
+     164             :                         return;
+     165       17111 :                 if (pdRate[idx].size() == 0)
+     166             :                         return;
+     167             : 
+     168             :                 // check if in tabulated energy range
+     169        1517 :                 double z = candidate->getRedshift();
+     170        1517 :                 double lg = log10(candidate->current.getLorentzFactor() * (1 + z));
+     171        1517 :                 if ((lg <= lgmin) or (lg >= lgmax))
+     172             :                         return;
+     173             : 
+     174        1517 :                 double rate = interpolateEquidistant(lg, lgmin, lgmax, pdRate[idx]);
+     175        1517 :                 rate *= pow_integer<2>(1 + z) * photonField->getRedshiftScaling(z); // cosmological scaling, rate per comoving distance
+     176             : 
+     177             :                 // check if interaction occurs in this step
+     178             :                 // otherwise limit next step to a fraction of the mean free path
+     179        1517 :                 Random &random = Random::instance();
+     180        1517 :                 double randDist = -log(random.rand()) / rate;
+     181        1517 :                 if (step < randDist) {
+     182        1254 :                         candidate->limitNextStep(limit / rate);
+     183        1254 :                         return;
+     184             :                 }
+     185             : 
+     186             :                 // select channel and interact
+     187             :                 const std::vector<Branch> &branches = pdBranch[idx];
+     188         263 :                 double cmp = random.rand();
+     189         263 :                 int l = round((lg - lgmin) / (lgmax - lgmin) * (nlg - 1)); // index of closest tabulation point
+     190             :                 size_t i = 0;
+     191        2133 :                 while ((i < branches.size()) and (cmp > 0)) {
+     192        1870 :                         cmp -= branches[i].branchingRatio[l];
+     193        1870 :                         i++;
+     194             :                 }
+     195         263 :                 performInteraction(candidate, branches[i-1].channel);
+     196             : 
+     197             :                 // repeat with remaining step
+     198         263 :                 step -= randDist;
+     199         263 :         } while (step > 0);
+     200             : }
+     201             : 
+     202         265 : void PhotoDisintegration::performInteraction(Candidate *candidate, int channel) const {
+     203         265 :         KISS_LOG_DEBUG << "Photodisintegration::performInteraction. Channel " <<  channel << " on candidate " << candidate->getDescription(); 
+     204             :         // parse disintegration channel
+     205             :         int nNeutron = digit(channel, 100000);
+     206             :         int nProton = digit(channel, 10000);
+     207             :         int nH2 = digit(channel, 1000);
+     208             :         int nH3 = digit(channel, 100);
+     209             :         int nHe3 = digit(channel, 10);
+     210             :         int nHe4 = digit(channel, 1);
+     211             : 
+     212         265 :         int dA = -nNeutron - nProton - 2 * nH2 - 3 * nH3 - 3 * nHe3 - 4 * nHe4;
+     213         265 :         int dZ = -nProton - nH2 - nH3 - 2 * nHe3 - 2 * nHe4;
+     214             : 
+     215         265 :         int id = candidate->current.getId();
+     216         265 :         int A = massNumber(id);
+     217         265 :         int Z = chargeNumber(id);
+     218         265 :         double EpA = candidate->current.getEnergy() / A;
+     219             : 
+     220             :         // create secondaries
+     221         265 :         Random &random = Random::instance();
+     222         265 :         Vector3d pos = random.randomInterpolatedPosition(candidate->previous.getPosition(), candidate->current.getPosition());
+     223             :         try
+     224             :         {
+     225         458 :                 for (size_t i = 0; i < nNeutron; i++)
+     226         193 :                         candidate->addSecondary(nucleusId(1, 0), EpA, pos, 1., interactionTag);
+     227         379 :                 for (size_t i = 0; i < nProton; i++)
+     228         114 :                         candidate->addSecondary(nucleusId(1, 1), EpA, pos, 1., interactionTag);
+     229         265 :                 for (size_t i = 0; i < nH2; i++)
+     230           0 :                         candidate->addSecondary(nucleusId(2, 1), EpA * 2, pos, 1., interactionTag);
+     231         267 :                 for (size_t i = 0; i < nH3; i++)
+     232           2 :                         candidate->addSecondary(nucleusId(3, 1), EpA * 3, pos, 1., interactionTag);
+     233         265 :                 for (size_t i = 0; i < nHe3; i++)
+     234           0 :                         candidate->addSecondary(nucleusId(3, 2), EpA * 3, pos, 1., interactionTag);
+     235         309 :                 for (size_t i = 0; i < nHe4; i++)
+     236          44 :                         candidate->addSecondary(nucleusId(4, 2), EpA * 4, pos, 1., interactionTag);
+     237             : 
+     238             : 
+     239             :         // update particle
+     240             :           candidate->created = candidate->current;
+     241         265 :                 candidate->current.setId(nucleusId(A + dA, Z + dZ));
+     242         265 :                 candidate->current.setEnergy(EpA * (A + dA));
+     243             :         }
+     244           0 :         catch (std::runtime_error &e)
+     245             :         {
+     246           0 :                 KISS_LOG_ERROR << "Something went wrong in the PhotoDisentigration\n" << "Please report this error on https://github.com/CRPropa/CRPropa3/issues including your simulation setup and the following random seed:\n" << Random::instance().getSeed_base64();
+     247           0 :                 throw;
+     248           0 :         }
+     249             : 
+     250         265 :         if (not havePhotons)
+     251             :                 return;
+     252             : 
+     253             :         // create photons
+     254          32 :         double z = candidate->getRedshift();
+     255          32 :         double lg = log10(candidate->current.getLorentzFactor() * (1 + z));
+     256          32 :         double lf = candidate->current.getLorentzFactor();
+     257             : 
+     258          32 :         int l = round((lg - lgmin) / (lgmax - lgmin) * (nlg - 1));  // index of closest tabulation point
+     259          32 :         int key = Z*1e6 + (A-Z)*1e4 + (Z+dZ)*1e2 + (A+dA) - (Z+dZ);
+     260             : 
+     261         227 :         for (int i = 0; i < pdPhoton[key].size(); i++) {
+     262             :                 // check for random emission
+     263         195 :                 if (random.rand() > pdPhoton[key][i].emissionProbability[l])
+     264         162 :                         continue;
+     265             : 
+     266             :                 // boost to lab frame
+     267          33 :                 double cosTheta = 2 * random.rand() - 1;
+     268          33 :                 double E = pdPhoton[key][i].energy * lf * (1 - cosTheta);
+     269          33 :                 candidate->addSecondary(22, E, pos, 1., interactionTag);
+     270             :         }
+     271             : }
+     272             : 
+     273           0 : double PhotoDisintegration::lossLength(int id, double gamma, double z) {
+     274             :         // check if nucleus
+     275           0 :         if (not (isNucleus(id)))
+     276             :                 return std::numeric_limits<double>::max();
+     277             : 
+     278           0 :         int A = massNumber(id);
+     279           0 :         int Z = chargeNumber(id);
+     280           0 :         int N = A - Z;
+     281           0 :         size_t idx = Z * 31 + N;
+     282             : 
+     283             :         // check if disintegration data available
+     284           0 :         if ((Z > 26) or (N > 30))
+     285             :                 return std::numeric_limits<double>::max();
+     286             :         const std::vector<double> &rate = pdRate[idx];
+     287           0 :         if (rate.size() == 0)
+     288             :                 return std::numeric_limits<double>::max();
+     289             : 
+     290             :         // check if in tabulated energy range
+     291           0 :         double lg = log10(gamma * (1 + z));
+     292           0 :         if ((lg <= lgmin) or (lg >= lgmax))
+     293             :                 return std::numeric_limits<double>::max();
+     294             : 
+     295             :         // total interaction rate
+     296           0 :         double lossRate = interpolateEquidistant(lg, lgmin, lgmax, rate);
+     297             : 
+     298             :         // comological scaling, rate per physical distance
+     299           0 :         lossRate *= pow_integer<3>(1 + z) * photonField->getRedshiftScaling(z);
+     300             : 
+     301             :         // average number of nucleons lost for all disintegration channels
+     302             :         double avg_dA = 0;
+     303             :         const std::vector<Branch> &branches = pdBranch[idx];
+     304           0 :         for (size_t i = 0; i < branches.size(); i++) {
+     305           0 :                 int channel = branches[i].channel;
+     306             :                 int dA = 0;
+     307             :                 dA += 1 * digit(channel, 100000);
+     308           0 :                 dA += 1 * digit(channel, 10000);
+     309           0 :                 dA += 2 * digit(channel, 1000);
+     310           0 :                 dA += 3 * digit(channel, 100);
+     311           0 :                 dA += 3 * digit(channel, 10);
+     312           0 :                 dA += 4 * digit(channel, 1);
+     313             : 
+     314           0 :                 double br = interpolateEquidistant(lg, lgmin, lgmax, branches[i].branchingRatio);
+     315           0 :                 avg_dA += br * dA;
+     316             :         }
+     317             : 
+     318           0 :         lossRate *= avg_dA / A;
+     319           0 :         return 1 / lossRate;
+     320             : }
+     321             : 
+     322           1 : void PhotoDisintegration::setInteractionTag(std::string tag) {
+     323           1 :         interactionTag = tag;
+     324           1 : }
+     325             : 
+     326           2 : std::string PhotoDisintegration::getInteractionTag() const {
+     327           2 :         return interactionTag;
+     328             : }
+     329             : 
+     330             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/PhotoPionProduction.cpp.func-sort-c.html b/doc/coverageReport/src/module/PhotoPionProduction.cpp.func-sort-c.html new file mode 100644 index 000000000..7b6272449 --- /dev/null +++ b/doc/coverageReport/src/module/PhotoPionProduction.cpp.func-sort-c.html @@ -0,0 +1,232 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/PhotoPionProduction.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - PhotoPionProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:24638763.6 %
Date:2024-04-08 14:58:22Functions:244060.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa19PhotoPionProduction10lossLengthEidd0
_ZN7crpropa19PhotoPionProduction12setSampleLogEb0
_ZN7crpropa19PhotoPionProduction16setHaveElectronsEb0
_ZN7crpropa19PhotoPionProduction16setHaveNeutrinosEb0
_ZN7crpropa19PhotoPionProduction19setCorrectionFactorEd0
_ZN7crpropa19PhotoPionProduction19setHaveAntiNucleonsEb0
_ZN7crpropa19PhotoPionProduction25setHaveRedshiftDependenceEb0
_ZN7crpropa19PhotoPionProduction8setLimitEd0
_ZNK7crpropa19PhotoPionProduction11sophiaEventEbdd0
_ZNK7crpropa19PhotoPionProduction12getSampleLogEv0
_ZNK7crpropa19PhotoPionProduction14getHavePhotonsEv0
_ZNK7crpropa19PhotoPionProduction16getHaveElectronsEv0
_ZNK7crpropa19PhotoPionProduction16getHaveNeutrinosEv0
_ZNK7crpropa19PhotoPionProduction19getHaveAntiNucleonsEv0
_ZNK7crpropa19PhotoPionProduction25getHaveRedshiftDependenceEv0
_ZNK7crpropa19PhotoPionProduction8getLimitEv0
_ZN7crpropa19PhotoPionProduction14setHavePhotonsEb1
_ZN7crpropa19PhotoPionProduction17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZNK7crpropa19PhotoPionProduction14getPhotonFieldEv1
_ZNK7crpropa19PhotoPionProduction19getCorrectionFactorEv1
_ZNK7crpropa19PhotoPionProduction17getInteractionTagB5cxx11Ev2
_ZN7crpropa19PhotoPionProductionC2ENS_7ref_ptrINS_11PhotonFieldEEEbbbbdb11
_ZN7crpropa19PhotoPionProduction14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE22
_ZN7crpropa19PhotoPionProduction8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE22
_ZNK7crpropa19PhotoPionProduction17epsMinInteractionEbd28
_ZNK7crpropa19PhotoPionProduction18performInteractionEPNS_9CandidateEb28
_ZNK7crpropa19PhotoPionProduction9sampleEpsEbdd28
_ZNK7crpropa19PhotoPionProduction10probEpsMaxEbdddd29
_ZNK7crpropa19PhotoPionProduction7probEpsEdbdd10689
_ZNK7crpropa19PhotoPionProduction8momentumEbd10717
_ZNK7crpropa19PhotoPionProduction7processEPNS_9CandidateE15289
_ZNK7crpropa19PhotoPionProduction10nucleonMFPEddb16206
_ZNK7crpropa19PhotoPionProduction18nucleiModificationEii16206
_ZNK7crpropa19PhotoPionProduction11crossectionEdb170560
_ZNK7crpropa19PhotoPionProduction6functsEdb170560
_ZNK7crpropa19PhotoPionProduction4sMinEv191909
_ZNK7crpropa19PhotoPionProduction2PlEdddd320502
_ZNK7crpropa19PhotoPionProduction11breitwignerEddddb1442259
_ZNK7crpropa19PhotoPionProduction2EfEddd1612819
_ZNK7crpropa19PhotoPionProduction4massEb1815502
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/PhotoPionProduction.cpp.func.html b/doc/coverageReport/src/module/PhotoPionProduction.cpp.func.html new file mode 100644 index 000000000..4e52c0c59 --- /dev/null +++ b/doc/coverageReport/src/module/PhotoPionProduction.cpp.func.html @@ -0,0 +1,232 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/PhotoPionProduction.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - PhotoPionProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:24638763.6 %
Date:2024-04-08 14:58:22Functions:244060.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa19PhotoPionProduction10lossLengthEidd0
_ZN7crpropa19PhotoPionProduction12setSampleLogEb0
_ZN7crpropa19PhotoPionProduction14setHavePhotonsEb1
_ZN7crpropa19PhotoPionProduction14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE22
_ZN7crpropa19PhotoPionProduction16setHaveElectronsEb0
_ZN7crpropa19PhotoPionProduction16setHaveNeutrinosEb0
_ZN7crpropa19PhotoPionProduction17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa19PhotoPionProduction19setCorrectionFactorEd0
_ZN7crpropa19PhotoPionProduction19setHaveAntiNucleonsEb0
_ZN7crpropa19PhotoPionProduction25setHaveRedshiftDependenceEb0
_ZN7crpropa19PhotoPionProduction8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE22
_ZN7crpropa19PhotoPionProduction8setLimitEd0
_ZN7crpropa19PhotoPionProductionC2ENS_7ref_ptrINS_11PhotonFieldEEEbbbbdb11
_ZNK7crpropa19PhotoPionProduction10nucleonMFPEddb16206
_ZNK7crpropa19PhotoPionProduction10probEpsMaxEbdddd29
_ZNK7crpropa19PhotoPionProduction11breitwignerEddddb1442259
_ZNK7crpropa19PhotoPionProduction11crossectionEdb170560
_ZNK7crpropa19PhotoPionProduction11sophiaEventEbdd0
_ZNK7crpropa19PhotoPionProduction12getSampleLogEv0
_ZNK7crpropa19PhotoPionProduction14getHavePhotonsEv0
_ZNK7crpropa19PhotoPionProduction14getPhotonFieldEv1
_ZNK7crpropa19PhotoPionProduction16getHaveElectronsEv0
_ZNK7crpropa19PhotoPionProduction16getHaveNeutrinosEv0
_ZNK7crpropa19PhotoPionProduction17epsMinInteractionEbd28
_ZNK7crpropa19PhotoPionProduction17getInteractionTagB5cxx11Ev2
_ZNK7crpropa19PhotoPionProduction18nucleiModificationEii16206
_ZNK7crpropa19PhotoPionProduction18performInteractionEPNS_9CandidateEb28
_ZNK7crpropa19PhotoPionProduction19getCorrectionFactorEv1
_ZNK7crpropa19PhotoPionProduction19getHaveAntiNucleonsEv0
_ZNK7crpropa19PhotoPionProduction25getHaveRedshiftDependenceEv0
_ZNK7crpropa19PhotoPionProduction2EfEddd1612819
_ZNK7crpropa19PhotoPionProduction2PlEdddd320502
_ZNK7crpropa19PhotoPionProduction4massEb1815502
_ZNK7crpropa19PhotoPionProduction4sMinEv191909
_ZNK7crpropa19PhotoPionProduction6functsEdb170560
_ZNK7crpropa19PhotoPionProduction7probEpsEdbdd10689
_ZNK7crpropa19PhotoPionProduction7processEPNS_9CandidateE15289
_ZNK7crpropa19PhotoPionProduction8getLimitEv0
_ZNK7crpropa19PhotoPionProduction8momentumEbd10717
_ZNK7crpropa19PhotoPionProduction9sampleEpsEbdd28
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/PhotoPionProduction.cpp.gcov.html b/doc/coverageReport/src/module/PhotoPionProduction.cpp.gcov.html new file mode 100644 index 000000000..5a80e6b6b --- /dev/null +++ b/doc/coverageReport/src/module/PhotoPionProduction.cpp.gcov.html @@ -0,0 +1,758 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/PhotoPionProduction.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - PhotoPionProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:24638763.6 %
Date:2024-04-08 14:58:22Functions:244060.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/PhotoPionProduction.h"
+       2             : #include "crpropa/Units.h"
+       3             : #include "crpropa/ParticleID.h"
+       4             : #include "crpropa/Random.h"
+       5             : 
+       6             : #include "kiss/convert.h"
+       7             : #include "kiss/logger.h"
+       8             : #include "sophia.h"
+       9             : 
+      10             : #include <limits>
+      11             : #include <cmath>
+      12             : #include <sstream>
+      13             : #include <fstream>
+      14             : #include <stdexcept>
+      15             : 
+      16             : namespace crpropa {
+      17             : 
+      18          11 : PhotoPionProduction::PhotoPionProduction(ref_ptr<PhotonField> field, bool photons, bool neutrinos, bool electrons, bool antiNucleons, double l, bool redshift) {
+      19          11 :         havePhotons = photons;
+      20          11 :         haveNeutrinos = neutrinos;
+      21          11 :         haveElectrons = electrons;
+      22          11 :         haveAntiNucleons = antiNucleons;
+      23          11 :         haveRedshiftDependence = redshift;
+      24          11 :         limit = l;
+      25          11 :         setPhotonField(field);
+      26          11 : }
+      27             : 
+      28          22 : void PhotoPionProduction::setPhotonField(ref_ptr<PhotonField> field) {
+      29          22 :         photonField = field;
+      30          22 :         std::string fname = photonField->getFieldName();
+      31          22 :         if (haveRedshiftDependence) {
+      32           0 :                 if (photonField->hasRedshiftDependence() == false){
+      33           0 :                         std::cout << "PhotoPionProduction: tabulated redshift dependence not needed for " + fname + ", switching off" << std::endl;
+      34           0 :                         haveRedshiftDependence = false;
+      35             :                 }
+      36             :                 else {
+      37           0 :                         KISS_LOG_WARNING << "PhotoPionProduction: You are using the 2-dimensional tabulated redshift evolution, which is not available for other interactions. To be consistent across all interactions you may deactivate this <setHaveRedshiftDependence(False)>.";
+      38             :                 }
+      39             :         }
+      40             :         
+      41          22 :         setDescription("PhotoPionProduction: " + fname);
+      42          22 :         if (haveRedshiftDependence){
+      43           0 :                 initRate(getDataPath("PhotoPionProduction/rate_" + fname.replace(0, 3, "IRBz") + ".txt"));
+      44             :         }
+      45             :         else
+      46          66 :                 initRate(getDataPath("PhotoPionProduction/rate_" + fname + ".txt"));
+      47          22 : }
+      48             : 
+      49           1 : void PhotoPionProduction::setHavePhotons(bool b) {
+      50           1 :         havePhotons = b;
+      51           1 : }
+      52             :         
+      53           0 : void PhotoPionProduction::setHaveElectrons(bool b) {
+      54           0 :         haveElectrons = b;
+      55           0 : }
+      56             : 
+      57           0 : void PhotoPionProduction::setHaveNeutrinos(bool b) {
+      58           0 :         haveNeutrinos = b;
+      59           0 : }
+      60             : 
+      61           0 : void PhotoPionProduction::setHaveAntiNucleons(bool b) {
+      62           0 :         haveAntiNucleons = b;
+      63           0 : }
+      64             : 
+      65           0 : void PhotoPionProduction::setHaveRedshiftDependence(bool b) {
+      66           0 :         haveRedshiftDependence = b;
+      67           0 :         setPhotonField(photonField);
+      68           0 : }
+      69             : 
+      70           0 : void PhotoPionProduction::setLimit(double l) {
+      71           0 :         limit = l;
+      72           0 : }
+      73             : 
+      74          22 : void PhotoPionProduction::initRate(std::string filename) {
+      75             :         // clear previously loaded tables
+      76          22 :         tabLorentz.clear();
+      77          22 :         tabRedshifts.clear();
+      78          22 :         tabProtonRate.clear();
+      79          22 :         tabNeutronRate.clear();
+      80             : 
+      81          22 :         std::ifstream infile(filename.c_str());
+      82          22 :         if (!infile.good())
+      83           0 :                 throw std::runtime_error("PhotoPionProduction: could not open file " + filename);
+      84             : 
+      85          22 :         if (haveRedshiftDependence) {
+      86             :                 double zOld = -1, aOld = -1;
+      87           0 :                 while (infile.good()) {
+      88           0 :                         if (infile.peek() == '#') {
+      89           0 :                                 infile.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
+      90           0 :                                 continue;
+      91             :                         }
+      92             :                         double z, a, b, c;
+      93             :                         infile >> z >> a >> b >> c;
+      94           0 :                         if (!infile)
+      95             :                                 break;
+      96           0 :                         if (z > zOld) {
+      97           0 :                                 tabRedshifts.push_back(z);
+      98           0 :                                 zOld = z;
+      99             :                         }
+     100           0 :                         if (a > aOld) {
+     101           0 :                                 tabLorentz.push_back(pow(10, a));
+     102           0 :                                 aOld = a;
+     103             :                         }
+     104           0 :                         tabProtonRate.push_back(b / Mpc);
+     105           0 :                         tabNeutronRate.push_back(c / Mpc);
+     106             :                 }
+     107             :         } else {
+     108        5610 :                 while (infile.good()) {
+     109        5610 :                         if (infile.peek() == '#') {
+     110          66 :                                 infile.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
+     111          66 :                                 continue;
+     112             :                         }
+     113             :                         double a, b, c;
+     114             :                         infile >> a >> b >> c;
+     115        5544 :                         if (!infile)
+     116             :                                 break;
+     117        5522 :                         tabLorentz.push_back(pow(10, a));
+     118        5522 :                         tabProtonRate.push_back(b / Mpc);
+     119        5522 :                         tabNeutronRate.push_back(c / Mpc);
+     120             :                 }
+     121             :         }
+     122             : 
+     123          22 :         infile.close();
+     124          22 : }
+     125             : 
+     126       16206 : double PhotoPionProduction::nucleonMFP(double gamma, double z, bool onProton) const {
+     127       16206 :         const std::vector<double> &tabRate = (onProton)? tabProtonRate : tabNeutronRate;
+     128             : 
+     129             :         // scale nucleus energy instead of background photon energy
+     130       16206 :         gamma *= (1 + z);
+     131       16206 :         if (gamma < tabLorentz.front() or (gamma > tabLorentz.back()))
+     132             :                 return std::numeric_limits<double>::max();
+     133             : 
+     134             :         double rate;
+     135       16206 :         if (haveRedshiftDependence)
+     136           0 :                 rate = interpolate2d(z, gamma, tabRedshifts, tabLorentz, tabRate);
+     137             :         else
+     138       16206 :                 rate = interpolate(gamma, tabLorentz, tabRate) * photonField->getRedshiftScaling(z);
+     139             : 
+     140             :         // cosmological scaling
+     141       16206 :         rate *= pow_integer<2>(1 + z);
+     142             : 
+     143       16206 :         return 1. / rate;
+     144             : }
+     145             : 
+     146       16206 : double PhotoPionProduction::nucleiModification(int A, int X) const {
+     147       16206 :         if (A == 1)
+     148             :                 return 1.;
+     149        1801 :         if (A <= 8)
+     150         453 :                 return 0.85 * pow(X, 2. / 3.);
+     151        1348 :         return 0.85 * X;
+     152             : }
+     153             : 
+     154       15289 : void PhotoPionProduction::process(Candidate *candidate) const {
+     155       15289 :         double step = candidate->getCurrentStep();
+     156       15289 :         double z = candidate->getRedshift();
+     157             :         // the loop is processed at least once for limiting the next step
+     158             :         do {
+     159             :                 // check if nucleus
+     160       15307 :                 int id = candidate->current.getId();
+     161       15307 :                 if (!isNucleus(id))
+     162             :                         return;
+     163             : 
+     164             :                 // find interaction with minimum random distance
+     165       15306 :                 Random &random = Random::instance();
+     166             :                 double randDistance = std::numeric_limits<double>::max();
+     167             :                 double meanFreePath;
+     168             :                 double totalRate = 0;
+     169             :                 bool onProton = true; // interacting particle: proton or neutron
+     170             : 
+     171       15306 :                 int A = massNumber(id);
+     172       15306 :                 int Z = chargeNumber(id);
+     173       15306 :                 int N = A - Z;
+     174       15306 :                 double gamma = candidate->current.getLorentzFactor();
+     175             : 
+     176             :                 // check for interaction on protons
+     177       15306 :                 if (Z > 0) {
+     178       14758 :                         meanFreePath = nucleonMFP(gamma, z, true) / nucleiModification(A, Z);
+     179       14758 :                         randDistance = -log(random.rand()) * meanFreePath;
+     180       14758 :                         totalRate += 1. / meanFreePath;
+     181             :                 }
+     182             :                 // check for interaction on neutrons
+     183       15306 :                 if (N > 0) {
+     184        1448 :                         meanFreePath = nucleonMFP(gamma, z, false) / nucleiModification(A, N);
+     185        1448 :                         totalRate += 1. / meanFreePath;
+     186        1448 :                         double d = -log(random.rand()) * meanFreePath;
+     187        1448 :                         if (d < randDistance) {
+     188             :                                 randDistance = d;
+     189             :                                 onProton = false;
+     190             :                         }
+     191             :                 }
+     192             : 
+     193             :                 // check if interaction does not happen
+     194       15306 :                 if (step < randDistance) {
+     195       15288 :                         if (totalRate > 0.)
+     196       15288 :                                 candidate->limitNextStep(limit / totalRate);
+     197       15288 :                         return;
+     198             :                 }
+     199             : 
+     200             :                 // interact and repeat with remaining step
+     201          18 :                 performInteraction(candidate, onProton);
+     202          18 :                 step -= randDistance;
+     203          18 :         } while (step > 0);
+     204             : }
+     205             : 
+     206          28 : void PhotoPionProduction::performInteraction(Candidate *candidate, bool onProton) const {
+     207          28 :         int id = candidate->current.getId();
+     208          28 :         int A = massNumber(id);
+     209          28 :         int Z = chargeNumber(id);
+     210          28 :         double E = candidate->current.getEnergy();
+     211          28 :         double EpA = E / A;
+     212          28 :         double z = candidate->getRedshift();
+     213             : 
+     214             :         // SOPHIA simulates interactions only for protons / neutrons.
+     215             :         // For anti-protons / neutrons assume charge symmetry and change all
+     216             :         // interaction products from particle <--> anti-particle (sign)
+     217          28 :         int sign = (id > 0) ? 1 : -1;
+     218             : 
+     219             :         // check if below SOPHIA's energy threshold
+     220          56 :         double E_threshold = (photonField->getFieldName() == "CMB") ? 3.72e18 * eV : 5.83e15 * eV;
+     221          28 :         if (EpA * (1 + z) < E_threshold)
+     222           0 :                 return;
+     223             : 
+     224             :         // SOPHIA - input:
+     225          28 :         int nature = 1 - static_cast<int>(onProton);  // 0=proton, 1=neutron
+     226          28 :         double Ein = EpA / GeV;  // GeV is the SOPHIA standard unit
+     227          28 :         double eps = sampleEps(onProton, EpA, z) / GeV;  // GeV for SOPHIA
+     228             : 
+     229             :         // SOPHIA - output:
+     230             :         double outputEnergy[5][2000];  // [GeV/c, GeV/c, GeV/c, GeV, GeV/c^2]
+     231             :         int outPartID[2000];
+     232             :         int nParticles;
+     233             : 
+     234          56 : #pragma omp critical
+     235             :         {
+     236          28 :                 sophiaevent_(nature, Ein, eps, outputEnergy, outPartID, nParticles);
+     237             :         }
+     238             : 
+     239          28 :         Random &random = Random::instance();
+     240          28 :         Vector3d pos = random.randomInterpolatedPosition(candidate->previous.getPosition(), candidate->current.getPosition());
+     241             :         std::vector<int> pnType;  // filled with either 13 (proton) or 14 (neutron)
+     242             :         std::vector<double> pnEnergy;  // corresponding energies of proton or neutron
+     243          28 :         if (nParticles == 0)
+     244             :                 return;
+     245         146 :         for (int i = 0; i < nParticles; i++) { // loop over out-going particles
+     246         118 :                 double Eout = outputEnergy[3][i] * GeV; // only the energy is used; could be changed for more detail
+     247         118 :                 int pType = outPartID[i];
+     248         118 :                 switch (pType) {
+     249          28 :                 case 13: // proton
+     250             :                 case 14: // neutron
+     251             :                         // proton and neutron data is taken to determine primary particle in a later step
+     252          28 :                         pnType.push_back(pType);
+     253          28 :                         pnEnergy.push_back(Eout);
+     254             :                         break;
+     255           0 :                 case -13: // anti-proton
+     256             :                 case -14: // anti-neutron
+     257           0 :                         if (haveAntiNucleons)
+     258             :                                 try
+     259             :                                 {
+     260           0 :                                         candidate->addSecondary(-sign * nucleusId(1, 14 + pType), Eout, pos, 1., interactionTag);
+     261             :                                 }
+     262           0 :                                 catch (std::runtime_error &e)
+     263             :                                 {
+     264           0 :                                         KISS_LOG_ERROR<< "Something went wrong in the PhotoPionProduction (anti-nucleon production)\n" << "Something went wrong in the PhotoPionProduction\n"<< "Please report this error on https://github.com/CRPropa/CRPropa3/issues including your simulation setup and the following random seed:\n" << Random::instance().getSeed_base64();
+     265           0 :                                         throw;
+     266           0 :                                 }
+     267             :                         break;
+     268          22 :                 case 1: // photon
+     269          22 :                         if (havePhotons)
+     270          14 :                                 candidate->addSecondary(22, Eout, pos, 1., interactionTag);
+     271             :                         break;
+     272          12 :                 case 2: // positron
+     273          12 :                         if (haveElectrons)
+     274           2 :                                 candidate->addSecondary(sign * -11, Eout, pos, 1., interactionTag);
+     275             :                         break;
+     276           5 :                 case 3: // electron
+     277           5 :                         if (haveElectrons)
+     278           2 :                                 candidate->addSecondary(sign * 11, Eout, pos, 1., interactionTag);
+     279             :                         break;
+     280          12 :                 case 15: // nu_e
+     281          12 :                         if (haveNeutrinos)
+     282           2 :                                 candidate->addSecondary(sign * 12, Eout, pos, 1., interactionTag);
+     283             :                         break;
+     284           5 :                 case 16: // anti-nu_e
+     285           5 :                         if (haveNeutrinos)
+     286           2 :                                 candidate->addSecondary(sign * -12, Eout, pos, 1., interactionTag);
+     287             :                         break;
+     288          17 :                 case 17: // nu_mu
+     289          17 :                         if (haveNeutrinos)
+     290           4 :                                 candidate->addSecondary(sign * 14, Eout, pos, 1., interactionTag);
+     291             :                         break;
+     292          17 :                 case 18: // anti-nu_mu
+     293          17 :                         if (haveNeutrinos)
+     294           4 :                                 candidate->addSecondary(sign * -14, Eout, pos, 1., interactionTag);
+     295             :                         break;
+     296           0 :                 default:
+     297           0 :                         throw std::runtime_error("PhotoPionProduction: unexpected particle " + kiss::str(pType));
+     298             :                 }
+     299             :         }
+     300          28 :         double maxEnergy = *std::max_element(pnEnergy.begin(), pnEnergy.end());  // criterion for being declared primary
+     301          56 :         for (int i = 0; i < pnEnergy.size(); ++i) {
+     302          28 :                 if (pnEnergy[i] == maxEnergy) {  // nucleon is primary particle
+     303          28 :                         if (A == 1) {
+     304             :                                 // single interacting nucleon
+     305          25 :                                 candidate->current.setEnergy(pnEnergy[i]);
+     306             :                                 try
+     307             :                                 {
+     308          25 :                                         candidate->current.setId(sign * nucleusId(1, 14 - pnType[i]));
+     309             :                                 }
+     310           0 :                                 catch (std::runtime_error &e)
+     311             :                                 {
+     312           0 :                                         KISS_LOG_ERROR<< "Something went wrong in the PhotoPionProduction (primary particle, A==1)\n" << "Please report this error on https://github.com/CRPropa/CRPropa3/issues including your simulation setup and the following random seed:\n" << Random::instance().getSeed_base64();
+     313           0 :                                         throw;
+     314           0 :                                 }
+     315             :                         } else {
+     316             :                                 // interacting nucleon is part of nucleus: it is emitted from the nucleus
+     317           3 :                                 candidate->current.setEnergy(E - EpA);
+     318             :                                 try
+     319             :                                 {
+     320           3 :                                         candidate->current.setId(sign * nucleusId(A - 1, Z - int(onProton)));
+     321           3 :                                         candidate->addSecondary(sign * nucleusId(1, 14 - pnType[i]), pnEnergy[i], pos, 1., interactionTag);
+     322             :                                 }
+     323           0 :                                 catch (std::runtime_error &e)
+     324             :                                 {
+     325           0 :                                         KISS_LOG_ERROR<< "Something went wrong in the PhotoPionProduction (primary particle, A!=1)\n" << "Please report this error on https://github.com/CRPropa/CRPropa3/issues including your simulation setup and the following random seed:\n" << Random::instance().getSeed_base64();
+     326           0 :                                         throw;
+     327           0 :                                 }
+     328             :                         }
+     329             :                 } else {  // nucleon is secondary proton or neutron
+     330           0 :                         candidate->addSecondary(sign * nucleusId(1, 14 - pnType[i]), pnEnergy[i], pos, 1., interactionTag);
+     331             :                 }
+     332             :         }
+     333             : }
+     334             : 
+     335           0 : double PhotoPionProduction::lossLength(int id, double gamma, double z) {
+     336           0 :         int A = massNumber(id);
+     337           0 :         int Z = chargeNumber(id);
+     338           0 :         int N = A - Z;
+     339             : 
+     340             :         double lossRate = 0;
+     341           0 :         if (Z > 0)
+     342           0 :                 lossRate += 1 / nucleonMFP(gamma, z, true) * nucleiModification(A, Z);
+     343           0 :         if (N > 0)
+     344           0 :                 lossRate += 1 / nucleonMFP(gamma, z, false) * nucleiModification(A, N);
+     345             : 
+     346             :         // approximate the relative energy loss
+     347             :         // - nucleons keep the fraction of mass to delta-resonance mass
+     348             :         // - nuclei lose the energy 1/A the interacting nucleon is carrying
+     349           0 :         double relativeEnergyLoss = (A == 1) ? 1 - 938. / 1232. : 1. / A;
+     350           0 :         lossRate *= relativeEnergyLoss;
+     351             : 
+     352             :         // scaling factor: interaction rate --> energy loss rate
+     353           0 :         lossRate *= (1 + z);
+     354             : 
+     355           0 :         return 1. / lossRate;
+     356             : }
+     357             : 
+     358           0 : SophiaEventOutput PhotoPionProduction::sophiaEvent(bool onProton, double Ein, double eps) const {
+     359             :         // SOPHIA - input:
+     360           0 :         int nature = 1 - static_cast<int>(onProton);  // 0=proton, 1=neutron
+     361           0 :         Ein /= GeV;  // GeV is the SOPHIA standard unit
+     362           0 :         eps /= GeV;  // GeV for SOPHIA
+     363             : 
+     364             :         // SOPHIA - output:
+     365             :         double outputEnergy[5][2000];  // [Px GeV/c, Py GeV/c, Pz GeV/c, E GeV, m0 GeV/c^2]
+     366             :         int outPartID[2000];
+     367             :         int nParticles;
+     368             : 
+     369           0 :         sophiaevent_(nature, Ein, eps, outputEnergy, outPartID, nParticles);
+     370             : 
+     371             :         // convert SOPHIA IDs to PDG naming convention & create particles
+     372             :         SophiaEventOutput output;
+     373           0 :         output.nParticles = nParticles;
+     374           0 :         for (int i = 0; i < nParticles; ++i) {
+     375           0 :                 int id = 0;
+     376           0 :                 int partType = outPartID[i];
+     377           0 :                 switch (partType) {
+     378           0 :                         case 13:  // proton
+     379             :                         case 14:  // neutron
+     380           0 :                                 id = nucleusId(1, 14 - partType);
+     381           0 :                                 break;
+     382           0 :                         case -13:  // anti-proton
+     383             :                         case -14:  // anti-neutron
+     384           0 :                                 id = -nucleusId(1, 14 + partType);
+     385           0 :                                 break;
+     386           0 :                         case 1:  // photon
+     387           0 :                                 id = 22;
+     388           0 :                                 break;
+     389           0 :                         case 2:  // positron
+     390           0 :                                 id = -11;
+     391           0 :                                 break;
+     392           0 :                         case 3:  // electron
+     393           0 :                                 id = 11;
+     394           0 :                                 break;
+     395           0 :                         case 15:  // nu_e
+     396           0 :                                 id = 12;
+     397           0 :                                 break;
+     398           0 :                         case 16:  // anti-nu_e
+     399           0 :                                 id = -12;
+     400           0 :                                 break;
+     401           0 :                         case 17:  // nu_mu
+     402           0 :                                 id = 14;
+     403           0 :                                 break;
+     404           0 :                         case 18:  // anti-nu_mu
+     405           0 :                                 id = -14;
+     406           0 :                                 break;
+     407           0 :                         default:
+     408           0 :                                 throw std::runtime_error("PhotoPionProduction: unexpected particle " + kiss::str(partType));
+     409             :                 }
+     410           0 :                 output.energy.push_back(outputEnergy[3][i] * GeV); // only the energy is used; could be changed for more detail
+     411           0 :                 output.id.push_back(id);
+     412             :         }
+     413           0 :         return output;
+     414           0 : }
+     415             : 
+     416          28 : double PhotoPionProduction::sampleEps(bool onProton, double E, double z) const {
+     417             :         // sample eps between epsMin ... epsMax
+     418          28 :         double Ein = E / GeV;
+     419          56 :         double epsMin = std::max(photonField -> getMinimumPhotonEnergy(z) / eV, epsMinInteraction(onProton, Ein));
+     420          28 :         double epsMax = photonField -> getMaximumPhotonEnergy(z) / eV;
+     421          28 :         double pEpsMax = probEpsMax(onProton, Ein, z, epsMin, epsMax);
+     422             : 
+     423          28 :         Random &random = Random::instance();
+     424        5034 :         for (int i = 0; i < 1000000; i++) {
+     425        5034 :                 double eps = epsMin + random.rand() * (epsMax - epsMin);
+     426        5034 :                 double pEps = probEps(eps, onProton, Ein, z);
+     427        5034 :                 if (random.rand() * pEpsMax < pEps)
+     428          28 :                         return eps * eV;
+     429             :         }
+     430           0 :         throw std::runtime_error("error: no photon found in sampleEps, please make sure that photon field provides photons for the interaction by adapting the energy range of the tabulated photon field.");
+     431             : }
+     432             : 
+     433          28 : double PhotoPionProduction::epsMinInteraction(bool onProton, double Ein) const {
+     434             :         // labframe energy of least energetic photon where PPP can occur
+     435             :         // this kind-of ties samplingEps to the PPP and SOPHIA
+     436          28 :         const double m = mass(onProton);
+     437          28 :         const double p = momentum(onProton, Ein);
+     438          28 :         double epsMin = 1.e9 * (1.1646 - m * m) / 2. / (Ein + p); // eV
+     439          28 :         return epsMin;
+     440             : }
+     441             : 
+     442          29 : double PhotoPionProduction::probEpsMax(bool onProton, double Ein, double z, double epsMin, double epsMax) const {
+     443             :         // find pEpsMax by testing photon energies (eps) for their interaction
+     444             :         // probabilities (p) in order to find the maximum (max) probability
+     445             :         const int nrSteps = 100;
+     446             :         double pEpsMaxTested = 0.;
+     447             :         double step = 0.;
+     448          29 :         if (sampleLog){
+     449             :                 // sample in logspace with stepsize that is at max Δlog(E/eV) = 0.01 or otherwise dep. on size of energy range with nrSteps+1 steps log. equidis. spaced
+     450          29 :                 step = std::min(0.01, std::log10(epsMax / epsMin) / nrSteps);
+     451             :         } else
+     452           0 :                 step = (epsMax - epsMin) / nrSteps;
+     453             : 
+     454             :         double epsDummy = 0.;
+     455             :         int i = 0;
+     456        5684 :         while (epsDummy < epsMax) {
+     457        5655 :                 if (sampleLog)
+     458        5655 :                         epsDummy = epsMin * pow(10, step * i);
+     459             :                 else
+     460           0 :                         epsDummy = epsMin + step * i;
+     461        5655 :                 double p = probEps(epsDummy, onProton, Ein, z);
+     462        5655 :                 if(p > pEpsMaxTested)
+     463             :                         pEpsMaxTested = p;
+     464        5655 :                 i++;
+     465             :         }
+     466             :         // the following factor corrects for only trying to find the maximum on nrIteration photon energies
+     467             :         // the factor should be determined in convergence tests
+     468          29 :         double pEpsMax = pEpsMaxTested * correctionFactor;
+     469             : 
+     470          29 :         if(pEpsMax == 0) {
+     471           0 :                 KISS_LOG_WARNING << "pEpsMax is 0 in the following configuration: \n"
+     472           0 :                         << "\t" << "onProton: " << onProton << "\n"
+     473           0 :                         << "\t" << "Ein: " << Ein << " [GeV] \n"
+     474           0 :                         << "\t" << "epsRange [eV] " << epsMin << "\t" << epsMax << "\n"
+     475           0 :                         << "\t" << "redshift: " << z << "\n"
+     476           0 :                         << "\t" << "sample Log " << sampleLog << " with step " << step << " [eV] \n";
+     477             :         }
+     478             : 
+     479          29 :         return pEpsMax;
+     480             : }
+     481             : 
+     482       10689 : double PhotoPionProduction::probEps(double eps, bool onProton, double Ein, double z) const {
+     483             :         // probEps returns "probability to encounter a photon of energy eps", given a primary nucleon
+     484             :         // note, probEps does not return a normalized probability [0,...,1]
+     485       10689 :         double photonDensity = photonField->getPhotonDensity(eps * eV, z) * ccm / eps;
+     486       10689 :         if (photonDensity != 0.) {
+     487       10689 :                 const double p = momentum(onProton, Ein);
+     488       10689 :                 const double sMax = mass(onProton) * mass(onProton) + 2. * eps * (Ein + p) / 1.e9;
+     489       10689 :                 if (sMax <= sMin())
+     490             :                         return 0;
+     491       95940 :                 double sIntegr = gaussInt([this, onProton](double s) { return this->functs(s, onProton); }, sMin(), sMax);
+     492       10660 :                 return photonDensity * sIntegr / eps / eps / p / 8. * 1.e18 * 1.e6;
+     493             :         }
+     494             :         return 0;
+     495             : }
+     496             : 
+     497       10717 : double PhotoPionProduction::momentum(bool onProton, double Ein) const {
+     498       10717 :         const double m = mass(onProton);
+     499       10717 :         const double momentumHadron = sqrt(Ein * Ein - m * m);  // GeV/c
+     500       10717 :         return momentumHadron;
+     501             : }
+     502             : 
+     503      170560 : double PhotoPionProduction::crossection(double eps, bool onProton) const {
+     504      170560 :         const double m = mass(onProton);
+     505      170560 :         const double s = m * m + 2. * m * eps;
+     506      170560 :         if (s < sMin())
+     507             :                 return 0.;
+     508             :         double cross_res = 0.;
+     509             :         double cross_dir = 0.;
+     510             :         double cross_dir1 = 0.;
+     511             :         double cross_dir2 = 0.;
+     512             :         double sig_res[9];
+     513             : 
+     514             :         // first half of array: 9x proton resonance data | second half of array 9x neutron resonance data
+     515             :         static const double AMRES[18] = {1.231, 1.440, 1.515, 1.525, 1.675, 1.680, 1.690, 1.895, 1.950, 1.231, 1.440, 1.515, 1.525, 1.675, 1.675, 1.690, 1.895, 1.950};
+     516             :         static const double BGAMMA[18] = {5.6, 0.5, 4.6, 2.5, 1.0, 2.1, 2.0, 0.2, 1.0, 6.1, 0.3, 4.0, 2.5, 0.0, 0.2, 2.0, 0.2, 1.0};
+     517             :         static const double WIDTH[18] = {0.11, 0.35, 0.11, 0.1, 0.16, 0.125, 0.29, 0.35, 0.3, 0.11, 0.35, 0.11, 0.1, 0.16, 0.150, 0.29, 0.35, 0.3};
+     518             :         static const double RATIOJ[18] = {1., 0.5, 1., 0.5, 0.5, 1.5, 1., 1.5, 2., 1., 0.5, 1., 0.5, 0.5, 1.5, 1., 1.5, 2.};
+     519             :         static const double AM2[2] = {0.882792, 0.880351};
+     520             : 
+     521      170560 :         const int idx = onProton? 0 : 9;
+     522             :         double SIG0[9];
+     523     1705600 :         for (int i = 0; i < 9; ++i) {
+     524     1535040 :                 SIG0[i] = 4.893089117 / AM2[int(onProton)] * RATIOJ[i + idx] * BGAMMA[i + idx];
+     525             :         }
+     526      170560 :         if (eps <= 10.) {
+     527      160251 :                 cross_res = breitwigner(SIG0[0], WIDTH[0 + idx], AMRES[0 + idx], eps, onProton) * Ef(eps, 0.152, 0.17);
+     528             :                 sig_res[0] = cross_res;
+     529     1442259 :                 for (int i = 1; i < 9; ++i) {
+     530     1282008 :                         sig_res[i] = breitwigner(SIG0[i], WIDTH[i + idx], AMRES[i + idx], eps, onProton) * Ef(eps, 0.15, 0.38);
+     531     1282008 :                         cross_res += sig_res[i];
+     532             :                 }
+     533             :                 // direct channel
+     534      160251 :                 if ((eps > 0.1) && (eps < 0.6)) {
+     535       66492 :                         cross_dir1 = 92.7 * Pl(eps, 0.152, 0.25, 2.0)  // single pion production
+     536       66492 :                                            + 40. * std::exp(-(eps - 0.29) * (eps - 0.29) / 0.002)
+     537       66492 :                                            - 15. * std::exp(-(eps - 0.37) * (eps - 0.37) / 0.002);
+     538             :                 } else {
+     539       93759 :                         cross_dir1 = 92.7 * Pl(eps, 0.152, 0.25, 2.0);  // single pion production
+     540             :                 }
+     541      160251 :                 cross_dir2 = 37.7 * Pl(eps, 0.4, 0.6, 2.0);  // double pion production
+     542      160251 :                 cross_dir = cross_dir1 + cross_dir2;
+     543             :         }
+     544             :         // fragmentation 2:
+     545      170560 :         double cross_frag2 = onProton? 80.3 : 60.2;
+     546      170560 :         cross_frag2 *= Ef(eps, 0.5, 0.1) * std::pow(s, -0.34);
+     547             :         // multipion production/fragmentation 1 cross section
+     548             :         double cs_multidiff = 0.;
+     549             :         double cs_multi = 0.;
+     550             :         double cross_diffr1 = 0.;
+     551             :         double cross_diffr2 = 0.;
+     552             :         double cross_diffr = 0.;
+     553      170560 :         if (eps > 0.85) {
+     554       92272 :                 double ss1 = (eps - 0.85) / 0.69;
+     555       92272 :                 double ss2 = onProton? 29.3 : 26.4;
+     556       92272 :                 ss2 *= std::pow(s, -0.34) + 59.3 * std::pow(s, 0.095);
+     557       92272 :                 cs_multidiff = (1. - std::exp(-ss1)) * ss2;
+     558       92272 :                 cs_multi = 0.89 * cs_multidiff;
+     559             :                 // diffractive scattering:
+     560             :                 cross_diffr1 = 0.099 * cs_multidiff;
+     561             :                 cross_diffr2 = 0.011 * cs_multidiff;
+     562       92272 :                 cross_diffr = 0.11 * cs_multidiff;
+     563             :                 // **************************************
+     564       92272 :                 ss1 = std::pow(eps - 0.85, 0.75) / 0.64;
+     565       92272 :                 ss2 = 74.1 * std::pow(eps, -0.44) + 62. * std::pow(s, 0.08);
+     566       92272 :                 double cs_tmp = 0.96 * (1. - std::exp(-ss1)) * ss2;
+     567       92272 :                 cross_diffr1 = 0.14 * cs_tmp;
+     568       92272 :                 cross_diffr2 = 0.013 * cs_tmp;
+     569       92272 :                 double cs_delta = cross_frag2 - (cross_diffr1 + cross_diffr2 - cross_diffr);
+     570       92272 :                 if (cs_delta < 0.) {
+     571             :                         cross_frag2 = 0.;
+     572           0 :                         cs_multi += cs_delta;
+     573             :                 } else {
+     574             :                         cross_frag2 = cs_delta;
+     575             :                 }
+     576             :                 cross_diffr = cross_diffr1 + cross_diffr2;
+     577       92272 :                 cs_multidiff = cs_multi + cross_diffr;
+     578             :         // in the original SOPHIA code, here is a switch for the return argument.
+     579             :         // Here, only one case (compare in SOPHIA: NDIR=3) is needed.
+     580             :         }
+     581      170560 :         return cross_res + cross_dir + cs_multidiff + cross_frag2;
+     582             : }
+     583             : 
+     584      320502 : double PhotoPionProduction::Pl(double eps, double epsTh, double epsMax, double alpha) const {
+     585      320502 :         if (epsTh > eps)
+     586             :                 return 0.;
+     587      266687 :         const double a = alpha * epsMax / epsTh;
+     588      266687 :         const double prod1 = std::pow((eps - epsTh) / (epsMax - epsTh), a - alpha);
+     589      266687 :         const double prod2 = std::pow(eps / epsMax, -a);
+     590      266687 :         return prod1 * prod2;
+     591             : }
+     592             : 
+     593     1612819 : double PhotoPionProduction::Ef(double eps, double epsTh, double w) const {
+     594     1612819 :         const double wTh = w + epsTh;
+     595     1612819 :         if (eps <= epsTh) {
+     596             :                 return 0.;
+     597     1551121 :         } else if ((eps > epsTh) && (eps < wTh)) {
+     598      547581 :                 return (eps - epsTh) / w;
+     599     1003540 :         } else if (eps >= wTh) {
+     600             :                 return 1.;
+     601             :         } else {
+     602           0 :                 throw std::runtime_error("error in function Ef");
+     603             :         }
+     604             : }
+     605             : 
+     606     1442259 : double PhotoPionProduction::breitwigner(double sigma0, double gamma, double DMM, double epsPrime, bool onProton) const {
+     607     1442259 :         const double m = mass(onProton);
+     608     1442259 :         const double s = m * m + 2. * m * epsPrime;
+     609     1442259 :         const double gam2s = gamma * gamma * s;
+     610     1442259 :         return sigma0 * (s / epsPrime / epsPrime) * gam2s / ((s - DMM * DMM) * (s - DMM * DMM) + gam2s);
+     611             : }
+     612             : 
+     613      170560 : double PhotoPionProduction::functs(double s, bool onProton) const {
+     614      170560 :         const double m = mass(onProton);
+     615      170560 :         const double factor = s - m * m;
+     616      170560 :         const double epsPrime = factor / 2. / m;
+     617      170560 :         const double sigmaPg = crossection(epsPrime, onProton);
+     618      170560 :         return factor * sigmaPg;
+     619             : }
+     620             : 
+     621     1815502 : double PhotoPionProduction::mass(bool onProton) const {
+     622     1815502 :         const double m =  onProton ? mass_proton : mass_neutron;
+     623     1815502 :         return m / GeV * c_squared;
+     624             : }
+     625             : 
+     626      191909 : double PhotoPionProduction::sMin() const {
+     627      191909 :         return 1.1646; // [GeV^2] head-on collision
+     628             : }
+     629             : 
+     630           0 : void PhotoPionProduction::setSampleLog(bool b) {
+     631           0 :         sampleLog = b;
+     632           0 : }
+     633             : 
+     634           0 : void PhotoPionProduction::setCorrectionFactor(double factor) {
+     635           0 :         correctionFactor = factor;
+     636           0 : }
+     637             : 
+     638           1 : ref_ptr<PhotonField> PhotoPionProduction::getPhotonField() const {
+     639           1 :         return photonField;
+     640             : }
+     641             : 
+     642           0 : bool PhotoPionProduction::getHavePhotons() const {
+     643           0 :         return havePhotons;
+     644             : }
+     645             : 
+     646           0 : bool PhotoPionProduction::getHaveNeutrinos() const {
+     647           0 :         return haveNeutrinos;
+     648             : }
+     649             : 
+     650           0 : bool PhotoPionProduction::getHaveElectrons() const {
+     651           0 :         return haveElectrons;
+     652             : }
+     653             : 
+     654           0 : bool PhotoPionProduction::getHaveAntiNucleons() const {
+     655           0 :         return haveAntiNucleons;
+     656             : }
+     657             : 
+     658           0 : bool PhotoPionProduction::getHaveRedshiftDependence() const {
+     659           0 :         return haveRedshiftDependence;
+     660             : }
+     661             : 
+     662           0 : double PhotoPionProduction::getLimit() const {
+     663           0 :         return limit;
+     664             : }
+     665             : 
+     666           0 : bool PhotoPionProduction::getSampleLog() const {
+     667           0 :         return sampleLog;
+     668             : }
+     669             : 
+     670           1 : double PhotoPionProduction::getCorrectionFactor() const {
+     671           1 :         return correctionFactor;
+     672             : }
+     673             : 
+     674           1 : void PhotoPionProduction::setInteractionTag(std::string tag) {
+     675           1 :         interactionTag = tag;
+     676           1 : }
+     677             : 
+     678           2 : std::string PhotoPionProduction::getInteractionTag() const {
+     679           2 :         return interactionTag;
+     680             : }
+     681             : 
+     682             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/PhotonOutput1D.cpp.func-sort-c.html b/doc/coverageReport/src/module/PhotonOutput1D.cpp.func-sort-c.html new file mode 100644 index 000000000..20fda8338 --- /dev/null +++ b/doc/coverageReport/src/module/PhotonOutput1D.cpp.func-sort-c.html @@ -0,0 +1,108 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/PhotonOutput1D.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - PhotonOutput1D.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0560.0 %
Date:2024-04-08 14:58:22Functions:090.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa14PhotonOutput1D4gzipEv0
_ZN7crpropa14PhotonOutput1D5closeEv0
_ZN7crpropa14PhotonOutput1DC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa14PhotonOutput1DC2ERSo0
_ZN7crpropa14PhotonOutput1DC2Ev0
_ZN7crpropa14PhotonOutput1DD0Ev0
_ZN7crpropa14PhotonOutput1DD2Ev0
_ZNK7crpropa14PhotonOutput1D14getDescriptionB5cxx11Ev0
_ZNK7crpropa14PhotonOutput1D7processEPNS_9CandidateE0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/PhotonOutput1D.cpp.func.html b/doc/coverageReport/src/module/PhotonOutput1D.cpp.func.html new file mode 100644 index 000000000..bb7a35aac --- /dev/null +++ b/doc/coverageReport/src/module/PhotonOutput1D.cpp.func.html @@ -0,0 +1,108 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/PhotonOutput1D.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - PhotonOutput1D.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0560.0 %
Date:2024-04-08 14:58:22Functions:090.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa14PhotonOutput1D4gzipEv0
_ZN7crpropa14PhotonOutput1D5closeEv0
_ZN7crpropa14PhotonOutput1DC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa14PhotonOutput1DC2ERSo0
_ZN7crpropa14PhotonOutput1DC2Ev0
_ZN7crpropa14PhotonOutput1DD0Ev0
_ZN7crpropa14PhotonOutput1DD2Ev0
_ZNK7crpropa14PhotonOutput1D14getDescriptionB5cxx11Ev0
_ZNK7crpropa14PhotonOutput1D7processEPNS_9CandidateE0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/PhotonOutput1D.cpp.gcov.html b/doc/coverageReport/src/module/PhotonOutput1D.cpp.gcov.html new file mode 100644 index 000000000..18cb674db --- /dev/null +++ b/doc/coverageReport/src/module/PhotonOutput1D.cpp.gcov.html @@ -0,0 +1,180 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/PhotonOutput1D.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - PhotonOutput1D.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0560.0 %
Date:2024-04-08 14:58:22Functions:090.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/PhotonOutput1D.h"
+       2             : #include "crpropa/Units.h"
+       3             : 
+       4             : #include <iostream>
+       5             : #include <sstream>
+       6             : #include <cstdio>
+       7             : #include <stdexcept>
+       8             : 
+       9             : #include "kiss/string.h"
+      10             : #include "kiss/logger.h"
+      11             : 
+      12             : #ifdef CRPROPA_HAVE_ZLIB
+      13             : #include <ozstream.hpp>
+      14             : #endif
+      15             : 
+      16             : using namespace std;
+      17             : 
+      18             : namespace crpropa {
+      19             : 
+      20           0 : PhotonOutput1D::PhotonOutput1D() : out(&std::cout) {
+      21           0 :         KISS_LOG_WARNING << "PhotonOutput1D is deprecated and will be removed in the future. Replace with TextOutput or HDF5Output with features ObserverNucleusVeto + ObserverDetectAll";
+      22           0 : }
+      23             : 
+      24           0 : PhotonOutput1D::PhotonOutput1D(std::ostream &out) : out(&out) {
+      25           0 :         KISS_LOG_WARNING << "PhotonOutput1D is deprecated and will be removed in the future. Replace with TextOutput or HDF5Output with features ObserverNucleusVeto + ObserverDetectAll";
+      26           0 : }
+      27             : 
+      28           0 : PhotonOutput1D::PhotonOutput1D(const std::string &filename) : outfile(
+      29           0 :         filename.c_str(), std::ios::binary), out(&outfile), filename(filename) {
+      30           0 :         KISS_LOG_WARNING << "PhotonOutput1D is deprecated and will be removed in the future. Replace with TextOutput or HDF5Output with features ObserverNucleusVeto + ObserverDetectAll";
+      31           0 :         if (kiss::ends_with(filename, ".gz"))
+      32           0 :                 gzip();
+      33             : 
+      34           0 :         *out << "#ID\tE\tD\tpID\tpE\tiID\tiE\tiD\n";
+      35           0 :         *out << "#\n";
+      36           0 :         *out << "# ID          Id of particle (photon, electron, positron)\n";
+      37           0 :         *out << "# E           Energy [EeV]\n";
+      38           0 :         *out << "# D           Comoving distance to origin [Mpc]\n";
+      39           0 :         *out << "# pID         Id of parent particle\n";
+      40           0 :         *out << "# pE          Energy [EeV] of parent particle\n";
+      41           0 :         *out << "# iID         Id of source particle\n";
+      42           0 :         *out << "# iE          Energy [EeV] of source particle\n";
+      43           0 :         *out << "# iD          Comoving distance [Mpc] to source\n";
+      44           0 :         *out << "#\n";
+      45           0 : }
+      46             : 
+      47           0 : void PhotonOutput1D::process(Candidate *candidate) const {
+      48           0 :         int pid = candidate->current.getId();
+      49           0 :         if ((pid != 22) and (abs(pid) != 11))
+      50           0 :                 return;
+      51             : 
+      52             :         char buffer[1024];
+      53             :         size_t p = 0;
+      54             : 
+      55           0 :         p += std::sprintf(buffer + p, "%4i\t", pid);
+      56           0 :         p += std::sprintf(buffer + p, "%g\t", candidate->current.getEnergy() / EeV);
+      57           0 :         p += std::sprintf(buffer + p, "%8.4f\t", candidate->current.getPosition().getR() / Mpc);
+      58             : 
+      59           0 :         p += std::sprintf(buffer + p, "%10i\t", candidate->created.getId());
+      60           0 :         p += std::sprintf(buffer + p, "%8.4f\t", candidate->created.getEnergy() / EeV);
+      61             : 
+      62           0 :         p += std::sprintf(buffer + p, "%10i\t", candidate->source.getId());
+      63           0 :         p += std::sprintf(buffer + p, "%8.4f\t", candidate->source.getEnergy() / EeV);
+      64           0 :         p += std::sprintf(buffer + p, "%8.4f\n", candidate->source.getPosition().getR() / Mpc);
+      65             : 
+      66           0 : #pragma omp critical
+      67             :         {
+      68           0 :                 out->write(buffer, p);
+      69             :         }
+      70             : 
+      71           0 :         candidate->setActive(false);
+      72             : }
+      73             : 
+      74           0 : void PhotonOutput1D::close() {
+      75             :         #ifdef CRPROPA_HAVE_ZLIB
+      76           0 :                 zstream::ogzstream *zs = dynamic_cast<zstream::ogzstream *>(out);
+      77           0 :                 if (zs) {
+      78           0 :                         zs->close();
+      79           0 :                         delete out;
+      80           0 :                         out = 0;
+      81             :                 }
+      82             :         #endif
+      83           0 :         outfile.flush();
+      84           0 : }
+      85             : 
+      86           0 : string PhotonOutput1D::getDescription() const {
+      87           0 :         std::stringstream s;
+      88             :         s << "PhotonOutput1D: Output file = " << filename;
+      89           0 :         return s.str();
+      90           0 : }
+      91             : 
+      92           0 : PhotonOutput1D::~PhotonOutput1D() {
+      93           0 :         close();
+      94           0 : }
+      95             : 
+      96           0 : void PhotonOutput1D::gzip() {
+      97             :         #ifdef CRPROPA_HAVE_ZLIB
+      98           0 :                 out = new zstream::ogzstream(*out);
+      99             :         #else
+     100             :                 throw std::runtime_error("CRPropa was build without Zlib compression!");
+     101             :         #endif
+     102           0 : }
+     103             : 
+     104             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/PropagationBP.cpp.func-sort-c.html b/doc/coverageReport/src/module/PropagationBP.cpp.func-sort-c.html new file mode 100644 index 000000000..ba52b0e12 --- /dev/null +++ b/doc/coverageReport/src/module/PropagationBP.cpp.func-sort-c.html @@ -0,0 +1,136 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/PropagationBP.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - PropagationBP.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:9210488.5 %
Date:2024-04-08 14:58:22Functions:151693.8 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa13PropagationBP14getDescriptionB5cxx11Ev0
_ZNK7crpropa13PropagationBP12getToleranceEv2
_ZNK7crpropa13PropagationBP14getMinimumStepEv2
_ZNK7crpropa13PropagationBP8getFieldEv2
_ZN7crpropa13PropagationBPC2ENS_7ref_ptrINS_13MagneticFieldEEEddd5
_ZNK7crpropa13PropagationBP14getMaximumStepEv5
_ZN7crpropa13PropagationBPC2ENS_7ref_ptrINS_13MagneticFieldEEEd10
_ZN7crpropa13PropagationBP8setFieldENS_7ref_ptrINS_13MagneticFieldEEE16
_ZN7crpropa13PropagationBP12setToleranceEd22
_ZN7crpropa13PropagationBP14setMaximumStepEd22
_ZN7crpropa13PropagationBP14setMinimumStepEd24
_ZNK7crpropa13PropagationBP15errorEstimationENS_7Vector3IdEES2_d28
_ZNK7crpropa13PropagationBP7tryStepERKNS0_1YERS1_S4_dRNS_13ParticleStateEddd28
_ZNK7crpropa13PropagationBP7processEPNS_9CandidateE37
_ZNK7crpropa13PropagationBP2dYENS_7Vector3IdEES2_dddd103
_ZNK7crpropa13PropagationBP18getFieldAtPositionENS_7Vector3IdEEd104
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/PropagationBP.cpp.func.html b/doc/coverageReport/src/module/PropagationBP.cpp.func.html new file mode 100644 index 000000000..d14b61859 --- /dev/null +++ b/doc/coverageReport/src/module/PropagationBP.cpp.func.html @@ -0,0 +1,136 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/PropagationBP.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - PropagationBP.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:9210488.5 %
Date:2024-04-08 14:58:22Functions:151693.8 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa13PropagationBP12setToleranceEd22
_ZN7crpropa13PropagationBP14setMaximumStepEd22
_ZN7crpropa13PropagationBP14setMinimumStepEd24
_ZN7crpropa13PropagationBP8setFieldENS_7ref_ptrINS_13MagneticFieldEEE16
_ZN7crpropa13PropagationBPC2ENS_7ref_ptrINS_13MagneticFieldEEEd10
_ZN7crpropa13PropagationBPC2ENS_7ref_ptrINS_13MagneticFieldEEEddd5
_ZNK7crpropa13PropagationBP12getToleranceEv2
_ZNK7crpropa13PropagationBP14getDescriptionB5cxx11Ev0
_ZNK7crpropa13PropagationBP14getMaximumStepEv5
_ZNK7crpropa13PropagationBP14getMinimumStepEv2
_ZNK7crpropa13PropagationBP15errorEstimationENS_7Vector3IdEES2_d28
_ZNK7crpropa13PropagationBP18getFieldAtPositionENS_7Vector3IdEEd104
_ZNK7crpropa13PropagationBP2dYENS_7Vector3IdEES2_dddd103
_ZNK7crpropa13PropagationBP7processEPNS_9CandidateE37
_ZNK7crpropa13PropagationBP7tryStepERKNS0_1YERS1_S4_dRNS_13ParticleStateEddd28
_ZNK7crpropa13PropagationBP8getFieldEv2
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/PropagationBP.cpp.gcov.html b/doc/coverageReport/src/module/PropagationBP.cpp.gcov.html new file mode 100644 index 000000000..8e1869baf --- /dev/null +++ b/doc/coverageReport/src/module/PropagationBP.cpp.gcov.html @@ -0,0 +1,285 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/PropagationBP.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - PropagationBP.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:9210488.5 %
Date:2024-04-08 14:58:22Functions:151693.8 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/PropagationBP.h"
+       2             : 
+       3             : #include <sstream>
+       4             : #include <stdexcept>
+       5             : #include <vector>
+       6             : 
+       7             : namespace crpropa {
+       8          28 :         void PropagationBP::tryStep(const Y &y, Y &out, Y &error, double h,
+       9             :                         ParticleState &particle, double z, double q, double m) const {
+      10          28 :                 out = dY(y.x, y.u, h, z, q, m);  // 1 step with h
+      11             : 
+      12          28 :                 Y outHelp = dY(y.x, y.u, h/2, z, q, m);  // 2 steps with h/2
+      13          28 :                 Y outCompare = dY(outHelp.x, outHelp.u, h/2, z, q, m);
+      14             : 
+      15          28 :                 error = errorEstimation(out.x , outCompare.x , h);
+      16          28 :         }
+      17             : 
+      18             : 
+      19         103 :         PropagationBP::Y PropagationBP::dY(Vector3d pos, Vector3d dir, double step,
+      20             :                         double z, double q, double m) const {
+      21             :                 // half leap frog step in the position
+      22             :                 pos += dir * step / 2.;
+      23             : 
+      24             :                 // get B field at particle position
+      25         103 :                 Vector3d B = getFieldAtPosition(pos, z);
+      26             : 
+      27             :                 // Boris help vectors
+      28             :                 Vector3d t = B * q / 2 / m * step / c_light;
+      29         103 :                 Vector3d s = t * 2 / (1 + t.dot(t));
+      30             :                 Vector3d v_help;
+      31             : 
+      32             :                 // Boris push
+      33             :                 v_help = dir + dir.cross(t);
+      34             :                 dir = dir + v_help.cross(s);
+      35             : 
+      36             :                 // the other half leap frog step in the position
+      37             :                 pos += dir * step / 2.;
+      38         103 :                 return Y(pos, dir);
+      39             :         }
+      40             : 
+      41             : 
+      42             :         // with a fixed step size
+      43          10 :         PropagationBP::PropagationBP(ref_ptr<MagneticField> field, double fixedStep) :
+      44          10 :                         minStep(0) {
+      45          10 :                 setField(field);
+      46          10 :                 setTolerance(0.42);
+      47          10 :                 setMaximumStep(fixedStep);
+      48          10 :                 setMinimumStep(fixedStep);
+      49          10 :         }
+      50             : 
+      51             : 
+      52             :         // with adaptive step size
+      53           5 :         PropagationBP::PropagationBP(ref_ptr<MagneticField> field, double tolerance, double minStep, double maxStep) :
+      54           5 :                         minStep(0) {
+      55           7 :                 setField(field);
+      56           5 :                 setTolerance(tolerance);
+      57           4 :                 setMaximumStep(maxStep);
+      58           4 :                 setMinimumStep(minStep);
+      59           3 :         }
+      60             : 
+      61             : 
+      62          37 :         void PropagationBP::process(Candidate *candidate) const {
+      63             :                 // save the new previous particle state
+      64          37 :                 ParticleState &current = candidate->current;
+      65             :                 candidate->previous = current;
+      66             : 
+      67          37 :                 Y yIn(current.getPosition(), current.getDirection());
+      68             : 
+      69             :                 // calculate charge of particle
+      70          37 :                 double q = current.getCharge();
+      71          37 :                 double step = maxStep;
+      72             : 
+      73             :                 // rectilinear propagation for neutral particles
+      74          37 :                 if (q == 0) {
+      75           2 :                         step = clip(candidate->getNextStep(), minStep, maxStep);
+      76           1 :                         current.setPosition(yIn.x + yIn.u * step);
+      77           1 :                         candidate->setCurrentStep(step);
+      78           1 :                         candidate->setNextStep(maxStep);
+      79             :                         return;
+      80             :                 }
+      81             : 
+      82             :                 Y yOut, yErr;
+      83          36 :                 double newStep = step;
+      84          36 :                 double z = candidate->getRedshift();
+      85          36 :                 double m = current.getEnergy()/(c_light * c_light);
+      86             : 
+      87             :                 // if minStep is the same as maxStep the adaptive algorithm with its error
+      88             :                 // estimation is not needed and the computation time can be saved:
+      89          36 :                 if (minStep == maxStep){
+      90          19 :                         yOut = dY(yIn.x, yIn.u, step, z, q, m);
+      91             :                 } else {
+      92          17 :                         step = clip(candidate->getNextStep(), minStep, maxStep);
+      93          17 :                         newStep = step;
+      94             :                         double r = 42;  // arbitrary value
+      95             : 
+      96             :                         // try performing step until the target error (tolerance) or the minimum/maximum step size has been reached
+      97             :                         while (true) {
+      98          28 :                                 tryStep(yIn, yOut, yErr, step, current, z, q, m);
+      99          28 :                                 r = yErr.u.getR() / tolerance;  // ratio of absolute direction error and tolerance
+     100          28 :                                 if (r > 1) {  // large direction error relative to tolerance, try to decrease step size
+     101          18 :                                         if (step == minStep)  // already minimum step size
+     102             :                                                 break;
+     103             :                                         else {
+     104          11 :                                                 newStep = step * 0.95 * pow(r, -0.2);
+     105          19 :                                                 newStep = std::max(newStep, 0.1 * step); // limit step size decrease
+     106          11 :                                                 newStep = std::max(newStep, minStep); // limit step size to minStep
+     107             :                                                 step = newStep;
+     108             :                                         }
+     109             :                                 } else {  // small direction error relative to tolerance, try to increase step size
+     110          10 :                                         if (step != maxStep) {  // only update once if maximum step size yet not reached
+     111          10 :                                                 newStep = step * 0.95 * pow(r, -0.2);
+     112          17 :                                                 newStep = std::min(newStep, 5 * step); // limit step size increase
+     113          10 :                                                 newStep = std::min(newStep, maxStep); // limit step size to maxStep
+     114             :                                         }
+     115             :                                         break;
+     116             :                                 }
+     117             :                         }
+     118             :                 }
+     119             : 
+     120          36 :                 current.setPosition(yOut.x);
+     121          36 :                 current.setDirection(yOut.u.getUnitVector());
+     122          36 :                 candidate->setCurrentStep(step);
+     123          36 :                 candidate->setNextStep(newStep);
+     124             :         }
+     125             : 
+     126             : 
+     127          16 :         void PropagationBP::setField(ref_ptr<MagneticField> f) {
+     128          16 :                 field = f;
+     129          16 :         }
+     130             : 
+     131             : 
+     132           2 :         ref_ptr<MagneticField> PropagationBP::getField() const {
+     133           2 :                 return field;
+     134             :         }
+     135             : 
+     136             : 
+     137         104 :         Vector3d PropagationBP::getFieldAtPosition(Vector3d pos, double z) const {
+     138             :                 Vector3d B(0, 0, 0);
+     139             :                 try {
+     140             :                         // check if field is valid and use the field vector at the
+     141             :                         // position pos with the redshift z
+     142         104 :                         if (field.valid())
+     143         104 :                                 B = field->getField(pos, z);
+     144           0 :                 } catch (std::exception &e) {
+     145           0 :                         KISS_LOG_ERROR  << "PropagationBP: Exception in PropagationBP::getFieldAtPosition.\n"
+     146           0 :                                         << e.what();
+     147           0 :                 }       
+     148         104 :                 return B;
+     149             :         }
+     150             : 
+     151             : 
+     152          28 :         double PropagationBP::errorEstimation(const Vector3d x1, const Vector3d x2, double step) const {
+     153             :                 // compare the position after one step with the position after two steps with step/2.
+     154             :                 Vector3d diff = (x1 - x2);
+     155             : 
+     156          28 :                 double S = diff.getR() / (step * (1 - 1/4.) );  // 1/4 = (1/2)²  number of steps for x1 divided by number of steps for x2 to the power of p (order)
+     157             : 
+     158          28 :                 return S;
+     159             :         }
+     160             : 
+     161             : 
+     162          22 :         void PropagationBP::setTolerance(double tol) {
+     163          22 :                 if ((tol > 1) or (tol < 0))
+     164           2 :                         throw std::runtime_error(
+     165           4 :                                         "PropagationBP: target error not in range 0-1");
+     166          20 :                 tolerance = tol;
+     167          20 :         }
+     168             : 
+     169             : 
+     170          24 :         void PropagationBP::setMinimumStep(double min) {
+     171          24 :                 if (min < 0)
+     172           1 :                         throw std::runtime_error("PropagationBP: minStep < 0 ");
+     173          23 :                 if (min > maxStep)
+     174           2 :                         throw std::runtime_error("PropagationBP: minStep > maxStep");
+     175          21 :                 minStep = min;
+     176          21 :         }
+     177             : 
+     178             : 
+     179          22 :         void PropagationBP::setMaximumStep(double max) {
+     180          22 :                 if (max < minStep)
+     181           1 :                         throw std::runtime_error("PropagationBP: maxStep < minStep");
+     182          21 :                 maxStep = max;
+     183          21 :         }
+     184             : 
+     185             : 
+     186           2 :         double PropagationBP::getTolerance() const {
+     187           2 :                 return tolerance;
+     188             :         }
+     189             : 
+     190             : 
+     191           2 :         double PropagationBP::getMinimumStep() const {
+     192           2 :                 return minStep;
+     193             :         }
+     194             : 
+     195             : 
+     196           5 :         double PropagationBP::getMaximumStep() const {
+     197           5 :                 return maxStep;
+     198             :         }
+     199             : 
+     200             : 
+     201           0 :         std::string PropagationBP::getDescription() const {
+     202           0 :                 std::stringstream s;
+     203           0 :                 s << "Propagation in magnetic fields using the adaptive Boris push method.";
+     204           0 :                 s << " Target error: " << tolerance;
+     205           0 :                 s << ", Minimum Step: " << minStep / kpc << " kpc";
+     206           0 :                 s << ", Maximum Step: " << maxStep / kpc << " kpc";
+     207           0 :                 return s.str();
+     208           0 :         }
+     209             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/PropagationCK.cpp.func-sort-c.html b/doc/coverageReport/src/module/PropagationCK.cpp.func-sort-c.html new file mode 100644 index 000000000..01527a79b --- /dev/null +++ b/doc/coverageReport/src/module/PropagationCK.cpp.func-sort-c.html @@ -0,0 +1,128 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/PropagationCK.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - PropagationCK.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:859787.6 %
Date:2024-04-08 14:58:22Functions:131492.9 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa13PropagationCK14getDescriptionB5cxx11Ev0
_ZNK7crpropa13PropagationCK12getToleranceEv2
_ZNK7crpropa13PropagationCK14getMinimumStepEv2
_ZNK7crpropa13PropagationCK8getFieldEv2
_ZNK7crpropa13PropagationCK14getMaximumStepEv3
_ZN7crpropa13PropagationCKC2ENS_7ref_ptrINS_13MagneticFieldEEEddd13
_ZN7crpropa13PropagationCK8setFieldENS_7ref_ptrINS_13MagneticFieldEEE14
_ZN7crpropa13PropagationCK12setToleranceEd18
_ZN7crpropa13PropagationCK14setMaximumStepEd19
_ZN7crpropa13PropagationCK14setMinimumStepEd22
_ZNK7crpropa13PropagationCK7processEPNS_9CandidateE34
_ZNK7crpropa13PropagationCK7tryStepERKNS0_1YERS1_S4_dRNS_13ParticleStateEd42
_ZNK7crpropa13PropagationCK4dYdtERKNS0_1YERNS_13ParticleStateEd252
_ZNK7crpropa13PropagationCK18getFieldAtPositionENS_7Vector3IdEEd253
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/PropagationCK.cpp.func.html b/doc/coverageReport/src/module/PropagationCK.cpp.func.html new file mode 100644 index 000000000..6461ce48c --- /dev/null +++ b/doc/coverageReport/src/module/PropagationCK.cpp.func.html @@ -0,0 +1,128 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/PropagationCK.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - PropagationCK.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:859787.6 %
Date:2024-04-08 14:58:22Functions:131492.9 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa13PropagationCK12setToleranceEd18
_ZN7crpropa13PropagationCK14setMaximumStepEd19
_ZN7crpropa13PropagationCK14setMinimumStepEd22
_ZN7crpropa13PropagationCK8setFieldENS_7ref_ptrINS_13MagneticFieldEEE14
_ZN7crpropa13PropagationCKC2ENS_7ref_ptrINS_13MagneticFieldEEEddd13
_ZNK7crpropa13PropagationCK12getToleranceEv2
_ZNK7crpropa13PropagationCK14getDescriptionB5cxx11Ev0
_ZNK7crpropa13PropagationCK14getMaximumStepEv3
_ZNK7crpropa13PropagationCK14getMinimumStepEv2
_ZNK7crpropa13PropagationCK18getFieldAtPositionENS_7Vector3IdEEd253
_ZNK7crpropa13PropagationCK4dYdtERKNS0_1YERNS_13ParticleStateEd252
_ZNK7crpropa13PropagationCK7processEPNS_9CandidateE34
_ZNK7crpropa13PropagationCK7tryStepERKNS0_1YERS1_S4_dRNS_13ParticleStateEd42
_ZNK7crpropa13PropagationCK8getFieldEv2
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/PropagationCK.cpp.gcov.html b/doc/coverageReport/src/module/PropagationCK.cpp.gcov.html new file mode 100644 index 000000000..037e88d09 --- /dev/null +++ b/doc/coverageReport/src/module/PropagationCK.cpp.gcov.html @@ -0,0 +1,278 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/PropagationCK.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - PropagationCK.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:859787.6 %
Date:2024-04-08 14:58:22Functions:131492.9 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/PropagationCK.h"
+       2             : 
+       3             : #include <limits>
+       4             : #include <sstream>
+       5             : #include <stdexcept>
+       6             : #include <vector>
+       7             : 
+       8             : namespace crpropa {
+       9             : 
+      10             : // Cash-Karp coefficients
+      11             : const double cash_karp_a[] = {
+      12             :         0., 0., 0., 0., 0., 0.,
+      13             :         1. / 5., 0., 0., 0., 0., 0.,
+      14             :         3. / 40., 9. / 40., 0., 0., 0., 0.,
+      15             :         3. / 10., -9. / 10., 6. / 5., 0., 0., 0.,
+      16             :         -11. / 54., 5. / 2., -70. / 27., 35. / 27., 0., 0.,
+      17             :         1631. / 55296., 175. / 512., 575. / 13824., 44275. / 110592., 253. / 4096., 0.
+      18             : };
+      19             : 
+      20             : const double cash_karp_b[] = {
+      21             :         37. / 378., 0, 250. / 621., 125. / 594., 0., 512. / 1771.
+      22             : };
+      23             : 
+      24             : const double cash_karp_bs[] = {
+      25             :         2825. / 27648., 0., 18575. / 48384., 13525. / 55296., 277. / 14336., 1. / 4.
+      26             : };
+      27             : 
+      28          42 : void PropagationCK::tryStep(const Y &y, Y &out, Y &error, double h,
+      29             :                 ParticleState &particle, double z) const {
+      30             :         std::vector<Y> k;
+      31          42 :         k.reserve(6);
+      32             : 
+      33             :         out = y;
+      34             :         error = Y(0);
+      35             : 
+      36             :         // calculate the sum of b_i * k_i
+      37         294 :         for (size_t i = 0; i < 6; i++) {
+      38             : 
+      39             :                 Y y_n = y;
+      40         882 :                 for (size_t j = 0; j < i; j++)
+      41         630 :                         y_n += k[j] * a[i * 6 + j] * h;
+      42             : 
+      43             :                 // update k_i
+      44         252 :                 k[i] = dYdt(y_n, particle, z);
+      45             : 
+      46         252 :                 out += k[i] * b[i] * h;
+      47         252 :                 error += k[i] * (b[i] - bs[i]) * h;
+      48             :         }
+      49          42 : }
+      50             : 
+      51         252 : PropagationCK::Y PropagationCK::dYdt(const Y &y, ParticleState &p, double z) const {
+      52             :         // normalize direction vector to prevent numerical losses
+      53         252 :         Vector3d velocity = y.u.getUnitVector() * c_light;
+      54             :         
+      55             :         // get B field at particle position
+      56         252 :         Vector3d B = getFieldAtPosition(y.x, z);
+      57             : 
+      58             :         // Lorentz force: du/dt = q*c/E * (v x B)
+      59         252 :         Vector3d dudt = p.getCharge() * c_light / p.getEnergy() * velocity.cross(B);
+      60         252 :         return Y(velocity, dudt);
+      61             : }
+      62             : 
+      63          13 : PropagationCK::PropagationCK(ref_ptr<MagneticField> field, double tolerance,
+      64          13 :                 double minStep, double maxStep) :
+      65          13 :                 minStep(0) {
+      66          15 :         setField(field);
+      67          13 :         setTolerance(tolerance);
+      68          12 :         setMaximumStep(maxStep);
+      69          12 :         setMinimumStep(minStep);
+      70             : 
+      71             :         // load Cash-Karp coefficients
+      72             :         a.assign(cash_karp_a, cash_karp_a + 36);
+      73             :         b.assign(cash_karp_b, cash_karp_b + 6);
+      74             :         bs.assign(cash_karp_bs, cash_karp_bs + 6);
+      75          11 : }
+      76             : 
+      77          34 : void PropagationCK::process(Candidate *candidate) const {
+      78             :         // save the new previous particle state
+      79          34 :         ParticleState &current = candidate->current;
+      80             :         candidate->previous = current;
+      81             : 
+      82          34 :         Y yIn(current.getPosition(), current.getDirection());
+      83          34 :         double step = maxStep;
+      84             : 
+      85             :         // rectilinear propagation for neutral particles
+      86          34 :         if (current.getCharge() == 0) {
+      87           2 :                 step = clip(candidate->getNextStep(), minStep, maxStep);
+      88           1 :                 current.setPosition(yIn.x + yIn.u * step);
+      89           1 :                 candidate->setCurrentStep(step);
+      90           1 :                 candidate->setNextStep(maxStep);
+      91             :                 return;
+      92             :         }
+      93             : 
+      94             :         Y yOut, yErr;
+      95          33 :         double newStep = step;
+      96          33 :         double z = candidate->getRedshift();
+      97             : 
+      98             : 
+      99             :         // if minStep is the same as maxStep the adaptive algorithm with its error
+     100             :         // estimation is not needed and the computation time can be saved:
+     101          33 :         if (minStep == maxStep){
+     102          10 :                 tryStep(yIn, yOut, yErr, step / c_light, current, z);
+     103             :         } else {
+     104          23 :                 step = clip(candidate->getNextStep(), minStep, maxStep);
+     105          23 :                 newStep = step;
+     106             :                 double r = 42;  // arbitrary value
+     107             : 
+     108             :                 // try performing step until the target error (tolerance) or the minimum/maximum step size has been reached
+     109             :                 while (true) {
+     110          32 :                         tryStep(yIn, yOut, yErr, step / c_light, current, z);
+     111          32 :                         r = yErr.u.getR() / tolerance;  // ratio of absolute direction error and tolerance
+     112          32 :                         if (r > 1) {  // large direction error relative to tolerance, try to decrease step size
+     113          10 :                                 if (step == minStep)  // already minimum step size
+     114             :                                         break;
+     115             :                                 else {
+     116           9 :                                         newStep = step * 0.95 * pow(r, -0.2);
+     117          17 :                                         newStep = std::max(newStep, 0.1 * step); // limit step size decrease
+     118           9 :                                         newStep = std::max(newStep, minStep); // limit step size to minStep
+     119             :                                         step = newStep;
+     120             :                                 }
+     121             :                         } else {  // small direction error relative to tolerance, try to increase step size
+     122          22 :                                 if (step != maxStep) {  // only update once if maximum step size yet not reached
+     123          22 :                                         newStep = step * 0.95 * pow(r, -0.2);
+     124          35 :                                         newStep = std::min(newStep, 5 * step); // limit step size increase
+     125          22 :                                         newStep = std::min(newStep, maxStep); // limit step size to maxStep
+     126             :                                 }
+     127             :                                 break;
+     128             :                         }
+     129             :                 }
+     130             :         }
+     131             : 
+     132          33 :         current.setPosition(yOut.x);
+     133          33 :         current.setDirection(yOut.u.getUnitVector());
+     134          33 :         candidate->setCurrentStep(step);
+     135          33 :         candidate->setNextStep(newStep);
+     136             : }
+     137             : 
+     138          14 : void PropagationCK::setField(ref_ptr<MagneticField> f) {
+     139          14 :         field = f;
+     140          14 : }
+     141             : 
+     142           2 : ref_ptr<MagneticField> PropagationCK::getField() const {
+     143           2 :         return field;
+     144             : }
+     145             : 
+     146         253 : Vector3d PropagationCK::getFieldAtPosition(Vector3d pos, double z) const {
+     147             :         Vector3d B(0, 0, 0);
+     148             :         try {
+     149             :                 // check if field is valid and use the field vector at the
+     150             :                 // position pos with the redshift z
+     151         253 :                 if (field.valid())
+     152         253 :                         B = field->getField(pos, z);
+     153           0 :         } catch (std::exception &e) {
+     154           0 :                 KISS_LOG_ERROR  << "PropagationCK: Exception in PropagationCK::getFieldAtPosition.\n"
+     155           0 :                                 << e.what();
+     156           0 :         }       
+     157         253 :         return B;
+     158             : }
+     159             : 
+     160          18 : void PropagationCK::setTolerance(double tol) {
+     161          18 :         if ((tol > 1) or (tol < 0))
+     162           2 :                 throw std::runtime_error(
+     163           4 :                                 "PropagationCK: target error not in range 0-1");
+     164          16 :         tolerance = tol;
+     165          16 : }
+     166             : 
+     167          22 : void PropagationCK::setMinimumStep(double min) {
+     168          22 :         if (min < 0)
+     169           1 :                 throw std::runtime_error("PropagationCK: minStep < 0 ");
+     170          21 :         if (min > maxStep)
+     171           2 :                 throw std::runtime_error("PropagationCK: minStep > maxStep");
+     172          19 :         minStep = min;
+     173          19 : }
+     174             : 
+     175          19 : void PropagationCK::setMaximumStep(double max) {
+     176          19 :         if (max < minStep)
+     177           1 :                 throw std::runtime_error("PropagationCK: maxStep < minStep");
+     178          18 :         maxStep = max;
+     179          18 : }
+     180             : 
+     181           2 : double PropagationCK::getTolerance() const {
+     182           2 :         return tolerance;
+     183             : }
+     184             : 
+     185           2 : double PropagationCK::getMinimumStep() const {
+     186           2 :         return minStep;
+     187             : }
+     188             : 
+     189           3 : double PropagationCK::getMaximumStep() const {
+     190           3 :         return maxStep;
+     191             : }
+     192             : 
+     193           0 : std::string PropagationCK::getDescription() const {
+     194           0 :         std::stringstream s;
+     195           0 :         s << "Propagation in magnetic fields using the Cash-Karp method.";
+     196           0 :         s << " Target error: " << tolerance;
+     197           0 :         s << ", Minimum Step: " << minStep / kpc << " kpc";
+     198           0 :         s << ", Maximum Step: " << maxStep / kpc << " kpc";
+     199           0 :         return s.str();
+     200           0 : }
+     201             : 
+     202             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/Redshift.cpp.func-sort-c.html b/doc/coverageReport/src/module/Redshift.cpp.func-sort-c.html new file mode 100644 index 000000000..8258b1e94 --- /dev/null +++ b/doc/coverageReport/src/module/Redshift.cpp.func-sort-c.html @@ -0,0 +1,88 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/Redshift.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - Redshift.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:92832.1 %
Date:2024-04-08 14:58:22Functions:1425.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa14FutureRedshift14getDescriptionB5cxx11Ev0
_ZNK7crpropa14FutureRedshift7processEPNS_9CandidateE0
_ZNK7crpropa8Redshift14getDescriptionB5cxx11Ev0
_ZNK7crpropa8Redshift7processEPNS_9CandidateE7644
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/Redshift.cpp.func.html b/doc/coverageReport/src/module/Redshift.cpp.func.html new file mode 100644 index 000000000..39944b158 --- /dev/null +++ b/doc/coverageReport/src/module/Redshift.cpp.func.html @@ -0,0 +1,88 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/Redshift.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - Redshift.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:92832.1 %
Date:2024-04-08 14:58:22Functions:1425.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa14FutureRedshift14getDescriptionB5cxx11Ev0
_ZNK7crpropa14FutureRedshift7processEPNS_9CandidateE0
_ZNK7crpropa8Redshift14getDescriptionB5cxx11Ev0
_ZNK7crpropa8Redshift7processEPNS_9CandidateE7644
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/Redshift.cpp.gcov.html b/doc/coverageReport/src/module/Redshift.cpp.gcov.html new file mode 100644 index 000000000..f41db2d01 --- /dev/null +++ b/doc/coverageReport/src/module/Redshift.cpp.gcov.html @@ -0,0 +1,138 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/Redshift.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - Redshift.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:92832.1 %
Date:2024-04-08 14:58:22Functions:1425.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/Redshift.h"
+       2             : #include "crpropa/Units.h"
+       3             : #include "crpropa/Cosmology.h"
+       4             : 
+       5             : #include <limits>
+       6             : 
+       7             : namespace crpropa {
+       8             : 
+       9        7644 : void Redshift::process(Candidate *c) const {
+      10        7644 :         double z = c->getRedshift();
+      11             : 
+      12             :         // check if z = 0
+      13        7644 :         if (z <= std::numeric_limits<double>::min())
+      14          21 :                 return;
+      15             : 
+      16             :         // use small step approximation:  dz = H(z) / c * ds
+      17        7623 :         double dz = hubbleRate(z) / c_light * c->getCurrentStep();
+      18             : 
+      19             :         // prevent dz > z
+      20        7623 :         dz = std::min(dz, z);
+      21             : 
+      22             :         // update redshift
+      23        7623 :         c->setRedshift(z - dz);
+      24             : 
+      25             :         // adiabatic energy loss: dE / dz = E / (1 + z)
+      26        7623 :         double E = c->current.getEnergy();
+      27        7623 :         c->current.setEnergy(E * (1 - dz / (1 + z)));
+      28             : }
+      29             : 
+      30           0 : std::string Redshift::getDescription() const {
+      31           0 :         std::stringstream s;
+      32           0 :         s << "Redshift: h0 = " << hubbleRate() / 1e5 * Mpc << ", omegaL = "
+      33           0 :                         << omegaL() << ", omegaM = " << omegaM();
+      34           0 :         return s.str();
+      35           0 : }
+      36             : 
+      37           0 : void FutureRedshift::process(Candidate *c) const {
+      38           0 :         double z = c->getRedshift();
+      39             : 
+      40             :         // check if z = -1
+      41           0 :         if (z <= -1)
+      42             :                 return;
+      43             : 
+      44             :         // use small step approximation:  dz = H(z) / c * ds
+      45           0 :         double dz = hubbleRate(z) / c_light * c->getCurrentStep();
+      46             : 
+      47             :         // update redshift
+      48           0 :         c->setRedshift(z - dz);
+      49             : 
+      50             :         // adiabatic energy loss: dE / dz = E / (1 + z)
+      51           0 :         double E = c->current.getEnergy();
+      52           0 :         c->current.setEnergy(E * (1 - dz / (1 + z)));
+      53             : }
+      54             : 
+      55           0 : std::string FutureRedshift::getDescription() const {
+      56           0 :         std::stringstream s;
+      57           0 :         s << "FutureRedshift: h0 = " << hubbleRate() / 1e5 * Mpc << ", omegaL = "
+      58           0 :                         << omegaL() << ", omegaM = " << omegaM();
+      59           0 :         return s.str();
+      60           0 : }
+      61             : 
+      62             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/RestrictToRegion.cpp.func-sort-c.html b/doc/coverageReport/src/module/RestrictToRegion.cpp.func-sort-c.html new file mode 100644 index 000000000..89ada30d6 --- /dev/null +++ b/doc/coverageReport/src/module/RestrictToRegion.cpp.func-sort-c.html @@ -0,0 +1,84 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/RestrictToRegion.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - RestrictToRegion.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:61250.0 %
Date:2024-04-08 14:58:22Functions:2366.7 %
+
+ +
+ + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa16RestrictToRegion14getDescriptionB5cxx11Ev0
_ZN7crpropa16RestrictToRegionC2EPNS_6ModuleEPNS_7SurfaceE1
_ZNK7crpropa16RestrictToRegion7processEPNS_9CandidateE2
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/RestrictToRegion.cpp.func.html b/doc/coverageReport/src/module/RestrictToRegion.cpp.func.html new file mode 100644 index 000000000..6024c3ad3 --- /dev/null +++ b/doc/coverageReport/src/module/RestrictToRegion.cpp.func.html @@ -0,0 +1,84 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/RestrictToRegion.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - RestrictToRegion.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:61250.0 %
Date:2024-04-08 14:58:22Functions:2366.7 %
+
+ +
+ + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16RestrictToRegionC2EPNS_6ModuleEPNS_7SurfaceE1
_ZNK7crpropa16RestrictToRegion14getDescriptionB5cxx11Ev0
_ZNK7crpropa16RestrictToRegion7processEPNS_9CandidateE2
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/RestrictToRegion.cpp.gcov.html b/doc/coverageReport/src/module/RestrictToRegion.cpp.gcov.html new file mode 100644 index 000000000..38282b565 --- /dev/null +++ b/doc/coverageReport/src/module/RestrictToRegion.cpp.gcov.html @@ -0,0 +1,101 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/RestrictToRegion.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - RestrictToRegion.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:61250.0 %
Date:2024-04-08 14:58:22Functions:2366.7 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/RestrictToRegion.h" 
+       2             : 
+       3             : #include <sstream>
+       4             : 
+       5             : namespace crpropa {
+       6             : 
+       7           1 : RestrictToRegion::RestrictToRegion(Module* _module, Surface* _surface) : module(_module), surface(_surface) { 
+       8           1 : };
+       9             : 
+      10           2 : void RestrictToRegion::process(Candidate *candidate) const {
+      11           2 :         if (surface->distance(candidate->current.getPosition()) <= 0) {
+      12           1 :                 module->process(candidate);
+      13             :         }
+      14           2 : };
+      15             : 
+      16           0 : std::string RestrictToRegion::getDescription() const {
+      17           0 :         std::stringstream s;
+      18             :         s << "RestrictToArea:\n"
+      19           0 :                 << "  Module: " << module->getDescription() << std::endl
+      20           0 :                 << "  Region: " << surface->getDescription() << std::endl;
+      21           0 :         return s.str();
+      22           0 : };
+      23             : 
+      24             : 
+      25             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/SimplePropagation.cpp.func-sort-c.html b/doc/coverageReport/src/module/SimplePropagation.cpp.func-sort-c.html new file mode 100644 index 000000000..1d24c0fb2 --- /dev/null +++ b/doc/coverageReport/src/module/SimplePropagation.cpp.func-sort-c.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/SimplePropagation.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - SimplePropagation.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:123336.4 %
Date:2024-04-08 14:58:22Functions:2728.6 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa17SimplePropagation14setMaximumStepEd0
_ZN7crpropa17SimplePropagation14setMinimumStepEd0
_ZNK7crpropa17SimplePropagation14getDescriptionB5cxx11Ev0
_ZNK7crpropa17SimplePropagation14getMaximumStepEv0
_ZNK7crpropa17SimplePropagation14getMinimumStepEv0
_ZN7crpropa17SimplePropagationC2Edd12
_ZNK7crpropa17SimplePropagation7processEPNS_9CandidateE19294
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/SimplePropagation.cpp.func.html b/doc/coverageReport/src/module/SimplePropagation.cpp.func.html new file mode 100644 index 000000000..2f86027c0 --- /dev/null +++ b/doc/coverageReport/src/module/SimplePropagation.cpp.func.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/SimplePropagation.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - SimplePropagation.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:123336.4 %
Date:2024-04-08 14:58:22Functions:2728.6 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa17SimplePropagation14setMaximumStepEd0
_ZN7crpropa17SimplePropagation14setMinimumStepEd0
_ZN7crpropa17SimplePropagationC2Edd12
_ZNK7crpropa17SimplePropagation14getDescriptionB5cxx11Ev0
_ZNK7crpropa17SimplePropagation14getMaximumStepEv0
_ZNK7crpropa17SimplePropagation14getMinimumStepEv0
_ZNK7crpropa17SimplePropagation7processEPNS_9CandidateE19294
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/SimplePropagation.cpp.gcov.html b/doc/coverageReport/src/module/SimplePropagation.cpp.gcov.html new file mode 100644 index 000000000..c01c7f1d1 --- /dev/null +++ b/doc/coverageReport/src/module/SimplePropagation.cpp.gcov.html @@ -0,0 +1,128 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/SimplePropagation.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - SimplePropagation.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:123336.4 %
Date:2024-04-08 14:58:22Functions:2728.6 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/SimplePropagation.h"
+       2             : 
+       3             : #include <sstream>
+       4             : #include <stdexcept>
+       5             : 
+       6             : namespace crpropa {
+       7             : 
+       8          12 : SimplePropagation::SimplePropagation(double minStep, double maxStep) :
+       9          12 :                 minStep(minStep), maxStep(maxStep) {
+      10          12 :         if (minStep > maxStep)
+      11           0 :                 throw std::runtime_error("SimplePropagation: minStep > maxStep");
+      12          12 : }
+      13             : 
+      14       19294 : void SimplePropagation::process(Candidate *c) const {
+      15             :         c->previous = c->current;
+      16             : 
+      17       19294 :         double step = clip(c->getNextStep(), minStep, maxStep);
+      18       19294 :         c->setCurrentStep(step);
+      19       19294 :         Vector3d pos = c->current.getPosition();
+      20       19294 :         Vector3d dir = c->current.getDirection();
+      21       19294 :         c->current.setPosition(pos + dir * step);
+      22       19294 :         c->setNextStep(maxStep);
+      23       19294 : }
+      24             : 
+      25           0 : void SimplePropagation::setMinimumStep(double step) {
+      26           0 :         if (step > maxStep)
+      27           0 :                 throw std::runtime_error("SimplePropagation: minStep > maxStep");
+      28           0 :         minStep = step;
+      29           0 : }
+      30             : 
+      31           0 : void SimplePropagation::setMaximumStep(double step) {
+      32           0 :         if (minStep > step)
+      33           0 :                 throw std::runtime_error("SimplePropagation: minStep > maxStep");
+      34           0 :         maxStep = step;
+      35           0 : }
+      36             : 
+      37           0 : double SimplePropagation::getMinimumStep() const {
+      38           0 :         return minStep;
+      39             : }
+      40             : 
+      41           0 : double SimplePropagation::getMaximumStep() const {
+      42           0 :         return maxStep;
+      43             : }
+      44             : 
+      45           0 : std::string SimplePropagation::getDescription() const {
+      46           0 :         std::stringstream s;
+      47           0 :         s << "SimplePropagation: Step size = " << minStep / kpc
+      48           0 :                         << " - " << maxStep / kpc << " kpc";
+      49           0 :         return s.str();
+      50           0 : }
+      51             : 
+      52             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/SynchrotronRadiation.cpp.func-sort-c.html b/doc/coverageReport/src/module/SynchrotronRadiation.cpp.func-sort-c.html new file mode 100644 index 000000000..d0dcbba06 --- /dev/null +++ b/doc/coverageReport/src/module/SynchrotronRadiation.cpp.func-sort-c.html @@ -0,0 +1,156 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/SynchrotronRadiation.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - SynchrotronRadiation.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8113161.8 %
Date:2024-04-08 14:58:22Functions:102147.6 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa20SynchrotronRadiation11getThinningEv0
_ZN7crpropa20SynchrotronRadiation11setThinningEd0
_ZN7crpropa20SynchrotronRadiation14getHavePhotonsEv0
_ZN7crpropa20SynchrotronRadiation17getMaximumSamplesEv0
_ZN7crpropa20SynchrotronRadiation7getBrmsEv0
_ZN7crpropa20SynchrotronRadiation8getFieldEv0
_ZN7crpropa20SynchrotronRadiation8getLimitEv0
_ZN7crpropa20SynchrotronRadiation8setFieldENS_7ref_ptrINS_13MagneticFieldEEE0
_ZN7crpropa20SynchrotronRadiationC2ENS_7ref_ptrINS_13MagneticFieldEEEbdid0
_ZNK7crpropa20SynchrotronRadiation14getDescriptionB5cxx11Ev0
_ZNK7crpropa20SynchrotronRadiation21getSecondaryThresholdEv0
_ZN7crpropa20SynchrotronRadiation12initSpectrumEv1
_ZN7crpropa20SynchrotronRadiation14setHavePhotonsEb1
_ZN7crpropa20SynchrotronRadiation17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa20SynchrotronRadiation17setMaximumSamplesEi1
_ZN7crpropa20SynchrotronRadiation21setSecondaryThresholdEd1
_ZN7crpropa20SynchrotronRadiation7setBrmsEd1
_ZN7crpropa20SynchrotronRadiation8setLimitEd1
_ZN7crpropa20SynchrotronRadiationC2Edbdid1
_ZNK7crpropa20SynchrotronRadiation7processEPNS_9CandidateE1
_ZNK7crpropa20SynchrotronRadiation17getInteractionTagB5cxx11Ev2
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/SynchrotronRadiation.cpp.func.html b/doc/coverageReport/src/module/SynchrotronRadiation.cpp.func.html new file mode 100644 index 000000000..bc212b37e --- /dev/null +++ b/doc/coverageReport/src/module/SynchrotronRadiation.cpp.func.html @@ -0,0 +1,156 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/SynchrotronRadiation.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - SynchrotronRadiation.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8113161.8 %
Date:2024-04-08 14:58:22Functions:102147.6 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa20SynchrotronRadiation11getThinningEv0
_ZN7crpropa20SynchrotronRadiation11setThinningEd0
_ZN7crpropa20SynchrotronRadiation12initSpectrumEv1
_ZN7crpropa20SynchrotronRadiation14getHavePhotonsEv0
_ZN7crpropa20SynchrotronRadiation14setHavePhotonsEb1
_ZN7crpropa20SynchrotronRadiation17getMaximumSamplesEv0
_ZN7crpropa20SynchrotronRadiation17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa20SynchrotronRadiation17setMaximumSamplesEi1
_ZN7crpropa20SynchrotronRadiation21setSecondaryThresholdEd1
_ZN7crpropa20SynchrotronRadiation7getBrmsEv0
_ZN7crpropa20SynchrotronRadiation7setBrmsEd1
_ZN7crpropa20SynchrotronRadiation8getFieldEv0
_ZN7crpropa20SynchrotronRadiation8getLimitEv0
_ZN7crpropa20SynchrotronRadiation8setFieldENS_7ref_ptrINS_13MagneticFieldEEE0
_ZN7crpropa20SynchrotronRadiation8setLimitEd1
_ZN7crpropa20SynchrotronRadiationC2ENS_7ref_ptrINS_13MagneticFieldEEEbdid0
_ZN7crpropa20SynchrotronRadiationC2Edbdid1
_ZNK7crpropa20SynchrotronRadiation14getDescriptionB5cxx11Ev0
_ZNK7crpropa20SynchrotronRadiation17getInteractionTagB5cxx11Ev2
_ZNK7crpropa20SynchrotronRadiation21getSecondaryThresholdEv0
_ZNK7crpropa20SynchrotronRadiation7processEPNS_9CandidateE1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/SynchrotronRadiation.cpp.gcov.html b/doc/coverageReport/src/module/SynchrotronRadiation.cpp.gcov.html new file mode 100644 index 000000000..3ea130039 --- /dev/null +++ b/doc/coverageReport/src/module/SynchrotronRadiation.cpp.gcov.html @@ -0,0 +1,306 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/SynchrotronRadiation.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - SynchrotronRadiation.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8113161.8 %
Date:2024-04-08 14:58:22Functions:102147.6 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/SynchrotronRadiation.h"
+       2             : #include "crpropa/Units.h"
+       3             : #include "crpropa/Random.h"
+       4             : 
+       5             : #include <fstream>
+       6             : #include <limits>
+       7             : #include <stdexcept>
+       8             : 
+       9             : namespace crpropa {
+      10             : 
+      11           0 : SynchrotronRadiation::SynchrotronRadiation(ref_ptr<MagneticField> field, bool havePhotons, double thinning, int nSamples, double limit) {
+      12           0 :         setField(field);
+      13           0 :         setBrms(0);
+      14           0 :         initSpectrum();
+      15           0 :         setHavePhotons(havePhotons);
+      16           0 :         setLimit(limit);
+      17           0 :         setSecondaryThreshold(1e6 * eV);
+      18           0 :         setMaximumSamples(nSamples);
+      19           0 : }
+      20             : 
+      21           1 : SynchrotronRadiation::SynchrotronRadiation(double Brms, bool havePhotons, double thinning, int nSamples, double limit) {
+      22           1 :         setBrms(Brms);
+      23           1 :         initSpectrum();
+      24           1 :         setHavePhotons(havePhotons);
+      25           1 :         setLimit(limit);
+      26           1 :         setSecondaryThreshold(1e6 * eV);
+      27           1 :         setMaximumSamples(nSamples);
+      28           1 : }
+      29             : 
+      30           0 : void SynchrotronRadiation::setField(ref_ptr<MagneticField> f) {
+      31           0 :         this->field = f;
+      32           0 : }
+      33             : 
+      34           0 : ref_ptr<MagneticField> SynchrotronRadiation::getField() {
+      35           0 :         return field;
+      36             : }
+      37             : 
+      38           1 : void SynchrotronRadiation::setBrms(double Brms) {
+      39           1 :         this->Brms = Brms;
+      40           1 : }
+      41             : 
+      42           0 : double SynchrotronRadiation::getBrms() {
+      43           0 :         return Brms;
+      44             : }
+      45             : 
+      46           1 : void SynchrotronRadiation::setHavePhotons(bool havePhotons) {
+      47           1 :         this->havePhotons = havePhotons;
+      48           1 : }
+      49             : 
+      50           0 : bool SynchrotronRadiation::getHavePhotons() {
+      51           0 :         return havePhotons;
+      52             : }
+      53             : 
+      54           0 : void SynchrotronRadiation::setThinning(double thinning) {
+      55           0 :         this->thinning = thinning;
+      56           0 : }
+      57             : 
+      58           0 : double SynchrotronRadiation::getThinning() {
+      59           0 :         return thinning;
+      60             : }
+      61             : 
+      62           1 : void SynchrotronRadiation::setLimit(double limit) {
+      63           1 :         this->limit = limit;
+      64           1 : }
+      65             : 
+      66           0 : double SynchrotronRadiation::getLimit() {
+      67           0 :         return limit;
+      68             : }
+      69             : 
+      70           1 : void SynchrotronRadiation::setMaximumSamples(int nmax) {
+      71           1 :         maximumSamples = nmax;
+      72           1 : }
+      73             : 
+      74           0 : int SynchrotronRadiation::getMaximumSamples() {
+      75           0 :         return maximumSamples;
+      76             : }
+      77             : 
+      78           1 : void SynchrotronRadiation::setSecondaryThreshold(double threshold) {
+      79           1 :         secondaryThreshold = threshold;
+      80           1 : }
+      81             : 
+      82           0 : double SynchrotronRadiation::getSecondaryThreshold() const {
+      83           0 :         return secondaryThreshold;
+      84             : }
+      85             : 
+      86           1 : void SynchrotronRadiation::initSpectrum() {
+      87           2 :         std::string filename = getDataPath("Synchrotron/spectrum.txt");
+      88           1 :         std::ifstream infile(filename.c_str());
+      89             : 
+      90           1 :         if (!infile.good())
+      91           0 :                 throw std::runtime_error("SynchrotronRadiation: could not open file " + filename);
+      92             : 
+      93             :         // clear previously loaded interaction rates
+      94           1 :         tabx.clear();
+      95           1 :         tabCDF.clear();
+      96             : 
+      97        1407 :         while (infile.good()) {
+      98        1406 :                 if (infile.peek() != '#') {
+      99             :                         double a, b;
+     100             :                         infile >> a >> b;
+     101        1402 :                         if (infile) {
+     102        1401 :                                 tabx.push_back(pow(10, a));
+     103        1401 :                                 tabCDF.push_back(b);
+     104             :                         }
+     105             :                 }
+     106        1406 :                 infile.ignore(std::numeric_limits < std::streamsize > ::max(), '\n');
+     107             :         }
+     108           1 :         infile.close();
+     109           2 : }
+     110             : 
+     111           1 : void SynchrotronRadiation::process(Candidate *candidate) const {
+     112           1 :         double charge = fabs(candidate->current.getCharge());
+     113           1 :         if (charge == 0)
+     114           0 :                 return; // only charged particles
+     115             : 
+     116             :         // calculate gyroradius, evaluated at the current position
+     117           1 :         double z = candidate->getRedshift();
+     118             :         double B;
+     119           1 :         if (field.valid()) {
+     120           0 :                 Vector3d Bvec = field->getField(candidate->current.getPosition(), z);
+     121           0 :                 B = Bvec.cross(candidate->current.getDirection()).getR();
+     122             :         } else {
+     123           1 :                 B = sqrt(2. / 3) * Brms; // average perpendicular field component
+     124             :         }
+     125           1 :         B *= pow(1 + z, 2); // cosmological scaling
+     126           1 :         double Rg = candidate->current.getMomentum().getR() / charge / B;
+     127             : 
+     128             :         // calculate energy loss
+     129           1 :         double lf = candidate->current.getLorentzFactor();
+     130           1 :         double dEdx = 1. / 6 / M_PI / epsilon0 * pow(lf * lf - 1, 2) * pow(charge / Rg, 2); // Jackson p. 770 (14.31)
+     131           1 :         double step = candidate->getCurrentStep() / (1 + z); // step size in local frame
+     132           1 :         double dE = step * dEdx;
+     133             : 
+     134             :         // apply energy loss and limit next step
+     135           1 :         double E = candidate->current.getEnergy();
+     136           1 :         candidate->current.setEnergy(E - dE);
+     137           1 :         candidate->limitNextStep(limit * E / dEdx);
+     138             : 
+     139             :         // optionally add secondary photons
+     140           1 :         if (not(havePhotons))
+     141             :                 return;
+     142             : 
+     143             :         // check if photons with energies > 14 * Ecrit are possible
+     144           1 :         double Ecrit = 3. / 4 * h_planck / M_PI * c_light * pow(lf, 3) / Rg;
+     145           1 :         if (14 * Ecrit < secondaryThreshold)
+     146             :                 return;
+     147             : 
+     148             :         // draw photons up to the total energy loss
+     149             :         // if maximumSamples is reached before that, compensate the total energy afterwards
+     150           1 :         Random &random = Random::instance();
+     151             :         double dE0 = dE;
+     152             :         std::vector<double> energies;
+     153             :         int counter = 0;
+     154     3620603 :         while (dE > 0) {
+     155             :                 // draw random value between 0 and maximum of corresponding cdf
+     156             :                 // choose bin of s where cdf(x) = cdf_rand -> x_rand
+     157     3620602 :                 size_t i = random.randBin(tabCDF); // draw random bin (upper bin boundary returned)
+     158     3620602 :                 double binWidth = (tabx[i] - tabx[i-1]);
+     159     3620602 :                 double x = tabx[i-1] + random.rand() * binWidth; // draw random x uniformly distributed in bin
+     160     3620602 :                 double Ephoton = x * Ecrit;
+     161             : 
+     162             :                 // if the remaining energy is not sufficient check for random accepting
+     163     3620602 :                 if (Ephoton > dE) {
+     164           1 :                         if (random.rand() > (dE / Ephoton))
+     165             :                                 break; // not accepted
+     166             :                 }
+     167             : 
+     168             :                 // only activate the "per-step" sampling if maximumSamples is explicitly set.
+     169     3620602 :                 if (maximumSamples > 0) {
+     170           0 :                         if (counter >= maximumSamples) 
+     171             :                                 break;                  
+     172             :                 }
+     173             : 
+     174             :                 // store energies in array
+     175     3620602 :                 energies.push_back(Ephoton);
+     176             : 
+     177             :                 // energy loss
+     178     3620602 :                 dE -= Ephoton;
+     179             : 
+     180             :                 // counter for sampling break condition;
+     181     3620602 :                 counter++;
+     182             :         }
+     183             : 
+     184             :         // while loop before gave total energy which is just a fraction of the required
+     185             :         double w1 = 1;
+     186           1 :         if (maximumSamples > 0 && dE > 0)
+     187           0 :                 w1 = 1. / (1. - dE / dE0); 
+     188             : 
+     189             :         // loop over sampled photons and attribute weights accordingly
+     190     3620603 :         for (int i = 0; i < energies.size(); i++) {
+     191     3620602 :                 double Ephoton = energies[i];
+     192     3620602 :                 double f = Ephoton / (E - dE0);
+     193     3620602 :                 double w = w1 / pow(f, thinning);
+     194             : 
+     195             :                 // thinning procedure: accepts only a few random secondaries
+     196     3620602 :                 if (random.rand() < pow(f, thinning)) {
+     197     3620602 :                         Vector3d pos = random.randomInterpolatedPosition(candidate->previous.getPosition(), candidate->current.getPosition());
+     198     3620602 :                         if (Ephoton > secondaryThreshold) // create only photons with energies above threshold
+     199     3309554 :                                 candidate->addSecondary(22, Ephoton, pos, w, interactionTag);
+     200             :                 }
+     201             :         }
+     202             : }
+     203             : 
+     204           0 : std::string SynchrotronRadiation::getDescription() const {
+     205           0 :         std::stringstream s;
+     206           0 :         s << "Synchrotron radiation";
+     207           0 :         if (field.valid())
+     208           0 :                 s << " for specified magnetic field";
+     209             :         else
+     210           0 :                 s << " for Brms = " << Brms / nG << " nG";
+     211           0 :         if (havePhotons)
+     212           0 :                 s << ", synchrotron photons E > " << secondaryThreshold / eV << " eV";
+     213             :         else
+     214           0 :                 s << ", no synchrotron photons";
+     215           0 :         if (maximumSamples > 0)
+     216           0 :                 s << "maximum number of photon samples: " << maximumSamples;
+     217           0 :         if (thinning > 0)
+     218           0 :                 s << "thinning parameter: " << thinning; 
+     219           0 :         return s.str();
+     220           0 : }
+     221             : 
+     222           1 : void SynchrotronRadiation::setInteractionTag(std::string tag) {
+     223           1 :         interactionTag = tag;
+     224           1 : }
+     225             : 
+     226           2 : std::string SynchrotronRadiation::getInteractionTag() const {
+     227           2 :         return interactionTag;
+     228             : }
+     229             : 
+     230             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/TextOutput.cpp.func-sort-c.html b/doc/coverageReport/src/module/TextOutput.cpp.func-sort-c.html new file mode 100644 index 000000000..97378d014 --- /dev/null +++ b/doc/coverageReport/src/module/TextOutput.cpp.func-sort-c.html @@ -0,0 +1,128 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/TextOutput.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - TextOutput.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:21924988.0 %
Date:2024-04-08 14:58:22Functions:91464.3 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa10TextOutput4gzipEv0
_ZN7crpropa10TextOutputC2ERSo0
_ZN7crpropa10TextOutputC2ERSoNS_6Output10OutputTypeE0
_ZN7crpropa10TextOutputC2Ev0
_ZNK7crpropa10TextOutput14getDescriptionB5cxx11Ev0
_ZN7crpropa10TextOutput4loadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPNS_17ParticleCollectorE1
_ZN7crpropa10TextOutputC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_6Output10OutputTypeE1
_ZN7crpropa10TextOutputD0Ev1
_ZN7crpropa10TextOutputC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE2
_ZN7crpropa10TextOutputC2ENS_6Output10OutputTypeE7
_ZN7crpropa10TextOutputD2Ev9
_ZNK7crpropa10TextOutput11printHeaderEv9
_ZN7crpropa10TextOutput5closeEv10
_ZNK7crpropa10TextOutput7processEPNS_9CandidateE54
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/TextOutput.cpp.func.html b/doc/coverageReport/src/module/TextOutput.cpp.func.html new file mode 100644 index 000000000..1ca5f18f5 --- /dev/null +++ b/doc/coverageReport/src/module/TextOutput.cpp.func.html @@ -0,0 +1,128 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/TextOutput.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - TextOutput.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:21924988.0 %
Date:2024-04-08 14:58:22Functions:91464.3 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa10TextOutput4gzipEv0
_ZN7crpropa10TextOutput4loadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPNS_17ParticleCollectorE1
_ZN7crpropa10TextOutput5closeEv10
_ZN7crpropa10TextOutputC2ENS_6Output10OutputTypeE7
_ZN7crpropa10TextOutputC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE2
_ZN7crpropa10TextOutputC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_6Output10OutputTypeE1
_ZN7crpropa10TextOutputC2ERSo0
_ZN7crpropa10TextOutputC2ERSoNS_6Output10OutputTypeE0
_ZN7crpropa10TextOutputC2Ev0
_ZN7crpropa10TextOutputD0Ev1
_ZN7crpropa10TextOutputD2Ev9
_ZNK7crpropa10TextOutput11printHeaderEv9
_ZNK7crpropa10TextOutput14getDescriptionB5cxx11Ev0
_ZNK7crpropa10TextOutput7processEPNS_9CandidateE54
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/TextOutput.cpp.gcov.html b/doc/coverageReport/src/module/TextOutput.cpp.gcov.html new file mode 100644 index 000000000..7ac87a19d --- /dev/null +++ b/doc/coverageReport/src/module/TextOutput.cpp.gcov.html @@ -0,0 +1,457 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/TextOutput.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - TextOutput.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:21924988.0 %
Date:2024-04-08 14:58:22Functions:91464.3 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/TextOutput.h"
+       2             : #include "crpropa/module/ParticleCollector.h"
+       3             : #include "crpropa/Units.h"
+       4             : #include "crpropa/Version.h"
+       5             : #include "crpropa/Random.h"
+       6             : #include "crpropa/base64.h"
+       7             : 
+       8             : #include "kiss/string.h"
+       9             : 
+      10             : #include <cstdio>
+      11             : #include <stdexcept>
+      12             : #include <iostream>
+      13             : 
+      14             : #ifdef CRPROPA_HAVE_ZLIB
+      15             : #include <izstream.hpp>
+      16             : #include <ozstream.hpp>
+      17             : #endif
+      18             : 
+      19             : namespace crpropa {
+      20             : 
+      21           0 : TextOutput::TextOutput() : Output(), out(&std::cout), storeRandomSeeds(false) {
+      22           0 : }
+      23             : 
+      24           7 : TextOutput::TextOutput(OutputType outputtype) : Output(outputtype), out(&std::cout), storeRandomSeeds(false) {
+      25           7 : }
+      26             : 
+      27           0 : TextOutput::TextOutput(std::ostream &out) : Output(), out(&out), storeRandomSeeds(false) {
+      28           0 : }
+      29             : 
+      30           0 : TextOutput::TextOutput(std::ostream &out,
+      31           0 :                 OutputType outputtype) : Output(outputtype), out(&out), storeRandomSeeds(false) {
+      32           0 : }
+      33             : 
+      34           4 : TextOutput::TextOutput(const std::string &filename) :  Output(), outfile(filename.c_str(),
+      35           2 :                                 std::ios::binary), out(&outfile),  filename(
+      36           4 :                                 filename), storeRandomSeeds(false) {
+      37           2 :         if (!outfile.is_open())
+      38           2 :                 throw std::runtime_error(std::string("Cannot create file: ") + filename);
+      39           3 :         if (kiss::ends_with(filename, ".gz"))
+      40           0 :                 gzip();
+      41           3 : }
+      42             : 
+      43           1 : TextOutput::TextOutput(const std::string &filename,
+      44           2 :                                 OutputType outputtype) : Output(outputtype), outfile(filename.c_str(),
+      45           1 :                                 std::ios::binary), out(&outfile), filename(
+      46           2 :                                 filename), storeRandomSeeds(false) {
+      47           1 :         if (!outfile.is_open())
+      48           0 :                 throw std::runtime_error(std::string("Cannot create file: ") + filename);
+      49           2 :         if (kiss::ends_with(filename, ".gz"))
+      50           0 :                 gzip();
+      51           1 : }
+      52             : 
+      53           9 : void TextOutput::printHeader() const {
+      54           9 :         *out << "#";
+      55           9 :         if (fields.test(TrajectoryLengthColumn))
+      56           6 :                 *out << "\tD";
+      57           9 :         if (fields.test(RedshiftColumn))
+      58           2 :                 *out << "\tz";
+      59           9 :         if (fields.test(SerialNumberColumn))
+      60           3 :                 *out << "\tSN";
+      61           9 :         if (fields.test(CurrentIdColumn))
+      62           8 :                 *out << "\tID";
+      63           9 :         if (fields.test(CurrentEnergyColumn))
+      64           8 :                 *out << "\tE";
+      65           9 :         if (fields.test(CurrentPositionColumn) && oneDimensional)
+      66           2 :                 *out << "\tX";
+      67           9 :         if (fields.test(CurrentPositionColumn) && not oneDimensional)
+      68           3 :                 *out << "\tX\tY\tZ";
+      69           9 :         if (fields.test(CurrentDirectionColumn) && not oneDimensional)
+      70           3 :                 *out << "\tPx\tPy\tPz";
+      71           9 :         if (fields.test(SerialNumberColumn))
+      72           3 :                 *out << "\tSN0";
+      73           9 :         if (fields.test(SourceIdColumn))
+      74           6 :                 *out << "\tID0";
+      75           9 :         if (fields.test(SourceEnergyColumn))
+      76           6 :                 *out << "\tE0";
+      77           9 :         if (fields.test(SourcePositionColumn) && oneDimensional) 
+      78           1 :                 *out << "\tX0";
+      79           9 :         if (fields.test(SourcePositionColumn) && not oneDimensional)
+      80           2 :                 *out << "\tX0\tY0\tZ0";
+      81           9 :         if (fields.test(SourceDirectionColumn) && not oneDimensional)
+      82           2 :                 *out << "\tP0x\tP0y\tP0z";
+      83           9 :         if (fields.test(SerialNumberColumn))
+      84           3 :                 *out << "\tSN1";
+      85           9 :         if (fields.test(CreatedIdColumn))
+      86           2 :                 *out << "\tID1";
+      87           9 :         if (fields.test(CreatedEnergyColumn))
+      88           2 :                 *out << "\tE1";
+      89           9 :         if (fields.test(CreatedPositionColumn) && oneDimensional)
+      90           1 :                 *out << "\tX1";
+      91           9 :         if (fields.test(CreatedPositionColumn) && not oneDimensional)
+      92           1 :                 *out << "\tX1\tY1\tZ1";
+      93           9 :         if (fields.test(CreatedDirectionColumn) && not oneDimensional)
+      94           1 :                 *out << "\tP1x\tP1y\tP1z";
+      95           9 :         if (fields.test(WeightColumn))
+      96           2 :                 *out << "\tW";
+      97           9 :         if (fields.test(CandidateTagColumn))
+      98           3 :                 *out << "\ttag";
+      99           9 :         for(std::vector<Property>::const_iterator iter = properties.begin();
+     100          10 :                         iter != properties.end(); ++iter)
+     101             :         {
+     102           1 :                 *out << "\t" << (*iter).name;
+     103             :         }
+     104             : 
+     105           9 :         *out << "\n#\n";
+     106           9 :         if (fields.test(TrajectoryLengthColumn))
+     107           6 :                 *out << "# D             Trajectory length [" << lengthScale / Mpc
+     108           6 :                                 << " Mpc]\n";
+     109           9 :         if (fields.test(RedshiftColumn))
+     110           2 :                 *out << "# z             Redshift\n";
+     111           9 :         if (fields.test(SerialNumberColumn))
+     112           3 :                 *out << "# SN/SN0/SN1    Serial number. Unique (within this run) id of the particle.\n";
+     113           1 :         if (fields.test(CurrentIdColumn) || fields.test(CreatedIdColumn)
+     114          10 :                         || fields.test(SourceIdColumn))
+     115           8 :                 *out << "# ID/ID0/ID1    Particle type (PDG MC numbering scheme)\n";
+     116           1 :         if (fields.test(CurrentEnergyColumn) || fields.test(CreatedEnergyColumn)
+     117          10 :                         || fields.test(SourceEnergyColumn))
+     118           8 :                 *out << "# E/E0/E1       Energy [" << energyScale / EeV << " EeV]\n";
+     119           4 :         if (fields.test(CurrentPositionColumn) || fields.test(CreatedPositionColumn)
+     120          13 :                         || fields.test(SourcePositionColumn))
+     121           5 :                 *out << "# X/X0/X1...    Position [" << lengthScale / Mpc << " Mpc]\n";
+     122             :         if (fields.test(CurrentDirectionColumn)
+     123           5 :                         || fields.test(CreatedDirectionColumn)
+     124          14 :                         || fields.test(SourceDirectionColumn))
+     125           4 :                 *out << "# Px/P0x/P1x... Heading (unit vector of momentum)\n";
+     126           9 :         if (fields.test(WeightColumn))
+     127           2 :                 *out << "# W             Weights" << " \n";
+     128           9 :         if (fields.test(CandidateTagColumn)) {
+     129           3 :                 *out << "# tag           Candidate tag can be given by the source feature (user defined tag) or by the following interaction process \n";
+     130           3 :                 *out << "#\tES  \tElasticScattering \n" << "#\tEPP \tElectronPairProduction \n" << "#\tEMPP\tEMPairProduction\n"
+     131             :                         << "#\tEMDP\tEMDoublePairProduction\n" << "#\tEMTP\tEMTripletPairProduction \n" << "#\tEMIC\tEMInverseComptonScattering\n"
+     132             :                         << "#\tND  \tNuclearDecay\n" << "#\tPD  \tPhotoDisintegration\n" << "#\tPPP  \tPhotoPionProduction\n" << "#\tSYN \tSynchrotronRadiation\n"
+     133           3 :                         << "#\tPRIM/SEC\t primary / secondary particle\n";
+     134             :         }
+     135           9 :         for(std::vector<Property>::const_iterator iter = properties.begin();
+     136          10 :                         iter != properties.end(); ++iter)
+     137             :         {
+     138           2 :                         *out << "# " << (*iter).name << " " << (*iter).comment << "\n";
+     139             :         }
+     140             : 
+     141           9 :         *out << "# no index = current, 0 = at source, 1 = at point of creation\n#\n";
+     142          18 :         *out << "# CRPropa version: " << g_GIT_DESC << "\n#\n";
+     143             : 
+     144           9 :         if (storeRandomSeeds)
+     145             :         {
+     146           0 :                 *out << "# Random seeds:\n";
+     147           0 :                 std::vector< std::vector<uint32_t> > seeds = Random::getSeedThreads();
+     148             : 
+     149           0 :                 for (size_t i =0; i < seeds.size(); i++)
+     150             :                 {
+     151           0 :                         std::string encoded_data = Base64::encode((unsigned char*) &seeds[i][0], sizeof(seeds[i][0]) * seeds[i].size() / sizeof(unsigned char));
+     152           0 :                         *out << "#   Thread " << i << ": ";
+     153           0 :                         *out << encoded_data;
+     154           0 :                         *out << "\n";
+     155             :                 }
+     156           0 :         }
+     157           9 : }
+     158             : 
+     159          54 : void TextOutput::process(Candidate *c) const {
+     160          54 :         if (fields.none() && properties.empty())
+     161           0 :                 return;
+     162             : 
+     163             :         char buffer[1024];
+     164             :         size_t p = 0;
+     165             : 
+     166          54 :         std::locale old_locale = std::locale::global(std::locale::classic());
+     167             : 
+     168          54 :         if (fields.test(TrajectoryLengthColumn))
+     169          51 :                 p += std::sprintf(buffer + p, "%8.5E\t",
+     170          51 :                                 c->getTrajectoryLength() / lengthScale);
+     171             : 
+     172          54 :         if (fields.test(RedshiftColumn))
+     173          47 :                 p += std::sprintf(buffer + p, "%1.5E\t", c->getRedshift());
+     174             : 
+     175          54 :         if (fields.test(SerialNumberColumn))
+     176          48 :                 p += std::sprintf(buffer + p, "%10lu\t",
+     177             :                                 c->getSerialNumber());
+     178          54 :         if (fields.test(CurrentIdColumn))
+     179          53 :                 p += std::sprintf(buffer + p, "%10i\t", c->current.getId());
+     180          54 :         if (fields.test(CurrentEnergyColumn))
+     181          53 :                 p += std::sprintf(buffer + p, "%8.5E\t",
+     182          53 :                                 c->current.getEnergy() / energyScale);
+     183          54 :         if (fields.test(CurrentPositionColumn)) {
+     184          50 :                 if (oneDimensional) {
+     185          37 :                         p += std::sprintf(buffer + p, "%8.5E\t",
+     186          37 :                                         c->current.getPosition().x / lengthScale);
+     187             :                 } else {
+     188          13 :                         const Vector3d pos = c->current.getPosition() / lengthScale;
+     189          13 :                         p += std::sprintf(buffer + p, "%8.5E\t%8.5E\t%8.5E\t", pos.x, pos.y,
+     190             :                                         pos.z);
+     191             :                 }
+     192             :         }
+     193          54 :         if (fields.test(CurrentDirectionColumn)) {
+     194          49 :                 if (not oneDimensional) {
+     195          13 :                         const Vector3d pos = c->current.getDirection();
+     196          13 :                         p += std::sprintf(buffer + p, "%8.5E\t%8.5E\t%8.5E\t", pos.x, pos.y,
+     197             :                                         pos.z);
+     198             :                 }
+     199             :         }
+     200             : 
+     201          54 :         if (fields.test(SerialNumberColumn))
+     202          48 :                 p += std::sprintf(buffer + p, "%10lu\t", c->getSourceSerialNumber());
+     203          54 :         if (fields.test(SourceIdColumn))
+     204          51 :                 p += std::sprintf(buffer + p, "%10i\t", c->source.getId());
+     205          54 :         if (fields.test(SourceEnergyColumn))
+     206          51 :                 p += std::sprintf(buffer + p, "%8.5E\t",
+     207          51 :                                 c->source.getEnergy() / energyScale);
+     208          54 :         if (fields.test(SourcePositionColumn)) {
+     209          48 :                 if (oneDimensional) {
+     210          36 :                         p += std::sprintf(buffer + p, "%8.5E\t",
+     211          36 :                                         c->source.getPosition().x / lengthScale);
+     212             :                 } else {
+     213          12 :                         const Vector3d pos = c->source.getPosition() / lengthScale;
+     214          12 :                         p += std::sprintf(buffer + p, "%8.5E\t%8.5E\t%8.5E\t", pos.x, pos.y,
+     215             :                                         pos.z);
+     216             :                 }
+     217             :         }
+     218          54 :         if (fields.test(SourceDirectionColumn)) {
+     219          48 :                 if (not oneDimensional) {
+     220          12 :                         const Vector3d pos = c->source.getDirection();
+     221          12 :                         p += std::sprintf(buffer + p, "%8.5E\t%8.5E\t%8.5E\t", pos.x, pos.y,
+     222             :                                         pos.z);
+     223             :                 }
+     224             : 
+     225             :         }
+     226             : 
+     227          54 :         if (fields.test(SerialNumberColumn))
+     228          48 :                 p += std::sprintf(buffer + p, "%10lu\t",
+     229             :                                 c->getCreatedSerialNumber());
+     230          54 :         if (fields.test(CreatedIdColumn))
+     231          47 :                 p += std::sprintf(buffer + p, "%10i\t", c->created.getId());
+     232          54 :         if (fields.test(CreatedEnergyColumn))
+     233          47 :                 p += std::sprintf(buffer + p, "%8.5E\t",
+     234          47 :                                 c->created.getEnergy() / energyScale);
+     235          54 :         if (fields.test(CreatedPositionColumn)) {
+     236          47 :                 if (oneDimensional) {
+     237          36 :                         p += std::sprintf(buffer + p, "%8.5E\t",
+     238          36 :                                         c->created.getPosition().x / lengthScale);
+     239             :                 } else {
+     240          11 :                         const Vector3d pos = c->created.getPosition() / lengthScale;
+     241          11 :                         p += std::sprintf(buffer + p, "%8.5E\t%8.5E\t%8.5E\t", pos.x, pos.y,
+     242             :                                         pos.z);
+     243             :                 }
+     244             :         }
+     245          54 :         if (fields.test(CreatedDirectionColumn)) {
+     246          47 :                 if (not oneDimensional) {
+     247          11 :                         const Vector3d pos = c->created.getDirection();
+     248          11 :                         p += std::sprintf(buffer + p, "%8.5E\t%8.5E\t%8.5E\t", pos.x, pos.y,
+     249             :                                         pos.z);
+     250             :                 }
+     251             :         }
+     252          54 :         if (fields.test(WeightColumn)) {
+     253          47 :                 p += std::sprintf(buffer + p, "%8.5E\t", c->getWeight());
+     254             :         }
+     255          54 :         if (fields.test(CandidateTagColumn)) {
+     256          48 :                 p += std::sprintf(buffer + p, "%s\t", c->getTagOrigin().c_str());
+     257             :         }
+     258             : 
+     259          54 :         for(std::vector<Output::Property>::const_iterator iter = properties.begin();
+     260          55 :                         iter != properties.end(); ++iter) {
+     261           1 :                   Variant v;
+     262           1 :                         if (c->hasProperty((*iter).name)) {
+     263           0 :                                 v = c->getProperty((*iter).name);
+     264             :                         } else {
+     265           1 :                                 v = (*iter).defaultValue;
+     266             :                         }
+     267           1 :                         p += std::sprintf(buffer + p, "%s", v.toString("\t").c_str());
+     268           1 :                         p += std::sprintf(buffer + p, "\t");
+     269           1 :         }
+     270          54 :         buffer[p - 1] = '\n';
+     271             : 
+     272          54 :         std::locale::global(old_locale);
+     273             : 
+     274         108 : #pragma omp critical
+     275             :         {
+     276          54 :                 if (count == 0)
+     277           9 :                         printHeader();
+     278          54 :                 Output::process(c);
+     279          54 :                 out->write(buffer, p);
+     280             :         }
+     281             : 
+     282          54 : }
+     283             : 
+     284           1 : void TextOutput::load(const std::string &filename, ParticleCollector *collector){
+     285             : 
+     286             :         std::string line;
+     287             :         std::istream *in;
+     288           1 :         std::ifstream infile(filename.c_str());
+     289             :         
+     290             :         double lengthScale = Mpc; // default Mpc
+     291             :         double energyScale = EeV; // default EeV
+     292             : 
+     293           1 :         if (!infile.good())
+     294           0 :                 throw std::runtime_error("crpropa::TextOutput: could not open file " + filename);
+     295             :         in = &infile;
+     296             :         
+     297           2 :         if (kiss::ends_with(filename, ".gz")){
+     298             : #ifdef CRPROPA_HAVE_ZLIB
+     299           0 :                 in = new zstream::igzstream(*in);
+     300             : #else
+     301             :                 throw std::runtime_error("CRPropa was built without Zlib compression!");
+     302             : #endif
+     303             :         }
+     304             : 
+     305          38 :         while (std::getline(*in, line)) {
+     306          37 :                 std::stringstream stream(line);
+     307          37 :                 if (stream.peek() == '#')
+     308             :                         continue;
+     309             : 
+     310          22 :                 ref_ptr<Candidate> c = new Candidate(); 
+     311             :                 double val_d; int val_i;
+     312             :                 double x, y, z;
+     313             :                 stream >> val_d;
+     314          11 :                 c->setTrajectoryLength(val_d*lengthScale); // D
+     315             :                 stream >> val_d;
+     316          11 :                 c->setRedshift(val_d); // z
+     317          11 :                 stream >> val_i;
+     318          11 :                 c->setSerialNumber(val_i); // SN
+     319          11 :                 stream >> val_i;
+     320          11 :                 c->current.setId(val_i); // ID
+     321             :                 stream >> val_d;
+     322          11 :                 c->current.setEnergy(val_d*energyScale); // E
+     323             :                 stream >> x >> y >> z;
+     324          11 :                 c->current.setPosition(Vector3d(x, y, z)*lengthScale); // X, Y, Z
+     325             :                 stream >> x >> y >> z;
+     326          11 :                 c->current.setDirection(Vector3d(x, y, z)*lengthScale); // Px, Py, Pz
+     327          11 :                 stream >> val_i; // SN0 (TODO: Reconstruct the parent-child relationship)
+     328          11 :                 stream >> val_i;
+     329          11 :                 c->source.setId(val_i); // ID0
+     330             :                 stream >> val_d;
+     331          11 :                 c->source.setEnergy(val_d*energyScale);      // E0
+     332             :                 stream >> x >> y >> z;
+     333          11 :                 c->source.setPosition(Vector3d(x, y, z)*lengthScale); // X0, Y0, Z0
+     334             :                 stream >> x >> y >> z;
+     335          11 :                 c->source.setDirection(Vector3d(x, y, z)*lengthScale); // P0x, P0y, P0z
+     336          11 :                 stream >> val_i; // SN1
+     337          11 :                 stream >> val_i;
+     338          11 :                 c->created.setId(val_i); // ID1
+     339             :                 stream >> val_d;
+     340          11 :                 c->created.setEnergy(val_d*energyScale); // E1
+     341             :                 stream >> x >> y >> z;
+     342          11 :                 c->created.setPosition(Vector3d(x, y, z)*lengthScale); // X1, Y1, Z1
+     343             :                 stream >> x >> y >> z;
+     344          11 :                 c->created.setDirection(Vector3d(x, y, z)*lengthScale); // P1x, P1y, P1z
+     345             :                 stream >> val_d;
+     346          11 :                 c->setWeight(val_d); // W
+     347             : 
+     348          22 :                 collector->process(c);
+     349          37 :         }
+     350           1 :         infile.close();
+     351           2 : }
+     352             : 
+     353           0 : std::string TextOutput::getDescription() const {
+     354           0 :         return "TextOutput";
+     355             : }
+     356             : 
+     357          10 : void TextOutput::close() {
+     358             : #ifdef CRPROPA_HAVE_ZLIB
+     359          10 :         zstream::ogzstream *zs = dynamic_cast<zstream::ogzstream *>(out);
+     360          10 :         if (zs) {
+     361           0 :                 zs->close();
+     362           0 :                 delete out;
+     363           0 :                 out = 0;
+     364             :         }
+     365             : #endif
+     366          10 :         outfile.flush();
+     367          10 : }
+     368             : 
+     369          10 : TextOutput::~TextOutput() {
+     370           9 :         close();
+     371          10 : }
+     372             : 
+     373           0 : void TextOutput::gzip() {
+     374             : #ifdef CRPROPA_HAVE_ZLIB
+     375           0 :         out = new zstream::ogzstream(*out);
+     376             : #else
+     377             :         throw std::runtime_error("CRPropa was built without Zlib compression!");
+     378             : #endif
+     379           0 : }
+     380             : 
+     381             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/Tools.cpp.func-sort-c.html b/doc/coverageReport/src/module/Tools.cpp.func-sort-c.html new file mode 100644 index 000000000..ec6611df0 --- /dev/null +++ b/doc/coverageReport/src/module/Tools.cpp.func-sort-c.html @@ -0,0 +1,136 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/Tools.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - Tools.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:77010.0 %
Date:2024-04-08 14:58:22Functions:21612.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa14ParticleFilter5addIdEi0
_ZN7crpropa14ParticleFilter6getIdsEv0
_ZN7crpropa14ParticleFilter8removeIdEi0
_ZN7crpropa14ParticleFilterC2Ev0
_ZN7crpropa17EmissionMapFiller14setEmissionMapEPNS_11EmissionMapE0
_ZN7crpropa17EmissionMapFillerC2EPNS_11EmissionMapE0
_ZN7crpropa17PerformanceModule3addEPNS_6ModuleE0
_ZN7crpropa17PerformanceModuleD0Ev0
_ZN7crpropa17PerformanceModuleD2Ev0
_ZNK7crpropa14ParticleFilter14getDescriptionB5cxx11Ev0
_ZNK7crpropa17EmissionMapFiller14getDescriptionB5cxx11Ev0
_ZNK7crpropa17EmissionMapFiller7processEPNS_9CandidateE0
_ZNK7crpropa17PerformanceModule14getDescriptionB5cxx11Ev0
_ZNK7crpropa17PerformanceModule7processEPNS_9CandidateE0
_ZN7crpropa14ParticleFilterC2ERKSt3setIiSt4lessIiESaIiEE1
_ZNK7crpropa14ParticleFilter7processEPNS_9CandidateE7
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/Tools.cpp.func.html b/doc/coverageReport/src/module/Tools.cpp.func.html new file mode 100644 index 000000000..23037d8e8 --- /dev/null +++ b/doc/coverageReport/src/module/Tools.cpp.func.html @@ -0,0 +1,136 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/Tools.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - Tools.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:77010.0 %
Date:2024-04-08 14:58:22Functions:21612.5 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa14ParticleFilter5addIdEi0
_ZN7crpropa14ParticleFilter6getIdsEv0
_ZN7crpropa14ParticleFilter8removeIdEi0
_ZN7crpropa14ParticleFilterC2ERKSt3setIiSt4lessIiESaIiEE1
_ZN7crpropa14ParticleFilterC2Ev0
_ZN7crpropa17EmissionMapFiller14setEmissionMapEPNS_11EmissionMapE0
_ZN7crpropa17EmissionMapFillerC2EPNS_11EmissionMapE0
_ZN7crpropa17PerformanceModule3addEPNS_6ModuleE0
_ZN7crpropa17PerformanceModuleD0Ev0
_ZN7crpropa17PerformanceModuleD2Ev0
_ZNK7crpropa14ParticleFilter14getDescriptionB5cxx11Ev0
_ZNK7crpropa14ParticleFilter7processEPNS_9CandidateE7
_ZNK7crpropa17EmissionMapFiller14getDescriptionB5cxx11Ev0
_ZNK7crpropa17EmissionMapFiller7processEPNS_9CandidateE0
_ZNK7crpropa17PerformanceModule14getDescriptionB5cxx11Ev0
_ZNK7crpropa17PerformanceModule7processEPNS_9CandidateE0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/Tools.cpp.gcov.html b/doc/coverageReport/src/module/Tools.cpp.gcov.html new file mode 100644 index 000000000..050d3fde4 --- /dev/null +++ b/doc/coverageReport/src/module/Tools.cpp.gcov.html @@ -0,0 +1,199 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module/Tools.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/module - Tools.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:77010.0 %
Date:2024-04-08 14:58:22Functions:21612.5 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/module/Tools.h"
+       2             : #include "crpropa/Clock.h"
+       3             : 
+       4             : #include <iostream>
+       5             : #include <sstream>
+       6             : 
+       7             : using namespace std;
+       8             : 
+       9             : namespace crpropa {
+      10             : 
+      11           0 : PerformanceModule::~PerformanceModule() {
+      12             :         double total = 0;
+      13           0 :         for (size_t i = 0; i < modules.size(); i++) {
+      14             :                 _module_info &m = modules[i];
+      15           0 :                 total += m.time;
+      16             :         }
+      17           0 :         cout << "Performance for " << calls << " calls:" << endl;
+      18           0 :         for (size_t i = 0; i < modules.size(); i++) {
+      19             :                 _module_info &m = modules[i];
+      20           0 :                 cout << " - " << floor((1000 * m.time / total) + 0.5) / 10 << "% -> "
+      21           0 :                                 << m.module->getDescription() << ": " << (m.time / calls)
+      22             :                                 << endl;
+      23             :         }
+      24           0 : }
+      25             : 
+      26           0 : void PerformanceModule::add(Module *module) {
+      27             :         _module_info info;
+      28           0 :         info.module = module;
+      29           0 :         info.time = 0;
+      30           0 :         modules.push_back(info);
+      31           0 : }
+      32             : 
+      33           0 : void PerformanceModule::process(Candidate *candidate) const {
+      34           0 :         vector<double> times(modules.size());
+      35           0 :         for (size_t i = 0; i < modules.size(); i++) {
+      36             :                 _module_info &m = modules[i];
+      37           0 :                 double start = Clock::getInstance().getMillisecond();
+      38           0 :                 m.module->process(candidate);
+      39           0 :                 double end = Clock::getInstance().getMillisecond();
+      40           0 :                 times[i] = end - start;
+      41             :         }
+      42             : 
+      43           0 : #pragma omp critical
+      44             :         {
+      45           0 :                 for (size_t i = 0; i < modules.size(); i++) {
+      46             :                         _module_info &m = modules[i];
+      47           0 :                         m.time += times[i];
+      48             :                 }
+      49           0 :                 calls++;
+      50             :         }
+      51           0 : }
+      52             : 
+      53           0 : string PerformanceModule::getDescription() const {
+      54           0 :         stringstream sstr;
+      55           0 :         sstr << "PerformanceModule (";
+      56           0 :         for (size_t i = 0; i < modules.size(); i++) {
+      57             :                 _module_info &m = modules[i];
+      58           0 :                 if (i > 0)
+      59           0 :                         sstr << ", ";
+      60           0 :                 sstr << m.module->getDescription();
+      61             :         }
+      62           0 :         sstr << ")";
+      63           0 :         return sstr.str();
+      64           0 : }
+      65             : 
+      66             : // ----------------------------------------------------------------------------
+      67           0 : ParticleFilter::ParticleFilter() {
+      68             : 
+      69           0 : }
+      70           1 : ParticleFilter::ParticleFilter(const std::set<int> &ids) : ids(ids) {
+      71             : 
+      72           1 : }
+      73           0 : void ParticleFilter::addId(int id) {
+      74             :         ids.insert(id);
+      75           0 : }
+      76           0 : void ParticleFilter::removeId(int id) {
+      77             :         ids.erase(id);
+      78           0 : }
+      79             : 
+      80           0 : std::set<int> &ParticleFilter::getIds() {
+      81           0 :         return ids;
+      82             : }
+      83             : 
+      84           7 : void ParticleFilter::process(Candidate* candidate) const {
+      85          14 :         if (ids.find(candidate->current.getId()) == ids.end())
+      86           5 :                 reject(candidate);
+      87             :         else
+      88           2 :                 accept(candidate);
+      89           7 : }
+      90             : 
+      91           0 : string ParticleFilter::getDescription() const {
+      92           0 :         stringstream sstr;
+      93           0 :         sstr << "ParticleFilter: ";
+      94           0 :         for (std::set<int>::const_iterator i = ids.begin(); i != ids.end(); i++) {
+      95           0 :                 sstr << *i << ", ";
+      96             :         }
+      97           0 :         sstr << ")";
+      98           0 :         return sstr.str();
+      99           0 : }
+     100             : 
+     101             : // ----------------------------------------------------------------------------
+     102           0 : EmissionMapFiller::EmissionMapFiller(EmissionMap *emissionMap) : emissionMap(emissionMap) {
+     103             : 
+     104           0 : }
+     105             : 
+     106           0 : void EmissionMapFiller::setEmissionMap(EmissionMap *emissionMap) {
+     107           0 :         this->emissionMap = emissionMap;
+     108           0 : }
+     109             : 
+     110           0 : void EmissionMapFiller::process(Candidate* candidate) const {
+     111           0 :         if (emissionMap) {
+     112           0 :                 #pragma omp critical
+     113             :                 {
+     114           0 :                         emissionMap->fillMap(candidate->source);
+     115             :                 }
+     116             :         }
+     117           0 : }
+     118             : 
+     119           0 : string EmissionMapFiller::getDescription() const {
+     120           0 :         return "EmissionMapFiller";
+     121             : }
+     122             : 
+     123             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/index-sort-f.html b/doc/coverageReport/src/module/index-sort-f.html new file mode 100644 index 000000000..cb0181bfe --- /dev/null +++ b/doc/coverageReport/src/module/index-sort-f.html @@ -0,0 +1,383 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/moduleHitTotalCoverage
Test:coverage.info.cleanedLines:2250354763.4 %
Date:2024-04-08 14:58:22Functions:28648559.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
OutputShell.cpp +
0.0%
+
0.0 %0 / 270.0 %0 / 6
PhotonOutput1D.cpp +
0.0%
+
0.0 %0 / 560.0 %0 / 9
Acceleration.cpp +
0.0%
+
0.0 %0 / 890.0 %0 / 14
Tools.cpp +
10.0%10.0%
+
10.0 %7 / 7012.5 %2 / 16
Redshift.cpp +
32.1%32.1%
+
32.1 %9 / 2825.0 %1 / 4
SimplePropagation.cpp +
36.4%36.4%
+
36.4 %12 / 3328.6 %2 / 7
HDF5Output.cpp +
5.0%5.0%
+
5.0 %12 / 24128.6 %4 / 14
MomentumDiffusion.cpp +
24.4%24.4%
+
24.4 %11 / 4530.0 %3 / 10
Observer.cpp +
44.4%44.4%
+
44.4 %80 / 18036.4 %16 / 44
BreakCondition.cpp +
36.6%36.6%
+
36.6 %63 / 17239.5 %15 / 38
Boundary.cpp +
48.4%48.4%
+
48.4 %106 / 21944.4 %20 / 45
SynchrotronRadiation.cpp +
61.8%61.8%
+
61.8 %81 / 13147.6 %10 / 21
PhotoPionProduction.cpp +
63.6%63.6%
+
63.6 %246 / 38760.0 %24 / 40
TextOutput.cpp +
88.0%88.0%
+
88.0 %219 / 24964.3 %9 / 14
RestrictToRegion.cpp +
50.0%50.0%
+
50.0 %6 / 1266.7 %2 / 3
ParticleCollector.cpp +
75.0%75.0%
+
75.0 %54 / 7270.8 %17 / 24
ElasticScattering.cpp +
90.0%90.0%
+
90.0 %63 / 7071.4 %5 / 7
PhotoDisintegration.cpp +
80.0%80.0%
+
80.0 %140 / 17583.3 %10 / 12
NuclearDecay.cpp +
81.5%81.5%
+
81.5 %137 / 16884.6 %11 / 13
Output.cpp +
89.8%89.8%
+
89.8 %88 / 9887.5 %14 / 16
DiffusionSDE.cpp +
76.2%76.2%
+
76.2 %154 / 20288.0 %22 / 25
ElectronPairProduction.cpp +
92.4%92.4%
+
92.4 %85 / 9290.0 %9 / 10
CandidateSplitting.cpp +
86.9%86.9%
+
86.9 %53 / 6190.9 %10 / 11
PropagationCK.cpp +
87.6%87.6%
+
87.6 %85 / 9792.9 %13 / 14
PropagationBP.cpp +
88.5%88.5%
+
88.5 %92 / 10493.8 %15 / 16
AdiabaticCooling.cpp +
85.2%85.2%
+
85.2 %23 / 27100.0 %5 / 5
EMDoublePairProduction.cpp +
94.4%94.4%
+
94.4 %68 / 72100.0 %10 / 10
EMTripletPairProduction.cpp +
94.0%94.0%
+
94.0 %94 / 100100.0 %11 / 11
EMInverseComptonScattering.cpp +
96.2%96.2%
+
96.2 %128 / 133100.0 %13 / 13
EMPairProduction.cpp +
97.8%97.8%
+
97.8 %134 / 137100.0 %13 / 13
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/index-sort-l.html b/doc/coverageReport/src/module/index-sort-l.html new file mode 100644 index 000000000..aa76e709f --- /dev/null +++ b/doc/coverageReport/src/module/index-sort-l.html @@ -0,0 +1,383 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/moduleHitTotalCoverage
Test:coverage.info.cleanedLines:2250354763.4 %
Date:2024-04-08 14:58:22Functions:28648559.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
OutputShell.cpp +
0.0%
+
0.0 %0 / 270.0 %0 / 6
PhotonOutput1D.cpp +
0.0%
+
0.0 %0 / 560.0 %0 / 9
Acceleration.cpp +
0.0%
+
0.0 %0 / 890.0 %0 / 14
HDF5Output.cpp +
5.0%5.0%
+
5.0 %12 / 24128.6 %4 / 14
Tools.cpp +
10.0%10.0%
+
10.0 %7 / 7012.5 %2 / 16
MomentumDiffusion.cpp +
24.4%24.4%
+
24.4 %11 / 4530.0 %3 / 10
Redshift.cpp +
32.1%32.1%
+
32.1 %9 / 2825.0 %1 / 4
SimplePropagation.cpp +
36.4%36.4%
+
36.4 %12 / 3328.6 %2 / 7
BreakCondition.cpp +
36.6%36.6%
+
36.6 %63 / 17239.5 %15 / 38
Observer.cpp +
44.4%44.4%
+
44.4 %80 / 18036.4 %16 / 44
Boundary.cpp +
48.4%48.4%
+
48.4 %106 / 21944.4 %20 / 45
RestrictToRegion.cpp +
50.0%50.0%
+
50.0 %6 / 1266.7 %2 / 3
SynchrotronRadiation.cpp +
61.8%61.8%
+
61.8 %81 / 13147.6 %10 / 21
PhotoPionProduction.cpp +
63.6%63.6%
+
63.6 %246 / 38760.0 %24 / 40
ParticleCollector.cpp +
75.0%75.0%
+
75.0 %54 / 7270.8 %17 / 24
DiffusionSDE.cpp +
76.2%76.2%
+
76.2 %154 / 20288.0 %22 / 25
PhotoDisintegration.cpp +
80.0%80.0%
+
80.0 %140 / 17583.3 %10 / 12
NuclearDecay.cpp +
81.5%81.5%
+
81.5 %137 / 16884.6 %11 / 13
AdiabaticCooling.cpp +
85.2%85.2%
+
85.2 %23 / 27100.0 %5 / 5
CandidateSplitting.cpp +
86.9%86.9%
+
86.9 %53 / 6190.9 %10 / 11
PropagationCK.cpp +
87.6%87.6%
+
87.6 %85 / 9792.9 %13 / 14
TextOutput.cpp +
88.0%88.0%
+
88.0 %219 / 24964.3 %9 / 14
PropagationBP.cpp +
88.5%88.5%
+
88.5 %92 / 10493.8 %15 / 16
Output.cpp +
89.8%89.8%
+
89.8 %88 / 9887.5 %14 / 16
ElasticScattering.cpp +
90.0%90.0%
+
90.0 %63 / 7071.4 %5 / 7
ElectronPairProduction.cpp +
92.4%92.4%
+
92.4 %85 / 9290.0 %9 / 10
EMTripletPairProduction.cpp +
94.0%94.0%
+
94.0 %94 / 100100.0 %11 / 11
EMDoublePairProduction.cpp +
94.4%94.4%
+
94.4 %68 / 72100.0 %10 / 10
EMInverseComptonScattering.cpp +
96.2%96.2%
+
96.2 %128 / 133100.0 %13 / 13
EMPairProduction.cpp +
97.8%97.8%
+
97.8 %134 / 137100.0 %13 / 13
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/src/module/index.html b/doc/coverageReport/src/module/index.html new file mode 100644 index 000000000..7af31a205 --- /dev/null +++ b/doc/coverageReport/src/module/index.html @@ -0,0 +1,383 @@ + + + + + + + LCOV - coverage.info.cleaned - src/module + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/moduleHitTotalCoverage
Test:coverage.info.cleanedLines:2250354763.4 %
Date:2024-04-08 14:58:22Functions:28648559.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Acceleration.cpp +
0.0%
+
0.0 %0 / 890.0 %0 / 14
AdiabaticCooling.cpp +
85.2%85.2%
+
85.2 %23 / 27100.0 %5 / 5
Boundary.cpp +
48.4%48.4%
+
48.4 %106 / 21944.4 %20 / 45
BreakCondition.cpp +
36.6%36.6%
+
36.6 %63 / 17239.5 %15 / 38
CandidateSplitting.cpp +
86.9%86.9%
+
86.9 %53 / 6190.9 %10 / 11
DiffusionSDE.cpp +
76.2%76.2%
+
76.2 %154 / 20288.0 %22 / 25
EMDoublePairProduction.cpp +
94.4%94.4%
+
94.4 %68 / 72100.0 %10 / 10
EMInverseComptonScattering.cpp +
96.2%96.2%
+
96.2 %128 / 133100.0 %13 / 13
EMPairProduction.cpp +
97.8%97.8%
+
97.8 %134 / 137100.0 %13 / 13
EMTripletPairProduction.cpp +
94.0%94.0%
+
94.0 %94 / 100100.0 %11 / 11
ElasticScattering.cpp +
90.0%90.0%
+
90.0 %63 / 7071.4 %5 / 7
ElectronPairProduction.cpp +
92.4%92.4%
+
92.4 %85 / 9290.0 %9 / 10
HDF5Output.cpp +
5.0%5.0%
+
5.0 %12 / 24128.6 %4 / 14
MomentumDiffusion.cpp +
24.4%24.4%
+
24.4 %11 / 4530.0 %3 / 10
NuclearDecay.cpp +
81.5%81.5%
+
81.5 %137 / 16884.6 %11 / 13
Observer.cpp +
44.4%44.4%
+
44.4 %80 / 18036.4 %16 / 44
Output.cpp +
89.8%89.8%
+
89.8 %88 / 9887.5 %14 / 16
OutputShell.cpp +
0.0%
+
0.0 %0 / 270.0 %0 / 6
ParticleCollector.cpp +
75.0%75.0%
+
75.0 %54 / 7270.8 %17 / 24
PhotoDisintegration.cpp +
80.0%80.0%
+
80.0 %140 / 17583.3 %10 / 12
PhotoPionProduction.cpp +
63.6%63.6%
+
63.6 %246 / 38760.0 %24 / 40
PhotonOutput1D.cpp +
0.0%
+
0.0 %0 / 560.0 %0 / 9
PropagationBP.cpp +
88.5%88.5%
+
88.5 %92 / 10493.8 %15 / 16
PropagationCK.cpp +
87.6%87.6%
+
87.6 %85 / 9792.9 %13 / 14
Redshift.cpp +
32.1%32.1%
+
32.1 %9 / 2825.0 %1 / 4
RestrictToRegion.cpp +
50.0%50.0%
+
50.0 %6 / 1266.7 %2 / 3
SimplePropagation.cpp +
36.4%36.4%
+
36.4 %12 / 3328.6 %2 / 7
SynchrotronRadiation.cpp +
61.8%61.8%
+
61.8 %81 / 13147.6 %10 / 21
TextOutput.cpp +
88.0%88.0%
+
88.0 %219 / 24964.3 %9 / 14
Tools.cpp +
10.0%10.0%
+
10.0 %7 / 7012.5 %2 / 16
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/index-sort-f.html b/doc/coverageReport/test/index-sort-f.html new file mode 100644 index 000000000..d8992e401 --- /dev/null +++ b/doc/coverageReport/test/index-sort-f.html @@ -0,0 +1,243 @@ + + + + + + + LCOV - coverage.info.cleaned - test + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - testHitTotalCoverage
Test:coverage.info.cleanedLines:3320339197.9 %
Date:2024-04-08 14:58:22Functions:26427396.7 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
testFunctionalGroups.cpp +
87.0%87.0%
+
87.0 %20 / 2350.0 %1 / 2
testModuleList.cpp +
94.5%94.5%
+
94.5 %52 / 5585.7 %6 / 7
testVector3.cpp +
96.8%96.8%
+
96.8 %90 / 9392.3 %12 / 13
testOutput.cpp +
96.9%96.9%
+
96.9 %157 / 16294.4 %17 / 18
testPropagation.cpp +
99.1%99.1%
+
99.1 %337 / 34094.7 %18 / 19
testSource.cpp +
98.6%98.6%
+
98.6 %279 / 28395.8 %23 / 24
testBreakCondition.cpp +
99.3%99.3%
+
99.3 %398 / 40196.8 %30 / 31
testInteraction.cpp +
94.4%94.4%
+
94.4 %743 / 78798.1 %52 / 53
testCore.cpp +
99.5%99.5%
+
99.5 %654 / 65798.3 %58 / 59
testCandidateSplitting.cpp +
100.0%
+
100.0 %47 / 47100.0 %2 / 2
testAdiabaticCooling.cpp +
100.0%
+
100.0 %23 / 23100.0 %2 / 2
testAdvectionField.cpp +
100.0%
+
100.0 %83 / 83100.0 %5 / 5
testMagneticLens.cpp +
100.0%
+
100.0 %87 / 87100.0 %7 / 7
testDensity.cpp +
100.0%
+
100.0 %166 / 166100.0 %7 / 7
testTurbulentField.cpp +
100.0%
+
100.0 %46 / 46100.0 %8 / 8
testMagneticField.cpp +
100.0%
+
100.0 %138 / 138100.0 %16 / 16
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/index-sort-l.html b/doc/coverageReport/test/index-sort-l.html new file mode 100644 index 000000000..a458518a3 --- /dev/null +++ b/doc/coverageReport/test/index-sort-l.html @@ -0,0 +1,243 @@ + + + + + + + LCOV - coverage.info.cleaned - test + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - testHitTotalCoverage
Test:coverage.info.cleanedLines:3320339197.9 %
Date:2024-04-08 14:58:22Functions:26427396.7 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
testFunctionalGroups.cpp +
87.0%87.0%
+
87.0 %20 / 2350.0 %1 / 2
testInteraction.cpp +
94.4%94.4%
+
94.4 %743 / 78798.1 %52 / 53
testModuleList.cpp +
94.5%94.5%
+
94.5 %52 / 5585.7 %6 / 7
testVector3.cpp +
96.8%96.8%
+
96.8 %90 / 9392.3 %12 / 13
testOutput.cpp +
96.9%96.9%
+
96.9 %157 / 16294.4 %17 / 18
testSource.cpp +
98.6%98.6%
+
98.6 %279 / 28395.8 %23 / 24
testPropagation.cpp +
99.1%99.1%
+
99.1 %337 / 34094.7 %18 / 19
testBreakCondition.cpp +
99.3%99.3%
+
99.3 %398 / 40196.8 %30 / 31
testCore.cpp +
99.5%99.5%
+
99.5 %654 / 65798.3 %58 / 59
testAdiabaticCooling.cpp +
100.0%
+
100.0 %23 / 23100.0 %2 / 2
testTurbulentField.cpp +
100.0%
+
100.0 %46 / 46100.0 %8 / 8
testCandidateSplitting.cpp +
100.0%
+
100.0 %47 / 47100.0 %2 / 2
testAdvectionField.cpp +
100.0%
+
100.0 %83 / 83100.0 %5 / 5
testMagneticLens.cpp +
100.0%
+
100.0 %87 / 87100.0 %7 / 7
testMagneticField.cpp +
100.0%
+
100.0 %138 / 138100.0 %16 / 16
testDensity.cpp +
100.0%
+
100.0 %166 / 166100.0 %7 / 7
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/index.html b/doc/coverageReport/test/index.html new file mode 100644 index 000000000..8374654ca --- /dev/null +++ b/doc/coverageReport/test/index.html @@ -0,0 +1,243 @@ + + + + + + + LCOV - coverage.info.cleaned - test + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - testHitTotalCoverage
Test:coverage.info.cleanedLines:3320339197.9 %
Date:2024-04-08 14:58:22Functions:26427396.7 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
testAdiabaticCooling.cpp +
100.0%
+
100.0 %23 / 23100.0 %2 / 2
testAdvectionField.cpp +
100.0%
+
100.0 %83 / 83100.0 %5 / 5
testBreakCondition.cpp +
99.3%99.3%
+
99.3 %398 / 40196.8 %30 / 31
testCandidateSplitting.cpp +
100.0%
+
100.0 %47 / 47100.0 %2 / 2
testCore.cpp +
99.5%99.5%
+
99.5 %654 / 65798.3 %58 / 59
testDensity.cpp +
100.0%
+
100.0 %166 / 166100.0 %7 / 7
testFunctionalGroups.cpp +
87.0%87.0%
+
87.0 %20 / 2350.0 %1 / 2
testInteraction.cpp +
94.4%94.4%
+
94.4 %743 / 78798.1 %52 / 53
testMagneticField.cpp +
100.0%
+
100.0 %138 / 138100.0 %16 / 16
testMagneticLens.cpp +
100.0%
+
100.0 %87 / 87100.0 %7 / 7
testModuleList.cpp +
94.5%94.5%
+
94.5 %52 / 5585.7 %6 / 7
testOutput.cpp +
96.9%96.9%
+
96.9 %157 / 16294.4 %17 / 18
testPropagation.cpp +
99.1%99.1%
+
99.1 %337 / 34094.7 %18 / 19
testSource.cpp +
98.6%98.6%
+
98.6 %279 / 28395.8 %23 / 24
testTurbulentField.cpp +
100.0%
+
100.0 %46 / 46100.0 %8 / 8
testVector3.cpp +
96.8%96.8%
+
96.8 %90 / 9392.3 %12 / 13
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testAdiabaticCooling.cpp.func-sort-c.html b/doc/coverageReport/test/testAdiabaticCooling.cpp.func-sort-c.html new file mode 100644 index 000000000..32530ff4f --- /dev/null +++ b/doc/coverageReport/test/testAdiabaticCooling.cpp.func-sort-c.html @@ -0,0 +1,80 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testAdiabaticCooling.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testAdiabaticCooling.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:2323100.0 %
Date:2024-04-08 14:58:22Functions:22100.0 %
+
+ +
+ + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa34AdiabaticCooling_UniformField_Test8TestBodyEv1
_ZN7crpropa44AdiabaticCooling_ConstantSphericalField_Test8TestBodyEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testAdiabaticCooling.cpp.func.html b/doc/coverageReport/test/testAdiabaticCooling.cpp.func.html new file mode 100644 index 000000000..2bf778f01 --- /dev/null +++ b/doc/coverageReport/test/testAdiabaticCooling.cpp.func.html @@ -0,0 +1,80 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testAdiabaticCooling.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testAdiabaticCooling.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:2323100.0 %
Date:2024-04-08 14:58:22Functions:22100.0 %
+
+ +
+ + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa34AdiabaticCooling_UniformField_Test8TestBodyEv1
_ZN7crpropa44AdiabaticCooling_ConstantSphericalField_Test8TestBodyEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testAdiabaticCooling.cpp.gcov.html b/doc/coverageReport/test/testAdiabaticCooling.cpp.gcov.html new file mode 100644 index 000000000..6953c46a9 --- /dev/null +++ b/doc/coverageReport/test/testAdiabaticCooling.cpp.gcov.html @@ -0,0 +1,131 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testAdiabaticCooling.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testAdiabaticCooling.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:2323100.0 %
Date:2024-04-08 14:58:22Functions:22100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/Candidate.h"
+       2             : #include "crpropa/Units.h"
+       3             : #include "crpropa/ParticleID.h"
+       4             : #include "crpropa/advectionField/AdvectionField.h"
+       5             : #include "crpropa/module/AdiabaticCooling.h"
+       6             : #include "gtest/gtest.h"
+       7             : 
+       8             : //#include <fstream>
+       9             : 
+      10             : namespace crpropa {
+      11             : 
+      12             : // AdiabaticCooling ---------------------------------------------------------------
+      13             : 
+      14           2 : TEST (AdiabaticCooling, UniformField) {
+      15             :         // Test in a uniform advection Field
+      16             : 
+      17           2 :         AdiabaticCooling AC(new UniformAdvectionField(Vector3d(1,0,0)));
+      18           1 :         Candidate c(nucleusId(1,1), 1e13*eV);
+      19           1 :         c.setCurrentStep(10*kpc);
+      20           1 :         c.setNextStep(10*kpc);
+      21           1 :         double E = c.current.getEnergy();
+      22           1 :         AC.process(&c);
+      23             : 
+      24             :         // Energy is expected to be conserved
+      25           1 :         EXPECT_DOUBLE_EQ(c.current.getEnergy(), E);
+      26           1 :         EXPECT_DOUBLE_EQ(c.getNextStep(), 10*kpc);
+      27             : 
+      28             :         double limit = 0.2;
+      29           3 :         AdiabaticCooling AC2(new UniformAdvectionField(Vector3d(1,0,0)), limit);
+      30             :         
+      31           1 :         EXPECT_DOUBLE_EQ(AC2.getLimit(), limit);
+      32             : 
+      33             :         //
+      34             : 
+      35           1 : }
+      36             : 
+      37           2 : TEST (AdiabaticCooling, ConstantSphericalField) {
+      38             :         // Constant velocity vector
+      39             :         
+      40           2 :         AdiabaticCooling AC(new ConstantSphericalAdvectionField(Vector3d(0,0,0), 1));
+      41           1 :         Candidate c(nucleusId(1,1), 10);
+      42           1 :         c.current.setPosition(Vector3d(1,0,0));
+      43           1 :         c.setCurrentStep(c_light);
+      44           1 :         c.setNextStep(c_light);
+      45           1 :         double E = c.current.getEnergy();
+      46           1 :         AC.process(&c);
+      47             : 
+      48             :         // Check energy loss and step limitation
+      49           1 :         EXPECT_DOUBLE_EQ(c.current.getEnergy(), E/3.);
+      50           1 :         EXPECT_DOUBLE_EQ(c.getNextStep(), 0.15*c_light);
+      51             : 
+      52           1 : }
+      53             : 
+      54             : 
+      55             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testAdvectionField.cpp.func-sort-c.html b/doc/coverageReport/test/testAdvectionField.cpp.func-sort-c.html new file mode 100644 index 000000000..f4debdd54 --- /dev/null +++ b/doc/coverageReport/test/testAdvectionField.cpp.func-sort-c.html @@ -0,0 +1,92 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testAdvectionField.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testAdvectionField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8383100.0 %
Date:2024-04-08 14:58:22Functions:55100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa38testAdvectionFieldList_SimpleTest_Test8TestBodyEv1
_ZN7crpropa41testUniformAdvectionField_SimpleTest_Test8TestBodyEv1
_ZN7crpropa43testSphericalAdvectionField_SimpleTest_Test8TestBodyEv1
_ZN7crpropa43testSphericalAdvectionShock_SimpleTest_Test8TestBodyEv1
_ZN7crpropa51testConstantSphericalAdvectionField_SimpleTest_Test8TestBodyEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testAdvectionField.cpp.func.html b/doc/coverageReport/test/testAdvectionField.cpp.func.html new file mode 100644 index 000000000..c24ce98a8 --- /dev/null +++ b/doc/coverageReport/test/testAdvectionField.cpp.func.html @@ -0,0 +1,92 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testAdvectionField.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testAdvectionField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8383100.0 %
Date:2024-04-08 14:58:22Functions:55100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa38testAdvectionFieldList_SimpleTest_Test8TestBodyEv1
_ZN7crpropa41testUniformAdvectionField_SimpleTest_Test8TestBodyEv1
_ZN7crpropa43testSphericalAdvectionField_SimpleTest_Test8TestBodyEv1
_ZN7crpropa43testSphericalAdvectionShock_SimpleTest_Test8TestBodyEv1
_ZN7crpropa51testConstantSphericalAdvectionField_SimpleTest_Test8TestBodyEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testAdvectionField.cpp.gcov.html b/doc/coverageReport/test/testAdvectionField.cpp.gcov.html new file mode 100644 index 000000000..e0ac90041 --- /dev/null +++ b/doc/coverageReport/test/testAdvectionField.cpp.gcov.html @@ -0,0 +1,245 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testAdvectionField.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testAdvectionField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8383100.0 %
Date:2024-04-08 14:58:22Functions:55100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/advectionField/AdvectionField.h"
+       2             : #include "crpropa/Units.h"
+       3             : #include "crpropa/Common.h"
+       4             : 
+       5             : #include "gtest/gtest.h"
+       6             : #include <stdexcept>
+       7             : #include <cmath>
+       8             : 
+       9             : namespace crpropa {
+      10             : 
+      11           2 : TEST(testUniformAdvectionField, SimpleTest) {
+      12           1 :         UniformAdvectionField A(Vector3d(-1, 5, 3));
+      13           1 :         Vector3d a = A.getField(Vector3d(1, 0, 0));
+      14           1 :         double D = A.getDivergence(Vector3d(1, 0, 0));
+      15           1 :         EXPECT_DOUBLE_EQ(a.x, -1);
+      16           1 :         EXPECT_DOUBLE_EQ(a.y, 5);
+      17           1 :         EXPECT_DOUBLE_EQ(a.z, 3);
+      18           1 :         EXPECT_DOUBLE_EQ(D, 0.);
+      19           1 : }
+      20             : 
+      21           2 : TEST(testAdvectionFieldList, SimpleTest) {
+      22             :         // Test a list of three advection fields
+      23             :         AdvectionFieldList A;
+      24           2 :         A.addField(new UniformAdvectionField(Vector3d(1, 0, 0)));
+      25           2 :         A.addField(new UniformAdvectionField(Vector3d(0, 2, 0)));
+      26           2 :         A.addField(new UniformAdvectionField(Vector3d(0, 0, 3)));
+      27           1 :         Vector3d a = A.getField(Vector3d(0.));
+      28           1 :         double D = A.getDivergence(Vector3d(1, 2, 3));
+      29           1 :         EXPECT_DOUBLE_EQ(a.x, 1);
+      30           1 :         EXPECT_DOUBLE_EQ(a.y, 2);
+      31           1 :         EXPECT_DOUBLE_EQ(a.z, 3);
+      32           1 :         EXPECT_DOUBLE_EQ(D, 0.);
+      33           1 : }
+      34             : 
+      35           2 : TEST(testConstantSphericalAdvectionField, SimpleTest) {
+      36             :         
+      37             :         Vector3d origin(1, 0, 0);
+      38             :         double V_wind(10);
+      39             :         
+      40           1 :         ConstantSphericalAdvectionField A(origin, V_wind);
+      41             :         
+      42             :         // Check the properties of the advection field
+      43           1 :         EXPECT_DOUBLE_EQ(A.getOrigin().x, origin.x);
+      44           1 :         EXPECT_DOUBLE_EQ(A.getOrigin().y, origin.y);
+      45           1 :         EXPECT_DOUBLE_EQ(A.getOrigin().z, origin.z);
+      46             : 
+      47           1 :         EXPECT_DOUBLE_EQ(A.getVWind(), V_wind);
+      48             : 
+      49             :         // Field should be radial with center (1,0,0)
+      50             :         Vector3d Pos(2, 1, 1);
+      51           1 :         Vector3d V = A.getField(Pos);
+      52             : 
+      53           1 :         EXPECT_DOUBLE_EQ(V.x, 10.*pow(3, -0.5));
+      54           1 :         EXPECT_DOUBLE_EQ(V.y, 10.*pow(3, -0.5));
+      55           1 :         EXPECT_DOUBLE_EQ(V.z, 10.*pow(3, -0.5));
+      56             :         
+      57             :         // Divergence should be 2*V/r
+      58             :         Vector3d Pos2(2, 0, 0);
+      59           1 :         double D = A.getDivergence(Pos2);
+      60           1 :         EXPECT_DOUBLE_EQ(D, 2*10);
+      61           1 : }
+      62             : 
+      63           2 : TEST(testSphericalAdvectionField, SimpleTest) {
+      64             : 
+      65             :         Vector3d origin(1, 0, 0);
+      66             :         double R_max(10);
+      67             :         double V_max(1000);
+      68             :         double tau(3.);
+      69             :         double alpha(2.);
+      70             : 
+      71           1 :         SphericalAdvectionField A(origin, R_max, V_max, tau, alpha);
+      72             : 
+      73             :         // Check the properties of the advection field
+      74           1 :         EXPECT_DOUBLE_EQ(A.getOrigin().x, origin.x);
+      75           1 :         EXPECT_DOUBLE_EQ(A.getOrigin().y, origin.y);
+      76           1 :         EXPECT_DOUBLE_EQ(A.getOrigin().z, origin.z);
+      77             :         
+      78           1 :         EXPECT_DOUBLE_EQ(A.getRadius(), R_max);
+      79           1 :         EXPECT_DOUBLE_EQ(A.getVMax(), V_max);
+      80           1 :         EXPECT_DOUBLE_EQ(A.getTau(), tau);
+      81           1 :         EXPECT_DOUBLE_EQ(A.getAlpha(), alpha);
+      82             : 
+      83             :         // Field/divergence should be zero for R>10
+      84           1 :         EXPECT_DOUBLE_EQ(A.getField(Vector3d(12,0,0)).getR(), 0.);
+      85           1 :         EXPECT_DOUBLE_EQ(A.getDivergence(Vector3d(12,0,0)), 0.);
+      86             : 
+      87             :         // Check field and divergence
+      88             :         Vector3d Pos(2, 0, 0);
+      89           1 :         Vector3d a = A.getField(Pos);
+      90           1 :         Vector3d a0 = a.getUnitVector();
+      91           1 :         double d = A.getDivergence(Pos);
+      92             : 
+      93           1 :         EXPECT_DOUBLE_EQ(a0.x, 1.);
+      94           1 :         EXPECT_DOUBLE_EQ(a0.y, 0.);
+      95           1 :         EXPECT_DOUBLE_EQ(a0.z, 0.);
+      96           1 :         EXPECT_DOUBLE_EQ(a.getR(), V_max*(1.-exp(-1./tau)) );
+      97             : 
+      98           1 :         EXPECT_NEAR(d, 1044.624919, 1e-5);
+      99             : 
+     100             :         // Check asymptotic of the Field
+     101           1 :         EXPECT_NEAR(A.getField(Vector3d(11, 0, 0)).getR(), 1000., 1e-4);
+     102             :         
+     103             :         // Divergence should be 2*V_max/r for r>>1
+     104           1 :         EXPECT_NEAR(A.getDivergence(Vector3d(11, 0, 0)), 2*1000./10., 1e-4);
+     105           1 : }
+     106             : 
+     107             : 
+     108           2 : TEST(testSphericalAdvectionShock, SimpleTest) {
+     109             : 
+     110             :         Vector3d origin(0, 0, 0);
+     111             :         double R_0(10);
+     112             :         double V_0(1000);
+     113             :         double lambda(0.1);
+     114             :         double R_rot(1.);
+     115             :         double V_rot(100);
+     116             :         
+     117             : 
+     118           1 :         SphericalAdvectionShock A(origin, R_0, V_0, lambda);
+     119             : 
+     120             :         // Check the properties of the advection field
+     121           1 :         EXPECT_DOUBLE_EQ(A.getOrigin().x, origin.x);
+     122           1 :         EXPECT_DOUBLE_EQ(A.getOrigin().y, origin.y);
+     123           1 :         EXPECT_DOUBLE_EQ(A.getOrigin().z, origin.z);
+     124             :         
+     125           1 :         EXPECT_DOUBLE_EQ(A.getR0(), R_0);
+     126           1 :         EXPECT_DOUBLE_EQ(A.getV0(), V_0);
+     127           1 :         EXPECT_DOUBLE_EQ(A.getLambda(), lambda);
+     128             : 
+     129             :         // Default values for R_Rot is R_0
+     130             :         // Default value for Azimuthal speed is 0
+     131           1 :         EXPECT_DOUBLE_EQ(A.getRRot(), R_0);
+     132           1 :         EXPECT_DOUBLE_EQ(A.getAzimuthalSpeed(), 0.);    
+     133             : 
+     134             :         // Field should drop to 0.625*V_0 at the shock 
+     135             :         // That's a difference to the analytic shock model where it should
+     136             :         // drop to v_r(R_0)=0.25*V_0.
+     137           1 :         EXPECT_DOUBLE_EQ(A.getField(Vector3d(R_0,0,0)).getR(), 0.625*V_0);
+     138             : 
+     139             :         // Field divergence should be zero for R>>R_0
+     140           1 :         EXPECT_NEAR(A.getDivergence(Vector3d(15,0,0)), 0., 1e-10);
+     141             : 
+     142             :         // Check field and divergence
+     143             :         Vector3d Pos(2, 0, 0);
+     144           1 :         Vector3d a = A.getField(Pos);
+     145           1 :         Vector3d a0 = a.getUnitVector();
+     146           1 :         double d = A.getDivergence(Pos);
+     147             : 
+     148           1 :         EXPECT_DOUBLE_EQ(a0.x, 1.);
+     149           1 :         EXPECT_DOUBLE_EQ(a0.y, 0.);
+     150           1 :         EXPECT_DOUBLE_EQ(a0.z, 0.);
+     151           1 :         EXPECT_DOUBLE_EQ(a.getR(), V_0);
+     152             :         
+     153             :         //Set explicitely the azimuthal rotation speed 
+     154           1 :         A.setRRot(R_rot);
+     155           1 :         A.setAzimuthalSpeed(V_rot);
+     156             :         
+     157           1 :         EXPECT_DOUBLE_EQ(A.getRRot(), R_rot);
+     158           1 :         EXPECT_DOUBLE_EQ(A.getAzimuthalSpeed(), V_rot); 
+     159             :         
+     160             :         Vector3d pos(1., 0., 0.);
+     161           1 :         Vector3d f = A.getField(pos);
+     162           1 :         EXPECT_DOUBLE_EQ(f.x, 1000.);
+     163           1 :         EXPECT_DOUBLE_EQ(f.y, 100.);
+     164           1 :         EXPECT_DOUBLE_EQ(f.z, 0.);      
+     165             : 
+     166             :         
+     167           1 : }
+     168             : 
+     169             : } //namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testBreakCondition.cpp.func-sort-c.html b/doc/coverageReport/test/testBreakCondition.cpp.func-sort-c.html new file mode 100644 index 000000000..fdc048a9d --- /dev/null +++ b/doc/coverageReport/test/testBreakCondition.cpp.func-sort-c.html @@ -0,0 +1,196 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testBreakCondition.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testBreakCondition.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:39840199.3 %
Date:2024-04-08 14:58:22Functions:303196.8 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa4mainEiPPc0
_ZN7crpropa20PeriodicBox_low_Test8TestBodyEv1
_ZN7crpropa21PeriodicBox_high_Test8TestBodyEv1
_ZN7crpropa23MinimumEnergy_test_Test8TestBodyEv1
_ZN7crpropa23ReflectiveBox_high_Test8TestBodyEv1
_ZN7crpropa25CubicBoundary_inside_Test8TestBodyEv1
_ZN7crpropa25DetectionLength_test_Test8TestBodyEv1
_ZN7crpropa25MinimumRedshift_test_Test8TestBodyEv1
_ZN7crpropa26CubicBoundary_outside_Test8TestBodyEv1
_ZN7crpropa26ObserverFeature_Point_Test8TestBodyEv1
_ZN7crpropa29MinimumChargeNumber_test_Test8TestBodyEv1
_ZN7crpropa29SphericalBoundary_inside_Test8TestBodyEv1
_ZN7crpropa30ObserverFeature_DetectAll_Test8TestBodyEv1
_ZN7crpropa30SphericalBoundary_outside_Test8TestBodyEv1
_ZN7crpropa31CylindricalBoundary_inside_Test8TestBodyEv1
_ZN7crpropa31EllipsoidalBoundary_inside_Test8TestBodyEv1
_ZN7crpropa32CylindricalBoundary_outside_Test8TestBodyEv1
_ZN7crpropa32EllipsoidalBoundary_outside_Test8TestBodyEv1
_ZN7crpropa32ObserverFeature_LargeSphere_Test8TestBodyEv1
_ZN7crpropa32ObserverFeature_SmallSphere_Test8TestBodyEv1
_ZN7crpropa32SphericalBoundary_limitStep_Test8TestBodyEv1
_ZN7crpropa33CubicBoundary_limitStepLower_Test8TestBodyEv1
_ZN7crpropa33CubicBoundary_limitStepUpper_Test8TestBodyEv1
_ZN7crpropa33MaximumTrajectoryLength_test_Test8TestBodyEv1
_ZN7crpropa34CylindricalBoundary_limitStep_Test8TestBodyEv1
_ZN7crpropa34EllipsoidalBoundary_limitStep_Test8TestBodyEv1
_ZN7crpropa34ObserverFeature_TimeEvolution_Test8TestBodyEv1
_ZN7crpropa36MinimumEnergyPerParticleId_test_Test8TestBodyEv1
_ZN7crpropa37MaximumTrajectoryLength_observer_Test8TestBodyEv1
_ZN7crpropa37ObserverFeature_TimeEvolutionLog_Test8TestBodyEv1
_ZN7crpropa38RestrictToRegion_RestrictToRegion_Test8TestBodyEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testBreakCondition.cpp.func.html b/doc/coverageReport/test/testBreakCondition.cpp.func.html new file mode 100644 index 000000000..13dcf1aae --- /dev/null +++ b/doc/coverageReport/test/testBreakCondition.cpp.func.html @@ -0,0 +1,196 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testBreakCondition.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testBreakCondition.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:39840199.3 %
Date:2024-04-08 14:58:22Functions:303196.8 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa20PeriodicBox_low_Test8TestBodyEv1
_ZN7crpropa21PeriodicBox_high_Test8TestBodyEv1
_ZN7crpropa23MinimumEnergy_test_Test8TestBodyEv1
_ZN7crpropa23ReflectiveBox_high_Test8TestBodyEv1
_ZN7crpropa25CubicBoundary_inside_Test8TestBodyEv1
_ZN7crpropa25DetectionLength_test_Test8TestBodyEv1
_ZN7crpropa25MinimumRedshift_test_Test8TestBodyEv1
_ZN7crpropa26CubicBoundary_outside_Test8TestBodyEv1
_ZN7crpropa26ObserverFeature_Point_Test8TestBodyEv1
_ZN7crpropa29MinimumChargeNumber_test_Test8TestBodyEv1
_ZN7crpropa29SphericalBoundary_inside_Test8TestBodyEv1
_ZN7crpropa30ObserverFeature_DetectAll_Test8TestBodyEv1
_ZN7crpropa30SphericalBoundary_outside_Test8TestBodyEv1
_ZN7crpropa31CylindricalBoundary_inside_Test8TestBodyEv1
_ZN7crpropa31EllipsoidalBoundary_inside_Test8TestBodyEv1
_ZN7crpropa32CylindricalBoundary_outside_Test8TestBodyEv1
_ZN7crpropa32EllipsoidalBoundary_outside_Test8TestBodyEv1
_ZN7crpropa32ObserverFeature_LargeSphere_Test8TestBodyEv1
_ZN7crpropa32ObserverFeature_SmallSphere_Test8TestBodyEv1
_ZN7crpropa32SphericalBoundary_limitStep_Test8TestBodyEv1
_ZN7crpropa33CubicBoundary_limitStepLower_Test8TestBodyEv1
_ZN7crpropa33CubicBoundary_limitStepUpper_Test8TestBodyEv1
_ZN7crpropa33MaximumTrajectoryLength_test_Test8TestBodyEv1
_ZN7crpropa34CylindricalBoundary_limitStep_Test8TestBodyEv1
_ZN7crpropa34EllipsoidalBoundary_limitStep_Test8TestBodyEv1
_ZN7crpropa34ObserverFeature_TimeEvolution_Test8TestBodyEv1
_ZN7crpropa36MinimumEnergyPerParticleId_test_Test8TestBodyEv1
_ZN7crpropa37MaximumTrajectoryLength_observer_Test8TestBodyEv1
_ZN7crpropa37ObserverFeature_TimeEvolutionLog_Test8TestBodyEv1
_ZN7crpropa38RestrictToRegion_RestrictToRegion_Test8TestBodyEv1
_ZN7crpropa4mainEiPPc0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testBreakCondition.cpp.gcov.html b/doc/coverageReport/test/testBreakCondition.cpp.gcov.html new file mode 100644 index 000000000..daded67ee --- /dev/null +++ b/doc/coverageReport/test/testBreakCondition.cpp.gcov.html @@ -0,0 +1,621 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testBreakCondition.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testBreakCondition.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:39840199.3 %
Date:2024-04-08 14:58:22Functions:303196.8 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : /** Unit tests for break condition, observer, boundary and tool modules */
+       2             : 
+       3             : #include "crpropa/module/BreakCondition.h"
+       4             : #include "crpropa/module/Observer.h"
+       5             : #include "crpropa/module/Boundary.h"
+       6             : #include "crpropa/module/Tools.h"
+       7             : #include "crpropa/module/RestrictToRegion.h"
+       8             : #include "crpropa/ParticleID.h"
+       9             : #include "crpropa/Geometry.h"
+      10             : 
+      11             : #include "gtest/gtest.h"
+      12             : 
+      13             : namespace crpropa {
+      14             : 
+      15             : //** ========================= Break conditions ============================= */
+      16           1 : TEST(MinimumEnergy, test) {
+      17           1 :         MinimumEnergy minEnergy(5);
+      18           1 :         Candidate c;
+      19             : 
+      20           1 :         c.current.setEnergy(5.1);
+      21           1 :         minEnergy.process(&c);
+      22           1 :         EXPECT_TRUE(c.isActive());
+      23             : 
+      24           1 :         c.current.setEnergy(4.9);
+      25           1 :         minEnergy.process(&c);
+      26           1 :         EXPECT_FALSE(c.isActive());
+      27           2 :         EXPECT_TRUE(c.hasProperty("Rejected"));
+      28           2 : }
+      29             : 
+      30           1 : TEST(MinimumChargeNumber, test) {
+      31           1 :         MinimumChargeNumber minChargeNumber(20);
+      32           1 :         Candidate c;
+      33             : 
+      34           1 :         c.current.setId(nucleusId(56, 26));
+      35           1 :         minChargeNumber.process(&c);
+      36           1 :         EXPECT_TRUE(c.isActive());
+      37             :         
+      38           1 :         c.current.setId(-nucleusId(56, 26));
+      39           1 :         minChargeNumber.process(&c);
+      40           1 :         EXPECT_TRUE(c.isActive());
+      41             : 
+      42           1 :         c.current.setId(nucleusId(4, 2));
+      43           1 :         minChargeNumber.process(&c);
+      44           1 :         EXPECT_FALSE(c.isActive());
+      45           2 :         EXPECT_TRUE(c.hasProperty("Rejected"));
+      46             :         
+      47           1 :         c.setActive(true);
+      48           1 :         c.removeProperty("Rejected");
+      49             : 
+      50           1 :         c.current.setId(-nucleusId(4, 2));
+      51           1 :         minChargeNumber.process(&c);
+      52           1 :         EXPECT_FALSE(c.isActive());
+      53           2 :         EXPECT_TRUE(c.hasProperty("Rejected"));
+      54           2 : }
+      55             : 
+      56           1 : TEST(MinimumEnergyPerParticleId, test) {
+      57           1 :         MinimumEnergyPerParticleId minEnergy(1);
+      58           1 :         minEnergy.add(22, 10);
+      59           1 :         minEnergy.add(12, 2);
+      60           1 :         minEnergy.add(11, 20);
+      61             : 
+      62           1 :         Candidate c;
+      63             : 
+      64           1 :         c.current.setEnergy(20);
+      65           1 :         c.current.setId(22);
+      66           1 :         minEnergy.process(&c);
+      67           1 :         EXPECT_TRUE(c.isActive());
+      68             : 
+      69           1 :         c.current.setEnergy(5);
+      70           1 :         c.current.setId(22);
+      71           1 :         minEnergy.process(&c);
+      72           1 :         EXPECT_FALSE(c.isActive());
+      73           2 :         EXPECT_TRUE(c.hasProperty("Rejected"));
+      74             : 
+      75           1 :         c.setActive(true);
+      76           1 :         c.removeProperty("Rejected");
+      77             : 
+      78           1 :         c.current.setEnergy(10);
+      79           1 :         c.current.setId(11);
+      80           1 :         minEnergy.process(&c);
+      81           1 :         EXPECT_FALSE(c.isActive());
+      82           2 :         EXPECT_TRUE(c.hasProperty("Rejected"));
+      83             : 
+      84           1 :         c.setActive(true);
+      85           1 :         c.removeProperty("Rejected");
+      86             : 
+      87           1 :         c.current.setEnergy(5);
+      88           1 :         c.current.setId(12);
+      89           1 :         minEnergy.process(&c);
+      90           1 :         EXPECT_TRUE(c.isActive());      
+      91             : 
+      92           1 :         c.current.setEnergy(0.1);
+      93           1 :         c.current.setId(12);
+      94           1 :         minEnergy.process(&c);
+      95           1 :         EXPECT_FALSE(c.isActive());
+      96           2 :         EXPECT_TRUE(c.hasProperty("Rejected"));
+      97           1 : }
+      98             : 
+      99           1 : TEST(MaximumTrajectoryLength, test) {
+     100           1 :         MaximumTrajectoryLength maxLength(10);
+     101           1 :         Candidate c;
+     102             : 
+     103           1 :         c.setTrajectoryLength(9.9);
+     104           1 :         maxLength.process(&c);
+     105           1 :         EXPECT_TRUE(c.isActive());
+     106             : 
+     107           1 :         c.setTrajectoryLength(10.1);
+     108           1 :         maxLength.process(&c);
+     109           1 :         EXPECT_FALSE(c.isActive());
+     110           2 :         EXPECT_TRUE(c.hasProperty("Rejected"));
+     111           1 : }
+     112             : 
+     113           1 : TEST(MaximumTrajectoryLength, observer) {
+     114           1 :         MaximumTrajectoryLength maxLength(12);
+     115           1 :         maxLength.addObserverPosition(Vector3d(10, 0, 0));
+     116           1 :         Candidate c;
+     117           1 :         c.current.setPosition(Vector3d(5, 0, 0));
+     118             : 
+     119           1 :         c.setTrajectoryLength(5);
+     120           1 :         maxLength.process(&c);
+     121           1 :         EXPECT_TRUE(c.isActive());
+     122             : 
+     123           1 :         c.setTrajectoryLength(8);
+     124           1 :         maxLength.process(&c);
+     125           1 :         EXPECT_FALSE(c.isActive());
+     126           1 : }
+     127             : 
+     128           1 : TEST(MinimumRedshift, test) {
+     129           1 :         MinimumRedshift minZ; // default minimum redshift of 0
+     130           1 :         Candidate c;
+     131             : 
+     132           1 :         c.setRedshift(0.1);
+     133           1 :         minZ.process(&c);
+     134           1 :         EXPECT_TRUE(c.isActive());
+     135             : 
+     136           1 :         c.setRedshift(0);
+     137           1 :         minZ.process(&c);
+     138           1 :         EXPECT_FALSE(c.isActive());
+     139           2 :         EXPECT_TRUE(c.hasProperty("Rejected"));
+     140           2 : }
+     141             : 
+     142           1 : TEST(DetectionLength, test) {
+     143           1 :         DetectionLength detL(10);
+     144           1 :         detL.setMakeRejectedInactive(false);
+     145           1 :         Candidate c;
+     146           1 :         c.current.setPosition(Vector3d(5,0,0));
+     147             : 
+     148           1 :         c.setTrajectoryLength(2);
+     149           1 :         detL.process(&c);
+     150           1 :         EXPECT_TRUE(c.isActive());
+     151             :         
+     152           1 :         c.setCurrentStep(10);
+     153           1 :         c.setTrajectoryLength(12);
+     154           1 :         detL.process(&c);
+     155           1 :         EXPECT_TRUE(c.isActive());
+     156           2 :         EXPECT_TRUE(c.hasProperty("Rejected"));
+     157           2 : }
+     158             : 
+     159             : //** ============================= Observers ================================ */
+     160           1 : TEST(ObserverFeature, SmallSphere) {
+     161             :         // detect if the current position is inside and the previous outside of the sphere
+     162           1 :         Observer obs;
+     163           1 :         obs.add(new ObserverSurface(new Sphere (Vector3d(0, 0, 0), 1)));
+     164           1 :         Candidate c;
+     165           1 :         c.setNextStep(10);
+     166             : 
+     167             :         // no detection: particle was inside already
+     168           1 :         c.current.setPosition(Vector3d(0.9, 0, 0));
+     169           1 :         c.previous.setPosition(Vector3d(0.95, 0, 0));
+     170           1 :         obs.process(&c);
+     171           1 :         EXPECT_TRUE(c.isActive());
+     172             : 
+     173             :         // limit step
+     174           1 :         EXPECT_NEAR(c.getNextStep(), 0.1, 0.001);
+     175             : 
+     176             :         // detection: particle just entered
+     177           1 :         c.current.setPosition(Vector3d(0.9, 0, 0));
+     178           1 :         c.previous.setPosition(Vector3d(1.1, 0, 0));
+     179           1 :         obs.process(&c);
+     180           1 :         EXPECT_FALSE(c.isActive());
+     181           1 : }
+     182             : 
+     183           1 : TEST(ObserverFeature, LargeSphere) {
+     184             :         // detect if the current position is outside and the previous inside of the sphere
+     185           1 :         Observer obs;
+     186           1 :         obs.add(new ObserverSurface(new Sphere (Vector3d(0, 0, 0), 10)));
+     187           1 :         Candidate c;
+     188           1 :         c.setNextStep(10);
+     189             : 
+     190             :         // no detection: particle was outside already
+     191           1 :         c.current.setPosition(Vector3d(11, 0, 0));
+     192           1 :         c.previous.setPosition(Vector3d(10.5, 0, 0));
+     193           1 :         obs.process(&c);
+     194           1 :         EXPECT_TRUE(c.isActive());
+     195             : 
+     196             :         // limit step
+     197           1 :         EXPECT_DOUBLE_EQ(c.getNextStep(), 1);
+     198             : 
+     199             :         // detection: particle just left
+     200           1 :         c.current.setPosition(Vector3d(11, 0, 0));
+     201           1 :         c.previous.setPosition(Vector3d(9.5, 0, 0));
+     202           1 :         obs.process(&c);
+     203           1 :         EXPECT_FALSE(c.isActive());
+     204           1 : }
+     205             : 
+     206           1 : TEST(ObserverFeature, Point) {
+     207           1 :         Observer obs;
+     208           1 :         obs.add(new Observer1D());
+     209           1 :         Candidate c;
+     210           1 :         c.setNextStep(10);
+     211             : 
+     212             :         // no detection, limit step
+     213           1 :         c.current.setPosition(Vector3d(5, 0, 0));
+     214           1 :         obs.process(&c);
+     215           1 :         EXPECT_TRUE(c.isActive());
+     216             : 
+     217             :         // limit step
+     218           1 :         EXPECT_DOUBLE_EQ(5, c.getNextStep());
+     219             : 
+     220             :         // detection
+     221           1 :         c.current.setPosition(Vector3d(0, 0, 0));
+     222           1 :         obs.process(&c);
+     223           1 :         EXPECT_FALSE(c.isActive());
+     224           1 : }
+     225             : 
+     226           1 : TEST(ObserverFeature, DetectAll) {
+     227             :         // DetectAll should detect all candidates
+     228           1 :         Observer obs;
+     229           1 :         obs.add(new ObserverDetectAll());
+     230           1 :         Candidate c;
+     231           1 :         obs.process(&c);
+     232           1 :         EXPECT_FALSE(c.isActive());
+     233           1 : }
+     234             : 
+     235           1 : TEST(ObserverFeature, TimeEvolution) {
+     236           1 :   Observer obs;
+     237           1 :   obs.setDeactivateOnDetection(false);
+     238           2 :   obs.setFlag("Detected", "Detected");
+     239           1 :   obs.add(new ObserverTimeEvolution(5, 5, 2));
+     240           1 :   Candidate c;
+     241           1 :   c.setNextStep(10);
+     242           1 :   c.setTrajectoryLength(3);
+     243             :   
+     244             :   // no detection, limit next step
+     245           1 :   obs.process(&c);
+     246           1 :   EXPECT_TRUE(c.isActive());
+     247             : 
+     248             :   // limit step
+     249           1 :   EXPECT_DOUBLE_EQ(2, c.getNextStep());
+     250             :   
+     251             :   // detection one
+     252           1 :   c.setCurrentStep(0.1);
+     253           1 :   c.setTrajectoryLength(5);
+     254           1 :   obs.process(&c);
+     255           1 :   EXPECT_TRUE(c.isActive());
+     256           2 :   EXPECT_TRUE(c.hasProperty("Detected"));
+     257             : 
+     258             :   // delete property
+     259           1 :   c.removeProperty("Detected");
+     260           1 :   EXPECT_FALSE(c.hasProperty("Detected"));
+     261             : 
+     262             :   // detection two
+     263           1 :   c.setCurrentStep(0.1);
+     264           1 :   c.setTrajectoryLength(10.05);
+     265           1 :   obs.process(&c);
+     266           1 :   EXPECT_TRUE(c.isActive());
+     267           2 :   EXPECT_TRUE(c.hasProperty("Detected"));
+     268           1 : }
+     269             : 
+     270           1 : TEST(ObserverFeature, TimeEvolutionLog) {
+     271           1 :   Observer obs;
+     272           1 :   obs.setDeactivateOnDetection(false);
+     273           2 :   obs.setFlag("Detected", "Detected");
+     274             :   // usage of a log scaling for the observer
+     275             :   bool log = true;
+     276           1 :   obs.add(new ObserverTimeEvolution(5, 5, 2, log));
+     277           1 :   Candidate c;
+     278           1 :   c.setNextStep(10);
+     279           1 :   c.setTrajectoryLength(3);
+     280             :   
+     281             :   // no detection, limit next step
+     282           1 :   obs.process(&c);
+     283           1 :   EXPECT_TRUE(c.isActive());
+     284             : 
+     285             :   // limit step
+     286           1 :   EXPECT_DOUBLE_EQ(2, c.getNextStep());
+     287             :   
+     288             :   // detection one
+     289           1 :   c.setCurrentStep(0.1);
+     290           1 :   c.setTrajectoryLength(5);
+     291           1 :   obs.process(&c);
+     292           1 :   EXPECT_TRUE(c.isActive());
+     293           2 :   EXPECT_TRUE(c.hasProperty("Detected"));
+     294             : 
+     295             :   // delete property
+     296           1 :   c.removeProperty("Detected");
+     297           1 :   EXPECT_FALSE(c.hasProperty("Detected"));
+     298             : 
+     299             :   // detection two
+     300           1 :   c.setCurrentStep(0.1);
+     301           1 :   c.setTrajectoryLength(10.05);
+     302           1 :   obs.process(&c);
+     303           1 :   EXPECT_TRUE(c.isActive());
+     304           2 :   EXPECT_TRUE(c.hasProperty("Detected"));
+     305           1 : }
+     306             : 
+     307             : //** ========================= Boundaries =================================== */
+     308           2 : TEST(PeriodicBox, high) {
+     309             :         // Tests if the periodical boundaries place the particle back inside the box and translate the initial position accordingly.
+     310             :         Vector3d origin(2, 2, 2);
+     311             :         Vector3d size(2, 2, 2);
+     312           1 :         PeriodicBox box(origin, size);
+     313             : 
+     314           1 :         Candidate c;
+     315           1 :         c.current.setPosition(Vector3d(4.5, 4.3, 4.4));
+     316           1 :         c.created.setPosition(Vector3d(3, 3, 3));
+     317             : 
+     318           1 :         box.process(&c);
+     319             : 
+     320           1 :         EXPECT_DOUBLE_EQ(2.5, c.current.getPosition().x);
+     321           1 :         EXPECT_DOUBLE_EQ(1, c.created.getPosition().x);
+     322           1 :         EXPECT_DOUBLE_EQ(2.3, c.current.getPosition().y);
+     323           1 :         EXPECT_DOUBLE_EQ(1, c.created.getPosition().y);
+     324           1 :         EXPECT_DOUBLE_EQ(2.4, c.current.getPosition().z);
+     325           1 :         EXPECT_DOUBLE_EQ(1, c.created.getPosition().z);
+     326           2 : }
+     327             : 
+     328           2 : TEST(PeriodicBox, low) {
+     329             :         // Tests if the periodical boundaries place the particle back inside the box and translate the initial position accordingly.
+     330             :         Vector3d origin(0, 0, 0);
+     331             :         Vector3d size(2, 2, 2);
+     332           1 :         PeriodicBox box(origin, size);
+     333             : 
+     334           1 :         Candidate c;
+     335           1 :         c.current.setPosition(Vector3d(-2.5, -0.3, -0.4));
+     336           1 :         c.created.setPosition(Vector3d(1, 1, 1));
+     337             : 
+     338           1 :         box.process(&c);
+     339             : 
+     340           1 :         EXPECT_DOUBLE_EQ(1.5, c.current.getPosition().x);
+     341           1 :         EXPECT_DOUBLE_EQ(5, c.created.getPosition().x);
+     342           1 :         EXPECT_DOUBLE_EQ(1.7, c.current.getPosition().y);
+     343           1 :         EXPECT_DOUBLE_EQ(3, c.created.getPosition().y);
+     344           1 :         EXPECT_DOUBLE_EQ(1.6, c.current.getPosition().z);
+     345           1 :         EXPECT_DOUBLE_EQ(3, c.created.getPosition().z);
+     346           2 : }
+     347             : 
+     348           2 : TEST(ReflectiveBox, high) {
+     349             :         // Tests if the reflective boundaries place the particle back inside the box and translate the initial position accordingly.
+     350             :         // Also the initial and final directions are to be reflected
+     351             :         Vector3d origin(10, 10, 10);
+     352             :         Vector3d size(10, 20, 20);
+     353           1 :         ReflectiveBox box(origin, size);
+     354             : 
+     355           1 :         Candidate c;
+     356           1 :         c.source.setPosition(Vector3d(16, 17, 18));
+     357           1 :         c.source.setDirection(Vector3d(1, 1.6, 1.8));
+     358           1 :         c.created.setPosition(Vector3d(15, 15, 15));
+     359           1 :         c.created.setDirection(Vector3d(0, 0.6, 0.8));
+     360           1 :         c.previous.setPosition(Vector3d(15, 15, 29.5));
+     361           1 :         c.previous.setDirection(Vector3d(0, 0.6, 0.8));
+     362           1 :         c.current.setPosition(Vector3d(15, 15, 30.5));
+     363           1 :         c.current.setDirection(Vector3d(0, 0.6, 0.8));
+     364             : 
+     365           1 :         box.process(&c);
+     366             : 
+     367           1 :         EXPECT_DOUBLE_EQ(16, c.source.getPosition().x);
+     368           1 :         EXPECT_DOUBLE_EQ(17, c.source.getPosition().y);
+     369           1 :         EXPECT_DOUBLE_EQ(42, c.source.getPosition().z);
+     370             : 
+     371           1 :         EXPECT_DOUBLE_EQ(15, c.created.getPosition().x);
+     372           1 :         EXPECT_DOUBLE_EQ(15, c.created.getPosition().y);
+     373           1 :         EXPECT_DOUBLE_EQ(45, c.created.getPosition().z);
+     374             : 
+     375           1 :         EXPECT_DOUBLE_EQ(15, c.previous.getPosition().x);
+     376           1 :         EXPECT_DOUBLE_EQ(15, c.previous.getPosition().y);
+     377           1 :         EXPECT_DOUBLE_EQ(30.5, c.previous.getPosition().z);
+     378             : 
+     379           1 :         EXPECT_DOUBLE_EQ(15, c.current.getPosition().x);
+     380           1 :         EXPECT_DOUBLE_EQ(15, c.current.getPosition().y);
+     381           1 :         EXPECT_DOUBLE_EQ(29.5, c.current.getPosition().z);
+     382             : 
+     383           1 :         EXPECT_DOUBLE_EQ(0, c.created.getDirection().x);
+     384           1 :         EXPECT_DOUBLE_EQ(0.6, c.created.getDirection().y);
+     385           1 :         EXPECT_DOUBLE_EQ(-0.8, c.created.getDirection().z);
+     386             : 
+     387           1 :         EXPECT_DOUBLE_EQ(0, c.previous.getDirection().x);
+     388           1 :         EXPECT_DOUBLE_EQ(0.6, c.previous.getDirection().y);
+     389           1 :         EXPECT_DOUBLE_EQ(-0.8, c.previous.getDirection().z);
+     390             : 
+     391           1 :         EXPECT_DOUBLE_EQ(0, c.current.getDirection().x);
+     392           1 :         EXPECT_DOUBLE_EQ(0.6, c.current.getDirection().y);
+     393           1 :         EXPECT_DOUBLE_EQ(-0.8, c.current.getDirection().z);
+     394           2 : }
+     395             : 
+     396           2 : TEST(CubicBoundary, inside) {
+     397           1 :         CubicBoundary cube(Vector3d(0, 0, 0), 10);
+     398           1 :         Candidate c;
+     399           1 :         c.current.setPosition(Vector3d(9, 5, 5));
+     400           1 :         cube.process(&c);
+     401           1 :         EXPECT_TRUE(c.isActive());
+     402           2 : }
+     403             : 
+     404           2 : TEST(CubicBoundary, outside) {
+     405           1 :         CubicBoundary cube(Vector3d(0, 0, 0), 10);
+     406           1 :         Candidate c;
+     407           1 :         c.current.setPosition(Vector3d(10.1, 5, 5));
+     408           1 :         cube.process(&c);
+     409           1 :         EXPECT_FALSE(c.isActive());
+     410           2 :         EXPECT_TRUE(c.hasProperty("Rejected"));
+     411           2 : }
+     412             : 
+     413           2 : TEST(CubicBoundary, limitStepLower) {
+     414           1 :         CubicBoundary cube(Vector3d(10, 10, 10), 10);
+     415           1 :         cube.setLimitStep(true);
+     416           1 :         cube.setMargin(1);
+     417           1 :         Candidate c;
+     418           1 :         c.current.setPosition(Vector3d(15, 15, 10.5));
+     419           1 :         c.setNextStep(100);
+     420           1 :         cube.process(&c);
+     421           1 :         EXPECT_DOUBLE_EQ(1.5, c.getNextStep());
+     422           2 : }
+     423             : 
+     424           2 : TEST(CubicBoundary, limitStepUpper) {
+     425           1 :         CubicBoundary cube(Vector3d(-10, -10, -10), 10);
+     426           1 :         cube.setLimitStep(true);
+     427           1 :         cube.setMargin(1);
+     428           1 :         Candidate c;
+     429           1 :         c.current.setPosition(Vector3d(-5, -5, -0.5));
+     430           1 :         c.setNextStep(100);
+     431           1 :         cube.process(&c);
+     432           1 :         EXPECT_DOUBLE_EQ(1.5, c.getNextStep());
+     433           2 : }
+     434             : 
+     435           2 : TEST(SphericalBoundary, inside) {
+     436           1 :         SphericalBoundary sphere(Vector3d(0, 0, 0), 10);
+     437           1 :         Candidate c;
+     438           1 :         c.current.setPosition(Vector3d(9, 0, 0));
+     439           1 :         sphere.process(&c);
+     440           1 :         EXPECT_TRUE(c.isActive());
+     441           1 :         EXPECT_FALSE(c.hasProperty("Rejected"));
+     442           2 : }
+     443             : 
+     444           2 : TEST(SphericalBoundary, outside) {
+     445           1 :         SphericalBoundary sphere(Vector3d(0, 0, 0), 10);
+     446           2 :         sphere.setRejectFlag("I passed the galactic border", "Nothing happened");
+     447           1 :         Candidate c;
+     448           1 :         c.current.setPosition(Vector3d(0, -10.1, 0));
+     449           1 :         sphere.process(&c);
+     450           1 :         EXPECT_FALSE(c.isActive());
+     451           2 :         EXPECT_TRUE(c.hasProperty("I passed the galactic border"));
+     452           2 : }
+     453             : 
+     454           2 : TEST(SphericalBoundary, limitStep) {
+     455           1 :         SphericalBoundary sphere(Vector3d(0, 0, 0), 10);
+     456           1 :         sphere.setLimitStep(true);
+     457           1 :         sphere.setMargin(1);
+     458           1 :         Candidate c;
+     459           1 :         c.setNextStep(100);
+     460           1 :         c.current.setPosition(Vector3d(0, 0, 9.5));
+     461           1 :         sphere.process(&c);
+     462           1 :         EXPECT_DOUBLE_EQ(1.5, c.getNextStep());
+     463           2 : }
+     464             : 
+     465           2 : TEST(EllipsoidalBoundary, inside) {
+     466           1 :         EllipsoidalBoundary ellipsoid(Vector3d(-5, 0, 0), Vector3d(5, 0, 0), 15);
+     467           1 :         Candidate c;
+     468           1 :         c.current.setPosition(Vector3d(3, 2, 0));
+     469           1 :         ellipsoid.process(&c);
+     470           1 :         EXPECT_TRUE(c.isActive());
+     471           1 :         EXPECT_FALSE(c.hasProperty("Rejected"));
+     472           2 : }
+     473             : 
+     474           2 : TEST(EllipsoidalBoundary, outside) {
+     475           1 :         EllipsoidalBoundary ellipsoid(Vector3d(-5, 0, 0), Vector3d(5, 0, 0), 15);
+     476           1 :         Candidate c;
+     477           1 :         c.current.setPosition(Vector3d(0, 25, 0));
+     478           1 :         ellipsoid.process(&c);
+     479           1 :         EXPECT_FALSE(c.isActive());
+     480           2 :         EXPECT_TRUE(c.hasProperty("Rejected"));
+     481           2 : }
+     482             : 
+     483           2 : TEST(EllipsoidalBoundary, limitStep) {
+     484           1 :         EllipsoidalBoundary ellipsoid(Vector3d(-5, 0, 0), Vector3d(5, 0, 0), 15);
+     485           1 :         ellipsoid.setLimitStep(true);
+     486           1 :         ellipsoid.setMargin(0.5);
+     487           1 :         Candidate c;
+     488           1 :         c.setNextStep(2);
+     489           1 :         c.current.setPosition(Vector3d(7, 0, 0));
+     490           1 :         ellipsoid.process(&c);
+     491           1 :         EXPECT_DOUBLE_EQ(c.getNextStep(), 1.5);
+     492           2 : }
+     493             : 
+     494           2 : TEST(CylindricalBoundary, inside) {
+     495           1 :         CylindricalBoundary cylinder(Vector3d(0, 0, 0), 2, 15);
+     496           1 :         Candidate c;
+     497           1 :         c.current.setPosition(Vector3d(6, -3, 0.5));
+     498           1 :         cylinder.process(&c);
+     499           1 :         EXPECT_TRUE(c.isActive());
+     500           1 :         EXPECT_FALSE(c.hasProperty("Rejected"));
+     501           2 : }
+     502             : 
+     503           2 : TEST(CylindricalBoundary, outside) {
+     504           1 :         CylindricalBoundary cylinder(Vector3d(0, 0, 0), 2, 15);
+     505           1 :         Candidate c;
+     506           1 :         c.current.setPosition(Vector3d(6, -3, 1.5));
+     507           1 :         cylinder.process(&c);
+     508           1 :         EXPECT_FALSE(c.isActive());
+     509           2 :         EXPECT_TRUE(c.hasProperty("Rejected"));
+     510           2 : }
+     511             : 
+     512           2 : TEST(CylindricalBoundary, limitStep) {
+     513           1 :         CylindricalBoundary cylinder(Vector3d(0, 0, 0), 2, 15);
+     514           1 :         cylinder.setLimitStep(true);
+     515           1 :         cylinder.setMargin(0.5);
+     516           1 :         Candidate c;
+     517           1 :         c.setNextStep(2);
+     518           1 :         c.current.setPosition(Vector3d(7, 0, 0));
+     519           1 :         cylinder.process(&c);
+     520           1 :         EXPECT_DOUBLE_EQ(c.getNextStep(), 1.5);
+     521           2 : }
+     522             : 
+     523           1 : TEST(RestrictToRegion, RestrictToRegion) {
+     524             : 
+     525           1 :         ref_ptr<Observer> obs = new Observer();
+     526           1 :         obs->add(new ObserverDetectAll());
+     527           1 :         RestrictToRegion R(obs, new Sphere(Vector3d(0, 0, 0), 10));
+     528             : 
+     529           1 :         Candidate c;
+     530           1 :         c.previous.setPosition(Vector3d(13,0,0));
+     531           1 :         c.current.setPosition(Vector3d(12,0,0));
+     532           1 :         R.process(&c);
+     533           1 :         EXPECT_TRUE(c.isActive());
+     534           1 :         c.current.setPosition(Vector3d(9,0,0));
+     535           1 :         R.process(&c);
+     536           1 :         EXPECT_FALSE(c.isActive());
+     537           2 : }
+     538             : 
+     539             : 
+     540           0 : int main(int argc, char **argv) {
+     541           0 :         ::testing::InitGoogleTest(&argc, argv);
+     542           0 :         return RUN_ALL_TESTS();
+     543             : }
+     544             : 
+     545             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testCandidateSplitting.cpp.func-sort-c.html b/doc/coverageReport/test/testCandidateSplitting.cpp.func-sort-c.html new file mode 100644 index 000000000..fd272427c --- /dev/null +++ b/doc/coverageReport/test/testCandidateSplitting.cpp.func-sort-c.html @@ -0,0 +1,80 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testCandidateSplitting.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testCandidateSplitting.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:4747100.0 %
Date:2024-04-08 14:58:22Functions:22100.0 %
+
+ +
+ + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa38testCandidateSplitting_SimpleTest_Test8TestBodyEv1
_ZN7crpropa39testCandidateSplitting_CheckSplits_Test8TestBodyEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testCandidateSplitting.cpp.func.html b/doc/coverageReport/test/testCandidateSplitting.cpp.func.html new file mode 100644 index 000000000..5940d2ea4 --- /dev/null +++ b/doc/coverageReport/test/testCandidateSplitting.cpp.func.html @@ -0,0 +1,80 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testCandidateSplitting.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testCandidateSplitting.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:4747100.0 %
Date:2024-04-08 14:58:22Functions:22100.0 %
+
+ +
+ + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa38testCandidateSplitting_SimpleTest_Test8TestBodyEv1
_ZN7crpropa39testCandidateSplitting_CheckSplits_Test8TestBodyEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testCandidateSplitting.cpp.gcov.html b/doc/coverageReport/test/testCandidateSplitting.cpp.gcov.html new file mode 100644 index 000000000..7f7795772 --- /dev/null +++ b/doc/coverageReport/test/testCandidateSplitting.cpp.gcov.html @@ -0,0 +1,166 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testCandidateSplitting.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testCandidateSplitting.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:4747100.0 %
Date:2024-04-08 14:58:22Functions:22100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/Units.h"
+       2             : #include "crpropa/Common.h"
+       3             : #include "crpropa/ParticleID.h"
+       4             : #include "crpropa/module/CandidateSplitting.h"
+       5             : 
+       6             : #include "gtest/gtest.h"
+       7             : #include <stdexcept>
+       8             : #include <cmath>
+       9             : 
+      10             : namespace crpropa {
+      11             : 
+      12           1 : TEST(testCandidateSplitting, SimpleTest) {
+      13           1 :         int nSplit = 2;
+      14             :         int nBins = 4;
+      15             :         double minWeight = pow(1. / nSplit, 2);
+      16             :         double Emin = 1; // dimensionless for testing
+      17             :         double Emax = 10;       
+      18             : 
+      19           1 :         CandidateSplitting split_lin(nSplit, Emin, Emax, nBins, minWeight);
+      20             :         double dE = (Emax - Emin) / nBins;
+      21           1 :         EXPECT_DOUBLE_EQ(split_lin.getEnergyBins()[0], Emin);
+      22           1 :         EXPECT_DOUBLE_EQ(split_lin.getEnergyBins()[1], Emin + dE);
+      23             : 
+      24           1 :         EXPECT_EQ(split_lin.getNsplit(), nSplit);
+      25           1 :         EXPECT_DOUBLE_EQ(split_lin.getMinimalWeight(), minWeight);
+      26             : 
+      27           2 :         CandidateSplitting split_log(nSplit, Emin, Emax, nBins, minWeight, true);
+      28             :         double dE_log = pow(Emax / Emin, 1. / (nBins - 1.0));
+      29           1 :         EXPECT_DOUBLE_EQ(split_log.getEnergyBins()[0], Emin);
+      30           1 :         EXPECT_DOUBLE_EQ(split_log.getEnergyBins()[1], Emin * dE_log);
+      31             : 
+      32             :         double spectralIndex = -2.;
+      33           2 :         CandidateSplitting split_dsa(spectralIndex, Emin, nBins);
+      34             :         double dE_dsa = pow(1. / 2, 1. / (spectralIndex + 1));
+      35           1 :         EXPECT_DOUBLE_EQ(split_dsa.getEnergyBins()[0], Emin * dE_dsa);
+      36           1 :         EXPECT_DOUBLE_EQ(split_dsa.getEnergyBins()[nBins - 1], Emin * pow(dE_dsa, nBins));
+      37           1 : }
+      38             : 
+      39             : 
+      40           1 : TEST(testCandidateSplitting, CheckSplits) {
+      41             :         int nSplit = 2;
+      42             :         int nBins = 3;
+      43             :         double Emin = 1; // dimensionless for testing
+      44             :         double Emax = 10;
+      45             :         double minWeight = pow(1. / nSplit, 4);
+      46             : 
+      47           1 :         CandidateSplitting splitting(nSplit, Emin, Emax, nBins, minWeight);
+      48           1 :         Candidate c(nucleusId(1,1),0.5);
+      49             :         double weight = 1.0;
+      50           1 :         double serial = c.getSerialNumber();
+      51             :         
+      52           1 :         splitting.process(&c); // no split
+      53           1 :         EXPECT_DOUBLE_EQ(c.getWeight(), weight);
+      54           1 :         EXPECT_DOUBLE_EQ(c.getNextSerialNumber(), serial);
+      55             : 
+      56           1 :         c.current.setEnergy(2); 
+      57           1 :         splitting.process(&c); // 1. split
+      58             :         weight = weight/nSplit;
+      59           1 :         EXPECT_DOUBLE_EQ(c.getWeight(), weight);
+      60           1 :         EXPECT_DOUBLE_EQ(c.getNextSerialNumber(), serial + 1);
+      61           1 :         c.previous.setEnergy(2);
+      62             : 
+      63           1 :         c.current.setEnergy(6); 
+      64           1 :         splitting.process(&c); // 2. split
+      65             :         weight = weight/nSplit;
+      66           1 :         EXPECT_DOUBLE_EQ(c.getWeight(), weight);
+      67           1 :         EXPECT_DOUBLE_EQ(c.getNextSerialNumber(), serial + 2);
+      68           1 :         c.previous.setEnergy(6);
+      69             : 
+      70           1 :         c.current.setEnergy(0.5); 
+      71           1 :         splitting.process(&c); // no split, cooling
+      72           1 :         EXPECT_DOUBLE_EQ(c.getWeight(), weight);
+      73           1 :         EXPECT_DOUBLE_EQ(c.getNextSerialNumber(), serial + 2);
+      74           1 :         c.previous.setEnergy(0.5);
+      75             : 
+      76           1 :         c.current.setEnergy(6); 
+      77           1 :         splitting.process(&c); // 3. & 4. split, crosses two boundaries
+      78             :         weight = weight/nSplit/nSplit;
+      79           1 :         EXPECT_DOUBLE_EQ(c.getWeight(), weight);
+      80           1 :         EXPECT_DOUBLE_EQ(c.getNextSerialNumber(), serial + 4);
+      81           1 :         c.previous.setEnergy(6);
+      82             : 
+      83           1 :         c.current.setEnergy(8); 
+      84           1 :         splitting.process(&c); // no split, minimal weight reached
+      85           1 :         EXPECT_DOUBLE_EQ(c.getWeight(), weight);
+      86           1 :         EXPECT_DOUBLE_EQ(c.getNextSerialNumber(), serial + 4);
+      87           1 :         c.previous.setEnergy(8);
+      88           1 : }
+      89             : 
+      90             : } //namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testCore.cpp.func-sort-c.html b/doc/coverageReport/test/testCore.cpp.func-sort-c.html new file mode 100644 index 000000000..d65894f63 --- /dev/null +++ b/doc/coverageReport/test/testCore.cpp.func-sort-c.html @@ -0,0 +1,308 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testCore.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testCore.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:65465799.5 %
Date:2024-04-08 14:58:22Functions:585998.3 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa4mainEiPPc0
_ZN7crpropa16Random_seed_Test8TestBodyEv1
_ZN7crpropa17Grid3f_Speed_Test8TestBodyEv1
_ZN7crpropa17common_digit_Test8TestBodyEv1
_ZN7crpropa18HepPID_charge_Test8TestBodyEv1
_ZN7crpropa19Geometry_Plane_Test8TestBodyEv1
_ZN7crpropa20Geometry_Sphere_Test8TestBodyEv1
_ZN7crpropa20Grid3f_DumpLoad_Test8TestBodyEv1
_ZN7crpropa20common_gaussInt_Test8TestBodyEv1
_ZN7crpropa21Candidate_weight_Test8TestBodyEv1
_ZN7crpropa21ParticleState_id_Test8TestBodyEv1
_ZN7crpropa22EmissionMap_merge_Test8TestBodyEv1
_ZN7crpropa22Grid1f_SimpleTest_Test8TestBodyEv1
_ZN7crpropa22Grid1f_clipVolume_Test8TestBodyEv1
_ZN7crpropa22Random_base64Seed_Test8TestBodyEv1
_ZN7crpropa22VectordGrid_Scale_Test8TestBodyEv1
_ZN7crpropa23Candidate_isActive_Test8TestBodyEv1
_ZN7crpropa23Candidate_property_Test8TestBodyEv1
_ZN7crpropa23Grid3f_DumpLoadTxt_Test8TestBodyEv1
_ZN7crpropa23Grid3f_Periodicity_Test8TestBodyEv1
_ZN7crpropa23Grid_PeriodicClamp_Test8TestBodyEv1
_ZN7crpropa23ParticleState_Mass_Test8TestBodyEv1
_ZN7crpropa23common_interpolate_Test8TestBodyEv1
_ZN7crpropa23common_pow_integer_Test8TestBodyEv1
_ZN7crpropa24Grid1f_ClosestValue_Test8TestBodyEv1
_ZN7crpropa24Grid3f_Reflectivity_Test8TestBodyEv1
_ZN7crpropa24base64_de_en_coding_Test8TestBodyEv1
_ZN7crpropa25Geometry_ParaxialBox_Test8TestBodyEv1
_ZN7crpropa25Grid3f_Interpolation_Test8TestBodyEv1
_ZN7crpropa25Grid_ReflectiveClamp_Test8TestBodyEv1
_ZN7crpropa25ParticleID_isNucleus_Test8TestBodyEv1
_ZN7crpropa25ParticleID_nucleusId_Test8TestBodyEv1
_ZN7crpropa25ParticleState_Charge_Test8TestBodyEv1
_ZN7crpropa25ParticleState_energy_Test8TestBodyEv1
_ZN7crpropa25Variant_copyToBuffer_Test8TestBodyEv1
_ZN7crpropa26Candidate_currentStep_Test8TestBodyEv1
_ZN7crpropa26EmissionMap_functions_Test8TestBodyEv1
_ZN7crpropa26Grid_PeriodicBoundary_Test8TestBodyEv1
_ZN7crpropa26ParticleID_massNumber_Test8TestBodyEv1
_ZN7crpropa26Random_bigSeedStorage_Test8TestBodyEv1
_ZN7crpropa27Candidate_addSecondary_Test8TestBodyEv1
_ZN7crpropa27Candidate_candidateTag_Test8TestBodyEv1
_ZN7crpropa27Candidate_serialNumber_Test8TestBodyEv1
_ZN7crpropa27ParticleState_Rigidity_Test8TestBodyEv1
_ZN7crpropa27ParticleState_momentum_Test8TestBodyEv1
_ZN7crpropa27ParticleState_position_Test8TestBodyEv1
_ZN7crpropa27ParticleState_velocity_Test8TestBodyEv1
_ZN7crpropa28Candidate_limitNextStep_Test8TestBodyEv1
_ZN7crpropa28Grid_ReflectiveBoundary_Test8TestBodyEv1
_ZN7crpropa28ParticleID_chargeNumber_Test8TestBodyEv1
_ZN7crpropa28ParticleState_direction_Test8TestBodyEv1
_ZN7crpropa29Grid1f_TestVectorSpacing_Test8TestBodyEv1
_ZN7crpropa29Variant_stringConversion_Test8TestBodyEv1
_ZN7crpropa30ParticleState_idException_Test8TestBodyEv1
_ZN7crpropa32ParticleState_lorentzFactor_Test8TestBodyEv1
_ZN7crpropa34common_interpolateEquidistant_Test8TestBodyEv1
_ZN7crpropa37Grid1f_GridPropertiesConstructor_Test8TestBodyEv1
_ZN7crpropa39CylindricalProjectionMap_functions_Test8TestBodyEv1
_ZN7crpropa50HepPID_consistencyWithReferenceImplementation_Test8TestBodyEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testCore.cpp.func.html b/doc/coverageReport/test/testCore.cpp.func.html new file mode 100644 index 000000000..1336167ed --- /dev/null +++ b/doc/coverageReport/test/testCore.cpp.func.html @@ -0,0 +1,308 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testCore.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testCore.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:65465799.5 %
Date:2024-04-08 14:58:22Functions:585998.3 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16Random_seed_Test8TestBodyEv1
_ZN7crpropa17Grid3f_Speed_Test8TestBodyEv1
_ZN7crpropa17common_digit_Test8TestBodyEv1
_ZN7crpropa18HepPID_charge_Test8TestBodyEv1
_ZN7crpropa19Geometry_Plane_Test8TestBodyEv1
_ZN7crpropa20Geometry_Sphere_Test8TestBodyEv1
_ZN7crpropa20Grid3f_DumpLoad_Test8TestBodyEv1
_ZN7crpropa20common_gaussInt_Test8TestBodyEv1
_ZN7crpropa21Candidate_weight_Test8TestBodyEv1
_ZN7crpropa21ParticleState_id_Test8TestBodyEv1
_ZN7crpropa22EmissionMap_merge_Test8TestBodyEv1
_ZN7crpropa22Grid1f_SimpleTest_Test8TestBodyEv1
_ZN7crpropa22Grid1f_clipVolume_Test8TestBodyEv1
_ZN7crpropa22Random_base64Seed_Test8TestBodyEv1
_ZN7crpropa22VectordGrid_Scale_Test8TestBodyEv1
_ZN7crpropa23Candidate_isActive_Test8TestBodyEv1
_ZN7crpropa23Candidate_property_Test8TestBodyEv1
_ZN7crpropa23Grid3f_DumpLoadTxt_Test8TestBodyEv1
_ZN7crpropa23Grid3f_Periodicity_Test8TestBodyEv1
_ZN7crpropa23Grid_PeriodicClamp_Test8TestBodyEv1
_ZN7crpropa23ParticleState_Mass_Test8TestBodyEv1
_ZN7crpropa23common_interpolate_Test8TestBodyEv1
_ZN7crpropa23common_pow_integer_Test8TestBodyEv1
_ZN7crpropa24Grid1f_ClosestValue_Test8TestBodyEv1
_ZN7crpropa24Grid3f_Reflectivity_Test8TestBodyEv1
_ZN7crpropa24base64_de_en_coding_Test8TestBodyEv1
_ZN7crpropa25Geometry_ParaxialBox_Test8TestBodyEv1
_ZN7crpropa25Grid3f_Interpolation_Test8TestBodyEv1
_ZN7crpropa25Grid_ReflectiveClamp_Test8TestBodyEv1
_ZN7crpropa25ParticleID_isNucleus_Test8TestBodyEv1
_ZN7crpropa25ParticleID_nucleusId_Test8TestBodyEv1
_ZN7crpropa25ParticleState_Charge_Test8TestBodyEv1
_ZN7crpropa25ParticleState_energy_Test8TestBodyEv1
_ZN7crpropa25Variant_copyToBuffer_Test8TestBodyEv1
_ZN7crpropa26Candidate_currentStep_Test8TestBodyEv1
_ZN7crpropa26EmissionMap_functions_Test8TestBodyEv1
_ZN7crpropa26Grid_PeriodicBoundary_Test8TestBodyEv1
_ZN7crpropa26ParticleID_massNumber_Test8TestBodyEv1
_ZN7crpropa26Random_bigSeedStorage_Test8TestBodyEv1
_ZN7crpropa27Candidate_addSecondary_Test8TestBodyEv1
_ZN7crpropa27Candidate_candidateTag_Test8TestBodyEv1
_ZN7crpropa27Candidate_serialNumber_Test8TestBodyEv1
_ZN7crpropa27ParticleState_Rigidity_Test8TestBodyEv1
_ZN7crpropa27ParticleState_momentum_Test8TestBodyEv1
_ZN7crpropa27ParticleState_position_Test8TestBodyEv1
_ZN7crpropa27ParticleState_velocity_Test8TestBodyEv1
_ZN7crpropa28Candidate_limitNextStep_Test8TestBodyEv1
_ZN7crpropa28Grid_ReflectiveBoundary_Test8TestBodyEv1
_ZN7crpropa28ParticleID_chargeNumber_Test8TestBodyEv1
_ZN7crpropa28ParticleState_direction_Test8TestBodyEv1
_ZN7crpropa29Grid1f_TestVectorSpacing_Test8TestBodyEv1
_ZN7crpropa29Variant_stringConversion_Test8TestBodyEv1
_ZN7crpropa30ParticleState_idException_Test8TestBodyEv1
_ZN7crpropa32ParticleState_lorentzFactor_Test8TestBodyEv1
_ZN7crpropa34common_interpolateEquidistant_Test8TestBodyEv1
_ZN7crpropa37Grid1f_GridPropertiesConstructor_Test8TestBodyEv1
_ZN7crpropa39CylindricalProjectionMap_functions_Test8TestBodyEv1
_ZN7crpropa4mainEiPPc0
_ZN7crpropa50HepPID_consistencyWithReferenceImplementation_Test8TestBodyEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testCore.cpp.gcov.html b/doc/coverageReport/test/testCore.cpp.gcov.html new file mode 100644 index 000000000..3e1716747 --- /dev/null +++ b/doc/coverageReport/test/testCore.cpp.gcov.html @@ -0,0 +1,1144 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testCore.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testCore.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:65465799.5 %
Date:2024-04-08 14:58:22Functions:585998.3 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : /** Unit tests for core features of CRPropa
+       2             :         Candidate
+       3             :         ParticleState
+       4             :         Random
+       5             :         Common functions
+       6             :  */
+       7             : 
+       8             : #include <complex>
+       9             : 
+      10             : #include "crpropa/Candidate.h"
+      11             : #include "crpropa/base64.h"
+      12             : #include "crpropa/Common.h"
+      13             : #include "crpropa/Units.h"
+      14             : #include "crpropa/ParticleID.h"
+      15             : #include "crpropa/ParticleMass.h"
+      16             : #include "crpropa/Random.h"
+      17             : #include "crpropa/Grid.h"
+      18             : #include "crpropa/GridTools.h"
+      19             : #include "crpropa/Geometry.h"
+      20             : #include "crpropa/EmissionMap.h"
+      21             : #include "crpropa/Vector3.h"
+      22             : 
+      23             : #include <HepPID/ParticleIDMethods.hh>
+      24             : #include "gtest/gtest.h"
+      25             : 
+      26             : namespace crpropa {
+      27             : 
+      28           2 : TEST(ParticleState, position) {
+      29           1 :         ParticleState particle;
+      30             :         Vector3d v(1, 3, 5);
+      31           1 :         particle.setPosition(v * Mpc);
+      32           2 :         EXPECT_TRUE(particle.getPosition() == v * Mpc);
+      33           1 : }
+      34             : 
+      35           2 : TEST(ParticleState, energy) {
+      36           1 :         ParticleState particle;
+      37           1 :         particle.setEnergy(10 * EeV);
+      38           1 :         EXPECT_EQ(particle.getEnergy(), 10 * EeV);
+      39           1 : }
+      40             : 
+      41           2 : TEST(ParticleState, direction) {
+      42           1 :         ParticleState particle;
+      43             :         Vector3d v(1, 2, 3);
+      44           1 :         particle.setDirection(v);
+      45           2 :         EXPECT_TRUE(particle.getDirection() == v.getUnitVector());
+      46           1 : }
+      47             : 
+      48           2 : TEST(ParticleState, velocity) {
+      49           1 :         ParticleState particle;
+      50             :         Vector3d v(1, 1, 0);
+      51           1 :         particle.setDirection(v);
+      52           2 :         EXPECT_TRUE(particle.getVelocity() == v.getUnitVector() * c_light);
+      53           1 : }
+      54             : 
+      55           2 : TEST(ParticleState, momentum) {
+      56           1 :         ParticleState particle;
+      57             :         Vector3d v(0, 1, 0);
+      58           1 :         particle.setDirection(v);
+      59           1 :         particle.setEnergy(100 * EeV);
+      60           2 :         EXPECT_TRUE(particle.getMomentum() == v * (particle.getEnergy() / c_light));
+      61           1 : }
+      62             : 
+      63           2 : TEST(ParticleState, id) {
+      64           1 :         ParticleState particle;
+      65           1 :         particle.setId(nucleusId(12, 6));
+      66           1 :         EXPECT_EQ(particle.getId(), 1000060120);
+      67           1 : }
+      68             : 
+      69             : #ifndef CRPROPA_TESTS_SKIP_EXCEPTIONS
+      70           1 : TEST(ParticleState, idException) {
+      71           1 :         EXPECT_THROW(nucleusId(5, 6), std::runtime_error);
+      72           1 : }
+      73             : #endif
+      74             : 
+      75           2 : TEST(ParticleState, Charge) {
+      76           1 :         ParticleState particle;
+      77             : 
+      78           1 :         particle.setId(nucleusId(56, 26)); // iron
+      79           1 :         EXPECT_DOUBLE_EQ(26 * eplus, particle.getCharge());
+      80             : 
+      81           1 :         particle.setId(-nucleusId(56, 26)); // anti-iron
+      82           1 :         EXPECT_DOUBLE_EQ(-26 * eplus, particle.getCharge());
+      83             : 
+      84           1 :         particle.setId(11); // electron
+      85           1 :         EXPECT_DOUBLE_EQ(-1 * eplus, particle.getCharge());
+      86             : 
+      87           1 :         particle.setId(-11); // positron
+      88           1 :         EXPECT_DOUBLE_EQ(1 * eplus, particle.getCharge());
+      89             : 
+      90           1 :         particle.setId(12); // electron neutrino
+      91           1 :         EXPECT_DOUBLE_EQ(0, particle.getCharge());
+      92             : 
+      93           1 :         particle.setId(-12); // electron anti-neutrino
+      94           1 :         EXPECT_DOUBLE_EQ(0, particle.getCharge());
+      95           1 : }
+      96             : 
+      97           2 : TEST(ParticleState, Rigidity) {
+      98           1 :         ParticleState particle;
+      99             : 
+     100           1 :         particle.setId(nucleusId(1, 1)); // proton
+     101           1 :         particle.setEnergy(1 * EeV);
+     102           1 :         EXPECT_EQ(particle.getRigidity(), 1e18);
+     103           1 : }
+     104             : 
+     105           2 : TEST(ParticleState, Mass) {
+     106           1 :         ParticleState particle;
+     107             : 
+     108           1 :         particle.setId(nucleusId(1, 1)); // proton
+     109           1 :         EXPECT_DOUBLE_EQ(mass_proton, particle.getMass());
+     110             : 
+     111           1 :         particle.setId(nucleusId(1, 0)); // neutron
+     112           1 :         EXPECT_DOUBLE_EQ(mass_neutron, particle.getMass());
+     113             : 
+     114           1 :         int id = nucleusId(56, 26);
+     115           1 :         particle.setId(id); // iron
+     116           1 :         EXPECT_DOUBLE_EQ(nuclearMass(id), particle.getMass());
+     117             : 
+     118           1 :         particle.setId(-id); // anti-iron
+     119           1 :         EXPECT_DOUBLE_EQ(nuclearMass(-id), particle.getMass());
+     120             : 
+     121             :         // approximation for unkown nucleus A * amu - Z * mass_electron
+     122             :         int A = 238; int Z = 92; // Uranium92
+     123           1 :         EXPECT_DOUBLE_EQ(nuclearMass(A, Z), A*amu - Z*mass_electron);
+     124           1 : }
+     125             : 
+     126           2 : TEST(ParticleState, lorentzFactor) {
+     127           1 :         ParticleState particle;
+     128           1 :         particle.setId(nucleusId(1, 1));
+     129           1 :         particle.setEnergy(1e12 * eV);
+     130           1 :         EXPECT_DOUBLE_EQ(particle.getLorentzFactor(),
+     131             :                         1e12 * eV / mass_proton / c_squared);
+     132           1 : }
+     133             : 
+     134           1 : TEST(ParticleID, nucleusId) {
+     135           1 :         EXPECT_EQ(nucleusId(3,2), 1000020030);
+     136           1 : }
+     137             : 
+     138           1 : TEST(ParticleID, chargeNumber) {
+     139           1 :         EXPECT_EQ(chargeNumber(1000020030), 2);
+     140           1 : }
+     141             : 
+     142           1 : TEST(ParticleID, massNumber) {
+     143           1 :         EXPECT_EQ(massNumber(2112), 1);
+     144           1 :         EXPECT_EQ(massNumber(1000020030), 3);
+     145           1 : }
+     146             : 
+     147           1 : TEST(ParticleID, isNucleus) {
+     148           1 :         EXPECT_TRUE(isNucleus(1000020030));
+     149           1 :         EXPECT_FALSE(isNucleus(11));
+     150           1 : }
+     151             : 
+     152           1 : TEST(HepPID, consistencyWithReferenceImplementation) {
+     153             :         // Tests the performance improved version against the default one
+     154           1 :         unsigned long testPID = rand() % 1000000000 + 1000000000;
+     155           8 :         for(size_t i=1; i < 8; i++) {
+     156           7 :                 HepPID::location loc = (HepPID::location) i;
+     157           7 :                 unsigned short newResult = HepPID::digit(loc, testPID);
+     158             :                 //original implementation
+     159           7 :                 int numerator = (int) std::pow(10.0,(loc-1));
+     160           7 :                 EXPECT_EQ(newResult, (HepPID::abspid(testPID)/numerator)%10);
+     161             :         }
+     162           1 : }
+     163             : 
+     164           1 : TEST(HepPID, charge) {
+     165           1 :         EXPECT_DOUBLE_EQ(HepPID::charge(11), -1.);
+     166           1 : }
+     167             : 
+     168           1 : TEST(Candidate, currentStep) {
+     169           1 :         Candidate candidate;
+     170           1 :         candidate.setCurrentStep(1 * Mpc);
+     171           1 :         EXPECT_DOUBLE_EQ(candidate.getCurrentStep(), 1 * Mpc);
+     172           1 : }
+     173             : 
+     174           1 : TEST(Candidate, limitNextStep) {
+     175           1 :         Candidate candidate;
+     176           1 :         candidate.setNextStep(5 * Mpc);
+     177           1 :         EXPECT_DOUBLE_EQ(candidate.getNextStep(), 5 * Mpc);
+     178           1 :         candidate.limitNextStep(2 * Mpc);
+     179           1 :         EXPECT_DOUBLE_EQ(candidate.getNextStep(), 2 * Mpc);
+     180           1 :         candidate.limitNextStep(3 * Mpc);
+     181           1 :         EXPECT_DOUBLE_EQ(candidate.getNextStep(), 2 * Mpc);
+     182           1 : }
+     183             : 
+     184           1 : TEST(Candidate, isActive) {
+     185           1 :         Candidate candidate;
+     186           1 :         EXPECT_TRUE(candidate.isActive());
+     187           1 :         candidate.setActive(false);
+     188           1 :         EXPECT_FALSE(candidate.isActive());
+     189           1 : }
+     190             : 
+     191           1 : TEST(Candidate, property) {
+     192           1 :         Candidate candidate;
+     193           2 :         candidate.setProperty("foo", "bar");
+     194           2 :         EXPECT_TRUE(candidate.hasProperty("foo"));
+     195           2 :         std::string value = candidate.getProperty("foo");
+     196           1 :         EXPECT_EQ("bar", value);
+     197           1 : }
+     198             : 
+     199           1 : TEST(Candidate, weight) {
+     200           1 :     Candidate candidate;
+     201           1 :     EXPECT_EQ (1., candidate.getWeight());
+     202             :     
+     203           1 :     candidate.setWeight(5.);
+     204           1 :     EXPECT_EQ (5., candidate.getWeight());
+     205             :     
+     206           1 :     candidate.updateWeight(3.);
+     207           1 :     EXPECT_EQ (15., candidate.getWeight());
+     208           1 : }
+     209             : 
+     210           1 : TEST(Candidate, addSecondary) {
+     211           1 :         Candidate c;
+     212           1 :         c.setRedshift(5);
+     213           1 :         c.setTrajectoryLength(23);
+     214           1 :         c.setWeight(3.);
+     215           1 :         c.previous.setId(nucleusId(56,26));
+     216           1 :         c.previous.setEnergy(1000);
+     217           1 :         c.previous.setPosition(Vector3d(1,2,3));
+     218           1 :         c.previous.setDirection(Vector3d(0,0,1));
+     219             : 
+     220           1 :         c.addSecondary(nucleusId(1,1), 200);
+     221           2 :         c.addSecondary(nucleusId(1,1), 200, 5.);
+     222           1 :         Candidate s1 = *c.secondaries[0];
+     223           1 :         Candidate s2 = *c.secondaries[1];
+     224             : 
+     225           1 :         EXPECT_EQ(nucleusId(1,1), s1.current.getId());
+     226           1 :         EXPECT_EQ(200, s1.current.getEnergy());
+     227           1 :         EXPECT_EQ(5, s1.getRedshift());
+     228           1 :         EXPECT_EQ(23, s1.getTrajectoryLength());
+     229           1 :         EXPECT_EQ(1000, s1.created.getEnergy());
+     230           1 :         EXPECT_EQ(3., s1.getWeight());
+     231           2 :         EXPECT_TRUE(Vector3d(1,2,3) == s1.created.getPosition());
+     232           2 :         EXPECT_TRUE(Vector3d(0,0,1) == s1.created.getDirection());
+     233           2 :         EXPECT_TRUE(s1.getTagOrigin() == "SEC");
+     234             : 
+     235           1 :         EXPECT_EQ(15., s2.getWeight());
+     236           1 : }
+     237             : 
+     238           1 : TEST(Candidate, candidateTag) {
+     239           1 :         Candidate c;
+     240             : 
+     241             :         // test default tag
+     242           2 :         EXPECT_TRUE(c.getTagOrigin() == "PRIM");
+     243             : 
+     244             :         // test setting tag
+     245           1 :         c.setTagOrigin("myTag");
+     246           2 :         EXPECT_TRUE(c.getTagOrigin() == "myTag");
+     247           1 : }
+     248             : 
+     249           1 : TEST(Candidate, serialNumber) {
+     250           1 :         Candidate::setNextSerialNumber(42);
+     251           1 :         Candidate c;
+     252           1 :         EXPECT_EQ(43, c.getSourceSerialNumber());
+     253           1 : }
+     254             : 
+     255           1 : TEST(common, digit) {
+     256           1 :         EXPECT_EQ(1, digit(1234, 1000));
+     257           1 :         EXPECT_EQ(2, digit(1234, 100));
+     258           1 :         EXPECT_EQ(3, digit(1234, 10));
+     259           1 :         EXPECT_EQ(4, digit(1234, 1));
+     260           1 : }
+     261             : 
+     262           1 : TEST(common, interpolate) {
+     263             :         // create vectors x = (0, 0.02, ... 2) and y = 2x + 3 = (3, ... 7)
+     264           1 :         std::vector<double> xD(101), yD(101);
+     265         102 :         for (int i = 0; i <= 100; i++) {
+     266         101 :                 xD[i] = i * 0.02;
+     267         101 :                 yD[i] = 2 * xD[i] + 3;
+     268             :         }
+     269             : 
+     270             :         // interpolating tabulated values of a linear function should produce exact results
+     271           1 :         Random &R = Random::instance();
+     272             :         double x, ytrue, yinterp;
+     273       10001 :         for (int i = 0; i < 10000; i++) {
+     274       10000 :                 x = R.rand() * 2; // random value between 0 and 2
+     275       10000 :                 ytrue = 2 * x + 3;
+     276       10000 :                 yinterp = interpolate(x, xD, yD);
+     277       10000 :                 EXPECT_DOUBLE_EQ(ytrue, yinterp);
+     278             :         }
+     279             : 
+     280             :         // test interpolation in first bin
+     281             :         x = 0.01;
+     282             :         ytrue = 2 * x + 3;
+     283           1 :         yinterp = interpolate(x, xD, yD);
+     284           1 :         EXPECT_DOUBLE_EQ(ytrue, yinterp);
+     285             : 
+     286             :         // test interpolation in last bin
+     287             :         x = 1.99;
+     288             :         ytrue = 2 * x + 3;
+     289           1 :         yinterp = interpolate(x, xD, yD);
+     290           1 :         EXPECT_DOUBLE_EQ(ytrue, yinterp);
+     291             : 
+     292             :         // value out of range, return lower bound
+     293           1 :         EXPECT_EQ(3, interpolate(-0.001, xD, yD));
+     294             : 
+     295             :         // value out of range, return upper bound
+     296           1 :         EXPECT_EQ(7, interpolate(2.001, xD, yD));
+     297           1 : }
+     298             : 
+     299           1 : TEST(common, interpolateEquidistant) {
+     300           1 :         std::vector<double> yD(100);
+     301         101 :         for (int i = 0; i < 100; i++) {
+     302         100 :                 yD[i] = pow(1 + i * 2. / 99., 2);
+     303             :         }
+     304             : 
+     305             :         // interpolated value should be close to computed
+     306           1 :         double y = interpolateEquidistant(1.5001, 1, 3, yD);
+     307           1 :         EXPECT_NEAR(pow(1.5001, 2), y, 1e-4);
+     308             : 
+     309             :         // value out of range, return lower bound
+     310           1 :         EXPECT_EQ(1, interpolateEquidistant(0.9, 1, 3, yD));
+     311             : 
+     312             :         // value out of range, return lower bound
+     313           1 :         EXPECT_EQ(9, interpolateEquidistant(3.1, 1, 3, yD));
+     314           1 : }
+     315             : 
+     316           1 : TEST(common, pow_integer) {
+     317           1 :         EXPECT_EQ(pow_integer<0>(1.23), 1);
+     318           1 :         EXPECT_FLOAT_EQ(pow_integer<1>(1.234), 1.234);
+     319           1 :         EXPECT_FLOAT_EQ(pow_integer<2>(1.234), pow(1.234, 2));
+     320           1 :         EXPECT_FLOAT_EQ(pow_integer<3>(1.234), pow(1.234, 3));
+     321           1 : }
+     322             : 
+     323           2 : TEST(common, gaussInt) {
+     324           9 :         EXPECT_NEAR(gaussInt(([](double x){ return x*x; }), 0, 10), 1000/3., 1e-4);
+     325           9 :         EXPECT_NEAR(gaussInt(([](double x){ return sin(x)*sin(x); }), 0, M_PI), M_PI/2., 1e-4);
+     326           1 : }
+     327             : 
+     328           1 : TEST(Random, seed) {
+     329           1 :         Random &a = Random::instance();
+     330           1 :         Random &b = Random::instance();
+     331             : 
+     332           1 :         a.seed(42);
+     333           1 :         double r1 = a.rand();
+     334             : 
+     335           1 :         a.seed(42);
+     336           1 :         double r2 = a.rand();
+     337             : 
+     338           1 :         a.seed(42);
+     339           1 :         double r3 = b.rand();
+     340             : 
+     341             :         // seeding should give same random numbers
+     342           1 :         EXPECT_EQ(r1, r2);
+     343             : 
+     344             :         // seeding should work for all instances
+     345           1 :         EXPECT_EQ(r1, r3);
+     346           1 : }
+     347             : 
+     348           1 : TEST(Random, bigSeedStorage) {
+     349           1 :         Random a;
+     350             :         std::vector<uint32_t> bigSeed;
+     351             : 
+     352             :         const size_t nComp = 42;
+     353             :         double values[nComp];
+     354          43 :         for (size_t i = 0; i < nComp; i++)
+     355             :         {
+     356          42 :                 values[i] = a.rand();
+     357             :         }
+     358           1 :         bigSeed = a.getSeed();
+     359           1 :         Random b;
+     360             :         //b.load(bigSeed);
+     361           1 :         b.seed(&bigSeed[0], bigSeed.size());
+     362          43 :         for (size_t i = 0; i < nComp; i++)
+     363             :         {
+     364          42 :                 EXPECT_EQ(values[i], b.rand());
+     365             :         }
+     366             : 
+     367           1 :         a.seed(42);
+     368           1 :         bigSeed = a.getSeed();
+     369           1 :         EXPECT_EQ(bigSeed.size(), 1);
+     370           1 :         EXPECT_EQ(bigSeed[0], 42);
+     371           1 :         b.seed(bigSeed[0]);
+     372          43 :         for (size_t i = 0; i < nComp; i++)
+     373             :         {
+     374          42 :                 EXPECT_EQ(a.rand(), b.rand());
+     375             :         }
+     376             : 
+     377           1 : }
+     378             : 
+     379           1 : TEST(base64, de_en_coding) {
+     380           1 :         Random a;
+     381         100 :         for (int N=1; N < 100; N++) {
+     382             :                 std::vector<uint32_t> data;
+     383          99 :                 data.reserve(N);
+     384        5049 :                 for (int i =0; i<N; i++)
+     385        4950 :                         data.push_back(a.randInt());
+     386             : 
+     387          99 :                 std::string encoded_data = Base64::encode((unsigned char*)&data[0], sizeof(data[0]) * data.size() / sizeof(unsigned char));
+     388             : 
+     389          99 :                 std::string decoded_data = Base64::decode(encoded_data);
+     390          99 :                 size_t S = decoded_data.size() * sizeof(decoded_data[0]) / sizeof(uint32_t);
+     391        5049 :                 for (int i=0; i < S; i++) {
+     392        4950 :                         EXPECT_EQ(((uint32_t*)decoded_data.c_str())[i], data[i]);
+     393             :                 }
+     394             :         }
+     395             : 
+     396           1 : }
+     397             : 
+     398           1 : TEST(Random, base64Seed) {
+     399             : 
+     400           1 :         std::string seed =  "I1+8ANzXYwAqAAAAAwAAAA==";
+     401             :         std::vector<uint32_t> bigSeed;
+     402           1 :         bigSeed.push_back(12345123);
+     403           1 :         bigSeed.push_back(6543324);
+     404           1 :         bigSeed.push_back(42);
+     405           1 :         bigSeed.push_back(3);
+     406           1 :         Random a, b;
+     407           1 :         a.seed(seed);
+     408           1 :         b.seed(&bigSeed[0], bigSeed.size());
+     409             : 
+     410             :         const size_t nComp = 42;
+     411             :         double values[nComp];
+     412          43 :         for (size_t i = 0; i < nComp; i++)
+     413             :         {
+     414          42 :                 EXPECT_EQ(a.rand(), b.rand());
+     415             :         }
+     416           1 : }
+     417             : 
+     418           2 : TEST(Grid, PeriodicClamp) {
+     419             :         // Test correct determination of lower and upper neighbor
+     420             :         int lo, hi;
+     421             : 
+     422             :         periodicClamp(23.12, 8, lo, hi);
+     423           1 :         EXPECT_EQ(7, lo);
+     424           1 :         EXPECT_EQ(0, hi);
+     425             : 
+     426             :         periodicClamp(-23.12, 8, lo, hi);
+     427           1 :         EXPECT_EQ(0, lo);
+     428           1 :         EXPECT_EQ(1, hi);
+     429           1 : }
+     430             : 
+     431           1 : TEST(Grid, PeriodicBoundary) {
+     432             :         // Test correct determination of periodic continuated index
+     433             :         // periodic indices for n=8 should repeat like ...0123456701234567...
+     434             :         int index;
+     435             : 
+     436           1 :         index = periodicBoundary(0, 8);
+     437           1 :         EXPECT_EQ(0, index);
+     438           1 :         index = periodicBoundary(7, 8);
+     439           1 :         EXPECT_EQ(7, index);
+     440           1 :         index = periodicBoundary(8, 8);
+     441           1 :         EXPECT_EQ(0, index);
+     442           1 :         index = periodicBoundary(9, 8);
+     443           1 :         EXPECT_EQ(1, index);
+     444           1 : }
+     445             : 
+     446           1 : TEST(Grid, ReflectiveClamp) {
+     447             :         // Test correct determination of lower and upper neighbor
+     448             :         // reflective indices for n=8 should repeat like ...67765432100123456776...
+     449             :         int lo, hi; 
+     450             :         double res;
+     451             : 
+     452           1 :         reflectiveClamp(23.12, 8, lo, hi, res);
+     453           1 :         EXPECT_EQ(7, lo);
+     454           1 :         EXPECT_EQ(7, hi);
+     455           1 :         EXPECT_FLOAT_EQ(7.12, res);
+     456             : 
+     457           1 :         reflectiveClamp(-23.12, 8, lo, hi, res);
+     458           1 :         EXPECT_EQ(6, lo);
+     459           1 :         EXPECT_EQ(7, hi);
+     460           1 :         EXPECT_FLOAT_EQ(6.12, res);
+     461           1 : }
+     462             : 
+     463           2 : TEST(Grid, ReflectiveBoundary) {
+     464             :         // Test correct determination of reflected index
+     465             :         // reflective indices for n=8 should repeat like ...67765432100123456776...
+     466             :         int index; 
+     467             : 
+     468           1 :         index = reflectiveBoundary(8, 8);
+     469           1 :         EXPECT_EQ(7, index);
+     470           1 :         index = reflectiveBoundary(9, 8);
+     471           1 :         EXPECT_EQ(6, index);
+     472           1 :         index = reflectiveBoundary(0, 8);
+     473           1 :         EXPECT_EQ(0, index);
+     474           1 :         index = reflectiveBoundary(-1, 8);
+     475           1 :         EXPECT_EQ(0, index);
+     476           1 :         index = reflectiveBoundary(-8, 8);
+     477           1 :         EXPECT_EQ(7, index);
+     478           1 :         index = reflectiveBoundary(-9, 8);
+     479           1 :         EXPECT_EQ(7, index);
+     480           1 : }
+     481             : 
+     482           1 : TEST(Grid1f, SimpleTest) {
+     483             :         // Test construction and parameters
+     484           1 :         size_t Nx = 5;
+     485           1 :         size_t Ny = 8;
+     486           1 :         size_t Nz = 10;
+     487             :         double spacing = 2.0;
+     488             :         Vector3d origin(1., 2., 3.);
+     489             : 
+     490           1 :         Grid1f grid(origin, Nx, Ny, Nz, spacing);
+     491             : 
+     492           1 :         EXPECT_TRUE(origin == grid.getOrigin());
+     493           1 :         EXPECT_EQ(Nx, grid.getNx());
+     494           1 :         EXPECT_EQ(Ny, grid.getNy());
+     495           1 :         EXPECT_EQ(Nz, grid.getNz());
+     496           1 :         EXPECT_EQ(Vector3d(spacing), grid.getSpacing());
+     497           1 :         EXPECT_EQ(5 * 8 * 10, grid.getGrid().size());
+     498             : 
+     499             :         // Test index handling: get position of grid point (2, 3, 4)
+     500           1 :         size_t some_index = 2 * Ny * Nz + 3 * Nz + 4;
+     501             :         Vector3d some_grid_point = origin + Vector3d(2, 3, 4) * spacing + Vector3d(spacing / 2.);
+     502           2 :         EXPECT_EQ(some_grid_point, grid.positionFromIndex(some_index));
+     503             :         
+     504             :         //Test if value on gridpoint is correctly retrieved
+     505           1 :         grid.get(2, 3, 4) = 7;
+     506           1 :         EXPECT_FLOAT_EQ(7., grid.getGrid()[some_index]);
+     507             :         //trilinear interpolated
+     508           1 :         EXPECT_FLOAT_EQ(7., grid.interpolate(some_grid_point));
+     509             :         //tricubic interpolated
+     510             :         grid.setInterpolationType(TRICUBIC);
+     511           1 :         EXPECT_FLOAT_EQ(7., grid.interpolate(some_grid_point));
+     512             :         //nearest neighbour interpolated
+     513             :         grid.setInterpolationType(NEAREST_NEIGHBOUR);
+     514           1 :         EXPECT_FLOAT_EQ(7., grid.interpolate(some_grid_point));
+     515             : 
+     516             :         //Test if grid is set to zero outside of volume for clipVolume=true
+     517             :         grid.setClipVolume(true);
+     518           1 :         EXPECT_FLOAT_EQ(0, grid.interpolate(Vector3d(100, 0, 12)));
+     519           1 : }
+     520             : 
+     521           2 : TEST(Grid1f, GridPropertiesConstructor) {
+     522             :         // Test constructor for vector spacing
+     523             :         size_t Nx = 5;
+     524             :         size_t Ny = 8;
+     525             :         size_t Nz = 10;
+     526             :         Vector3d origin = Vector3d(1., 2., 3.);
+     527             :         Vector3d spacing = Vector3d(1., 5., 3.);
+     528             :         GridProperties properties(origin, Nx, Ny, Nz, spacing);
+     529           1 :         Grid1f grid(properties);
+     530             : 
+     531           1 :         EXPECT_EQ(spacing, grid.getSpacing());
+     532             : 
+     533             :         // Test index handling: get position of grid point (1, 7, 6)
+     534             :         size_t some_index = 1 * Ny * Nz + 7 * Nz + 6;
+     535             :         Vector3d some_grid_point = origin + Vector3d(1, 7, 6) * spacing + spacing / 2.;
+     536             : 
+     537             :         //Test if value on gridpoint is correctly retrieved
+     538           1 :         grid.get(1, 7, 6) = 12;
+     539           1 :         EXPECT_FLOAT_EQ(12., grid.getGrid()[some_index]);
+     540             :         //trilinear interpolated
+     541           1 :         EXPECT_FLOAT_EQ(12., grid.interpolate(some_grid_point));
+     542             :         //tricubic interpolated
+     543             :         grid.setInterpolationType(TRICUBIC);
+     544           1 :         EXPECT_FLOAT_EQ(12., grid.interpolate(some_grid_point));
+     545             :         //nearest neighbour interpolated
+     546             :         grid.setInterpolationType(NEAREST_NEIGHBOUR);
+     547           1 :         EXPECT_FLOAT_EQ(12., grid.interpolate(some_grid_point));
+     548           1 : }
+     549             : 
+     550           2 : TEST(Grid1f, TestVectorSpacing) {
+     551             :         // Test constructor for vector spacing
+     552             :         size_t Nx = 5;
+     553             :         size_t Ny = 8;
+     554             :         size_t Nz = 10;
+     555             :         Vector3d origin = Vector3d(1., 2., 3.);
+     556             :         Vector3d spacing = Vector3d(1., 5., 3.);
+     557             : 
+     558           1 :         Grid1f grid(origin, Nx, Ny, Nz, spacing);
+     559             : 
+     560           1 :         EXPECT_EQ(spacing, grid.getSpacing());
+     561             : 
+     562             :         // Test index handling: get position of grid point (1, 7, 6)
+     563             :         size_t some_index = 1 * Ny * Nz + 7 * Nz + 6;
+     564             :         Vector3d some_grid_point = origin + Vector3d(1, 7, 6) * spacing + spacing / 2.;
+     565             : 
+     566             :         //Test if value on gridpoint is correctly retrieved
+     567           1 :         grid.get(1, 7, 6) = 12;
+     568           1 :         EXPECT_FLOAT_EQ(12., grid.getGrid()[some_index]);
+     569             :         //trilinear interpolated
+     570           1 :         EXPECT_FLOAT_EQ(12., grid.interpolate(some_grid_point));
+     571             :         //tricubic interpolated
+     572             :         grid.setInterpolationType(TRICUBIC);
+     573           1 :         EXPECT_FLOAT_EQ(12., grid.interpolate(some_grid_point));
+     574             :         //nearest neighbour interpolated
+     575             :         grid.setInterpolationType(NEAREST_NEIGHBOUR);
+     576           1 :         EXPECT_FLOAT_EQ(12., grid.interpolate(some_grid_point));
+     577           1 : }
+     578             : 
+     579           2 : TEST(Grid1f, ClosestValue) {
+     580             :         // Check some closest values / nearest neighbour interpolation
+     581           1 :         Grid1f grid(Vector3d(0.), 2, 2, 2, 1.);
+     582           1 :         grid.get(0, 0, 0) = 1;
+     583           1 :         grid.get(0, 0, 1) = 2;
+     584           1 :         grid.get(0, 1, 0) = 3;
+     585           1 :         grid.get(0, 1, 1) = 4;
+     586           1 :         grid.get(1, 0, 0) = 5;
+     587           1 :         grid.get(1, 0, 1) = 6;
+     588           1 :         grid.get(1, 1, 0) = 7;
+     589           1 :         grid.get(1, 1, 1) = 8;
+     590             : 
+     591             :         // grid points are at 0.5 and 1.5
+     592           1 :         EXPECT_FLOAT_EQ(1, grid.closestValue(Vector3d(0.1,  0.2, 0.6)));
+     593           1 :         EXPECT_FLOAT_EQ(2, grid.closestValue(Vector3d(0.2, 0.1, 1.3)));
+     594           1 :         EXPECT_FLOAT_EQ(3, grid.closestValue(Vector3d(0.3, 1.2, 0.2)));
+     595           1 :         EXPECT_FLOAT_EQ(7, grid.closestValue(Vector3d(1.7, 1.8, 0.4)));
+     596             : 
+     597             :         //Test if grid is set to zero outside of volume for clipVolume=true
+     598           1 :         EXPECT_NE(0, grid.interpolate(Vector3d(0, 0, 12)));
+     599             :         grid.setClipVolume(true);
+     600           1 :         double b = grid.interpolate(Vector3d(0, 0, 12));
+     601           1 :         EXPECT_FLOAT_EQ(0, b);
+     602           1 : }
+     603             : 
+     604           2 : TEST(Grid1f, clipVolume) {
+     605             :         // Check volume clipping for gridproperties constructor
+     606             :         size_t N = 2;
+     607             :         Vector3d origin = Vector3d(0.);
+     608             :         double spacing = 2;
+     609             :         GridProperties properties(origin, N, spacing);
+     610           1 :         Grid1f grid(properties);
+     611           1 :         grid.get(0, 0, 0) = 1;
+     612           1 :         grid.get(0, 0, 1) = 2;
+     613           1 :         grid.get(0, 1, 0) = 3;
+     614           1 :         grid.get(0, 1, 1) = 4;
+     615           1 :         grid.get(1, 0, 0) = 5;
+     616           1 :         grid.get(1, 0, 1) = 6;
+     617           1 :         grid.get(1, 1, 0) = 7;
+     618           1 :         grid.get(1, 1, 1) = 8;
+     619             : 
+     620             :         //Test if grid is set to zero outside of volume for clipVolume=true
+     621           1 :         EXPECT_NE(0, grid.interpolate(Vector3d(0, 0, 12)));
+     622             :         grid.setClipVolume(true);
+     623           1 :         double b = grid.interpolate(Vector3d(0, 0, 10));
+     624           1 :         EXPECT_FLOAT_EQ(0, b);
+     625           1 : }
+     626             : 
+     627           2 : TEST(Grid3f, Interpolation) {
+     628             :         // Explicitly test trilinear and tricubic interpolation
+     629             :         double spacing = 2.793;
+     630             :         int n = 3;
+     631           1 :         Grid3f grid(Vector3d(0.), n, n, n, spacing);
+     632             :         grid.get(0, 0, 1) = Vector3f(1.7, 0., 0.); // set one value
+     633             : 
+     634             :         Vector3d b;
+     635             :         
+     636             :         //trilinear
+     637             : 
+     638             :         // grid points are at [0.5, 1.5, ...] * spacing
+     639           1 :         b = grid.interpolate(Vector3d(0.5, 0.5, 1.5) * spacing);
+     640           1 :         EXPECT_FLOAT_EQ(1.7, b.x);
+     641             : 
+     642           1 :         b = grid.interpolate(Vector3d(0.5, 0.5, 1.4) * spacing);
+     643           1 :         EXPECT_FLOAT_EQ(1.7 * 0.9, b.x);
+     644             : 
+     645           1 :         b = grid.interpolate(Vector3d(0.5, 0.5, 1.6) * spacing);
+     646           1 :         EXPECT_FLOAT_EQ(1.7 * 0.9, b.x);
+     647             : 
+     648           1 :         b = grid.interpolate(Vector3d(0.5, 0.35, 1.6) * spacing);
+     649           1 :         EXPECT_FLOAT_EQ(1.7 * 0.9 * 0.85, b.x);
+     650             : 
+     651           1 :         b = grid.interpolate(Vector3d(0.5, 2.65, 1.6) * spacing); // using periodic repetition
+     652           1 :         EXPECT_FLOAT_EQ(1.7 * 0.9 * 0.15, b.x);
+     653             :         
+     654             :         //tricubic
+     655             :         #ifdef HAVE_SIMD
+     656             :         grid.setInterpolationType(TRICUBIC);
+     657             :         
+     658           1 :         b = grid.interpolate(Vector3d(0.5, 0.5, 1.5) * spacing);
+     659           1 :         EXPECT_FLOAT_EQ(1.7, b.x);
+     660             : 
+     661           1 :         b = grid.interpolate(Vector3d(0.5, 0.5, 1.4) * spacing);
+     662           1 :         EXPECT_FLOAT_EQ(1.66005015373, b.x);
+     663             : 
+     664           1 :         b = grid.interpolate(Vector3d(0.5, 0.5, 1.6) * spacing);
+     665           1 :         EXPECT_FLOAT_EQ(1.66005003452, b.x);
+     666             : 
+     667           1 :         b = grid.interpolate(Vector3d(0.5, 0.35, 1.6) * spacing);
+     668           1 :         EXPECT_FLOAT_EQ(1.57507634163, b.x);
+     669             : 
+     670           1 :         b = grid.interpolate(Vector3d(0.5, 2.65, 1.6) * spacing);
+     671           1 :         EXPECT_FLOAT_EQ(0.190802007914, b.x);
+     672             :         #endif // HAVE_SIMD
+     673           1 : }
+     674             : 
+     675           2 : TEST(VectordGrid, Scale) {
+     676             :         // Test scaling a field
+     677           1 :         ref_ptr<Grid3f> grid = new Grid3f(Vector3d(0.), 3, 1);
+     678           4 :         for (int ix = 0; ix < 3; ix++)
+     679          12 :                 for (int iy = 0; iy < 3; iy++)
+     680          36 :                         for (int iz = 0; iz < 3; iz++)
+     681          27 :                                 grid->get(ix, iy, iz) = Vector3f(1, 0, 0);
+     682             : 
+     683           1 :         scaleGrid(grid, 5);
+     684           4 :         for (int ix = 0; ix < 3; ix++)
+     685          12 :                 for (int iy = 0; iy < 3; iy++)
+     686          36 :                         for (int iz = 0; iz < 3; iz++)
+     687          27 :                                 EXPECT_FLOAT_EQ(5, grid->interpolate(Vector3d(0.7, 0, 0.1)).x);
+     688           1 : }
+     689             : 
+     690           2 : TEST(Grid3f, Periodicity) {
+     691             :         // Test for periodic boundaries: grid(x+a*n) = grid(x)
+     692             :         size_t n = 3;
+     693             :         double spacing = 3;
+     694             :         double size = n * spacing;
+     695           1 :         Grid3f grid(Vector3d(0.), n, spacing);
+     696           4 :         for (int ix = 0; ix < 3; ix++)
+     697          12 :                 for (int iy = 0; iy < 3; iy++)
+     698          36 :                         for (int iz = 0; iz < 3; iz++)
+     699          27 :                                 grid.get(ix, iy, iz) = Vector3f(iz + ix, iy * iz, ix - iz * iy);
+     700             : 
+     701             :         Vector3d pos(1.2, 2.3, 0.7);
+     702             :         
+     703             :         //trilinear interpolated
+     704           1 :         Vector3f b = grid.interpolate(pos);
+     705           1 :         Vector3f b2 = grid.interpolate(pos + Vector3d(1, 0, 0) * size);
+     706           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
+     707           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
+     708           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
+     709             : 
+     710           1 :         b2 = grid.interpolate(pos + Vector3d(0, 5, 0) * size);
+     711           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
+     712           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
+     713           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
+     714             : 
+     715           1 :         b2 = grid.interpolate(pos + Vector3d(0, 0, -2) * size);
+     716           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
+     717           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
+     718           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
+     719             :         
+     720             :         //tricubic interpolated
+     721             :         #ifdef HAVE_SIMD
+     722             :         grid.setInterpolationType(TRICUBIC);
+     723           1 :         b = grid.interpolate(pos);
+     724           1 :         b2 = grid.interpolate(pos + Vector3d(1, 0, 0) * size);
+     725           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
+     726           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
+     727           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
+     728             : 
+     729           1 :         b2 = grid.interpolate(pos + Vector3d(0, 5, 0) * size);
+     730           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
+     731           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
+     732           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
+     733             : 
+     734           1 :         b2 = grid.interpolate(pos + Vector3d(0, 0, -2) * size);
+     735           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
+     736           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
+     737           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
+     738             :         #endif // HAVE_SIMD
+     739             :         
+     740             :         //nearest neighbour interpolated
+     741             :         grid.setInterpolationType(NEAREST_NEIGHBOUR);
+     742           1 :         b = grid.interpolate(pos);
+     743           1 :         b2 = grid.interpolate(pos + Vector3d(1, 0, 0) * size);
+     744           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
+     745           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
+     746           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
+     747             : 
+     748           1 :         b2 = grid.interpolate(pos + Vector3d(0, 5, 0) * size);
+     749           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
+     750           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
+     751           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
+     752             : 
+     753           1 :         b2 = grid.interpolate(pos + Vector3d(0, 0, -2) * size);
+     754           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
+     755           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
+     756           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
+     757             : 
+     758             :         //Test if grid is set to zero outside of volume for clipVolume=true
+     759             :         grid.setClipVolume(true);
+     760           1 :         Vector3f b3 = grid.interpolate(pos + Vector3d(0, 0, -2) * size);
+     761           1 :         EXPECT_FLOAT_EQ(0., b3.x);
+     762           1 :         EXPECT_FLOAT_EQ(0., b3.y);
+     763           1 :         EXPECT_FLOAT_EQ(0., b3.z);
+     764           1 : }
+     765             : 
+     766           2 : TEST(Grid3f, Reflectivity) {
+     767             :         // Test for reflective boundaries: grid(pos) = grid(x+a) = grid(-x-a)
+     768             :         size_t n = 3;
+     769             :         double spacing = 3;
+     770             :         double size = n * spacing;
+     771           1 :         Grid3f grid(Vector3d(0.), n, spacing);
+     772             :         grid.setReflective(true); //set reflective boundary
+     773           4 :         for (int ix = 0; ix < 3; ix++)
+     774          12 :                 for (int iy = 0; iy < 3; iy++)
+     775          36 :                         for (int iz = 0; iz < 3; iz++)
+     776          27 :                                 grid.get(ix, iy, iz) = Vector3f(iz + ix, iy * iz, ix - iz * iy);
+     777             : 
+     778             :         Vector3d pos(1.2, 2.3, 0.7);
+     779             :         
+     780             :         //trilinear interpolated
+     781           1 :         Vector3f b = grid.interpolate(pos + Vector3d(1,0,0) * spacing);
+     782           1 :         Vector3f b2 = grid.interpolate(pos *(-1) - Vector3d(1,0,0) * spacing);
+     783           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
+     784           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
+     785           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
+     786             :         
+     787           1 :         b = grid.interpolate(pos + Vector3d(0,5,0) * spacing);
+     788           1 :         b2 = grid.interpolate(pos *(-1) - Vector3d(0,5,0) * spacing);
+     789           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
+     790           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
+     791           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
+     792             :         
+     793           1 :         b = grid.interpolate(pos + Vector3d(0,0,-2) * spacing);
+     794           1 :         b2 = grid.interpolate(pos *(-1) - Vector3d(0,0,-2) * spacing);
+     795           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
+     796           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
+     797           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
+     798             :         
+     799             :         //tricubic interpolated
+     800             :         #ifdef HAVE_SIMD
+     801             :         grid.setInterpolationType(TRICUBIC);
+     802           1 :         b = grid.interpolate(pos + Vector3d(1,0,0) * spacing);
+     803           1 :         b2 = grid.interpolate(pos *(-1) - Vector3d(1,0,0) * spacing);
+     804           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
+     805           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
+     806           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
+     807             :         
+     808           1 :         b = grid.interpolate(pos + Vector3d(0,5,0) * spacing);
+     809           1 :         b2 = grid.interpolate(pos *(-1) - Vector3d(0,5,0) * spacing);
+     810           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
+     811           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
+     812           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
+     813             :         
+     814           1 :         b = grid.interpolate(pos + Vector3d(0,0,-2) * spacing);
+     815           1 :         b2 = grid.interpolate(pos *(-1) - Vector3d(0,0,-2) * spacing);
+     816           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
+     817           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
+     818           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
+     819             :         #endif //HAVE_SIMD
+     820             :         
+     821             :         //nearest neighbour interpolated
+     822             :         grid.setInterpolationType(NEAREST_NEIGHBOUR);
+     823           1 :         b = grid.interpolate(pos + Vector3d(1,0,0) * spacing);
+     824           1 :         b2 = grid.interpolate(pos *(-1) - Vector3d(1,0,0) * spacing);
+     825           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
+     826           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
+     827           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
+     828             :         
+     829           1 :         b = grid.interpolate(pos + Vector3d(0,5,0) * spacing);
+     830           1 :         b2 = grid.interpolate(pos *(-1) - Vector3d(0,5,0) * spacing);
+     831           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
+     832           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
+     833           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
+     834             :         
+     835           1 :         b = grid.interpolate(pos + Vector3d(0,0,-2) * spacing);
+     836           1 :         b2 = grid.interpolate(pos *(-1) - Vector3d(0,0,-2) * spacing);
+     837           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
+     838           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
+     839           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
+     840             : 
+     841             :         //Test if grid is set to zero outside of volume for clipVolume=true
+     842             :         grid.setClipVolume(true);
+     843           1 :         Vector3f b3 = grid.interpolate(pos + Vector3d(0, 0, -2) * size);
+     844           1 :         EXPECT_FLOAT_EQ(0., b3.x);
+     845           1 :         EXPECT_FLOAT_EQ(0., b3.y);
+     846           1 :         EXPECT_FLOAT_EQ(0., b3.z);
+     847           1 : }
+     848             : 
+     849           2 : TEST(Grid3f, DumpLoad) {
+     850             :         // Dump and load a field grid
+     851           1 :         ref_ptr<Grid3f> grid1 = new Grid3f(Vector3d(0.), 3, 1);
+     852           1 :         ref_ptr<Grid3f> grid2 = new Grid3f(Vector3d(0.), 3, 1);
+     853             : 
+     854           4 :         for (int ix = 0; ix < 3; ix++)
+     855          12 :                 for (int iy = 0; iy < 3; iy++)
+     856          36 :                         for (int iz = 0; iz < 3; iz++)
+     857          27 :                                 grid1->get(ix, iy, iz) = Vector3f(1, 2, 3);
+     858             : 
+     859           2 :         dumpGrid(grid1, "testDump.raw");
+     860           2 :         loadGrid(grid2, "testDump.raw");
+     861             : 
+     862           4 :         for (int ix = 0; ix < 3; ix++) {
+     863          12 :                 for (int iy = 0; iy < 3; iy++) {
+     864          36 :                         for (int iz = 0; iz < 3; iz++) {
+     865          27 :                                 Vector3f b1 = grid1->get(ix, iy, iz);
+     866             :                                 Vector3f b2 = grid2->get(ix, iy, iz);
+     867          27 :                                 EXPECT_FLOAT_EQ(b1.x, b2.x);
+     868          27 :                                 EXPECT_FLOAT_EQ(b1.y, b2.y);
+     869          27 :                                 EXPECT_FLOAT_EQ(b1.z, b2.z);
+     870             :                         }
+     871             :                 }
+     872             :         }
+     873           1 : }
+     874             : 
+     875           2 : TEST(Grid3f, DumpLoadTxt) {
+     876             :         // Dump and load a field grid
+     877           1 :         ref_ptr<Grid3f> grid1 = new Grid3f(Vector3d(0.), 3, 1);
+     878           1 :         ref_ptr<Grid3f> grid2 = new Grid3f(Vector3d(0.), 3, 1);
+     879             : 
+     880           4 :         for (int ix = 0; ix < 3; ix++)
+     881          12 :                 for (int iy = 0; iy < 3; iy++)
+     882          36 :                         for (int iz = 0; iz < 3; iz++)
+     883          27 :                                 grid1->get(ix, iy, iz) = Vector3f(ix, iy, iz);
+     884             : 
+     885           2 :         dumpGridToTxt(grid1, "testDump.txt", 1e4);
+     886           2 :         loadGridFromTxt(grid2, "testDump.txt", 1e-4);
+     887             : 
+     888           4 :         for (int ix = 0; ix < 3; ix++) {
+     889          12 :                 for (int iy = 0; iy < 3; iy++) {
+     890          36 :                         for (int iz = 0; iz < 3; iz++) {
+     891          27 :                                 Vector3f b1 = grid1->get(ix, iy, iz);
+     892             :                                 Vector3f b2 = grid2->get(ix, iy, iz);
+     893          27 :                                 EXPECT_FLOAT_EQ(b1.x, b2.x);
+     894          27 :                                 EXPECT_FLOAT_EQ(b1.y, b2.y);
+     895          27 :                                 EXPECT_FLOAT_EQ(b1.z, b2.z);
+     896             :                         }
+     897             :                 }
+     898             :         }
+     899           1 : }
+     900             : 
+     901           2 : TEST(Grid3f, Speed) {
+     902             :         // Dump and load a field grid
+     903           1 :         Grid3f grid(Vector3d(0.), 3, 3);
+     904           4 :         for (int ix = 0; ix < 3; ix++)
+     905          12 :                 for (int iy = 0; iy < 3; iy++)
+     906          36 :                         for (int iz = 0; iz < 3; iz++)
+     907          27 :                                 grid.get(ix, iy, iz) = Vector3f(1, 2, 3);
+     908             : 
+     909             :         Vector3d b;
+     910      100001 :         for (int i = 0; i < 100000; i++)
+     911      100000 :                 b = grid.interpolate(Vector3d(i));
+     912           1 : }
+     913             : 
+     914           2 : TEST(CylindricalProjectionMap, functions) {
+     915             :         Vector3d v;
+     916           1 :         v.setRThetaPhi(1.0, 1.2, 2.4);
+     917           1 :         EXPECT_NEAR(v.getPhi(), 2.4, .00001);
+     918           1 :         EXPECT_NEAR(v.getTheta(), 1.2, .000001);
+     919             : 
+     920             : 
+     921             : 
+     922           2 :         CylindricalProjectionMap cpm(24, 12);
+     923           1 :         size_t bin = 50;
+     924           1 :         Vector3d d = cpm.directionFromBin(bin);
+     925           1 :         size_t bin2 = cpm.binFromDirection(d);
+     926           1 :         EXPECT_EQ(bin, bin2);
+     927           1 : }
+     928             : 
+     929           1 : TEST(EmissionMap, functions) {
+     930             : 
+     931           1 :         EmissionMap em(360, 180, 100, 1 * EeV, 100 * EeV);
+     932           1 :         double e = em.energyFromBin(50);
+     933           1 :         size_t b = em.binFromEnergy(50 * EeV);
+     934             : 
+     935             :         Vector3d d(1.0, 0.0, 0.0);
+     936             : 
+     937           1 :         em.fillMap(1, 50 * EeV, d);
+     938             : 
+     939             :         Vector3d d2;
+     940             : 
+     941           1 :         bool r = em.drawDirection(1, 50 * EeV, d2);
+     942           1 :         EXPECT_TRUE(r);
+     943           1 :         EXPECT_TRUE(d.getAngleTo(d2) < (2. * M_PI / 180.));
+     944             : 
+     945           1 :         r = em.drawDirection(1, 30 * EeV, d2);
+     946           1 :         EXPECT_FALSE(r);
+     947             : 
+     948           1 :         r = em.drawDirection(2, 50 * EeV, d2);
+     949           1 :         EXPECT_FALSE(r);
+     950             : 
+     951           1 : }
+     952             : 
+     953           1 : TEST(EmissionMap, merge) {
+     954           1 :         EmissionMap em1, em2;
+     955           1 :         em1.fillMap(1, 50 * EeV, Vector3d(1.0, 0.0, 0.0));
+     956           1 :         em2.fillMap(1, 50 * EeV, Vector3d(0.0, 1.0, 0.0));
+     957           1 :         em2.fillMap(2, 50 * EeV, Vector3d(0.0, 1.0, 0.0));
+     958             : 
+     959           1 :         em1.merge(&em2);
+     960             : 
+     961           1 :         EXPECT_EQ(em1.getMaps().size(), 2);
+     962             : 
+     963           1 :         ref_ptr<CylindricalProjectionMap> cpm = em1.getMap(1, 50 * EeV);
+     964           1 :         size_t bin = cpm->binFromDirection(Vector3d(0.0, 1.0, 0.0));
+     965           1 :         EXPECT_TRUE(cpm->getPdf()[bin] > 0);
+     966           1 : }
+     967             : 
+     968           1 : TEST(Variant, copyToBuffer) {
+     969           1 :         double a = 23.42;
+     970             :         Variant v(a);
+     971             :         double b;
+     972           1 :         v.copyToBuffer(&b);
+     973           1 :         EXPECT_EQ(a, b);
+     974           1 : }
+     975             : 
+     976           1 : TEST(Variant, stringConversion) {
+     977           1 :         Variant v, w;
+     978             :         {
+     979           1 :                 int32_t a = 12;
+     980           1 :                 v = Variant::fromInt32(a);
+     981           1 :                 EXPECT_EQ(a, v.asInt32());
+     982             : 
+     983           1 :                 w = Variant::fromString(v.toString(), v.getType());
+     984           1 :                 EXPECT_EQ(a, w.asInt32());
+     985             :         }
+     986             : 
+     987             :         {
+     988           1 :                 int64_t a = 12;
+     989           1 :                 v = Variant::fromInt64(a);
+     990           1 :                 EXPECT_EQ(a, v.asInt64());
+     991             : 
+     992           1 :                 w = Variant::fromString(v.toString(), v.getType());
+     993           1 :                 EXPECT_EQ(a, w.asInt64());
+     994             :         }
+     995             : 
+     996             :         {
+     997             :                 Vector3d a(1, 2, 3);
+     998             :                 Variant v = Variant::fromVector3d(a);
+     999             :                 Vector3d u = v.asVector3d();
+    1000           1 :                 EXPECT_EQ(a.getX(), u.getX());
+    1001           1 :                 EXPECT_EQ(a.getY(), u.getY());
+    1002           1 :                 EXPECT_EQ(a.getZ(), u.getZ());
+    1003           1 :         }
+    1004             : 
+    1005             :         {
+    1006           1 :                 std::complex<double> a1(1, 1);
+    1007           1 :                 std::complex<double> a2(2, 0);
+    1008             :                 Vector3<std::complex<double>> a(a1, a1, a2);
+    1009             :                 Variant v = Variant::fromVector3c(a);
+    1010             :                 Vector3<std::complex<double>> u = v.asVector3c();
+    1011           1 :                 EXPECT_EQ(a1, u.getX());
+    1012           1 :                 EXPECT_EQ(a1, u.getY());
+    1013           1 :                 EXPECT_EQ(a2, u.getZ());
+    1014           1 :         }
+    1015             : 
+    1016             :         {
+    1017             :                 std::complex<double> a(1, 2);
+    1018             :                 Variant v = Variant::fromComplexDouble(a);
+    1019           1 :                 std::complex<double> u = v.asComplexDouble();
+    1020           1 :                 EXPECT_EQ(u.real(), 1);
+    1021           1 :                 EXPECT_EQ(u.imag(), 2);
+    1022           1 :         }
+    1023             : 
+    1024             :         {
+    1025             :                 std::vector<Variant> a;
+    1026           1 :                 a.push_back(Variant::fromDouble(1));
+    1027           1 :                 a.push_back(Variant::fromDouble(2));
+    1028           1 :                 a.push_back(Variant::fromDouble(3));
+    1029           1 :                 a.push_back(Variant::fromDouble(4));
+    1030             :                 Variant v = Variant::fromVector(a);
+    1031           1 :                 std::vector<Variant> u = v.asVector();
+    1032           1 :                 EXPECT_EQ(a[0], Variant::fromDouble(u[0]));
+    1033           1 :                 EXPECT_EQ(a[1], Variant::fromDouble(u[1]));
+    1034           1 :                 EXPECT_EQ(a[2], Variant::fromDouble(u[2]));
+    1035           1 :                 EXPECT_EQ(a[3], Variant::fromDouble(u[3]));
+    1036           1 :         }
+    1037             : 
+    1038             : 
+    1039           1 : }
+    1040             : 
+    1041           2 : TEST(Geometry, Plane) {
+    1042           1 :         Plane p(Vector3d(0,0,1), Vector3d(0,0,1));
+    1043           1 :         EXPECT_DOUBLE_EQ(-1., p.distance(Vector3d(0, 0, 0)));
+    1044           1 :         EXPECT_DOUBLE_EQ(9., p.distance(Vector3d(1, 1, 10)));
+    1045           1 : }
+    1046             : 
+    1047           2 : TEST(Geometry, Sphere) {
+    1048           1 :         Sphere s(Vector3d(0,0,0), 1.);
+    1049           1 :         EXPECT_DOUBLE_EQ(-1., s.distance(Vector3d(0, 0, 0)));
+    1050           1 :         EXPECT_DOUBLE_EQ(9., s.distance(Vector3d(10, 0, 0)));
+    1051           1 : }
+    1052             : 
+    1053           2 : TEST(Geometry, ParaxialBox) {
+    1054           1 :         ParaxialBox b(Vector3d(0,0,0), Vector3d(3,4,5));
+    1055           1 :         EXPECT_NEAR(-.1, b.distance(Vector3d(0.1, 0.1, 0.1)), 1E-10);
+    1056           1 :         EXPECT_NEAR(-.1, b.distance(Vector3d(0.1, 3.8, 0.1)), 1E-10);
+    1057           1 :         EXPECT_NEAR(-.2, b.distance(Vector3d(0.9, 3.8, 0.9)), 1E-10);
+    1058           1 :         EXPECT_NEAR(7., b.distance(Vector3d(10., 0., 0.)), 1E-10);
+    1059           1 :         EXPECT_NEAR(7., b.distance(Vector3d(10., 2., 0.)), 1E-10);
+    1060           1 :         EXPECT_NEAR(8., b.distance(Vector3d(-8., 0., 0.)), 1E-10);
+    1061           1 : }
+    1062             : 
+    1063           0 : int main(int argc, char **argv) {
+    1064           0 :         ::testing::InitGoogleTest(&argc, argv);
+    1065           0 :         return RUN_ALL_TESTS();
+    1066             : }
+    1067             : 
+    1068             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testDensity.cpp.func-sort-c.html b/doc/coverageReport/test/testDensity.cpp.func-sort-c.html new file mode 100644 index 000000000..b1eb7ef54 --- /dev/null +++ b/doc/coverageReport/test/testDensity.cpp.func-sort-c.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testDensity.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testDensity.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:166166100.0 %
Date:2024-04-08 14:58:22Functions:77100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa31testDensityList_SimpleTest_Test8TestBodyEv1
_ZN7crpropa31testGridDensity_SimpleTest_Test8TestBodyEv1
_ZN7crpropa35testConstantDensity_SimpleTest_Test8TestBodyEv1
_ZN7crpropa36testGridDensity_testRetrunValue_Test8TestBodyEv1
_ZN7crpropa41testCordes_checkValueAtCertainPoints_Test8TestBodyEv1
_ZN7crpropa43testFerriere_checkValueAtCertainPoints_Test8TestBodyEv1
_ZN7crpropa44testNakanishi_checkValueAtCertainPoints_Test8TestBodyEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testDensity.cpp.func.html b/doc/coverageReport/test/testDensity.cpp.func.html new file mode 100644 index 000000000..337e954df --- /dev/null +++ b/doc/coverageReport/test/testDensity.cpp.func.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testDensity.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testDensity.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:166166100.0 %
Date:2024-04-08 14:58:22Functions:77100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa31testDensityList_SimpleTest_Test8TestBodyEv1
_ZN7crpropa31testGridDensity_SimpleTest_Test8TestBodyEv1
_ZN7crpropa35testConstantDensity_SimpleTest_Test8TestBodyEv1
_ZN7crpropa36testGridDensity_testRetrunValue_Test8TestBodyEv1
_ZN7crpropa41testCordes_checkValueAtCertainPoints_Test8TestBodyEv1
_ZN7crpropa43testFerriere_checkValueAtCertainPoints_Test8TestBodyEv1
_ZN7crpropa44testNakanishi_checkValueAtCertainPoints_Test8TestBodyEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testDensity.cpp.gcov.html b/doc/coverageReport/test/testDensity.cpp.gcov.html new file mode 100644 index 000000000..587a77d5d --- /dev/null +++ b/doc/coverageReport/test/testDensity.cpp.gcov.html @@ -0,0 +1,372 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testDensity.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testDensity.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:166166100.0 %
Date:2024-04-08 14:58:22Functions:77100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/massDistribution/Massdistribution.h"
+       2             : #include "crpropa/massDistribution/Cordes.h"
+       3             : #include "crpropa/massDistribution/Ferriere.h"
+       4             : #include "crpropa/massDistribution/Nakanishi.h"
+       5             : #include "crpropa/massDistribution/ConstantDensity.h"
+       6             : #include "crpropa/Units.h"
+       7             : #include "crpropa/Grid.h"
+       8             : 
+       9             : #include "gtest/gtest.h"
+      10             : 
+      11             : #include <stdexcept>
+      12             : #include <cmath>
+      13             : #include <string>
+      14             : 
+      15             : namespace crpropa {
+      16             : 
+      17           1 : TEST(testConstantDensity, SimpleTest) {
+      18             :         //test ConstantDensity in all types and in total density (output)
+      19           1 :         ConstantDensity n(2/ccm,3/ccm, 2/ccm);
+      20             :         Vector3d p(1*pc,2*pc,1*kpc);    // random position for testing density
+      21           1 :         EXPECT_DOUBLE_EQ(n.getHIDensity(p), 2e6);       // density output in m^-3
+      22           1 :         EXPECT_DOUBLE_EQ(n.getHIIDensity(p), 3e6);
+      23           1 :         EXPECT_DOUBLE_EQ( n.getH2Density(p), 2e6);
+      24           1 :         EXPECT_DOUBLE_EQ(n.getDensity(p), 7e6);         // total density 2+3+2 = 7 (/ccm)
+      25           1 :         EXPECT_DOUBLE_EQ(n.getNucleonDensity(p),9e6);   // nucleon density 2+3+2*2 = 9 (/ccm) factor 2 for molecular hydrogen
+      26             : 
+      27             :         //test set/get function for used type
+      28           1 :         bool useHI = n.getIsForHI();
+      29           1 :         bool useHII= n.getIsForHII();
+      30           1 :         bool useH2 = n.getIsForH2();
+      31             :         //check if all types are activited
+      32           1 :         EXPECT_TRUE(useHI);
+      33           1 :         EXPECT_TRUE(useHII);
+      34           1 :         EXPECT_TRUE(useH2);
+      35             : 
+      36             :         //set density number to 500
+      37           1 :         n.setHI(500.);
+      38           1 :         n.setHII(500.);
+      39           1 :         n.setH2(500.);
+      40             : 
+      41             :         //check if output is changed to 500 in types and is 0 (all deactivated) for Hges
+      42           1 :         EXPECT_DOUBLE_EQ(n.getHIDensity(p), 500.);
+      43           1 :         EXPECT_DOUBLE_EQ(n.getHIIDensity(p), 500.);
+      44           1 :         EXPECT_DOUBLE_EQ(n.getH2Density(p), 500.);
+      45             : 
+      46             :         //deactivate all
+      47           1 :         n.setHI(false);
+      48           1 :         n.setHII(false);
+      49           1 :         n.setH2(false);
+      50             : 
+      51             :         //check if all isfor are set to false
+      52           1 :         useHI = n.getIsForHI();
+      53           1 :         useHII= n.getIsForHII();
+      54           1 :         useH2 = n.getIsForH2();
+      55           1 :         EXPECT_FALSE(useHI);
+      56           1 :         EXPECT_FALSE(useHII);
+      57           1 :         EXPECT_FALSE(useH2);
+      58             : 
+      59             :         //get<type>Density is independent of type activation, getDensity is not independent
+      60             :         //check if getDensity returns 0. (should give a error message in log file)
+      61           1 :         ::testing::internal::CaptureStderr();
+      62           1 :         EXPECT_DOUBLE_EQ(n.getDensity(p), 0);
+      63           1 :         EXPECT_DOUBLE_EQ(n.getNucleonDensity(p),0);
+      64           1 :         std::string captured = testing::internal::GetCapturedStderr();
+      65           1 :         EXPECT_NE(captured.find("WARNING"), std::string::npos);
+      66           1 : }
+      67             : 
+      68             : 
+      69           2 : TEST(testDensityList, SimpleTest) {
+      70             : 
+      71             :         DensityList MS;
+      72           1 :         MS.addDensity(new ConstantDensity(1,1,2));      //sum 4
+      73           2 :         MS.addDensity(new ConstantDensity(2,3,1));      //sum 6
+      74             : 
+      75             :         Vector3d p(50*pc,10*pc,-30*pc); //random position for testing density
+      76           1 :         EXPECT_DOUBLE_EQ(MS.getHIDensity(p),3);
+      77           1 :         EXPECT_DOUBLE_EQ(MS.getHIIDensity(p),4);
+      78           1 :         EXPECT_DOUBLE_EQ(MS.getH2Density(p),3);
+      79           1 :         EXPECT_DOUBLE_EQ(MS.getDensity(p),10);  //sum of sums
+      80           1 :         EXPECT_DOUBLE_EQ(MS.getNucleonDensity(p),13);   // 3+4+2*3 factor 2 for molecular hydrogen
+      81             : 
+      82           1 : }
+      83             : 
+      84           2 : TEST(testCordes, checkValueAtCertainPoints) {
+      85             : 
+      86             :         Cordes n;
+      87             : 
+      88             :         //check type Information
+      89           1 :         EXPECT_FALSE(n.getIsForHI());
+      90           1 :         EXPECT_TRUE(n.getIsForHII());
+      91           1 :         EXPECT_FALSE(n.getIsForH2());
+      92             : 
+      93             :         Vector3d p(3.1*kpc,2.9*kpc,-30*pc);     //position for testing density
+      94             : 
+      95           1 :         EXPECT_NEAR(n.getHIIDensity(p), 184500.,1);     // output in m^-3 ; uncertainty of 1e-6 cm^-3
+      96           1 :         EXPECT_NEAR(n.getDensity(p), 184500.,1);
+      97           1 :         EXPECT_NEAR(n.getNucleonDensity(p), 184500,1);  // only HII component -> no differenz between density and nucleon density
+      98           1 :         p.z=30*pc;                      // invariant density for +/- z
+      99           1 :         EXPECT_NEAR(n.getDensity(p),184500,1);
+     100             : 
+     101           1 : }
+     102             : 
+     103           2 : TEST(testNakanishi, checkValueAtCertainPoints) {
+     104             : 
+     105             :         Nakanishi n;
+     106             : 
+     107             :         //check type Information
+     108           1 :         EXPECT_TRUE(n.getIsForHI());
+     109           1 :         EXPECT_FALSE(n.getIsForHII());
+     110           1 :         EXPECT_TRUE(n.getIsForH2());
+     111             : 
+     112             :         //first position for testing density
+     113             :         Vector3d p(4*kpc,-2.5*kpc,-0.85*kpc);
+     114             : 
+     115             :         //testing HI component
+     116           1 :         EXPECT_NEAR(n.getHIPlanedensity(p),162597,1);   //uncertaincy of 1e-6 cm^-3
+     117           1 :         EXPECT_NEAR(n.getHIScaleheight(p),0.3109*kpc,0.1*pc);
+     118           1 :         EXPECT_NEAR(n.getHIDensity(p),914,1);   //uncertainc 1e-6 cm^-3
+     119             : 
+     120             :         //testing H2 compontent
+     121           1 :         EXPECT_NEAR(n.getH2Planedensity(p),741999,1); //uncertaincy of 1e-6 cm^-3
+     122           1 :         EXPECT_NEAR(n.getH2Scaleheight(p),88.2*pc,0.1*pc);
+     123           1 :         EXPECT_NEAR(n.getH2Density(p),0,1);
+     124             : 
+     125             :         //testing total Density
+     126           1 :         EXPECT_NEAR(n.getDensity(p),914,2); //double uncertaincy for both type á 1cm^-3
+     127           1 :         EXPECT_NEAR(n.getNucleonDensity(p),914,2);      // 914 + 0*2    factor 2 for molecular hydrogen
+     128             : 
+     129             :         //second position for testing density
+     130             :         p = Vector3d(50*pc,100*pc,10*pc);
+     131             : 
+     132             :         //testing HI component
+     133           1 :         EXPECT_NEAR(n.getHIPlanedensity(p),543249,1);
+     134           1 :         EXPECT_NEAR(n.getHIScaleheight(p),125.6*pc,0.1*pc);
+     135           1 :         EXPECT_NEAR(n.getHIDensity(p),540867,1);
+     136             : 
+     137             :         //testing H2 component
+     138           1 :         EXPECT_NEAR(n.getH2Planedensity(p),10556748,1);
+     139           1 :         EXPECT_NEAR(n.getH2Scaleheight(p),57.2*pc,0.1*pc);
+     140           1 :         EXPECT_NEAR(n.getH2Density(p),10335137,1);
+     141             : 
+     142             :         //testing total Density
+     143           1 :         EXPECT_NEAR(n.getDensity(p),10876004,2);
+     144           1 :         EXPECT_NEAR(n.getNucleonDensity(p),21211141,2); // factor 2 in molecular hydrogen
+     145             : 
+     146             :         //test set type function
+     147           1 :         n.setIsForHI(false);
+     148           1 :         EXPECT_FALSE(n.getIsForHI());
+     149           1 :         EXPECT_TRUE(n.getIsForH2());
+     150             : 
+     151           1 :         n.setIsForH2(false);
+     152           1 :         EXPECT_FALSE(n.getIsForHI());
+     153           1 :         EXPECT_FALSE(n.getIsForH2());
+     154             : 
+     155             :         //check if density output is zero if all density-types are deaktivated (should give warning in log-file)
+     156           1 :         ::testing::internal::CaptureStderr();
+     157           1 :         EXPECT_DOUBLE_EQ(n.getDensity(p),0);
+     158           1 :         EXPECT_DOUBLE_EQ(n.getNucleonDensity(p),0);
+     159           1 :         std::string captured = testing::internal::GetCapturedStderr();
+     160           1 :         EXPECT_NE(captured.find("WARNING"), std::string::npos);
+     161             : 
+     162           1 : }
+     163             : 
+     164           1 : TEST(testFerriere, checkValueAtCertainPoints) {
+     165           1 :         ::testing::internal::CaptureStderr();
+     166             :         Ferriere n;
+     167             : 
+     168             :         //check type information
+     169             : 
+     170           1 :         EXPECT_TRUE(n.getIsForHI());
+     171           1 :         EXPECT_TRUE(n.getIsForHII());
+     172           1 :         EXPECT_TRUE(n.getIsForH2());
+     173             : 
+     174             :         //testing density in inner Ring (R <= 3*kpc)
+     175             :         Vector3d p(60*pc,-60*pc,-20*pc);        //testing position in region of CMZ
+     176             : 
+     177             :         //test CMZ Trafo
+     178             :         Vector3d Trafo;
+     179           1 :         Trafo = n.CMZTransformation(p);
+     180           1 :         EXPECT_NEAR(Trafo.x,5.9767*pc,1e-4*pc);
+     181           1 :         EXPECT_NEAR(Trafo.y,12.8171*pc,1e-4*pc);
+     182           1 :         EXPECT_DOUBLE_EQ(Trafo.z,p.z);  //no transformation in z component
+     183             : 
+     184             :         //test DISK Trafo
+     185           1 :         Trafo = n.DiskTransformation(p);
+     186           1 :         EXPECT_NEAR(Trafo.x,11.0660*pc,1e-4*pc);
+     187           1 :         EXPECT_NEAR(Trafo.y,82.5860*pc,1e-4*pc);
+     188           1 :         EXPECT_NEAR(Trafo.z,-25.6338*pc,1e-4*pc);
+     189             : 
+     190             :         //testing density
+     191           1 :         EXPECT_NEAR(n.getHIDensity(p),6237723,1);       //uncertaincy 1e-6 cm^-3
+     192           1 :         EXPECT_NEAR(n.getH2Density(p),35484825,1);
+     193           1 :         EXPECT_NEAR(n.getHIIDensity(p),6243793,1);
+     194           1 :         EXPECT_NEAR(n.getDensity(p),47966341,1);
+     195           1 :         EXPECT_NEAR(n.getNucleonDensity(p),83451166,2);         //factor 2 in molecular hydrogen; double uncertaincy
+     196             : 
+     197             :         Vector3d p2(-500*pc,-900*pc,35*pc);     //testing position in region of the DISK
+     198           1 :         EXPECT_NEAR(n.getHIIDensity(p2),48190,1);
+     199           1 :         EXPECT_NEAR(n.getHIDensity(p2),5,1);
+     200           1 :         EXPECT_NEAR(n.getH2Density(p2),0,1);
+     201           1 :         EXPECT_NEAR(n.getDensity(p2),48195,1);
+     202           1 :         EXPECT_NEAR(n.getNucleonDensity(p2),48195,1);   // no H2 component -> no difference between density and nucleon-density
+     203             : 
+     204             :         //testing the outer region R>3kpc
+     205             :         Vector3d p3(5*kpc,4*kpc,-29*pc);        //testing position with 3kpc < R < R_sun
+     206           1 :         EXPECT_NEAR(n.getHIDensity(p3),540607,1);
+     207           1 :         EXPECT_NEAR(n.getHIIDensity(p3),66495 ,1);
+     208           1 :         EXPECT_NEAR(n.getH2Density(p3),2492685,1);
+     209           1 :         EXPECT_NEAR(n.getDensity(p3),3099787,1);
+     210           1 :         EXPECT_NEAR(n.getNucleonDensity(p3), 5592472,1);
+     211             : 
+     212             :         Vector3d p4(10*kpc,2*kpc,50*pc);        //testing position with R > R_sun
+     213           1 :         EXPECT_NEAR(n.getHIDensity(p4),431294,1);
+     214           1 :         EXPECT_NEAR(n.getHIIDensity(p4),22109,1);
+     215           1 :         EXPECT_NEAR(n.getH2Density(p4),54099,1);
+     216           1 :         EXPECT_NEAR(n.getDensity(p4),507502,1);
+     217           1 :         EXPECT_NEAR(n.getNucleonDensity(p4),561601,1);
+     218             : 
+     219             :         //test get/set type function
+     220           1 :         n.setIsForHI(false);
+     221           1 :         EXPECT_FALSE(n.getIsForHI());
+     222           1 :         EXPECT_TRUE(n.getIsForHII());
+     223           1 :         EXPECT_TRUE(n.getIsForH2());
+     224             : 
+     225           1 :         n.setIsForHII(false);
+     226           1 :         EXPECT_FALSE(n.getIsForHI());
+     227           1 :         EXPECT_FALSE(n.getIsForHII());
+     228           1 :         EXPECT_TRUE(n.getIsForH2());
+     229             : 
+     230           1 :         n.setIsForH2(false);
+     231           1 :         EXPECT_FALSE(n.getIsForHI());
+     232           1 :         EXPECT_FALSE(n.getIsForHII());
+     233           1 :         EXPECT_FALSE(n.getIsForH2());
+     234             : 
+     235             :         //check if density is set to zero if all types are deactivated (should give warning in log-file)
+     236           1 :         EXPECT_DOUBLE_EQ(n.getDensity(p),0);
+     237           1 :         EXPECT_DOUBLE_EQ(n.getNucleonDensity(p),0);
+     238           1 :         std::string captured = testing::internal::GetCapturedStderr();
+     239           1 :         EXPECT_NE(captured.find("WARNING"), std::string::npos);
+     240           1 : }
+     241             : 
+     242           2 : TEST(testGridDensity, SimpleTest) {
+     243           1 :         ref_ptr<Grid1f> grid = new Grid1f(Vector3d(0.), 1, 1, 1, 1.);     
+     244           1 :         DensityGrid dens = DensityGrid(grid, true, false, false);
+     245             : 
+     246             :         // check active types
+     247           1 :         EXPECT_TRUE(dens.getIsForHI()); 
+     248           1 :         EXPECT_FALSE(dens.getIsForHII());
+     249           1 :         EXPECT_FALSE(dens.getIsForH2());
+     250             : 
+     251             :         // check set function
+     252           1 :         dens.setIsForH2(true);
+     253           1 :         EXPECT_TRUE(dens.getIsForH2());
+     254             : 
+     255           1 :         dens.setIsForHII(true);
+     256           1 :         EXPECT_TRUE(dens.getIsForHII());
+     257             : 
+     258           1 :         dens.setIsForHI(false);
+     259           1 :         EXPECT_FALSE(dens.getIsForHI());
+     260           1 : }
+     261             : 
+     262           2 : TEST(testGridDensity, testRetrunValue) {
+     263             :         size_t Nx = 5;
+     264             :         size_t Ny = 8;
+     265             :         size_t Nz = 10;
+     266             :         double spacing = 2.0;
+     267             :         Vector3d origin(1., 2., 3.);
+     268             : 
+     269           1 :         ref_ptr<Grid1f> grid = new Grid1f(origin, Nx, Ny, Nz, spacing);
+     270             : 
+     271             :         // set some values for the grid
+     272           1 :         grid->get(3, 2, 4) = 5;
+     273           1 :         grid->get(3, 2, 5) = 12;
+     274           1 :         grid->get(2, 3, 4) = 6;
+     275             : 
+     276           2 :         DensityGrid dens = DensityGrid(grid, true, false, false);
+     277             : 
+     278             :         // a point in the region where values are defined for the grid.
+     279             :         Vector3d position = origin + Vector3d(2.2, 2.8, 4.1) * spacing; 
+     280           1 :         double valueFromGrid =  grid->interpolate(position);
+     281           1 :         double nHI = dens.getHIDensity(position);
+     282           1 :         double nHII = dens.getHIIDensity(position);
+     283           1 :         double nH2 = dens.getH2Density(position);
+     284           1 :         double nNucleon = dens.getNucleonDensity(position);
+     285           1 :         double nTotal = dens.getDensity(position);
+     286             : 
+     287             :         // Check for values
+     288           1 :         EXPECT_DOUBLE_EQ(valueFromGrid, nHI);
+     289           1 :         EXPECT_DOUBLE_EQ(nHII, 0);      // HII is set to false and should be 0
+     290           1 :         EXPECT_DOUBLE_EQ(nH2, 0);       // H2 is set to false and should be 0
+     291           1 :         EXPECT_DOUBLE_EQ(nNucleon, valueFromGrid);
+     292           1 :         EXPECT_DOUBLE_EQ(nTotal, valueFromGrid);
+     293           1 : }
+     294             : 
+     295             : 
+     296             : } //namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testFunctionalGroups.cpp.func-sort-c.html b/doc/coverageReport/test/testFunctionalGroups.cpp.func-sort-c.html new file mode 100644 index 000000000..1eaa671c2 --- /dev/null +++ b/doc/coverageReport/test/testFunctionalGroups.cpp.func-sort-c.html @@ -0,0 +1,80 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testFunctionalGroups.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testFunctionalGroups.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:202387.0 %
Date:2024-04-08 14:58:22Functions:1250.0 %
+
+ +
+ + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa4mainEiPPc0
_ZN7crpropa36testFunctionalGroups_gyroradius_Test8TestBodyEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testFunctionalGroups.cpp.func.html b/doc/coverageReport/test/testFunctionalGroups.cpp.func.html new file mode 100644 index 000000000..24b5d5269 --- /dev/null +++ b/doc/coverageReport/test/testFunctionalGroups.cpp.func.html @@ -0,0 +1,80 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testFunctionalGroups.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testFunctionalGroups.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:202387.0 %
Date:2024-04-08 14:58:22Functions:1250.0 %
+
+ +
+ + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa36testFunctionalGroups_gyroradius_Test8TestBodyEv1
_ZN7crpropa4mainEiPPc0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testFunctionalGroups.cpp.gcov.html b/doc/coverageReport/test/testFunctionalGroups.cpp.gcov.html new file mode 100644 index 000000000..e6bdc1708 --- /dev/null +++ b/doc/coverageReport/test/testFunctionalGroups.cpp.gcov.html @@ -0,0 +1,126 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testFunctionalGroups.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testFunctionalGroups.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:202387.0 %
Date:2024-04-08 14:58:22Functions:1250.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "CRPropa.h"
+       2             : #include "gtest/gtest.h"
+       3             : 
+       4             : namespace crpropa {
+       5             : 
+       6             : /*
+       7             :  * Functional test which calculates the particle's gyroradius in a uniform field
+       8             :  * r_g = R / (B*c) = 1 EV / (1 nG * c) \approx 1.08*Mpc
+       9             :  */
+      10           2 : TEST(testFunctionalGroups, gyroradius) {
+      11             :         double energy = 1*EeV;
+      12             :         double field = 1*nG;
+      13             : 
+      14           1 :         ParticleState p;
+      15           1 :         p.setId(nucleusId(1, 1));
+      16           1 :         p.setEnergy(energy);
+      17           1 :         p.setPosition(Vector3d(0, 0, 0));
+      18           1 :         p.setDirection(Vector3d(0, 0, 1));
+      19             : 
+      20           1 :         ref_ptr<Candidate> c = new Candidate(p);
+      21           1 :         ref_ptr<PropagationCK> propa = new PropagationCK(new UniformMagneticField(Vector3d(field, 0, 0)));
+      22           1 :         ref_ptr<ParticleCollector> collector = new ParticleCollector();
+      23           1 :         collector->setClone(true);
+      24           1 :         ref_ptr<ModuleList> sim = new ModuleList();
+      25             : 
+      26             :         Vector3d pos;
+      27             :         double max_y = 0;
+      28             : 
+      29           1 :         sim->add(propa);
+      30           1 :         sim->add(new MaximumTrajectoryLength(10*Mpc));
+      31           1 :         sim->add(collector);
+      32             : 
+      33           1 :         sim->run(c);
+      34             : 
+      35          16 :         for (ParticleCollector::iterator itr = collector->begin(); itr != collector->end(); ++itr){
+      36          15 :                 pos = (*(itr->get())).current.getPosition();
+      37          15 :                 if (max_y < pos.getY())
+      38             :                         max_y = pos.getY();
+      39             :         }
+      40             : 
+      41           1 :         EXPECT_NEAR(max_y/2.0, energy/(field * c_light * eplus), 0.01*Mpc);
+      42             : 
+      43           1 : }
+      44             : 
+      45           0 : int main(int argc, char **argv) {
+      46           0 :         ::testing::InitGoogleTest(&argc, argv);
+      47           0 :         return RUN_ALL_TESTS();
+      48             : }
+      49             : 
+      50             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testInteraction.cpp.func-sort-c.html b/doc/coverageReport/test/testInteraction.cpp.func-sort-c.html new file mode 100644 index 000000000..e28ec63a0 --- /dev/null +++ b/doc/coverageReport/test/testInteraction.cpp.func-sort-c.html @@ -0,0 +1,284 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testInteraction.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testInteraction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:74378794.4 %
Date:2024-04-08 14:58:22Functions:525398.1 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa4mainEiPPc0
_ZN7crpropa24Redshift_simpleTest_Test8TestBodyEv1
_ZN7crpropa25NuclearDecay_helium5_Test8TestBodyEv1
_ZN7crpropa26NuclearDecay_lithium4_Test8TestBodyEv1
_ZN7crpropa28NuclearDecay_scandium44_Test8TestBodyEv1
_ZN7crpropa29NuclearDecay_secondaries_Test8TestBodyEv1
_ZN7crpropa29PhotoDisintegration_iron_Test8TestBodyEv1
_ZN7crpropa31NuclearDecay_limitNextStep_Test8TestBodyEv1
_ZN7crpropa31PhotoDisintegration_carbon_Test8TestBodyEv1
_ZN7crpropa31PhotoPionProduction_helium_Test8TestBodyEv1
_ZN7crpropa31PhotoPionProduction_proton_Test8TestBodyEv1
_ZN7crpropa32NuclearDecay_interactionTag_Test8TestBodyEv1
_ZN7crpropa33EMPairProduction_secondaries_Test8TestBodyEv1
_ZN7crpropa33PhotoPionProduction_sampling_Test8TestBodyEv1
_ZN7crpropa34ElasticScattering_secondaries_Test8TestBodyEv1
_ZN7crpropa35EMPairProduction_limitNextStep_Test8TestBodyEv1
_ZN7crpropa35Redshift_limitRedshiftDecrease_Test8TestBodyEv1
_ZN7crpropa36EMPairProduction_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa36EMPairProduction_interactionTag_Test8TestBodyEv1
_ZN7crpropa36NuclearDecay_allChannelsWorking_Test8TestBodyEv1
_ZN7crpropa36NuclearDecay_thisIsNotNucleonic_Test8TestBodyEv1
_ZN7crpropa36PhotoDisintegration_allIsotopes_Test8TestBodyEv1
_ZN7crpropa36PhotoPionProduction_secondaries_Test8TestBodyEv1
_ZN7crpropa37ElasticScattering_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa37ElectronPairProduction_valuesCMB_Test8TestBodyEv1
_ZN7crpropa37ElectronPairProduction_valuesIRB_Test8TestBodyEv1
_ZN7crpropa38PhotoDisintegration_limitNextStep_Test8TestBodyEv1
_ZN7crpropa38PhotoPionProduction_limitNextStep_Test8TestBodyEv1
_ZN7crpropa39EMDoublePairProduction_secondaries_Test8TestBodyEv1
_ZN7crpropa39PhotoDisintegration_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa39PhotoDisintegration_interactionTag_Test8TestBodyEv1
_ZN7crpropa39PhotoPionProduction_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa39PhotoPionProduction_interactionTag_Test8TestBodyEv1
_ZN7crpropa40EMTripletPairProduction_secondaries_Test8TestBodyEv1
_ZN7crpropa40SynchrotronRadiation_interactionTag_Test8TestBodyEv1
_ZN7crpropa41EMDoublePairProduction_limitNextStep_Test8TestBodyEv1
_ZN7crpropa42EMDoublePairProduction_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa42EMDoublePairProduction_interactionTag_Test8TestBodyEv1
_ZN7crpropa42EMTripletPairProduction_limitNextStep_Test8TestBodyEv1
_ZN7crpropa42ElectronPairProduction_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa42ElectronPairProduction_interactionTag_Test8TestBodyEv1
_ZN7crpropa43EMInverseComptonScattering_secondaries_Test8TestBodyEv1
_ZN7crpropa43EMTripletPairProduction_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa43EMTripletPairProduction_interactionTag_Test8TestBodyEv1
_ZN7crpropa43PhotoDisintegration_thisIsNotNucleonic_Test8TestBodyEv1
_ZN7crpropa43PhotoPionProduction_thisIsNotNucleonic_Test8TestBodyEv1
_ZN7crpropa44ElectronPairProduction_energyDecreasing_Test8TestBodyEv1
_ZN7crpropa45EMInverseComptonScattering_limitNextStep_Test8TestBodyEv1
_ZN7crpropa46EMInverseComptonScattering_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa46EMInverseComptonScattering_interactionTag_Test8TestBodyEv1
_ZN7crpropa46ElectronPairProduction_thisIsNotNucleonic_Test8TestBodyEv1
_ZN7crpropa47ElectronPairProduction_belowEnergyTreshold_Test8TestBodyEv1
_ZN7crpropa55Photodisintegration_updateParticleParentProperties_Test8TestBodyEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testInteraction.cpp.func.html b/doc/coverageReport/test/testInteraction.cpp.func.html new file mode 100644 index 000000000..ded452dfc --- /dev/null +++ b/doc/coverageReport/test/testInteraction.cpp.func.html @@ -0,0 +1,284 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testInteraction.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testInteraction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:74378794.4 %
Date:2024-04-08 14:58:22Functions:525398.1 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa24Redshift_simpleTest_Test8TestBodyEv1
_ZN7crpropa25NuclearDecay_helium5_Test8TestBodyEv1
_ZN7crpropa26NuclearDecay_lithium4_Test8TestBodyEv1
_ZN7crpropa28NuclearDecay_scandium44_Test8TestBodyEv1
_ZN7crpropa29NuclearDecay_secondaries_Test8TestBodyEv1
_ZN7crpropa29PhotoDisintegration_iron_Test8TestBodyEv1
_ZN7crpropa31NuclearDecay_limitNextStep_Test8TestBodyEv1
_ZN7crpropa31PhotoDisintegration_carbon_Test8TestBodyEv1
_ZN7crpropa31PhotoPionProduction_helium_Test8TestBodyEv1
_ZN7crpropa31PhotoPionProduction_proton_Test8TestBodyEv1
_ZN7crpropa32NuclearDecay_interactionTag_Test8TestBodyEv1
_ZN7crpropa33EMPairProduction_secondaries_Test8TestBodyEv1
_ZN7crpropa33PhotoPionProduction_sampling_Test8TestBodyEv1
_ZN7crpropa34ElasticScattering_secondaries_Test8TestBodyEv1
_ZN7crpropa35EMPairProduction_limitNextStep_Test8TestBodyEv1
_ZN7crpropa35Redshift_limitRedshiftDecrease_Test8TestBodyEv1
_ZN7crpropa36EMPairProduction_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa36EMPairProduction_interactionTag_Test8TestBodyEv1
_ZN7crpropa36NuclearDecay_allChannelsWorking_Test8TestBodyEv1
_ZN7crpropa36NuclearDecay_thisIsNotNucleonic_Test8TestBodyEv1
_ZN7crpropa36PhotoDisintegration_allIsotopes_Test8TestBodyEv1
_ZN7crpropa36PhotoPionProduction_secondaries_Test8TestBodyEv1
_ZN7crpropa37ElasticScattering_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa37ElectronPairProduction_valuesCMB_Test8TestBodyEv1
_ZN7crpropa37ElectronPairProduction_valuesIRB_Test8TestBodyEv1
_ZN7crpropa38PhotoDisintegration_limitNextStep_Test8TestBodyEv1
_ZN7crpropa38PhotoPionProduction_limitNextStep_Test8TestBodyEv1
_ZN7crpropa39EMDoublePairProduction_secondaries_Test8TestBodyEv1
_ZN7crpropa39PhotoDisintegration_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa39PhotoDisintegration_interactionTag_Test8TestBodyEv1
_ZN7crpropa39PhotoPionProduction_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa39PhotoPionProduction_interactionTag_Test8TestBodyEv1
_ZN7crpropa40EMTripletPairProduction_secondaries_Test8TestBodyEv1
_ZN7crpropa40SynchrotronRadiation_interactionTag_Test8TestBodyEv1
_ZN7crpropa41EMDoublePairProduction_limitNextStep_Test8TestBodyEv1
_ZN7crpropa42EMDoublePairProduction_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa42EMDoublePairProduction_interactionTag_Test8TestBodyEv1
_ZN7crpropa42EMTripletPairProduction_limitNextStep_Test8TestBodyEv1
_ZN7crpropa42ElectronPairProduction_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa42ElectronPairProduction_interactionTag_Test8TestBodyEv1
_ZN7crpropa43EMInverseComptonScattering_secondaries_Test8TestBodyEv1
_ZN7crpropa43EMTripletPairProduction_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa43EMTripletPairProduction_interactionTag_Test8TestBodyEv1
_ZN7crpropa43PhotoDisintegration_thisIsNotNucleonic_Test8TestBodyEv1
_ZN7crpropa43PhotoPionProduction_thisIsNotNucleonic_Test8TestBodyEv1
_ZN7crpropa44ElectronPairProduction_energyDecreasing_Test8TestBodyEv1
_ZN7crpropa45EMInverseComptonScattering_limitNextStep_Test8TestBodyEv1
_ZN7crpropa46EMInverseComptonScattering_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa46EMInverseComptonScattering_interactionTag_Test8TestBodyEv1
_ZN7crpropa46ElectronPairProduction_thisIsNotNucleonic_Test8TestBodyEv1
_ZN7crpropa47ElectronPairProduction_belowEnergyTreshold_Test8TestBodyEv1
_ZN7crpropa4mainEiPPc0
_ZN7crpropa55Photodisintegration_updateParticleParentProperties_Test8TestBodyEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testInteraction.cpp.gcov.html b/doc/coverageReport/test/testInteraction.cpp.gcov.html new file mode 100644 index 000000000..a903e964c --- /dev/null +++ b/doc/coverageReport/test/testInteraction.cpp.gcov.html @@ -0,0 +1,1229 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testInteraction.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testInteraction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:74378794.4 %
Date:2024-04-08 14:58:22Functions:525398.1 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/Candidate.h"
+       2             : #include "crpropa/Units.h"
+       3             : #include "crpropa/ParticleID.h"
+       4             : #include "crpropa/PhotonBackground.h"
+       5             : #include "crpropa/module/ElectronPairProduction.h"
+       6             : #include "crpropa/module/NuclearDecay.h"
+       7             : #include "crpropa/module/PhotoDisintegration.h"
+       8             : #include "crpropa/module/ElasticScattering.h"
+       9             : #include "crpropa/module/PhotoPionProduction.h"
+      10             : #include "crpropa/module/Redshift.h"
+      11             : #include "crpropa/module/EMPairProduction.h"
+      12             : #include "crpropa/module/EMDoublePairProduction.h"
+      13             : #include "crpropa/module/EMTripletPairProduction.h"
+      14             : #include "crpropa/module/EMInverseComptonScattering.h"
+      15             : #include "crpropa/module/SynchrotronRadiation.h"
+      16             : #include "gtest/gtest.h"
+      17             : 
+      18             : #include <fstream>
+      19             : 
+      20             : namespace crpropa {
+      21             : 
+      22             : // ElectronPairProduction -----------------------------------------------------
+      23           1 : TEST(ElectronPairProduction, allBackgrounds) {
+      24             :         // Test if interaction data files are loaded.
+      25           1 :         ref_ptr<PhotonField> cmb = new CMB();
+      26           1 :         ElectronPairProduction epp(cmb);
+      27           1 :         ref_ptr<PhotonField> irb = new IRB_Kneiske04();
+      28           1 :         epp.setPhotonField(irb);
+      29           2 :         irb = new IRB_Stecker05();
+      30           1 :         epp.setPhotonField(irb);
+      31           2 :         irb = new IRB_Franceschini08();
+      32           1 :         epp.setPhotonField(irb);
+      33           2 :         irb = new IRB_Finke10();
+      34           1 :         epp.setPhotonField(irb);
+      35           2 :         irb = new IRB_Dominguez11();
+      36           1 :         epp.setPhotonField(irb);
+      37           2 :         irb = new IRB_Gilmore12();
+      38           1 :         epp.setPhotonField(irb);
+      39           2 :         irb = new IRB_Stecker16_upper();
+      40           1 :         epp.setPhotonField(irb);
+      41           2 :         irb = new IRB_Stecker16_lower();
+      42           1 :         epp.setPhotonField(irb);
+      43           2 :     irb = new IRB_Finke22();
+      44           2 :         epp.setPhotonField(irb);
+      45           2 : }
+      46             : 
+      47           1 : TEST(ElectronPairProduction, energyDecreasing) {
+      48             :         // Test if energy loss occurs for protons with energies from 1e15 - 1e23 eV.
+      49           1 :         Candidate c;
+      50           1 :         c.setCurrentStep(2 * Mpc);
+      51           1 :         c.current.setId(nucleusId(1, 1)); // proton
+      52             : 
+      53           1 :         ref_ptr<PhotonField> cmb = new CMB();
+      54           1 :         ElectronPairProduction epp1(cmb);
+      55          81 :         for (int i = 0; i < 80; i++) {
+      56          80 :                 double E = pow(10, 15 + i * 0.1) * eV;
+      57          80 :                 c.current.setEnergy(E);
+      58          80 :                 epp1.process(&c);
+      59          80 :                 EXPECT_LE(c.current.getEnergy(), E);
+      60             :         }
+      61             : 
+      62           1 :         ref_ptr<PhotonField> irb = new IRB_Kneiske04();
+      63           2 :         ElectronPairProduction epp2(irb);
+      64          81 :         for (int i = 0; i < 80; i++) {
+      65          80 :                 double E = pow(10, 15 + i * 0.1) * eV;
+      66          80 :                 c.current.setEnergy(E);
+      67          80 :                 epp2.process(&c);
+      68          80 :                 EXPECT_LE(c.current.getEnergy(), E);
+      69             :         }
+      70           2 : }
+      71             : 
+      72           1 : TEST(ElectronPairProduction, belowEnergyTreshold) {
+      73             :         // Test if nothing happens below 1e15 eV.
+      74           1 :         ref_ptr<PhotonField> cmb = new CMB();
+      75           1 :         ElectronPairProduction epp(cmb);
+      76           1 :         Candidate c(nucleusId(1, 1), 1E14 * eV);
+      77           1 :         epp.process(&c);
+      78           1 :         EXPECT_DOUBLE_EQ(1E14 * eV, c.current.getEnergy());
+      79           2 : }
+      80             : 
+      81           1 : TEST(ElectronPairProduction, thisIsNotNucleonic) {
+      82             :         // Test if non-nuclei are skipped.
+      83           1 :         ref_ptr<PhotonField> cmb = new CMB();
+      84           1 :         ElectronPairProduction epp(cmb);
+      85           1 :         Candidate c(11, 1E20 * eV);  // electron
+      86           1 :         epp.process(&c);
+      87           1 :         EXPECT_DOUBLE_EQ(1E20 * eV, c.current.getEnergy());
+      88           2 : }
+      89             : 
+      90           2 : TEST(ElectronPairProduction, valuesCMB) {
+      91             :         // Test if energy loss corresponds to the data table.
+      92             :         std::vector<double> x;
+      93             :         std::vector<double> y;
+      94           2 :         std::ifstream infile(getDataPath("pair_CMB.txt").c_str());
+      95           1 :         while (infile.good()) {
+      96           0 :                 if (infile.peek() != '#') {
+      97             :                         double a, b;
+      98             :                         infile >> a >> b;
+      99           0 :                         if (infile) {
+     100           0 :                                 x.push_back(a * eV);
+     101           0 :                                 y.push_back(b * eV / Mpc);
+     102             :                         }
+     103             :                 }
+     104           0 :                 infile.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
+     105             :         }
+     106           1 :         infile.close();
+     107             : 
+     108           1 :         Candidate c;
+     109           1 :         c.setCurrentStep(1 * Mpc);
+     110           1 :         c.current.setId(nucleusId(1, 1)); // proton
+     111           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     112             : 
+     113           1 :         ElectronPairProduction epp(cmb);
+     114           1 :         for (int i = 0; i < x.size(); i++) {
+     115           0 :                 c.current.setEnergy(x[i]);
+     116           0 :                 epp.process(&c);
+     117           0 :                 double dE = x[i] - c.current.getEnergy();
+     118           0 :                 double dE_table = y[i] * 1 * Mpc;
+     119           0 :                 EXPECT_NEAR(dE_table, dE, 1e-12);
+     120             :         }
+     121           3 : }
+     122             : 
+     123           1 : TEST(ElectronPairProduction, interactionTag) {
+     124             :         
+     125           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     126           0 :         ElectronPairProduction epp(cmb);
+     127             :         
+     128             :         // test the default interaction tag
+     129           2 :         EXPECT_TRUE(epp.getInteractionTag() == "EPP");
+     130             : 
+     131             :         // test changing the interaction tag
+     132           1 :         epp.setInteractionTag("myTag");
+     133           2 :         EXPECT_TRUE(epp.getInteractionTag() == "myTag");
+     134             : 
+     135             :         // test the tag of produced secondaries
+     136           2 :         Candidate c;
+     137           1 :         c.setCurrentStep(1 * Gpc);
+     138           1 :         c.current.setId(nucleusId(1,1));
+     139           1 :         c.current.setEnergy(100 * EeV);
+     140           1 :         epp.setHaveElectrons(true);
+     141           1 :         epp.process(&c);
+     142             :         
+     143           1 :         std::string secondaryTag = c.secondaries[0] -> getTagOrigin();
+     144           1 :         EXPECT_TRUE(secondaryTag == "myTag");
+     145           2 : }
+     146             : 
+     147           2 : TEST(ElectronPairProduction, valuesIRB) {
+     148             :         // Test if energy loss corresponds to the data table.
+     149             :         std::vector<double> x;
+     150             :         std::vector<double> y;
+     151           2 :         std::ifstream infile(getDataPath("pairIRB.txt").c_str());
+     152           1 :         while (infile.good()) {
+     153           0 :                 if (infile.peek() != '#') {
+     154             :                         double a, b;
+     155             :                         infile >> a >> b;
+     156           0 :                         if (infile) {
+     157           0 :                                 x.push_back(a * eV);
+     158           0 :                                 y.push_back(b * eV / Mpc);
+     159             :                         }
+     160             :                 }
+     161           0 :                 infile.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
+     162             :         }
+     163           1 :         infile.close();
+     164             : 
+     165           1 :         Candidate c;
+     166           1 :         c.setCurrentStep(1 * Mpc);
+     167           1 :         c.current.setId(nucleusId(1, 1)); // proton
+     168           1 :         ref_ptr<PhotonField> irb = new IRB_Kneiske04();
+     169             : 
+     170           1 :         ElectronPairProduction epp(irb);
+     171           1 :         for (int i = 0; i < x.size(); i++) {
+     172           0 :                 c.current.setEnergy(x[i]);
+     173           0 :                 epp.process(&c);
+     174           0 :                 double dE = x[i] - c.current.getEnergy();
+     175           0 :                 double dE_table = y[i] * 1 * Mpc;
+     176           0 :                 EXPECT_NEAR(dE, dE_table, 1e-12);
+     177             :         }
+     178           3 : }
+     179             : 
+     180             : // NuclearDecay ---------------------------------------------------------------
+     181           1 : TEST(NuclearDecay, scandium44) {
+     182             :         // Test beta+ decay of 44Sc to 44Ca.
+     183             :         // This test can stochastically fail.
+     184           1 :         NuclearDecay d(true, true);
+     185           1 :         Candidate c(nucleusId(44, 21), 1E18 * eV);
+     186           1 :         c.setCurrentStep(100 * Mpc);
+     187           1 :         double gamma = c.current.getLorentzFactor();
+     188           1 :         d.process(&c);
+     189             :         
+     190             :         // expected decay product: 44Ca
+     191           1 :         EXPECT_EQ(nucleusId(44, 20), c.current.getId());
+     192             : 
+     193             :         // expect Lorentz factor to be conserved
+     194           1 :         EXPECT_DOUBLE_EQ(gamma, c.current.getLorentzFactor());
+     195             :         
+     196             :         // expect at least two secondaries: positron + electron neutrino
+     197           1 :         EXPECT_GE(c.secondaries.size(), 2);
+     198           1 : }
+     199             : 
+     200           1 : TEST(NuclearDecay, lithium4) {
+     201             :         // Test proton dripping of Li-4 to He-3
+     202             :         // This test can stochastically fail
+     203           1 :         NuclearDecay d;
+     204           1 :         Candidate c(nucleusId(4, 3), 4 * EeV);
+     205           1 :         c.setCurrentStep(100 * Mpc);
+     206           1 :         d.process(&c);
+     207             :         
+     208             :         // expected decay product: He-3
+     209           1 :         EXPECT_EQ(nucleusId(3, 2), c.current.getId());
+     210             : 
+     211             :         // expected secondary: proton
+     212           1 :         EXPECT_EQ(1, c.secondaries.size());
+     213           2 :         Candidate c1 = *c.secondaries[0];
+     214           1 :         EXPECT_EQ(nucleusId(1, 1), c1.current.getId());
+     215           1 :         EXPECT_EQ(1 * EeV, c1.current.getEnergy());
+     216           1 : }
+     217             : 
+     218           1 : TEST(NuclearDecay, helium5) {
+     219             :         // Test neutron dripping of He-5 to He-4.
+     220             :         // This test can stochastically fail.
+     221           1 :         NuclearDecay d;
+     222           1 :         Candidate c(nucleusId(5, 2), 5 * EeV);
+     223           1 :         c.setCurrentStep(100 * Mpc);
+     224           1 :         d.process(&c);
+     225             : 
+     226             :         // expected primary: He-4
+     227           1 :         EXPECT_EQ(nucleusId(4, 2), c.current.getId());
+     228           1 :         EXPECT_EQ(4, c.current.getEnergy() / EeV);
+     229             :         
+     230             :         // expected secondary: neutron
+     231           2 :         Candidate c2 = *c.secondaries[0];
+     232           1 :         EXPECT_EQ(nucleusId(1, 0), c2.current.getId());
+     233           1 :         EXPECT_EQ(1, c2.current.getEnergy() / EeV);
+     234           1 : }
+     235             : 
+     236           1 : TEST(NuclearDecay, limitNextStep) {
+     237             :         // Test if next step is limited in case of a neutron.
+     238           1 :         NuclearDecay decay;
+     239           1 :         Candidate c(nucleusId(1, 0), 10 * EeV);
+     240           1 :         c.setNextStep(std::numeric_limits<double>::max());
+     241           1 :         decay.process(&c);
+     242           1 :         EXPECT_LT(c.getNextStep(), std::numeric_limits<double>::max());
+     243           1 : }
+     244             : 
+     245           1 : TEST(NuclearDecay, allChannelsWorking) {
+     246             :         // Test if all nuclear decays are working.
+     247           1 :         NuclearDecay d;
+     248           1 :         Candidate c;
+     249             : 
+     250           2 :         std::ifstream infile(getDataPath("nuclear_decay.txt").c_str());
+     251         951 :         while (infile.good()) {
+     252         950 :                 if (infile.peek() != '#') {
+     253             :                         int Z, N, channel, foo;
+     254         948 :                         infile >> Z >> N >> channel >> foo;
+     255         948 :                         c.current.setId(nucleusId(Z + N, Z));
+     256         948 :                         c.current.setEnergy(80 * EeV);
+     257         948 :                         d.performInteraction(&c, channel);
+     258             :                 }
+     259         950 :                 infile.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
+     260             :         }
+     261           1 :         infile.close();
+     262           1 : }
+     263             : 
+     264           1 : TEST(NuclearDecay, secondaries) {
+     265             :         // Test if all types of secondaries are produced.
+     266           1 :         NuclearDecay d;
+     267           1 :         d.setHaveElectrons(true);
+     268           1 :         d.setHaveNeutrinos(true);
+     269           1 :         d.setHavePhotons(true);
+     270           1 :         Candidate c;
+     271             : 
+     272             :         // He-8 --> Li-8 + e- + neutrino
+     273             :         // additional photon emitted with 84% probability
+     274             :         // --> expect at least 1 photon out of 10 decays
+     275          11 :         for (int i = 0; i < 10; ++i) {
+     276          10 :                 c.current.setId(nucleusId(8, 2));
+     277          10 :                 c.current.setEnergy(5 * EeV);
+     278          10 :                 d.performInteraction(&c, 10000);
+     279             :         }
+     280             : 
+     281             :         // count number of secondaries
+     282           1 :         size_t nElectrons = 0;
+     283           1 :         size_t nNeutrinos = 0;
+     284           1 :         size_t nPhotons = 0;
+     285             : 
+     286          30 :         for(size_t i = 0; i < c.secondaries.size(); ++i) {
+     287          29 :                 int id = (*c.secondaries[i]).current.getId();
+     288          29 :                 if (id == 22) nPhotons++;
+     289          29 :                 if (id == 11) nElectrons++;
+     290          29 :                 if (id == -12) nNeutrinos++;
+     291             :         }
+     292             : 
+     293           1 :         EXPECT_EQ(nElectrons, 10);
+     294           1 :         EXPECT_EQ(nNeutrinos, 10);
+     295           1 :         EXPECT_GE(nPhotons, 1);
+     296           1 : }
+     297             : 
+     298           1 : TEST(NuclearDecay, thisIsNotNucleonic) {
+     299             :         // Test if nothing happens to an electron
+     300           1 :         NuclearDecay decay;
+     301           1 :         Candidate c(11, 10 * EeV);
+     302           1 :         c.setNextStep(std::numeric_limits<double>::max());
+     303           1 :         decay.process(&c);
+     304           1 :         EXPECT_EQ(11, c.current.getId());
+     305           1 :         EXPECT_EQ(10 * EeV, c.current.getEnergy());
+     306           1 : }
+     307             : 
+     308           1 : TEST(NuclearDecay, interactionTag) {
+     309             :         // test default interaction tag
+     310           1 :         NuclearDecay decay;
+     311           2 :         EXPECT_TRUE(decay.getInteractionTag() == "ND");
+     312             : 
+     313             :         // test secondary tag
+     314           1 :         decay.setHaveElectrons(true);
+     315           2 :         Candidate c(nucleusId(8,2), 5 * EeV);
+     316           1 :         decay.performInteraction(&c, 10000);
+     317           3 :         EXPECT_TRUE(c.secondaries[0] -> getTagOrigin() == "ND");
+     318             : 
+     319             :         // test custom tags
+     320           1 :         decay.setInteractionTag("myTag");
+     321           2 :         EXPECT_TRUE(decay.getInteractionTag() == "myTag");
+     322           1 : }
+     323             : 
+     324             : // PhotoDisintegration --------------------------------------------------------
+     325           1 : TEST(PhotoDisintegration, allBackgrounds) {
+     326             :         // Test if interaction data files are loaded.
+     327           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     328           1 :         PhotoDisintegration pd(cmb);
+     329           1 :         ref_ptr<PhotonField> irb = new IRB_Kneiske04();
+     330           1 :         pd.setPhotonField(irb);
+     331           1 :         ref_ptr<PhotonField> urb = new URB_Protheroe96();
+     332           1 :         pd.setPhotonField(urb);
+     333           2 :         irb = new IRB_Stecker05();
+     334           1 :         pd.setPhotonField(irb);
+     335           2 :         irb = new IRB_Franceschini08();
+     336           1 :         pd.setPhotonField(irb);
+     337           2 :         irb = new IRB_Finke10();
+     338           1 :         pd.setPhotonField(irb);
+     339           2 :         irb = new IRB_Dominguez11();
+     340           1 :         pd.setPhotonField(irb);
+     341           2 :         irb = new IRB_Gilmore12();
+     342           1 :         pd.setPhotonField(irb);
+     343           2 :         irb = new IRB_Stecker16_upper();
+     344           1 :         pd.setPhotonField(irb);
+     345           2 :         irb = new IRB_Stecker16_lower();
+     346           1 :         pd.setPhotonField(irb);
+     347           2 :     irb = new IRB_Finke22();
+     348           1 :         pd.setPhotonField(irb);
+     349           2 :         urb = new URB_Nitu21();
+     350           2 :         pd.setPhotonField(urb);
+     351           2 : }
+     352             : 
+     353           1 : TEST(PhotoDisintegration, carbon) {
+     354             :         // Test if a 100 EeV C-12 nucleus photo-disintegrates (at least once) over a distance of 1 Gpc.
+     355             :         // This test can stochastically fail.
+     356           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     357           1 :         PhotoDisintegration pd(cmb);
+     358           1 :         Candidate c;
+     359           1 :         int id = nucleusId(12, 6);
+     360           1 :         c.current.setId(id);
+     361           1 :         c.current.setEnergy(100 * EeV);
+     362           1 :         c.setCurrentStep(1000 * Mpc);
+     363           1 :         pd.process(&c);
+     364             : 
+     365           1 :         EXPECT_TRUE(c.current.getEnergy() < 100 * EeV);
+     366             :         // energy loss
+     367           1 :         EXPECT_TRUE(c.secondaries.size() > 0);
+     368             :         // secondaries produced
+     369             : 
+     370           1 :         double E = c.current.getEnergy();
+     371           1 :         id = c.current.getId();
+     372           1 :         int A = massNumber(id);
+     373           1 :         int Z = chargeNumber(id);
+     374             : 
+     375           2 :         for (int i = 0; i < c.secondaries.size(); i++) {
+     376           1 :                 E += (*c.secondaries[i]).current.getEnergy();
+     377           1 :                 id = (*c.secondaries[i]).current.getId();
+     378           1 :                 A += massNumber(id);
+     379           1 :                 Z += chargeNumber(id);
+     380             :         }
+     381           1 :         EXPECT_EQ(12, A);
+     382             :         // nucleon number conserved
+     383           1 :         EXPECT_EQ(6, Z);
+     384             :         // proton number conserved
+     385           1 :         EXPECT_DOUBLE_EQ(100 * EeV, E);
+     386             :         // energy conserved
+     387           2 : }
+     388             : 
+     389           1 : TEST(PhotoDisintegration, iron) {
+     390             :         // Test if a 200 EeV Fe-56 nucleus photo-disintegrates (at least once) over a distance of 1 Gpc.
+     391             :         // This test can stochastically fail.
+     392           1 :         ref_ptr<PhotonField> irb = new IRB_Kneiske04();
+     393           1 :         PhotoDisintegration pd(irb);
+     394           1 :         Candidate c;
+     395           1 :         int id = nucleusId(56, 26);
+     396           1 :         c.current.setId(id);
+     397           1 :         c.current.setEnergy(200 * EeV);
+     398           1 :         c.setCurrentStep(1000 * Mpc);
+     399           1 :         pd.process(&c);
+     400             : 
+     401             :         // expect energy loss
+     402           1 :         EXPECT_TRUE(c.current.getEnergy() < 200 * EeV);
+     403             :         
+     404             :         // expect secondaries produced
+     405           1 :         EXPECT_TRUE(c.secondaries.size() > 0);
+     406             : 
+     407           1 :         double E = c.current.getEnergy();
+     408           1 :         id = c.current.getId();
+     409           1 :         int A = massNumber(id);
+     410           1 :         int Z = chargeNumber(id);
+     411             : 
+     412          31 :         for (int i = 0; i < c.secondaries.size(); i++) {
+     413          30 :                 E += (*c.secondaries[i]).current.getEnergy();
+     414          30 :                 id = (*c.secondaries[i]).current.getId();
+     415          30 :                 A += massNumber(id);
+     416          30 :                 Z += chargeNumber(id);
+     417             :         }
+     418             : 
+     419             :         // nucleon number conserved
+     420           1 :         EXPECT_EQ(56, A);
+     421             :         
+     422             :         // proton number conserved (no decay active)
+     423           1 :         EXPECT_EQ(26, Z);
+     424             :         
+     425             :         // energy conserved
+     426           1 :         EXPECT_DOUBLE_EQ(200 * EeV, E);
+     427           2 : }
+     428             : 
+     429           1 : TEST(PhotoDisintegration, thisIsNotNucleonic) {
+     430             :         // Test that nothing happens to an electron.
+     431           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     432           1 :         PhotoDisintegration pd(cmb);
+     433           1 :         Candidate c;
+     434           1 :         c.setCurrentStep(1 * Mpc);
+     435           1 :         c.current.setId(11); // electron
+     436           1 :         c.current.setEnergy(10 * EeV);
+     437           1 :         pd.process(&c);
+     438           1 :         EXPECT_EQ(11, c.current.getId());
+     439           1 :         EXPECT_EQ(10 * EeV, c.current.getEnergy());
+     440           2 : }
+     441             : 
+     442           1 : TEST(PhotoDisintegration, limitNextStep) {
+     443             :         // Test if the interaction limits the next propagation step.
+     444           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     445           1 :         PhotoDisintegration pd(cmb);
+     446           1 :         Candidate c;
+     447           1 :         c.setNextStep(std::numeric_limits<double>::max());
+     448           1 :         c.current.setId(nucleusId(4, 2));
+     449           1 :         c.current.setEnergy(200 * EeV);
+     450           1 :         pd.process(&c);
+     451           1 :         EXPECT_LT(c.getNextStep(), std::numeric_limits<double>::max());
+     452           2 : }
+     453             : 
+     454           1 : TEST(PhotoDisintegration, allIsotopes) {
+     455             :         // Test if all isotopes are handled.
+     456           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     457           1 :         PhotoDisintegration pd1(cmb);
+     458           1 :         ref_ptr<PhotonField> irb = new IRB_Kneiske04();
+     459           1 :         PhotoDisintegration pd2(irb);
+     460           1 :         Candidate c;
+     461           1 :         c.setCurrentStep(10 * Mpc);
+     462             : 
+     463          27 :         for (int Z = 1; Z <= 26; Z++) {
+     464         806 :                 for (int N = 1; N <= 30; N++) {
+     465             : 
+     466         780 :                         c.current.setId(nucleusId(Z + N, Z));
+     467         780 :                         c.current.setEnergy(80 * EeV);
+     468         780 :                         pd1.process(&c);
+     469             : 
+     470         780 :                         c.current.setId(nucleusId(Z + N, Z));
+     471         780 :                         c.current.setEnergy(80 * EeV);
+     472         780 :                         pd2.process(&c);
+     473             :                 }
+     474             :         }
+     475           3 : }
+     476             : 
+     477           1 : TEST(Photodisintegration, updateParticleParentProperties) { // Issue: #204
+     478           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     479           1 :         PhotoDisintegration pd(cmb);
+     480             : 
+     481           1 :         Candidate c(nucleusId(56,26), 500 * EeV, Vector3d(1 * Mpc, 0, 0));
+     482             : 
+     483           1 :         pd.performInteraction(&c, 1);
+     484             :         // the candidates parent is the original particle
+     485           1 :         EXPECT_EQ(c.created.getId(), nucleusId(56,26));
+     486             : 
+     487           1 :         pd.performInteraction(&c, 1);
+     488             :         // now it has to be changed
+     489           1 :         EXPECT_NE(c.created.getId(), nucleusId(56,26));
+     490           2 : }
+     491             : 
+     492           1 : TEST(PhotoDisintegration, interactionTag) {
+     493           2 :         PhotoDisintegration pd(new CMB());
+     494             : 
+     495             :         // test default interactionTag
+     496           2 :         EXPECT_TRUE(pd.getInteractionTag() == "PD");
+     497             : 
+     498             :         // test secondary tag
+     499           1 :         pd.setHavePhotons(true);
+     500           2 :         Candidate c(nucleusId(56,26), 500 * EeV);
+     501           1 :         c.setCurrentStep(1 * Gpc);
+     502           1 :         pd.process(&c);
+     503           2 :         EXPECT_TRUE(c.secondaries[0] -> getTagOrigin() == "PD");
+     504             : 
+     505             :         // test custom tag
+     506           1 :         pd.setInteractionTag("myTag");
+     507           2 :         EXPECT_TRUE(pd.getInteractionTag() == "myTag");
+     508           1 : }
+     509             : 
+     510             : // ElasticScattering ----------------------------------------------------------
+     511           1 : TEST(ElasticScattering, allBackgrounds) {
+     512             :         // Test if interaction data files are loaded.
+     513           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     514           1 :         ElasticScattering scattering(cmb);
+     515           1 :         ref_ptr<PhotonField> irb = new IRB_Kneiske04();
+     516           1 :         scattering.setPhotonField(irb);
+     517           1 :         ref_ptr<PhotonField> urb = new URB_Nitu21();
+     518           2 :         scattering.setPhotonField(urb);
+     519           2 : }
+     520             : 
+     521           1 : TEST(ElasticScattering, secondaries) {
+     522             :         // Test the creation of cosmic ray photons.
+     523             :         // This test can stochastically fail.
+     524           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     525           1 :         ElasticScattering scattering(cmb);
+     526           1 :         Candidate c;
+     527           1 :         int id = nucleusId(12, 6);
+     528           1 :         c.current.setId(id);
+     529           1 :         c.current.setEnergy(200 * EeV);
+     530           1 :         c.setCurrentStep(400 * Mpc);
+     531           1 :         scattering.process(&c);
+     532             : 
+     533           1 :         EXPECT_GT(c.secondaries.size(), 0);
+     534             : 
+     535           8 :         for (int i = 0; i < c.secondaries.size(); i++) {
+     536           7 :                 int id = (*c.secondaries[i]).current.getId();
+     537           7 :                 EXPECT_EQ(id, 22);
+     538           7 :                 double energy = (*c.secondaries[i]).current.getEnergy();
+     539           7 :                 EXPECT_GT(energy, 0);
+     540           7 :                 EXPECT_LT(energy, 200 * EeV);
+     541             :         }
+     542           2 : }
+     543             : 
+     544             : // PhotoPionProduction --------------------------------------------------------
+     545           1 : TEST(PhotoPionProduction, allBackgrounds) {
+     546             :         // Test if all interaction data files can be loaded.
+     547           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     548           1 :         PhotoPionProduction ppp(cmb);
+     549           1 :         ref_ptr<PhotonField> irb = new IRB_Kneiske04();
+     550           1 :         ppp.setPhotonField(irb);
+     551           2 :         irb = new IRB_Stecker05();
+     552           1 :         ppp.setPhotonField(irb);
+     553           2 :         irb = new IRB_Franceschini08();
+     554           1 :         ppp.setPhotonField(irb);
+     555           2 :         irb = new IRB_Finke10();
+     556           1 :         ppp.setPhotonField(irb);
+     557           2 :         irb = new IRB_Dominguez11();
+     558           1 :         ppp.setPhotonField(irb);
+     559           2 :         irb = new IRB_Gilmore12();
+     560           1 :         ppp.setPhotonField(irb);
+     561           2 :         irb = new IRB_Stecker16_upper();
+     562           1 :         ppp.setPhotonField(irb);
+     563           2 :         irb = new IRB_Stecker16_lower();
+     564           1 :         ppp.setPhotonField(irb);
+     565           2 :     irb = new IRB_Finke22();
+     566           1 :         ppp.setPhotonField(irb);
+     567           1 :         ref_ptr<PhotonField> urb = new URB_Protheroe96();
+     568           1 :         ppp.setPhotonField(urb);
+     569           2 :         urb = new URB_Nitu21();
+     570           2 :         ppp.setPhotonField(urb);
+     571           2 : }
+     572             : 
+     573           1 : TEST(PhotoPionProduction, proton) {
+     574             :         // Test photopion interaction for 100 EeV proton.
+     575             :         // This test can stochastically fail.
+     576           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     577           1 :         PhotoPionProduction ppp(cmb);
+     578           1 :         Candidate c(nucleusId(1, 1), 100 * EeV);
+     579           1 :         c.setCurrentStep(1000 * Mpc);
+     580           1 :         ppp.process(&c);
+     581             : 
+     582             :         // expect energy loss
+     583           1 :         EXPECT_LT(c.current.getEnergy(), 100. * EeV);
+     584             : 
+     585             :         // expect nucleon number conservation
+     586           1 :         EXPECT_EQ(1, massNumber(c.current.getId()));
+     587             : 
+     588             :         // expect no (nucleonic) secondaries
+     589           1 :         EXPECT_EQ(0, c.secondaries.size());
+     590           2 : }
+     591             : 
+     592           1 : TEST(PhotoPionProduction, helium) {
+     593             :         // Test photo-pion interaction for 400 EeV He nucleus.
+     594             :         // This test can stochastically fail.
+     595           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     596           1 :         PhotoPionProduction ppp(cmb);
+     597           1 :         Candidate c;
+     598           1 :         c.current.setId(nucleusId(4, 2));
+     599           1 :         c.current.setEnergy(400. * EeV);
+     600           1 :         c.setCurrentStep(1000 * Mpc);
+     601           1 :         ppp.process(&c);
+     602           1 :         EXPECT_LT(c.current.getEnergy(), 400. * EeV);
+     603           1 :         int id = c.current.getId();
+     604           1 :         EXPECT_TRUE(massNumber(id) < 4);
+     605           1 :         EXPECT_TRUE(c.secondaries.size() > 0);
+     606           2 : }
+     607             : 
+     608           1 : TEST(PhotoPionProduction, thisIsNotNucleonic) {
+     609             :         // Test if nothing happens to an electron.
+     610           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     611           1 :         PhotoPionProduction ppp(cmb);
+     612           1 :         Candidate c;
+     613           1 :         c.current.setId(11); // electron
+     614           1 :         c.current.setEnergy(10 * EeV);
+     615           1 :         c.setCurrentStep(100 * Mpc);
+     616           1 :         ppp.process(&c);
+     617           1 :         EXPECT_EQ(11, c.current.getId());
+     618           1 :         EXPECT_EQ(10 * EeV, c.current.getEnergy());
+     619           2 : }
+     620             : 
+     621           1 : TEST(PhotoPionProduction, limitNextStep) {
+     622             :         // Test if the interaction limits the next propagation step.
+     623           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     624           1 :         PhotoPionProduction ppp(cmb);
+     625           1 :         Candidate c(nucleusId(1, 1), 200 * EeV);
+     626           1 :         c.setNextStep(std::numeric_limits<double>::max());
+     627           1 :         ppp.process(&c);
+     628           1 :         EXPECT_LT(c.getNextStep(), std::numeric_limits<double>::max());
+     629           2 : }
+     630             : 
+     631           1 : TEST(PhotoPionProduction, secondaries) {
+     632             :         // Test photo-pion interaction for 100 EeV proton.
+     633             :         // This test can stochastically fail.
+     634           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     635           1 :         PhotoPionProduction ppp(cmb, true, true, true);
+     636           1 :         Candidate c(nucleusId(1, 1), 100 * EeV);
+     637           1 :         c.setCurrentStep(1000 * Mpc);
+     638           1 :         ppp.process(&c);
+     639             :         // there should be secondaries
+     640           1 :         EXPECT_GT(c.secondaries.size(), 1);
+     641           2 : }
+     642             : 
+     643           1 : TEST(PhotoPionProduction, sampling) {
+     644             :         // Specific test of photon sampling of photo-pion production
+     645             :         // by testing the calculated pEpsMax for CMB(), also indirectly
+     646             :         // testing epsMinInteraction and logSampling (default).
+     647           1 :         ref_ptr<PhotonField> cmb = new CMB(); //create CMB instance
+     648             :         double energy = 1.e10; //1e10 GeV
+     649             :         bool onProton = true; //proton
+     650             :         double z = 0; //no redshift
+     651           1 :         PhotoPionProduction ppp(cmb, true, true, true);
+     652           1 :         double correctionFactor = ppp.getCorrectionFactor(); //get current correctionFactor
+     653           1 :         double epsMin = std::max(cmb -> getMinimumPhotonEnergy(z) / eV, 0.00710614); // 0.00710614 = epsMinInteraction(onProton,energy)
+     654           1 :         double epsMax = cmb -> getMaximumPhotonEnergy(z) / eV;
+     655           1 :         double pEpsMax = ppp.probEpsMax(onProton, energy, z, epsMin, epsMax) / correctionFactor;
+     656           1 :         EXPECT_DOUBLE_EQ(pEpsMax,132673934934.922);
+     657           2 : }
+     658             : 
+     659           1 : TEST(PhotoPionProduction, interactionTag) {
+     660           2 :         PhotoPionProduction ppp(new CMB());
+     661             : 
+     662             :         // test default interactionTag
+     663           2 :         EXPECT_TRUE(ppp.getInteractionTag() == "PPP");
+     664             : 
+     665             :         // test secondary tag
+     666           1 :         ppp.setHavePhotons(true);
+     667           2 :         Candidate c(nucleusId(1,1), 100 * EeV);
+     668          11 :         for(int i = 0; i <10; i++) 
+     669          10 :                 ppp.performInteraction(&c, true);
+     670           2 :         EXPECT_TRUE(c.secondaries[0] -> getTagOrigin() == "PPP");
+     671             : 
+     672             :         // test custom interactionTag
+     673           1 :         ppp.setInteractionTag("myTag");
+     674           2 :         EXPECT_TRUE(ppp.getInteractionTag() == "myTag");
+     675           1 : }
+     676             : 
+     677             : // Redshift -------------------------------------------------------------------
+     678           2 : TEST(Redshift, simpleTest) {
+     679             :         // Test if redshift is decreased and adiabatic energy loss is applied.
+     680             :         Redshift redshift;
+     681             : 
+     682           1 :         Candidate c;
+     683           1 :         c.setRedshift(0.024);
+     684           1 :         c.current.setEnergy(100 * EeV);
+     685           1 :         c.setCurrentStep(1 * Mpc);
+     686             : 
+     687           1 :         redshift.process(&c);
+     688           1 :         EXPECT_GT(0.024, c.getRedshift()); // expect redshift decrease
+     689           1 :         EXPECT_GT(100, c.current.getEnergy() / EeV); // expect energy loss
+     690           2 : }
+     691             : 
+     692           2 : TEST(Redshift, limitRedshiftDecrease) {
+     693             :         // Test if the redshift decrease is limited to z_updated >= 0.
+     694             :         Redshift redshift;
+     695             : 
+     696           1 :         Candidate c;
+     697           1 :         c.setRedshift(0.024); // roughly corresponds to 100 Mpc
+     698           1 :         c.setCurrentStep(150 * Mpc);
+     699             : 
+     700           1 :         redshift.process(&c);
+     701           1 :         EXPECT_DOUBLE_EQ(0, c.getRedshift());
+     702           2 : }
+     703             : 
+     704             : // EMPairProduction -----------------------------------------------------------
+     705           1 : TEST(EMPairProduction, allBackgrounds) {
+     706             :         // Test if interaction data files are loaded.
+     707           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     708           1 :         EMPairProduction em(cmb);
+     709           1 :         ref_ptr<PhotonField> ebl = new IRB_Kneiske04();
+     710           1 :         em.setPhotonField(ebl);
+     711           1 :         ref_ptr<PhotonField> urb = new URB_Protheroe96();
+     712           1 :         em.setPhotonField(urb);
+     713           2 :         ebl = new IRB_Stecker05();
+     714           1 :         em.setPhotonField(ebl);
+     715           2 :         ebl = new IRB_Franceschini08();
+     716           1 :         em.setPhotonField(ebl);
+     717           2 :         ebl = new IRB_Finke10();
+     718           1 :         em.setPhotonField(ebl);
+     719           2 :         ebl = new IRB_Dominguez11();
+     720           1 :         em.setPhotonField(ebl);
+     721           2 :         ebl = new IRB_Gilmore12();
+     722           1 :         em.setPhotonField(ebl);
+     723           2 :         ebl = new IRB_Stecker16_upper();
+     724           1 :         em.setPhotonField(ebl);
+     725           2 :         ebl = new IRB_Stecker16_lower();
+     726           1 :         em.setPhotonField(ebl);
+     727           2 :         ebl = new IRB_Finke22();
+     728           1 :         em.setPhotonField(ebl);
+     729           2 :         urb = new URB_Fixsen11();
+     730           1 :         em.setPhotonField(urb);
+     731           2 :         urb = new URB_Nitu21();
+     732           2 :         em.setPhotonField(urb);
+     733           2 : }
+     734             : 
+     735           1 : TEST(EMPairProduction, limitNextStep) {
+     736             :         // Test if the interaction limits the next propagation step.
+     737           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     738           1 :         EMPairProduction m(cmb);
+     739           1 :         Candidate c(22, 1E17 * eV);
+     740           1 :         c.setNextStep(std::numeric_limits<double>::max());
+     741           1 :         m.process(&c);
+     742           1 :         EXPECT_LT(c.getNextStep(), std::numeric_limits<double>::max());
+     743           2 : }
+     744             : 
+     745           1 : TEST(EMPairProduction, secondaries) {
+     746             :         // Test if secondaries are correctly produced.
+     747           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     748           1 :         ref_ptr<PhotonField> irb = new IRB_Saldana21();
+     749           1 :         ref_ptr<PhotonField> urb = new URB_Nitu21();
+     750           1 :         EMPairProduction m(cmb);
+     751           1 :         m.setHaveElectrons(true);
+     752           1 :         m.setThinning(0.);
+     753             : 
+     754             :         std::vector<ref_ptr<PhotonField>> fields;
+     755           1 :         fields.push_back(cmb);
+     756           1 :         fields.push_back(irb);
+     757           1 :         fields.push_back(urb);
+     758             : 
+     759             :         // loop over photon backgrounds
+     760           4 :         for (int f = 0; f < fields.size(); f++) {
+     761           3 :                 m.setPhotonField(fields[f]);
+     762         423 :                 for (int i = 0; i < 140; i++) { // loop over energies Ep = (1e10 - 1e23) eV
+     763         420 :                         double Ep = pow(10, 9.05 + 0.1 * i) * eV;
+     764         420 :                         Candidate c(22, Ep);
+     765         420 :                         c.setCurrentStep(1e10 * Mpc);
+     766             : 
+     767         420 :                         m.process(&c);
+     768             : 
+     769             :                         // pass if no interaction has ocurred (no tabulated rates)
+     770         420 :                         if (c.isActive())
+     771             :                                 continue;
+     772             :                         
+     773             :                         // expect 2 secondaries
+     774         311 :                         EXPECT_EQ(c.secondaries.size(), 2);
+     775             : 
+     776             :                         // expect electron / positron with energies 0 < E < Ephoton
+     777             :                         double Etot = 0;
+     778         933 :                         for (int j = 0; j < c.secondaries.size(); j++) {
+     779         622 :                                 Candidate s = *c.secondaries[j];
+     780         622 :                                 EXPECT_EQ(abs(s.current.getId()), 11);
+     781         622 :                                 EXPECT_GT(s.current.getEnergy(), 0);
+     782         622 :                                 EXPECT_LT(s.current.getEnergy(), Ep);
+     783         622 :                                 Etot += s.current.getEnergy();
+     784         622 :                         }
+     785             : 
+     786             :                         // test energy conservation
+     787         311 :                         EXPECT_DOUBLE_EQ(Ep, Etot);
+     788         420 :                 }
+     789             :         }
+     790           2 : }
+     791             : 
+     792           1 : TEST(EMPairProduction, interactionTag) {
+     793           2 :         EMPairProduction m(new CMB());
+     794             : 
+     795             :         // test default interactionTag
+     796           2 :         EXPECT_TRUE(m.getInteractionTag() == "EMPP");
+     797             : 
+     798             :         // test secondary tag
+     799           1 :         m.setHaveElectrons(true);
+     800           2 :         Candidate c(22, 1 * EeV);
+     801           1 :         m.performInteraction(&c);
+     802           2 :         EXPECT_TRUE(c.secondaries[0] -> getTagOrigin() == "EMPP");
+     803             : 
+     804             :         // test custom tag
+     805           1 :         m.setInteractionTag("myTag");
+     806           2 :         EXPECT_TRUE(m.getInteractionTag() == "myTag");
+     807           1 : }
+     808             : 
+     809             : // EMDoublePairProduction -----------------------------------------------------
+     810           1 : TEST(EMDoublePairProduction, allBackgrounds) {
+     811             :         // Test if interaction data files are loaded.
+     812           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     813           1 :         EMDoublePairProduction em(cmb);
+     814           1 :         ref_ptr<PhotonField> ebl = new IRB_Kneiske04();
+     815           1 :         em.setPhotonField(ebl);
+     816           1 :         ref_ptr<PhotonField> urb = new URB_Protheroe96();
+     817           1 :         em.setPhotonField(urb);
+     818           2 :         ebl = new IRB_Stecker05();
+     819           1 :         em.setPhotonField(ebl);
+     820           2 :         ebl = new IRB_Franceschini08();
+     821           1 :         em.setPhotonField(ebl);
+     822           2 :         ebl = new IRB_Finke10();
+     823           1 :         em.setPhotonField(ebl);
+     824           2 :         ebl = new IRB_Dominguez11();
+     825           1 :         em.setPhotonField(ebl);
+     826           2 :         ebl = new IRB_Gilmore12();
+     827           1 :         em.setPhotonField(ebl);
+     828           2 :         ebl = new IRB_Stecker16_upper();
+     829           1 :         em.setPhotonField(ebl);
+     830           2 :         ebl = new IRB_Stecker16_lower();
+     831           1 :         em.setPhotonField(ebl);
+     832           2 :         ebl = new IRB_Finke22();
+     833           1 :         em.setPhotonField(ebl);
+     834           2 :         urb = new URB_Fixsen11();
+     835           1 :         em.setPhotonField(urb);
+     836           2 :         urb = new URB_Nitu21();
+     837           2 :         em.setPhotonField(urb);
+     838           2 : }
+     839             : 
+     840           1 : TEST(EMDoublePairProduction, limitNextStep) {
+     841             :         // Test if the interaction limits the next propagation step.
+     842           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     843           1 :         EMDoublePairProduction m(cmb);
+     844           1 :         Candidate c(22, 1E17 * eV);
+     845           1 :         c.setNextStep(std::numeric_limits<double>::max());
+     846           1 :         m.process(&c);
+     847           1 :         EXPECT_LT(c.getNextStep(), std::numeric_limits<double>::max());
+     848           2 : }
+     849             : 
+     850           1 : TEST(EMDoublePairProduction, secondaries) {
+     851             :         // Test if secondaries are correctly produced.
+     852           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     853           1 :         ref_ptr<PhotonField> irb = new IRB_Saldana21();
+     854           1 :         ref_ptr<PhotonField> urb = new URB_Nitu21();
+     855           1 :         EMPairProduction m(cmb);
+     856           1 :         m.setHaveElectrons(true);
+     857           1 :         m.setThinning(0.);
+     858             : 
+     859             :         std::vector<ref_ptr<PhotonField>> fields;
+     860           1 :         fields.push_back(cmb);
+     861           1 :         fields.push_back(irb);
+     862           1 :         fields.push_back(urb);
+     863             : 
+     864             :         // loop over photon backgrounds
+     865           4 :         for (int f = 0; f < fields.size(); f++) {
+     866           3 :                 m.setPhotonField(fields[f]);
+     867             :                 
+     868             :                 // loop over energies Ep = (1e9 - 1e23) eV
+     869         423 :                 for (int i = 0; i < 140; i++) {
+     870         420 :                         double Ep = pow(10, 9.05 + 0.1 * i) * eV;
+     871         420 :                         Candidate c(22, Ep);
+     872         420 :                         c.setCurrentStep(1e4 * Mpc); // use lower value so that the test can run faster
+     873         420 :                         m.process(&c);
+     874             : 
+     875             :                         // pass if no interaction has occured (no tabulated rates)
+     876         420 :                         if (c.isActive())
+     877             :                                 continue;
+     878             :                         
+     879             :                         // expect 2 secondaries (only one pair is considered)
+     880         251 :                         EXPECT_EQ(c.secondaries.size(), 2);
+     881             : 
+     882             :                         // expect electron / positron with energies 0 < E < Ephoton
+     883             :                         double Etot = 0;
+     884         753 :                         for (int j = 0; j < c.secondaries.size(); j++) {
+     885         502 :                                 Candidate s = *c.secondaries[j];
+     886         502 :                                 EXPECT_EQ(abs(s.current.getId()), 11);
+     887         502 :                                 EXPECT_GT(s.current.getEnergy(), 0);
+     888         502 :                                 EXPECT_LT(s.current.getEnergy(), Ep);
+     889         502 :                                 Etot += s.current.getEnergy();
+     890         502 :                         }
+     891             : 
+     892             :                         // test energy conservation
+     893         251 :                         EXPECT_NEAR(Ep, Etot, 1E-9);
+     894         420 :                 }
+     895             :         }
+     896           2 : }
+     897             : 
+     898           1 : TEST(EMDoublePairProduction, interactionTag) {
+     899           2 :         EMDoublePairProduction m(new CMB());
+     900             : 
+     901             :         // test default interactionTag
+     902           2 :         EXPECT_TRUE(m.getInteractionTag() == "EMDP");
+     903             : 
+     904             :         // test secondary tag
+     905           1 :         m.setHaveElectrons(true);
+     906           2 :         Candidate c(22, 1 * EeV);
+     907           1 :         m.performInteraction(&c);
+     908           2 :         EXPECT_TRUE(c.secondaries[0] -> getTagOrigin() == "EMDP");
+     909             : 
+     910             :         // test custom tag
+     911           1 :         m.setInteractionTag("myTag");
+     912           2 :         EXPECT_TRUE(m.getInteractionTag() == "myTag");
+     913           1 : }
+     914             : 
+     915             : // EMTripletPairProduction ----------------------------------------------------
+     916           1 : TEST(EMTripletPairProduction, allBackgrounds) {
+     917             :         // Test if interaction data files are loaded.
+     918           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     919           1 :         EMTripletPairProduction em(cmb);
+     920           1 :         ref_ptr<PhotonField> ebl = new IRB_Kneiske04();
+     921           1 :         em.setPhotonField(ebl);
+     922           1 :         ref_ptr<PhotonField> urb = new URB_Protheroe96();
+     923           1 :         em.setPhotonField(urb);
+     924           2 :         ebl = new IRB_Stecker05();
+     925           1 :         em.setPhotonField(ebl);
+     926           2 :         ebl = new IRB_Franceschini08();
+     927           1 :         em.setPhotonField(ebl);
+     928           2 :         ebl = new IRB_Finke10();
+     929           1 :         em.setPhotonField(ebl);
+     930           2 :         ebl = new IRB_Dominguez11();
+     931           1 :         em.setPhotonField(ebl);
+     932           2 :         ebl = new IRB_Gilmore12();
+     933           1 :         em.setPhotonField(ebl);
+     934           2 :         ebl = new IRB_Stecker16_upper();
+     935           1 :         em.setPhotonField(ebl);
+     936           2 :         ebl = new IRB_Stecker16_lower();
+     937           1 :         em.setPhotonField(ebl);
+     938           2 :         ebl = new IRB_Finke22();
+     939           1 :         em.setPhotonField(ebl);
+     940           2 :         urb = new URB_Fixsen11();
+     941           1 :         em.setPhotonField(urb);
+     942           2 :         urb = new URB_Nitu21();
+     943           2 :         em.setPhotonField(urb);
+     944           2 : }
+     945             : 
+     946           1 : TEST(EMTripletPairProduction, limitNextStep) {
+     947             :         // Test if the interaction limits the next propagation step.
+     948           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     949           1 :         EMTripletPairProduction m(cmb);
+     950           1 :         Candidate c(11, 1E17 * eV);
+     951           1 :         c.setNextStep(std::numeric_limits<double>::max());
+     952           1 :         m.process(&c);
+     953           1 :         EXPECT_LT(c.getNextStep(), std::numeric_limits<double>::max());
+     954           2 : }
+     955             : 
+     956           1 : TEST(EMTripletPairProduction, secondaries) {
+     957             :         // Test if secondaries are correctly produced.
+     958           1 :         ref_ptr<PhotonField> cmb = new CMB();
+     959           1 :         ref_ptr<PhotonField> irb = new IRB_Saldana21();
+     960           1 :         ref_ptr<PhotonField> urb = new URB_Nitu21();
+     961           1 :         EMPairProduction m(cmb);
+     962           1 :         m.setHaveElectrons(true);
+     963           1 :         m.setThinning(0.);
+     964             : 
+     965             :         std::vector<ref_ptr<PhotonField>> fields;
+     966           1 :         fields.push_back(cmb);
+     967           1 :         fields.push_back(irb);
+     968           1 :         fields.push_back(urb);
+     969             : 
+     970             :         // loop over photon backgrounds
+     971           4 :         for (int f = 0; f < fields.size(); f++) {
+     972           3 :                 m.setPhotonField(fields[f]);
+     973             :                 
+     974             :                 // loop over energies Ep = (1e9 - 1e23) eV
+     975         423 :                 for (int i = 0; i < 140; i++) {
+     976             : 
+     977         420 :                         double Ep = pow(10, 9.05 + 0.1 * i) * eV;
+     978         420 :                         Candidate c(11, Ep);
+     979         420 :                         c.setCurrentStep(1e4 * Mpc); // use lower value so that the test can run faster
+     980         420 :                         m.process(&c);
+     981             : 
+     982             :                         // pass if no interaction has occured (no tabulated rates)
+     983         420 :                         if (c.current.getEnergy() == Ep)
+     984             :                                 continue;
+     985             : 
+     986             :                         // expect positive energy of primary electron
+     987           0 :                         EXPECT_GT(c.current.getEnergy(), 0);
+     988           0 :                         double Etot = c.current.getEnergy();
+     989             : 
+     990             :                         // expect electron / positron with energies 0 < E < Ephoton
+     991           0 :                         for (int j = 0; j < c.secondaries.size(); j++) {
+     992           0 :                                 Candidate s = *c.secondaries[j];
+     993           0 :                                 EXPECT_EQ(abs(s.current.getId()), 11);
+     994           0 :                                 EXPECT_GT(s.current.getEnergy(), 0);
+     995           0 :                                 EXPECT_LT(s.current.getEnergy(), Ep);
+     996           0 :                                 Etot += s.current.getEnergy();
+     997           0 :                         }
+     998             : 
+     999             :                         // test energy conservation
+    1000           0 :                         EXPECT_NEAR(Ep, Etot, 1e-9);
+    1001         420 :                 }
+    1002             :         }
+    1003           2 : }
+    1004             : 
+    1005           1 : TEST(EMTripletPairProduction, interactionTag) {
+    1006           2 :         EMTripletPairProduction m(new CMB());
+    1007             : 
+    1008             :         // test default interactionTag
+    1009           2 :         EXPECT_TRUE(m.getInteractionTag() == "EMTP");
+    1010             : 
+    1011             :         // test secondary tag
+    1012           1 :         m.setHaveElectrons(true);
+    1013           2 :         Candidate c(11, 1 * EeV);
+    1014           1 :         m.performInteraction(&c);
+    1015           2 :         EXPECT_TRUE(c.secondaries[0] -> getTagOrigin() == "EMTP");
+    1016             : 
+    1017             :         // test custom tag
+    1018           1 :         m.setInteractionTag("myTag");
+    1019           2 :         EXPECT_TRUE(m.getInteractionTag() == "myTag");
+    1020           1 : }
+    1021             : 
+    1022             : // EMInverseComptonScattering -------------------------------------------------
+    1023           1 : TEST(EMInverseComptonScattering, allBackgrounds) {
+    1024             :         // Test if interaction data files are loaded.
+    1025           1 :         ref_ptr<PhotonField> cmb = new CMB();
+    1026           1 :         EMInverseComptonScattering em(cmb);
+    1027           1 :         ref_ptr<PhotonField> ebl = new IRB_Kneiske04();
+    1028           1 :         em.setPhotonField(ebl);
+    1029           1 :         ref_ptr<PhotonField> urb = new URB_Protheroe96();
+    1030           1 :         em.setPhotonField(urb);
+    1031           2 :         ebl = new IRB_Stecker05();
+    1032           1 :         em.setPhotonField(ebl);
+    1033           2 :         ebl = new IRB_Franceschini08();
+    1034           1 :         em.setPhotonField(ebl);
+    1035           2 :         ebl = new IRB_Finke10();
+    1036           1 :         em.setPhotonField(ebl);
+    1037           2 :         ebl = new IRB_Dominguez11();
+    1038           1 :         em.setPhotonField(ebl);
+    1039           2 :         ebl = new IRB_Gilmore12();
+    1040           1 :         em.setPhotonField(ebl);
+    1041           2 :         ebl = new IRB_Stecker16_upper();
+    1042           1 :         em.setPhotonField(ebl);
+    1043           2 :         ebl = new IRB_Stecker16_lower();
+    1044           1 :         em.setPhotonField(ebl);
+    1045           2 :         ebl = new IRB_Finke22();
+    1046           1 :         em.setPhotonField(ebl);
+    1047           2 :         urb = new URB_Fixsen11();
+    1048           1 :         em.setPhotonField(urb);
+    1049           2 :         urb = new URB_Nitu21();
+    1050           2 :         em.setPhotonField(urb);
+    1051           2 : }
+    1052             : 
+    1053           1 : TEST(EMInverseComptonScattering, limitNextStep) {
+    1054             :         // Test if the interaction limits the next propagation step.
+    1055           1 :         ref_ptr<PhotonField> cmb = new CMB();
+    1056           1 :         EMInverseComptonScattering m(cmb);
+    1057           1 :         Candidate c(11, 1E17 * eV);
+    1058           1 :         c.setNextStep(std::numeric_limits<double>::max());
+    1059           1 :         m.process(&c);
+    1060           1 :         EXPECT_LT(c.getNextStep(), std::numeric_limits<double>::max());
+    1061           2 : }
+    1062             : 
+    1063           1 : TEST(EMInverseComptonScattering, secondaries) {
+    1064             :         // Test if secondaries are correctly produced.
+    1065           1 :         ref_ptr<PhotonField> cmb = new CMB();
+    1066           1 :         ref_ptr<PhotonField> irb = new IRB_Saldana21();
+    1067           1 :         ref_ptr<PhotonField> urb = new URB_Nitu21();
+    1068           1 :         EMPairProduction m(cmb);
+    1069           1 :         m.setHaveElectrons(true);
+    1070           1 :         m.setThinning(0.);
+    1071             : 
+    1072             :         std::vector<ref_ptr<PhotonField>> fields;
+    1073           1 :         fields.push_back(cmb);
+    1074           1 :         fields.push_back(irb);
+    1075           1 :         fields.push_back(urb);
+    1076             : 
+    1077             :         // loop over photon backgrounds
+    1078           4 :         for (int f = 0; f < fields.size(); f++) {
+    1079           3 :                 m.setPhotonField(fields[f]);
+    1080             :                 
+    1081             :                 // loop over energies Ep = (1e9 - 1e23) eV
+    1082         423 :                 for (int i = 0; i < 140; i++) {
+    1083         420 :                         double Ep = pow(10, 9.05 + 0.1 * i) * eV;
+    1084         420 :                         Candidate c(11, Ep);
+    1085         420 :                         c.setCurrentStep(1e3 * Mpc); // use lower value so that the test can run faster
+    1086         420 :                         m.process(&c);
+    1087             : 
+    1088             :                         // pass if no interaction has occured (no tabulated rates)
+    1089         420 :                         if (c.current.getEnergy() == Ep)
+    1090             :                                 continue;
+    1091             :                         
+    1092             :                         // expect positive energy of primary electron
+    1093           0 :                         EXPECT_GT(c.current.getEnergy(), 0);
+    1094             : 
+    1095             :                         // expect photon with energy 0 < E < Ephoton
+    1096           0 :                         Candidate s = *c.secondaries[0];
+    1097           0 :                         EXPECT_EQ(abs(s.current.getId()), 22);
+    1098           0 :                         EXPECT_TRUE(s.current.getEnergy() >= 0.);
+    1099           0 :                         EXPECT_TRUE(s.current.getEnergy() < Ep);
+    1100             : 
+    1101             : 
+    1102           0 :                         double Etot = c.current.getEnergy();
+    1103           0 :                         for (int j = 0; j < c.secondaries.size(); j++) {
+    1104           0 :                                 s = *c.secondaries[j];
+    1105           0 :                                 Etot += s.current.getEnergy();
+    1106             :                         }
+    1107           0 :                         EXPECT_NEAR(Ep, Etot, 1e-9); 
+    1108         420 :                 }
+    1109             :         }
+    1110           2 : }
+    1111             : 
+    1112           1 : TEST(EMInverseComptonScattering, interactionTag) {
+    1113           2 :         EMInverseComptonScattering m(new CMB());
+    1114             : 
+    1115             :         // test default interactionTag
+    1116           2 :         EXPECT_TRUE(m.getInteractionTag() == "EMIC");
+    1117             : 
+    1118             :         // test secondary tag
+    1119           1 :         m.setHavePhotons(true);
+    1120           2 :         Candidate c(11, 1 * PeV);
+    1121           1 :         m.performInteraction(&c);
+    1122           2 :         EXPECT_TRUE(c.secondaries[0] -> getTagOrigin() == "EMIC");
+    1123             : 
+    1124             :         // test custom tag
+    1125           1 :         m.setInteractionTag("myTag");
+    1126           2 :         EXPECT_TRUE(m.getInteractionTag() == "myTag");
+    1127           1 : }
+    1128             : 
+    1129             : // SynchrotronRadiation -------------------------------------------------
+    1130           1 : TEST(SynchrotronRadiation, interactionTag) {
+    1131           1 :         SynchrotronRadiation s(1 * muG, true);
+    1132             : 
+    1133             :         // test default interactionTag
+    1134           2 :         EXPECT_TRUE(s.getInteractionTag() == "SYN");
+    1135             : 
+    1136             :         // test secondary tag
+    1137           2 :         Candidate c(11, 10 * PeV);
+    1138           1 :         c.setCurrentStep(1 * pc);
+    1139           1 :         s.process(&c);
+    1140           2 :         EXPECT_TRUE(c.secondaries[0] -> getTagOrigin() == "SYN");
+    1141             : 
+    1142             :         // test custom tag
+    1143           1 :         s.setInteractionTag("myTag");
+    1144           2 :         EXPECT_TRUE(s.getInteractionTag() == "myTag");
+    1145           1 : }
+    1146             : 
+    1147             : 
+    1148           0 : int main(int argc, char **argv) {
+    1149           0 :         ::testing::InitGoogleTest(&argc, argv);
+    1150           0 :         return RUN_ALL_TESTS();
+    1151             : }
+    1152             : 
+    1153             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testMagneticField.cpp.func-sort-c.html b/doc/coverageReport/test/testMagneticField.cpp.func-sort-c.html new file mode 100644 index 000000000..aaf4ebc36 --- /dev/null +++ b/doc/coverageReport/test/testMagneticField.cpp.func-sort-c.html @@ -0,0 +1,136 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testMagneticField.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testMagneticField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:138138100.0 %
Date:2024-04-08 14:58:22Functions:1616100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN36testCMZMagneticField_SimpleTest_Test8TestBodyEv1
_ZN37testMagneticFieldList_SimpleTest_Test8TestBodyEv1
_ZN37testToroidalHaloField_SimpleTest_Test8TestBodyEv1
_ZN38testCMZMagneticField_TestNTFField_Test8TestBodyEv1
_ZN39testMagneticDipoleField_SimpleTest_Test8TestBodyEv1
_ZN40testUniformMagneticField_SimpleTest_Test8TestBodyEv1
_ZN41testCMZMagneticField_TestICComponent_Test8TestBodyEv1
_ZN41testPeriodicMagneticField_Exceptions_Test8TestBodyEv1
_ZN42testLogarithmicSpiralField_SimpleTest_Test8TestBodyEv1
_ZN42testMagneticFieldEvolution_SimpleTest_Test8TestBodyEv1
_ZN43testCMZMagneticField_TestRaidoArcField_Test8TestBodyEv1
_ZN44testRenormalizeMagneticField_simpleTest_Test8TestBodyEv1
_ZN47testCMZMagneticField_TestAzimutalComponent_Test8TestBodyEv1
_ZN52testPolarizedSingleModeMagneticField_SimpleTest_Test8TestBodyEv1
main1
_ZNK17EchoMagneticField8getFieldERKN7crpropa7Vector3IdEE3
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testMagneticField.cpp.func.html b/doc/coverageReport/test/testMagneticField.cpp.func.html new file mode 100644 index 000000000..4842756d7 --- /dev/null +++ b/doc/coverageReport/test/testMagneticField.cpp.func.html @@ -0,0 +1,136 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testMagneticField.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testMagneticField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:138138100.0 %
Date:2024-04-08 14:58:22Functions:1616100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN36testCMZMagneticField_SimpleTest_Test8TestBodyEv1
_ZN37testMagneticFieldList_SimpleTest_Test8TestBodyEv1
_ZN37testToroidalHaloField_SimpleTest_Test8TestBodyEv1
_ZN38testCMZMagneticField_TestNTFField_Test8TestBodyEv1
_ZN39testMagneticDipoleField_SimpleTest_Test8TestBodyEv1
_ZN40testUniformMagneticField_SimpleTest_Test8TestBodyEv1
_ZN41testCMZMagneticField_TestICComponent_Test8TestBodyEv1
_ZN41testPeriodicMagneticField_Exceptions_Test8TestBodyEv1
_ZN42testLogarithmicSpiralField_SimpleTest_Test8TestBodyEv1
_ZN42testMagneticFieldEvolution_SimpleTest_Test8TestBodyEv1
_ZN43testCMZMagneticField_TestRaidoArcField_Test8TestBodyEv1
_ZN44testRenormalizeMagneticField_simpleTest_Test8TestBodyEv1
_ZN47testCMZMagneticField_TestAzimutalComponent_Test8TestBodyEv1
_ZN52testPolarizedSingleModeMagneticField_SimpleTest_Test8TestBodyEv1
_ZNK17EchoMagneticField8getFieldERKN7crpropa7Vector3IdEE3
main1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testMagneticField.cpp.gcov.html b/doc/coverageReport/test/testMagneticField.cpp.gcov.html new file mode 100644 index 000000000..1da471524 --- /dev/null +++ b/doc/coverageReport/test/testMagneticField.cpp.gcov.html @@ -0,0 +1,292 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testMagneticField.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testMagneticField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:138138100.0 %
Date:2024-04-08 14:58:22Functions:1616100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include <stdexcept>
+       2             : 
+       3             : #include "crpropa/magneticField/MagneticFieldGrid.h"
+       4             : #include "crpropa/magneticField/CMZField.h"
+       5             : #include "crpropa/magneticField/PolarizedSingleModeMagneticField.h"
+       6             : #include "crpropa/magneticField/GalacticMagneticField.h"
+       7             : #include "crpropa/Grid.h"
+       8             : #include "crpropa/Units.h"
+       9             : #include "crpropa/Common.h"
+      10             : 
+      11             : #include "gtest/gtest.h"
+      12             : 
+      13             : using namespace crpropa;
+      14             : 
+      15           1 : TEST(testUniformMagneticField, SimpleTest) {
+      16             :         UniformMagneticField B(Vector3d(-1, 5, 3));
+      17             :         Vector3d b = B.getField(Vector3d(1, 0, 0));
+      18           1 :         EXPECT_DOUBLE_EQ(b.getX(), -1);
+      19           1 :         EXPECT_DOUBLE_EQ(b.getY(), 5);
+      20           1 :         EXPECT_DOUBLE_EQ(b.getZ(), 3);
+      21           1 : }
+      22             : 
+      23           2 : TEST(testMagneticDipoleField, SimpleTest) {
+      24             :         // Test magnetic dipole
+      25             :         // mu0 / (4*M_PI) * m / r^3 (2*cos(theta)*e_r + sin(theta)*e_theta)
+      26             :         MagneticDipoleField B(Vector3d(0,0,0), Vector3d(0,0,1), 1);
+      27           1 :         Vector3d b1 = B.getField(Vector3d(0, 0, 1)); // theta = 0
+      28           1 :         Vector3d b2 = B.getField(Vector3d(1, 0, 0)); // theta = 0
+      29           1 :         EXPECT_NEAR(b1.getX(), 0, 1E-8);
+      30           1 :         EXPECT_NEAR(b1.getY(), 0, 1E-8);
+      31           1 :         EXPECT_NEAR(b1.getZ(), mu0 / (4*M_PI) * 2, 1E-8);
+      32           1 :         EXPECT_NEAR(b2.getX(), 0, 1E-8);
+      33           1 :         EXPECT_NEAR(b2.getY(), 0, 1E-8);
+      34           1 :         EXPECT_NEAR(b2.getZ(), -1 * mu0 / (4*M_PI), 1E-8);
+      35           1 : }
+      36             : 
+      37             : #ifdef CRPROPA_HAVE_MUPARSER
+      38           1 : TEST(testRenormalizeMagneticField, simpleTest) {
+      39           1 :         ref_ptr<UniformMagneticField> field = new UniformMagneticField(Vector3d(2*nG, 0, 0));
+      40           2 :         RenormalizeMagneticField modField(field, "B^2-1*nG");
+      41           1 :         Vector3d b = modField.getField(Vector3d(5, 5, 5));
+      42           1 :         EXPECT_NEAR(b.getR(), 3*nG, 0.001);
+      43           2 : }
+      44             : #endif
+      45             : 
+      46           2 : TEST(testMagneticFieldList, SimpleTest) {
+      47             :         // Test a list of three magnetic fields
+      48             :         MagneticFieldList B;
+      49           1 :         B.addField(new UniformMagneticField(Vector3d(1, 0, 0)));
+      50           1 :         B.addField(new UniformMagneticField(Vector3d(0, 2, 0)));
+      51           2 :         B.addField(new UniformMagneticField(Vector3d(0, 0, 3)));
+      52           1 :         Vector3d b = B.getField(Vector3d(0.));
+      53           1 :         EXPECT_DOUBLE_EQ(b.x, 1);
+      54           1 :         EXPECT_DOUBLE_EQ(b.y, 2);
+      55           1 :         EXPECT_DOUBLE_EQ(b.z, 3);
+      56           1 : }
+      57             : 
+      58           1 : TEST(testMagneticFieldEvolution, SimpleTest) {
+      59             :         // Test if this decorator scales the underlying field as (1+z)^m
+      60           1 :         ref_ptr<UniformMagneticField> B = new UniformMagneticField(Vector3d(1,0,0));
+      61             :         double z = 1.2;
+      62             :         double m = 3;
+      63           2 :         MagneticFieldEvolution Bz(B, m);
+      64             : 
+      65             :         // scaled field
+      66           1 :         Vector3d b = Bz.getField(Vector3d(0,0,0), z);
+      67           1 :         EXPECT_DOUBLE_EQ(b.x, pow(1+z, m));
+      68             : 
+      69             :         // unscaled field
+      70           1 :         b = Bz.getField(Vector3d(0,0,0));
+      71           1 :         EXPECT_DOUBLE_EQ(b.x, 1);
+      72           1 : }
+      73             : 
+      74           1 : class EchoMagneticField: public MagneticField {
+      75             : public:
+      76           3 :         Vector3d getField(const Vector3d &position) const {
+      77           3 :                 return position;
+      78             :         }
+      79             : };
+      80             : 
+      81           1 : TEST(testPeriodicMagneticField, Exceptions) {
+      82           1 :         ref_ptr<EchoMagneticField> f = new EchoMagneticField();
+      83             :         ref_ptr<PeriodicMagneticField> p = new PeriodicMagneticField(f,
+      84           1 :                         Vector3d(10000, 10000, 10000), Vector3d(1000, 1000, 1000), true);
+      85             : 
+      86             :         // box 0, 0, 0
+      87           1 :         Vector3d v = p->getField(Vector3d(1000, 2000, 3000));
+      88           1 :         EXPECT_DOUBLE_EQ(0, v.x);
+      89           1 :         EXPECT_DOUBLE_EQ(1000, v.y);
+      90           1 :         EXPECT_DOUBLE_EQ(2000, v.z);
+      91             : 
+      92             :         // box 1, 2, 3
+      93           1 :         v = p->getField(Vector3d(12000, 23000, 34000));
+      94           1 :         EXPECT_DOUBLE_EQ(9000, v.x);
+      95           1 :         EXPECT_DOUBLE_EQ(2000, v.y);
+      96           1 :         EXPECT_DOUBLE_EQ(7000, v.z);
+      97             : 
+      98             :         // box -1, -2, -3
+      99           1 :         v = p->getField(Vector3d(0, -10000, -20000));
+     100           1 :         EXPECT_DOUBLE_EQ(1000, v.x);
+     101           1 :         EXPECT_DOUBLE_EQ(9000, v.y);
+     102           1 :         EXPECT_DOUBLE_EQ(1000, v.z);
+     103             : 
+     104           1 : }
+     105             : 
+     106           1 : TEST(testCMZMagneticField, SimpleTest) {
+     107           1 :         ref_ptr<CMZField> field = new CMZField();
+     108             :         
+     109             :         // check use-Values
+     110           1 :         EXPECT_FALSE(field->getUseMCField());
+     111           1 :         EXPECT_TRUE(field->getUseICField());
+     112           1 :         EXPECT_FALSE(field->getUseNTFField());
+     113           1 :         EXPECT_FALSE(field->getUseRadioArc());
+     114             : 
+     115             :         // check set function
+     116           1 :         field->setUseMCField(true);
+     117           1 :         EXPECT_TRUE(field->getUseMCField());
+     118           1 :         field->setUseICField(false);
+     119           1 :         EXPECT_FALSE(field->getUseICField());
+     120           1 :         field->setUseNTFField(true);
+     121           1 :         EXPECT_TRUE(field->getUseNTFField());
+     122           1 :         field->setUseRadioArc(true);
+     123           1 :         EXPECT_TRUE(field->getUseRadioArc());
+     124           1 : }
+     125             : 
+     126           1 : TEST(testCMZMagneticField, TestICComponent) {
+     127           1 :         ref_ptr<CMZField> field = new CMZField();
+     128             :         Vector3d pos(10*pc,15*pc,-5*pc);        
+     129             : 
+     130             :         // check IC field at given position
+     131           1 :         Vector3d bVec = field->getField(pos);
+     132           1 :         EXPECT_NEAR(bVec.getR(), 10.501*muG, 1E-3*muG);
+     133           1 :         EXPECT_NEAR(bVec.x, 0.225*muG, 1E-3*muG);
+     134           1 :         EXPECT_NEAR(bVec.y, 0.524*muG, 1E-3*muG);
+     135           1 :         EXPECT_NEAR(bVec.z, 10.486*muG, 1E-3*muG);
+     136           1 : }
+     137           1 : TEST(testCMZMagneticField, TestNTFField){
+     138           1 :         ref_ptr<CMZField> field = new CMZField();
+     139             :         Vector3d pos(10*pc,15*pc,-5*pc);        
+     140             :         
+     141             :         // check NFTField at given position
+     142           1 :         Vector3d bVec = field->getNTFField(pos);
+     143           1 :         EXPECT_NEAR(bVec.getR(),1.692*muG, 1e-3*muG);
+     144           1 :         EXPECT_NEAR(bVec.x, -0.584*muG, 1e-3*muG);
+     145           1 :         EXPECT_NEAR(bVec.y, -1.185*muG, 1e-3*muG);
+     146           1 :         EXPECT_NEAR(bVec.z, 1.057*muG, 1e-3*muG);
+     147           1 : }
+     148           1 : TEST(testCMZMagneticField, TestRaidoArcField){
+     149           1 :         ref_ptr<CMZField> field = new CMZField();
+     150             :         Vector3d pos(10*pc,15*pc,-5*pc);        
+     151             : 
+     152             :         // check RadioArcField at given position
+     153           1 :         Vector3d bVec = field->getRadioArcField(pos);
+     154           1 :         EXPECT_NEAR(bVec.getR(), 31.616*muG, 1e-3*muG);
+     155           1 :         EXPECT_NEAR(bVec.x, -4.671*muG, 1e-3*muG);
+     156           1 :         EXPECT_NEAR(bVec.y, 5.465*muG, 1e-3*muG);
+     157           1 :         EXPECT_NEAR(bVec.z, 30.788*muG, 1e-3*muG);
+     158           1 : }
+     159             : 
+     160           1 : TEST(testCMZMagneticField, TestAzimutalComponent){
+     161           1 :         ref_ptr<CMZField> field = new CMZField();
+     162             :         Vector3d mid(12*pc, 9*pc, 20*pc);
+     163             :         Vector3d pos(9*pc, 10*pc, 25*pc);       
+     164             : 
+     165             :         // simple Test for inner part
+     166           1 :         Vector3d bVec = field->BAz(pos, mid, 100, 0.2, 60*pc);
+     167           1 :         EXPECT_NEAR(bVec.x, 3939.782, 1e-3);
+     168           1 :         EXPECT_NEAR(bVec.y, 14347.304, 1e-3);
+     169           1 :         EXPECT_DOUBLE_EQ(bVec.z, 0);
+     170             : 
+     171             :         // simple Test for outer part
+     172           1 :         bVec = field->BAz(pos, mid, 100, 0.2, 10*pc);
+     173           1 :         EXPECT_NEAR(bVec.x, -164.659, 1e-3);
+     174           1 :         EXPECT_NEAR(bVec.y, -1317.270, 1e-3);
+     175           1 :         EXPECT_DOUBLE_EQ(bVec.z, 0);
+     176             : 
+     177             :         // test for molecular Clouds
+     178           1 :         bVec = field->getMCField(pos);
+     179           1 :         EXPECT_NEAR(bVec.x, -8.339*muG, 1e-3*muG);
+     180           1 :         EXPECT_NEAR(bVec.y, -0.850*muG, 1e-3*muG);
+     181           1 :         EXPECT_DOUBLE_EQ(bVec.z, 0);
+     182           1 : }
+     183             : 
+     184           1 : TEST(testToroidalHaloField, SimpleTest) {
+     185           1 :         ref_ptr<ToroidalHaloField> field = new ToroidalHaloField();
+     186           1 :         Vector3d b = field->getField(Vector3d(0.));
+     187           1 :         EXPECT_DOUBLE_EQ(b.x, 0);
+     188           1 :         EXPECT_DOUBLE_EQ(b.y, 0);
+     189           1 :         EXPECT_DOUBLE_EQ(b.z, 0);
+     190             : 
+     191           1 :         b = field->getField(Vector3d(1,0,0));
+     192           1 :         EXPECT_DOUBLE_EQ(b.x, 0.5);
+     193           1 :         EXPECT_DOUBLE_EQ(b.y, 0);
+     194           1 :         EXPECT_DOUBLE_EQ(b.z, 0);
+     195           1 : }
+     196             : 
+     197           1 : TEST(testLogarithmicSpiralField, SimpleTest) {
+     198           1 :         ref_ptr<LogarithmicSpiralField> field = new LogarithmicSpiralField();
+     199           1 :         Vector3d b = field->getField(Vector3d(8.5, 0, 0)*kpc);
+     200           1 :         EXPECT_NEAR(b.x, -1., 1E-2);
+     201           1 :         EXPECT_NEAR(b.y, 0, 1E-10);
+     202           1 :         EXPECT_NEAR(b.z, 0, 1E-10);
+     203           1 : }
+     204             : 
+     205           1 : TEST(testPolarizedSingleModeMagneticField, SimpleTest) {
+     206           1 :         PolarizedSingleModeMagneticField B(2, 4, 0.5, Vector3d(1,1,1), Vector3d(0,1,0), Vector3d(1,0,0), "amplitude", "polarization", "elliptical");
+     207           1 :         Vector3d b = B.getField(Vector3d(1,1,2));
+     208           1 :         EXPECT_DOUBLE_EQ(b.x, 1);
+     209           1 :         EXPECT_NEAR(b.y, 0, 1E-10);
+     210           1 :         EXPECT_NEAR(b.z, 0, 1E-10);
+     211           1 : }
+     212             : 
+     213           1 : int main(int argc, char **argv) {
+     214           1 :         ::testing::InitGoogleTest(&argc, argv);
+     215             :         return RUN_ALL_TESTS();
+     216             : }
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testMagneticLens.cpp.func-sort-c.html b/doc/coverageReport/test/testMagneticLens.cpp.func-sort-c.html new file mode 100644 index 000000000..d114bd5b9 --- /dev/null +++ b/doc/coverageReport/test/testMagneticLens.cpp.func-sort-c.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testMagneticLens.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testMagneticLens.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8787100.0 %
Date:2024-04-08 14:58:22Functions:77100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN28MagneticLens_Deflection_Test8TestBodyEv1
_ZN33Pixelization_angularDistance_Test8TestBodyEv1
_ZN35MagneticLens_OutOfBoundsEnergy_Test8TestBodyEv1
_ZN35MagneticLens_Vector3Deflection_Test8TestBodyEv1
_ZN38ParticleMapsContainer_addParticle_Test8TestBodyEv1
_ZN40Pixelization_randomDirectionInPixel_Test8TestBodyEv1
_ZN45ParticleMapsContainer_getRandomParticles_Test8TestBodyEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testMagneticLens.cpp.func.html b/doc/coverageReport/test/testMagneticLens.cpp.func.html new file mode 100644 index 000000000..8fc41a1d4 --- /dev/null +++ b/doc/coverageReport/test/testMagneticLens.cpp.func.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testMagneticLens.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testMagneticLens.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8787100.0 %
Date:2024-04-08 14:58:22Functions:77100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN28MagneticLens_Deflection_Test8TestBodyEv1
_ZN33Pixelization_angularDistance_Test8TestBodyEv1
_ZN35MagneticLens_OutOfBoundsEnergy_Test8TestBodyEv1
_ZN35MagneticLens_Vector3Deflection_Test8TestBodyEv1
_ZN38ParticleMapsContainer_addParticle_Test8TestBodyEv1
_ZN40Pixelization_randomDirectionInPixel_Test8TestBodyEv1
_ZN45ParticleMapsContainer_getRandomParticles_Test8TestBodyEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testMagneticLens.cpp.gcov.html b/doc/coverageReport/test/testMagneticLens.cpp.gcov.html new file mode 100644 index 000000000..e293783f6 --- /dev/null +++ b/doc/coverageReport/test/testMagneticLens.cpp.gcov.html @@ -0,0 +1,248 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testMagneticLens.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testMagneticLens.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8787100.0 %
Date:2024-04-08 14:58:22Functions:77100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : /// Tests gamale with a test lense from file and demonstrating basic
+       2             : /// usage
+       3             : 
+       4             : //--------------------------------------------
+       5             : // Project: Galactic magnetic Lense (GaMaLe) -
+       6             : // Copyright (C) 2009 Tobias Winchen         -
+       7             : //               RWTH Aachen, Germany        -
+       8             : // Contact: winchen@physik.rwth-achen.de     -
+       9             : // Licensed under the GNU GPL v2             - 
+      10             : //--------------------------------------------
+      11             : 
+      12             : #include <string>
+      13             : #include "gtest/gtest.h"
+      14             : 
+      15             : #include "crpropa/magneticLens/MagneticLens.h"
+      16             : #include "crpropa/magneticLens/ModelMatrix.h"
+      17             : #include "crpropa/magneticLens/Pixelization.h"
+      18             : #include "crpropa/magneticLens/ParticleMapsContainer.h"
+      19             : #include "crpropa/Common.h"
+      20             : 
+      21             : using namespace std;
+      22             : using namespace crpropa;
+      23             : 
+      24           1 : TEST(MagneticLens, Deflection)
+      25             : {
+      26           1 :         MagneticLens magneticLens(5);
+      27           1 :         Pixelization P(5);
+      28           1 :         ModelMatrixType M;
+      29           1 :         M.resize(P.nPix(), P.nPix());
+      30           1 :         M.reserve(P.nPix());
+      31             : 
+      32             :         // Map any direction (p,t) to (p, -t)
+      33       12289 :         for (int i=0;i<P.nPix();i++)
+      34             :         {
+      35             :                 double theta, phi;
+      36       12288 :                 P.pix2Direction(i, phi, theta);
+      37       12288 :                 theta*= -1;
+      38       12288 :                 int j = P.direction2Pix(phi, theta);
+      39       12288 :                 M.insert(i,j) =1;
+      40             :         }
+      41             : 
+      42           1 :         magneticLens.setLensPart(M, 10 * EeV, 100 * EeV);
+      43             : 
+      44       12289 :         for (int i=0; i < P.nPix(); i++)
+      45             :         {
+      46             :                 double theta, phi;
+      47       12288 :                 P.pix2Direction(i, phi, theta);
+      48       12288 :                 double theta0 = theta;
+      49             : 
+      50             :                 // No CR is allowed to be lost in this lens
+      51       12288 :                 EXPECT_TRUE(magneticLens.transformCosmicRay(20 * EeV, phi, theta));
+      52       12288 :                 EXPECT_NEAR(theta+theta0,0., 0.05);
+      53             :         }
+      54           2 : }
+      55             : 
+      56           1 : TEST(MagneticLens, Vector3Deflection)
+      57             : {
+      58           1 :         MagneticLens magneticLens(5);
+      59           1 :         Pixelization P(5);
+      60           1 :         ModelMatrixType M;
+      61           1 :         M.resize(P.nPix(), P.nPix());
+      62           1 :         M.reserve(P.nPix());
+      63             : 
+      64             :         // No deflection 
+      65       12289 :         for (int i=0;i<P.nPix();i++)
+      66             :         {
+      67       12288 :                 M.insert(i,i) = 1;
+      68             :         }
+      69             : 
+      70           1 :         magneticLens.setLensPart(M, 10 * EeV, 100 * EeV);
+      71             : 
+      72             :         Vector3d u(1,0,0);
+      73             :         Vector3d v(u);
+      74           1 :         EXPECT_TRUE(magneticLens.transformCosmicRay(20 * EeV, v));
+      75           1 :         EXPECT_NEAR(u.getAngleTo(v), 0., 2. / 180 * M_PI);
+      76             : 
+      77           1 :         u.x = 0; u.y = 1; u.z = 0; v = u;
+      78           1 :         EXPECT_TRUE(magneticLens.transformCosmicRay(20 * EeV, v));
+      79           1 :         EXPECT_NEAR(u.getAngleTo(v), 0., 2. / 180 * M_PI);
+      80             : 
+      81           1 :         u.x = 0; u.y = 0; u.z = 1; v = u;
+      82           1 :         EXPECT_TRUE(magneticLens.transformCosmicRay(20 * EeV, v));
+      83           1 :         EXPECT_NEAR(u.getAngleTo(v), 0., 2. / 180 * M_PI);
+      84             : 
+      85           1 :         u.x = 1; u.y = -2; u.z = 3; v = u;
+      86           1 :         EXPECT_TRUE(magneticLens.transformCosmicRay(20 * EeV, v));
+      87           1 :         EXPECT_NEAR(u.getAngleTo(v), 0., 2. / 180 * M_PI);
+      88           2 : }
+      89             : 
+      90           1 : TEST(MagneticLens, OutOfBoundsEnergy)
+      91             : {
+      92           1 :         MagneticLens magneticLens(5);
+      93           1 :         Pixelization P(5);
+      94           1 :         ModelMatrixType M;
+      95           1 :         M.resize(P.nPix(), P.nPix());
+      96           1 :         M.reserve(P.nPix());
+      97           1 :         magneticLens.setLensPart(M,10. * EeV, 100. * EeV);
+      98           1 :         double theta = 0, phi = 0;
+      99           1 :         EXPECT_FALSE(magneticLens.transformCosmicRay(1. * EeV, phi, theta));
+     100           2 : }
+     101             : 
+     102             : 
+     103           1 : TEST(Pixelization, angularDistance)
+     104             : {
+     105             :         // test for correct angular distance in case of same vectors 
+     106           1 :         Pixelization P(6);
+     107       49153 :         for (int idx =0; idx < P.nPix(); idx++)
+     108             :         {
+     109       49152 :                 double ang = P.angularDistance(idx,idx);
+     110       49152 :                 EXPECT_TRUE(ang == ang);
+     111             :         }
+     112           1 : }
+     113             : 
+     114             : 
+     115           1 : TEST(ParticleMapsContainer, addParticle)
+     116             : {
+     117           1 :   ParticleMapsContainer maps;
+     118           1 :   maps.addParticle(1000010010, 1 * EeV, 0 , 0 );
+     119           1 :   std::vector<int> pids = maps.getParticleIds();
+     120           1 :   EXPECT_EQ(pids.size(), 1);
+     121           1 :   EXPECT_EQ(pids[0], 1000010010);
+     122             : 
+     123           1 :   std::vector<double> energies = maps.getEnergies(1000010010);
+     124           1 :   EXPECT_EQ(energies.size(), 1);
+     125           1 : }
+     126             : 
+     127           1 : TEST(ParticleMapsContainer, getRandomParticles)
+     128             : {
+     129           1 :   ParticleMapsContainer maps(0.002);
+     130           1 :   maps.addParticle(1000010010, 1 * EeV, 0 , 0 );
+     131             :   std::vector<double> energies;
+     132             :   std::vector<double> lons;
+     133             :   std::vector<double> lats;
+     134             :   std::vector<int> particleIds;
+     135             : 
+     136           1 :   size_t N = 420;
+     137           1 :         maps.getRandomParticles(N, particleIds, energies, lons, lats);
+     138             :                         
+     139           1 :   EXPECT_EQ(energies.size(), N);
+     140           1 :   EXPECT_EQ(lons.size(), N);
+     141           1 :   EXPECT_EQ(lats.size(), N);
+     142           1 :   EXPECT_EQ(particleIds.size(), N);
+     143             : 
+     144         421 :   for(size_t i = 0; i < N; i++)
+     145             :   {
+     146         420 :     EXPECT_NEAR(log10(energies[i]), 18, 0.002);
+     147         420 :     EXPECT_EQ(particleIds[i], 1000010010);
+     148         420 :     EXPECT_NEAR(lons[i], 0, 2./180*M_PI);
+     149         420 :     EXPECT_NEAR(lats[i], 0, 2./180*M_PI);
+     150             :   }
+     151             : 
+     152           1 : }
+     153             : 
+     154           1 : TEST(Pixelization, randomDirectionInPixel)
+     155             : {
+     156           1 :   Pixelization p(6);
+     157             :   const double long0 = -35./180 * M_PI;
+     158             :   const double lat0 =  12.08/180 * M_PI;
+     159             : 
+     160           1 :   int pix = p.direction2Pix(long0, lat0);
+     161             : 
+     162             :   double rlon, rlat;
+     163           1 :   p.getRandomDirectionInPixel(pix, rlon, rlat);
+     164             : 
+     165             :   // new direction should be inside the pixel
+     166           1 :   EXPECT_EQ(pix, p.direction2Pix(rlon, rlat));
+     167             : 
+     168             :   // new direction should be different from input 
+     169           1 :   EXPECT_FALSE(long0 == rlon);
+     170           1 :   EXPECT_FALSE(lat0 == rlat);
+     171             : 
+     172           1 : }
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testModuleList.cpp.func-sort-c.html b/doc/coverageReport/test/testModuleList.cpp.func-sort-c.html new file mode 100644 index 000000000..923a232e2 --- /dev/null +++ b/doc/coverageReport/test/testModuleList.cpp.func-sort-c.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testModuleList.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testModuleList.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:525594.5 %
Date:2024-04-08 14:58:22Functions:6785.7 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa4mainEiPPc0
_ZN7crpropa23ModuleList_process_Test8TestBodyEv1
_ZN7crpropa25ModuleList_getModule_Test8TestBodyEv1
_ZN7crpropa25ModuleList_runOpenMP_Test8TestBodyEv1
_ZN7crpropa25ModuleList_runSource_Test8TestBodyEv1
_ZN7crpropa28ModuleList_removeModule_Test8TestBodyEv1
_ZN7crpropa32ModuleList_runCandidateList_Test8TestBodyEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testModuleList.cpp.func.html b/doc/coverageReport/test/testModuleList.cpp.func.html new file mode 100644 index 000000000..1ac5ff9e1 --- /dev/null +++ b/doc/coverageReport/test/testModuleList.cpp.func.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testModuleList.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testModuleList.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:525594.5 %
Date:2024-04-08 14:58:22Functions:6785.7 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa23ModuleList_process_Test8TestBodyEv1
_ZN7crpropa25ModuleList_getModule_Test8TestBodyEv1
_ZN7crpropa25ModuleList_runOpenMP_Test8TestBodyEv1
_ZN7crpropa25ModuleList_runSource_Test8TestBodyEv1
_ZN7crpropa28ModuleList_removeModule_Test8TestBodyEv1
_ZN7crpropa32ModuleList_runCandidateList_Test8TestBodyEv1
_ZN7crpropa4mainEiPPc0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testModuleList.cpp.gcov.html b/doc/coverageReport/test/testModuleList.cpp.gcov.html new file mode 100644 index 000000000..63abd27da --- /dev/null +++ b/doc/coverageReport/test/testModuleList.cpp.gcov.html @@ -0,0 +1,155 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testModuleList.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testModuleList.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:525594.5 %
Date:2024-04-08 14:58:22Functions:6785.7 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/ModuleList.h"
+       2             : #include "crpropa/Source.h"
+       3             : #include "crpropa/ParticleID.h"
+       4             : #include "crpropa/module/SimplePropagation.h"
+       5             : #include "crpropa/module/BreakCondition.h"
+       6             : 
+       7             : #include "gtest/gtest.h"
+       8             : 
+       9             : namespace crpropa {
+      10             : 
+      11           1 : TEST(ModuleList, process) {
+      12           1 :         ModuleList modules;
+      13           2 :         modules.add(new SimplePropagation());
+      14           1 :         ParticleState initial;
+      15           1 :         ref_ptr<Candidate> candidate = new Candidate(initial);
+      16           2 :         modules.process(candidate);
+      17           1 : }
+      18             : 
+      19           1 : TEST(ModuleList, getModule) {
+      20           1 :         ModuleList modules;
+      21           1 :         ref_ptr<SimplePropagation> prop = new SimplePropagation();
+      22           1 :         modules.add(prop);
+      23           2 :         EXPECT_TRUE(modules[0] == prop);
+      24           1 : }
+      25             : 
+      26           1 : TEST(ModuleList, removeModule) {
+      27           1 :         ModuleList modules;
+      28           1 :         ref_ptr<SimplePropagation> prop = new SimplePropagation();
+      29           1 :         modules.add(prop);
+      30           1 :         modules.remove(0);
+      31           1 :         EXPECT_EQ(modules.size(), 0);
+      32           1 : }
+      33             : 
+      34           1 : TEST(ModuleList, runCandidateList) {
+      35           1 :         ModuleList modules;
+      36           2 :         modules.add(new SimplePropagation());
+      37           1 :         modules.add(new MaximumTrajectoryLength(1 * Mpc));
+      38           1 :         ParticleState initial;
+      39           1 :         ref_ptr<Candidate> candidate = new Candidate(initial);
+      40           1 :         modules.run(candidate);
+      41           1 :         EXPECT_DOUBLE_EQ(1 * Mpc, candidate->getTrajectoryLength());
+      42           1 :         EXPECT_TRUE(candidate->isActive() == false);
+      43           1 : }
+      44             : 
+      45           1 : TEST(ModuleList, runSource) {
+      46           1 :         ModuleList modules;
+      47           2 :         modules.add(new SimplePropagation());
+      48           1 :         modules.add(new MaximumTrajectoryLength(1 * Mpc));
+      49             :         Source source;
+      50           1 :         source.add(new SourcePosition(Vector3d(10, 0, 0) * Mpc));
+      51           2 :         source.add(new SourceIsotropicEmission());
+      52           1 :         source.add(new SourcePowerLawSpectrum(5 * EeV, 100 * EeV, -2));
+      53           1 :         source.add(new SourceParticleType(nucleusId(1, 1)));
+      54           1 :         modules.setShowProgress(true);
+      55           1 :         modules.run(&source, 100, false);
+      56           1 : }
+      57             : 
+      58             : #if _OPENMP
+      59             : #include <omp.h>
+      60           1 : TEST(ModuleList, runOpenMP) {
+      61           1 :         ModuleList modules;
+      62           2 :         modules.add(new SimplePropagation());
+      63           1 :         modules.add(new MaximumTrajectoryLength(1 * Mpc));
+      64             :         Source source;
+      65           1 :         source.add(new SourcePosition(Vector3d(10, 0, 0) * Mpc));
+      66           2 :         source.add(new SourceIsotropicEmission());
+      67           1 :         source.add(new SourcePowerLawSpectrum(5 * EeV, 100 * EeV, -2));
+      68           1 :         source.add(new SourceParticleType(nucleusId(1, 1)));
+      69           1 :         omp_set_num_threads(2);
+      70           1 :         modules.run(&source, 1000, false);
+      71           1 : }
+      72             : #endif
+      73             : 
+      74           0 : int main(int argc, char **argv) {
+      75           0 :         ::testing::InitGoogleTest(&argc, argv);
+      76           0 :         return RUN_ALL_TESTS();
+      77             : }
+      78             : 
+      79             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testOutput.cpp.func-sort-c.html b/doc/coverageReport/test/testOutput.cpp.func-sort-c.html new file mode 100644 index 000000000..f1f61fe38 --- /dev/null +++ b/doc/coverageReport/test/testOutput.cpp.func-sort-c.html @@ -0,0 +1,144 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testOutput.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testOutput.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:15716296.9 %
Date:2024-04-08 14:58:22Functions:171894.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa4mainEiPPc0
_Z11ArraysMatchIiLm10EEN7testing15AssertionResultERAT0__KT_S5_1
_ZN7crpropa16Output_size_Test8TestBodyEv1
_ZN7crpropa27ParticleCollector_size_Test8TestBodyEv1
_ZN7crpropa29TextOutput_printProperty_Test8TestBodyEv1
_ZN7crpropa31ParticleCollector_dumpload_Test8TestBodyEv1
_ZN7crpropa32ParticleCollector_fetchItem_Test8TestBodyEv1
_ZN7crpropa32ParticleCollector_reprocess_Test8TestBodyEv1
_ZN7crpropa34TextOutput_printHeader_Custom_Test8TestBodyEv1
_ZN7crpropa35TextOutput_printHeader_Event1D_Test8TestBodyEv1
_ZN7crpropa35TextOutput_printHeader_Event3D_Test8TestBodyEv1
_ZN7crpropa35TextOutput_printHeader_Version_Test8TestBodyEv1
_ZN7crpropa36ParticleCollector_getTrajectory_Test8TestBodyEv1
_ZN7crpropa36ParticleCollector_runModuleList_Test8TestBodyEv1
_ZN7crpropa39HDF5Output_failOnIllegalOutputFile_Test8TestBodyEv1
_ZN7crpropa39TextOutput_failOnIllegalOutputFile_Test8TestBodyEv1
_ZN7crpropa40TextOutput_printHeader_Trajectory1D_Test8TestBodyEv1
_ZN7crpropa40TextOutput_printHeader_Trajectory3D_Test8TestBodyEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testOutput.cpp.func.html b/doc/coverageReport/test/testOutput.cpp.func.html new file mode 100644 index 000000000..9920b9d67 --- /dev/null +++ b/doc/coverageReport/test/testOutput.cpp.func.html @@ -0,0 +1,144 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testOutput.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testOutput.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:15716296.9 %
Date:2024-04-08 14:58:22Functions:171894.4 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_Z11ArraysMatchIiLm10EEN7testing15AssertionResultERAT0__KT_S5_1
_ZN7crpropa16Output_size_Test8TestBodyEv1
_ZN7crpropa27ParticleCollector_size_Test8TestBodyEv1
_ZN7crpropa29TextOutput_printProperty_Test8TestBodyEv1
_ZN7crpropa31ParticleCollector_dumpload_Test8TestBodyEv1
_ZN7crpropa32ParticleCollector_fetchItem_Test8TestBodyEv1
_ZN7crpropa32ParticleCollector_reprocess_Test8TestBodyEv1
_ZN7crpropa34TextOutput_printHeader_Custom_Test8TestBodyEv1
_ZN7crpropa35TextOutput_printHeader_Event1D_Test8TestBodyEv1
_ZN7crpropa35TextOutput_printHeader_Event3D_Test8TestBodyEv1
_ZN7crpropa35TextOutput_printHeader_Version_Test8TestBodyEv1
_ZN7crpropa36ParticleCollector_getTrajectory_Test8TestBodyEv1
_ZN7crpropa36ParticleCollector_runModuleList_Test8TestBodyEv1
_ZN7crpropa39HDF5Output_failOnIllegalOutputFile_Test8TestBodyEv1
_ZN7crpropa39TextOutput_failOnIllegalOutputFile_Test8TestBodyEv1
_ZN7crpropa40TextOutput_printHeader_Trajectory1D_Test8TestBodyEv1
_ZN7crpropa40TextOutput_printHeader_Trajectory3D_Test8TestBodyEv1
_ZN7crpropa4mainEiPPc0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testOutput.cpp.gcov.html b/doc/coverageReport/test/testOutput.cpp.gcov.html new file mode 100644 index 000000000..3a91eb777 --- /dev/null +++ b/doc/coverageReport/test/testOutput.cpp.gcov.html @@ -0,0 +1,355 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testOutput.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testOutput.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:15716296.9 %
Date:2024-04-08 14:58:22Functions:171894.4 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : /** Unit tests for Output modules of CRPropa
+       2             :     Output
+       3             :     TextOutput
+       4             :     ParticleCollector
+       5             :  */
+       6             : 
+       7             : #include "CRPropa.h"
+       8             : 
+       9             : #include "gtest/gtest.h"
+      10             : #include <iostream>
+      11             : #include <string>
+      12             : 
+      13             : 
+      14             : #ifdef CRPROPA_HAVE_HDF5
+      15             : #include <hdf5.h>
+      16             : #endif
+      17             : 
+      18             : // compare two arrays (intead of using Google Mock)
+      19             : // https://stackoverflow.com/a/10062016/6819103
+      20             : template <typename T, size_t size>
+      21           1 : ::testing::AssertionResult ArraysMatch(const T (&expected)[size],
+      22             :                                        const T (&actual)[size]) {
+      23          11 :         for (size_t i(0); i < size; ++i) {
+      24          10 :                 if (expected[i] != actual[i]) {
+      25             :                         return ::testing::AssertionFailure()
+      26           0 :                                << "array[" << i << "] (" << actual[i] << ") != expected["
+      27           0 :                                << i << "] (" << expected[i] << ")";
+      28             :                 }
+      29             :         }
+      30             : 
+      31           1 :         return ::testing::AssertionSuccess();
+      32             : }
+      33             : 
+      34             : namespace crpropa {
+      35             : 
+      36             : //-- Output
+      37           1 : TEST(Output, size) {
+      38           1 :         Candidate c;
+      39           1 :         Output output;
+      40           6 :         for (int it = 0; it < 5; ++it, output.process(&c));
+      41             : 
+      42           1 :         EXPECT_EQ(output.size(), 5);
+      43           1 : }
+      44             : 
+      45             : //-- TextOutput
+      46           1 : TEST(TextOutput, printHeader_Trajectory1D) {
+      47           1 :         Candidate c;
+      48           1 :         TextOutput output(Output::Trajectory1D);
+      49             : 
+      50           1 :         ::testing::internal::CaptureStdout();
+      51           1 :         output.process(&c);
+      52           1 :         std::string captured = testing::internal::GetCapturedStdout();
+      53             : 
+      54           2 :         EXPECT_EQ(captured.substr(0, captured.find("\n")), "#\tID\tE\tX");
+      55           1 : }
+      56             : 
+      57           1 : TEST(TextOutput, printHeader_Event1D) {
+      58           1 :         Candidate c;
+      59           1 :         TextOutput output(Output::Event1D);
+      60             : 
+      61           1 :         ::testing::internal::CaptureStdout();
+      62           1 :         output.process(&c);
+      63           1 :         std::string captured = testing::internal::GetCapturedStdout();
+      64             : 
+      65           2 :         EXPECT_EQ(captured.substr(0, captured.find("\n")), "#\tD\tID\tE\tID0\tE0");
+      66           1 : }
+      67             : 
+      68           1 : TEST(TextOutput, printHeader_Trajectory3D) {
+      69           1 :         Candidate c;
+      70           1 :         TextOutput output(Output::Trajectory3D);
+      71             : 
+      72           1 :         ::testing::internal::CaptureStdout();
+      73           1 :         output.process(&c);
+      74           1 :         std::string captured = testing::internal::GetCapturedStdout();
+      75             : 
+      76           2 :         EXPECT_EQ(captured.substr(0, captured.find("\n")),
+      77             :                   "#\tD\tID\tE\tX\tY\tZ\tPx\tPy\tPz");
+      78           1 : }
+      79             : 
+      80           1 : TEST(TextOutput, printHeader_Event3D) {
+      81           1 :         Candidate c;
+      82           1 :         TextOutput output(Output::Event3D);
+      83             : 
+      84           1 :         ::testing::internal::CaptureStdout();
+      85           1 :         output.process(&c);
+      86           1 :         std::string captured = testing::internal::GetCapturedStdout();
+      87             : 
+      88           2 :         EXPECT_EQ(
+      89             :             captured.substr(0, captured.find("\n")),
+      90             :             "#\tD\tID\tE\tX\tY\tZ\tPx\tPy\tPz\tID0\tE0\tX0\tY0\tZ0\tP0x\tP0y\tP0z");
+      91           1 : }
+      92             : 
+      93           1 : TEST(TextOutput, printHeader_Custom) {
+      94           1 :         Candidate c;
+      95           1 :         TextOutput output(Output::Event1D);
+      96             : 
+      97           1 :         output.enable(Output::SerialNumberColumn);
+      98           1 :         output.disable(Output::TrajectoryLengthColumn);
+      99           1 :         output.set(Output::RedshiftColumn, false);
+     100           1 :         output.enable(Output::CandidateTagColumn);
+     101             : 
+     102           1 :         ::testing::internal::CaptureStdout();
+     103           1 :         output.process(&c);
+     104           1 :         std::string captured = testing::internal::GetCapturedStdout();
+     105             : 
+     106           2 :         EXPECT_EQ(captured.substr(0, captured.find("\n")),
+     107             :                   "#\tSN\tID\tE\tSN0\tID0\tE0\tSN1\ttag");
+     108           1 : }
+     109             : 
+     110           1 : TEST(TextOutput, printProperty) {
+     111           1 :         Candidate c;
+     112           1 :         TextOutput output(Output::Event1D);
+     113           1 :         output.disableAll();
+     114           2 :         output.enableProperty("foo", 2.0, "Bar");
+     115             : 
+     116           1 :         ::testing::internal::CaptureStdout();
+     117           1 :         output.process(&c);
+     118           1 :         std::string captured = testing::internal::GetCapturedStdout();
+     119             : 
+     120             :         // name in first line of header
+     121           2 :         EXPECT_EQ(captured.substr(0, captured.find("\n")), "#\tfoo");
+     122           1 : }
+     123             : 
+     124           1 : TEST(TextOutput, printHeader_Version) {
+     125           1 :         Candidate c;
+     126           1 :         TextOutput output(Output::Event1D);
+     127             : 
+     128           1 :         ::testing::internal::CaptureStdout();
+     129           1 :         output.process(&c);
+     130           1 :         std::string captured = testing::internal::GetCapturedStdout();
+     131             : 
+     132             :         // length of the prefix is 19 chars
+     133           1 :         size_t version_pos = captured.find("# CRPropa version: ") + 19;
+     134             : 
+     135           2 :         EXPECT_EQ(captured.substr(version_pos,
+     136             :                                   captured.find("\n", version_pos) - version_pos),
+     137             :                   g_GIT_DESC);
+     138           1 : }
+     139             : 
+     140             : #ifndef CRPROPA_TESTS_SKIP_EXCEPTIONS
+     141           1 : TEST(TextOutput, failOnIllegalOutputFile) {
+     142           2 :         EXPECT_THROW(
+     143             :             TextOutput output("THIS_FOLDER_MUST_NOT_EXISTS_12345+/FILE.txt"),
+     144             :             std::runtime_error);
+     145           1 : }
+     146             : #endif
+     147             : 
+     148             : #ifdef CRPROPA_HAVE_HDF5
+     149             : #ifndef CRPROPA_TESTS_SKIP_EXCEPTIONS
+     150           1 : TEST(HDF5Output, failOnIllegalOutputFile) {
+     151           1 :         HDF5Output out;
+     152             :         // disable default error output of HDF5
+     153           1 :         H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+     154           2 :         EXPECT_THROW(out.open("THIS_FOLDER_MUST_NOT_EXISTS_12345+/FILE.h5"),
+     155             :                      std::runtime_error);
+     156           1 : }
+     157             : #endif
+     158             : #endif
+     159             : 
+     160             : //-- ParticleCollector
+     161           2 : TEST(ParticleCollector, size) {
+     162           2 :         ref_ptr<Candidate> c = new Candidate();
+     163           1 :         ParticleCollector output;
+     164             : 
+     165           6 :         for (int it = 0; it < 5; ++it, output.process(c))
+     166             :                 ;
+     167             : 
+     168           1 :         EXPECT_EQ(output.size(), 5);
+     169           2 : }
+     170             : 
+     171           1 : TEST(ParticleCollector, fetchItem) {
+     172           2 :         ref_ptr<Candidate> c = new Candidate(nucleusId(1, 1), 1 * EeV);
+     173           1 :         ParticleCollector output;
+     174             : 
+     175           1 :         output.process(c);
+     176             : 
+     177           2 :         EXPECT_EQ(output[0], c);
+     178           2 : }
+     179             : 
+     180           1 : TEST(ParticleCollector, reprocess) {
+     181           2 :         ref_ptr<Candidate> c = new Candidate(nucleusId(1, 1), 1 * EeV);
+     182           1 :         ParticleCollector collector;
+     183           1 :         ParticleCollector output;
+     184             : 
+     185           1 :         collector.process(c);
+     186           1 :         collector.reprocess(&output);
+     187             : 
+     188           2 :         EXPECT_EQ(output[0], c);
+     189           2 : }
+     190             : 
+     191           1 : TEST(ParticleCollector, dumpload) {
+     192           2 :         ref_ptr<Candidate> c = new Candidate(nucleusId(1, 1), 1.234 * EeV);
+     193           1 :         c->current.setPosition(Vector3d(1, 2, 3));
+     194           1 :         c->current.setDirection(Vector3d(-1, -1, -1));
+     195           1 :         c->setTrajectoryLength(1 * Mpc);
+     196           1 :         c->setRedshift(2);
+     197             : 
+     198           1 :         ParticleCollector input;
+     199           1 :         ParticleCollector output;
+     200             : 
+     201          12 :         for (int i = 0; i <= 10; ++i) {
+     202          22 :                 input.process(c);
+     203             :         }
+     204             : 
+     205             :         // Well, it would be nicer if we don't need to receate any file
+     206           1 :         input.dump("ParticleCollector_DumpTest.txt");
+     207           1 :         output.load("ParticleCollector_DumpTest.txt");
+     208             : 
+     209           1 :         EXPECT_EQ(input.size(), output.size());
+     210           2 :         EXPECT_EQ(output[0]->current.getEnergy(), c->current.getEnergy());
+     211           2 :         EXPECT_EQ(output[1]->getTrajectoryLength(), c->getTrajectoryLength());
+     212           2 :         EXPECT_EQ(output[2]->current.getId(), c->current.getId());
+     213           2 :         EXPECT_EQ(output[3]->getRedshift(), c->getRedshift());
+     214           2 : }
+     215             : 
+     216             : // Just test if the trajectory is on a line for rectilinear propagation
+     217           1 : TEST(ParticleCollector, getTrajectory) {
+     218             :         int pos_x[10];
+     219           1 :         int pos_x_expected[] = {9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
+     220             : 
+     221           1 :         ParticleState p;
+     222           1 :         p.setPosition(Vector3d(10, 0, 0));
+     223           1 :         p.setDirection(Vector3d(-1, 0, 0));
+     224           1 :         ref_ptr<Candidate> c = new Candidate(p);
+     225             : 
+     226           1 :         ref_ptr<ParticleCollector> output = new ParticleCollector();
+     227           1 :         ref_ptr<ParticleCollector> trajectory = new ParticleCollector();
+     228           1 :         trajectory->setClone(true);
+     229             : 
+     230           1 :         ref_ptr<ModuleList> sim = new ModuleList();
+     231           1 :         sim->add(new SimplePropagation(1, 1));
+     232             : 
+     233           1 :         ref_ptr<Observer> obs = new Observer();
+     234           1 :         obs->add(new Observer1D());
+     235           1 :         obs->onDetection(output);
+     236           1 :         sim->add(obs);
+     237             : 
+     238           2 :         sim->run(c);
+     239             : 
+     240           2 :         output->getTrajectory(sim, 0, trajectory);
+     241             : 
+     242             :         Vector3d pos;
+     243             :         int i = 0;
+     244             : 
+     245           1 :         for (ParticleCollector::iterator itr = trajectory->begin();
+     246          11 :              itr != trajectory->end(); ++itr) {
+     247          10 :                 pos = (*(itr->get())).current.getPosition();
+     248          10 :                 pos_x[i] = pos.getX();
+     249          10 :                 ++i;
+     250             :         }
+     251             : 
+     252           1 :         EXPECT_TRUE(ArraysMatch(pos_x_expected, pos_x));
+     253           1 : }
+     254             : 
+     255           1 : TEST(ParticleCollector, runModuleList) {
+     256           1 :         ModuleList modules;
+     257           2 :         modules.add(new SimplePropagation());
+     258           1 :         modules.add(new MaximumTrajectoryLength(1 * Mpc));
+     259             : 
+     260           1 :         ParticleState p;
+     261           1 :         p.setPosition(Vector3d(10, 0, 0));
+     262           1 :         p.setDirection(Vector3d(-1, 0, 0));
+     263           1 :         ref_ptr<Candidate> c = new Candidate(p);
+     264             : 
+     265           1 :         ref_ptr<ParticleCollector> collector = new ParticleCollector();
+     266             : 
+     267           1 :         collector->process(c);
+     268             : 
+     269           1 :         modules.setShowProgress(false);
+     270           1 :         auto candidates = collector->getContainer();
+     271           1 :         modules.run(&candidates);
+     272           2 : }
+     273             : 
+     274           0 : int main(int argc, char **argv) {
+     275           0 :         ::testing::InitGoogleTest(&argc, argv);
+     276           0 :         return RUN_ALL_TESTS();
+     277             : }
+     278             : 
+     279             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testPropagation.cpp.func-sort-c.html b/doc/coverageReport/test/testPropagation.cpp.func-sort-c.html new file mode 100644 index 000000000..15ff4021f --- /dev/null +++ b/doc/coverageReport/test/testPropagation.cpp.func-sort-c.html @@ -0,0 +1,148 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testPropagation.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testPropagation.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:33734099.1 %
Date:2024-04-08 14:58:22Functions:181994.7 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa4mainEiPPc0
_ZN7crpropa29testPropagationBP_proton_Test8TestBodyEv1
_ZN7crpropa29testPropagationCK_proton_Test8TestBodyEv1
_ZN7crpropa30testPropagationBP_neutron_Test8TestBodyEv1
_ZN7crpropa30testPropagationCK_neutron_Test8TestBodyEv1
_ZN7crpropa31testPropagationBP_gyration_Test8TestBodyEv1
_ZN7crpropa31testPropagationCK_gyration_Test8TestBodyEv1
_ZN7crpropa31testSimplePropagation_step_Test8TestBodyEv1
_ZN7crpropa32testPropagationBP_zeroField_Test8TestBodyEv1
_ZN7crpropa32testPropagationCK_zeroField_Test8TestBodyEv1
_ZN7crpropa33testPropagationBP_exceptions_Test8TestBodyEv1
_ZN7crpropa33testPropagationBP_reduceStep_Test8TestBodyEv1
_ZN7crpropa33testPropagationCK_exceptions_Test8TestBodyEv1
_ZN7crpropa33testPropagationCK_reduceStep_Test8TestBodyEv1
_ZN7crpropa34testPropagationBP_constructor_Test8TestBodyEv1
_ZN7crpropa34testPropagationCK_constructor_Test8TestBodyEv1
_ZN7crpropa35testPropagationBP_increaseStep_Test8TestBodyEv1
_ZN7crpropa35testPropagationCK_increaseStep_Test8TestBodyEv1
_ZN7crpropa44testPropagationBP_fixedStepOptimization_Test8TestBodyEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testPropagation.cpp.func.html b/doc/coverageReport/test/testPropagation.cpp.func.html new file mode 100644 index 000000000..586d6fcc2 --- /dev/null +++ b/doc/coverageReport/test/testPropagation.cpp.func.html @@ -0,0 +1,148 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testPropagation.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testPropagation.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:33734099.1 %
Date:2024-04-08 14:58:22Functions:181994.7 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa29testPropagationBP_proton_Test8TestBodyEv1
_ZN7crpropa29testPropagationCK_proton_Test8TestBodyEv1
_ZN7crpropa30testPropagationBP_neutron_Test8TestBodyEv1
_ZN7crpropa30testPropagationCK_neutron_Test8TestBodyEv1
_ZN7crpropa31testPropagationBP_gyration_Test8TestBodyEv1
_ZN7crpropa31testPropagationCK_gyration_Test8TestBodyEv1
_ZN7crpropa31testSimplePropagation_step_Test8TestBodyEv1
_ZN7crpropa32testPropagationBP_zeroField_Test8TestBodyEv1
_ZN7crpropa32testPropagationCK_zeroField_Test8TestBodyEv1
_ZN7crpropa33testPropagationBP_exceptions_Test8TestBodyEv1
_ZN7crpropa33testPropagationBP_reduceStep_Test8TestBodyEv1
_ZN7crpropa33testPropagationCK_exceptions_Test8TestBodyEv1
_ZN7crpropa33testPropagationCK_reduceStep_Test8TestBodyEv1
_ZN7crpropa34testPropagationBP_constructor_Test8TestBodyEv1
_ZN7crpropa34testPropagationCK_constructor_Test8TestBodyEv1
_ZN7crpropa35testPropagationBP_increaseStep_Test8TestBodyEv1
_ZN7crpropa35testPropagationCK_increaseStep_Test8TestBodyEv1
_ZN7crpropa44testPropagationBP_fixedStepOptimization_Test8TestBodyEv1
_ZN7crpropa4mainEiPPc0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testPropagation.cpp.gcov.html b/doc/coverageReport/test/testPropagation.cpp.gcov.html new file mode 100644 index 000000000..f3e80ad45 --- /dev/null +++ b/doc/coverageReport/test/testPropagation.cpp.gcov.html @@ -0,0 +1,632 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testPropagation.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testPropagation.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:33734099.1 %
Date:2024-04-08 14:58:22Functions:181994.7 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/Candidate.h"
+       2             : #include "crpropa/ParticleID.h"
+       3             : #include "crpropa/module/SimplePropagation.h"
+       4             : #include "crpropa/module/PropagationBP.h"
+       5             : #include "crpropa/module/PropagationCK.h"
+       6             : #include "crpropa/magneticField/turbulentField/PlaneWaveTurbulence.h"
+       7             : 
+       8             : #include "gtest/gtest.h"
+       9             : 
+      10             : #include <string>
+      11             : #include <iostream>
+      12             : 
+      13             : namespace crpropa {
+      14             : 
+      15           1 : TEST(testSimplePropagation, step) {
+      16           1 :         double minStep = 20;
+      17           1 :         double maxStep = 100;
+      18           1 :         SimplePropagation propa(minStep, maxStep);
+      19             : 
+      20           1 :         ParticleState p;
+      21           1 :         p.setPosition(Vector3d(0, 0, 0));
+      22           1 :         p.setDirection(Vector3d(0, 1, 0));
+      23             : 
+      24           1 :         Candidate c(p);
+      25           1 :         c.setNextStep(10);
+      26             : 
+      27           1 :         propa.process(&c);
+      28             : 
+      29           1 :         EXPECT_EQ(minStep, c.getCurrentStep());
+      30           1 :         EXPECT_EQ(maxStep, c.getNextStep());
+      31           2 :         EXPECT_EQ(Vector3d(0,  0, 0), c.created.getPosition());
+      32           2 :         EXPECT_EQ(Vector3d(0,  1, 0), c.created.getDirection());
+      33           2 :         EXPECT_EQ(Vector3d(0,  0, 0), c.previous.getPosition());
+      34           2 :         EXPECT_EQ(Vector3d(0,  1, 0), c.previous.getDirection());
+      35           2 :         EXPECT_EQ(Vector3d(0, 20, 0), c.current.getPosition());
+      36           2 :         EXPECT_EQ(Vector3d(0,  1, 0), c.current.getDirection());
+      37           2 : }
+      38             : 
+      39             : 
+      40           1 : TEST(testPropagationCK, zeroField) {
+      41           1 :         PropagationCK propa(new UniformMagneticField(Vector3d(0, 0, 0)));
+      42             : 
+      43             :         double minStep = 0.1 * kpc;
+      44           1 :         propa.setMinimumStep(minStep);
+      45             : 
+      46           1 :         ParticleState p;
+      47           1 :         p.setId(nucleusId(1, 1));
+      48           1 :         p.setEnergy(100 * EeV);
+      49           1 :         p.setPosition(Vector3d(0, 0, 0));
+      50           1 :         p.setDirection(Vector3d(0, 1, 0));
+      51           1 :         Candidate c(p);
+      52           1 :         c.setNextStep(0);
+      53             : 
+      54           1 :         propa.process(&c);
+      55             : 
+      56           1 :         EXPECT_DOUBLE_EQ(minStep, c.getCurrentStep());  // perform minimum step
+      57           1 :         EXPECT_DOUBLE_EQ(5 * minStep, c.getNextStep());  // acceleration by factor 5
+      58           1 : }
+      59             : 
+      60             : #ifndef CRPROPA_TESTS_SKIP_EXCEPTIONS
+      61           1 : TEST(testPropagationCK, exceptions) {
+      62             :         // minStep should be smaller than maxStep
+      63           2 :         EXPECT_THROW(PropagationCK propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)), 0.42, 10 , 0), std::runtime_error);
+      64             :         // Too large tolerance: tolerance should be between 0 and 1
+      65           2 :         EXPECT_THROW(PropagationCK propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)), 42., 10 * kpc , 20 * kpc), std::runtime_error);
+      66             : 
+      67           2 :         PropagationCK propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)));
+      68             : 
+      69             :         // set maximum step, so that it can be tested what happens if a larger minStep is set.
+      70           1 :         propa.setMaximumStep(1 * Mpc);
+      71             : 
+      72             :         // this tests _that_ the expected exception is thrown
+      73           1 :         EXPECT_THROW(propa.setTolerance(2.), std::runtime_error);
+      74           1 :         EXPECT_THROW(propa.setMinimumStep(-1.), std::runtime_error);
+      75           1 :         EXPECT_THROW(propa.setMinimumStep(2 * Mpc), std::runtime_error);
+      76             : 
+      77             :         // set minimum step, so that it can be tested what happens if a smaller maxStep is set.
+      78           1 :         propa.setMinimumStep(0.5 * Mpc);
+      79             : 
+      80           1 :         EXPECT_THROW(propa.setMaximumStep(0.1 * Mpc), std::runtime_error);
+      81           1 : }
+      82             : #endif
+      83             : 
+      84           1 : TEST(testPropagationCK, constructor) {
+      85             :         // Test construction and parameters
+      86           1 :         ref_ptr<MagneticField> bField = new UniformMagneticField(Vector3d(0, 0, 1 * nG));
+      87             : 
+      88           1 :         double minStep = 1.;
+      89           1 :         double maxStep = 100.;
+      90           1 :         double tolerance = 0.01;
+      91             : 
+      92           1 :         PropagationCK propa(bField, tolerance, minStep, maxStep);
+      93             : 
+      94           1 :         EXPECT_EQ(minStep, propa.getMinimumStep());
+      95           1 :         EXPECT_EQ(maxStep, propa.getMaximumStep());
+      96           1 :         EXPECT_EQ(tolerance, propa.getTolerance());
+      97           2 :         EXPECT_EQ(bField, propa.getField());
+      98             : 
+      99             :         // Update parameters
+     100           1 :         minStep = 10.;
+     101           1 :         maxStep = 10.;
+     102           1 :         propa.setTolerance(0.0001);
+     103           1 :         bField = new UniformMagneticField(Vector3d(10 * nG, 0, 1 * nG));
+     104             : 
+     105           1 :         propa.setTolerance(tolerance);
+     106           1 :         propa.setMinimumStep(minStep);
+     107           1 :         propa.setMaximumStep(maxStep);
+     108           1 :         propa.setField(bField);
+     109             : 
+     110           1 :         EXPECT_EQ(minStep, propa.getMinimumStep());
+     111           1 :         EXPECT_EQ(maxStep, propa.getMaximumStep());
+     112           1 :         EXPECT_EQ(tolerance, propa.getTolerance());
+     113           2 :         EXPECT_EQ(bField, propa.getField());
+     114             : 
+     115             :         // The propagation should be initialized with the default constructor
+     116           2 :         PropagationCK propaCKField(bField);
+     117           1 :         EXPECT_EQ(propaCKField.getMaximumStep(), 1 * Gpc);
+     118           2 : }
+     119             : 
+     120             : 
+     121             : // Test if the step size is reduced correctly if the error is too large with respect to the tolerance: r > 1
+     122           1 : TEST(testPropagationCK, reduceStep) {
+     123           1 :         PropagationCK propa(new UniformMagneticField(Vector3d(0, 0, 100 * nG)));
+     124             : 
+     125             :         double minStep = 0.1 * kpc;
+     126             :         double maxStep = 1 * Gpc;
+     127           1 :         propa.setMinimumStep(minStep);
+     128           1 :         propa.setMaximumStep(maxStep);
+     129             :         // small tolerance leads to large values of r
+     130           1 :         propa.setTolerance(1e-15);
+     131             : 
+     132           1 :         ParticleState p;
+     133           1 :         p.setId(nucleusId(1, 1));
+     134           1 :         p.setEnergy(100 * TeV);
+     135           1 :         p.setPosition(Vector3d(0, 0, 0));
+     136           1 :         p.setDirection(Vector3d(0, 1, 0));
+     137           1 :         Candidate c(p);
+     138             :         // large step leads to large errors and thus in combination with the low tolerance to high values of r
+     139           1 :         c.setNextStep(maxStep);
+     140             : 
+     141           1 :         propa.process(&c);
+     142             : 
+     143             :         // adaptive algorithm should propagate particle with minimum step size due to the low value for the tolerance
+     144           1 :         EXPECT_DOUBLE_EQ(minStep, c.getCurrentStep());  // perform minimum step because of large r due to small tolerance
+     145           1 :         EXPECT_DOUBLE_EQ(minStep, c.getNextStep());  // stay at minimum step because of large r due to small tolerance
+     146           1 : }
+     147             : 
+     148             : 
+     149             : // Test if the step size is increased correctly if the error is small with respect to the tolerance: r < 1
+     150           1 : TEST(testPropagationCK, increaseStep) {
+     151           1 :         PropagationCK propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)));
+     152             : 
+     153             :         double minStep = 0.001 * pc;
+     154             :         double maxStep = 3.125 * pc;
+     155           1 :         propa.setMinimumStep(minStep);
+     156           1 :         propa.setMaximumStep(maxStep);
+     157             :         // large tolerance leads to small values of r. Consequently, the step size can be increased.
+     158           1 :         propa.setTolerance(0.9);
+     159             : 
+     160           1 :         ParticleState p;
+     161           1 :         p.setId(nucleusId(1, 1));
+     162           1 :         p.setEnergy(100 * EeV);
+     163           1 :         p.setPosition(Vector3d(0, 0, 0));
+     164           1 :         p.setDirection(Vector3d(0, 1, 0));
+     165           1 :         Candidate c(p);
+     166             : 
+     167             :         // each step the step size can be increased by a factor of 5.
+     168           6 :         for (int i = 1; i < 6; i++){
+     169           5 :                 propa.process(&c);
+     170           5 :                 EXPECT_DOUBLE_EQ(minStep*pow(5, i) / pc, c.getNextStep()/pc);
+     171             :         }
+     172             :         // after 5 steps the maxStep is reached. The current step is, however, less.
+     173           1 :         EXPECT_DOUBLE_EQ(maxStep/pc/5., c.getCurrentStep()/pc);
+     174           1 :         EXPECT_DOUBLE_EQ(maxStep/pc, c.getNextStep()/pc);
+     175           1 : }
+     176             : 
+     177             : 
+     178           1 : TEST(testPropagationCK, proton) {
+     179           1 :         PropagationCK propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)));
+     180             : 
+     181             :         double minStep = 0.1 * kpc;
+     182           1 :         propa.setMinimumStep(minStep);
+     183             : 
+     184           1 :         ParticleState p;
+     185           1 :         p.setId(nucleusId(1, 1));
+     186           1 :         p.setEnergy(100 * EeV);
+     187           1 :         p.setPosition(Vector3d(0, 0, 0));
+     188           1 :         p.setDirection(Vector3d(0, 1, 0));
+     189           1 :         Candidate c(p);
+     190           1 :         c.setNextStep(0);
+     191             : 
+     192           1 :         propa.process(&c);
+     193             : 
+     194           1 :         EXPECT_DOUBLE_EQ(minStep, c.getCurrentStep());  // perform minimum step
+     195           1 :         EXPECT_DOUBLE_EQ(5 * minStep, c.getNextStep());  // acceleration by factor 5
+     196           1 : }
+     197             : 
+     198             : 
+     199             : // Test the numerical results for parallel magnetic field lines along the z-axis
+     200           1 : TEST(testPropagationCK, gyration) {
+     201           1 :         PropagationCK propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)));
+     202             : 
+     203             :         double step = 10. * Mpc;  // gyroradius is 108.1 Mpc
+     204           1 :         propa.setMaximumStep(step);
+     205           1 :         propa.setMinimumStep(step);
+     206             : 
+     207             : 
+     208           1 :         ParticleState p;
+     209           1 :         p.setId(nucleusId(1, 1));
+     210           1 :         p.setEnergy(100 * EeV);
+     211           1 :         p.setPosition(Vector3d(0, 0, 0));
+     212           1 :         p.setDirection(Vector3d(1, 1, 1));
+     213           1 :         Candidate c(p);
+     214           1 :         c.setNextStep(0);
+     215           1 :         propa.process(&c);
+     216             : 
+     217           1 :         double dirX = c.current.getDirection().x;
+     218           1 :         double dirY = c.current.getDirection().y;
+     219           1 :         double dirZ = c.current.getDirection().z;
+     220           1 :         double posZ = c.current.getPosition().z;
+     221             : 
+     222             :         // Test if the analytical solution is achieved for the components of the momentum with the CK method as expected in
+     223             :         // the background magnetic field.
+     224             :         double precision = 1e-7;
+     225             :         double expected = 2 / 3.;
+     226           1 :         EXPECT_NEAR(expected, dirX * dirX + dirY * dirY, expected * precision);  // constant momentum in the plane perpendicular to background magnetic field field
+     227             :         expected = 1 / 3.;
+     228           1 :         EXPECT_NEAR(expected, dirZ * dirZ, expected * precision);  // constant momentum parallel to the background magnetic field
+     229             :         expected = step * step / 3.;
+     230           1 :         EXPECT_NEAR(expected, posZ * posZ, expected * precision);  // constant velocity parallel to the background magnetic field
+     231             : 
+     232             :         // Nine new steps to have finally propagated the particle ten times
+     233          10 :         for (int i = 0; i < 9; i++){
+     234           9 :                 propa.process(&c);
+     235             :         }
+     236             : 
+     237           1 :         dirX = c.current.getDirection().x;
+     238           1 :         dirY = c.current.getDirection().y;
+     239           1 :         dirZ = c.current.getDirection().z;
+     240           1 :         posZ = c.current.getPosition().z;
+     241             : 
+     242             :         // Compare the numerical solutions after ten steps with the analytical solution of the trajectories
+     243             :         expected = 2 / 3.;
+     244           1 :         EXPECT_NEAR(expected, dirX * dirX + dirY * dirY, expected * precision);  // constant momentum in the plane perpendicular to background magnetic field field
+     245             :         expected = 1 / 3.;
+     246           1 :         EXPECT_NEAR(expected, dirZ * dirZ, expected * precision);  // constant momentum parallel to the background magnetic field
+     247             :         expected = 100 * step * step / 3.;
+     248           1 :         EXPECT_NEAR(expected, posZ * posZ, expected * precision);  // constant velocity parallel to the background magnetic field
+     249           1 : }
+     250             : 
+     251             : 
+     252           1 : TEST(testPropagationCK, neutron) {
+     253           1 :         PropagationCK propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)));
+     254           1 :         propa.setMinimumStep(1 * kpc);
+     255           1 :         propa.setMaximumStep(42 * Mpc);
+     256             : 
+     257           1 :         ParticleState p;
+     258           1 :         p.setId(nucleusId(1, 0));
+     259           1 :         p.setEnergy(100 * EeV);
+     260           1 :         p.setPosition(Vector3d(0, 0, 0));
+     261           1 :         p.setDirection(Vector3d(0, 1, 0));
+     262           1 :         Candidate c(p);
+     263             : 
+     264           1 :         propa.process(&c);
+     265             : 
+     266           1 :         EXPECT_DOUBLE_EQ(1 * kpc, c.getCurrentStep());
+     267           1 :         EXPECT_DOUBLE_EQ(42 * Mpc, c.getNextStep());
+     268           2 :         EXPECT_EQ(Vector3d(0, 1 * kpc, 0), c.current.getPosition());
+     269           2 :         EXPECT_EQ(Vector3d(0, 1, 0), c.current.getDirection());
+     270           1 : }
+     271             : 
+     272             : 
+     273           1 : TEST(testPropagationBP, zeroField) {
+     274           1 :         PropagationBP propa(new UniformMagneticField(Vector3d(0, 0, 0)), 1 * kpc);
+     275             : 
+     276             :         double minStep = 0.1 * kpc;
+     277           1 :         propa.setMinimumStep(minStep);
+     278           1 :         propa.setTolerance(0.42);
+     279             : 
+     280           1 :         ParticleState p;
+     281           1 :         p.setId(nucleusId(1, 1));
+     282           1 :         p.setEnergy(100 * EeV);
+     283           1 :         p.setPosition(Vector3d(0, 0, 0));
+     284           1 :         p.setDirection(Vector3d(0, 1, 0));
+     285           1 :         Candidate c(p);
+     286           1 :         c.setNextStep(0);
+     287             : 
+     288           1 :         propa.process(&c);
+     289             : 
+     290           1 :         EXPECT_DOUBLE_EQ(minStep, c.getCurrentStep());  // perform minimum step
+     291           1 :         EXPECT_DOUBLE_EQ(5 * minStep, c.getNextStep());  // acceleration by factor 5
+     292           1 : }
+     293             : 
+     294             : #ifndef CRPROPA_TESTS_SKIP_EXCEPTIONS
+     295           1 : TEST(testPropagationBP, exceptions) {
+     296             :         // minStep should be smaller than maxStep
+     297           2 :         EXPECT_THROW(PropagationBP propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)), 0.42, 10 , 0), std::runtime_error);
+     298             :         // Too large tolerance: tolerance should be between 0 and 1
+     299           2 :         EXPECT_THROW(PropagationBP propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)), 42., 10 * kpc , 20 * kpc), std::runtime_error);
+     300             : 
+     301           2 :         PropagationBP propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)));
+     302             : 
+     303             :         // set maximum step, so that it can be tested what happens if a larger minStep is set.
+     304           1 :         propa.setMaximumStep(1 * Mpc);
+     305             : 
+     306             :         // this tests _that_ the expected exception is thrown
+     307           1 :         EXPECT_THROW(propa.setTolerance(2.), std::runtime_error);
+     308           1 :         EXPECT_THROW(propa.setMinimumStep(-1.), std::runtime_error);
+     309           1 :         EXPECT_THROW(propa.setMinimumStep(2 * Mpc), std::runtime_error);
+     310             : 
+     311             :         // set minimum step, so that it can be tested what happens if a smaller maxStep is set.
+     312           1 :         propa.setMinimumStep(0.5 * Mpc);
+     313             : 
+     314           1 :         EXPECT_THROW(propa.setMaximumStep(0.1 * Mpc), std::runtime_error);
+     315           1 : }
+     316             : #endif
+     317             : 
+     318             : 
+     319           1 : TEST(testPropagationBP, constructor) {
+     320             :         // Test construction and parameters
+     321           1 :         ref_ptr<MagneticField> bField = new UniformMagneticField(Vector3d(0, 0, 1 * nG));
+     322             : 
+     323           1 :         double minStep = 1.;
+     324           1 :         double maxStep = 100.;
+     325           1 :         double tolerance = 0.01;
+     326             : 
+     327           1 :         PropagationBP propa(bField, tolerance, minStep, maxStep);
+     328             : 
+     329           1 :         EXPECT_EQ(minStep, propa.getMinimumStep());
+     330           1 :         EXPECT_EQ(maxStep, propa.getMaximumStep());
+     331           1 :         EXPECT_EQ(tolerance, propa.getTolerance());
+     332           2 :         EXPECT_EQ(bField, propa.getField());
+     333             : 
+     334             :         // Update parameters
+     335           1 :         minStep = 10.;
+     336           1 :         maxStep = 10.;
+     337           1 :         propa.setTolerance(0.0001);
+     338           1 :         bField = new UniformMagneticField(Vector3d(10 * nG, 0, 1 * nG));
+     339             : 
+     340           1 :         propa.setTolerance(tolerance);
+     341           1 :         propa.setMinimumStep(minStep);
+     342           1 :         propa.setMaximumStep(maxStep);
+     343           1 :         propa.setField(bField);
+     344             : 
+     345           1 :         EXPECT_EQ(minStep, propa.getMinimumStep());
+     346           1 :         EXPECT_EQ(maxStep, propa.getMaximumStep());
+     347           1 :         EXPECT_EQ(tolerance, propa.getTolerance());
+     348           2 :         EXPECT_EQ(bField, propa.getField());
+     349             : 
+     350             :         // Test the fixed step size version of the Boris push
+     351           1 :         minStep = 10. * kpc;
+     352           2 :         PropagationBP propaBP(bField, minStep);
+     353           1 :         EXPECT_EQ(propaBP.getMaximumStep(), propaBP.getMaximumStep());
+     354             : 
+     355             :         // The propagation should be initialized with the default constructor
+     356           2 :         PropagationBP propaBPField(bField);
+     357           1 :         EXPECT_EQ(propaBPField.getMaximumStep(), 1 * kpc);
+     358           2 : }
+     359             : 
+     360             : 
+     361             : // Test if the step size is reduced correctly if the error is too large with respect to the tolerance: r > 1
+     362           1 : TEST(testPropagationBP, reduceStep) {
+     363           1 :         PropagationBP propa(new UniformMagneticField(Vector3d(0, 0, 100 * nG)), 1 * kpc);
+     364             : 
+     365             :         double minStep = 0.1 * kpc;
+     366             :         double maxStep = 1 * Gpc;
+     367           1 :         propa.setMinimumStep(minStep);
+     368           1 :         propa.setMaximumStep(maxStep);
+     369             :         // small tolerance leads to large values of r
+     370           1 :         propa.setTolerance(1e-15);
+     371             : 
+     372           1 :         ParticleState p;
+     373           1 :         p.setId(nucleusId(1, 1));
+     374           1 :         p.setEnergy(100 * TeV);
+     375           1 :         p.setPosition(Vector3d(0, 0, 0));
+     376           1 :         p.setDirection(Vector3d(0, 1, 0));
+     377           1 :         Candidate c(p);
+     378             :         // large step leads to large errors and thus in combination with the low tolerance to high values of r
+     379           1 :         c.setNextStep(maxStep);
+     380             : 
+     381           1 :         propa.process(&c);
+     382             : 
+     383             :         // adaptive algorithm should propagate particle with minimum step size due to the low value for the tolerance
+     384           1 :         EXPECT_DOUBLE_EQ(minStep, c.getCurrentStep());  // perform minimum step because of large r due to small tolerance
+     385           1 :         EXPECT_DOUBLE_EQ(minStep, c.getNextStep());  // stay at minimum step because of large r due to small tolerance
+     386           1 : }
+     387             : 
+     388             : 
+     389             : // Test if the step size is increased correctly if the error is small with respect to the tolerance: r < 1
+     390           1 : TEST(testPropagationBP, increaseStep) {
+     391           1 :         PropagationBP propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)), 1 * kpc);
+     392             : 
+     393             :         double minStep = 0.001 * pc;
+     394             :         double maxStep = 3.125 * pc;
+     395           1 :         propa.setMinimumStep(minStep);
+     396           1 :         propa.setMaximumStep(maxStep);
+     397             :         // large tolerance leads to small values of r. Consequently, the step size can be increased.
+     398           1 :         propa.setTolerance(0.9);
+     399             : 
+     400           1 :         ParticleState p;
+     401           1 :         p.setId(nucleusId(1, 1));
+     402           1 :         p.setEnergy(100 * EeV);
+     403           1 :         p.setPosition(Vector3d(0, 0, 0));
+     404           1 :         p.setDirection(Vector3d(0, 1, 0));
+     405           1 :         Candidate c(p);
+     406             : 
+     407             :         // each step the step size can be increased by a factor of 5.
+     408           6 :         for (int i = 1; i < 6; i++){
+     409           5 :                 propa.process(&c);
+     410           5 :                 EXPECT_DOUBLE_EQ(minStep*pow(5, i) / pc, c.getNextStep()/pc);
+     411             :         }
+     412             :         // after 5 steps the maxStep is reached. The current step is, however, less.
+     413           1 :         EXPECT_DOUBLE_EQ(maxStep/pc/5., c.getCurrentStep()/pc);
+     414           1 :         EXPECT_DOUBLE_EQ(maxStep/pc, c.getNextStep()/pc);
+     415           1 : }
+     416             : 
+     417             : 
+     418           1 : TEST(testPropagationBP, proton) {
+     419           1 :         PropagationBP propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)));
+     420             : 
+     421             :         double step = 0.01 * kpc;
+     422           1 :         propa.setMinimumStep(step);
+     423           1 :         propa.setMaximumStep(10*step);
+     424           1 :         propa.setTolerance(0.00001);
+     425             : 
+     426           1 :         ParticleState p;
+     427           1 :         p.setId(nucleusId(1, 1));
+     428           1 :         p.setEnergy(100 * EeV);
+     429           1 :         p.setPosition(Vector3d(0, 0, 0));
+     430           1 :         p.setDirection(Vector3d(0, 1, 0));
+     431           1 :         Candidate c(p);
+     432           1 :         c.setNextStep(0);
+     433             : 
+     434           1 :         propa.process(&c);
+     435             : 
+     436           1 :         EXPECT_DOUBLE_EQ(step, c.getCurrentStep());  // perform step
+     437           1 :         EXPECT_DOUBLE_EQ(5 * step, c.getNextStep());  // acceleration by factor 5
+     438           1 : }
+     439             : 
+     440             : 
+     441             : // Test the numerical results for parallel magnetic field lines along the z-axis
+     442           1 : TEST(testPropagationBP, gyration) {
+     443           1 :         PropagationBP propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)));
+     444             : 
+     445             :         double step = 10. * Mpc;  // gyroradius is 108.1 Mpc
+     446           1 :         propa.setMaximumStep(step);
+     447           1 :         propa.setMinimumStep(step);
+     448             : 
+     449             : 
+     450           1 :         ParticleState p;
+     451           1 :         p.setId(nucleusId(1, 1));
+     452           1 :         p.setEnergy(100 * EeV);
+     453           1 :         p.setPosition(Vector3d(0, 0, 0));
+     454           1 :         p.setDirection(Vector3d(1, 1, 1));
+     455           1 :         Candidate c(p);
+     456           1 :         c.setNextStep(0);
+     457           1 :         propa.process(&c);
+     458             : 
+     459           1 :         double dirX = c.current.getDirection().x;
+     460           1 :         double dirY = c.current.getDirection().y;
+     461           1 :         double dirZ = c.current.getDirection().z;
+     462           1 :         double posZ = c.current.getPosition().z;
+     463             : 
+     464             :         // Test if the analytical solution is achieved for the components of the momentum with the Boris push as expected in
+     465             :         // the background magnetic field.
+     466           1 :         EXPECT_DOUBLE_EQ(2 / 3., dirX * dirX + dirY * dirY);  // constant momentum in the perpendicular plane to background magnetic field field
+     467           1 :         EXPECT_DOUBLE_EQ(1 / 3., dirZ * dirZ);  // constant momentum parallel to the background magnetic field
+     468           1 :         EXPECT_DOUBLE_EQ( step * step / 3., posZ * posZ);  // constant velocity parallel to the background magnetic field
+     469             : 
+     470             :         // Nine new steps to have finally propagated the particle ten times
+     471          10 :         for (int i = 0; i < 9; i++){
+     472           9 :                 propa.process(&c);
+     473             :         }
+     474             : 
+     475           1 :         dirX = c.current.getDirection().x;
+     476           1 :         dirY = c.current.getDirection().y;
+     477           1 :         dirZ = c.current.getDirection().z;
+     478           1 :         posZ = c.current.getPosition().z;
+     479             : 
+     480             :         // Compare the numerical solutions after ten steps with the analytical solution of the trajectories
+     481           1 :         EXPECT_DOUBLE_EQ(2 / 3., dirX * dirX + dirY * dirY);  // constant momentum in the perpendicular plane to background magnetic field field
+     482           1 :         EXPECT_DOUBLE_EQ(1 / 3., dirZ * dirZ);  // constant momentum parallel to the background magnetic field
+     483           1 :         EXPECT_DOUBLE_EQ(100 * step * step / 3., posZ * posZ);  // constant velocity parallel to the background magnetic field
+     484           1 : }
+     485             : 
+     486             : 
+     487             : // Test the that the optimization for fixed step sizes works
+     488           1 : TEST(testPropagationBP, fixedStepOptimization) {
+     489             :         // particle 1 with fixed step sizes
+     490             :         double fixed_step = pc;
+     491           2 :         PropagationBP propa1(new PlaneWaveTurbulence(TurbulenceSpectrum(gauss, pc, 100*pc), 10, 1), fixed_step);
+     492           1 :         ParticleState p1;
+     493           1 :         p1.setId(nucleusId(1, 1));
+     494           1 :         p1.setEnergy(100 * EeV);
+     495           1 :         p1.setPosition(Vector3d(0, 0, 0));
+     496           1 :         p1.setDirection(Vector3d(1, 1, 1));
+     497           1 :         Candidate c1(p1);
+     498           1 :         c1.setNextStep(0);
+     499             :         // Nine new steps to have finally propagated the particle ten times
+     500          10 :         for (int i = 0; i < 9; i++){
+     501           9 :                 propa1.process(&c1);
+     502             :         }
+     503             : 
+     504             :         // particle 2 with different min and max steps. The tolerance is chosen such that particle 2 will be
+     505             :         // propagated with the same step as particle 1, however not using the optimization for fixed step sizes
+     506             :         double tolerance = 1;
+     507           2 :         PropagationBP propa2(new PlaneWaveTurbulence(TurbulenceSpectrum(gauss, pc, 100*pc), 10, 1), tolerance, fixed_step, 1.1*fixed_step);
+     508           1 :         ParticleState p2;
+     509           1 :         p2.setId(nucleusId(1, 1));
+     510           1 :         p2.setEnergy(100 * EeV);
+     511           1 :         p2.setPosition(Vector3d(0, 0, 0));
+     512           1 :         p2.setDirection(Vector3d(1, 1, 1));
+     513           1 :         Candidate c2(p2);
+     514           1 :         c1.setNextStep(0);
+     515             :         // Nine new steps to have finally propagated the particle ten times
+     516          10 :         for (int i = 0; i < 9; i++){
+     517           9 :                 propa2.process(&c2);
+     518             :         }
+     519             : 
+     520           1 :         EXPECT_DOUBLE_EQ(c1.current.getDirection().x, c2.current.getDirection().x);
+     521           1 :         EXPECT_DOUBLE_EQ(c1.current.getDirection().y, c2.current.getDirection().y);
+     522           1 :         EXPECT_DOUBLE_EQ(c1.current.getDirection().z, c2.current.getDirection().z);
+     523           1 :         EXPECT_DOUBLE_EQ(c1.current.getPosition().x, c2.current.getPosition().x);
+     524           1 :         EXPECT_DOUBLE_EQ(c1.current.getPosition().y, c2.current.getPosition().y);
+     525           1 :         EXPECT_DOUBLE_EQ(c1.current.getPosition().z, c2.current.getPosition().z);
+     526           1 : }
+     527             : 
+     528             : 
+     529           1 : TEST(testPropagationBP, neutron) {
+     530           1 :         PropagationBP propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)));
+     531             : 
+     532           1 :         propa.setMinimumStep(1 * kpc);
+     533           1 :         propa.setMaximumStep(1 * kpc);
+     534             : 
+     535           1 :         ParticleState p;
+     536           1 :         p.setId(nucleusId(1, 0));
+     537           1 :         p.setEnergy(100 * EeV);
+     538           1 :         p.setPosition(Vector3d(0, 0, 0));
+     539           1 :         p.setDirection(Vector3d(0, 1, 0));
+     540           1 :         Candidate c(p);
+     541             : 
+     542           1 :         propa.process(&c);
+     543             : 
+     544           1 :         EXPECT_DOUBLE_EQ(1 * kpc, c.getCurrentStep());
+     545           1 :         EXPECT_DOUBLE_EQ(1 * kpc, c.getNextStep());
+     546           2 :         EXPECT_EQ(Vector3d(0, 1 * kpc, 0), c.current.getPosition());
+     547           2 :         EXPECT_EQ(Vector3d(0, 1, 0), c.current.getDirection());
+     548           1 : }
+     549             : 
+     550             : 
+     551           0 : int main(int argc, char **argv) {
+     552           0 :         ::testing::InitGoogleTest(&argc, argv);
+     553           0 :         return RUN_ALL_TESTS();
+     554             : }
+     555             : 
+     556             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testSource.cpp.func-sort-c.html b/doc/coverageReport/test/testSource.cpp.func-sort-c.html new file mode 100644 index 000000000..d2aaccaf2 --- /dev/null +++ b/doc/coverageReport/test/testSource.cpp.func-sort-c.html @@ -0,0 +1,168 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testSource.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testSource.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:27928398.6 %
Date:2024-04-08 14:58:22Functions:232495.8 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa4mainEiPPc0
_ZN7crpropa24SourceList_noSource_Test8TestBodyEv1
_ZN7crpropa24SourceTag_sourceTag_Test8TestBodyEv1
_ZN7crpropa26SourceList_luminosity_Test8TestBodyEv1
_ZN7crpropa26SourceList_simpleTest_Test8TestBodyEv1
_ZN7crpropa29Source_allPropertiesUsed_Test8TestBodyEv1
_ZN7crpropa30SourcePosition_simpleTest_Test8TestBodyEv1
_ZN7crpropa32SourceUniformBox_simpleTest_Test8TestBodyEv1
_ZN7crpropa33SourceComposition_simpleTest_Test8TestBodyEv1
_ZN7crpropa34SourceDensityGrid_withInRange_Test8TestBodyEv1
_ZN7crpropa34SourceEmissionCone_simpleTest_Test8TestBodyEv1
_ZN7crpropa35SourceUniformSphere_simpleTest_Test8TestBodyEv1
_ZN7crpropa36SourceDensityGrid1D_withInRange_Test8TestBodyEv1
_ZN7crpropa37SourceComposition_throwNoIsotope_Test8TestBodyEv1
_ZN7crpropa37SourceDensityGrid_OneAllowedCell_Test8TestBodyEv1
_ZN7crpropa37SourceSNRDistribution_simpleTest_Test8TestBodyEv1
_ZN7crpropa37SourceUniformCylinder_simpleTest_Test8TestBodyEv1
_ZN7crpropa38SourceDirectedEmission_simpleTest_Test8TestBodyEv1
_ZN7crpropa38SourcePowerLawSpectrum_simpleTest_Test8TestBodyEv1
_ZN7crpropa39SourceDensityGrid1D_OneAllowedCell_Test8TestBodyEv1
_ZN7crpropa39SourceMultiplePositions_simpleTest_Test8TestBodyEv1
_ZN7crpropa40SourceGenericComposition_simpleTest_Test8TestBodyEv1
_ZN7crpropa40SourceRedshiftEvolution_testInRange_Test8TestBodyEv1
_ZN7crpropa41SourceUniformHollowSphere_simpleTest_Test8TestBodyEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testSource.cpp.func.html b/doc/coverageReport/test/testSource.cpp.func.html new file mode 100644 index 000000000..03ae49b49 --- /dev/null +++ b/doc/coverageReport/test/testSource.cpp.func.html @@ -0,0 +1,168 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testSource.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testSource.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:27928398.6 %
Date:2024-04-08 14:58:22Functions:232495.8 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa24SourceList_noSource_Test8TestBodyEv1
_ZN7crpropa24SourceTag_sourceTag_Test8TestBodyEv1
_ZN7crpropa26SourceList_luminosity_Test8TestBodyEv1
_ZN7crpropa26SourceList_simpleTest_Test8TestBodyEv1
_ZN7crpropa29Source_allPropertiesUsed_Test8TestBodyEv1
_ZN7crpropa30SourcePosition_simpleTest_Test8TestBodyEv1
_ZN7crpropa32SourceUniformBox_simpleTest_Test8TestBodyEv1
_ZN7crpropa33SourceComposition_simpleTest_Test8TestBodyEv1
_ZN7crpropa34SourceDensityGrid_withInRange_Test8TestBodyEv1
_ZN7crpropa34SourceEmissionCone_simpleTest_Test8TestBodyEv1
_ZN7crpropa35SourceUniformSphere_simpleTest_Test8TestBodyEv1
_ZN7crpropa36SourceDensityGrid1D_withInRange_Test8TestBodyEv1
_ZN7crpropa37SourceComposition_throwNoIsotope_Test8TestBodyEv1
_ZN7crpropa37SourceDensityGrid_OneAllowedCell_Test8TestBodyEv1
_ZN7crpropa37SourceSNRDistribution_simpleTest_Test8TestBodyEv1
_ZN7crpropa37SourceUniformCylinder_simpleTest_Test8TestBodyEv1
_ZN7crpropa38SourceDirectedEmission_simpleTest_Test8TestBodyEv1
_ZN7crpropa38SourcePowerLawSpectrum_simpleTest_Test8TestBodyEv1
_ZN7crpropa39SourceDensityGrid1D_OneAllowedCell_Test8TestBodyEv1
_ZN7crpropa39SourceMultiplePositions_simpleTest_Test8TestBodyEv1
_ZN7crpropa40SourceGenericComposition_simpleTest_Test8TestBodyEv1
_ZN7crpropa40SourceRedshiftEvolution_testInRange_Test8TestBodyEv1
_ZN7crpropa41SourceUniformHollowSphere_simpleTest_Test8TestBodyEv1
_ZN7crpropa4mainEiPPc0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testSource.cpp.gcov.html b/doc/coverageReport/test/testSource.cpp.gcov.html new file mode 100644 index 000000000..5c0300eea --- /dev/null +++ b/doc/coverageReport/test/testSource.cpp.gcov.html @@ -0,0 +1,516 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testSource.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testSource.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:27928398.6 %
Date:2024-04-08 14:58:22Functions:232495.8 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/Source.h"
+       2             : #include "crpropa/Units.h"
+       3             : #include "crpropa/ParticleID.h"
+       4             : 
+       5             : #include "gtest/gtest.h"
+       6             : #include <stdexcept>
+       7             : 
+       8             : namespace crpropa {
+       9             : 
+      10           2 : TEST(SourcePosition, simpleTest) {
+      11             :         Vector3d position(1, 2, 3);
+      12           1 :         SourcePosition source(position);
+      13           1 :         ParticleState ps;
+      14           1 :         source.prepareParticle(ps);
+      15           2 :         EXPECT_EQ(position, ps.getPosition());
+      16           1 : }
+      17             : 
+      18           1 : TEST(SourceMultiplePositions, simpleTest) {
+      19           1 :         SourceMultiplePositions source;
+      20           1 :         source.add(Vector3d(1, 0, 0), 0.25);
+      21           1 :         source.add(Vector3d(2, 0, 0), 0.75);
+      22           1 :         ParticleState ps;
+      23             :         int n1 = 0;
+      24             :         int n2 = 0;
+      25       10001 :         for (int i = 0; i < 10000; i++) {
+      26       10000 :                 source.prepareParticle(ps);
+      27       10000 :                 if (ps.getPosition().x == 1)
+      28        2585 :                         n1++;
+      29        7415 :                 else if (ps.getPosition().x == 2)
+      30        7415 :                         n2++;
+      31             :         }
+      32           1 :         EXPECT_NEAR(n1, 2500, 5 * sqrt(2500));
+      33           1 :         EXPECT_NEAR(n2, 7500, 5 * sqrt(7500));
+      34           1 : }
+      35             : 
+      36           2 : TEST(SourceUniformSphere, simpleTest) {
+      37             :         Vector3d center(0, 0, 0);
+      38           1 :         double radius = 110;
+      39           1 :         SourceUniformSphere source(center, radius);
+      40           1 :         ParticleState ps;
+      41           1 :         source.prepareParticle(ps);
+      42           1 :         double distance = ps.getPosition().getDistanceTo(center);
+      43           1 :         EXPECT_GE(radius, distance);
+      44           1 : }
+      45             : 
+      46           2 : TEST(SourceUniformHollowSphere, simpleTest) {
+      47             :         Vector3d center(0, 0, 0);
+      48           1 :         double radius_inner = 50;
+      49           1 :         double radius_outer = 110;
+      50             :         SourceUniformHollowSphere source(center,
+      51             :                         radius_inner,
+      52           1 :                         radius_outer);
+      53         101 :         for (int i=0; i < 100; ++i) {
+      54         100 :                 ParticleState ps;
+      55         100 :                 source.prepareParticle(ps);
+      56         100 :                 double distance = ps.getPosition().getDistanceTo(center);
+      57         100 :                 EXPECT_GE(radius_outer, distance);
+      58         100 :                 EXPECT_LE(radius_inner, distance);
+      59             :         }
+      60           1 : }
+      61             : 
+      62           2 : TEST(SourceUniformBox, simpleTest) {
+      63             :         Vector3d origin(-7, -2, 0);
+      64             :         Vector3d size(13, 55, 192);
+      65           1 :         SourceUniformBox box(origin, size);
+      66           1 :         ParticleState p;
+      67           1 :         box.prepareParticle(p);
+      68           1 :         Vector3d pos = p.getPosition();
+      69           1 :         EXPECT_LE(origin.x, pos.x);
+      70           1 :         EXPECT_LE(origin.y, pos.y);
+      71           1 :         EXPECT_LE(origin.z, pos.z);
+      72           1 :         EXPECT_GE(size.x, pos.x);
+      73           1 :         EXPECT_GE(size.y, pos.y);
+      74           1 :         EXPECT_GE(size.z, pos.z);
+      75           1 : }
+      76             : 
+      77           2 : TEST(SourceUniformCylinder, simpleTest) {
+      78             :         Vector3d center(0, 0, 0);
+      79             :         double radius = 15;
+      80             :         double height = 2;
+      81           1 :         SourceUniformCylinder cylinder(center, height, radius);
+      82           1 :         ParticleState ps;
+      83           1 :         cylinder.prepareParticle(ps);
+      84           1 :         Vector3d pos = ps.getPosition();
+      85           1 :         double R2 = pos.x*pos.x+pos.y*pos.y;
+      86           1 :         double H = pow(pos.z*pos.z, 0.5);
+      87           1 :         EXPECT_GE(radius*radius, R2);
+      88           1 :         EXPECT_GE(height/2., H);
+      89           1 : }
+      90             : 
+      91           1 : TEST(SourceSNRDistribution, simpleTest) {
+      92             :         double R_earth = 8.5*kpc;
+      93             :         double alpha = 2.0;
+      94             :         double beta = 3.53;
+      95             :         double Z_G = 0.3*kpc;
+      96           1 :         SourceSNRDistribution snr(R_earth,alpha, beta, Z_G);
+      97           1 :         ParticleState ps;
+      98           1 :         snr.prepareParticle(ps);
+      99           1 :         Vector3d pos = ps.getPosition();
+     100           1 :         double R2 = pos.x*pos.x+pos.y*pos.y;
+     101           1 :         EXPECT_GE(20*kpc*20*kpc, R2); // radius must be smaller than 20 kpc
+     102             :         
+     103             :         double R2_mean = 0.;
+     104             :         double Z_mean = 0.;
+     105      100001 :         for (size_t i=0; i<100000; i++) {
+     106      100000 :                 snr.prepareParticle(ps);
+     107      100000 :                 Vector3d pos = ps.getPosition();
+     108      100000 :                 R2_mean += pow(pos.x/kpc, 2.)+pow(pos.y/kpc, 2.);
+     109      100000 :                 Z_mean += pos.z/kpc;
+     110             :         }
+     111           1 :         R2_mean/=100000.;
+     112           1 :         Z_mean/=100000.;
+     113           1 :         EXPECT_NEAR(100.306, R2_mean, 1);
+     114           1 :         EXPECT_NEAR(0., Z_mean, 0.1);
+     115           1 : }
+     116             : 
+     117           2 : TEST(SourceDensityGrid, withInRange) {
+     118             :         // Create a grid with 10^3 cells ranging from (0, 0, 0) to (10, 10, 10)
+     119             :         Vector3d origin(0, 0, 0);
+     120             :         int cells = 10;
+     121             :         double spacing = 1;
+     122           1 :         auto grid = new Grid1f(origin, cells, spacing);
+     123          11 :         for (int ix = 0; ix < cells; ix++)
+     124         110 :                 for (int iy = 0; iy < cells; iy++)
+     125        1100 :                         for (int iz = 0; iz < cells; iz++)
+     126        1000 :                                 grid->get(ix, iy, iz) = ix * iy * iz;
+     127             : 
+     128           2 :         SourceDensityGrid source(grid);
+     129           1 :         ParticleState p;
+     130             : 
+     131           1 :         source.prepareParticle(p);
+     132           1 :         Vector3d pos = p.getPosition();
+     133             : 
+     134             :         // dialed positions should be within the volume (0, 0, 0) - (10, 10, 10)
+     135           1 :         EXPECT_LE(0, pos.x);
+     136           1 :         EXPECT_GE(10, pos.x);
+     137           1 :         EXPECT_LE(0, pos.y);
+     138           1 :         EXPECT_GE(10, pos.y);
+     139           1 :         EXPECT_LE(0, pos.z);
+     140           1 :         EXPECT_GE(10, pos.z);
+     141           1 : }
+     142             : 
+     143           2 : TEST(SourceDensityGrid, OneAllowedCell) {
+     144             :         // Create a grid with 2^3 cells ranging from (0, 0, 0) to (4, 4, 4)
+     145             :         Vector3d origin(0, 0, 0);
+     146             :         int cells = 2;
+     147             :         double spacing = 2;
+     148           1 :         auto grid = new Grid1f(origin, cells, spacing);
+     149             :         
+     150             :         // set all but one cells to 0
+     151           3 :         for (int ix = 0; ix < cells; ix++)
+     152           6 :                 for (int iy = 0; iy < cells; iy++)
+     153          12 :                         for (int iz = 0; iz < cells; iz++)
+     154           8 :                                 grid->get(ix, iy, iz) = 0;
+     155             : 
+     156             :         // set the first cell ((0, 0, 0) to (2, 2, 2))
+     157           1 :         grid->get(0, 0, 0) = 1;
+     158             : 
+     159           2 :         SourceDensityGrid source(grid);
+     160           1 :         ParticleState p;
+     161             : 
+     162           1 :         int nFalse = 0;
+     163             :         Vector3d mean(0, 0, 0);
+     164       10001 :         for (int i = 0; i < 10000; i++) {
+     165       10000 :                 source.prepareParticle(p);
+     166       10000 :                 Vector3d pos = p.getPosition();
+     167             :                 mean += pos;
+     168       10000 :                 if ((pos.x < 0) or (pos.x > 2) or (pos.y < 0) or (pos.y > 2)
+     169       10000 :                                 or (pos.z < 0) or (pos.z > 2))
+     170           0 :                         nFalse++;
+     171             :         }
+     172             : 
+     173             :         // only the first bin should get dialed
+     174           1 :         EXPECT_EQ(0, nFalse);
+     175             : 
+     176             :         // mean should be close to (1, 1, 1) if random positions are uniform in (0, 0, 0) - (2, 2, 2)
+     177             :         mean /= 10000;
+     178           1 :         EXPECT_NEAR(1, mean.x, 0.2);
+     179           1 :         EXPECT_NEAR(1, mean.y, 0.2);
+     180           1 :         EXPECT_NEAR(1, mean.z, 0.2);
+     181           1 : }
+     182             : 
+     183           2 : TEST(SourceDensityGrid1D, withInRange) {
+     184             :         // Create a grid with 10 cells ranging from 0 to 10
+     185             :         Vector3d origin(0, 0, 0);
+     186             :         int nCells = 10;
+     187             :         double spacing = 1.;
+     188           1 :         auto grid = new Grid1f(origin, nCells, 1, 1, spacing);
+     189             : 
+     190             :         // set some values
+     191          11 :         for (int i = 0; i < 10; i++) {
+     192          10 :                 grid->get(i, 0, 0) = 2;
+     193             :         }
+     194             : 
+     195           2 :         SourceDensityGrid1D source(grid);
+     196           1 :         ParticleState p;
+     197             : 
+     198           1 :         source.prepareParticle(p);
+     199           1 :         Vector3d pos = p.getPosition();
+     200             :         // dialed position should be within the range 0 - 10
+     201           1 :         EXPECT_LE(0, pos.x);
+     202           1 :         EXPECT_GE(10, pos.x);
+     203           1 : }
+     204             : 
+     205           2 : TEST(SourceDensityGrid1D, OneAllowedCell) {
+     206             :         // Test if the only allowed cells is repeatedly selected
+     207             :         Vector3d origin(0, 0, 0);
+     208             :         int nCells = 10;
+     209             :         double spacing = 1.;
+     210           1 :         auto grid = new Grid1f(origin, nCells, 1, 1, spacing);
+     211             : 
+     212             :         // set some values
+     213          11 :         for (int i = 0; i < 10; i++) {
+     214          10 :                 grid->get(i, 0, 0) = 0;
+     215             :         }
+     216           1 :         grid->get(5, 0, 0) = 1;
+     217             : 
+     218           2 :         SourceDensityGrid1D source(grid);
+     219           1 :         ParticleState p;
+     220             : 
+     221         101 :         for (int i = 0; i < 100; i++) {
+     222         100 :                 source.prepareParticle(p);
+     223             :                 // dialed position should be in range 5-6
+     224         100 :                 Vector3d pos = p.getPosition();
+     225         100 :                 EXPECT_LE(5, pos.x);
+     226         100 :                 EXPECT_GE(6, pos.x);
+     227             :         }
+     228           1 : }
+     229             : 
+     230           1 : TEST(SourcePowerLawSpectrum, simpleTest) {
+     231           1 :         double Emin = 4 * EeV;
+     232           1 :         double Emax = 200 * EeV;
+     233             :         double index = -2.7;
+     234           1 :         SourcePowerLawSpectrum spectrum(Emin, Emax, index);
+     235           1 :         ParticleState ps;
+     236           1 :         spectrum.prepareParticle(ps);
+     237             : 
+     238             :         // energy should be within Emin - Emax
+     239           1 :         EXPECT_LE(Emin, ps.getEnergy());
+     240           1 :         EXPECT_GE(Emax, ps.getEnergy());
+     241           1 : }
+     242             : 
+     243           1 : TEST(SourceComposition, simpleTest) {
+     244           1 :         double Emin = 10;
+     245             :         double Rmax = 100;
+     246             :         double index = -1;
+     247           1 :         SourceComposition source(Emin, Rmax, index);
+     248           1 :         source.add(nucleusId(6, 3), 1);
+     249           1 :         ParticleState p;
+     250           1 :         source.prepareParticle(p);
+     251           1 :         EXPECT_EQ(nucleusId(6, 3), p.getId());
+     252           1 :         EXPECT_LE(Emin, p.getEnergy());
+     253           1 :         EXPECT_GE(6 * Rmax, p.getEnergy());
+     254           1 : }
+     255             : 
+     256           2 : TEST(SourceDirectedEmission, simpleTest) {
+     257             :         Vector3d mu(1., 0., 0.);
+     258             :         double kappa = 1000.;
+     259           1 :         SourceDirectedEmission source(mu, kappa);
+     260           1 :         Candidate c;
+     261             :         Vector3d meanDir(0., 0., 0.);
+     262        1001 :         for (size_t i = 0; i < 1000; i++) {
+     263        1000 :                 source.prepareCandidate(c);
+     264        1000 :                 meanDir += c.source.getDirection();
+     265        1000 :                 double w = c.getWeight();
+     266        1000 :                 EXPECT_GE(w, 0.);
+     267             :         }
+     268             :         meanDir /= 1000.;
+     269           1 :         EXPECT_NEAR(meanDir.x, 1., 0.1);
+     270           1 :         EXPECT_NEAR(meanDir.y, 0., 0.01);
+     271           1 :         EXPECT_NEAR(meanDir.z, 0., 0.01);
+     272           2 : }
+     273             : 
+     274           2 : TEST(SourceEmissionCone, simpleTest) {
+     275             :         Vector3d direction(42., 0., 0.);
+     276           1 :         double aperture = 1/42.;
+     277             :         
+     278           1 :         SourceEmissionCone source(direction, aperture);
+     279             :         
+     280           1 :         ParticleState p;
+     281           1 :         source.prepareParticle(p);
+     282           1 :         double angle = direction.getAngleTo(p.getDirection());
+     283           1 :         EXPECT_LE(angle, aperture);
+     284           1 : }
+     285             : 
+     286             : #ifdef CRPROPA_HAVE_MUPARSER
+     287           1 : TEST(SourceGenericComposition, simpleTest) {
+     288             :         double Emin = 10;
+     289             :         double Emax = 100;
+     290           1 :         SourceGenericComposition source(Emin, Emax, "E^-2");
+     291           1 :         int id1 = nucleusId(6, 3);
+     292           1 :         int id2 = nucleusId(12, 6);
+     293           1 :         source.add(id1, 1);
+     294           1 :         source.add(id2, 10);
+     295           1 :         ParticleState p;
+     296             :         size_t id1Count = 0, id2Count = 0;
+     297             :         size_t ElowCount = 0, EhighCount = 0;
+     298           1 :         size_t n = 100000;
+     299      100001 :         for (size_t i = 0; i < n; i++) {
+     300      100000 :                 source.prepareParticle(p);
+     301      100000 :                 if (p.getId() == id1)
+     302        8964 :                         id1Count++;
+     303      100000 :                 if (p.getId() == id2)
+     304       91036 :                         id2Count++;
+     305      100000 :                 double e = p.getEnergy();
+     306      100000 :                 if ( (e >= Emin) && (e < 20))
+     307       55702 :                         ElowCount++;
+     308      100000 :                 if ( (e >= 20) && (e <= Emax))
+     309       44298 :                         EhighCount++;
+     310             : 
+     311             :         }
+     312           1 :         EXPECT_EQ(n, id1Count + id2Count);
+     313           1 :         EXPECT_EQ(n, ElowCount + EhighCount);
+     314           1 :         EXPECT_NEAR((float)id1Count/(float)id2Count, 0.1, 0.01);
+     315           1 :         EXPECT_NEAR((float)ElowCount/(float)EhighCount, 1.25, 0.1);
+     316           1 : }
+     317             : #endif
+     318             : 
+     319           1 : TEST(SourceComposition, throwNoIsotope) {
+     320           1 :         SourceComposition source(1, 10, -1);
+     321           1 :         ParticleState ps;
+     322           1 :         EXPECT_THROW(source.prepareParticle(ps), std::runtime_error);
+     323           1 : }
+     324             : 
+     325           1 : TEST(SourceRedshiftEvolution, testInRange) {
+     326           1 :         Candidate c;
+     327             : 
+     328           1 :         double zmin = 0.5;
+     329           1 :         double zmax = 2.5;
+     330             : 
+     331             :         // general case: m
+     332           1 :         SourceRedshiftEvolution source1(3.2, zmin, zmax);
+     333         101 :         for (int i = 0; i < 100; i++) {
+     334         100 :                 source1.prepareCandidate(c);
+     335         100 :                 EXPECT_LE(zmin, c.getRedshift());
+     336         100 :                 EXPECT_GE(zmax, c.getRedshift());
+     337             :         }
+     338             : 
+     339             :         // general case: m = -1
+     340           1 :         SourceRedshiftEvolution source2(-1, zmin, zmax);
+     341         101 :         for (int i = 0; i < 100; i++) {
+     342         100 :                 source2.prepareCandidate(c);
+     343         100 :                 EXPECT_LE(zmin, c.getRedshift());
+     344         100 :                 EXPECT_GE(zmax, c.getRedshift());
+     345             :         }
+     346           1 : }
+     347             : 
+     348           2 : TEST(Source, allPropertiesUsed) {
+     349             :         Source source;
+     350           1 :         source.add(new SourcePosition(Vector3d(10, 0, 0) * Mpc));
+     351           2 :         source.add(new SourceIsotropicEmission());
+     352           1 :         source.add(new SourcePowerLawSpectrum(5 * EeV, 100 * EeV, -2));
+     353           1 :         source.add(new SourceParticleType(nucleusId(8, 4)));
+     354           1 :         source.add(new SourceRedshift(2));
+     355             : 
+     356           1 :         Candidate c = *source.getCandidate();
+     357             : 
+     358           1 :         EXPECT_EQ(2, c.getRedshift());
+     359             : 
+     360           1 :         ParticleState p;
+     361             : 
+     362             :         p = c.source;
+     363           1 :         EXPECT_EQ(nucleusId(8, 4), p.getId());
+     364           1 :         EXPECT_LE(5 * EeV, p.getEnergy());
+     365           1 :         EXPECT_GE(100 * EeV, p.getEnergy());
+     366           2 :         EXPECT_EQ(Vector3d(10, 0, 0) * Mpc, p.getPosition());
+     367             : 
+     368             :         p = c.created;
+     369           1 :         EXPECT_EQ(nucleusId(8, 4), p.getId());
+     370           1 :         EXPECT_LE(5 * EeV, p.getEnergy());
+     371           1 :         EXPECT_GE(100 * EeV, p.getEnergy());
+     372           2 :         EXPECT_EQ(Vector3d(10, 0, 0) * Mpc, p.getPosition());
+     373             : 
+     374             :         p = c.previous;
+     375           1 :         EXPECT_EQ(nucleusId(8, 4), p.getId());
+     376           1 :         EXPECT_LE(5 * EeV, p.getEnergy());
+     377           1 :         EXPECT_GE(100 * EeV, p.getEnergy());
+     378           2 :         EXPECT_EQ(Vector3d(10, 0, 0) * Mpc, p.getPosition());
+     379             : 
+     380             :         p = c.current;
+     381           1 :         EXPECT_EQ(nucleusId(8, 4), p.getId());
+     382           1 :         EXPECT_LE(5 * EeV, p.getEnergy());
+     383           1 :         EXPECT_GE(100 * EeV, p.getEnergy());
+     384           2 :         EXPECT_EQ(Vector3d(10, 0, 0) * Mpc, p.getPosition());
+     385           2 : }
+     386             : 
+     387           2 : TEST(SourceList, simpleTest) {
+     388             :         // test if source list works with one source
+     389             :         SourceList sourceList;
+     390           1 :         ref_ptr<Source> source = new Source;
+     391           1 :         source->add(new SourcePosition(Vector3d(10, 0, 0)));
+     392           1 :         sourceList.add(source);
+     393             : 
+     394           1 :         ref_ptr<Candidate> c = sourceList.getCandidate();
+     395             : 
+     396           2 :         EXPECT_EQ(Vector3d(10, 0, 0), c->created.getPosition());
+     397           2 :         EXPECT_EQ(Vector3d(10, 0, 0), c->previous.getPosition());
+     398           2 :         EXPECT_EQ(Vector3d(10, 0, 0), c->current.getPosition());
+     399           1 : }
+     400             : 
+     401           2 : TEST(SourceList, noSource) {
+     402             :         // test if an error is thrown when source list empty
+     403             :         SourceList sourceList;
+     404           1 :         EXPECT_THROW(sourceList.getCandidate(), std::runtime_error);
+     405           1 : }
+     406             : 
+     407           2 : TEST(SourceList, luminosity) {
+     408             :         // test if the sources are dialed according to their luminosities
+     409             :         SourceList sourceList;
+     410             : 
+     411           1 :         ref_ptr<Source> source1 = new Source;
+     412           1 :         source1->add(new SourceEnergy(100));
+     413           1 :         sourceList.add(source1, 80);
+     414             : 
+     415           1 :         ref_ptr<Source> source2 = new Source;
+     416           1 :         source2->add(new SourceEnergy(0));
+     417           1 :         sourceList.add(source2, 20);
+     418             : 
+     419             :         double meanE = 0;
+     420        1001 :         for (int i = 0; i < 1000; i++) {
+     421        1000 :                 ref_ptr<Candidate> c = sourceList.getCandidate();
+     422        1000 :                 meanE += c->created.getEnergy();
+     423             :         }
+     424           1 :         meanE /= 1000;
+     425           1 :         EXPECT_NEAR(80, meanE, 4); // this test can stochastically fail
+     426           1 : }
+     427             : 
+     428           1 : TEST(SourceTag, sourceTag) {
+     429           1 :         SourceTag tag("mySourceTag");
+     430           1 :         Candidate c;
+     431           1 :         tag.prepareCandidate(c);
+     432           2 :         EXPECT_TRUE(c.getTagOrigin() == "mySourceTag");
+     433           1 : }
+     434             : 
+     435           0 : int main(int argc, char **argv) {
+     436           0 :         ::testing::InitGoogleTest(&argc, argv);
+     437           0 :         return RUN_ALL_TESTS();
+     438             : }
+     439             : 
+     440             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testTurbulentField.cpp.func-sort-c.html b/doc/coverageReport/test/testTurbulentField.cpp.func-sort-c.html new file mode 100644 index 000000000..f9a2c170f --- /dev/null +++ b/doc/coverageReport/test/testTurbulentField.cpp.func-sort-c.html @@ -0,0 +1,104 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testTurbulentField.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testTurbulentField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:4646100.0 %
Date:2024-04-08 14:58:22Functions:88100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN39testGridTurbulence_Turbulence_seed_Test8TestBodyEv1
_ZN39testTurbulenceSpectrum_constructor_Test8TestBodyEv1
_ZN40testVectorFieldGrid_Turbulence_seed_Test8TestBodyEv1
_ZN45testTurbulenceSpectrum_correlationLength_Test8TestBodyEv1
_ZN46testVectorFieldGrid_Turbulence_bmean_brms_Test8TestBodyEv1
_ZN46testVectorFieldGrid_turbulence_Exceptions_Test8TestBodyEv1
_ZN60testSimpleGridTurbulence_oldFunctionForCrrelationLength_Test8TestBodyEv1
main1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testTurbulentField.cpp.func.html b/doc/coverageReport/test/testTurbulentField.cpp.func.html new file mode 100644 index 000000000..4a96c6309 --- /dev/null +++ b/doc/coverageReport/test/testTurbulentField.cpp.func.html @@ -0,0 +1,104 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testTurbulentField.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testTurbulentField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:4646100.0 %
Date:2024-04-08 14:58:22Functions:88100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN39testGridTurbulence_Turbulence_seed_Test8TestBodyEv1
_ZN39testTurbulenceSpectrum_constructor_Test8TestBodyEv1
_ZN40testVectorFieldGrid_Turbulence_seed_Test8TestBodyEv1
_ZN45testTurbulenceSpectrum_correlationLength_Test8TestBodyEv1
_ZN46testVectorFieldGrid_Turbulence_bmean_brms_Test8TestBodyEv1
_ZN46testVectorFieldGrid_turbulence_Exceptions_Test8TestBodyEv1
_ZN60testSimpleGridTurbulence_oldFunctionForCrrelationLength_Test8TestBodyEv1
main1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testTurbulentField.cpp.gcov.html b/doc/coverageReport/test/testTurbulentField.cpp.gcov.html new file mode 100644 index 000000000..642a3acef --- /dev/null +++ b/doc/coverageReport/test/testTurbulentField.cpp.gcov.html @@ -0,0 +1,218 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testTurbulentField.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testTurbulentField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:4646100.0 %
Date:2024-04-08 14:58:22Functions:88100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include <stdexcept>
+       2             : 
+       3             : #include "crpropa/Grid.h"
+       4             : #include "crpropa/Units.h"
+       5             : #include "crpropa/Common.h"
+       6             : #include "crpropa/GridTools.h"
+       7             : #include "crpropa/magneticField/turbulentField/TurbulentField.h"
+       8             : #include "crpropa/magneticField/turbulentField/GridTurbulence.h"
+       9             : #include "crpropa/magneticField/turbulentField/PlaneWaveTurbulence.h"
+      10             : #include "crpropa/magneticField/turbulentField/SimpleGridTurbulence.h"
+      11             : 
+      12             : #include "gtest/gtest.h"
+      13             : 
+      14             : using namespace crpropa;
+      15             : 
+      16             : //check problems brought up in https://github.com/CRPropa/CRPropa3/issues/322
+      17           1 : TEST(testTurbulenceSpectrum, constructor) {
+      18             :         double sIndex = 5./3.;
+      19             :         double qIndex = 4.;
+      20             :         double bendOver = 1.;
+      21             :         double lMin = 1.; 
+      22             :         double lMax = 10.; 
+      23             :         double brms = 1*muG;
+      24           1 :         auto spectrum = TurbulenceSpectrum(brms, lMin, lMax);
+      25           1 :         EXPECT_DOUBLE_EQ(spectrum.getBrms(), brms);
+      26           1 :         EXPECT_DOUBLE_EQ(spectrum.getLmin(), lMin);
+      27           1 :         EXPECT_DOUBLE_EQ(spectrum.getLmax(), lMax);
+      28           1 :         EXPECT_DOUBLE_EQ(spectrum.getLbendover(), bendOver); //default
+      29           1 :         EXPECT_DOUBLE_EQ(spectrum.getSindex(), sIndex); //default
+      30           1 :         EXPECT_DOUBLE_EQ(spectrum.getQindex(), qIndex); //default
+      31           1 : }
+      32             : 
+      33           1 : TEST(testTurbulenceSpectrum, correlationLength) {
+      34             :         double lMin = 0.00001; // not used for Lc
+      35             :         double lMax = 9999999; // not used for Lc
+      36             :         double lBo = 100;
+      37           1 :         auto spectrum = TurbulenceSpectrum(1*muG, lMin, lMax, lBo);
+      38             :         auto Lc = spectrum.getCorrelationLength();
+      39           1 :     EXPECT_NEAR(Lc, 0.498*lBo, 0.001*lBo);
+      40           1 : }
+      41             : 
+      42             : #ifdef CRPROPA_HAVE_FFTW3F
+      43             : 
+      44           1 : TEST(testSimpleGridTurbulence, oldFunctionForCrrelationLength) { //TODO: remove in future
+      45             :         double lMin = 1*kpc;
+      46             :         double lMax = 1*Gpc;
+      47             :         double alpha = -11/3.;
+      48           1 :         auto Lc = turbulentCorrelationLength(lMin, lMax, alpha);
+      49           1 :     EXPECT_NEAR(Lc, lMax/5, 1*Mpc);
+      50           1 : }
+      51             : 
+      52           2 : TEST(testVectorFieldGrid, Turbulence_bmean_brms) {
+      53             :         // Test for zero mean: <B> = 0
+      54             :         size_t n = 64;
+      55             :         double spacing = 10 * Mpc / n;
+      56             :         double Brms = 1;
+      57             :         double lMin = 2 * spacing;
+      58             :         double lMax = 8 * spacing;
+      59             : 
+      60             :         auto spectrum = SimpleTurbulenceSpectrum(Brms, lMin, lMax);
+      61             :         auto gp = GridProperties(Vector3d(0, 0, 0), n, spacing);
+      62           1 :     auto tf = SimpleGridTurbulence(spectrum, gp);
+      63           1 :         auto grid = tf.getGrid();
+      64             : 
+      65             :         double precision = 1e-7;
+      66           1 :         Vector3f bMean = meanFieldVector(grid);
+      67           1 :         EXPECT_NEAR(0, bMean.x, precision);
+      68           1 :         EXPECT_NEAR(0, bMean.y, precision);
+      69           1 :         EXPECT_NEAR(0, bMean.z, precision);
+      70           2 :         EXPECT_NEAR(1, rmsFieldStrength(grid), precision);
+      71           1 : }
+      72             : 
+      73           2 : TEST(testVectorFieldGrid, Turbulence_seed) {
+      74             :         // Test if seeding produces 2 identical fields
+      75             :         size_t n = 64;
+      76             :         double spacing = 1 * Mpc;
+      77             :         double Brms = 1;
+      78             :         double lMin = 2 * spacing;
+      79             :         double lMax = 8 * spacing;
+      80             :         int seed = 753;
+      81             :         
+      82             :         auto spectrum = SimpleTurbulenceSpectrum(Brms, lMin, lMax);
+      83             : 
+      84             :         auto gp1 = GridProperties(Vector3d(0, 0, 0), n, spacing);
+      85           1 :     auto tf1 = SimpleGridTurbulence(spectrum, gp1,  seed);
+      86             : 
+      87             :         auto gp2 = GridProperties(Vector3d(0, 0, 0), n, spacing);
+      88           1 :     auto tf2 = SimpleGridTurbulence(spectrum, gp2, seed);
+      89             : 
+      90             :         Vector3d pos(22 * Mpc);
+      91           1 :         EXPECT_FLOAT_EQ(tf1.getField(pos).x, tf2.getField(pos).x);
+      92           1 : }
+      93             : 
+      94             : #ifndef CRPROPA_TESTS_SKIP_EXCEPTIONS
+      95           2 : TEST(testVectorFieldGrid, turbulence_Exceptions) {
+      96             :         // Test exceptions
+      97             :         size_t n = 64;
+      98             :         double spacing = 10 * Mpc / n;
+      99             :         double brms = 1;
+     100           1 :         ref_ptr<Grid3f> grid = new Grid3f(Vector3d(0, 0, 0), n, spacing);
+     101             : 
+     102             :         // should be fine
+     103           2 :         EXPECT_NO_THROW(initTurbulence(grid, brms, 2 * spacing, 8 * spacing));
+     104             :         // lMin too small
+     105           2 :         EXPECT_THROW(initTurbulence(grid, brms, 1.5 * spacing, 8 * spacing),
+     106             :                         std::runtime_error);
+     107             :         // lMin > lMax
+     108           2 :         EXPECT_THROW(initTurbulence(grid, brms, 8.1 * spacing, 8 * spacing),
+     109             :                         std::runtime_error);
+     110             :         // lMax too large
+     111           2 :         EXPECT_THROW(initTurbulence(grid, brms, 2 * spacing, 65 * spacing),
+     112             :                         std::runtime_error);
+     113           1 : }
+     114             : #endif
+     115             : 
+     116           1 : TEST(testGridTurbulence, Turbulence_seed) {
+     117             :         // Test if seeding produces 2 identical fields
+     118             :         size_t n = 64;
+     119             :         double spacing = 1 * Mpc;
+     120             :         double Brms = 1;
+     121             :         double lMin = 2 * spacing;
+     122             :         double lMax = 8 * spacing;
+     123             :         double lBo = lMax/6;
+     124             :         int seed = 137;
+     125             :         
+     126           1 :         auto spectrum = TurbulenceSpectrum(Brms, lMin, lMax, lBo);
+     127             : 
+     128             :         auto gp1 = GridProperties(Vector3d(0, 0, 0), n, spacing);
+     129           1 :     auto tf1 = GridTurbulence(spectrum, gp1, seed);
+     130             : 
+     131             :         auto gp2 = GridProperties(Vector3d(0, 0, 0), n, spacing);
+     132           1 :     auto tf2 = GridTurbulence(spectrum, gp2, seed);
+     133             : 
+     134             :         Vector3d pos(22 * Mpc);
+     135           1 :         EXPECT_FLOAT_EQ(tf1.getField(pos).x, tf2.getField(pos).x);
+     136           1 : }
+     137             : #endif // CRPROPA_HAVE_FFTW3F
+     138             : 
+     139           1 : int main(int argc, char **argv) {
+     140           1 :         ::testing::InitGoogleTest(&argc, argv);
+     141             :         return RUN_ALL_TESTS();
+     142             : }
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testVector3.cpp.func-sort-c.html b/doc/coverageReport/test/testVector3.cpp.func-sort-c.html new file mode 100644 index 000000000..b7177d48e --- /dev/null +++ b/doc/coverageReport/test/testVector3.cpp.func-sort-c.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testVector3.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testVector3.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:909396.8 %
Date:2024-04-08 14:58:22Functions:121392.3 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa4mainEiPPc0
_ZN7crpropa16Vector3_dot_Test8TestBodyEv1
_ZN7crpropa16Vector3_mod_Test8TestBodyEv1
_ZN7crpropa18Vector3_angle_Test8TestBodyEv1
_ZN7crpropa18Vector3_cross_Test8TestBodyEv1
_ZN7crpropa21Vector3_distance_Test8TestBodyEv1
_ZN7crpropa21Vector3_division_Test8TestBodyEv1
_ZN7crpropa21Vector3_rotation_Test8TestBodyEv1
_ZN7crpropa22Vector3_magnitude_Test8TestBodyEv1
_ZN7crpropa23Vector3_comparison_Test8TestBodyEv1
_ZN7crpropa24Vector3_unitVectors_Test8TestBodyEv1
_ZN7crpropa27Vector3_multiplication_Test8TestBodyEv1
_ZN7crpropa34Vector3_parallelPerpendicular_Test8TestBodyEv1
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testVector3.cpp.func.html b/doc/coverageReport/test/testVector3.cpp.func.html new file mode 100644 index 000000000..f79586ce3 --- /dev/null +++ b/doc/coverageReport/test/testVector3.cpp.func.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testVector3.cpp - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testVector3.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:909396.8 %
Date:2024-04-08 14:58:22Functions:121392.3 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16Vector3_dot_Test8TestBodyEv1
_ZN7crpropa16Vector3_mod_Test8TestBodyEv1
_ZN7crpropa18Vector3_angle_Test8TestBodyEv1
_ZN7crpropa18Vector3_cross_Test8TestBodyEv1
_ZN7crpropa21Vector3_distance_Test8TestBodyEv1
_ZN7crpropa21Vector3_division_Test8TestBodyEv1
_ZN7crpropa21Vector3_rotation_Test8TestBodyEv1
_ZN7crpropa22Vector3_magnitude_Test8TestBodyEv1
_ZN7crpropa23Vector3_comparison_Test8TestBodyEv1
_ZN7crpropa24Vector3_unitVectors_Test8TestBodyEv1
_ZN7crpropa27Vector3_multiplication_Test8TestBodyEv1
_ZN7crpropa34Vector3_parallelPerpendicular_Test8TestBodyEv1
_ZN7crpropa4mainEiPPc0
+
+
+ + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/test/testVector3.cpp.gcov.html b/doc/coverageReport/test/testVector3.cpp.gcov.html new file mode 100644 index 000000000..a1e919522 --- /dev/null +++ b/doc/coverageReport/test/testVector3.cpp.gcov.html @@ -0,0 +1,238 @@ + + + + + + + LCOV - coverage.info.cleaned - test/testVector3.cpp + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - test - testVector3.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:909396.8 %
Date:2024-04-08 14:58:22Functions:121392.3 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : #include "crpropa/Vector3.h"
+       2             : #include "gtest/gtest.h"
+       3             : 
+       4             : namespace crpropa {
+       5             : 
+       6           2 : TEST(Vector3, comparison) {
+       7             :         EXPECT_TRUE(Vector3d(1, 2, 3) == Vector3d(1, 2, 3));
+       8             :         EXPECT_FALSE(Vector3d(1, 2, 3) == Vector3d(2, 3, 4));
+       9           1 : }
+      10             : 
+      11           1 : TEST(Vector3, multiplication) {
+      12             :         Vector3d v(1);
+      13             :         v *= 10;
+      14           1 :         EXPECT_DOUBLE_EQ(v.x, 10);
+      15           1 :         EXPECT_DOUBLE_EQ(v.y, 10);
+      16           1 :         EXPECT_DOUBLE_EQ(v.z, 10);
+      17             :         v = Vector3d(1) * Vector3d(2); // element-wise multiplication
+      18           1 :         EXPECT_DOUBLE_EQ(v.x, 2);
+      19           1 :         EXPECT_DOUBLE_EQ(v.y, 2);
+      20           1 :         EXPECT_DOUBLE_EQ(v.z, 2);
+      21           1 : }
+      22             : 
+      23           1 : TEST(Vector3, division) {
+      24             :         Vector3d v(10);
+      25             :         v /= 10;
+      26           1 :         EXPECT_DOUBLE_EQ(v.x, 1);
+      27           1 :         EXPECT_DOUBLE_EQ(v.y, 1);
+      28           1 :         EXPECT_DOUBLE_EQ(v.z, 1);
+      29             :         v = Vector3d(10) / Vector3d(2); // element-wise division
+      30           1 :         EXPECT_DOUBLE_EQ(v.x, 5);
+      31           1 :         EXPECT_DOUBLE_EQ(v.y, 5);
+      32           1 :         EXPECT_DOUBLE_EQ(v.z, 5);
+      33           1 : }
+      34             : 
+      35           2 : TEST(Vector3, mod) {
+      36             :         Vector3d v(10.1, 10.2, 10.3);
+      37           1 :         v %= 10.2;
+      38           1 :         EXPECT_NEAR(v.x, 10.1, 1e-10); // mod doesn't preserve double precision
+      39           1 :         EXPECT_NEAR(v.y, 0, 1e-10);
+      40           1 :         EXPECT_NEAR(v.z, 0.1, 1e-10);
+      41           1 : }
+      42             : 
+      43           1 : TEST(Vector3, dot) {
+      44             :         double a = Vector3d(1, 0, 0).dot(Vector3d(0, 1, 0));
+      45           1 :         EXPECT_DOUBLE_EQ(a, 0);
+      46             :         double b = Vector3d(-1, 10, 2).dot(Vector3d(5, 1, -3));
+      47           1 :         EXPECT_DOUBLE_EQ(b, -1);
+      48           1 : }
+      49             : 
+      50           2 : TEST(Vector3, cross) {
+      51             :         Vector3d v = Vector3d(1, 0, 0).cross(Vector3d(0, 1, 0));
+      52             :         EXPECT_TRUE(v == Vector3d(0, 0, 1));
+      53           1 : }
+      54             : 
+      55           2 : TEST(Vector3, angle) {
+      56             :         // 45 degrees
+      57           1 :         double a = Vector3d(1, 1, 0).getAngleTo(Vector3d(1, 0, 0));
+      58           1 :         EXPECT_DOUBLE_EQ(a, 45 * M_PI / 180);
+      59             :         // perpendicular vectors
+      60           1 :         double b = Vector3d(0, 0, 1).getAngleTo(Vector3d(0, 0, 1));
+      61           1 :         EXPECT_DOUBLE_EQ(b, 0);
+      62           1 : }
+      63             : 
+      64           2 : TEST(Vector3, unitVectors) {
+      65             :         Vector3d v = Vector3d(2, 0, 0);
+      66           1 :         Vector3d er = v.getUnitVector();
+      67           1 :         Vector3d et = v.getUnitVectorTheta();
+      68           1 :         Vector3d ep = v.getUnitVectorPhi();
+      69             : 
+      70             :         // trigonometrical functions don't preserve double precision
+      71             :         double eps = 1e-16;
+      72           1 :         EXPECT_NEAR(er.x, 1, eps);
+      73           1 :         EXPECT_NEAR(er.y, 0, eps);
+      74           1 :         EXPECT_NEAR(er.z, 0, eps);
+      75             : 
+      76           1 :         EXPECT_NEAR(et.x, 0, eps);
+      77           1 :         EXPECT_NEAR(et.y, 0, eps);
+      78           1 :         EXPECT_NEAR(et.z, -1, eps);
+      79             : 
+      80           1 :         EXPECT_NEAR(ep.x, 0, eps);
+      81           1 :         EXPECT_NEAR(ep.y, 1, eps);
+      82           1 :         EXPECT_NEAR(ep.z, 0, eps);
+      83           1 : }
+      84             : 
+      85           1 : TEST(Vector3, magnitude) {
+      86             :         Vector3d v = Vector3d(1, 2, -2);
+      87           1 :         EXPECT_DOUBLE_EQ(v.getR(), 3);
+      88           1 :         EXPECT_DOUBLE_EQ(v.getR2(), 9);
+      89           1 : }
+      90             : 
+      91           2 : TEST(Vector3, distance) {
+      92           1 :         double a = Vector3d(10, 0, 10).getDistanceTo(Vector3d(10, 0, 0));
+      93           1 :         EXPECT_DOUBLE_EQ(a, 10);
+      94           1 : }
+      95             : 
+      96           2 : TEST(Vector3, rotation) {
+      97             :         Vector3d v, w;
+      98             : 
+      99             :         // rotation by 180 degrees
+     100             :         v = Vector3d(10, 0, 0);
+     101           1 :         w = v.getRotated(Vector3d(0, 2, 0), M_PI);
+     102           1 :         EXPECT_NEAR(w.x, -10, 1e-9);
+     103           1 :         EXPECT_NEAR(w.y, 0, 1e-9);
+     104           1 :         EXPECT_NEAR(w.z, 0, 1e-9);
+     105             : 
+     106             :         // rotation axis parallel to vector --> no rotation
+     107             :         v = Vector3d(10, 0, 0);
+     108           1 :         w = v.getRotated(Vector3d(1, 0, 0), M_PI);
+     109           1 :         EXPECT_NEAR(w.x, 10, 1e-9);
+     110           1 :         EXPECT_NEAR(w.y, 0, 1e-9);
+     111           1 :         EXPECT_NEAR(w.z, 0, 1e-9);
+     112             : 
+     113             :         // rotation by 360 degrees
+     114             :         v = Vector3d(5, 2, 7);
+     115           1 :         w = v.getRotated(Vector3d(1, 8, -4), 2 * M_PI);
+     116           1 :         EXPECT_NEAR(w.x, 5, 1e-9);
+     117           1 :         EXPECT_NEAR(w.y, 2, 1e-9);
+     118           1 :         EXPECT_NEAR(w.z, 7, 1e-9);
+     119             : 
+     120             :         // rotation by zero degrees
+     121             :         v = Vector3d(1, 0, 0);
+     122           1 :         w = v.getRotated(Vector3d(0,1,0), 0);
+     123             : 
+     124           1 :         EXPECT_NEAR(w.x, 1, 1e-9);
+     125           1 :         EXPECT_NEAR(w.y, 0, 1e-9);
+     126           1 :         EXPECT_NEAR(w.z, 0, 1e-9);
+     127             : 
+     128             :         // rotation around zero axis
+     129             :         v = Vector3d(1, 0, 0);
+     130             :         Vector3d a = v.cross(v);
+     131           1 :         w = v.getRotated(a, 0);
+     132             : 
+     133           1 :         EXPECT_NEAR(w.x, 1, 1e-9);
+     134           1 :         EXPECT_NEAR(w.y, 0, 1e-9);
+     135           1 :         EXPECT_NEAR(w.z, 0, 1e-9);
+     136             : 
+     137             : 
+     138             : 
+     139             : 
+     140           1 : }
+     141             : 
+     142           2 : TEST(Vector3, parallelPerpendicular) {
+     143             :         Vector3d v(3, 2, 1);
+     144             :         Vector3d w(0, 1, 0);
+     145             : 
+     146           1 :         Vector3d vpara = v.getParallelTo(w);
+     147           1 :         Vector3d vperp = v.getPerpendicularTo(w);
+     148             : 
+     149           1 :         EXPECT_DOUBLE_EQ(vpara.x, 0);
+     150           1 :         EXPECT_DOUBLE_EQ(vpara.y, 2);
+     151           1 :         EXPECT_DOUBLE_EQ(vpara.z, 0);
+     152           1 :         EXPECT_DOUBLE_EQ(vperp.x, 3);
+     153           1 :         EXPECT_DOUBLE_EQ(vperp.y, 0);
+     154           1 :         EXPECT_DOUBLE_EQ(vperp.z, 1);
+     155           1 : }
+     156             : 
+     157           0 : int main(int argc, char **argv) {
+     158           0 :         ::testing::InitGoogleTest(&argc, argv);
+     159           0 :         return RUN_ALL_TESTS();
+     160             : }
+     161             : 
+     162             : } // namespace crpropa
+
+
+
+ + + + +
Generated by: LCOV version 1.14
+
+ + + diff --git a/doc/coverageReport/updown.png b/doc/coverageReport/updown.png new file mode 100644 index 0000000000000000000000000000000000000000..aa56a238b3e6c435265250f9266cd1b8caba0f20 GIT binary patch literal 117 zcmeAS@N?(olHy`uVBq!ia0vp^AT}Qd8;}%R+`Ae`*?77*hG?8mPH5^{)z4*}Q$iB}huR`+ literal 0 HcmV?d00001 diff --git a/doc/pages/Code-Coverage.md b/doc/pages/Code-Coverage.md index 699f79eab..a70872b04 100644 --- a/doc/pages/Code-Coverage.md +++ b/doc/pages/Code-Coverage.md @@ -16,3 +16,10 @@ make test make coverage ``` The final report is in ```~/build/coverageReport/index.html``` + + +### Code Coverage for the current master version +The report for the current master branch version can be found here. + +.. toctree:: + conerageReport/index.html \ No newline at end of file From 2468e864561697c94f1d0425b4472f65784f7bfb Mon Sep 17 00:00:00 2001 From: Julien Date: Tue, 9 Apr 2024 10:49:25 +0200 Subject: [PATCH 2/7] add coverage report link in docu, remove pre-build coveragereport and use build instead --- .github/workflows/create_documentation.yml | 1 + doc/coverageReport/amber.png | Bin 141 -> 0 bytes doc/coverageReport/emerald.png | Bin 141 -> 0 bytes doc/coverageReport/gcov.css | 519 ----- doc/coverageReport/glass.png | Bin 167 -> 0 bytes .../numpy/__multiarray_api.h.func-sort-c.html | 76 - .../numpy/__multiarray_api.h.func.html | 76 - .../numpy/__multiarray_api.h.gcov.html | 1642 ------------- .../numpy/__ufunc_api.h.func-sort-c.html | 76 - .../include/numpy/__ufunc_api.h.func.html | 76 - .../include/numpy/__ufunc_api.h.gcov.html | 390 ---- .../core/include/numpy/index-sort-f.html | 113 - .../core/include/numpy/index-sort-l.html | 113 - .../numpy/core/include/numpy/index.html | 113 - .../numpy/ndarraytypes.h.func-sort-c.html | 72 - .../include/numpy/ndarraytypes.h.func.html | 72 - .../include/numpy/ndarraytypes.h.gcov.html | 2021 ---------------- .../crpropa/AssocVector.h.func-sort-c.html | 92 - .../include/crpropa/AssocVector.h.func.html | 92 - .../include/crpropa/AssocVector.h.gcov.html | 457 ---- .../crpropa/Candidate.h.func-sort-c.html | 72 - .../include/crpropa/Candidate.h.func.html | 72 - .../include/crpropa/Candidate.h.gcov.html | 258 -- .../include/crpropa/Common.h.func-sort-c.html | 80 - .../include/crpropa/Common.h.func.html | 80 - .../include/crpropa/Common.h.gcov.html | 163 -- .../crpropa/EmissionMap.h.func-sort-c.html | 72 - .../include/crpropa/EmissionMap.h.func.html | 72 - .../include/crpropa/EmissionMap.h.gcov.html | 212 -- .../crpropa/Geometry.h.func-sort-c.html | 76 - .../include/crpropa/Geometry.h.func.html | 76 - .../include/crpropa/Geometry.h.gcov.html | 165 -- .../include/crpropa/Grid.h.func-sort-c.html | 296 --- .../include/crpropa/Grid.h.func.html | 296 --- .../include/crpropa/Grid.h.gcov.html | 640 ----- .../crpropa/Logging.h.func-sort-c.html | 96 - .../include/crpropa/Logging.h.func.html | 96 - .../include/crpropa/Logging.h.gcov.html | 111 - .../include/crpropa/Module.h.func-sort-c.html | 72 - .../include/crpropa/Module.h.func.html | 72 - .../include/crpropa/Module.h.gcov.html | 141 -- .../crpropa/ParticleState.h.func-sort-c.html | 72 - .../include/crpropa/ParticleState.h.func.html | 72 - .../include/crpropa/ParticleState.h.gcov.html | 196 -- .../PhotonBackground.h.func-sort-c.html | 148 -- .../crpropa/PhotonBackground.h.func.html | 148 -- .../crpropa/PhotonBackground.h.gcov.html | 398 ---- .../include/crpropa/Random.h.func-sort-c.html | 72 - .../include/crpropa/Random.h.func.html | 72 - .../include/crpropa/Random.h.gcov.html | 317 --- .../crpropa/Referenced.h.func-sort-c.html | 148 -- .../include/crpropa/Referenced.h.func.html | 148 -- .../include/crpropa/Referenced.h.gcov.html | 320 --- .../include/crpropa/Source.h.func-sort-c.html | 76 - .../include/crpropa/Source.h.func.html | 76 - .../include/crpropa/Source.h.gcov.html | 1002 -------- .../crpropa/Variant.h.func-sort-c.html | 136 -- .../include/crpropa/Variant.h.func.html | 136 -- .../include/crpropa/Variant.h.gcov.html | 410 ---- .../crpropa/Vector3.h.func-sort-c.html | 236 -- .../include/crpropa/Vector3.h.func.html | 236 -- .../include/crpropa/Vector3.h.gcov.html | 516 ---- .../AdvectionField.h.func-sort-c.html | 72 - .../advectionField/AdvectionField.h.func.html | 72 - .../advectionField/AdvectionField.h.gcov.html | 367 --- .../crpropa/advectionField/index-sort-f.html | 93 - .../crpropa/advectionField/index-sort-l.html | 93 - .../include/crpropa/advectionField/index.html | 93 - .../include/crpropa/index-sort-f.html | 233 -- .../include/crpropa/index-sort-l.html | 233 -- doc/coverageReport/include/crpropa/index.html | 233 -- .../GalacticMagneticField.h.func-sort-c.html | 88 - .../GalacticMagneticField.h.func.html | 88 - .../GalacticMagneticField.h.gcov.html | 210 -- .../MagneticField.h.func-sort-c.html | 100 - .../magneticField/MagneticField.h.func.html | 100 - .../magneticField/MagneticField.h.gcov.html | 248 -- .../MagneticFieldGrid.h.func-sort-c.html | 72 - .../MagneticFieldGrid.h.func.html | 72 - .../MagneticFieldGrid.h.gcov.html | 139 -- .../crpropa/magneticField/index-sort-f.html | 113 - .../crpropa/magneticField/index-sort-l.html | 113 - .../include/crpropa/magneticField/index.html | 113 - .../GridTurbulence.h.func-sort-c.html | 72 - .../turbulentField/GridTurbulence.h.func.html | 72 - .../turbulentField/GridTurbulence.h.gcov.html | 151 -- .../HelicalGridTurbulence.h.func-sort-c.html | 76 - .../HelicalGridTurbulence.h.func.html | 76 - .../HelicalGridTurbulence.h.gcov.html | 147 -- .../SimpleGridTurbulence.h.func-sort-c.html | 100 - .../SimpleGridTurbulence.h.func.html | 100 - .../SimpleGridTurbulence.h.gcov.html | 192 -- .../TurbulentField.h.func-sort-c.html | 108 - .../turbulentField/TurbulentField.h.func.html | 108 - .../turbulentField/TurbulentField.h.gcov.html | 195 -- .../turbulentField/index-sort-f.html | 123 - .../turbulentField/index-sort-l.html | 123 - .../magneticField/turbulentField/index.html | 123 - .../MagneticLens.h.func-sort-c.html | 96 - .../magneticLens/MagneticLens.h.func.html | 96 - .../magneticLens/MagneticLens.h.gcov.html | 352 --- .../ParticleMapsContainer.h.func-sort-c.html | 80 - .../ParticleMapsContainer.h.func.html | 80 - .../ParticleMapsContainer.h.gcov.html | 221 -- .../Pixelization.h.func-sort-c.html | 84 - .../magneticLens/Pixelization.h.func.html | 84 - .../magneticLens/Pixelization.h.gcov.html | 217 -- .../crpropa/magneticLens/index-sort-f.html | 113 - .../crpropa/magneticLens/index-sort-l.html | 113 - .../include/crpropa/magneticLens/index.html | 113 - .../Cordes.h.func-sort-c.html | 72 - .../massDistribution/Cordes.h.func.html | 72 - .../massDistribution/Cordes.h.gcov.html | 121 - .../Density.h.func-sort-c.html | 116 - .../massDistribution/Density.h.func.html | 116 - .../massDistribution/Density.h.gcov.html | 134 -- .../Ferriere.h.func-sort-c.html | 72 - .../massDistribution/Ferriere.h.func.html | 72 - .../massDistribution/Ferriere.h.gcov.html | 153 -- .../Massdistribution.h.func-sort-c.html | 72 - .../Massdistribution.h.func.html | 72 - .../Massdistribution.h.gcov.html | 212 -- .../Nakanishi.h.func-sort-c.html | 72 - .../massDistribution/Nakanishi.h.func.html | 72 - .../massDistribution/Nakanishi.h.gcov.html | 150 -- .../massDistribution/index-sort-f.html | 133 -- .../massDistribution/index-sort-l.html | 133 -- .../crpropa/massDistribution/index.html | 133 -- .../module/Boundary.h.func-sort-c.html | 72 - .../crpropa/module/Boundary.h.func.html | 72 - .../crpropa/module/Boundary.h.gcov.html | 283 --- .../module/BreakCondition.h.func-sort-c.html | 72 - .../crpropa/module/BreakCondition.h.func.html | 72 - .../crpropa/module/BreakCondition.h.gcov.html | 221 -- .../module/HDF5Output.h.func-sort-c.html | 72 - .../crpropa/module/HDF5Output.h.func.html | 72 - .../crpropa/module/HDF5Output.h.gcov.html | 217 -- .../module/NuclearDecay.h.func-sort-c.html | 72 - .../crpropa/module/NuclearDecay.h.func.html | 72 - .../crpropa/module/NuclearDecay.h.gcov.html | 163 -- .../module/Observer.h.func-sort-c.html | 72 - .../crpropa/module/Observer.h.func.html | 72 - .../crpropa/module/Observer.h.gcov.html | 351 --- .../module/OutputShell.h.func-sort-c.html | 72 - .../crpropa/module/OutputShell.h.func.html | 72 - .../crpropa/module/OutputShell.h.gcov.html | 124 - .../PhotoDisintegration.h.func-sort-c.html | 72 - .../module/PhotoDisintegration.h.func.html | 72 - .../module/PhotoDisintegration.h.gcov.html | 167 -- .../module/PropagationBP.h.func-sort-c.html | 72 - .../crpropa/module/PropagationBP.h.func.html | 72 - .../crpropa/module/PropagationBP.h.gcov.html | 225 -- .../module/PropagationCK.h.func-sort-c.html | 72 - .../crpropa/module/PropagationCK.h.func.html | 72 - .../crpropa/module/PropagationCK.h.gcov.html | 178 -- .../module/Redshift.h.func-sort-c.html | 72 - .../crpropa/module/Redshift.h.func.html | 72 - .../crpropa/module/Redshift.h.gcov.html | 111 - .../SimplePropagation.h.func-sort-c.html | 72 - .../module/SimplePropagation.h.func.html | 72 - .../module/SimplePropagation.h.gcov.html | 115 - .../module/TextOutput.h.func-sort-c.html | 72 - .../crpropa/module/TextOutput.h.func.html | 72 - .../crpropa/module/TextOutput.h.gcov.html | 155 -- .../crpropa/module/Tools.h.func-sort-c.html | 72 - .../include/crpropa/module/Tools.h.func.html | 72 - .../include/crpropa/module/Tools.h.gcov.html | 150 -- .../include/crpropa/module/index-sort-f.html | 213 -- .../include/crpropa/module/index-sort-l.html | 213 -- .../include/crpropa/module/index.html | 213 -- doc/coverageReport/index-sort-f.html | 293 --- doc/coverageReport/index-sort-l.html | 293 --- doc/coverageReport/index.html | 293 --- .../src/ParticleIDMethods.cc.func-sort-c.html | 200 -- .../HepPID/src/ParticleIDMethods.cc.func.html | 200 -- .../HepPID/src/ParticleIDMethods.cc.gcov.html | 641 ----- .../src/ParticleName.cc.func-sort-c.html | 124 - .../libs/HepPID/src/ParticleName.cc.func.html | 124 - .../libs/HepPID/src/ParticleName.cc.gcov.html | 2075 ----------------- .../HepPID/src/Version.cc.func-sort-c.html | 84 - .../libs/HepPID/src/Version.cc.func.html | 84 - .../libs/HepPID/src/Version.cc.gcov.html | 106 - .../libs/HepPID/src/index-sort-f.html | 113 - .../libs/HepPID/src/index-sort-l.html | 113 - doc/coverageReport/libs/HepPID/src/index.html | 113 - .../error_handling.cc.func-sort-c.html | 100 - .../healpix_base/error_handling.cc.func.html | 100 - .../healpix_base/error_handling.cc.gcov.html | 136 -- .../geom_utils.cc.func-sort-c.html | 84 - .../libs/healpix_base/geom_utils.cc.func.html | 84 - .../libs/healpix_base/geom_utils.cc.gcov.html | 151 -- .../healpix_base.cc.func-sort-c.html | 436 ---- .../healpix_base/healpix_base.cc.func.html | 436 ---- .../healpix_base/healpix_base.cc.gcov.html | 1454 ------------ .../alloc_utils.h.func-sort-c.html | 96 - .../healpix_base/alloc_utils.h.func.html | 96 - .../healpix_base/alloc_utils.h.gcov.html | 154 -- .../healpix_base/arr.h.func-sort-c.html | 76 - .../include/healpix_base/arr.h.func.html | 76 - .../include/healpix_base/arr.h.gcov.html | 734 ------ .../error_handling.h.func-sort-c.html | 76 - .../healpix_base/error_handling.h.func.html | 76 - .../healpix_base/error_handling.h.gcov.html | 180 -- .../geom_utils.h.func-sort-c.html | 80 - .../healpix_base/geom_utils.h.func.html | 80 - .../healpix_base/geom_utils.h.gcov.html | 161 -- .../healpix_base.h.func-sort-c.html | 208 -- .../healpix_base/healpix_base.h.func.html | 208 -- .../healpix_base/healpix_base.h.gcov.html | 457 ---- .../include/healpix_base/index-sort-f.html | 173 -- .../include/healpix_base/index-sort-l.html | 173 -- .../include/healpix_base/index.html | 173 -- .../math_utils.h.func-sort-c.html | 88 - .../healpix_base/math_utils.h.func.html | 88 - .../healpix_base/math_utils.h.gcov.html | 259 -- .../healpix_base/pointing.h.func-sort-c.html | 72 - .../include/healpix_base/pointing.h.func.html | 72 - .../include/healpix_base/pointing.h.gcov.html | 161 -- .../healpix_base/rangeset.h.func-sort-c.html | 120 - .../include/healpix_base/rangeset.h.func.html | 120 - .../include/healpix_base/rangeset.h.gcov.html | 363 --- .../healpix_base/vec3.h.func-sort-c.html | 80 - .../include/healpix_base/vec3.h.func.html | 80 - .../include/healpix_base/vec3.h.gcov.html | 229 -- .../libs/healpix_base/index-sort-f.html | 123 - .../libs/healpix_base/index-sort-l.html | 123 - .../libs/healpix_base/index.html | 123 - .../healpix_base/pointing.cc.func-sort-c.html | 92 - .../libs/healpix_base/pointing.cc.func.html | 92 - .../libs/healpix_base/pointing.cc.gcov.html | 148 -- .../include/kiss/convert.h.func-sort-c.html | 76 - .../kiss/include/kiss/convert.h.func.html | 76 - .../kiss/include/kiss/convert.h.gcov.html | 150 -- .../libs/kiss/include/kiss/index-sort-f.html | 103 - .../libs/kiss/include/kiss/index-sort-l.html | 103 - .../libs/kiss/include/kiss/index.html | 103 - .../include/kiss/logger.h.func-sort-c.html | 336 --- .../libs/kiss/include/kiss/logger.h.func.html | 336 --- .../libs/kiss/include/kiss/logger.h.gcov.html | 131 -- .../libs/kiss/src/index-sort-f.html | 113 - .../libs/kiss/src/index-sort-l.html | 113 - doc/coverageReport/libs/kiss/src/index.html | 113 - .../libs/kiss/src/logger.cpp.func-sort-c.html | 104 - .../libs/kiss/src/logger.cpp.func.html | 104 - .../libs/kiss/src/logger.cpp.gcov.html | 161 -- .../libs/kiss/src/path.cpp.func-sort-c.html | 104 - .../libs/kiss/src/path.cpp.func.html | 104 - .../libs/kiss/src/path.cpp.gcov.html | 245 -- .../libs/kiss/src/string.cpp.func-sort-c.html | 100 - .../libs/kiss/src/string.cpp.func.html | 100 - .../libs/kiss/src/string.cpp.gcov.html | 165 -- doc/coverageReport/ruby.png | Bin 141 -> 0 bytes doc/coverageReport/snow.png | Bin 141 -> 0 bytes .../src/Candidate.cpp.func-sort-c.html | 212 -- .../src/Candidate.cpp.func.html | 212 -- .../src/Candidate.cpp.gcov.html | 331 --- .../src/Clock.cpp.func-sort-c.html | 104 - doc/coverageReport/src/Clock.cpp.func.html | 104 - doc/coverageReport/src/Clock.cpp.gcov.html | 231 -- .../src/Common.cpp.func-sort-c.html | 96 - doc/coverageReport/src/Common.cpp.func.html | 96 - doc/coverageReport/src/Common.cpp.gcov.html | 212 -- .../src/Cosmology.cpp.func-sort-c.html | 132 -- .../src/Cosmology.cpp.func.html | 132 -- .../src/Cosmology.cpp.gcov.html | 245 -- .../src/EmissionMap.cpp.func-sort-c.html | 204 -- .../src/EmissionMap.cpp.func.html | 204 -- .../src/EmissionMap.cpp.gcov.html | 370 --- .../src/Geometry.cpp.func-sort-c.html | 124 - doc/coverageReport/src/Geometry.cpp.func.html | 124 - doc/coverageReport/src/Geometry.cpp.gcov.html | 200 -- .../src/GridTools.cpp.func-sort-c.html | 148 -- .../src/GridTools.cpp.func.html | 148 -- .../src/GridTools.cpp.gcov.html | 491 ---- .../src/Module.cpp.func-sort-c.html | 120 - doc/coverageReport/src/Module.cpp.func.html | 120 - doc/coverageReport/src/Module.cpp.gcov.html | 156 -- .../src/ParticleID.cpp.func-sort-c.html | 92 - .../src/ParticleID.cpp.func.html | 92 - .../src/ParticleID.cpp.gcov.html | 130 -- .../src/ParticleMass.cpp.func-sort-c.html | 88 - .../src/ParticleMass.cpp.func.html | 88 - .../src/ParticleMass.cpp.gcov.html | 150 -- .../src/ParticleState.cpp.func-sort-c.html | 140 -- .../src/ParticleState.cpp.func.html | 140 -- .../src/ParticleState.cpp.gcov.html | 178 -- .../src/PhotonBackground.cpp.func-sort-c.html | 132 -- .../src/PhotonBackground.cpp.func.html | 132 -- .../src/PhotonBackground.cpp.gcov.html | 291 --- .../src/ProgressBar.cpp.func-sort-c.html | 92 - .../src/ProgressBar.cpp.func.html | 92 - .../src/ProgressBar.cpp.gcov.html | 153 -- .../src/Random.cpp.func-sort-c.html | 256 -- doc/coverageReport/src/Random.cpp.func.html | 256 -- doc/coverageReport/src/Random.cpp.gcov.html | 605 ----- .../src/Source.cpp.func-sort-c.html | 656 ------ doc/coverageReport/src/Source.cpp.func.html | 656 ------ doc/coverageReport/src/Source.cpp.gcov.html | 1218 ---------- .../src/Variant.cpp.func-sort-c.html | 264 --- doc/coverageReport/src/Variant.cpp.func.html | 264 --- doc/coverageReport/src/Variant.cpp.gcov.html | 1200 ---------- .../AdvectionField.cpp.func-sort-c.html | 408 ---- .../AdvectionField.cpp.func.html | 408 ---- .../AdvectionField.cpp.gcov.html | 610 ----- .../src/advectionField/index-sort-f.html | 93 - .../src/advectionField/index-sort-l.html | 93 - .../src/advectionField/index.html | 93 - .../src/base64.cpp.func-sort-c.html | 80 - doc/coverageReport/src/base64.cpp.func.html | 80 - doc/coverageReport/src/base64.cpp.gcov.html | 205 -- doc/coverageReport/src/index-sort-f.html | 253 -- doc/coverageReport/src/index-sort-l.html | 253 -- doc/coverageReport/src/index.html | 253 -- ...rchimedeanSpiralField.cpp.func-sort-c.html | 112 - .../ArchimedeanSpiralField.cpp.func.html | 112 - .../ArchimedeanSpiralField.cpp.gcov.html | 162 -- .../CMZField.cpp.func-sort-c.html | 144 -- .../src/magneticField/CMZField.cpp.func.html | 144 -- .../src/magneticField/CMZField.cpp.gcov.html | 382 --- .../JF12Field.cpp.func-sort-c.html | 188 -- .../src/magneticField/JF12Field.cpp.func.html | 188 -- .../src/magneticField/JF12Field.cpp.gcov.html | 452 ---- .../JF12FieldSolenoidal.cpp.func-sort-c.html | 128 - .../JF12FieldSolenoidal.cpp.func.html | 128 - .../JF12FieldSolenoidal.cpp.gcov.html | 378 --- .../MagneticField.cpp.func-sort-c.html | 136 -- .../magneticField/MagneticField.cpp.func.html | 136 -- .../magneticField/MagneticField.cpp.gcov.html | 188 -- .../MagneticFieldGrid.cpp.func-sort-c.html | 116 - .../MagneticFieldGrid.cpp.func.html | 116 - .../MagneticFieldGrid.cpp.gcov.html | 133 -- .../PT11Field.cpp.func-sort-c.html | 108 - .../src/magneticField/PT11Field.cpp.func.html | 108 - .../src/magneticField/PT11Field.cpp.gcov.html | 206 -- ...ngleModeMagneticField.cpp.func-sort-c.html | 80 - ...rizedSingleModeMagneticField.cpp.func.html | 80 - ...rizedSingleModeMagneticField.cpp.gcov.html | 142 -- .../TF17Field.cpp.func-sort-c.html | 188 -- .../src/magneticField/TF17Field.cpp.func.html | 188 -- .../src/magneticField/TF17Field.cpp.gcov.html | 383 --- .../src/magneticField/index-sort-f.html | 173 -- .../src/magneticField/index-sort-l.html | 173 -- .../src/magneticField/index.html | 173 -- .../GridTurbulence.cpp.func-sort-c.html | 124 - .../GridTurbulence.cpp.func.html | 124 - .../GridTurbulence.cpp.gcov.html | 289 --- ...HelicalGridTurbulence.cpp.func-sort-c.html | 80 - .../HelicalGridTurbulence.cpp.func.html | 80 - .../HelicalGridTurbulence.cpp.gcov.html | 206 -- .../PlaneWaveTurbulence.cpp.func-sort-c.html | 80 - .../PlaneWaveTurbulence.cpp.func.html | 80 - .../PlaneWaveTurbulence.cpp.gcov.html | 517 ---- .../SimpleGridTurbulence.cpp.func-sort-c.html | 80 - .../SimpleGridTurbulence.cpp.func.html | 80 - .../SimpleGridTurbulence.cpp.gcov.html | 193 -- .../turbulentField/index-sort-f.html | 123 - .../turbulentField/index-sort-l.html | 123 - .../magneticField/turbulentField/index.html | 123 - .../MagneticLens.cpp.func-sort-c.html | 124 - .../magneticLens/MagneticLens.cpp.func.html | 124 - .../magneticLens/MagneticLens.cpp.gcov.html | 353 --- .../ModelMatrix.cpp.func-sort-c.html | 100 - .../magneticLens/ModelMatrix.cpp.func.html | 100 - .../magneticLens/ModelMatrix.cpp.gcov.html | 237 -- ...ParticleMapsContainer.cpp.func-sort-c.html | 124 - .../ParticleMapsContainer.cpp.func.html | 124 - .../ParticleMapsContainer.cpp.gcov.html | 275 --- .../Pixelization.cpp.func-sort-c.html | 104 - .../magneticLens/Pixelization.cpp.func.html | 104 - .../magneticLens/Pixelization.cpp.gcov.html | 205 -- .../src/magneticLens/index-sort-f.html | 123 - .../src/magneticLens/index-sort-l.html | 123 - .../src/magneticLens/index.html | 123 - .../ConstantDensity.cpp.func-sort-c.html | 148 -- .../ConstantDensity.cpp.func.html | 148 -- .../ConstantDensity.cpp.gcov.html | 213 -- .../Cordes.cpp.func-sort-c.html | 100 - .../src/massDistribution/Cordes.cpp.func.html | 100 - .../src/massDistribution/Cordes.cpp.gcov.html | 122 - .../Ferriere.cpp.func-sort-c.html | 128 - .../massDistribution/Ferriere.cpp.func.html | 128 - .../massDistribution/Ferriere.cpp.gcov.html | 349 --- .../Massdistribution.cpp.func-sort-c.html | 160 -- .../Massdistribution.cpp.func.html | 160 -- .../Massdistribution.cpp.gcov.html | 222 -- .../Nakanishi.cpp.func-sort-c.html | 128 - .../massDistribution/Nakanishi.cpp.func.html | 128 - .../massDistribution/Nakanishi.cpp.gcov.html | 195 -- .../src/massDistribution/index-sort-f.html | 133 -- .../src/massDistribution/index-sort-l.html | 133 -- .../src/massDistribution/index.html | 133 -- .../module/Acceleration.cpp.func-sort-c.html | 128 - .../src/module/Acceleration.cpp.func.html | 128 - .../src/module/Acceleration.cpp.gcov.html | 260 --- .../AdiabaticCooling.cpp.func-sort-c.html | 92 - .../src/module/AdiabaticCooling.cpp.func.html | 92 - .../src/module/AdiabaticCooling.cpp.gcov.html | 130 -- .../src/module/Boundary.cpp.func-sort-c.html | 252 -- .../src/module/Boundary.cpp.func.html | 252 -- .../src/module/Boundary.cpp.gcov.html | 370 --- .../BreakCondition.cpp.func-sort-c.html | 224 -- .../src/module/BreakCondition.cpp.func.html | 224 -- .../src/module/BreakCondition.cpp.gcov.html | 343 --- .../CandidateSplitting.cpp.func-sort-c.html | 116 - .../module/CandidateSplitting.cpp.func.html | 116 - .../module/CandidateSplitting.cpp.gcov.html | 194 -- .../module/DiffusionSDE.cpp.func-sort-c.html | 172 -- .../src/module/DiffusionSDE.cpp.func.html | 172 -- .../src/module/DiffusionSDE.cpp.gcov.html | 480 ---- ...MDoublePairProduction.cpp.func-sort-c.html | 112 - .../EMDoublePairProduction.cpp.func.html | 112 - .../EMDoublePairProduction.cpp.gcov.html | 209 -- ...erseComptonScattering.cpp.func-sort-c.html | 124 - .../EMInverseComptonScattering.cpp.func.html | 124 - .../EMInverseComptonScattering.cpp.gcov.html | 325 --- .../EMPairProduction.cpp.func-sort-c.html | 124 - .../src/module/EMPairProduction.cpp.func.html | 124 - .../src/module/EMPairProduction.cpp.gcov.html | 340 --- ...TripletPairProduction.cpp.func-sort-c.html | 116 - .../EMTripletPairProduction.cpp.func.html | 116 - .../EMTripletPairProduction.cpp.gcov.html | 263 --- .../ElasticScattering.cpp.func-sort-c.html | 100 - .../module/ElasticScattering.cpp.func.html | 100 - .../module/ElasticScattering.cpp.gcov.html | 212 -- ...lectronPairProduction.cpp.func-sort-c.html | 112 - .../ElectronPairProduction.cpp.func.html | 112 - .../ElectronPairProduction.cpp.gcov.html | 233 -- .../module/HDF5Output.cpp.func-sort-c.html | 128 - .../src/module/HDF5Output.cpp.func.html | 128 - .../src/module/HDF5Output.cpp.gcov.html | 468 ---- .../MomentumDiffusion.cpp.func-sort-c.html | 112 - .../module/MomentumDiffusion.cpp.func.html | 112 - .../module/MomentumDiffusion.cpp.gcov.html | 147 -- .../module/NuclearDecay.cpp.func-sort-c.html | 124 - .../src/module/NuclearDecay.cpp.func.html | 124 - .../src/module/NuclearDecay.cpp.gcov.html | 395 ---- .../src/module/Observer.cpp.func-sort-c.html | 248 -- .../src/module/Observer.cpp.func.html | 248 -- .../src/module/Observer.cpp.gcov.html | 427 ---- .../src/module/Output.cpp.func-sort-c.html | 136 -- .../src/module/Output.cpp.func.html | 136 -- .../src/module/Output.cpp.gcov.html | 210 -- .../module/OutputShell.cpp.func-sort-c.html | 96 - .../src/module/OutputShell.cpp.func.html | 96 - .../src/module/OutputShell.cpp.gcov.html | 134 -- .../ParticleCollector.cpp.func-sort-c.html | 168 -- .../module/ParticleCollector.cpp.func.html | 168 -- .../module/ParticleCollector.cpp.gcov.html | 194 -- .../PhotoDisintegration.cpp.func-sort-c.html | 120 - .../module/PhotoDisintegration.cpp.func.html | 120 - .../module/PhotoDisintegration.cpp.gcov.html | 406 ---- .../PhotoPionProduction.cpp.func-sort-c.html | 232 -- .../module/PhotoPionProduction.cpp.func.html | 232 -- .../module/PhotoPionProduction.cpp.gcov.html | 758 ------ .../PhotonOutput1D.cpp.func-sort-c.html | 108 - .../src/module/PhotonOutput1D.cpp.func.html | 108 - .../src/module/PhotonOutput1D.cpp.gcov.html | 180 -- .../module/PropagationBP.cpp.func-sort-c.html | 136 -- .../src/module/PropagationBP.cpp.func.html | 136 -- .../src/module/PropagationBP.cpp.gcov.html | 285 --- .../module/PropagationCK.cpp.func-sort-c.html | 128 - .../src/module/PropagationCK.cpp.func.html | 128 - .../src/module/PropagationCK.cpp.gcov.html | 278 --- .../src/module/Redshift.cpp.func-sort-c.html | 88 - .../src/module/Redshift.cpp.func.html | 88 - .../src/module/Redshift.cpp.gcov.html | 138 -- .../RestrictToRegion.cpp.func-sort-c.html | 84 - .../src/module/RestrictToRegion.cpp.func.html | 84 - .../src/module/RestrictToRegion.cpp.gcov.html | 101 - .../SimplePropagation.cpp.func-sort-c.html | 100 - .../module/SimplePropagation.cpp.func.html | 100 - .../module/SimplePropagation.cpp.gcov.html | 128 - .../SynchrotronRadiation.cpp.func-sort-c.html | 156 -- .../module/SynchrotronRadiation.cpp.func.html | 156 -- .../module/SynchrotronRadiation.cpp.gcov.html | 306 --- .../module/TextOutput.cpp.func-sort-c.html | 128 - .../src/module/TextOutput.cpp.func.html | 128 - .../src/module/TextOutput.cpp.gcov.html | 457 ---- .../src/module/Tools.cpp.func-sort-c.html | 136 -- .../src/module/Tools.cpp.func.html | 136 -- .../src/module/Tools.cpp.gcov.html | 199 -- .../src/module/index-sort-f.html | 383 --- .../src/module/index-sort-l.html | 383 --- doc/coverageReport/src/module/index.html | 383 --- doc/coverageReport/test/index-sort-f.html | 243 -- doc/coverageReport/test/index-sort-l.html | 243 -- doc/coverageReport/test/index.html | 243 -- .../testAdiabaticCooling.cpp.func-sort-c.html | 80 - .../test/testAdiabaticCooling.cpp.func.html | 80 - .../test/testAdiabaticCooling.cpp.gcov.html | 131 -- .../testAdvectionField.cpp.func-sort-c.html | 92 - .../test/testAdvectionField.cpp.func.html | 92 - .../test/testAdvectionField.cpp.gcov.html | 245 -- .../testBreakCondition.cpp.func-sort-c.html | 196 -- .../test/testBreakCondition.cpp.func.html | 196 -- .../test/testBreakCondition.cpp.gcov.html | 621 ----- ...estCandidateSplitting.cpp.func-sort-c.html | 80 - .../test/testCandidateSplitting.cpp.func.html | 80 - .../test/testCandidateSplitting.cpp.gcov.html | 166 -- .../test/testCore.cpp.func-sort-c.html | 308 --- .../test/testCore.cpp.func.html | 308 --- .../test/testCore.cpp.gcov.html | 1144 --------- .../test/testDensity.cpp.func-sort-c.html | 100 - .../test/testDensity.cpp.func.html | 100 - .../test/testDensity.cpp.gcov.html | 372 --- .../testFunctionalGroups.cpp.func-sort-c.html | 80 - .../test/testFunctionalGroups.cpp.func.html | 80 - .../test/testFunctionalGroups.cpp.gcov.html | 126 - .../test/testInteraction.cpp.func-sort-c.html | 284 --- .../test/testInteraction.cpp.func.html | 284 --- .../test/testInteraction.cpp.gcov.html | 1229 ---------- .../testMagneticField.cpp.func-sort-c.html | 136 -- .../test/testMagneticField.cpp.func.html | 136 -- .../test/testMagneticField.cpp.gcov.html | 292 --- .../testMagneticLens.cpp.func-sort-c.html | 100 - .../test/testMagneticLens.cpp.func.html | 100 - .../test/testMagneticLens.cpp.gcov.html | 248 -- .../test/testModuleList.cpp.func-sort-c.html | 100 - .../test/testModuleList.cpp.func.html | 100 - .../test/testModuleList.cpp.gcov.html | 155 -- .../test/testOutput.cpp.func-sort-c.html | 144 -- .../test/testOutput.cpp.func.html | 144 -- .../test/testOutput.cpp.gcov.html | 355 --- .../test/testPropagation.cpp.func-sort-c.html | 148 -- .../test/testPropagation.cpp.func.html | 148 -- .../test/testPropagation.cpp.gcov.html | 632 ----- .../test/testSource.cpp.func-sort-c.html | 168 -- .../test/testSource.cpp.func.html | 168 -- .../test/testSource.cpp.gcov.html | 516 ---- .../testTurbulentField.cpp.func-sort-c.html | 104 - .../test/testTurbulentField.cpp.func.html | 104 - .../test/testTurbulentField.cpp.gcov.html | 218 -- .../test/testVector3.cpp.func-sort-c.html | 124 - .../test/testVector3.cpp.func.html | 124 - .../test/testVector3.cpp.gcov.html | 238 -- doc/coverageReport/updown.png | Bin 117 -> 0 bytes doc/index.rst | 4 +- doc/pages/Code-Coverage.md | 8 +- 538 files changed, 4 insertions(+), 101309 deletions(-) delete mode 100644 doc/coverageReport/amber.png delete mode 100644 doc/coverageReport/emerald.png delete mode 100644 doc/coverageReport/gcov.css delete mode 100644 doc/coverageReport/glass.png delete mode 100644 doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h.func-sort-c.html delete mode 100644 doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h.func.html delete mode 100644 doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h.gcov.html delete mode 100644 doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h.func-sort-c.html delete mode 100644 doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h.func.html delete mode 100644 doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h.gcov.html delete mode 100644 doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/index-sort-f.html delete mode 100644 doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/index-sort-l.html delete mode 100644 doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/index.html delete mode 100644 doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h.func-sort-c.html delete mode 100644 doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h.func.html delete mode 100644 doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/AssocVector.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/AssocVector.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/AssocVector.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/Candidate.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/Candidate.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/Candidate.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/Common.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/Common.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/Common.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/EmissionMap.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/EmissionMap.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/EmissionMap.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/Geometry.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/Geometry.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/Geometry.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/Grid.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/Grid.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/Grid.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/Logging.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/Logging.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/Logging.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/Module.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/Module.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/Module.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/ParticleState.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/ParticleState.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/ParticleState.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/PhotonBackground.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/PhotonBackground.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/PhotonBackground.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/Random.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/Random.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/Random.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/Referenced.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/Referenced.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/Referenced.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/Source.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/Source.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/Source.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/Variant.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/Variant.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/Variant.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/Vector3.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/Vector3.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/Vector3.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/advectionField/AdvectionField.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/advectionField/AdvectionField.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/advectionField/AdvectionField.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/advectionField/index-sort-f.html delete mode 100644 doc/coverageReport/include/crpropa/advectionField/index-sort-l.html delete mode 100644 doc/coverageReport/include/crpropa/advectionField/index.html delete mode 100644 doc/coverageReport/include/crpropa/index-sort-f.html delete mode 100644 doc/coverageReport/include/crpropa/index-sort-l.html delete mode 100644 doc/coverageReport/include/crpropa/index.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/GalacticMagneticField.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/GalacticMagneticField.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/GalacticMagneticField.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/MagneticField.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/MagneticField.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/MagneticField.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/MagneticFieldGrid.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/MagneticFieldGrid.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/MagneticFieldGrid.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/index-sort-f.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/index-sort-l.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/index.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/GridTurbulence.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/GridTurbulence.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/GridTurbulence.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/TurbulentField.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/TurbulentField.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/TurbulentField.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/index-sort-f.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/index-sort-l.html delete mode 100644 doc/coverageReport/include/crpropa/magneticField/turbulentField/index.html delete mode 100644 doc/coverageReport/include/crpropa/magneticLens/MagneticLens.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/magneticLens/MagneticLens.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/magneticLens/MagneticLens.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/magneticLens/ParticleMapsContainer.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/magneticLens/ParticleMapsContainer.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/magneticLens/ParticleMapsContainer.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/magneticLens/Pixelization.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/magneticLens/Pixelization.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/magneticLens/Pixelization.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/magneticLens/index-sort-f.html delete mode 100644 doc/coverageReport/include/crpropa/magneticLens/index-sort-l.html delete mode 100644 doc/coverageReport/include/crpropa/magneticLens/index.html delete mode 100644 doc/coverageReport/include/crpropa/massDistribution/Cordes.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/massDistribution/Cordes.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/massDistribution/Cordes.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/massDistribution/Density.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/massDistribution/Density.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/massDistribution/Density.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/massDistribution/Ferriere.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/massDistribution/Ferriere.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/massDistribution/Ferriere.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/massDistribution/Massdistribution.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/massDistribution/Massdistribution.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/massDistribution/Massdistribution.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/massDistribution/Nakanishi.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/massDistribution/Nakanishi.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/massDistribution/Nakanishi.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/massDistribution/index-sort-f.html delete mode 100644 doc/coverageReport/include/crpropa/massDistribution/index-sort-l.html delete mode 100644 doc/coverageReport/include/crpropa/massDistribution/index.html delete mode 100644 doc/coverageReport/include/crpropa/module/Boundary.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/module/Boundary.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/module/Boundary.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/module/BreakCondition.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/module/BreakCondition.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/module/BreakCondition.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/module/HDF5Output.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/module/HDF5Output.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/module/HDF5Output.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/module/NuclearDecay.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/module/NuclearDecay.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/module/NuclearDecay.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/module/Observer.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/module/Observer.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/module/Observer.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/module/OutputShell.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/module/OutputShell.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/module/OutputShell.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/module/PhotoDisintegration.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/module/PhotoDisintegration.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/module/PhotoDisintegration.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/module/PropagationBP.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/module/PropagationBP.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/module/PropagationBP.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/module/PropagationCK.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/module/PropagationCK.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/module/PropagationCK.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/module/Redshift.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/module/Redshift.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/module/Redshift.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/module/SimplePropagation.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/module/SimplePropagation.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/module/SimplePropagation.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/module/TextOutput.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/module/TextOutput.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/module/TextOutput.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/module/Tools.h.func-sort-c.html delete mode 100644 doc/coverageReport/include/crpropa/module/Tools.h.func.html delete mode 100644 doc/coverageReport/include/crpropa/module/Tools.h.gcov.html delete mode 100644 doc/coverageReport/include/crpropa/module/index-sort-f.html delete mode 100644 doc/coverageReport/include/crpropa/module/index-sort-l.html delete mode 100644 doc/coverageReport/include/crpropa/module/index.html delete mode 100644 doc/coverageReport/index-sort-f.html delete mode 100644 doc/coverageReport/index-sort-l.html delete mode 100644 doc/coverageReport/index.html delete mode 100644 doc/coverageReport/libs/HepPID/src/ParticleIDMethods.cc.func-sort-c.html delete mode 100644 doc/coverageReport/libs/HepPID/src/ParticleIDMethods.cc.func.html delete mode 100644 doc/coverageReport/libs/HepPID/src/ParticleIDMethods.cc.gcov.html delete mode 100644 doc/coverageReport/libs/HepPID/src/ParticleName.cc.func-sort-c.html delete mode 100644 doc/coverageReport/libs/HepPID/src/ParticleName.cc.func.html delete mode 100644 doc/coverageReport/libs/HepPID/src/ParticleName.cc.gcov.html delete mode 100644 doc/coverageReport/libs/HepPID/src/Version.cc.func-sort-c.html delete mode 100644 doc/coverageReport/libs/HepPID/src/Version.cc.func.html delete mode 100644 doc/coverageReport/libs/HepPID/src/Version.cc.gcov.html delete mode 100644 doc/coverageReport/libs/HepPID/src/index-sort-f.html delete mode 100644 doc/coverageReport/libs/HepPID/src/index-sort-l.html delete mode 100644 doc/coverageReport/libs/HepPID/src/index.html delete mode 100644 doc/coverageReport/libs/healpix_base/error_handling.cc.func-sort-c.html delete mode 100644 doc/coverageReport/libs/healpix_base/error_handling.cc.func.html delete mode 100644 doc/coverageReport/libs/healpix_base/error_handling.cc.gcov.html delete mode 100644 doc/coverageReport/libs/healpix_base/geom_utils.cc.func-sort-c.html delete mode 100644 doc/coverageReport/libs/healpix_base/geom_utils.cc.func.html delete mode 100644 doc/coverageReport/libs/healpix_base/geom_utils.cc.gcov.html delete mode 100644 doc/coverageReport/libs/healpix_base/healpix_base.cc.func-sort-c.html delete mode 100644 doc/coverageReport/libs/healpix_base/healpix_base.cc.func.html delete mode 100644 doc/coverageReport/libs/healpix_base/healpix_base.cc.gcov.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/alloc_utils.h.func-sort-c.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/alloc_utils.h.func.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/alloc_utils.h.gcov.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/arr.h.func-sort-c.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/arr.h.func.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/arr.h.gcov.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/error_handling.h.func-sort-c.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/error_handling.h.func.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/error_handling.h.gcov.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/geom_utils.h.func-sort-c.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/geom_utils.h.func.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/geom_utils.h.gcov.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/healpix_base.h.func-sort-c.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/healpix_base.h.func.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/healpix_base.h.gcov.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/index-sort-f.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/index-sort-l.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/index.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/math_utils.h.func-sort-c.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/math_utils.h.func.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/math_utils.h.gcov.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/pointing.h.func-sort-c.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/pointing.h.func.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/pointing.h.gcov.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/rangeset.h.func-sort-c.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/rangeset.h.func.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/rangeset.h.gcov.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/vec3.h.func-sort-c.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/vec3.h.func.html delete mode 100644 doc/coverageReport/libs/healpix_base/include/healpix_base/vec3.h.gcov.html delete mode 100644 doc/coverageReport/libs/healpix_base/index-sort-f.html delete mode 100644 doc/coverageReport/libs/healpix_base/index-sort-l.html delete mode 100644 doc/coverageReport/libs/healpix_base/index.html delete mode 100644 doc/coverageReport/libs/healpix_base/pointing.cc.func-sort-c.html delete mode 100644 doc/coverageReport/libs/healpix_base/pointing.cc.func.html delete mode 100644 doc/coverageReport/libs/healpix_base/pointing.cc.gcov.html delete mode 100644 doc/coverageReport/libs/kiss/include/kiss/convert.h.func-sort-c.html delete mode 100644 doc/coverageReport/libs/kiss/include/kiss/convert.h.func.html delete mode 100644 doc/coverageReport/libs/kiss/include/kiss/convert.h.gcov.html delete mode 100644 doc/coverageReport/libs/kiss/include/kiss/index-sort-f.html delete mode 100644 doc/coverageReport/libs/kiss/include/kiss/index-sort-l.html delete mode 100644 doc/coverageReport/libs/kiss/include/kiss/index.html delete mode 100644 doc/coverageReport/libs/kiss/include/kiss/logger.h.func-sort-c.html delete mode 100644 doc/coverageReport/libs/kiss/include/kiss/logger.h.func.html delete mode 100644 doc/coverageReport/libs/kiss/include/kiss/logger.h.gcov.html delete mode 100644 doc/coverageReport/libs/kiss/src/index-sort-f.html delete mode 100644 doc/coverageReport/libs/kiss/src/index-sort-l.html delete mode 100644 doc/coverageReport/libs/kiss/src/index.html delete mode 100644 doc/coverageReport/libs/kiss/src/logger.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/libs/kiss/src/logger.cpp.func.html delete mode 100644 doc/coverageReport/libs/kiss/src/logger.cpp.gcov.html delete mode 100644 doc/coverageReport/libs/kiss/src/path.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/libs/kiss/src/path.cpp.func.html delete mode 100644 doc/coverageReport/libs/kiss/src/path.cpp.gcov.html delete mode 100644 doc/coverageReport/libs/kiss/src/string.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/libs/kiss/src/string.cpp.func.html delete mode 100644 doc/coverageReport/libs/kiss/src/string.cpp.gcov.html delete mode 100644 doc/coverageReport/ruby.png delete mode 100644 doc/coverageReport/snow.png delete mode 100644 doc/coverageReport/src/Candidate.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/Candidate.cpp.func.html delete mode 100644 doc/coverageReport/src/Candidate.cpp.gcov.html delete mode 100644 doc/coverageReport/src/Clock.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/Clock.cpp.func.html delete mode 100644 doc/coverageReport/src/Clock.cpp.gcov.html delete mode 100644 doc/coverageReport/src/Common.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/Common.cpp.func.html delete mode 100644 doc/coverageReport/src/Common.cpp.gcov.html delete mode 100644 doc/coverageReport/src/Cosmology.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/Cosmology.cpp.func.html delete mode 100644 doc/coverageReport/src/Cosmology.cpp.gcov.html delete mode 100644 doc/coverageReport/src/EmissionMap.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/EmissionMap.cpp.func.html delete mode 100644 doc/coverageReport/src/EmissionMap.cpp.gcov.html delete mode 100644 doc/coverageReport/src/Geometry.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/Geometry.cpp.func.html delete mode 100644 doc/coverageReport/src/Geometry.cpp.gcov.html delete mode 100644 doc/coverageReport/src/GridTools.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/GridTools.cpp.func.html delete mode 100644 doc/coverageReport/src/GridTools.cpp.gcov.html delete mode 100644 doc/coverageReport/src/Module.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/Module.cpp.func.html delete mode 100644 doc/coverageReport/src/Module.cpp.gcov.html delete mode 100644 doc/coverageReport/src/ParticleID.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/ParticleID.cpp.func.html delete mode 100644 doc/coverageReport/src/ParticleID.cpp.gcov.html delete mode 100644 doc/coverageReport/src/ParticleMass.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/ParticleMass.cpp.func.html delete mode 100644 doc/coverageReport/src/ParticleMass.cpp.gcov.html delete mode 100644 doc/coverageReport/src/ParticleState.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/ParticleState.cpp.func.html delete mode 100644 doc/coverageReport/src/ParticleState.cpp.gcov.html delete mode 100644 doc/coverageReport/src/PhotonBackground.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/PhotonBackground.cpp.func.html delete mode 100644 doc/coverageReport/src/PhotonBackground.cpp.gcov.html delete mode 100644 doc/coverageReport/src/ProgressBar.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/ProgressBar.cpp.func.html delete mode 100644 doc/coverageReport/src/ProgressBar.cpp.gcov.html delete mode 100644 doc/coverageReport/src/Random.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/Random.cpp.func.html delete mode 100644 doc/coverageReport/src/Random.cpp.gcov.html delete mode 100644 doc/coverageReport/src/Source.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/Source.cpp.func.html delete mode 100644 doc/coverageReport/src/Source.cpp.gcov.html delete mode 100644 doc/coverageReport/src/Variant.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/Variant.cpp.func.html delete mode 100644 doc/coverageReport/src/Variant.cpp.gcov.html delete mode 100644 doc/coverageReport/src/advectionField/AdvectionField.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/advectionField/AdvectionField.cpp.func.html delete mode 100644 doc/coverageReport/src/advectionField/AdvectionField.cpp.gcov.html delete mode 100644 doc/coverageReport/src/advectionField/index-sort-f.html delete mode 100644 doc/coverageReport/src/advectionField/index-sort-l.html delete mode 100644 doc/coverageReport/src/advectionField/index.html delete mode 100644 doc/coverageReport/src/base64.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/base64.cpp.func.html delete mode 100644 doc/coverageReport/src/base64.cpp.gcov.html delete mode 100644 doc/coverageReport/src/index-sort-f.html delete mode 100644 doc/coverageReport/src/index-sort-l.html delete mode 100644 doc/coverageReport/src/index.html delete mode 100644 doc/coverageReport/src/magneticField/ArchimedeanSpiralField.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/magneticField/ArchimedeanSpiralField.cpp.func.html delete mode 100644 doc/coverageReport/src/magneticField/ArchimedeanSpiralField.cpp.gcov.html delete mode 100644 doc/coverageReport/src/magneticField/CMZField.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/magneticField/CMZField.cpp.func.html delete mode 100644 doc/coverageReport/src/magneticField/CMZField.cpp.gcov.html delete mode 100644 doc/coverageReport/src/magneticField/JF12Field.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/magneticField/JF12Field.cpp.func.html delete mode 100644 doc/coverageReport/src/magneticField/JF12Field.cpp.gcov.html delete mode 100644 doc/coverageReport/src/magneticField/JF12FieldSolenoidal.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/magneticField/JF12FieldSolenoidal.cpp.func.html delete mode 100644 doc/coverageReport/src/magneticField/JF12FieldSolenoidal.cpp.gcov.html delete mode 100644 doc/coverageReport/src/magneticField/MagneticField.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/magneticField/MagneticField.cpp.func.html delete mode 100644 doc/coverageReport/src/magneticField/MagneticField.cpp.gcov.html delete mode 100644 doc/coverageReport/src/magneticField/MagneticFieldGrid.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/magneticField/MagneticFieldGrid.cpp.func.html delete mode 100644 doc/coverageReport/src/magneticField/MagneticFieldGrid.cpp.gcov.html delete mode 100644 doc/coverageReport/src/magneticField/PT11Field.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/magneticField/PT11Field.cpp.func.html delete mode 100644 doc/coverageReport/src/magneticField/PT11Field.cpp.gcov.html delete mode 100644 doc/coverageReport/src/magneticField/PolarizedSingleModeMagneticField.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/magneticField/PolarizedSingleModeMagneticField.cpp.func.html delete mode 100644 doc/coverageReport/src/magneticField/PolarizedSingleModeMagneticField.cpp.gcov.html delete mode 100644 doc/coverageReport/src/magneticField/TF17Field.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/magneticField/TF17Field.cpp.func.html delete mode 100644 doc/coverageReport/src/magneticField/TF17Field.cpp.gcov.html delete mode 100644 doc/coverageReport/src/magneticField/index-sort-f.html delete mode 100644 doc/coverageReport/src/magneticField/index-sort-l.html delete mode 100644 doc/coverageReport/src/magneticField/index.html delete mode 100644 doc/coverageReport/src/magneticField/turbulentField/GridTurbulence.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/magneticField/turbulentField/GridTurbulence.cpp.func.html delete mode 100644 doc/coverageReport/src/magneticField/turbulentField/GridTurbulence.cpp.gcov.html delete mode 100644 doc/coverageReport/src/magneticField/turbulentField/HelicalGridTurbulence.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/magneticField/turbulentField/HelicalGridTurbulence.cpp.func.html delete mode 100644 doc/coverageReport/src/magneticField/turbulentField/HelicalGridTurbulence.cpp.gcov.html delete mode 100644 doc/coverageReport/src/magneticField/turbulentField/PlaneWaveTurbulence.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/magneticField/turbulentField/PlaneWaveTurbulence.cpp.func.html delete mode 100644 doc/coverageReport/src/magneticField/turbulentField/PlaneWaveTurbulence.cpp.gcov.html delete mode 100644 doc/coverageReport/src/magneticField/turbulentField/SimpleGridTurbulence.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/magneticField/turbulentField/SimpleGridTurbulence.cpp.func.html delete mode 100644 doc/coverageReport/src/magneticField/turbulentField/SimpleGridTurbulence.cpp.gcov.html delete mode 100644 doc/coverageReport/src/magneticField/turbulentField/index-sort-f.html delete mode 100644 doc/coverageReport/src/magneticField/turbulentField/index-sort-l.html delete mode 100644 doc/coverageReport/src/magneticField/turbulentField/index.html delete mode 100644 doc/coverageReport/src/magneticLens/MagneticLens.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/magneticLens/MagneticLens.cpp.func.html delete mode 100644 doc/coverageReport/src/magneticLens/MagneticLens.cpp.gcov.html delete mode 100644 doc/coverageReport/src/magneticLens/ModelMatrix.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/magneticLens/ModelMatrix.cpp.func.html delete mode 100644 doc/coverageReport/src/magneticLens/ModelMatrix.cpp.gcov.html delete mode 100644 doc/coverageReport/src/magneticLens/ParticleMapsContainer.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/magneticLens/ParticleMapsContainer.cpp.func.html delete mode 100644 doc/coverageReport/src/magneticLens/ParticleMapsContainer.cpp.gcov.html delete mode 100644 doc/coverageReport/src/magneticLens/Pixelization.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/magneticLens/Pixelization.cpp.func.html delete mode 100644 doc/coverageReport/src/magneticLens/Pixelization.cpp.gcov.html delete mode 100644 doc/coverageReport/src/magneticLens/index-sort-f.html delete mode 100644 doc/coverageReport/src/magneticLens/index-sort-l.html delete mode 100644 doc/coverageReport/src/magneticLens/index.html delete mode 100644 doc/coverageReport/src/massDistribution/ConstantDensity.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/massDistribution/ConstantDensity.cpp.func.html delete mode 100644 doc/coverageReport/src/massDistribution/ConstantDensity.cpp.gcov.html delete mode 100644 doc/coverageReport/src/massDistribution/Cordes.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/massDistribution/Cordes.cpp.func.html delete mode 100644 doc/coverageReport/src/massDistribution/Cordes.cpp.gcov.html delete mode 100644 doc/coverageReport/src/massDistribution/Ferriere.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/massDistribution/Ferriere.cpp.func.html delete mode 100644 doc/coverageReport/src/massDistribution/Ferriere.cpp.gcov.html delete mode 100644 doc/coverageReport/src/massDistribution/Massdistribution.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/massDistribution/Massdistribution.cpp.func.html delete mode 100644 doc/coverageReport/src/massDistribution/Massdistribution.cpp.gcov.html delete mode 100644 doc/coverageReport/src/massDistribution/Nakanishi.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/massDistribution/Nakanishi.cpp.func.html delete mode 100644 doc/coverageReport/src/massDistribution/Nakanishi.cpp.gcov.html delete mode 100644 doc/coverageReport/src/massDistribution/index-sort-f.html delete mode 100644 doc/coverageReport/src/massDistribution/index-sort-l.html delete mode 100644 doc/coverageReport/src/massDistribution/index.html delete mode 100644 doc/coverageReport/src/module/Acceleration.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/Acceleration.cpp.func.html delete mode 100644 doc/coverageReport/src/module/Acceleration.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/AdiabaticCooling.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/AdiabaticCooling.cpp.func.html delete mode 100644 doc/coverageReport/src/module/AdiabaticCooling.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/Boundary.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/Boundary.cpp.func.html delete mode 100644 doc/coverageReport/src/module/Boundary.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/BreakCondition.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/BreakCondition.cpp.func.html delete mode 100644 doc/coverageReport/src/module/BreakCondition.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/CandidateSplitting.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/CandidateSplitting.cpp.func.html delete mode 100644 doc/coverageReport/src/module/CandidateSplitting.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/DiffusionSDE.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/DiffusionSDE.cpp.func.html delete mode 100644 doc/coverageReport/src/module/DiffusionSDE.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/EMDoublePairProduction.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/EMDoublePairProduction.cpp.func.html delete mode 100644 doc/coverageReport/src/module/EMDoublePairProduction.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/EMInverseComptonScattering.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/EMInverseComptonScattering.cpp.func.html delete mode 100644 doc/coverageReport/src/module/EMInverseComptonScattering.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/EMPairProduction.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/EMPairProduction.cpp.func.html delete mode 100644 doc/coverageReport/src/module/EMPairProduction.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/EMTripletPairProduction.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/EMTripletPairProduction.cpp.func.html delete mode 100644 doc/coverageReport/src/module/EMTripletPairProduction.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/ElasticScattering.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/ElasticScattering.cpp.func.html delete mode 100644 doc/coverageReport/src/module/ElasticScattering.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/ElectronPairProduction.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/ElectronPairProduction.cpp.func.html delete mode 100644 doc/coverageReport/src/module/ElectronPairProduction.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/HDF5Output.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/HDF5Output.cpp.func.html delete mode 100644 doc/coverageReport/src/module/HDF5Output.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/MomentumDiffusion.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/MomentumDiffusion.cpp.func.html delete mode 100644 doc/coverageReport/src/module/MomentumDiffusion.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/NuclearDecay.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/NuclearDecay.cpp.func.html delete mode 100644 doc/coverageReport/src/module/NuclearDecay.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/Observer.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/Observer.cpp.func.html delete mode 100644 doc/coverageReport/src/module/Observer.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/Output.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/Output.cpp.func.html delete mode 100644 doc/coverageReport/src/module/Output.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/OutputShell.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/OutputShell.cpp.func.html delete mode 100644 doc/coverageReport/src/module/OutputShell.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/ParticleCollector.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/ParticleCollector.cpp.func.html delete mode 100644 doc/coverageReport/src/module/ParticleCollector.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/PhotoDisintegration.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/PhotoDisintegration.cpp.func.html delete mode 100644 doc/coverageReport/src/module/PhotoDisintegration.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/PhotoPionProduction.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/PhotoPionProduction.cpp.func.html delete mode 100644 doc/coverageReport/src/module/PhotoPionProduction.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/PhotonOutput1D.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/PhotonOutput1D.cpp.func.html delete mode 100644 doc/coverageReport/src/module/PhotonOutput1D.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/PropagationBP.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/PropagationBP.cpp.func.html delete mode 100644 doc/coverageReport/src/module/PropagationBP.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/PropagationCK.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/PropagationCK.cpp.func.html delete mode 100644 doc/coverageReport/src/module/PropagationCK.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/Redshift.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/Redshift.cpp.func.html delete mode 100644 doc/coverageReport/src/module/Redshift.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/RestrictToRegion.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/RestrictToRegion.cpp.func.html delete mode 100644 doc/coverageReport/src/module/RestrictToRegion.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/SimplePropagation.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/SimplePropagation.cpp.func.html delete mode 100644 doc/coverageReport/src/module/SimplePropagation.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/SynchrotronRadiation.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/SynchrotronRadiation.cpp.func.html delete mode 100644 doc/coverageReport/src/module/SynchrotronRadiation.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/TextOutput.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/TextOutput.cpp.func.html delete mode 100644 doc/coverageReport/src/module/TextOutput.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/Tools.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/src/module/Tools.cpp.func.html delete mode 100644 doc/coverageReport/src/module/Tools.cpp.gcov.html delete mode 100644 doc/coverageReport/src/module/index-sort-f.html delete mode 100644 doc/coverageReport/src/module/index-sort-l.html delete mode 100644 doc/coverageReport/src/module/index.html delete mode 100644 doc/coverageReport/test/index-sort-f.html delete mode 100644 doc/coverageReport/test/index-sort-l.html delete mode 100644 doc/coverageReport/test/index.html delete mode 100644 doc/coverageReport/test/testAdiabaticCooling.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/test/testAdiabaticCooling.cpp.func.html delete mode 100644 doc/coverageReport/test/testAdiabaticCooling.cpp.gcov.html delete mode 100644 doc/coverageReport/test/testAdvectionField.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/test/testAdvectionField.cpp.func.html delete mode 100644 doc/coverageReport/test/testAdvectionField.cpp.gcov.html delete mode 100644 doc/coverageReport/test/testBreakCondition.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/test/testBreakCondition.cpp.func.html delete mode 100644 doc/coverageReport/test/testBreakCondition.cpp.gcov.html delete mode 100644 doc/coverageReport/test/testCandidateSplitting.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/test/testCandidateSplitting.cpp.func.html delete mode 100644 doc/coverageReport/test/testCandidateSplitting.cpp.gcov.html delete mode 100644 doc/coverageReport/test/testCore.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/test/testCore.cpp.func.html delete mode 100644 doc/coverageReport/test/testCore.cpp.gcov.html delete mode 100644 doc/coverageReport/test/testDensity.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/test/testDensity.cpp.func.html delete mode 100644 doc/coverageReport/test/testDensity.cpp.gcov.html delete mode 100644 doc/coverageReport/test/testFunctionalGroups.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/test/testFunctionalGroups.cpp.func.html delete mode 100644 doc/coverageReport/test/testFunctionalGroups.cpp.gcov.html delete mode 100644 doc/coverageReport/test/testInteraction.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/test/testInteraction.cpp.func.html delete mode 100644 doc/coverageReport/test/testInteraction.cpp.gcov.html delete mode 100644 doc/coverageReport/test/testMagneticField.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/test/testMagneticField.cpp.func.html delete mode 100644 doc/coverageReport/test/testMagneticField.cpp.gcov.html delete mode 100644 doc/coverageReport/test/testMagneticLens.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/test/testMagneticLens.cpp.func.html delete mode 100644 doc/coverageReport/test/testMagneticLens.cpp.gcov.html delete mode 100644 doc/coverageReport/test/testModuleList.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/test/testModuleList.cpp.func.html delete mode 100644 doc/coverageReport/test/testModuleList.cpp.gcov.html delete mode 100644 doc/coverageReport/test/testOutput.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/test/testOutput.cpp.func.html delete mode 100644 doc/coverageReport/test/testOutput.cpp.gcov.html delete mode 100644 doc/coverageReport/test/testPropagation.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/test/testPropagation.cpp.func.html delete mode 100644 doc/coverageReport/test/testPropagation.cpp.gcov.html delete mode 100644 doc/coverageReport/test/testSource.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/test/testSource.cpp.func.html delete mode 100644 doc/coverageReport/test/testSource.cpp.gcov.html delete mode 100644 doc/coverageReport/test/testTurbulentField.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/test/testTurbulentField.cpp.func.html delete mode 100644 doc/coverageReport/test/testTurbulentField.cpp.gcov.html delete mode 100644 doc/coverageReport/test/testVector3.cpp.func-sort-c.html delete mode 100644 doc/coverageReport/test/testVector3.cpp.func.html delete mode 100644 doc/coverageReport/test/testVector3.cpp.gcov.html delete mode 100644 doc/coverageReport/updown.png diff --git a/.github/workflows/create_documentation.yml b/.github/workflows/create_documentation.yml index b1a0bee70..190591189 100644 --- a/.github/workflows/create_documentation.yml +++ b/.github/workflows/create_documentation.yml @@ -55,6 +55,7 @@ jobs: run: | cd build make doc + cp -r coverageReport doc/pages/coverageReport tar -zcvf documentation.tar.gz doc - name: archive documentation uses: actions/upload-artifact@v4 diff --git a/doc/coverageReport/amber.png b/doc/coverageReport/amber.png deleted file mode 100644 index 2cab170d8359081983a4e343848dfe06bc490f12..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 141 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga>?NMQuI!iC1^G2tW}LqE04T&+ z;1OBOz`!j8!i<;h*8KqrvZOouIx;Y9?C1WI$O`1M1^9%x{(levWG?NMQuI!iC1^Jb!lvI6;R0X`wF(yt=9xVZRt1vCRixIA4P dLn>}1Cji+@42)0J?}79&c)I$ztaD0e0sy@GAL0N2 diff --git a/doc/coverageReport/gcov.css b/doc/coverageReport/gcov.css deleted file mode 100644 index bfd0a83e1..000000000 --- a/doc/coverageReport/gcov.css +++ /dev/null @@ -1,519 +0,0 @@ -/* All views: initial background and text color */ -body -{ - color: #000000; - background-color: #FFFFFF; -} - -/* All views: standard link format*/ -a:link -{ - color: #284FA8; - text-decoration: underline; -} - -/* All views: standard link - visited format */ -a:visited -{ - color: #00CB40; - text-decoration: underline; -} - -/* All views: standard link - activated format */ -a:active -{ - color: #FF0040; - text-decoration: underline; -} - -/* All views: main title format */ -td.title -{ - text-align: center; - padding-bottom: 10px; - font-family: sans-serif; - font-size: 20pt; - font-style: italic; - font-weight: bold; -} - -/* All views: header item format */ -td.headerItem -{ - text-align: right; - padding-right: 6px; - font-family: sans-serif; - font-weight: bold; - vertical-align: top; - white-space: nowrap; -} - -/* All views: header item value format */ -td.headerValue -{ - text-align: left; - color: #284FA8; - font-family: sans-serif; - font-weight: bold; - white-space: nowrap; -} - -/* All views: header item coverage table heading */ -td.headerCovTableHead -{ - text-align: center; - padding-right: 6px; - padding-left: 6px; - padding-bottom: 0px; - font-family: sans-serif; - font-size: 80%; - white-space: nowrap; -} - -/* All views: header item coverage table entry */ -td.headerCovTableEntry -{ - text-align: right; - color: #284FA8; - font-family: sans-serif; - font-weight: bold; - white-space: nowrap; - padding-left: 12px; - padding-right: 4px; - background-color: #DAE7FE; -} - -/* All views: header item coverage table entry for high coverage rate */ -td.headerCovTableEntryHi -{ - text-align: right; - color: #000000; - font-family: sans-serif; - font-weight: bold; - white-space: nowrap; - padding-left: 12px; - padding-right: 4px; - background-color: #A7FC9D; -} - -/* All views: header item coverage table entry for medium coverage rate */ -td.headerCovTableEntryMed -{ - text-align: right; - color: #000000; - font-family: sans-serif; - font-weight: bold; - white-space: nowrap; - padding-left: 12px; - padding-right: 4px; - background-color: #FFEA20; -} - -/* All views: header item coverage table entry for ow coverage rate */ -td.headerCovTableEntryLo -{ - text-align: right; - color: #000000; - font-family: sans-serif; - font-weight: bold; - white-space: nowrap; - padding-left: 12px; - padding-right: 4px; - background-color: #FF0000; -} - -/* All views: header legend value for legend entry */ -td.headerValueLeg -{ - text-align: left; - color: #000000; - font-family: sans-serif; - font-size: 80%; - white-space: nowrap; - padding-top: 4px; -} - -/* All views: color of horizontal ruler */ -td.ruler -{ - background-color: #6688D4; -} - -/* All views: version string format */ -td.versionInfo -{ - text-align: center; - padding-top: 2px; - font-family: sans-serif; - font-style: italic; -} - -/* Directory view/File view (all)/Test case descriptions: - table headline format */ -td.tableHead -{ - text-align: center; - color: #FFFFFF; - background-color: #6688D4; - font-family: sans-serif; - font-size: 120%; - font-weight: bold; - white-space: nowrap; - padding-left: 4px; - padding-right: 4px; -} - -span.tableHeadSort -{ - padding-right: 4px; -} - -/* Directory view/File view (all): filename entry format */ -td.coverFile -{ - text-align: left; - padding-left: 10px; - padding-right: 20px; - color: #284FA8; - background-color: #DAE7FE; - font-family: monospace; -} - -/* Directory view/File view (all): bar-graph entry format*/ -td.coverBar -{ - padding-left: 10px; - padding-right: 10px; - background-color: #DAE7FE; -} - -/* Directory view/File view (all): bar-graph outline color */ -td.coverBarOutline -{ - background-color: #000000; -} - -/* Directory view/File view (all): percentage entry for files with - high coverage rate */ -td.coverPerHi -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #A7FC9D; - font-weight: bold; - font-family: sans-serif; -} - -/* Directory view/File view (all): line count entry for files with - high coverage rate */ -td.coverNumHi -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #A7FC9D; - white-space: nowrap; - font-family: sans-serif; -} - -/* Directory view/File view (all): percentage entry for files with - medium coverage rate */ -td.coverPerMed -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #FFEA20; - font-weight: bold; - font-family: sans-serif; -} - -/* Directory view/File view (all): line count entry for files with - medium coverage rate */ -td.coverNumMed -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #FFEA20; - white-space: nowrap; - font-family: sans-serif; -} - -/* Directory view/File view (all): percentage entry for files with - low coverage rate */ -td.coverPerLo -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #FF0000; - font-weight: bold; - font-family: sans-serif; -} - -/* Directory view/File view (all): line count entry for files with - low coverage rate */ -td.coverNumLo -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #FF0000; - white-space: nowrap; - font-family: sans-serif; -} - -/* File view (all): "show/hide details" link format */ -a.detail:link -{ - color: #B8D0FF; - font-size:80%; -} - -/* File view (all): "show/hide details" link - visited format */ -a.detail:visited -{ - color: #B8D0FF; - font-size:80%; -} - -/* File view (all): "show/hide details" link - activated format */ -a.detail:active -{ - color: #FFFFFF; - font-size:80%; -} - -/* File view (detail): test name entry */ -td.testName -{ - text-align: right; - padding-right: 10px; - background-color: #DAE7FE; - font-family: sans-serif; -} - -/* File view (detail): test percentage entry */ -td.testPer -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #DAE7FE; - font-family: sans-serif; -} - -/* File view (detail): test lines count entry */ -td.testNum -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #DAE7FE; - font-family: sans-serif; -} - -/* Test case descriptions: test name format*/ -dt -{ - font-family: sans-serif; - font-weight: bold; -} - -/* Test case descriptions: description table body */ -td.testDescription -{ - padding-top: 10px; - padding-left: 30px; - padding-bottom: 10px; - padding-right: 30px; - background-color: #DAE7FE; -} - -/* Source code view: function entry */ -td.coverFn -{ - text-align: left; - padding-left: 10px; - padding-right: 20px; - color: #284FA8; - background-color: #DAE7FE; - font-family: monospace; -} - -/* Source code view: function entry zero count*/ -td.coverFnLo -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #FF0000; - font-weight: bold; - font-family: sans-serif; -} - -/* Source code view: function entry nonzero count*/ -td.coverFnHi -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #DAE7FE; - font-weight: bold; - font-family: sans-serif; -} - -/* Source code view: source code format */ -pre.source -{ - font-family: monospace; - white-space: pre; - margin-top: 2px; -} - -/* Source code view: line number format */ -span.lineNum -{ - background-color: #EFE383; -} - -/* Source code view: format for lines which were executed */ -td.lineCov, -span.lineCov -{ - background-color: #CAD7FE; -} - -/* Source code view: format for Cov legend */ -span.coverLegendCov -{ - padding-left: 10px; - padding-right: 10px; - padding-bottom: 2px; - background-color: #CAD7FE; -} - -/* Source code view: format for lines which were not executed */ -td.lineNoCov, -span.lineNoCov -{ - background-color: #FF6230; -} - -/* Source code view: format for NoCov legend */ -span.coverLegendNoCov -{ - padding-left: 10px; - padding-right: 10px; - padding-bottom: 2px; - background-color: #FF6230; -} - -/* Source code view (function table): standard link - visited format */ -td.lineNoCov > a:visited, -td.lineCov > a:visited -{ - color: black; - text-decoration: underline; -} - -/* Source code view: format for lines which were executed only in a - previous version */ -span.lineDiffCov -{ - background-color: #B5F7AF; -} - -/* Source code view: format for branches which were executed - * and taken */ -span.branchCov -{ - background-color: #CAD7FE; -} - -/* Source code view: format for branches which were executed - * but not taken */ -span.branchNoCov -{ - background-color: #FF6230; -} - -/* Source code view: format for branches which were not executed */ -span.branchNoExec -{ - background-color: #FF6230; -} - -/* Source code view: format for the source code heading line */ -pre.sourceHeading -{ - white-space: pre; - font-family: monospace; - font-weight: bold; - margin: 0px; -} - -/* All views: header legend value for low rate */ -td.headerValueLegL -{ - font-family: sans-serif; - text-align: center; - white-space: nowrap; - padding-left: 4px; - padding-right: 2px; - background-color: #FF0000; - font-size: 80%; -} - -/* All views: header legend value for med rate */ -td.headerValueLegM -{ - font-family: sans-serif; - text-align: center; - white-space: nowrap; - padding-left: 2px; - padding-right: 2px; - background-color: #FFEA20; - font-size: 80%; -} - -/* All views: header legend value for hi rate */ -td.headerValueLegH -{ - font-family: sans-serif; - text-align: center; - white-space: nowrap; - padding-left: 2px; - padding-right: 4px; - background-color: #A7FC9D; - font-size: 80%; -} - -/* All views except source code view: legend format for low coverage */ -span.coverLegendCovLo -{ - padding-left: 10px; - padding-right: 10px; - padding-top: 2px; - background-color: #FF0000; -} - -/* All views except source code view: legend format for med coverage */ -span.coverLegendCovMed -{ - padding-left: 10px; - padding-right: 10px; - padding-top: 2px; - background-color: #FFEA20; -} - -/* All views except source code view: legend format for hi coverage */ -span.coverLegendCovHi -{ - padding-left: 10px; - padding-right: 10px; - padding-top: 2px; - background-color: #A7FC9D; -} diff --git a/doc/coverageReport/glass.png b/doc/coverageReport/glass.png deleted file mode 100644 index e1abc00680a3093c49fdb775ae6bdb6764c95af2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 167 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)gaEa{HEjtmSN`?>!lvI6;R0X`wF z|Ns97GD8ntt^-nxB|(0{3=Yq3q=7g|-tI089jvk*Kn`btM`SSr1Gf+eGhVt|_XjA* zUgGKN%6^Gmn4d%Ph(nkFP>9RZ#WAE}PI3Z}&BVayv3^M*kj3EX>gTe~DWM4f=_Dpv diff --git a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h.func-sort-c.html b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h.func-sort-c.html deleted file mode 100644 index 0de34274a..000000000 --- a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h.func-sort-c.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy - __multiarray_api.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:132748.1 %
Date:2024-04-08 14:58:22Functions:11100.0 %
-
- -
- - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_import_array4
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h.func.html b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h.func.html deleted file mode 100644 index 6d2267253..000000000 --- a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h.func.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy - __multiarray_api.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:132748.1 %
Date:2024-04-08 14:58:22Functions:11100.0 %
-
- -
- - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_import_array4
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h.gcov.html b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h.gcov.html deleted file mode 100644 index 5aee35675..000000000 --- a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h.gcov.html +++ /dev/null @@ -1,1642 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__multiarray_api.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy - __multiarray_api.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:132748.1 %
Date:2024-04-08 14:58:22Functions:11100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : 
-       2             : #if defined(_MULTIARRAYMODULE) || defined(WITH_CPYCHECKER_STEALS_REFERENCE_TO_ARG_ATTRIBUTE)
-       3             : 
-       4             : typedef struct {
-       5             :         PyObject_HEAD
-       6             :         npy_bool obval;
-       7             : } PyBoolScalarObject;
-       8             : 
-       9             : extern NPY_NO_EXPORT PyTypeObject PyArrayMapIter_Type;
-      10             : extern NPY_NO_EXPORT PyTypeObject PyArrayNeighborhoodIter_Type;
-      11             : extern NPY_NO_EXPORT PyBoolScalarObject _PyArrayScalar_BoolValues[2];
-      12             : 
-      13             : NPY_NO_EXPORT  unsigned int PyArray_GetNDArrayCVersion \
-      14             :        (void);
-      15             : extern NPY_NO_EXPORT PyTypeObject PyBigArray_Type;
-      16             : 
-      17             : extern NPY_NO_EXPORT PyTypeObject PyArray_Type;
-      18             : 
-      19             : extern NPY_NO_EXPORT PyArray_DTypeMeta PyArrayDescr_TypeFull;
-      20             : #define PyArrayDescr_Type (*(PyTypeObject *)(&PyArrayDescr_TypeFull))
-      21             : 
-      22             : extern NPY_NO_EXPORT PyTypeObject PyArrayFlags_Type;
-      23             : 
-      24             : extern NPY_NO_EXPORT PyTypeObject PyArrayIter_Type;
-      25             : 
-      26             : extern NPY_NO_EXPORT PyTypeObject PyArrayMultiIter_Type;
-      27             : 
-      28             : extern NPY_NO_EXPORT int NPY_NUMUSERTYPES;
-      29             : 
-      30             : extern NPY_NO_EXPORT PyTypeObject PyBoolArrType_Type;
-      31             : 
-      32             : extern NPY_NO_EXPORT PyBoolScalarObject _PyArrayScalar_BoolValues[2];
-      33             : 
-      34             : extern NPY_NO_EXPORT PyTypeObject PyGenericArrType_Type;
-      35             : 
-      36             : extern NPY_NO_EXPORT PyTypeObject PyNumberArrType_Type;
-      37             : 
-      38             : extern NPY_NO_EXPORT PyTypeObject PyIntegerArrType_Type;
-      39             : 
-      40             : extern NPY_NO_EXPORT PyTypeObject PySignedIntegerArrType_Type;
-      41             : 
-      42             : extern NPY_NO_EXPORT PyTypeObject PyUnsignedIntegerArrType_Type;
-      43             : 
-      44             : extern NPY_NO_EXPORT PyTypeObject PyInexactArrType_Type;
-      45             : 
-      46             : extern NPY_NO_EXPORT PyTypeObject PyFloatingArrType_Type;
-      47             : 
-      48             : extern NPY_NO_EXPORT PyTypeObject PyComplexFloatingArrType_Type;
-      49             : 
-      50             : extern NPY_NO_EXPORT PyTypeObject PyFlexibleArrType_Type;
-      51             : 
-      52             : extern NPY_NO_EXPORT PyTypeObject PyCharacterArrType_Type;
-      53             : 
-      54             : extern NPY_NO_EXPORT PyTypeObject PyByteArrType_Type;
-      55             : 
-      56             : extern NPY_NO_EXPORT PyTypeObject PyShortArrType_Type;
-      57             : 
-      58             : extern NPY_NO_EXPORT PyTypeObject PyIntArrType_Type;
-      59             : 
-      60             : extern NPY_NO_EXPORT PyTypeObject PyLongArrType_Type;
-      61             : 
-      62             : extern NPY_NO_EXPORT PyTypeObject PyLongLongArrType_Type;
-      63             : 
-      64             : extern NPY_NO_EXPORT PyTypeObject PyUByteArrType_Type;
-      65             : 
-      66             : extern NPY_NO_EXPORT PyTypeObject PyUShortArrType_Type;
-      67             : 
-      68             : extern NPY_NO_EXPORT PyTypeObject PyUIntArrType_Type;
-      69             : 
-      70             : extern NPY_NO_EXPORT PyTypeObject PyULongArrType_Type;
-      71             : 
-      72             : extern NPY_NO_EXPORT PyTypeObject PyULongLongArrType_Type;
-      73             : 
-      74             : extern NPY_NO_EXPORT PyTypeObject PyFloatArrType_Type;
-      75             : 
-      76             : extern NPY_NO_EXPORT PyTypeObject PyDoubleArrType_Type;
-      77             : 
-      78             : extern NPY_NO_EXPORT PyTypeObject PyLongDoubleArrType_Type;
-      79             : 
-      80             : extern NPY_NO_EXPORT PyTypeObject PyCFloatArrType_Type;
-      81             : 
-      82             : extern NPY_NO_EXPORT PyTypeObject PyCDoubleArrType_Type;
-      83             : 
-      84             : extern NPY_NO_EXPORT PyTypeObject PyCLongDoubleArrType_Type;
-      85             : 
-      86             : extern NPY_NO_EXPORT PyTypeObject PyObjectArrType_Type;
-      87             : 
-      88             : extern NPY_NO_EXPORT PyTypeObject PyStringArrType_Type;
-      89             : 
-      90             : extern NPY_NO_EXPORT PyTypeObject PyUnicodeArrType_Type;
-      91             : 
-      92             : extern NPY_NO_EXPORT PyTypeObject PyVoidArrType_Type;
-      93             : 
-      94             : NPY_NO_EXPORT  int PyArray_SetNumericOps \
-      95             :        (PyObject *);
-      96             : NPY_NO_EXPORT  PyObject * PyArray_GetNumericOps \
-      97             :        (void);
-      98             : NPY_NO_EXPORT  int PyArray_INCREF \
-      99             :        (PyArrayObject *);
-     100             : NPY_NO_EXPORT  int PyArray_XDECREF \
-     101             :        (PyArrayObject *);
-     102             : NPY_NO_EXPORT  void PyArray_SetStringFunction \
-     103             :        (PyObject *, int);
-     104             : NPY_NO_EXPORT  PyArray_Descr * PyArray_DescrFromType \
-     105             :        (int);
-     106             : NPY_NO_EXPORT  PyObject * PyArray_TypeObjectFromType \
-     107             :        (int);
-     108             : NPY_NO_EXPORT  char * PyArray_Zero \
-     109             :        (PyArrayObject *);
-     110             : NPY_NO_EXPORT  char * PyArray_One \
-     111             :        (PyArrayObject *);
-     112             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) PyObject * PyArray_CastToType \
-     113             :        (PyArrayObject *, PyArray_Descr *, int);
-     114             : NPY_NO_EXPORT  int PyArray_CastTo \
-     115             :        (PyArrayObject *, PyArrayObject *);
-     116             : NPY_NO_EXPORT  int PyArray_CastAnyTo \
-     117             :        (PyArrayObject *, PyArrayObject *);
-     118             : NPY_NO_EXPORT  int PyArray_CanCastSafely \
-     119             :        (int, int);
-     120             : NPY_NO_EXPORT  npy_bool PyArray_CanCastTo \
-     121             :        (PyArray_Descr *, PyArray_Descr *);
-     122             : NPY_NO_EXPORT  int PyArray_ObjectType \
-     123             :        (PyObject *, int);
-     124             : NPY_NO_EXPORT  PyArray_Descr * PyArray_DescrFromObject \
-     125             :        (PyObject *, PyArray_Descr *);
-     126             : NPY_NO_EXPORT  PyArrayObject ** PyArray_ConvertToCommonType \
-     127             :        (PyObject *, int *);
-     128             : NPY_NO_EXPORT  PyArray_Descr * PyArray_DescrFromScalar \
-     129             :        (PyObject *);
-     130             : NPY_NO_EXPORT  PyArray_Descr * PyArray_DescrFromTypeObject \
-     131             :        (PyObject *);
-     132             : NPY_NO_EXPORT  npy_intp PyArray_Size \
-     133             :        (PyObject *);
-     134             : NPY_NO_EXPORT  PyObject * PyArray_Scalar \
-     135             :        (void *, PyArray_Descr *, PyObject *);
-     136             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) PyObject * PyArray_FromScalar \
-     137             :        (PyObject *, PyArray_Descr *);
-     138             : NPY_NO_EXPORT  void PyArray_ScalarAsCtype \
-     139             :        (PyObject *, void *);
-     140             : NPY_NO_EXPORT  int PyArray_CastScalarToCtype \
-     141             :        (PyObject *, void *, PyArray_Descr *);
-     142             : NPY_NO_EXPORT  int PyArray_CastScalarDirect \
-     143             :        (PyObject *, PyArray_Descr *, void *, int);
-     144             : NPY_NO_EXPORT  PyObject * PyArray_ScalarFromObject \
-     145             :        (PyObject *);
-     146             : NPY_NO_EXPORT  PyArray_VectorUnaryFunc * PyArray_GetCastFunc \
-     147             :        (PyArray_Descr *, int);
-     148             : NPY_NO_EXPORT  PyObject * PyArray_FromDims \
-     149             :        (int NPY_UNUSED(nd), int *NPY_UNUSED(d), int NPY_UNUSED(type));
-     150             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(3) PyObject * PyArray_FromDimsAndDataAndDescr \
-     151             :        (int NPY_UNUSED(nd), int *NPY_UNUSED(d), PyArray_Descr *, char *NPY_UNUSED(data));
-     152             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) PyObject * PyArray_FromAny \
-     153             :        (PyObject *, PyArray_Descr *, int, int, int, PyObject *);
-     154             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(1) PyObject * PyArray_EnsureArray \
-     155             :        (PyObject *);
-     156             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(1) PyObject * PyArray_EnsureAnyArray \
-     157             :        (PyObject *);
-     158             : NPY_NO_EXPORT  PyObject * PyArray_FromFile \
-     159             :        (FILE *, PyArray_Descr *, npy_intp, char *);
-     160             : NPY_NO_EXPORT  PyObject * PyArray_FromString \
-     161             :        (char *, npy_intp, PyArray_Descr *, npy_intp, char *);
-     162             : NPY_NO_EXPORT  PyObject * PyArray_FromBuffer \
-     163             :        (PyObject *, PyArray_Descr *, npy_intp, npy_intp);
-     164             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) PyObject * PyArray_FromIter \
-     165             :        (PyObject *, PyArray_Descr *, npy_intp);
-     166             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(1) PyObject * PyArray_Return \
-     167             :        (PyArrayObject *);
-     168             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) PyObject * PyArray_GetField \
-     169             :        (PyArrayObject *, PyArray_Descr *, int);
-     170             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) int PyArray_SetField \
-     171             :        (PyArrayObject *, PyArray_Descr *, int, PyObject *);
-     172             : NPY_NO_EXPORT  PyObject * PyArray_Byteswap \
-     173             :        (PyArrayObject *, npy_bool);
-     174             : NPY_NO_EXPORT  PyObject * PyArray_Resize \
-     175             :        (PyArrayObject *, PyArray_Dims *, int, NPY_ORDER NPY_UNUSED(order));
-     176             : NPY_NO_EXPORT  int PyArray_MoveInto \
-     177             :        (PyArrayObject *, PyArrayObject *);
-     178             : NPY_NO_EXPORT  int PyArray_CopyInto \
-     179             :        (PyArrayObject *, PyArrayObject *);
-     180             : NPY_NO_EXPORT  int PyArray_CopyAnyInto \
-     181             :        (PyArrayObject *, PyArrayObject *);
-     182             : NPY_NO_EXPORT  int PyArray_CopyObject \
-     183             :        (PyArrayObject *, PyObject *);
-     184             : NPY_NO_EXPORT  PyObject * PyArray_NewCopy \
-     185             :        (PyArrayObject *, NPY_ORDER);
-     186             : NPY_NO_EXPORT  PyObject * PyArray_ToList \
-     187             :        (PyArrayObject *);
-     188             : NPY_NO_EXPORT  PyObject * PyArray_ToString \
-     189             :        (PyArrayObject *, NPY_ORDER);
-     190             : NPY_NO_EXPORT  int PyArray_ToFile \
-     191             :        (PyArrayObject *, FILE *, char *, char *);
-     192             : NPY_NO_EXPORT  int PyArray_Dump \
-     193             :        (PyObject *, PyObject *, int);
-     194             : NPY_NO_EXPORT  PyObject * PyArray_Dumps \
-     195             :        (PyObject *, int);
-     196             : NPY_NO_EXPORT  int PyArray_ValidType \
-     197             :        (int);
-     198             : NPY_NO_EXPORT  void PyArray_UpdateFlags \
-     199             :        (PyArrayObject *, int);
-     200             : NPY_NO_EXPORT  PyObject * PyArray_New \
-     201             :        (PyTypeObject *, int, npy_intp const *, int, npy_intp const *, void *, int, int, PyObject *);
-     202             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) PyObject * PyArray_NewFromDescr \
-     203             :        (PyTypeObject *, PyArray_Descr *, int, npy_intp const *, npy_intp const *, void *, int, PyObject *);
-     204             : NPY_NO_EXPORT  PyArray_Descr * PyArray_DescrNew \
-     205             :        (PyArray_Descr *);
-     206             : NPY_NO_EXPORT  PyArray_Descr * PyArray_DescrNewFromType \
-     207             :        (int);
-     208             : NPY_NO_EXPORT  double PyArray_GetPriority \
-     209             :        (PyObject *, double);
-     210             : NPY_NO_EXPORT  PyObject * PyArray_IterNew \
-     211             :        (PyObject *);
-     212             : NPY_NO_EXPORT  PyObject* PyArray_MultiIterNew \
-     213             :        (int, ...);
-     214             : NPY_NO_EXPORT  int PyArray_PyIntAsInt \
-     215             :        (PyObject *);
-     216             : NPY_NO_EXPORT  npy_intp PyArray_PyIntAsIntp \
-     217             :        (PyObject *);
-     218             : NPY_NO_EXPORT  int PyArray_Broadcast \
-     219             :        (PyArrayMultiIterObject *);
-     220             : NPY_NO_EXPORT  void PyArray_FillObjectArray \
-     221             :        (PyArrayObject *, PyObject *);
-     222             : NPY_NO_EXPORT  int PyArray_FillWithScalar \
-     223             :        (PyArrayObject *, PyObject *);
-     224             : NPY_NO_EXPORT  npy_bool PyArray_CheckStrides \
-     225             :        (int, int, npy_intp, npy_intp, npy_intp const *, npy_intp const *);
-     226             : NPY_NO_EXPORT  PyArray_Descr * PyArray_DescrNewByteorder \
-     227             :        (PyArray_Descr *, char);
-     228             : NPY_NO_EXPORT  PyObject * PyArray_IterAllButAxis \
-     229             :        (PyObject *, int *);
-     230             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) PyObject * PyArray_CheckFromAny \
-     231             :        (PyObject *, PyArray_Descr *, int, int, int, PyObject *);
-     232             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) PyObject * PyArray_FromArray \
-     233             :        (PyArrayObject *, PyArray_Descr *, int);
-     234             : NPY_NO_EXPORT  PyObject * PyArray_FromInterface \
-     235             :        (PyObject *);
-     236             : NPY_NO_EXPORT  PyObject * PyArray_FromStructInterface \
-     237             :        (PyObject *);
-     238             : NPY_NO_EXPORT  PyObject * PyArray_FromArrayAttr \
-     239             :        (PyObject *, PyArray_Descr *, PyObject *);
-     240             : NPY_NO_EXPORT  NPY_SCALARKIND PyArray_ScalarKind \
-     241             :        (int, PyArrayObject **);
-     242             : NPY_NO_EXPORT  int PyArray_CanCoerceScalar \
-     243             :        (int, int, NPY_SCALARKIND);
-     244             : NPY_NO_EXPORT  PyObject * PyArray_NewFlagsObject \
-     245             :        (PyObject *);
-     246             : NPY_NO_EXPORT  npy_bool PyArray_CanCastScalar \
-     247             :        (PyTypeObject *, PyTypeObject *);
-     248             : NPY_NO_EXPORT  int PyArray_CompareUCS4 \
-     249             :        (npy_ucs4 const *, npy_ucs4 const *, size_t);
-     250             : NPY_NO_EXPORT  int PyArray_RemoveSmallest \
-     251             :        (PyArrayMultiIterObject *);
-     252             : NPY_NO_EXPORT  int PyArray_ElementStrides \
-     253             :        (PyObject *);
-     254             : NPY_NO_EXPORT  void PyArray_Item_INCREF \
-     255             :        (char *, PyArray_Descr *);
-     256             : NPY_NO_EXPORT  void PyArray_Item_XDECREF \
-     257             :        (char *, PyArray_Descr *);
-     258             : NPY_NO_EXPORT  PyObject * PyArray_FieldNames \
-     259             :        (PyObject *);
-     260             : NPY_NO_EXPORT  PyObject * PyArray_Transpose \
-     261             :        (PyArrayObject *, PyArray_Dims *);
-     262             : NPY_NO_EXPORT  PyObject * PyArray_TakeFrom \
-     263             :        (PyArrayObject *, PyObject *, int, PyArrayObject *, NPY_CLIPMODE);
-     264             : NPY_NO_EXPORT  PyObject * PyArray_PutTo \
-     265             :        (PyArrayObject *, PyObject*, PyObject *, NPY_CLIPMODE);
-     266             : NPY_NO_EXPORT  PyObject * PyArray_PutMask \
-     267             :        (PyArrayObject *, PyObject*, PyObject*);
-     268             : NPY_NO_EXPORT  PyObject * PyArray_Repeat \
-     269             :        (PyArrayObject *, PyObject *, int);
-     270             : NPY_NO_EXPORT  PyObject * PyArray_Choose \
-     271             :        (PyArrayObject *, PyObject *, PyArrayObject *, NPY_CLIPMODE);
-     272             : NPY_NO_EXPORT  int PyArray_Sort \
-     273             :        (PyArrayObject *, int, NPY_SORTKIND);
-     274             : NPY_NO_EXPORT  PyObject * PyArray_ArgSort \
-     275             :        (PyArrayObject *, int, NPY_SORTKIND);
-     276             : NPY_NO_EXPORT  PyObject * PyArray_SearchSorted \
-     277             :        (PyArrayObject *, PyObject *, NPY_SEARCHSIDE, PyObject *);
-     278             : NPY_NO_EXPORT  PyObject * PyArray_ArgMax \
-     279             :        (PyArrayObject *, int, PyArrayObject *);
-     280             : NPY_NO_EXPORT  PyObject * PyArray_ArgMin \
-     281             :        (PyArrayObject *, int, PyArrayObject *);
-     282             : NPY_NO_EXPORT  PyObject * PyArray_Reshape \
-     283             :        (PyArrayObject *, PyObject *);
-     284             : NPY_NO_EXPORT  PyObject * PyArray_Newshape \
-     285             :        (PyArrayObject *, PyArray_Dims *, NPY_ORDER);
-     286             : NPY_NO_EXPORT  PyObject * PyArray_Squeeze \
-     287             :        (PyArrayObject *);
-     288             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) PyObject * PyArray_View \
-     289             :        (PyArrayObject *, PyArray_Descr *, PyTypeObject *);
-     290             : NPY_NO_EXPORT  PyObject * PyArray_SwapAxes \
-     291             :        (PyArrayObject *, int, int);
-     292             : NPY_NO_EXPORT  PyObject * PyArray_Max \
-     293             :        (PyArrayObject *, int, PyArrayObject *);
-     294             : NPY_NO_EXPORT  PyObject * PyArray_Min \
-     295             :        (PyArrayObject *, int, PyArrayObject *);
-     296             : NPY_NO_EXPORT  PyObject * PyArray_Ptp \
-     297             :        (PyArrayObject *, int, PyArrayObject *);
-     298             : NPY_NO_EXPORT  PyObject * PyArray_Mean \
-     299             :        (PyArrayObject *, int, int, PyArrayObject *);
-     300             : NPY_NO_EXPORT  PyObject * PyArray_Trace \
-     301             :        (PyArrayObject *, int, int, int, int, PyArrayObject *);
-     302             : NPY_NO_EXPORT  PyObject * PyArray_Diagonal \
-     303             :        (PyArrayObject *, int, int, int);
-     304             : NPY_NO_EXPORT  PyObject * PyArray_Clip \
-     305             :        (PyArrayObject *, PyObject *, PyObject *, PyArrayObject *);
-     306             : NPY_NO_EXPORT  PyObject * PyArray_Conjugate \
-     307             :        (PyArrayObject *, PyArrayObject *);
-     308             : NPY_NO_EXPORT  PyObject * PyArray_Nonzero \
-     309             :        (PyArrayObject *);
-     310             : NPY_NO_EXPORT  PyObject * PyArray_Std \
-     311             :        (PyArrayObject *, int, int, PyArrayObject *, int);
-     312             : NPY_NO_EXPORT  PyObject * PyArray_Sum \
-     313             :        (PyArrayObject *, int, int, PyArrayObject *);
-     314             : NPY_NO_EXPORT  PyObject * PyArray_CumSum \
-     315             :        (PyArrayObject *, int, int, PyArrayObject *);
-     316             : NPY_NO_EXPORT  PyObject * PyArray_Prod \
-     317             :        (PyArrayObject *, int, int, PyArrayObject *);
-     318             : NPY_NO_EXPORT  PyObject * PyArray_CumProd \
-     319             :        (PyArrayObject *, int, int, PyArrayObject *);
-     320             : NPY_NO_EXPORT  PyObject * PyArray_All \
-     321             :        (PyArrayObject *, int, PyArrayObject *);
-     322             : NPY_NO_EXPORT  PyObject * PyArray_Any \
-     323             :        (PyArrayObject *, int, PyArrayObject *);
-     324             : NPY_NO_EXPORT  PyObject * PyArray_Compress \
-     325             :        (PyArrayObject *, PyObject *, int, PyArrayObject *);
-     326             : NPY_NO_EXPORT  PyObject * PyArray_Flatten \
-     327             :        (PyArrayObject *, NPY_ORDER);
-     328             : NPY_NO_EXPORT  PyObject * PyArray_Ravel \
-     329             :        (PyArrayObject *, NPY_ORDER);
-     330             : NPY_NO_EXPORT  npy_intp PyArray_MultiplyList \
-     331             :        (npy_intp const *, int);
-     332             : NPY_NO_EXPORT  int PyArray_MultiplyIntList \
-     333             :        (int const *, int);
-     334             : NPY_NO_EXPORT  void * PyArray_GetPtr \
-     335             :        (PyArrayObject *, npy_intp const*);
-     336             : NPY_NO_EXPORT  int PyArray_CompareLists \
-     337             :        (npy_intp const *, npy_intp const *, int);
-     338             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(5) int PyArray_AsCArray \
-     339             :        (PyObject **, void *, npy_intp *, int, PyArray_Descr*);
-     340             : NPY_NO_EXPORT  int PyArray_As1D \
-     341             :        (PyObject **NPY_UNUSED(op), char **NPY_UNUSED(ptr), int *NPY_UNUSED(d1), int NPY_UNUSED(typecode));
-     342             : NPY_NO_EXPORT  int PyArray_As2D \
-     343             :        (PyObject **NPY_UNUSED(op), char ***NPY_UNUSED(ptr), int *NPY_UNUSED(d1), int *NPY_UNUSED(d2), int NPY_UNUSED(typecode));
-     344             : NPY_NO_EXPORT  int PyArray_Free \
-     345             :        (PyObject *, void *);
-     346             : NPY_NO_EXPORT  int PyArray_Converter \
-     347             :        (PyObject *, PyObject **);
-     348             : NPY_NO_EXPORT  int PyArray_IntpFromSequence \
-     349             :        (PyObject *, npy_intp *, int);
-     350             : NPY_NO_EXPORT  PyObject * PyArray_Concatenate \
-     351             :        (PyObject *, int);
-     352             : NPY_NO_EXPORT  PyObject * PyArray_InnerProduct \
-     353             :        (PyObject *, PyObject *);
-     354             : NPY_NO_EXPORT  PyObject * PyArray_MatrixProduct \
-     355             :        (PyObject *, PyObject *);
-     356             : NPY_NO_EXPORT  PyObject * PyArray_CopyAndTranspose \
-     357             :        (PyObject *);
-     358             : NPY_NO_EXPORT  PyObject * PyArray_Correlate \
-     359             :        (PyObject *, PyObject *, int);
-     360             : NPY_NO_EXPORT  int PyArray_TypestrConvert \
-     361             :        (int, int);
-     362             : NPY_NO_EXPORT  int PyArray_DescrConverter \
-     363             :        (PyObject *, PyArray_Descr **);
-     364             : NPY_NO_EXPORT  int PyArray_DescrConverter2 \
-     365             :        (PyObject *, PyArray_Descr **);
-     366             : NPY_NO_EXPORT  int PyArray_IntpConverter \
-     367             :        (PyObject *, PyArray_Dims *);
-     368             : NPY_NO_EXPORT  int PyArray_BufferConverter \
-     369             :        (PyObject *, PyArray_Chunk *);
-     370             : NPY_NO_EXPORT  int PyArray_AxisConverter \
-     371             :        (PyObject *, int *);
-     372             : NPY_NO_EXPORT  int PyArray_BoolConverter \
-     373             :        (PyObject *, npy_bool *);
-     374             : NPY_NO_EXPORT  int PyArray_ByteorderConverter \
-     375             :        (PyObject *, char *);
-     376             : NPY_NO_EXPORT  int PyArray_OrderConverter \
-     377             :        (PyObject *, NPY_ORDER *);
-     378             : NPY_NO_EXPORT  unsigned char PyArray_EquivTypes \
-     379             :        (PyArray_Descr *, PyArray_Descr *);
-     380             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(3) PyObject * PyArray_Zeros \
-     381             :        (int, npy_intp const *, PyArray_Descr *, int);
-     382             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(3) PyObject * PyArray_Empty \
-     383             :        (int, npy_intp const *, PyArray_Descr *, int);
-     384             : NPY_NO_EXPORT  PyObject * PyArray_Where \
-     385             :        (PyObject *, PyObject *, PyObject *);
-     386             : NPY_NO_EXPORT  PyObject * PyArray_Arange \
-     387             :        (double, double, double, int);
-     388             : NPY_NO_EXPORT  PyObject * PyArray_ArangeObj \
-     389             :        (PyObject *, PyObject *, PyObject *, PyArray_Descr *);
-     390             : NPY_NO_EXPORT  int PyArray_SortkindConverter \
-     391             :        (PyObject *, NPY_SORTKIND *);
-     392             : NPY_NO_EXPORT  PyObject * PyArray_LexSort \
-     393             :        (PyObject *, int);
-     394             : NPY_NO_EXPORT  PyObject * PyArray_Round \
-     395             :        (PyArrayObject *, int, PyArrayObject *);
-     396             : NPY_NO_EXPORT  unsigned char PyArray_EquivTypenums \
-     397             :        (int, int);
-     398             : NPY_NO_EXPORT  int PyArray_RegisterDataType \
-     399             :        (PyArray_Descr *);
-     400             : NPY_NO_EXPORT  int PyArray_RegisterCastFunc \
-     401             :        (PyArray_Descr *, int, PyArray_VectorUnaryFunc *);
-     402             : NPY_NO_EXPORT  int PyArray_RegisterCanCast \
-     403             :        (PyArray_Descr *, int, NPY_SCALARKIND);
-     404             : NPY_NO_EXPORT  void PyArray_InitArrFuncs \
-     405             :        (PyArray_ArrFuncs *);
-     406             : NPY_NO_EXPORT  PyObject * PyArray_IntTupleFromIntp \
-     407             :        (int, npy_intp const *);
-     408             : NPY_NO_EXPORT  int PyArray_TypeNumFromName \
-     409             :        (char const *);
-     410             : NPY_NO_EXPORT  int PyArray_ClipmodeConverter \
-     411             :        (PyObject *, NPY_CLIPMODE *);
-     412             : NPY_NO_EXPORT  int PyArray_OutputConverter \
-     413             :        (PyObject *, PyArrayObject **);
-     414             : NPY_NO_EXPORT  PyObject * PyArray_BroadcastToShape \
-     415             :        (PyObject *, npy_intp *, int);
-     416             : NPY_NO_EXPORT  void _PyArray_SigintHandler \
-     417             :        (int);
-     418             : NPY_NO_EXPORT  void* _PyArray_GetSigintBuf \
-     419             :        (void);
-     420             : NPY_NO_EXPORT  int PyArray_DescrAlignConverter \
-     421             :        (PyObject *, PyArray_Descr **);
-     422             : NPY_NO_EXPORT  int PyArray_DescrAlignConverter2 \
-     423             :        (PyObject *, PyArray_Descr **);
-     424             : NPY_NO_EXPORT  int PyArray_SearchsideConverter \
-     425             :        (PyObject *, void *);
-     426             : NPY_NO_EXPORT  PyObject * PyArray_CheckAxis \
-     427             :        (PyArrayObject *, int *, int);
-     428             : NPY_NO_EXPORT  npy_intp PyArray_OverflowMultiplyList \
-     429             :        (npy_intp const *, int);
-     430             : NPY_NO_EXPORT  int PyArray_CompareString \
-     431             :        (const char *, const char *, size_t);
-     432             : NPY_NO_EXPORT  PyObject* PyArray_MultiIterFromObjects \
-     433             :        (PyObject **, int, int, ...);
-     434             : NPY_NO_EXPORT  int PyArray_GetEndianness \
-     435             :        (void);
-     436             : NPY_NO_EXPORT  unsigned int PyArray_GetNDArrayCFeatureVersion \
-     437             :        (void);
-     438             : NPY_NO_EXPORT  PyObject * PyArray_Correlate2 \
-     439             :        (PyObject *, PyObject *, int);
-     440             : NPY_NO_EXPORT  PyObject* PyArray_NeighborhoodIterNew \
-     441             :        (PyArrayIterObject *, const npy_intp *, int, PyArrayObject*);
-     442             : extern NPY_NO_EXPORT PyTypeObject PyTimeIntegerArrType_Type;
-     443             : 
-     444             : extern NPY_NO_EXPORT PyTypeObject PyDatetimeArrType_Type;
-     445             : 
-     446             : extern NPY_NO_EXPORT PyTypeObject PyTimedeltaArrType_Type;
-     447             : 
-     448             : extern NPY_NO_EXPORT PyTypeObject PyHalfArrType_Type;
-     449             : 
-     450             : extern NPY_NO_EXPORT PyTypeObject NpyIter_Type;
-     451             : 
-     452             : NPY_NO_EXPORT  void PyArray_SetDatetimeParseFunction \
-     453             :        (PyObject *NPY_UNUSED(op));
-     454             : NPY_NO_EXPORT  void PyArray_DatetimeToDatetimeStruct \
-     455             :        (npy_datetime NPY_UNUSED(val), NPY_DATETIMEUNIT NPY_UNUSED(fr), npy_datetimestruct *);
-     456             : NPY_NO_EXPORT  void PyArray_TimedeltaToTimedeltaStruct \
-     457             :        (npy_timedelta NPY_UNUSED(val), NPY_DATETIMEUNIT NPY_UNUSED(fr), npy_timedeltastruct *);
-     458             : NPY_NO_EXPORT  npy_datetime PyArray_DatetimeStructToDatetime \
-     459             :        (NPY_DATETIMEUNIT NPY_UNUSED(fr), npy_datetimestruct *NPY_UNUSED(d));
-     460             : NPY_NO_EXPORT  npy_datetime PyArray_TimedeltaStructToTimedelta \
-     461             :        (NPY_DATETIMEUNIT NPY_UNUSED(fr), npy_timedeltastruct *NPY_UNUSED(d));
-     462             : NPY_NO_EXPORT  NpyIter * NpyIter_New \
-     463             :        (PyArrayObject *, npy_uint32, NPY_ORDER, NPY_CASTING, PyArray_Descr*);
-     464             : NPY_NO_EXPORT  NpyIter * NpyIter_MultiNew \
-     465             :        (int, PyArrayObject **, npy_uint32, NPY_ORDER, NPY_CASTING, npy_uint32 *, PyArray_Descr **);
-     466             : NPY_NO_EXPORT  NpyIter * NpyIter_AdvancedNew \
-     467             :        (int, PyArrayObject **, npy_uint32, NPY_ORDER, NPY_CASTING, npy_uint32 *, PyArray_Descr **, int, int **, npy_intp *, npy_intp);
-     468             : NPY_NO_EXPORT  NpyIter * NpyIter_Copy \
-     469             :        (NpyIter *);
-     470             : NPY_NO_EXPORT  int NpyIter_Deallocate \
-     471             :        (NpyIter *);
-     472             : NPY_NO_EXPORT  npy_bool NpyIter_HasDelayedBufAlloc \
-     473             :        (NpyIter *);
-     474             : NPY_NO_EXPORT  npy_bool NpyIter_HasExternalLoop \
-     475             :        (NpyIter *);
-     476             : NPY_NO_EXPORT  int NpyIter_EnableExternalLoop \
-     477             :        (NpyIter *);
-     478             : NPY_NO_EXPORT  npy_intp * NpyIter_GetInnerStrideArray \
-     479             :        (NpyIter *);
-     480             : NPY_NO_EXPORT  npy_intp * NpyIter_GetInnerLoopSizePtr \
-     481             :        (NpyIter *);
-     482             : NPY_NO_EXPORT  int NpyIter_Reset \
-     483             :        (NpyIter *, char **);
-     484             : NPY_NO_EXPORT  int NpyIter_ResetBasePointers \
-     485             :        (NpyIter *, char **, char **);
-     486             : NPY_NO_EXPORT  int NpyIter_ResetToIterIndexRange \
-     487             :        (NpyIter *, npy_intp, npy_intp, char **);
-     488             : NPY_NO_EXPORT  int NpyIter_GetNDim \
-     489             :        (NpyIter *);
-     490             : NPY_NO_EXPORT  int NpyIter_GetNOp \
-     491             :        (NpyIter *);
-     492             : NPY_NO_EXPORT  NpyIter_IterNextFunc * NpyIter_GetIterNext \
-     493             :        (NpyIter *, char **);
-     494             : NPY_NO_EXPORT  npy_intp NpyIter_GetIterSize \
-     495             :        (NpyIter *);
-     496             : NPY_NO_EXPORT  void NpyIter_GetIterIndexRange \
-     497             :        (NpyIter *, npy_intp *, npy_intp *);
-     498             : NPY_NO_EXPORT  npy_intp NpyIter_GetIterIndex \
-     499             :        (NpyIter *);
-     500             : NPY_NO_EXPORT  int NpyIter_GotoIterIndex \
-     501             :        (NpyIter *, npy_intp);
-     502             : NPY_NO_EXPORT  npy_bool NpyIter_HasMultiIndex \
-     503             :        (NpyIter *);
-     504             : NPY_NO_EXPORT  int NpyIter_GetShape \
-     505             :        (NpyIter *, npy_intp *);
-     506             : NPY_NO_EXPORT  NpyIter_GetMultiIndexFunc * NpyIter_GetGetMultiIndex \
-     507             :        (NpyIter *, char **);
-     508             : NPY_NO_EXPORT  int NpyIter_GotoMultiIndex \
-     509             :        (NpyIter *, npy_intp const *);
-     510             : NPY_NO_EXPORT  int NpyIter_RemoveMultiIndex \
-     511             :        (NpyIter *);
-     512             : NPY_NO_EXPORT  npy_bool NpyIter_HasIndex \
-     513             :        (NpyIter *);
-     514             : NPY_NO_EXPORT  npy_bool NpyIter_IsBuffered \
-     515             :        (NpyIter *);
-     516             : NPY_NO_EXPORT  npy_bool NpyIter_IsGrowInner \
-     517             :        (NpyIter *);
-     518             : NPY_NO_EXPORT  npy_intp NpyIter_GetBufferSize \
-     519             :        (NpyIter *);
-     520             : NPY_NO_EXPORT  npy_intp * NpyIter_GetIndexPtr \
-     521             :        (NpyIter *);
-     522             : NPY_NO_EXPORT  int NpyIter_GotoIndex \
-     523             :        (NpyIter *, npy_intp);
-     524             : NPY_NO_EXPORT  char ** NpyIter_GetDataPtrArray \
-     525             :        (NpyIter *);
-     526             : NPY_NO_EXPORT  PyArray_Descr ** NpyIter_GetDescrArray \
-     527             :        (NpyIter *);
-     528             : NPY_NO_EXPORT  PyArrayObject ** NpyIter_GetOperandArray \
-     529             :        (NpyIter *);
-     530             : NPY_NO_EXPORT  PyArrayObject * NpyIter_GetIterView \
-     531             :        (NpyIter *, npy_intp);
-     532             : NPY_NO_EXPORT  void NpyIter_GetReadFlags \
-     533             :        (NpyIter *, char *);
-     534             : NPY_NO_EXPORT  void NpyIter_GetWriteFlags \
-     535             :        (NpyIter *, char *);
-     536             : NPY_NO_EXPORT  void NpyIter_DebugPrint \
-     537             :        (NpyIter *);
-     538             : NPY_NO_EXPORT  npy_bool NpyIter_IterationNeedsAPI \
-     539             :        (NpyIter *);
-     540             : NPY_NO_EXPORT  void NpyIter_GetInnerFixedStrideArray \
-     541             :        (NpyIter *, npy_intp *);
-     542             : NPY_NO_EXPORT  int NpyIter_RemoveAxis \
-     543             :        (NpyIter *, int);
-     544             : NPY_NO_EXPORT  npy_intp * NpyIter_GetAxisStrideArray \
-     545             :        (NpyIter *, int);
-     546             : NPY_NO_EXPORT  npy_bool NpyIter_RequiresBuffering \
-     547             :        (NpyIter *);
-     548             : NPY_NO_EXPORT  char ** NpyIter_GetInitialDataPtrArray \
-     549             :        (NpyIter *);
-     550             : NPY_NO_EXPORT  int NpyIter_CreateCompatibleStrides \
-     551             :        (NpyIter *, npy_intp, npy_intp *);
-     552             : NPY_NO_EXPORT  int PyArray_CastingConverter \
-     553             :        (PyObject *, NPY_CASTING *);
-     554             : NPY_NO_EXPORT  npy_intp PyArray_CountNonzero \
-     555             :        (PyArrayObject *);
-     556             : NPY_NO_EXPORT  PyArray_Descr * PyArray_PromoteTypes \
-     557             :        (PyArray_Descr *, PyArray_Descr *);
-     558             : NPY_NO_EXPORT  PyArray_Descr * PyArray_MinScalarType \
-     559             :        (PyArrayObject *);
-     560             : NPY_NO_EXPORT  PyArray_Descr * PyArray_ResultType \
-     561             :        (npy_intp, PyArrayObject *arrs[], npy_intp, PyArray_Descr *descrs[]);
-     562             : NPY_NO_EXPORT  npy_bool PyArray_CanCastArrayTo \
-     563             :        (PyArrayObject *, PyArray_Descr *, NPY_CASTING);
-     564             : NPY_NO_EXPORT  npy_bool PyArray_CanCastTypeTo \
-     565             :        (PyArray_Descr *, PyArray_Descr *, NPY_CASTING);
-     566             : NPY_NO_EXPORT  PyArrayObject * PyArray_EinsteinSum \
-     567             :        (char *, npy_intp, PyArrayObject **, PyArray_Descr *, NPY_ORDER, NPY_CASTING, PyArrayObject *);
-     568             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(3) PyObject * PyArray_NewLikeArray \
-     569             :        (PyArrayObject *, NPY_ORDER, PyArray_Descr *, int);
-     570             : NPY_NO_EXPORT  int PyArray_GetArrayParamsFromObject \
-     571             :        (PyObject *NPY_UNUSED(op), PyArray_Descr *NPY_UNUSED(requested_dtype), npy_bool NPY_UNUSED(writeable), PyArray_Descr **NPY_UNUSED(out_dtype), int *NPY_UNUSED(out_ndim), npy_intp *NPY_UNUSED(out_dims), PyArrayObject **NPY_UNUSED(out_arr), PyObject *NPY_UNUSED(context));
-     572             : NPY_NO_EXPORT  int PyArray_ConvertClipmodeSequence \
-     573             :        (PyObject *, NPY_CLIPMODE *, int);
-     574             : NPY_NO_EXPORT  PyObject * PyArray_MatrixProduct2 \
-     575             :        (PyObject *, PyObject *, PyArrayObject*);
-     576             : NPY_NO_EXPORT  npy_bool NpyIter_IsFirstVisit \
-     577             :        (NpyIter *, int);
-     578             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) int PyArray_SetBaseObject \
-     579             :        (PyArrayObject *, PyObject *);
-     580             : NPY_NO_EXPORT  void PyArray_CreateSortedStridePerm \
-     581             :        (int, npy_intp const *, npy_stride_sort_item *);
-     582             : NPY_NO_EXPORT  void PyArray_RemoveAxesInPlace \
-     583             :        (PyArrayObject *, const npy_bool *);
-     584             : NPY_NO_EXPORT  void PyArray_DebugPrint \
-     585             :        (PyArrayObject *);
-     586             : NPY_NO_EXPORT  int PyArray_FailUnlessWriteable \
-     587             :        (PyArrayObject *, const char *);
-     588             : NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) int PyArray_SetUpdateIfCopyBase \
-     589             :        (PyArrayObject *, PyArrayObject *);
-     590             : NPY_NO_EXPORT  void * PyDataMem_NEW \
-     591             :        (size_t);
-     592             : NPY_NO_EXPORT  void PyDataMem_FREE \
-     593             :        (void *);
-     594             : NPY_NO_EXPORT  void * PyDataMem_RENEW \
-     595             :        (void *, size_t);
-     596             : NPY_NO_EXPORT  PyDataMem_EventHookFunc * PyDataMem_SetEventHook \
-     597             :        (PyDataMem_EventHookFunc *, void *, void **);
-     598             : extern NPY_NO_EXPORT NPY_CASTING NPY_DEFAULT_ASSIGN_CASTING;
-     599             : 
-     600             : NPY_NO_EXPORT  void PyArray_MapIterSwapAxes \
-     601             :        (PyArrayMapIterObject *, PyArrayObject **, int);
-     602             : NPY_NO_EXPORT  PyObject * PyArray_MapIterArray \
-     603             :        (PyArrayObject *, PyObject *);
-     604             : NPY_NO_EXPORT  void PyArray_MapIterNext \
-     605             :        (PyArrayMapIterObject *);
-     606             : NPY_NO_EXPORT  int PyArray_Partition \
-     607             :        (PyArrayObject *, PyArrayObject *, int, NPY_SELECTKIND);
-     608             : NPY_NO_EXPORT  PyObject * PyArray_ArgPartition \
-     609             :        (PyArrayObject *, PyArrayObject *, int, NPY_SELECTKIND);
-     610             : NPY_NO_EXPORT  int PyArray_SelectkindConverter \
-     611             :        (PyObject *, NPY_SELECTKIND *);
-     612             : NPY_NO_EXPORT  void * PyDataMem_NEW_ZEROED \
-     613             :        (size_t, size_t);
-     614             : NPY_NO_EXPORT  int PyArray_CheckAnyScalarExact \
-     615             :        (PyObject *);
-     616             : NPY_NO_EXPORT  PyObject * PyArray_MapIterArrayCopyIfOverlap \
-     617             :        (PyArrayObject *, PyObject *, int, PyArrayObject *);
-     618             : NPY_NO_EXPORT  int PyArray_ResolveWritebackIfCopy \
-     619             :        (PyArrayObject *);
-     620             : NPY_NO_EXPORT  int PyArray_SetWritebackIfCopyBase \
-     621             :        (PyArrayObject *, PyArrayObject *);
-     622             : NPY_NO_EXPORT  PyObject * PyDataMem_SetHandler \
-     623             :        (PyObject *);
-     624             : NPY_NO_EXPORT  PyObject * PyDataMem_GetHandler \
-     625             :        (void);
-     626             : extern NPY_NO_EXPORT PyObject* PyDataMem_DefaultHandler;
-     627             : 
-     628             : 
-     629             : #else
-     630             : 
-     631             : #if defined(PY_ARRAY_UNIQUE_SYMBOL)
-     632             : #define PyArray_API PY_ARRAY_UNIQUE_SYMBOL
-     633             : #endif
-     634             : 
-     635             : #if defined(NO_IMPORT) || defined(NO_IMPORT_ARRAY)
-     636             : extern void **PyArray_API;
-     637             : #else
-     638             : #if defined(PY_ARRAY_UNIQUE_SYMBOL)
-     639             : void **PyArray_API;
-     640             : #else
-     641             : static void **PyArray_API=NULL;
-     642             : #endif
-     643             : #endif
-     644             : 
-     645             : #define PyArray_GetNDArrayCVersion \
-     646             :         (*(unsigned int (*)(void)) \
-     647             :     PyArray_API[0])
-     648             : #define PyBigArray_Type (*(PyTypeObject *)PyArray_API[1])
-     649             : #define PyArray_Type (*(PyTypeObject *)PyArray_API[2])
-     650             : #define PyArrayDescr_Type (*(PyTypeObject *)PyArray_API[3])
-     651             : #define PyArrayFlags_Type (*(PyTypeObject *)PyArray_API[4])
-     652             : #define PyArrayIter_Type (*(PyTypeObject *)PyArray_API[5])
-     653             : #define PyArrayMultiIter_Type (*(PyTypeObject *)PyArray_API[6])
-     654             : #define NPY_NUMUSERTYPES (*(int *)PyArray_API[7])
-     655             : #define PyBoolArrType_Type (*(PyTypeObject *)PyArray_API[8])
-     656             : #define _PyArrayScalar_BoolValues ((PyBoolScalarObject *)PyArray_API[9])
-     657             : #define PyGenericArrType_Type (*(PyTypeObject *)PyArray_API[10])
-     658             : #define PyNumberArrType_Type (*(PyTypeObject *)PyArray_API[11])
-     659             : #define PyIntegerArrType_Type (*(PyTypeObject *)PyArray_API[12])
-     660             : #define PySignedIntegerArrType_Type (*(PyTypeObject *)PyArray_API[13])
-     661             : #define PyUnsignedIntegerArrType_Type (*(PyTypeObject *)PyArray_API[14])
-     662             : #define PyInexactArrType_Type (*(PyTypeObject *)PyArray_API[15])
-     663             : #define PyFloatingArrType_Type (*(PyTypeObject *)PyArray_API[16])
-     664             : #define PyComplexFloatingArrType_Type (*(PyTypeObject *)PyArray_API[17])
-     665             : #define PyFlexibleArrType_Type (*(PyTypeObject *)PyArray_API[18])
-     666             : #define PyCharacterArrType_Type (*(PyTypeObject *)PyArray_API[19])
-     667             : #define PyByteArrType_Type (*(PyTypeObject *)PyArray_API[20])
-     668             : #define PyShortArrType_Type (*(PyTypeObject *)PyArray_API[21])
-     669             : #define PyIntArrType_Type (*(PyTypeObject *)PyArray_API[22])
-     670             : #define PyLongArrType_Type (*(PyTypeObject *)PyArray_API[23])
-     671             : #define PyLongLongArrType_Type (*(PyTypeObject *)PyArray_API[24])
-     672             : #define PyUByteArrType_Type (*(PyTypeObject *)PyArray_API[25])
-     673             : #define PyUShortArrType_Type (*(PyTypeObject *)PyArray_API[26])
-     674             : #define PyUIntArrType_Type (*(PyTypeObject *)PyArray_API[27])
-     675             : #define PyULongArrType_Type (*(PyTypeObject *)PyArray_API[28])
-     676             : #define PyULongLongArrType_Type (*(PyTypeObject *)PyArray_API[29])
-     677             : #define PyFloatArrType_Type (*(PyTypeObject *)PyArray_API[30])
-     678             : #define PyDoubleArrType_Type (*(PyTypeObject *)PyArray_API[31])
-     679             : #define PyLongDoubleArrType_Type (*(PyTypeObject *)PyArray_API[32])
-     680             : #define PyCFloatArrType_Type (*(PyTypeObject *)PyArray_API[33])
-     681             : #define PyCDoubleArrType_Type (*(PyTypeObject *)PyArray_API[34])
-     682             : #define PyCLongDoubleArrType_Type (*(PyTypeObject *)PyArray_API[35])
-     683             : #define PyObjectArrType_Type (*(PyTypeObject *)PyArray_API[36])
-     684             : #define PyStringArrType_Type (*(PyTypeObject *)PyArray_API[37])
-     685             : #define PyUnicodeArrType_Type (*(PyTypeObject *)PyArray_API[38])
-     686             : #define PyVoidArrType_Type (*(PyTypeObject *)PyArray_API[39])
-     687             : #define PyArray_SetNumericOps \
-     688             :         (*(int (*)(PyObject *)) \
-     689             :     PyArray_API[40])
-     690             : #define PyArray_GetNumericOps \
-     691             :         (*(PyObject * (*)(void)) \
-     692             :     PyArray_API[41])
-     693             : #define PyArray_INCREF \
-     694             :         (*(int (*)(PyArrayObject *)) \
-     695             :     PyArray_API[42])
-     696             : #define PyArray_XDECREF \
-     697             :         (*(int (*)(PyArrayObject *)) \
-     698             :     PyArray_API[43])
-     699             : #define PyArray_SetStringFunction \
-     700             :         (*(void (*)(PyObject *, int)) \
-     701             :     PyArray_API[44])
-     702             : #define PyArray_DescrFromType \
-     703             :         (*(PyArray_Descr * (*)(int)) \
-     704             :     PyArray_API[45])
-     705             : #define PyArray_TypeObjectFromType \
-     706             :         (*(PyObject * (*)(int)) \
-     707             :     PyArray_API[46])
-     708             : #define PyArray_Zero \
-     709             :         (*(char * (*)(PyArrayObject *)) \
-     710             :     PyArray_API[47])
-     711             : #define PyArray_One \
-     712             :         (*(char * (*)(PyArrayObject *)) \
-     713             :     PyArray_API[48])
-     714             : #define PyArray_CastToType \
-     715             :         (*(PyObject * (*)(PyArrayObject *, PyArray_Descr *, int)) \
-     716             :     PyArray_API[49])
-     717             : #define PyArray_CastTo \
-     718             :         (*(int (*)(PyArrayObject *, PyArrayObject *)) \
-     719             :     PyArray_API[50])
-     720             : #define PyArray_CastAnyTo \
-     721             :         (*(int (*)(PyArrayObject *, PyArrayObject *)) \
-     722             :     PyArray_API[51])
-     723             : #define PyArray_CanCastSafely \
-     724             :         (*(int (*)(int, int)) \
-     725             :     PyArray_API[52])
-     726             : #define PyArray_CanCastTo \
-     727             :         (*(npy_bool (*)(PyArray_Descr *, PyArray_Descr *)) \
-     728             :     PyArray_API[53])
-     729             : #define PyArray_ObjectType \
-     730             :         (*(int (*)(PyObject *, int)) \
-     731             :     PyArray_API[54])
-     732             : #define PyArray_DescrFromObject \
-     733             :         (*(PyArray_Descr * (*)(PyObject *, PyArray_Descr *)) \
-     734             :     PyArray_API[55])
-     735             : #define PyArray_ConvertToCommonType \
-     736             :         (*(PyArrayObject ** (*)(PyObject *, int *)) \
-     737             :     PyArray_API[56])
-     738             : #define PyArray_DescrFromScalar \
-     739             :         (*(PyArray_Descr * (*)(PyObject *)) \
-     740             :     PyArray_API[57])
-     741             : #define PyArray_DescrFromTypeObject \
-     742             :         (*(PyArray_Descr * (*)(PyObject *)) \
-     743             :     PyArray_API[58])
-     744             : #define PyArray_Size \
-     745             :         (*(npy_intp (*)(PyObject *)) \
-     746             :     PyArray_API[59])
-     747             : #define PyArray_Scalar \
-     748             :         (*(PyObject * (*)(void *, PyArray_Descr *, PyObject *)) \
-     749             :     PyArray_API[60])
-     750             : #define PyArray_FromScalar \
-     751             :         (*(PyObject * (*)(PyObject *, PyArray_Descr *)) \
-     752             :     PyArray_API[61])
-     753             : #define PyArray_ScalarAsCtype \
-     754             :         (*(void (*)(PyObject *, void *)) \
-     755             :     PyArray_API[62])
-     756             : #define PyArray_CastScalarToCtype \
-     757             :         (*(int (*)(PyObject *, void *, PyArray_Descr *)) \
-     758             :     PyArray_API[63])
-     759             : #define PyArray_CastScalarDirect \
-     760             :         (*(int (*)(PyObject *, PyArray_Descr *, void *, int)) \
-     761             :     PyArray_API[64])
-     762             : #define PyArray_ScalarFromObject \
-     763             :         (*(PyObject * (*)(PyObject *)) \
-     764             :     PyArray_API[65])
-     765             : #define PyArray_GetCastFunc \
-     766             :         (*(PyArray_VectorUnaryFunc * (*)(PyArray_Descr *, int)) \
-     767             :     PyArray_API[66])
-     768             : #define PyArray_FromDims \
-     769             :         (*(PyObject * (*)(int NPY_UNUSED(nd), int *NPY_UNUSED(d), int NPY_UNUSED(type))) \
-     770             :     PyArray_API[67])
-     771             : #define PyArray_FromDimsAndDataAndDescr \
-     772             :         (*(PyObject * (*)(int NPY_UNUSED(nd), int *NPY_UNUSED(d), PyArray_Descr *, char *NPY_UNUSED(data))) \
-     773             :     PyArray_API[68])
-     774             : #define PyArray_FromAny \
-     775             :         (*(PyObject * (*)(PyObject *, PyArray_Descr *, int, int, int, PyObject *)) \
-     776             :     PyArray_API[69])
-     777             : #define PyArray_EnsureArray \
-     778             :         (*(PyObject * (*)(PyObject *)) \
-     779             :     PyArray_API[70])
-     780             : #define PyArray_EnsureAnyArray \
-     781             :         (*(PyObject * (*)(PyObject *)) \
-     782             :     PyArray_API[71])
-     783             : #define PyArray_FromFile \
-     784             :         (*(PyObject * (*)(FILE *, PyArray_Descr *, npy_intp, char *)) \
-     785             :     PyArray_API[72])
-     786             : #define PyArray_FromString \
-     787             :         (*(PyObject * (*)(char *, npy_intp, PyArray_Descr *, npy_intp, char *)) \
-     788             :     PyArray_API[73])
-     789             : #define PyArray_FromBuffer \
-     790             :         (*(PyObject * (*)(PyObject *, PyArray_Descr *, npy_intp, npy_intp)) \
-     791             :     PyArray_API[74])
-     792             : #define PyArray_FromIter \
-     793             :         (*(PyObject * (*)(PyObject *, PyArray_Descr *, npy_intp)) \
-     794             :     PyArray_API[75])
-     795             : #define PyArray_Return \
-     796             :         (*(PyObject * (*)(PyArrayObject *)) \
-     797             :     PyArray_API[76])
-     798             : #define PyArray_GetField \
-     799             :         (*(PyObject * (*)(PyArrayObject *, PyArray_Descr *, int)) \
-     800             :     PyArray_API[77])
-     801             : #define PyArray_SetField \
-     802             :         (*(int (*)(PyArrayObject *, PyArray_Descr *, int, PyObject *)) \
-     803             :     PyArray_API[78])
-     804             : #define PyArray_Byteswap \
-     805             :         (*(PyObject * (*)(PyArrayObject *, npy_bool)) \
-     806             :     PyArray_API[79])
-     807             : #define PyArray_Resize \
-     808             :         (*(PyObject * (*)(PyArrayObject *, PyArray_Dims *, int, NPY_ORDER NPY_UNUSED(order))) \
-     809             :     PyArray_API[80])
-     810             : #define PyArray_MoveInto \
-     811             :         (*(int (*)(PyArrayObject *, PyArrayObject *)) \
-     812             :     PyArray_API[81])
-     813             : #define PyArray_CopyInto \
-     814             :         (*(int (*)(PyArrayObject *, PyArrayObject *)) \
-     815             :     PyArray_API[82])
-     816             : #define PyArray_CopyAnyInto \
-     817             :         (*(int (*)(PyArrayObject *, PyArrayObject *)) \
-     818             :     PyArray_API[83])
-     819             : #define PyArray_CopyObject \
-     820             :         (*(int (*)(PyArrayObject *, PyObject *)) \
-     821             :     PyArray_API[84])
-     822             : #define PyArray_NewCopy \
-     823             :         (*(PyObject * (*)(PyArrayObject *, NPY_ORDER)) \
-     824             :     PyArray_API[85])
-     825             : #define PyArray_ToList \
-     826             :         (*(PyObject * (*)(PyArrayObject *)) \
-     827             :     PyArray_API[86])
-     828             : #define PyArray_ToString \
-     829             :         (*(PyObject * (*)(PyArrayObject *, NPY_ORDER)) \
-     830             :     PyArray_API[87])
-     831             : #define PyArray_ToFile \
-     832             :         (*(int (*)(PyArrayObject *, FILE *, char *, char *)) \
-     833             :     PyArray_API[88])
-     834             : #define PyArray_Dump \
-     835             :         (*(int (*)(PyObject *, PyObject *, int)) \
-     836             :     PyArray_API[89])
-     837             : #define PyArray_Dumps \
-     838             :         (*(PyObject * (*)(PyObject *, int)) \
-     839             :     PyArray_API[90])
-     840             : #define PyArray_ValidType \
-     841             :         (*(int (*)(int)) \
-     842             :     PyArray_API[91])
-     843             : #define PyArray_UpdateFlags \
-     844             :         (*(void (*)(PyArrayObject *, int)) \
-     845             :     PyArray_API[92])
-     846             : #define PyArray_New \
-     847             :         (*(PyObject * (*)(PyTypeObject *, int, npy_intp const *, int, npy_intp const *, void *, int, int, PyObject *)) \
-     848             :     PyArray_API[93])
-     849             : #define PyArray_NewFromDescr \
-     850             :         (*(PyObject * (*)(PyTypeObject *, PyArray_Descr *, int, npy_intp const *, npy_intp const *, void *, int, PyObject *)) \
-     851             :     PyArray_API[94])
-     852             : #define PyArray_DescrNew \
-     853             :         (*(PyArray_Descr * (*)(PyArray_Descr *)) \
-     854             :     PyArray_API[95])
-     855             : #define PyArray_DescrNewFromType \
-     856             :         (*(PyArray_Descr * (*)(int)) \
-     857             :     PyArray_API[96])
-     858             : #define PyArray_GetPriority \
-     859             :         (*(double (*)(PyObject *, double)) \
-     860             :     PyArray_API[97])
-     861             : #define PyArray_IterNew \
-     862             :         (*(PyObject * (*)(PyObject *)) \
-     863             :     PyArray_API[98])
-     864             : #define PyArray_MultiIterNew \
-     865             :         (*(PyObject* (*)(int, ...)) \
-     866             :     PyArray_API[99])
-     867             : #define PyArray_PyIntAsInt \
-     868             :         (*(int (*)(PyObject *)) \
-     869             :     PyArray_API[100])
-     870             : #define PyArray_PyIntAsIntp \
-     871             :         (*(npy_intp (*)(PyObject *)) \
-     872             :     PyArray_API[101])
-     873             : #define PyArray_Broadcast \
-     874             :         (*(int (*)(PyArrayMultiIterObject *)) \
-     875             :     PyArray_API[102])
-     876             : #define PyArray_FillObjectArray \
-     877             :         (*(void (*)(PyArrayObject *, PyObject *)) \
-     878             :     PyArray_API[103])
-     879             : #define PyArray_FillWithScalar \
-     880             :         (*(int (*)(PyArrayObject *, PyObject *)) \
-     881             :     PyArray_API[104])
-     882             : #define PyArray_CheckStrides \
-     883             :         (*(npy_bool (*)(int, int, npy_intp, npy_intp, npy_intp const *, npy_intp const *)) \
-     884             :     PyArray_API[105])
-     885             : #define PyArray_DescrNewByteorder \
-     886             :         (*(PyArray_Descr * (*)(PyArray_Descr *, char)) \
-     887             :     PyArray_API[106])
-     888             : #define PyArray_IterAllButAxis \
-     889             :         (*(PyObject * (*)(PyObject *, int *)) \
-     890             :     PyArray_API[107])
-     891             : #define PyArray_CheckFromAny \
-     892             :         (*(PyObject * (*)(PyObject *, PyArray_Descr *, int, int, int, PyObject *)) \
-     893             :     PyArray_API[108])
-     894             : #define PyArray_FromArray \
-     895             :         (*(PyObject * (*)(PyArrayObject *, PyArray_Descr *, int)) \
-     896             :     PyArray_API[109])
-     897             : #define PyArray_FromInterface \
-     898             :         (*(PyObject * (*)(PyObject *)) \
-     899             :     PyArray_API[110])
-     900             : #define PyArray_FromStructInterface \
-     901             :         (*(PyObject * (*)(PyObject *)) \
-     902             :     PyArray_API[111])
-     903             : #define PyArray_FromArrayAttr \
-     904             :         (*(PyObject * (*)(PyObject *, PyArray_Descr *, PyObject *)) \
-     905             :     PyArray_API[112])
-     906             : #define PyArray_ScalarKind \
-     907             :         (*(NPY_SCALARKIND (*)(int, PyArrayObject **)) \
-     908             :     PyArray_API[113])
-     909             : #define PyArray_CanCoerceScalar \
-     910             :         (*(int (*)(int, int, NPY_SCALARKIND)) \
-     911             :     PyArray_API[114])
-     912             : #define PyArray_NewFlagsObject \
-     913             :         (*(PyObject * (*)(PyObject *)) \
-     914             :     PyArray_API[115])
-     915             : #define PyArray_CanCastScalar \
-     916             :         (*(npy_bool (*)(PyTypeObject *, PyTypeObject *)) \
-     917             :     PyArray_API[116])
-     918             : #define PyArray_CompareUCS4 \
-     919             :         (*(int (*)(npy_ucs4 const *, npy_ucs4 const *, size_t)) \
-     920             :     PyArray_API[117])
-     921             : #define PyArray_RemoveSmallest \
-     922             :         (*(int (*)(PyArrayMultiIterObject *)) \
-     923             :     PyArray_API[118])
-     924             : #define PyArray_ElementStrides \
-     925             :         (*(int (*)(PyObject *)) \
-     926             :     PyArray_API[119])
-     927             : #define PyArray_Item_INCREF \
-     928             :         (*(void (*)(char *, PyArray_Descr *)) \
-     929             :     PyArray_API[120])
-     930             : #define PyArray_Item_XDECREF \
-     931             :         (*(void (*)(char *, PyArray_Descr *)) \
-     932             :     PyArray_API[121])
-     933             : #define PyArray_FieldNames \
-     934             :         (*(PyObject * (*)(PyObject *)) \
-     935             :     PyArray_API[122])
-     936             : #define PyArray_Transpose \
-     937             :         (*(PyObject * (*)(PyArrayObject *, PyArray_Dims *)) \
-     938             :     PyArray_API[123])
-     939             : #define PyArray_TakeFrom \
-     940             :         (*(PyObject * (*)(PyArrayObject *, PyObject *, int, PyArrayObject *, NPY_CLIPMODE)) \
-     941             :     PyArray_API[124])
-     942             : #define PyArray_PutTo \
-     943             :         (*(PyObject * (*)(PyArrayObject *, PyObject*, PyObject *, NPY_CLIPMODE)) \
-     944             :     PyArray_API[125])
-     945             : #define PyArray_PutMask \
-     946             :         (*(PyObject * (*)(PyArrayObject *, PyObject*, PyObject*)) \
-     947             :     PyArray_API[126])
-     948             : #define PyArray_Repeat \
-     949             :         (*(PyObject * (*)(PyArrayObject *, PyObject *, int)) \
-     950             :     PyArray_API[127])
-     951             : #define PyArray_Choose \
-     952             :         (*(PyObject * (*)(PyArrayObject *, PyObject *, PyArrayObject *, NPY_CLIPMODE)) \
-     953             :     PyArray_API[128])
-     954             : #define PyArray_Sort \
-     955             :         (*(int (*)(PyArrayObject *, int, NPY_SORTKIND)) \
-     956             :     PyArray_API[129])
-     957             : #define PyArray_ArgSort \
-     958             :         (*(PyObject * (*)(PyArrayObject *, int, NPY_SORTKIND)) \
-     959             :     PyArray_API[130])
-     960             : #define PyArray_SearchSorted \
-     961             :         (*(PyObject * (*)(PyArrayObject *, PyObject *, NPY_SEARCHSIDE, PyObject *)) \
-     962             :     PyArray_API[131])
-     963             : #define PyArray_ArgMax \
-     964             :         (*(PyObject * (*)(PyArrayObject *, int, PyArrayObject *)) \
-     965             :     PyArray_API[132])
-     966             : #define PyArray_ArgMin \
-     967             :         (*(PyObject * (*)(PyArrayObject *, int, PyArrayObject *)) \
-     968             :     PyArray_API[133])
-     969             : #define PyArray_Reshape \
-     970             :         (*(PyObject * (*)(PyArrayObject *, PyObject *)) \
-     971             :     PyArray_API[134])
-     972             : #define PyArray_Newshape \
-     973             :         (*(PyObject * (*)(PyArrayObject *, PyArray_Dims *, NPY_ORDER)) \
-     974             :     PyArray_API[135])
-     975             : #define PyArray_Squeeze \
-     976             :         (*(PyObject * (*)(PyArrayObject *)) \
-     977             :     PyArray_API[136])
-     978             : #define PyArray_View \
-     979             :         (*(PyObject * (*)(PyArrayObject *, PyArray_Descr *, PyTypeObject *)) \
-     980             :     PyArray_API[137])
-     981             : #define PyArray_SwapAxes \
-     982             :         (*(PyObject * (*)(PyArrayObject *, int, int)) \
-     983             :     PyArray_API[138])
-     984             : #define PyArray_Max \
-     985             :         (*(PyObject * (*)(PyArrayObject *, int, PyArrayObject *)) \
-     986             :     PyArray_API[139])
-     987             : #define PyArray_Min \
-     988             :         (*(PyObject * (*)(PyArrayObject *, int, PyArrayObject *)) \
-     989             :     PyArray_API[140])
-     990             : #define PyArray_Ptp \
-     991             :         (*(PyObject * (*)(PyArrayObject *, int, PyArrayObject *)) \
-     992             :     PyArray_API[141])
-     993             : #define PyArray_Mean \
-     994             :         (*(PyObject * (*)(PyArrayObject *, int, int, PyArrayObject *)) \
-     995             :     PyArray_API[142])
-     996             : #define PyArray_Trace \
-     997             :         (*(PyObject * (*)(PyArrayObject *, int, int, int, int, PyArrayObject *)) \
-     998             :     PyArray_API[143])
-     999             : #define PyArray_Diagonal \
-    1000             :         (*(PyObject * (*)(PyArrayObject *, int, int, int)) \
-    1001             :     PyArray_API[144])
-    1002             : #define PyArray_Clip \
-    1003             :         (*(PyObject * (*)(PyArrayObject *, PyObject *, PyObject *, PyArrayObject *)) \
-    1004             :     PyArray_API[145])
-    1005             : #define PyArray_Conjugate \
-    1006             :         (*(PyObject * (*)(PyArrayObject *, PyArrayObject *)) \
-    1007             :     PyArray_API[146])
-    1008             : #define PyArray_Nonzero \
-    1009             :         (*(PyObject * (*)(PyArrayObject *)) \
-    1010             :     PyArray_API[147])
-    1011             : #define PyArray_Std \
-    1012             :         (*(PyObject * (*)(PyArrayObject *, int, int, PyArrayObject *, int)) \
-    1013             :     PyArray_API[148])
-    1014             : #define PyArray_Sum \
-    1015             :         (*(PyObject * (*)(PyArrayObject *, int, int, PyArrayObject *)) \
-    1016             :     PyArray_API[149])
-    1017             : #define PyArray_CumSum \
-    1018             :         (*(PyObject * (*)(PyArrayObject *, int, int, PyArrayObject *)) \
-    1019             :     PyArray_API[150])
-    1020             : #define PyArray_Prod \
-    1021             :         (*(PyObject * (*)(PyArrayObject *, int, int, PyArrayObject *)) \
-    1022             :     PyArray_API[151])
-    1023             : #define PyArray_CumProd \
-    1024             :         (*(PyObject * (*)(PyArrayObject *, int, int, PyArrayObject *)) \
-    1025             :     PyArray_API[152])
-    1026             : #define PyArray_All \
-    1027             :         (*(PyObject * (*)(PyArrayObject *, int, PyArrayObject *)) \
-    1028             :     PyArray_API[153])
-    1029             : #define PyArray_Any \
-    1030             :         (*(PyObject * (*)(PyArrayObject *, int, PyArrayObject *)) \
-    1031             :     PyArray_API[154])
-    1032             : #define PyArray_Compress \
-    1033             :         (*(PyObject * (*)(PyArrayObject *, PyObject *, int, PyArrayObject *)) \
-    1034             :     PyArray_API[155])
-    1035             : #define PyArray_Flatten \
-    1036             :         (*(PyObject * (*)(PyArrayObject *, NPY_ORDER)) \
-    1037             :     PyArray_API[156])
-    1038             : #define PyArray_Ravel \
-    1039             :         (*(PyObject * (*)(PyArrayObject *, NPY_ORDER)) \
-    1040             :     PyArray_API[157])
-    1041             : #define PyArray_MultiplyList \
-    1042             :         (*(npy_intp (*)(npy_intp const *, int)) \
-    1043             :     PyArray_API[158])
-    1044             : #define PyArray_MultiplyIntList \
-    1045             :         (*(int (*)(int const *, int)) \
-    1046             :     PyArray_API[159])
-    1047             : #define PyArray_GetPtr \
-    1048             :         (*(void * (*)(PyArrayObject *, npy_intp const*)) \
-    1049             :     PyArray_API[160])
-    1050             : #define PyArray_CompareLists \
-    1051             :         (*(int (*)(npy_intp const *, npy_intp const *, int)) \
-    1052             :     PyArray_API[161])
-    1053             : #define PyArray_AsCArray \
-    1054             :         (*(int (*)(PyObject **, void *, npy_intp *, int, PyArray_Descr*)) \
-    1055             :     PyArray_API[162])
-    1056             : #define PyArray_As1D \
-    1057             :         (*(int (*)(PyObject **NPY_UNUSED(op), char **NPY_UNUSED(ptr), int *NPY_UNUSED(d1), int NPY_UNUSED(typecode))) \
-    1058             :     PyArray_API[163])
-    1059             : #define PyArray_As2D \
-    1060             :         (*(int (*)(PyObject **NPY_UNUSED(op), char ***NPY_UNUSED(ptr), int *NPY_UNUSED(d1), int *NPY_UNUSED(d2), int NPY_UNUSED(typecode))) \
-    1061             :     PyArray_API[164])
-    1062             : #define PyArray_Free \
-    1063             :         (*(int (*)(PyObject *, void *)) \
-    1064             :     PyArray_API[165])
-    1065             : #define PyArray_Converter \
-    1066             :         (*(int (*)(PyObject *, PyObject **)) \
-    1067             :     PyArray_API[166])
-    1068             : #define PyArray_IntpFromSequence \
-    1069             :         (*(int (*)(PyObject *, npy_intp *, int)) \
-    1070             :     PyArray_API[167])
-    1071             : #define PyArray_Concatenate \
-    1072             :         (*(PyObject * (*)(PyObject *, int)) \
-    1073             :     PyArray_API[168])
-    1074             : #define PyArray_InnerProduct \
-    1075             :         (*(PyObject * (*)(PyObject *, PyObject *)) \
-    1076             :     PyArray_API[169])
-    1077             : #define PyArray_MatrixProduct \
-    1078             :         (*(PyObject * (*)(PyObject *, PyObject *)) \
-    1079             :     PyArray_API[170])
-    1080             : #define PyArray_CopyAndTranspose \
-    1081             :         (*(PyObject * (*)(PyObject *)) \
-    1082             :     PyArray_API[171])
-    1083             : #define PyArray_Correlate \
-    1084             :         (*(PyObject * (*)(PyObject *, PyObject *, int)) \
-    1085             :     PyArray_API[172])
-    1086             : #define PyArray_TypestrConvert \
-    1087             :         (*(int (*)(int, int)) \
-    1088             :     PyArray_API[173])
-    1089             : #define PyArray_DescrConverter \
-    1090             :         (*(int (*)(PyObject *, PyArray_Descr **)) \
-    1091             :     PyArray_API[174])
-    1092             : #define PyArray_DescrConverter2 \
-    1093             :         (*(int (*)(PyObject *, PyArray_Descr **)) \
-    1094             :     PyArray_API[175])
-    1095             : #define PyArray_IntpConverter \
-    1096             :         (*(int (*)(PyObject *, PyArray_Dims *)) \
-    1097             :     PyArray_API[176])
-    1098             : #define PyArray_BufferConverter \
-    1099             :         (*(int (*)(PyObject *, PyArray_Chunk *)) \
-    1100             :     PyArray_API[177])
-    1101             : #define PyArray_AxisConverter \
-    1102             :         (*(int (*)(PyObject *, int *)) \
-    1103             :     PyArray_API[178])
-    1104             : #define PyArray_BoolConverter \
-    1105             :         (*(int (*)(PyObject *, npy_bool *)) \
-    1106             :     PyArray_API[179])
-    1107             : #define PyArray_ByteorderConverter \
-    1108             :         (*(int (*)(PyObject *, char *)) \
-    1109             :     PyArray_API[180])
-    1110             : #define PyArray_OrderConverter \
-    1111             :         (*(int (*)(PyObject *, NPY_ORDER *)) \
-    1112             :     PyArray_API[181])
-    1113             : #define PyArray_EquivTypes \
-    1114             :         (*(unsigned char (*)(PyArray_Descr *, PyArray_Descr *)) \
-    1115             :     PyArray_API[182])
-    1116             : #define PyArray_Zeros \
-    1117             :         (*(PyObject * (*)(int, npy_intp const *, PyArray_Descr *, int)) \
-    1118             :     PyArray_API[183])
-    1119             : #define PyArray_Empty \
-    1120             :         (*(PyObject * (*)(int, npy_intp const *, PyArray_Descr *, int)) \
-    1121             :     PyArray_API[184])
-    1122             : #define PyArray_Where \
-    1123             :         (*(PyObject * (*)(PyObject *, PyObject *, PyObject *)) \
-    1124             :     PyArray_API[185])
-    1125             : #define PyArray_Arange \
-    1126             :         (*(PyObject * (*)(double, double, double, int)) \
-    1127             :     PyArray_API[186])
-    1128             : #define PyArray_ArangeObj \
-    1129             :         (*(PyObject * (*)(PyObject *, PyObject *, PyObject *, PyArray_Descr *)) \
-    1130             :     PyArray_API[187])
-    1131             : #define PyArray_SortkindConverter \
-    1132             :         (*(int (*)(PyObject *, NPY_SORTKIND *)) \
-    1133             :     PyArray_API[188])
-    1134             : #define PyArray_LexSort \
-    1135             :         (*(PyObject * (*)(PyObject *, int)) \
-    1136             :     PyArray_API[189])
-    1137             : #define PyArray_Round \
-    1138             :         (*(PyObject * (*)(PyArrayObject *, int, PyArrayObject *)) \
-    1139             :     PyArray_API[190])
-    1140             : #define PyArray_EquivTypenums \
-    1141             :         (*(unsigned char (*)(int, int)) \
-    1142             :     PyArray_API[191])
-    1143             : #define PyArray_RegisterDataType \
-    1144             :         (*(int (*)(PyArray_Descr *)) \
-    1145             :     PyArray_API[192])
-    1146             : #define PyArray_RegisterCastFunc \
-    1147             :         (*(int (*)(PyArray_Descr *, int, PyArray_VectorUnaryFunc *)) \
-    1148             :     PyArray_API[193])
-    1149             : #define PyArray_RegisterCanCast \
-    1150             :         (*(int (*)(PyArray_Descr *, int, NPY_SCALARKIND)) \
-    1151             :     PyArray_API[194])
-    1152             : #define PyArray_InitArrFuncs \
-    1153             :         (*(void (*)(PyArray_ArrFuncs *)) \
-    1154             :     PyArray_API[195])
-    1155             : #define PyArray_IntTupleFromIntp \
-    1156             :         (*(PyObject * (*)(int, npy_intp const *)) \
-    1157             :     PyArray_API[196])
-    1158             : #define PyArray_TypeNumFromName \
-    1159             :         (*(int (*)(char const *)) \
-    1160             :     PyArray_API[197])
-    1161             : #define PyArray_ClipmodeConverter \
-    1162             :         (*(int (*)(PyObject *, NPY_CLIPMODE *)) \
-    1163             :     PyArray_API[198])
-    1164             : #define PyArray_OutputConverter \
-    1165             :         (*(int (*)(PyObject *, PyArrayObject **)) \
-    1166             :     PyArray_API[199])
-    1167             : #define PyArray_BroadcastToShape \
-    1168             :         (*(PyObject * (*)(PyObject *, npy_intp *, int)) \
-    1169             :     PyArray_API[200])
-    1170             : #define _PyArray_SigintHandler \
-    1171             :         (*(void (*)(int)) \
-    1172             :     PyArray_API[201])
-    1173             : #define _PyArray_GetSigintBuf \
-    1174             :         (*(void* (*)(void)) \
-    1175             :     PyArray_API[202])
-    1176             : #define PyArray_DescrAlignConverter \
-    1177             :         (*(int (*)(PyObject *, PyArray_Descr **)) \
-    1178             :     PyArray_API[203])
-    1179             : #define PyArray_DescrAlignConverter2 \
-    1180             :         (*(int (*)(PyObject *, PyArray_Descr **)) \
-    1181             :     PyArray_API[204])
-    1182             : #define PyArray_SearchsideConverter \
-    1183             :         (*(int (*)(PyObject *, void *)) \
-    1184             :     PyArray_API[205])
-    1185             : #define PyArray_CheckAxis \
-    1186             :         (*(PyObject * (*)(PyArrayObject *, int *, int)) \
-    1187             :     PyArray_API[206])
-    1188             : #define PyArray_OverflowMultiplyList \
-    1189             :         (*(npy_intp (*)(npy_intp const *, int)) \
-    1190             :     PyArray_API[207])
-    1191             : #define PyArray_CompareString \
-    1192             :         (*(int (*)(const char *, const char *, size_t)) \
-    1193             :     PyArray_API[208])
-    1194             : #define PyArray_MultiIterFromObjects \
-    1195             :         (*(PyObject* (*)(PyObject **, int, int, ...)) \
-    1196             :     PyArray_API[209])
-    1197             : #define PyArray_GetEndianness \
-    1198             :         (*(int (*)(void)) \
-    1199             :     PyArray_API[210])
-    1200             : #define PyArray_GetNDArrayCFeatureVersion \
-    1201             :         (*(unsigned int (*)(void)) \
-    1202             :     PyArray_API[211])
-    1203             : #define PyArray_Correlate2 \
-    1204             :         (*(PyObject * (*)(PyObject *, PyObject *, int)) \
-    1205             :     PyArray_API[212])
-    1206             : #define PyArray_NeighborhoodIterNew \
-    1207             :         (*(PyObject* (*)(PyArrayIterObject *, const npy_intp *, int, PyArrayObject*)) \
-    1208             :     PyArray_API[213])
-    1209             : #define PyTimeIntegerArrType_Type (*(PyTypeObject *)PyArray_API[214])
-    1210             : #define PyDatetimeArrType_Type (*(PyTypeObject *)PyArray_API[215])
-    1211             : #define PyTimedeltaArrType_Type (*(PyTypeObject *)PyArray_API[216])
-    1212             : #define PyHalfArrType_Type (*(PyTypeObject *)PyArray_API[217])
-    1213             : #define NpyIter_Type (*(PyTypeObject *)PyArray_API[218])
-    1214             : #define PyArray_SetDatetimeParseFunction \
-    1215             :         (*(void (*)(PyObject *NPY_UNUSED(op))) \
-    1216             :     PyArray_API[219])
-    1217             : #define PyArray_DatetimeToDatetimeStruct \
-    1218             :         (*(void (*)(npy_datetime NPY_UNUSED(val), NPY_DATETIMEUNIT NPY_UNUSED(fr), npy_datetimestruct *)) \
-    1219             :     PyArray_API[220])
-    1220             : #define PyArray_TimedeltaToTimedeltaStruct \
-    1221             :         (*(void (*)(npy_timedelta NPY_UNUSED(val), NPY_DATETIMEUNIT NPY_UNUSED(fr), npy_timedeltastruct *)) \
-    1222             :     PyArray_API[221])
-    1223             : #define PyArray_DatetimeStructToDatetime \
-    1224             :         (*(npy_datetime (*)(NPY_DATETIMEUNIT NPY_UNUSED(fr), npy_datetimestruct *NPY_UNUSED(d))) \
-    1225             :     PyArray_API[222])
-    1226             : #define PyArray_TimedeltaStructToTimedelta \
-    1227             :         (*(npy_datetime (*)(NPY_DATETIMEUNIT NPY_UNUSED(fr), npy_timedeltastruct *NPY_UNUSED(d))) \
-    1228             :     PyArray_API[223])
-    1229             : #define NpyIter_New \
-    1230             :         (*(NpyIter * (*)(PyArrayObject *, npy_uint32, NPY_ORDER, NPY_CASTING, PyArray_Descr*)) \
-    1231             :     PyArray_API[224])
-    1232             : #define NpyIter_MultiNew \
-    1233             :         (*(NpyIter * (*)(int, PyArrayObject **, npy_uint32, NPY_ORDER, NPY_CASTING, npy_uint32 *, PyArray_Descr **)) \
-    1234             :     PyArray_API[225])
-    1235             : #define NpyIter_AdvancedNew \
-    1236             :         (*(NpyIter * (*)(int, PyArrayObject **, npy_uint32, NPY_ORDER, NPY_CASTING, npy_uint32 *, PyArray_Descr **, int, int **, npy_intp *, npy_intp)) \
-    1237             :     PyArray_API[226])
-    1238             : #define NpyIter_Copy \
-    1239             :         (*(NpyIter * (*)(NpyIter *)) \
-    1240             :     PyArray_API[227])
-    1241             : #define NpyIter_Deallocate \
-    1242             :         (*(int (*)(NpyIter *)) \
-    1243             :     PyArray_API[228])
-    1244             : #define NpyIter_HasDelayedBufAlloc \
-    1245             :         (*(npy_bool (*)(NpyIter *)) \
-    1246             :     PyArray_API[229])
-    1247             : #define NpyIter_HasExternalLoop \
-    1248             :         (*(npy_bool (*)(NpyIter *)) \
-    1249             :     PyArray_API[230])
-    1250             : #define NpyIter_EnableExternalLoop \
-    1251             :         (*(int (*)(NpyIter *)) \
-    1252             :     PyArray_API[231])
-    1253             : #define NpyIter_GetInnerStrideArray \
-    1254             :         (*(npy_intp * (*)(NpyIter *)) \
-    1255             :     PyArray_API[232])
-    1256             : #define NpyIter_GetInnerLoopSizePtr \
-    1257             :         (*(npy_intp * (*)(NpyIter *)) \
-    1258             :     PyArray_API[233])
-    1259             : #define NpyIter_Reset \
-    1260             :         (*(int (*)(NpyIter *, char **)) \
-    1261             :     PyArray_API[234])
-    1262             : #define NpyIter_ResetBasePointers \
-    1263             :         (*(int (*)(NpyIter *, char **, char **)) \
-    1264             :     PyArray_API[235])
-    1265             : #define NpyIter_ResetToIterIndexRange \
-    1266             :         (*(int (*)(NpyIter *, npy_intp, npy_intp, char **)) \
-    1267             :     PyArray_API[236])
-    1268             : #define NpyIter_GetNDim \
-    1269             :         (*(int (*)(NpyIter *)) \
-    1270             :     PyArray_API[237])
-    1271             : #define NpyIter_GetNOp \
-    1272             :         (*(int (*)(NpyIter *)) \
-    1273             :     PyArray_API[238])
-    1274             : #define NpyIter_GetIterNext \
-    1275             :         (*(NpyIter_IterNextFunc * (*)(NpyIter *, char **)) \
-    1276             :     PyArray_API[239])
-    1277             : #define NpyIter_GetIterSize \
-    1278             :         (*(npy_intp (*)(NpyIter *)) \
-    1279             :     PyArray_API[240])
-    1280             : #define NpyIter_GetIterIndexRange \
-    1281             :         (*(void (*)(NpyIter *, npy_intp *, npy_intp *)) \
-    1282             :     PyArray_API[241])
-    1283             : #define NpyIter_GetIterIndex \
-    1284             :         (*(npy_intp (*)(NpyIter *)) \
-    1285             :     PyArray_API[242])
-    1286             : #define NpyIter_GotoIterIndex \
-    1287             :         (*(int (*)(NpyIter *, npy_intp)) \
-    1288             :     PyArray_API[243])
-    1289             : #define NpyIter_HasMultiIndex \
-    1290             :         (*(npy_bool (*)(NpyIter *)) \
-    1291             :     PyArray_API[244])
-    1292             : #define NpyIter_GetShape \
-    1293             :         (*(int (*)(NpyIter *, npy_intp *)) \
-    1294             :     PyArray_API[245])
-    1295             : #define NpyIter_GetGetMultiIndex \
-    1296             :         (*(NpyIter_GetMultiIndexFunc * (*)(NpyIter *, char **)) \
-    1297             :     PyArray_API[246])
-    1298             : #define NpyIter_GotoMultiIndex \
-    1299             :         (*(int (*)(NpyIter *, npy_intp const *)) \
-    1300             :     PyArray_API[247])
-    1301             : #define NpyIter_RemoveMultiIndex \
-    1302             :         (*(int (*)(NpyIter *)) \
-    1303             :     PyArray_API[248])
-    1304             : #define NpyIter_HasIndex \
-    1305             :         (*(npy_bool (*)(NpyIter *)) \
-    1306             :     PyArray_API[249])
-    1307             : #define NpyIter_IsBuffered \
-    1308             :         (*(npy_bool (*)(NpyIter *)) \
-    1309             :     PyArray_API[250])
-    1310             : #define NpyIter_IsGrowInner \
-    1311             :         (*(npy_bool (*)(NpyIter *)) \
-    1312             :     PyArray_API[251])
-    1313             : #define NpyIter_GetBufferSize \
-    1314             :         (*(npy_intp (*)(NpyIter *)) \
-    1315             :     PyArray_API[252])
-    1316             : #define NpyIter_GetIndexPtr \
-    1317             :         (*(npy_intp * (*)(NpyIter *)) \
-    1318             :     PyArray_API[253])
-    1319             : #define NpyIter_GotoIndex \
-    1320             :         (*(int (*)(NpyIter *, npy_intp)) \
-    1321             :     PyArray_API[254])
-    1322             : #define NpyIter_GetDataPtrArray \
-    1323             :         (*(char ** (*)(NpyIter *)) \
-    1324             :     PyArray_API[255])
-    1325             : #define NpyIter_GetDescrArray \
-    1326             :         (*(PyArray_Descr ** (*)(NpyIter *)) \
-    1327             :     PyArray_API[256])
-    1328             : #define NpyIter_GetOperandArray \
-    1329             :         (*(PyArrayObject ** (*)(NpyIter *)) \
-    1330             :     PyArray_API[257])
-    1331             : #define NpyIter_GetIterView \
-    1332             :         (*(PyArrayObject * (*)(NpyIter *, npy_intp)) \
-    1333             :     PyArray_API[258])
-    1334             : #define NpyIter_GetReadFlags \
-    1335             :         (*(void (*)(NpyIter *, char *)) \
-    1336             :     PyArray_API[259])
-    1337             : #define NpyIter_GetWriteFlags \
-    1338             :         (*(void (*)(NpyIter *, char *)) \
-    1339             :     PyArray_API[260])
-    1340             : #define NpyIter_DebugPrint \
-    1341             :         (*(void (*)(NpyIter *)) \
-    1342             :     PyArray_API[261])
-    1343             : #define NpyIter_IterationNeedsAPI \
-    1344             :         (*(npy_bool (*)(NpyIter *)) \
-    1345             :     PyArray_API[262])
-    1346             : #define NpyIter_GetInnerFixedStrideArray \
-    1347             :         (*(void (*)(NpyIter *, npy_intp *)) \
-    1348             :     PyArray_API[263])
-    1349             : #define NpyIter_RemoveAxis \
-    1350             :         (*(int (*)(NpyIter *, int)) \
-    1351             :     PyArray_API[264])
-    1352             : #define NpyIter_GetAxisStrideArray \
-    1353             :         (*(npy_intp * (*)(NpyIter *, int)) \
-    1354             :     PyArray_API[265])
-    1355             : #define NpyIter_RequiresBuffering \
-    1356             :         (*(npy_bool (*)(NpyIter *)) \
-    1357             :     PyArray_API[266])
-    1358             : #define NpyIter_GetInitialDataPtrArray \
-    1359             :         (*(char ** (*)(NpyIter *)) \
-    1360             :     PyArray_API[267])
-    1361             : #define NpyIter_CreateCompatibleStrides \
-    1362             :         (*(int (*)(NpyIter *, npy_intp, npy_intp *)) \
-    1363             :     PyArray_API[268])
-    1364             : #define PyArray_CastingConverter \
-    1365             :         (*(int (*)(PyObject *, NPY_CASTING *)) \
-    1366             :     PyArray_API[269])
-    1367             : #define PyArray_CountNonzero \
-    1368             :         (*(npy_intp (*)(PyArrayObject *)) \
-    1369             :     PyArray_API[270])
-    1370             : #define PyArray_PromoteTypes \
-    1371             :         (*(PyArray_Descr * (*)(PyArray_Descr *, PyArray_Descr *)) \
-    1372             :     PyArray_API[271])
-    1373             : #define PyArray_MinScalarType \
-    1374             :         (*(PyArray_Descr * (*)(PyArrayObject *)) \
-    1375             :     PyArray_API[272])
-    1376             : #define PyArray_ResultType \
-    1377             :         (*(PyArray_Descr * (*)(npy_intp, PyArrayObject *arrs[], npy_intp, PyArray_Descr *descrs[])) \
-    1378             :     PyArray_API[273])
-    1379             : #define PyArray_CanCastArrayTo \
-    1380             :         (*(npy_bool (*)(PyArrayObject *, PyArray_Descr *, NPY_CASTING)) \
-    1381             :     PyArray_API[274])
-    1382             : #define PyArray_CanCastTypeTo \
-    1383             :         (*(npy_bool (*)(PyArray_Descr *, PyArray_Descr *, NPY_CASTING)) \
-    1384             :     PyArray_API[275])
-    1385             : #define PyArray_EinsteinSum \
-    1386             :         (*(PyArrayObject * (*)(char *, npy_intp, PyArrayObject **, PyArray_Descr *, NPY_ORDER, NPY_CASTING, PyArrayObject *)) \
-    1387             :     PyArray_API[276])
-    1388             : #define PyArray_NewLikeArray \
-    1389             :         (*(PyObject * (*)(PyArrayObject *, NPY_ORDER, PyArray_Descr *, int)) \
-    1390             :     PyArray_API[277])
-    1391             : #define PyArray_GetArrayParamsFromObject \
-    1392             :         (*(int (*)(PyObject *NPY_UNUSED(op), PyArray_Descr *NPY_UNUSED(requested_dtype), npy_bool NPY_UNUSED(writeable), PyArray_Descr **NPY_UNUSED(out_dtype), int *NPY_UNUSED(out_ndim), npy_intp *NPY_UNUSED(out_dims), PyArrayObject **NPY_UNUSED(out_arr), PyObject *NPY_UNUSED(context))) \
-    1393             :     PyArray_API[278])
-    1394             : #define PyArray_ConvertClipmodeSequence \
-    1395             :         (*(int (*)(PyObject *, NPY_CLIPMODE *, int)) \
-    1396             :     PyArray_API[279])
-    1397             : #define PyArray_MatrixProduct2 \
-    1398             :         (*(PyObject * (*)(PyObject *, PyObject *, PyArrayObject*)) \
-    1399             :     PyArray_API[280])
-    1400             : #define NpyIter_IsFirstVisit \
-    1401             :         (*(npy_bool (*)(NpyIter *, int)) \
-    1402             :     PyArray_API[281])
-    1403             : #define PyArray_SetBaseObject \
-    1404             :         (*(int (*)(PyArrayObject *, PyObject *)) \
-    1405             :     PyArray_API[282])
-    1406             : #define PyArray_CreateSortedStridePerm \
-    1407             :         (*(void (*)(int, npy_intp const *, npy_stride_sort_item *)) \
-    1408             :     PyArray_API[283])
-    1409             : #define PyArray_RemoveAxesInPlace \
-    1410             :         (*(void (*)(PyArrayObject *, const npy_bool *)) \
-    1411             :     PyArray_API[284])
-    1412             : #define PyArray_DebugPrint \
-    1413             :         (*(void (*)(PyArrayObject *)) \
-    1414             :     PyArray_API[285])
-    1415             : #define PyArray_FailUnlessWriteable \
-    1416             :         (*(int (*)(PyArrayObject *, const char *)) \
-    1417             :     PyArray_API[286])
-    1418             : #define PyArray_SetUpdateIfCopyBase \
-    1419             :         (*(int (*)(PyArrayObject *, PyArrayObject *)) \
-    1420             :     PyArray_API[287])
-    1421             : #define PyDataMem_NEW \
-    1422             :         (*(void * (*)(size_t)) \
-    1423             :     PyArray_API[288])
-    1424             : #define PyDataMem_FREE \
-    1425             :         (*(void (*)(void *)) \
-    1426             :     PyArray_API[289])
-    1427             : #define PyDataMem_RENEW \
-    1428             :         (*(void * (*)(void *, size_t)) \
-    1429             :     PyArray_API[290])
-    1430             : #define PyDataMem_SetEventHook \
-    1431             :         (*(PyDataMem_EventHookFunc * (*)(PyDataMem_EventHookFunc *, void *, void **)) \
-    1432             :     PyArray_API[291])
-    1433             : #define NPY_DEFAULT_ASSIGN_CASTING (*(NPY_CASTING *)PyArray_API[292])
-    1434             : #define PyArray_MapIterSwapAxes \
-    1435             :         (*(void (*)(PyArrayMapIterObject *, PyArrayObject **, int)) \
-    1436             :     PyArray_API[293])
-    1437             : #define PyArray_MapIterArray \
-    1438             :         (*(PyObject * (*)(PyArrayObject *, PyObject *)) \
-    1439             :     PyArray_API[294])
-    1440             : #define PyArray_MapIterNext \
-    1441             :         (*(void (*)(PyArrayMapIterObject *)) \
-    1442             :     PyArray_API[295])
-    1443             : #define PyArray_Partition \
-    1444             :         (*(int (*)(PyArrayObject *, PyArrayObject *, int, NPY_SELECTKIND)) \
-    1445             :     PyArray_API[296])
-    1446             : #define PyArray_ArgPartition \
-    1447             :         (*(PyObject * (*)(PyArrayObject *, PyArrayObject *, int, NPY_SELECTKIND)) \
-    1448             :     PyArray_API[297])
-    1449             : #define PyArray_SelectkindConverter \
-    1450             :         (*(int (*)(PyObject *, NPY_SELECTKIND *)) \
-    1451             :     PyArray_API[298])
-    1452             : #define PyDataMem_NEW_ZEROED \
-    1453             :         (*(void * (*)(size_t, size_t)) \
-    1454             :     PyArray_API[299])
-    1455             : #define PyArray_CheckAnyScalarExact \
-    1456             :         (*(int (*)(PyObject *)) \
-    1457             :     PyArray_API[300])
-    1458             : #define PyArray_MapIterArrayCopyIfOverlap \
-    1459             :         (*(PyObject * (*)(PyArrayObject *, PyObject *, int, PyArrayObject *)) \
-    1460             :     PyArray_API[301])
-    1461             : #define PyArray_ResolveWritebackIfCopy \
-    1462             :         (*(int (*)(PyArrayObject *)) \
-    1463             :     PyArray_API[302])
-    1464             : #define PyArray_SetWritebackIfCopyBase \
-    1465             :         (*(int (*)(PyArrayObject *, PyArrayObject *)) \
-    1466             :     PyArray_API[303])
-    1467             : 
-    1468             : #if NPY_FEATURE_VERSION >= NPY_1_22_API_VERSION
-    1469             : #define PyDataMem_SetHandler \
-    1470             :         (*(PyObject * (*)(PyObject *)) \
-    1471             :     PyArray_API[304])
-    1472             : #endif
-    1473             : 
-    1474             : #if NPY_FEATURE_VERSION >= NPY_1_22_API_VERSION
-    1475             : #define PyDataMem_GetHandler \
-    1476             :         (*(PyObject * (*)(void)) \
-    1477             :     PyArray_API[305])
-    1478             : #endif
-    1479             : #define PyDataMem_DefaultHandler (*(PyObject* *)PyArray_API[306])
-    1480             : 
-    1481             : #if !defined(NO_IMPORT_ARRAY) && !defined(NO_IMPORT)
-    1482             : static int
-    1483           4 : _import_array(void)
-    1484             : {
-    1485             :   int st;
-    1486           4 :   PyObject *numpy = PyImport_ImportModule("numpy.core._multiarray_umath");
-    1487             :   PyObject *c_api = NULL;
-    1488             : 
-    1489           4 :   if (numpy == NULL) {
-    1490             :       return -1;
-    1491             :   }
-    1492           4 :   c_api = PyObject_GetAttrString(numpy, "_ARRAY_API");
-    1493             :   Py_DECREF(numpy);
-    1494           4 :   if (c_api == NULL) {
-    1495             :       return -1;
-    1496             :   }
-    1497             : 
-    1498           4 :   if (!PyCapsule_CheckExact(c_api)) {
-    1499           0 :       PyErr_SetString(PyExc_RuntimeError, "_ARRAY_API is not PyCapsule object");
-    1500             :       Py_DECREF(c_api);
-    1501           0 :       return -1;
-    1502             :   }
-    1503           4 :   PyArray_API = (void **)PyCapsule_GetPointer(c_api, NULL);
-    1504             :   Py_DECREF(c_api);
-    1505           4 :   if (PyArray_API == NULL) {
-    1506           0 :       PyErr_SetString(PyExc_RuntimeError, "_ARRAY_API is NULL pointer");
-    1507           0 :       return -1;
-    1508             :   }
-    1509             : 
-    1510             :   /* Perform runtime check of C API version */
-    1511           4 :   if (NPY_VERSION != PyArray_GetNDArrayCVersion()) {
-    1512           0 :       PyErr_Format(PyExc_RuntimeError, "module compiled against "\
-    1513             :              "ABI version 0x%x but this version of numpy is 0x%x", \
-    1514           0 :              (int) NPY_VERSION, (int) PyArray_GetNDArrayCVersion());
-    1515           0 :       return -1;
-    1516             :   }
-    1517           4 :   if (NPY_FEATURE_VERSION > PyArray_GetNDArrayCFeatureVersion()) {
-    1518           0 :       PyErr_Format(PyExc_RuntimeError, "module compiled against "\
-    1519             :              "API version 0x%x but this version of numpy is 0x%x . "\
-    1520             :              "Check the section C-API incompatibility at the "\
-    1521             :              "Troubleshooting ImportError section at "\
-    1522             :              "https://numpy.org/devdocs/user/troubleshooting-importerror.html"\
-    1523             :              "#c-api-incompatibility "\
-    1524             :               "for indications on how to solve this problem .", \
-    1525           0 :              (int) NPY_FEATURE_VERSION, (int) PyArray_GetNDArrayCFeatureVersion());
-    1526           0 :       return -1;
-    1527             :   }
-    1528             : 
-    1529             :   /*
-    1530             :    * Perform runtime check of endianness and check it matches the one set by
-    1531             :    * the headers (npy_endian.h) as a safeguard
-    1532             :    */
-    1533           4 :   st = PyArray_GetEndianness();
-    1534           4 :   if (st == NPY_CPU_UNKNOWN_ENDIAN) {
-    1535           0 :       PyErr_SetString(PyExc_RuntimeError,
-    1536             :                       "FATAL: module compiled as unknown endian");
-    1537           0 :       return -1;
-    1538             :   }
-    1539             : #if NPY_BYTE_ORDER == NPY_BIG_ENDIAN
-    1540             :   if (st != NPY_CPU_BIG) {
-    1541             :       PyErr_SetString(PyExc_RuntimeError,
-    1542             :                       "FATAL: module compiled as big endian, but "
-    1543             :                       "detected different endianness at runtime");
-    1544             :       return -1;
-    1545             :   }
-    1546             : #elif NPY_BYTE_ORDER == NPY_LITTLE_ENDIAN
-    1547           4 :   if (st != NPY_CPU_LITTLE) {
-    1548           0 :       PyErr_SetString(PyExc_RuntimeError,
-    1549             :                       "FATAL: module compiled as little endian, but "
-    1550             :                       "detected different endianness at runtime");
-    1551           0 :       return -1;
-    1552             :   }
-    1553             : #endif
-    1554             : 
-    1555             :   return 0;
-    1556             : }
-    1557             : 
-    1558             : #define import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return NULL; } }
-    1559             : 
-    1560             : #define import_array1(ret) {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return ret; } }
-    1561             : 
-    1562             : #define import_array2(msg, ret) {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, msg); return ret; } }
-    1563             : 
-    1564             : #endif
-    1565             : 
-    1566             : #endif
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h.func-sort-c.html b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h.func-sort-c.html deleted file mode 100644 index 1e4f8aa99..000000000 --- a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h.func-sort-c.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy - __ufunc_api.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:81650.0 %
Date:2024-04-08 14:58:22Functions:11100.0 %
-
- -
- - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_import_umath4
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h.func.html b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h.func.html deleted file mode 100644 index 093ab6873..000000000 --- a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h.func.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy - __ufunc_api.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:81650.0 %
Date:2024-04-08 14:58:22Functions:11100.0 %
-
- -
- - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_import_umath4
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h.gcov.html b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h.gcov.html deleted file mode 100644 index da3452463..000000000 --- a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h.gcov.html +++ /dev/null @@ -1,390 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/__ufunc_api.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy - __ufunc_api.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:81650.0 %
Date:2024-04-08 14:58:22Functions:11100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : 
-       2             : #ifdef _UMATHMODULE
-       3             : 
-       4             : extern NPY_NO_EXPORT PyTypeObject PyUFunc_Type;
-       5             : 
-       6             : extern NPY_NO_EXPORT PyTypeObject PyUFunc_Type;
-       7             : 
-       8             : NPY_NO_EXPORT  PyObject * PyUFunc_FromFuncAndData \
-       9             :        (PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, int);
-      10             : NPY_NO_EXPORT  int PyUFunc_RegisterLoopForType \
-      11             :        (PyUFuncObject *, int, PyUFuncGenericFunction, const int *, void *);
-      12             : NPY_NO_EXPORT  int PyUFunc_GenericFunction \
-      13             :        (PyUFuncObject *NPY_UNUSED(ufunc), PyObject *NPY_UNUSED(args), PyObject *NPY_UNUSED(kwds), PyArrayObject **NPY_UNUSED(op));
-      14             : NPY_NO_EXPORT  void PyUFunc_f_f_As_d_d \
-      15             :        (char **, npy_intp const *, npy_intp const *, void *);
-      16             : NPY_NO_EXPORT  void PyUFunc_d_d \
-      17             :        (char **, npy_intp const *, npy_intp const *, void *);
-      18             : NPY_NO_EXPORT  void PyUFunc_f_f \
-      19             :        (char **, npy_intp const *, npy_intp const *, void *);
-      20             : NPY_NO_EXPORT  void PyUFunc_g_g \
-      21             :        (char **, npy_intp const *, npy_intp const *, void *);
-      22             : NPY_NO_EXPORT  void PyUFunc_F_F_As_D_D \
-      23             :        (char **, npy_intp const *, npy_intp const *, void *);
-      24             : NPY_NO_EXPORT  void PyUFunc_F_F \
-      25             :        (char **, npy_intp const *, npy_intp const *, void *);
-      26             : NPY_NO_EXPORT  void PyUFunc_D_D \
-      27             :        (char **, npy_intp const *, npy_intp const *, void *);
-      28             : NPY_NO_EXPORT  void PyUFunc_G_G \
-      29             :        (char **, npy_intp const *, npy_intp const *, void *);
-      30             : NPY_NO_EXPORT  void PyUFunc_O_O \
-      31             :        (char **, npy_intp const *, npy_intp const *, void *);
-      32             : NPY_NO_EXPORT  void PyUFunc_ff_f_As_dd_d \
-      33             :        (char **, npy_intp const *, npy_intp const *, void *);
-      34             : NPY_NO_EXPORT  void PyUFunc_ff_f \
-      35             :        (char **, npy_intp const *, npy_intp const *, void *);
-      36             : NPY_NO_EXPORT  void PyUFunc_dd_d \
-      37             :        (char **, npy_intp const *, npy_intp const *, void *);
-      38             : NPY_NO_EXPORT  void PyUFunc_gg_g \
-      39             :        (char **, npy_intp const *, npy_intp const *, void *);
-      40             : NPY_NO_EXPORT  void PyUFunc_FF_F_As_DD_D \
-      41             :        (char **, npy_intp const *, npy_intp const *, void *);
-      42             : NPY_NO_EXPORT  void PyUFunc_DD_D \
-      43             :        (char **, npy_intp const *, npy_intp const *, void *);
-      44             : NPY_NO_EXPORT  void PyUFunc_FF_F \
-      45             :        (char **, npy_intp const *, npy_intp const *, void *);
-      46             : NPY_NO_EXPORT  void PyUFunc_GG_G \
-      47             :        (char **, npy_intp const *, npy_intp const *, void *);
-      48             : NPY_NO_EXPORT  void PyUFunc_OO_O \
-      49             :        (char **, npy_intp const *, npy_intp const *, void *);
-      50             : NPY_NO_EXPORT  void PyUFunc_O_O_method \
-      51             :        (char **, npy_intp const *, npy_intp const *, void *);
-      52             : NPY_NO_EXPORT  void PyUFunc_OO_O_method \
-      53             :        (char **, npy_intp const *, npy_intp const *, void *);
-      54             : NPY_NO_EXPORT  void PyUFunc_On_Om \
-      55             :        (char **, npy_intp const *, npy_intp const *, void *);
-      56             : NPY_NO_EXPORT  int PyUFunc_GetPyValues \
-      57             :        (char *, int *, int *, PyObject **);
-      58             : NPY_NO_EXPORT  int PyUFunc_checkfperr \
-      59             :        (int, PyObject *, int *);
-      60             : NPY_NO_EXPORT  void PyUFunc_clearfperr \
-      61             :        (void);
-      62             : NPY_NO_EXPORT  int PyUFunc_getfperr \
-      63             :        (void);
-      64             : NPY_NO_EXPORT  int PyUFunc_handlefperr \
-      65             :        (int, PyObject *, int, int *);
-      66             : NPY_NO_EXPORT  int PyUFunc_ReplaceLoopBySignature \
-      67             :        (PyUFuncObject *, PyUFuncGenericFunction, const int *, PyUFuncGenericFunction *);
-      68             : NPY_NO_EXPORT  PyObject * PyUFunc_FromFuncAndDataAndSignature \
-      69             :        (PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, int, const char *);
-      70             : NPY_NO_EXPORT  int PyUFunc_SetUsesArraysAsData \
-      71             :        (void **NPY_UNUSED(data), size_t NPY_UNUSED(i));
-      72             : NPY_NO_EXPORT  void PyUFunc_e_e \
-      73             :        (char **, npy_intp const *, npy_intp const *, void *);
-      74             : NPY_NO_EXPORT  void PyUFunc_e_e_As_f_f \
-      75             :        (char **, npy_intp const *, npy_intp const *, void *);
-      76             : NPY_NO_EXPORT  void PyUFunc_e_e_As_d_d \
-      77             :        (char **, npy_intp const *, npy_intp const *, void *);
-      78             : NPY_NO_EXPORT  void PyUFunc_ee_e \
-      79             :        (char **, npy_intp const *, npy_intp const *, void *);
-      80             : NPY_NO_EXPORT  void PyUFunc_ee_e_As_ff_f \
-      81             :        (char **, npy_intp const *, npy_intp const *, void *);
-      82             : NPY_NO_EXPORT  void PyUFunc_ee_e_As_dd_d \
-      83             :        (char **, npy_intp const *, npy_intp const *, void *);
-      84             : NPY_NO_EXPORT  int PyUFunc_DefaultTypeResolver \
-      85             :        (PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyObject *, PyArray_Descr **);
-      86             : NPY_NO_EXPORT  int PyUFunc_ValidateCasting \
-      87             :        (PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyArray_Descr **);
-      88             : NPY_NO_EXPORT  int PyUFunc_RegisterLoopForDescr \
-      89             :        (PyUFuncObject *, PyArray_Descr *, PyUFuncGenericFunction, PyArray_Descr **, void *);
-      90             : NPY_NO_EXPORT  PyObject * PyUFunc_FromFuncAndDataAndSignatureAndIdentity \
-      91             :        (PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, const int, const char *, PyObject *);
-      92             : 
-      93             : #else
-      94             : 
-      95             : #if defined(PY_UFUNC_UNIQUE_SYMBOL)
-      96             : #define PyUFunc_API PY_UFUNC_UNIQUE_SYMBOL
-      97             : #endif
-      98             : 
-      99             : #if defined(NO_IMPORT) || defined(NO_IMPORT_UFUNC)
-     100             : extern void **PyUFunc_API;
-     101             : #else
-     102             : #if defined(PY_UFUNC_UNIQUE_SYMBOL)
-     103             : void **PyUFunc_API;
-     104             : #else
-     105             : static void **PyUFunc_API=NULL;
-     106             : #endif
-     107             : #endif
-     108             : 
-     109             : #define PyUFunc_Type (*(PyTypeObject *)PyUFunc_API[0])
-     110             : #define PyUFunc_FromFuncAndData \
-     111             :         (*(PyObject * (*)(PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, int)) \
-     112             :     PyUFunc_API[1])
-     113             : #define PyUFunc_RegisterLoopForType \
-     114             :         (*(int (*)(PyUFuncObject *, int, PyUFuncGenericFunction, const int *, void *)) \
-     115             :     PyUFunc_API[2])
-     116             : #define PyUFunc_GenericFunction \
-     117             :         (*(int (*)(PyUFuncObject *NPY_UNUSED(ufunc), PyObject *NPY_UNUSED(args), PyObject *NPY_UNUSED(kwds), PyArrayObject **NPY_UNUSED(op))) \
-     118             :     PyUFunc_API[3])
-     119             : #define PyUFunc_f_f_As_d_d \
-     120             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     121             :     PyUFunc_API[4])
-     122             : #define PyUFunc_d_d \
-     123             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     124             :     PyUFunc_API[5])
-     125             : #define PyUFunc_f_f \
-     126             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     127             :     PyUFunc_API[6])
-     128             : #define PyUFunc_g_g \
-     129             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     130             :     PyUFunc_API[7])
-     131             : #define PyUFunc_F_F_As_D_D \
-     132             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     133             :     PyUFunc_API[8])
-     134             : #define PyUFunc_F_F \
-     135             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     136             :     PyUFunc_API[9])
-     137             : #define PyUFunc_D_D \
-     138             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     139             :     PyUFunc_API[10])
-     140             : #define PyUFunc_G_G \
-     141             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     142             :     PyUFunc_API[11])
-     143             : #define PyUFunc_O_O \
-     144             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     145             :     PyUFunc_API[12])
-     146             : #define PyUFunc_ff_f_As_dd_d \
-     147             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     148             :     PyUFunc_API[13])
-     149             : #define PyUFunc_ff_f \
-     150             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     151             :     PyUFunc_API[14])
-     152             : #define PyUFunc_dd_d \
-     153             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     154             :     PyUFunc_API[15])
-     155             : #define PyUFunc_gg_g \
-     156             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     157             :     PyUFunc_API[16])
-     158             : #define PyUFunc_FF_F_As_DD_D \
-     159             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     160             :     PyUFunc_API[17])
-     161             : #define PyUFunc_DD_D \
-     162             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     163             :     PyUFunc_API[18])
-     164             : #define PyUFunc_FF_F \
-     165             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     166             :     PyUFunc_API[19])
-     167             : #define PyUFunc_GG_G \
-     168             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     169             :     PyUFunc_API[20])
-     170             : #define PyUFunc_OO_O \
-     171             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     172             :     PyUFunc_API[21])
-     173             : #define PyUFunc_O_O_method \
-     174             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     175             :     PyUFunc_API[22])
-     176             : #define PyUFunc_OO_O_method \
-     177             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     178             :     PyUFunc_API[23])
-     179             : #define PyUFunc_On_Om \
-     180             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     181             :     PyUFunc_API[24])
-     182             : #define PyUFunc_GetPyValues \
-     183             :         (*(int (*)(char *, int *, int *, PyObject **)) \
-     184             :     PyUFunc_API[25])
-     185             : #define PyUFunc_checkfperr \
-     186             :         (*(int (*)(int, PyObject *, int *)) \
-     187             :     PyUFunc_API[26])
-     188             : #define PyUFunc_clearfperr \
-     189             :         (*(void (*)(void)) \
-     190             :     PyUFunc_API[27])
-     191             : #define PyUFunc_getfperr \
-     192             :         (*(int (*)(void)) \
-     193             :     PyUFunc_API[28])
-     194             : #define PyUFunc_handlefperr \
-     195             :         (*(int (*)(int, PyObject *, int, int *)) \
-     196             :     PyUFunc_API[29])
-     197             : #define PyUFunc_ReplaceLoopBySignature \
-     198             :         (*(int (*)(PyUFuncObject *, PyUFuncGenericFunction, const int *, PyUFuncGenericFunction *)) \
-     199             :     PyUFunc_API[30])
-     200             : #define PyUFunc_FromFuncAndDataAndSignature \
-     201             :         (*(PyObject * (*)(PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, int, const char *)) \
-     202             :     PyUFunc_API[31])
-     203             : #define PyUFunc_SetUsesArraysAsData \
-     204             :         (*(int (*)(void **NPY_UNUSED(data), size_t NPY_UNUSED(i))) \
-     205             :     PyUFunc_API[32])
-     206             : #define PyUFunc_e_e \
-     207             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     208             :     PyUFunc_API[33])
-     209             : #define PyUFunc_e_e_As_f_f \
-     210             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     211             :     PyUFunc_API[34])
-     212             : #define PyUFunc_e_e_As_d_d \
-     213             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     214             :     PyUFunc_API[35])
-     215             : #define PyUFunc_ee_e \
-     216             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     217             :     PyUFunc_API[36])
-     218             : #define PyUFunc_ee_e_As_ff_f \
-     219             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     220             :     PyUFunc_API[37])
-     221             : #define PyUFunc_ee_e_As_dd_d \
-     222             :         (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
-     223             :     PyUFunc_API[38])
-     224             : #define PyUFunc_DefaultTypeResolver \
-     225             :         (*(int (*)(PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyObject *, PyArray_Descr **)) \
-     226             :     PyUFunc_API[39])
-     227             : #define PyUFunc_ValidateCasting \
-     228             :         (*(int (*)(PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyArray_Descr **)) \
-     229             :     PyUFunc_API[40])
-     230             : #define PyUFunc_RegisterLoopForDescr \
-     231             :         (*(int (*)(PyUFuncObject *, PyArray_Descr *, PyUFuncGenericFunction, PyArray_Descr **, void *)) \
-     232             :     PyUFunc_API[41])
-     233             : 
-     234             : #if NPY_FEATURE_VERSION >= NPY_1_16_API_VERSION
-     235             : #define PyUFunc_FromFuncAndDataAndSignatureAndIdentity \
-     236             :         (*(PyObject * (*)(PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, const int, const char *, PyObject *)) \
-     237             :     PyUFunc_API[42])
-     238             : #endif
-     239             : 
-     240             : static inline int
-     241           4 : _import_umath(void)
-     242             : {
-     243           4 :   PyObject *numpy = PyImport_ImportModule("numpy.core._multiarray_umath");
-     244             :   PyObject *c_api = NULL;
-     245             : 
-     246           4 :   if (numpy == NULL) {
-     247           0 :       PyErr_SetString(PyExc_ImportError,
-     248             :                       "numpy.core._multiarray_umath failed to import");
-     249           0 :       return -1;
-     250             :   }
-     251           4 :   c_api = PyObject_GetAttrString(numpy, "_UFUNC_API");
-     252             :   Py_DECREF(numpy);
-     253           4 :   if (c_api == NULL) {
-     254           0 :       PyErr_SetString(PyExc_AttributeError, "_UFUNC_API not found");
-     255           0 :       return -1;
-     256             :   }
-     257             : 
-     258           4 :   if (!PyCapsule_CheckExact(c_api)) {
-     259           0 :       PyErr_SetString(PyExc_RuntimeError, "_UFUNC_API is not PyCapsule object");
-     260             :       Py_DECREF(c_api);
-     261           0 :       return -1;
-     262             :   }
-     263           4 :   PyUFunc_API = (void **)PyCapsule_GetPointer(c_api, NULL);
-     264             :   Py_DECREF(c_api);
-     265           4 :   if (PyUFunc_API == NULL) {
-     266           0 :       PyErr_SetString(PyExc_RuntimeError, "_UFUNC_API is NULL pointer");
-     267           0 :       return -1;
-     268             :   }
-     269             :   return 0;
-     270             : }
-     271             : 
-     272             : #define import_umath() \
-     273             :     do {\
-     274             :         UFUNC_NOFPE\
-     275             :         if (_import_umath() < 0) {\
-     276             :             PyErr_Print();\
-     277             :             PyErr_SetString(PyExc_ImportError,\
-     278             :                     "numpy.core.umath failed to import");\
-     279             :             return NULL;\
-     280             :         }\
-     281             :     } while(0)
-     282             : 
-     283             : #define import_umath1(ret) \
-     284             :     do {\
-     285             :         UFUNC_NOFPE\
-     286             :         if (_import_umath() < 0) {\
-     287             :             PyErr_Print();\
-     288             :             PyErr_SetString(PyExc_ImportError,\
-     289             :                     "numpy.core.umath failed to import");\
-     290             :             return ret;\
-     291             :         }\
-     292             :     } while(0)
-     293             : 
-     294             : #define import_umath2(ret, msg) \
-     295             :     do {\
-     296             :         UFUNC_NOFPE\
-     297             :         if (_import_umath() < 0) {\
-     298             :             PyErr_Print();\
-     299             :             PyErr_SetString(PyExc_ImportError, msg);\
-     300             :             return ret;\
-     301             :         }\
-     302             :     } while(0)
-     303             : 
-     304             : #define import_ufunc() \
-     305             :     do {\
-     306             :         UFUNC_NOFPE\
-     307             :         if (_import_umath() < 0) {\
-     308             :             PyErr_Print();\
-     309             :             PyErr_SetString(PyExc_ImportError,\
-     310             :                     "numpy.core.umath failed to import");\
-     311             :         }\
-     312             :     } while(0)
-     313             : 
-     314             : #endif
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/index-sort-f.html b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/index-sort-f.html deleted file mode 100644 index 2686fc849..000000000 --- a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/index-sort-f.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpyHitTotalCoverage
Test:coverage.info.cleanedLines:214843.8 %
Date:2024-04-08 14:58:22Functions:22100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
ndarraytypes.h -
0.0%
-
0.0 %0 / 5-0 / 0
__ufunc_api.h -
50.0%50.0%
-
50.0 %8 / 16100.0 %1 / 1
__multiarray_api.h -
48.1%48.1%
-
48.1 %13 / 27100.0 %1 / 1
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/index-sort-l.html b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/index-sort-l.html deleted file mode 100644 index 80f238d04..000000000 --- a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/index-sort-l.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpyHitTotalCoverage
Test:coverage.info.cleanedLines:214843.8 %
Date:2024-04-08 14:58:22Functions:22100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
ndarraytypes.h -
0.0%
-
0.0 %0 / 5-0 / 0
__multiarray_api.h -
48.1%48.1%
-
48.1 %13 / 27100.0 %1 / 1
__ufunc_api.h -
50.0%50.0%
-
50.0 %8 / 16100.0 %1 / 1
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/index.html b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/index.html deleted file mode 100644 index 124271195..000000000 --- a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/index.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpyHitTotalCoverage
Test:coverage.info.cleanedLines:214843.8 %
Date:2024-04-08 14:58:22Functions:22100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
__multiarray_api.h -
48.1%48.1%
-
48.1 %13 / 27100.0 %1 / 1
__ufunc_api.h -
50.0%50.0%
-
50.0 %8 / 16100.0 %1 / 1
ndarraytypes.h -
0.0%
-
0.0 %0 / 5-0 / 0
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h.func-sort-c.html b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h.func-sort-c.html deleted file mode 100644 index 84a09fcbb..000000000 --- a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy - ndarraytypes.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:050.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h.func.html b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h.func.html deleted file mode 100644 index ebd0e1b6a..000000000 --- a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy - ndarraytypes.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:050.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h.gcov.html b/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h.gcov.html deleted file mode 100644 index c960b1d11..000000000 --- a/doc/coverageReport/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h.gcov.html +++ /dev/null @@ -1,2021 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - /home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy - ndarraytypes.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:050.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef NUMPY_CORE_INCLUDE_NUMPY_NDARRAYTYPES_H_
-       2             : #define NUMPY_CORE_INCLUDE_NUMPY_NDARRAYTYPES_H_
-       3             : 
-       4             : #include "npy_common.h"
-       5             : #include "npy_endian.h"
-       6             : #include "npy_cpu.h"
-       7             : #include "utils.h"
-       8             : 
-       9             : #define NPY_NO_EXPORT NPY_VISIBILITY_HIDDEN
-      10             : 
-      11             : /* Only use thread if configured in config and python supports it */
-      12             : #if defined WITH_THREAD && !NPY_NO_SMP
-      13             :         #define NPY_ALLOW_THREADS 1
-      14             : #else
-      15             :         #define NPY_ALLOW_THREADS 0
-      16             : #endif
-      17             : 
-      18             : #ifndef __has_extension
-      19             : #define __has_extension(x) 0
-      20             : #endif
-      21             : 
-      22             : #if !defined(_NPY_NO_DEPRECATIONS) && \
-      23             :     ((defined(__GNUC__)&& __GNUC__ >= 6) || \
-      24             :      __has_extension(attribute_deprecated_with_message))
-      25             : #define NPY_ATTR_DEPRECATE(text) __attribute__ ((deprecated (text)))
-      26             : #else
-      27             : #define NPY_ATTR_DEPRECATE(text)
-      28             : #endif
-      29             : 
-      30             : /*
-      31             :  * There are several places in the code where an array of dimensions
-      32             :  * is allocated statically.  This is the size of that static
-      33             :  * allocation.
-      34             :  *
-      35             :  * The array creation itself could have arbitrary dimensions but all
-      36             :  * the places where static allocation is used would need to be changed
-      37             :  * to dynamic (including inside of several structures)
-      38             :  */
-      39             : 
-      40             : #define NPY_MAXDIMS 32
-      41             : #define NPY_MAXARGS 32
-      42             : 
-      43             : /* Used for Converter Functions "O&" code in ParseTuple */
-      44             : #define NPY_FAIL 0
-      45             : #define NPY_SUCCEED 1
-      46             : 
-      47             : 
-      48             : enum NPY_TYPES {    NPY_BOOL=0,
-      49             :                     NPY_BYTE, NPY_UBYTE,
-      50             :                     NPY_SHORT, NPY_USHORT,
-      51             :                     NPY_INT, NPY_UINT,
-      52             :                     NPY_LONG, NPY_ULONG,
-      53             :                     NPY_LONGLONG, NPY_ULONGLONG,
-      54             :                     NPY_FLOAT, NPY_DOUBLE, NPY_LONGDOUBLE,
-      55             :                     NPY_CFLOAT, NPY_CDOUBLE, NPY_CLONGDOUBLE,
-      56             :                     NPY_OBJECT=17,
-      57             :                     NPY_STRING, NPY_UNICODE,
-      58             :                     NPY_VOID,
-      59             :                     /*
-      60             :                      * New 1.6 types appended, may be integrated
-      61             :                      * into the above in 2.0.
-      62             :                      */
-      63             :                     NPY_DATETIME, NPY_TIMEDELTA, NPY_HALF,
-      64             : 
-      65             :                     NPY_NTYPES,
-      66             :                     NPY_NOTYPE,
-      67             :                     NPY_CHAR NPY_ATTR_DEPRECATE("Use NPY_STRING"),
-      68             :                     NPY_USERDEF=256,  /* leave room for characters */
-      69             : 
-      70             :                     /* The number of types not including the new 1.6 types */
-      71             :                     NPY_NTYPES_ABI_COMPATIBLE=21
-      72             : };
-      73             : #if defined(_MSC_VER) && !defined(__clang__)
-      74             : #pragma deprecated(NPY_CHAR)
-      75             : #endif
-      76             : 
-      77             : /* basetype array priority */
-      78             : #define NPY_PRIORITY 0.0
-      79             : 
-      80             : /* default subtype priority */
-      81             : #define NPY_SUBTYPE_PRIORITY 1.0
-      82             : 
-      83             : /* default scalar priority */
-      84             : #define NPY_SCALAR_PRIORITY -1000000.0
-      85             : 
-      86             : /* How many floating point types are there (excluding half) */
-      87             : #define NPY_NUM_FLOATTYPE 3
-      88             : 
-      89             : /*
-      90             :  * These characters correspond to the array type and the struct
-      91             :  * module
-      92             :  */
-      93             : 
-      94             : enum NPY_TYPECHAR {
-      95             :         NPY_BOOLLTR = '?',
-      96             :         NPY_BYTELTR = 'b',
-      97             :         NPY_UBYTELTR = 'B',
-      98             :         NPY_SHORTLTR = 'h',
-      99             :         NPY_USHORTLTR = 'H',
-     100             :         NPY_INTLTR = 'i',
-     101             :         NPY_UINTLTR = 'I',
-     102             :         NPY_LONGLTR = 'l',
-     103             :         NPY_ULONGLTR = 'L',
-     104             :         NPY_LONGLONGLTR = 'q',
-     105             :         NPY_ULONGLONGLTR = 'Q',
-     106             :         NPY_HALFLTR = 'e',
-     107             :         NPY_FLOATLTR = 'f',
-     108             :         NPY_DOUBLELTR = 'd',
-     109             :         NPY_LONGDOUBLELTR = 'g',
-     110             :         NPY_CFLOATLTR = 'F',
-     111             :         NPY_CDOUBLELTR = 'D',
-     112             :         NPY_CLONGDOUBLELTR = 'G',
-     113             :         NPY_OBJECTLTR = 'O',
-     114             :         NPY_STRINGLTR = 'S',
-     115             :         NPY_STRINGLTR2 = 'a',
-     116             :         NPY_UNICODELTR = 'U',
-     117             :         NPY_VOIDLTR = 'V',
-     118             :         NPY_DATETIMELTR = 'M',
-     119             :         NPY_TIMEDELTALTR = 'm',
-     120             :         NPY_CHARLTR = 'c',
-     121             : 
-     122             :         /*
-     123             :          * No Descriptor, just a define -- this let's
-     124             :          * Python users specify an array of integers
-     125             :          * large enough to hold a pointer on the
-     126             :          * platform
-     127             :          */
-     128             :         NPY_INTPLTR = 'p',
-     129             :         NPY_UINTPLTR = 'P',
-     130             : 
-     131             :         /*
-     132             :          * These are for dtype 'kinds', not dtype 'typecodes'
-     133             :          * as the above are for.
-     134             :          */
-     135             :         NPY_GENBOOLLTR ='b',
-     136             :         NPY_SIGNEDLTR = 'i',
-     137             :         NPY_UNSIGNEDLTR = 'u',
-     138             :         NPY_FLOATINGLTR = 'f',
-     139             :         NPY_COMPLEXLTR = 'c'
-     140             : };
-     141             : 
-     142             : /*
-     143             :  * Changing this may break Numpy API compatibility
-     144             :  * due to changing offsets in PyArray_ArrFuncs, so be
-     145             :  * careful. Here we have reused the mergesort slot for
-     146             :  * any kind of stable sort, the actual implementation will
-     147             :  * depend on the data type.
-     148             :  */
-     149             : typedef enum {
-     150             :         NPY_QUICKSORT=0,
-     151             :         NPY_HEAPSORT=1,
-     152             :         NPY_MERGESORT=2,
-     153             :         NPY_STABLESORT=2,
-     154             : } NPY_SORTKIND;
-     155             : #define NPY_NSORTS (NPY_STABLESORT + 1)
-     156             : 
-     157             : 
-     158             : typedef enum {
-     159             :         NPY_INTROSELECT=0
-     160             : } NPY_SELECTKIND;
-     161             : #define NPY_NSELECTS (NPY_INTROSELECT + 1)
-     162             : 
-     163             : 
-     164             : typedef enum {
-     165             :         NPY_SEARCHLEFT=0,
-     166             :         NPY_SEARCHRIGHT=1
-     167             : } NPY_SEARCHSIDE;
-     168             : #define NPY_NSEARCHSIDES (NPY_SEARCHRIGHT + 1)
-     169             : 
-     170             : 
-     171             : typedef enum {
-     172             :         NPY_NOSCALAR=-1,
-     173             :         NPY_BOOL_SCALAR,
-     174             :         NPY_INTPOS_SCALAR,
-     175             :         NPY_INTNEG_SCALAR,
-     176             :         NPY_FLOAT_SCALAR,
-     177             :         NPY_COMPLEX_SCALAR,
-     178             :         NPY_OBJECT_SCALAR
-     179             : } NPY_SCALARKIND;
-     180             : #define NPY_NSCALARKINDS (NPY_OBJECT_SCALAR + 1)
-     181             : 
-     182             : /* For specifying array memory layout or iteration order */
-     183             : typedef enum {
-     184             :         /* Fortran order if inputs are all Fortran, C otherwise */
-     185             :         NPY_ANYORDER=-1,
-     186             :         /* C order */
-     187             :         NPY_CORDER=0,
-     188             :         /* Fortran order */
-     189             :         NPY_FORTRANORDER=1,
-     190             :         /* An order as close to the inputs as possible */
-     191             :         NPY_KEEPORDER=2
-     192             : } NPY_ORDER;
-     193             : 
-     194             : /* For specifying allowed casting in operations which support it */
-     195             : typedef enum {
-     196             :         _NPY_ERROR_OCCURRED_IN_CAST = -1,
-     197             :         /* Only allow identical types */
-     198             :         NPY_NO_CASTING=0,
-     199             :         /* Allow identical and byte swapped types */
-     200             :         NPY_EQUIV_CASTING=1,
-     201             :         /* Only allow safe casts */
-     202             :         NPY_SAFE_CASTING=2,
-     203             :         /* Allow safe casts or casts within the same kind */
-     204             :         NPY_SAME_KIND_CASTING=3,
-     205             :         /* Allow any casts */
-     206             :         NPY_UNSAFE_CASTING=4,
-     207             : } NPY_CASTING;
-     208             : 
-     209             : typedef enum {
-     210             :         NPY_CLIP=0,
-     211             :         NPY_WRAP=1,
-     212             :         NPY_RAISE=2
-     213             : } NPY_CLIPMODE;
-     214             : 
-     215             : typedef enum {
-     216             :         NPY_VALID=0,
-     217             :         NPY_SAME=1,
-     218             :         NPY_FULL=2
-     219             : } NPY_CORRELATEMODE;
-     220             : 
-     221             : /* The special not-a-time (NaT) value */
-     222             : #define NPY_DATETIME_NAT NPY_MIN_INT64
-     223             : 
-     224             : /*
-     225             :  * Upper bound on the length of a DATETIME ISO 8601 string
-     226             :  *   YEAR: 21 (64-bit year)
-     227             :  *   MONTH: 3
-     228             :  *   DAY: 3
-     229             :  *   HOURS: 3
-     230             :  *   MINUTES: 3
-     231             :  *   SECONDS: 3
-     232             :  *   ATTOSECONDS: 1 + 3*6
-     233             :  *   TIMEZONE: 5
-     234             :  *   NULL TERMINATOR: 1
-     235             :  */
-     236             : #define NPY_DATETIME_MAX_ISO8601_STRLEN (21 + 3*5 + 1 + 3*6 + 6 + 1)
-     237             : 
-     238             : /* The FR in the unit names stands for frequency */
-     239             : typedef enum {
-     240             :         /* Force signed enum type, must be -1 for code compatibility */
-     241             :         NPY_FR_ERROR = -1,      /* error or undetermined */
-     242             : 
-     243             :         /* Start of valid units */
-     244             :         NPY_FR_Y = 0,           /* Years */
-     245             :         NPY_FR_M = 1,           /* Months */
-     246             :         NPY_FR_W = 2,           /* Weeks */
-     247             :         /* Gap where 1.6 NPY_FR_B (value 3) was */
-     248             :         NPY_FR_D = 4,           /* Days */
-     249             :         NPY_FR_h = 5,           /* hours */
-     250             :         NPY_FR_m = 6,           /* minutes */
-     251             :         NPY_FR_s = 7,           /* seconds */
-     252             :         NPY_FR_ms = 8,          /* milliseconds */
-     253             :         NPY_FR_us = 9,          /* microseconds */
-     254             :         NPY_FR_ns = 10,         /* nanoseconds */
-     255             :         NPY_FR_ps = 11,         /* picoseconds */
-     256             :         NPY_FR_fs = 12,         /* femtoseconds */
-     257             :         NPY_FR_as = 13,         /* attoseconds */
-     258             :         NPY_FR_GENERIC = 14     /* unbound units, can convert to anything */
-     259             : } NPY_DATETIMEUNIT;
-     260             : 
-     261             : /*
-     262             :  * NOTE: With the NPY_FR_B gap for 1.6 ABI compatibility, NPY_DATETIME_NUMUNITS
-     263             :  * is technically one more than the actual number of units.
-     264             :  */
-     265             : #define NPY_DATETIME_NUMUNITS (NPY_FR_GENERIC + 1)
-     266             : #define NPY_DATETIME_DEFAULTUNIT NPY_FR_GENERIC
-     267             : 
-     268             : /*
-     269             :  * Business day conventions for mapping invalid business
-     270             :  * days to valid business days.
-     271             :  */
-     272             : typedef enum {
-     273             :     /* Go forward in time to the following business day. */
-     274             :     NPY_BUSDAY_FORWARD,
-     275             :     NPY_BUSDAY_FOLLOWING = NPY_BUSDAY_FORWARD,
-     276             :     /* Go backward in time to the preceding business day. */
-     277             :     NPY_BUSDAY_BACKWARD,
-     278             :     NPY_BUSDAY_PRECEDING = NPY_BUSDAY_BACKWARD,
-     279             :     /*
-     280             :      * Go forward in time to the following business day, unless it
-     281             :      * crosses a month boundary, in which case go backward
-     282             :      */
-     283             :     NPY_BUSDAY_MODIFIEDFOLLOWING,
-     284             :     /*
-     285             :      * Go backward in time to the preceding business day, unless it
-     286             :      * crosses a month boundary, in which case go forward.
-     287             :      */
-     288             :     NPY_BUSDAY_MODIFIEDPRECEDING,
-     289             :     /* Produce a NaT for non-business days. */
-     290             :     NPY_BUSDAY_NAT,
-     291             :     /* Raise an exception for non-business days. */
-     292             :     NPY_BUSDAY_RAISE
-     293             : } NPY_BUSDAY_ROLL;
-     294             : 
-     295             : /************************************************************
-     296             :  * NumPy Auxiliary Data for inner loops, sort functions, etc.
-     297             :  ************************************************************/
-     298             : 
-     299             : /*
-     300             :  * When creating an auxiliary data struct, this should always appear
-     301             :  * as the first member, like this:
-     302             :  *
-     303             :  * typedef struct {
-     304             :  *     NpyAuxData base;
-     305             :  *     double constant;
-     306             :  * } constant_multiplier_aux_data;
-     307             :  */
-     308             : typedef struct NpyAuxData_tag NpyAuxData;
-     309             : 
-     310             : /* Function pointers for freeing or cloning auxiliary data */
-     311             : typedef void (NpyAuxData_FreeFunc) (NpyAuxData *);
-     312             : typedef NpyAuxData *(NpyAuxData_CloneFunc) (NpyAuxData *);
-     313             : 
-     314             : struct NpyAuxData_tag {
-     315             :     NpyAuxData_FreeFunc *free;
-     316             :     NpyAuxData_CloneFunc *clone;
-     317             :     /* To allow for a bit of expansion without breaking the ABI */
-     318             :     void *reserved[2];
-     319             : };
-     320             : 
-     321             : /* Macros to use for freeing and cloning auxiliary data */
-     322             : #define NPY_AUXDATA_FREE(auxdata) \
-     323             :     do { \
-     324             :         if ((auxdata) != NULL) { \
-     325             :             (auxdata)->free(auxdata); \
-     326             :         } \
-     327             :     } while(0)
-     328             : #define NPY_AUXDATA_CLONE(auxdata) \
-     329             :     ((auxdata)->clone(auxdata))
-     330             : 
-     331             : #define NPY_ERR(str) fprintf(stderr, #str); fflush(stderr);
-     332             : #define NPY_ERR2(str) fprintf(stderr, str); fflush(stderr);
-     333             : 
-     334             : /*
-     335             : * Macros to define how array, and dimension/strides data is
-     336             : * allocated. These should be made private
-     337             : */
-     338             : 
-     339             : #define NPY_USE_PYMEM 1
-     340             : 
-     341             : 
-     342             : #if NPY_USE_PYMEM == 1
-     343             : /* use the Raw versions which are safe to call with the GIL released */
-     344             : #define PyArray_malloc PyMem_RawMalloc
-     345             : #define PyArray_free PyMem_RawFree
-     346             : #define PyArray_realloc PyMem_RawRealloc
-     347             : #else
-     348             : #define PyArray_malloc malloc
-     349             : #define PyArray_free free
-     350             : #define PyArray_realloc realloc
-     351             : #endif
-     352             : 
-     353             : /* Dimensions and strides */
-     354             : #define PyDimMem_NEW(size)                                         \
-     355             :     ((npy_intp *)PyArray_malloc(size*sizeof(npy_intp)))
-     356             : 
-     357             : #define PyDimMem_FREE(ptr) PyArray_free(ptr)
-     358             : 
-     359             : #define PyDimMem_RENEW(ptr,size)                                   \
-     360             :         ((npy_intp *)PyArray_realloc(ptr,size*sizeof(npy_intp)))
-     361             : 
-     362             : /* forward declaration */
-     363             : struct _PyArray_Descr;
-     364             : 
-     365             : /* These must deal with unaligned and swapped data if necessary */
-     366             : typedef PyObject * (PyArray_GetItemFunc) (void *, void *);
-     367             : typedef int (PyArray_SetItemFunc)(PyObject *, void *, void *);
-     368             : 
-     369             : typedef void (PyArray_CopySwapNFunc)(void *, npy_intp, void *, npy_intp,
-     370             :                                      npy_intp, int, void *);
-     371             : 
-     372             : typedef void (PyArray_CopySwapFunc)(void *, void *, int, void *);
-     373             : typedef npy_bool (PyArray_NonzeroFunc)(void *, void *);
-     374             : 
-     375             : 
-     376             : /*
-     377             :  * These assume aligned and notswapped data -- a buffer will be used
-     378             :  * before or contiguous data will be obtained
-     379             :  */
-     380             : 
-     381             : typedef int (PyArray_CompareFunc)(const void *, const void *, void *);
-     382             : typedef int (PyArray_ArgFunc)(void*, npy_intp, npy_intp*, void *);
-     383             : 
-     384             : typedef void (PyArray_DotFunc)(void *, npy_intp, void *, npy_intp, void *,
-     385             :                                npy_intp, void *);
-     386             : 
-     387             : typedef void (PyArray_VectorUnaryFunc)(void *, void *, npy_intp, void *,
-     388             :                                        void *);
-     389             : 
-     390             : /*
-     391             :  * XXX the ignore argument should be removed next time the API version
-     392             :  * is bumped. It used to be the separator.
-     393             :  */
-     394             : typedef int (PyArray_ScanFunc)(FILE *fp, void *dptr,
-     395             :                                char *ignore, struct _PyArray_Descr *);
-     396             : typedef int (PyArray_FromStrFunc)(char *s, void *dptr, char **endptr,
-     397             :                                   struct _PyArray_Descr *);
-     398             : 
-     399             : typedef int (PyArray_FillFunc)(void *, npy_intp, void *);
-     400             : 
-     401             : typedef int (PyArray_SortFunc)(void *, npy_intp, void *);
-     402             : typedef int (PyArray_ArgSortFunc)(void *, npy_intp *, npy_intp, void *);
-     403             : typedef int (PyArray_PartitionFunc)(void *, npy_intp, npy_intp,
-     404             :                                     npy_intp *, npy_intp *,
-     405             :                                     void *);
-     406             : typedef int (PyArray_ArgPartitionFunc)(void *, npy_intp *, npy_intp, npy_intp,
-     407             :                                        npy_intp *, npy_intp *,
-     408             :                                        void *);
-     409             : 
-     410             : typedef int (PyArray_FillWithScalarFunc)(void *, npy_intp, void *, void *);
-     411             : 
-     412             : typedef int (PyArray_ScalarKindFunc)(void *);
-     413             : 
-     414             : typedef void (PyArray_FastClipFunc)(void *in, npy_intp n_in, void *min,
-     415             :                                     void *max, void *out);
-     416             : typedef void (PyArray_FastPutmaskFunc)(void *in, void *mask, npy_intp n_in,
-     417             :                                        void *values, npy_intp nv);
-     418             : typedef int  (PyArray_FastTakeFunc)(void *dest, void *src, npy_intp *indarray,
-     419             :                                        npy_intp nindarray, npy_intp n_outer,
-     420             :                                        npy_intp m_middle, npy_intp nelem,
-     421             :                                        NPY_CLIPMODE clipmode);
-     422             : 
-     423             : typedef struct {
-     424             :         npy_intp *ptr;
-     425             :         int len;
-     426             : } PyArray_Dims;
-     427             : 
-     428             : typedef struct {
-     429             :         /*
-     430             :          * Functions to cast to most other standard types
-     431             :          * Can have some NULL entries. The types
-     432             :          * DATETIME, TIMEDELTA, and HALF go into the castdict
-     433             :          * even though they are built-in.
-     434             :          */
-     435             :         PyArray_VectorUnaryFunc *cast[NPY_NTYPES_ABI_COMPATIBLE];
-     436             : 
-     437             :         /* The next four functions *cannot* be NULL */
-     438             : 
-     439             :         /*
-     440             :          * Functions to get and set items with standard Python types
-     441             :          * -- not array scalars
-     442             :          */
-     443             :         PyArray_GetItemFunc *getitem;
-     444             :         PyArray_SetItemFunc *setitem;
-     445             : 
-     446             :         /*
-     447             :          * Copy and/or swap data.  Memory areas may not overlap
-     448             :          * Use memmove first if they might
-     449             :          */
-     450             :         PyArray_CopySwapNFunc *copyswapn;
-     451             :         PyArray_CopySwapFunc *copyswap;
-     452             : 
-     453             :         /*
-     454             :          * Function to compare items
-     455             :          * Can be NULL
-     456             :          */
-     457             :         PyArray_CompareFunc *compare;
-     458             : 
-     459             :         /*
-     460             :          * Function to select largest
-     461             :          * Can be NULL
-     462             :          */
-     463             :         PyArray_ArgFunc *argmax;
-     464             : 
-     465             :         /*
-     466             :          * Function to compute dot product
-     467             :          * Can be NULL
-     468             :          */
-     469             :         PyArray_DotFunc *dotfunc;
-     470             : 
-     471             :         /*
-     472             :          * Function to scan an ASCII file and
-     473             :          * place a single value plus possible separator
-     474             :          * Can be NULL
-     475             :          */
-     476             :         PyArray_ScanFunc *scanfunc;
-     477             : 
-     478             :         /*
-     479             :          * Function to read a single value from a string
-     480             :          * and adjust the pointer; Can be NULL
-     481             :          */
-     482             :         PyArray_FromStrFunc *fromstr;
-     483             : 
-     484             :         /*
-     485             :          * Function to determine if data is zero or not
-     486             :          * If NULL a default version is
-     487             :          * used at Registration time.
-     488             :          */
-     489             :         PyArray_NonzeroFunc *nonzero;
-     490             : 
-     491             :         /*
-     492             :          * Used for arange. Should return 0 on success
-     493             :          * and -1 on failure.
-     494             :          * Can be NULL.
-     495             :          */
-     496             :         PyArray_FillFunc *fill;
-     497             : 
-     498             :         /*
-     499             :          * Function to fill arrays with scalar values
-     500             :          * Can be NULL
-     501             :          */
-     502             :         PyArray_FillWithScalarFunc *fillwithscalar;
-     503             : 
-     504             :         /*
-     505             :          * Sorting functions
-     506             :          * Can be NULL
-     507             :          */
-     508             :         PyArray_SortFunc *sort[NPY_NSORTS];
-     509             :         PyArray_ArgSortFunc *argsort[NPY_NSORTS];
-     510             : 
-     511             :         /*
-     512             :          * Dictionary of additional casting functions
-     513             :          * PyArray_VectorUnaryFuncs
-     514             :          * which can be populated to support casting
-     515             :          * to other registered types. Can be NULL
-     516             :          */
-     517             :         PyObject *castdict;
-     518             : 
-     519             :         /*
-     520             :          * Functions useful for generalizing
-     521             :          * the casting rules.
-     522             :          * Can be NULL;
-     523             :          */
-     524             :         PyArray_ScalarKindFunc *scalarkind;
-     525             :         int **cancastscalarkindto;
-     526             :         int *cancastto;
-     527             : 
-     528             :         PyArray_FastClipFunc *fastclip;
-     529             :         PyArray_FastPutmaskFunc *fastputmask;
-     530             :         PyArray_FastTakeFunc *fasttake;
-     531             : 
-     532             :         /*
-     533             :          * Function to select smallest
-     534             :          * Can be NULL
-     535             :          */
-     536             :         PyArray_ArgFunc *argmin;
-     537             : 
-     538             : } PyArray_ArrFuncs;
-     539             : 
-     540             : /* The item must be reference counted when it is inserted or extracted. */
-     541             : #define NPY_ITEM_REFCOUNT   0x01
-     542             : /* Same as needing REFCOUNT */
-     543             : #define NPY_ITEM_HASOBJECT  0x01
-     544             : /* Convert to list for pickling */
-     545             : #define NPY_LIST_PICKLE     0x02
-     546             : /* The item is a POINTER  */
-     547             : #define NPY_ITEM_IS_POINTER 0x04
-     548             : /* memory needs to be initialized for this data-type */
-     549             : #define NPY_NEEDS_INIT      0x08
-     550             : /* operations need Python C-API so don't give-up thread. */
-     551             : #define NPY_NEEDS_PYAPI     0x10
-     552             : /* Use f.getitem when extracting elements of this data-type */
-     553             : #define NPY_USE_GETITEM     0x20
-     554             : /* Use f.setitem when setting creating 0-d array from this data-type.*/
-     555             : #define NPY_USE_SETITEM     0x40
-     556             : /* A sticky flag specifically for structured arrays */
-     557             : #define NPY_ALIGNED_STRUCT  0x80
-     558             : 
-     559             : /*
-     560             :  *These are inherited for global data-type if any data-types in the
-     561             :  * field have them
-     562             :  */
-     563             : #define NPY_FROM_FIELDS    (NPY_NEEDS_INIT | NPY_LIST_PICKLE | \
-     564             :                             NPY_ITEM_REFCOUNT | NPY_NEEDS_PYAPI)
-     565             : 
-     566             : #define NPY_OBJECT_DTYPE_FLAGS (NPY_LIST_PICKLE | NPY_USE_GETITEM | \
-     567             :                                 NPY_ITEM_IS_POINTER | NPY_ITEM_REFCOUNT | \
-     568             :                                 NPY_NEEDS_INIT | NPY_NEEDS_PYAPI)
-     569             : 
-     570             : #define PyDataType_FLAGCHK(dtype, flag) \
-     571             :         (((dtype)->flags & (flag)) == (flag))
-     572             : 
-     573             : #define PyDataType_REFCHK(dtype) \
-     574             :         PyDataType_FLAGCHK(dtype, NPY_ITEM_REFCOUNT)
-     575             : 
-     576             : typedef struct _PyArray_Descr {
-     577             :         PyObject_HEAD
-     578             :         /*
-     579             :          * the type object representing an
-     580             :          * instance of this type -- should not
-     581             :          * be two type_numbers with the same type
-     582             :          * object.
-     583             :          */
-     584             :         PyTypeObject *typeobj;
-     585             :         /* kind for this type */
-     586             :         char kind;
-     587             :         /* unique-character representing this type */
-     588             :         char type;
-     589             :         /*
-     590             :          * '>' (big), '<' (little), '|'
-     591             :          * (not-applicable), or '=' (native).
-     592             :          */
-     593             :         char byteorder;
-     594             :         /* flags describing data type */
-     595             :         char flags;
-     596             :         /* number representing this type */
-     597             :         int type_num;
-     598             :         /* element size (itemsize) for this type */
-     599             :         int elsize;
-     600             :         /* alignment needed for this type */
-     601             :         int alignment;
-     602             :         /*
-     603             :          * Non-NULL if this type is
-     604             :          * is an array (C-contiguous)
-     605             :          * of some other type
-     606             :          */
-     607             :         struct _arr_descr *subarray;
-     608             :         /*
-     609             :          * The fields dictionary for this type
-     610             :          * For statically defined descr this
-     611             :          * is always Py_None
-     612             :          */
-     613             :         PyObject *fields;
-     614             :         /*
-     615             :          * An ordered tuple of field names or NULL
-     616             :          * if no fields are defined
-     617             :          */
-     618             :         PyObject *names;
-     619             :         /*
-     620             :          * a table of functions specific for each
-     621             :          * basic data descriptor
-     622             :          */
-     623             :         PyArray_ArrFuncs *f;
-     624             :         /* Metadata about this dtype */
-     625             :         PyObject *metadata;
-     626             :         /*
-     627             :          * Metadata specific to the C implementation
-     628             :          * of the particular dtype. This was added
-     629             :          * for NumPy 1.7.0.
-     630             :          */
-     631             :         NpyAuxData *c_metadata;
-     632             :         /* Cached hash value (-1 if not yet computed).
-     633             :          * This was added for NumPy 2.0.0.
-     634             :          */
-     635             :         npy_hash_t hash;
-     636             : } PyArray_Descr;
-     637             : 
-     638             : typedef struct _arr_descr {
-     639             :         PyArray_Descr *base;
-     640             :         PyObject *shape;       /* a tuple */
-     641             : } PyArray_ArrayDescr;
-     642             : 
-     643             : /*
-     644             :  * Memory handler structure for array data.
-     645             :  */
-     646             : /* The declaration of free differs from PyMemAllocatorEx */
-     647             : typedef struct {
-     648             :     void *ctx;
-     649             :     void* (*malloc) (void *ctx, size_t size);
-     650             :     void* (*calloc) (void *ctx, size_t nelem, size_t elsize);
-     651             :     void* (*realloc) (void *ctx, void *ptr, size_t new_size);
-     652             :     void (*free) (void *ctx, void *ptr, size_t size);
-     653             :     /*
-     654             :      * This is the end of the version=1 struct. Only add new fields after
-     655             :      * this line
-     656             :      */
-     657             : } PyDataMemAllocator;
-     658             : 
-     659             : typedef struct {
-     660             :     char name[127];  /* multiple of 64 to keep the struct aligned */
-     661             :     uint8_t version; /* currently 1 */
-     662             :     PyDataMemAllocator allocator;
-     663             : } PyDataMem_Handler;
-     664             : 
-     665             : 
-     666             : /*
-     667             :  * The main array object structure.
-     668             :  *
-     669             :  * It has been recommended to use the inline functions defined below
-     670             :  * (PyArray_DATA and friends) to access fields here for a number of
-     671             :  * releases. Direct access to the members themselves is deprecated.
-     672             :  * To ensure that your code does not use deprecated access,
-     673             :  * #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
-     674             :  * (or NPY_1_8_API_VERSION or higher as required).
-     675             :  */
-     676             : /* This struct will be moved to a private header in a future release */
-     677             : typedef struct tagPyArrayObject_fields {
-     678             :     PyObject_HEAD
-     679             :     /* Pointer to the raw data buffer */
-     680             :     char *data;
-     681             :     /* The number of dimensions, also called 'ndim' */
-     682             :     int nd;
-     683             :     /* The size in each dimension, also called 'shape' */
-     684             :     npy_intp *dimensions;
-     685             :     /*
-     686             :      * Number of bytes to jump to get to the
-     687             :      * next element in each dimension
-     688             :      */
-     689             :     npy_intp *strides;
-     690             :     /*
-     691             :      * This object is decref'd upon
-     692             :      * deletion of array. Except in the
-     693             :      * case of WRITEBACKIFCOPY which has
-     694             :      * special handling.
-     695             :      *
-     696             :      * For views it points to the original
-     697             :      * array, collapsed so no chains of
-     698             :      * views occur.
-     699             :      *
-     700             :      * For creation from buffer object it
-     701             :      * points to an object that should be
-     702             :      * decref'd on deletion
-     703             :      *
-     704             :      * For WRITEBACKIFCOPY flag this is an
-     705             :      * array to-be-updated upon calling
-     706             :      * PyArray_ResolveWritebackIfCopy
-     707             :      */
-     708             :     PyObject *base;
-     709             :     /* Pointer to type structure */
-     710             :     PyArray_Descr *descr;
-     711             :     /* Flags describing array -- see below */
-     712             :     int flags;
-     713             :     /* For weak references */
-     714             :     PyObject *weakreflist;
-     715             : #if NPY_FEATURE_VERSION >= NPY_1_20_API_VERSION
-     716             :     void *_buffer_info;  /* private buffer info, tagged to allow warning */
-     717             : #endif
-     718             :     /*
-     719             :      * For malloc/calloc/realloc/free per object
-     720             :      */
-     721             : #if NPY_FEATURE_VERSION >= NPY_1_22_API_VERSION
-     722             :     PyObject *mem_handler;
-     723             : #endif
-     724             : } PyArrayObject_fields;
-     725             : 
-     726             : /*
-     727             :  * To hide the implementation details, we only expose
-     728             :  * the Python struct HEAD.
-     729             :  */
-     730             : #if !defined(NPY_NO_DEPRECATED_API) || \
-     731             :     (NPY_NO_DEPRECATED_API < NPY_1_7_API_VERSION)
-     732             : /*
-     733             :  * Can't put this in npy_deprecated_api.h like the others.
-     734             :  * PyArrayObject field access is deprecated as of NumPy 1.7.
-     735             :  */
-     736             : typedef PyArrayObject_fields PyArrayObject;
-     737             : #else
-     738             : typedef struct tagPyArrayObject {
-     739             :         PyObject_HEAD
-     740             : } PyArrayObject;
-     741             : #endif
-     742             : 
-     743             : /*
-     744             :  * Removed 2020-Nov-25, NumPy 1.20
-     745             :  * #define NPY_SIZEOF_PYARRAYOBJECT (sizeof(PyArrayObject_fields))
-     746             :  *
-     747             :  * The above macro was removed as it gave a false sense of a stable ABI
-     748             :  * with respect to the structures size.  If you require a runtime constant,
-     749             :  * you can use `PyArray_Type.tp_basicsize` instead.  Otherwise, please
-     750             :  * see the PyArrayObject documentation or ask the NumPy developers for
-     751             :  * information on how to correctly replace the macro in a way that is
-     752             :  * compatible with multiple NumPy versions.
-     753             :  */
-     754             : 
-     755             : 
-     756             : /* Array Flags Object */
-     757             : typedef struct PyArrayFlagsObject {
-     758             :         PyObject_HEAD
-     759             :         PyObject *arr;
-     760             :         int flags;
-     761             : } PyArrayFlagsObject;
-     762             : 
-     763             : /* Mirrors buffer object to ptr */
-     764             : 
-     765             : typedef struct {
-     766             :         PyObject_HEAD
-     767             :         PyObject *base;
-     768             :         void *ptr;
-     769             :         npy_intp len;
-     770             :         int flags;
-     771             : } PyArray_Chunk;
-     772             : 
-     773             : typedef struct {
-     774             :     NPY_DATETIMEUNIT base;
-     775             :     int num;
-     776             : } PyArray_DatetimeMetaData;
-     777             : 
-     778             : typedef struct {
-     779             :     NpyAuxData base;
-     780             :     PyArray_DatetimeMetaData meta;
-     781             : } PyArray_DatetimeDTypeMetaData;
-     782             : 
-     783             : /*
-     784             :  * This structure contains an exploded view of a date-time value.
-     785             :  * NaT is represented by year == NPY_DATETIME_NAT.
-     786             :  */
-     787             : typedef struct {
-     788             :         npy_int64 year;
-     789             :         npy_int32 month, day, hour, min, sec, us, ps, as;
-     790             : } npy_datetimestruct;
-     791             : 
-     792             : /* This is not used internally. */
-     793             : typedef struct {
-     794             :         npy_int64 day;
-     795             :         npy_int32 sec, us, ps, as;
-     796             : } npy_timedeltastruct;
-     797             : 
-     798             : typedef int (PyArray_FinalizeFunc)(PyArrayObject *, PyObject *);
-     799             : 
-     800             : /*
-     801             :  * Means c-style contiguous (last index varies the fastest). The data
-     802             :  * elements right after each other.
-     803             :  *
-     804             :  * This flag may be requested in constructor functions.
-     805             :  * This flag may be tested for in PyArray_FLAGS(arr).
-     806             :  */
-     807             : #define NPY_ARRAY_C_CONTIGUOUS    0x0001
-     808             : 
-     809             : /*
-     810             :  * Set if array is a contiguous Fortran array: the first index varies
-     811             :  * the fastest in memory (strides array is reverse of C-contiguous
-     812             :  * array)
-     813             :  *
-     814             :  * This flag may be requested in constructor functions.
-     815             :  * This flag may be tested for in PyArray_FLAGS(arr).
-     816             :  */
-     817             : #define NPY_ARRAY_F_CONTIGUOUS    0x0002
-     818             : 
-     819             : /*
-     820             :  * Note: all 0-d arrays are C_CONTIGUOUS and F_CONTIGUOUS. If a
-     821             :  * 1-d array is C_CONTIGUOUS it is also F_CONTIGUOUS. Arrays with
-     822             :  * more then one dimension can be C_CONTIGUOUS and F_CONTIGUOUS
-     823             :  * at the same time if they have either zero or one element.
-     824             :  * A higher dimensional array always has the same contiguity flags as
-     825             :  * `array.squeeze()`; dimensions with `array.shape[dimension] == 1` are
-     826             :  * effectively ignored when checking for contiguity.
-     827             :  */
-     828             : 
-     829             : /*
-     830             :  * If set, the array owns the data: it will be free'd when the array
-     831             :  * is deleted.
-     832             :  *
-     833             :  * This flag may be tested for in PyArray_FLAGS(arr).
-     834             :  */
-     835             : #define NPY_ARRAY_OWNDATA         0x0004
-     836             : 
-     837             : /*
-     838             :  * An array never has the next four set; they're only used as parameter
-     839             :  * flags to the various FromAny functions
-     840             :  *
-     841             :  * This flag may be requested in constructor functions.
-     842             :  */
-     843             : 
-     844             : /* Cause a cast to occur regardless of whether or not it is safe. */
-     845             : #define NPY_ARRAY_FORCECAST       0x0010
-     846             : 
-     847             : /*
-     848             :  * Always copy the array. Returned arrays are always CONTIGUOUS,
-     849             :  * ALIGNED, and WRITEABLE. See also: NPY_ARRAY_ENSURENOCOPY = 0x4000.
-     850             :  *
-     851             :  * This flag may be requested in constructor functions.
-     852             :  */
-     853             : #define NPY_ARRAY_ENSURECOPY      0x0020
-     854             : 
-     855             : /*
-     856             :  * Make sure the returned array is a base-class ndarray
-     857             :  *
-     858             :  * This flag may be requested in constructor functions.
-     859             :  */
-     860             : #define NPY_ARRAY_ENSUREARRAY     0x0040
-     861             : 
-     862             : /*
-     863             :  * Make sure that the strides are in units of the element size Needed
-     864             :  * for some operations with record-arrays.
-     865             :  *
-     866             :  * This flag may be requested in constructor functions.
-     867             :  */
-     868             : #define NPY_ARRAY_ELEMENTSTRIDES  0x0080
-     869             : 
-     870             : /*
-     871             :  * Array data is aligned on the appropriate memory address for the type
-     872             :  * stored according to how the compiler would align things (e.g., an
-     873             :  * array of integers (4 bytes each) starts on a memory address that's
-     874             :  * a multiple of 4)
-     875             :  *
-     876             :  * This flag may be requested in constructor functions.
-     877             :  * This flag may be tested for in PyArray_FLAGS(arr).
-     878             :  */
-     879             : #define NPY_ARRAY_ALIGNED         0x0100
-     880             : 
-     881             : /*
-     882             :  * Array data has the native endianness
-     883             :  *
-     884             :  * This flag may be requested in constructor functions.
-     885             :  */
-     886             : #define NPY_ARRAY_NOTSWAPPED      0x0200
-     887             : 
-     888             : /*
-     889             :  * Array data is writeable
-     890             :  *
-     891             :  * This flag may be requested in constructor functions.
-     892             :  * This flag may be tested for in PyArray_FLAGS(arr).
-     893             :  */
-     894             : #define NPY_ARRAY_WRITEABLE       0x0400
-     895             : 
-     896             : /*
-     897             :  * If this flag is set, then base contains a pointer to an array of
-     898             :  * the same size that should be updated with the current contents of
-     899             :  * this array when PyArray_ResolveWritebackIfCopy is called.
-     900             :  *
-     901             :  * This flag may be requested in constructor functions.
-     902             :  * This flag may be tested for in PyArray_FLAGS(arr).
-     903             :  */
-     904             : #define NPY_ARRAY_WRITEBACKIFCOPY 0x2000
-     905             : 
-     906             : /*
-     907             :  * No copy may be made while converting from an object/array (result is a view)
-     908             :  *
-     909             :  * This flag may be requested in constructor functions.
-     910             :  */
-     911             : #define NPY_ARRAY_ENSURENOCOPY 0x4000
-     912             : 
-     913             : /*
-     914             :  * NOTE: there are also internal flags defined in multiarray/arrayobject.h,
-     915             :  * which start at bit 31 and work down.
-     916             :  */
-     917             : 
-     918             : #define NPY_ARRAY_BEHAVED      (NPY_ARRAY_ALIGNED | \
-     919             :                                 NPY_ARRAY_WRITEABLE)
-     920             : #define NPY_ARRAY_BEHAVED_NS   (NPY_ARRAY_ALIGNED | \
-     921             :                                 NPY_ARRAY_WRITEABLE | \
-     922             :                                 NPY_ARRAY_NOTSWAPPED)
-     923             : #define NPY_ARRAY_CARRAY       (NPY_ARRAY_C_CONTIGUOUS | \
-     924             :                                 NPY_ARRAY_BEHAVED)
-     925             : #define NPY_ARRAY_CARRAY_RO    (NPY_ARRAY_C_CONTIGUOUS | \
-     926             :                                 NPY_ARRAY_ALIGNED)
-     927             : #define NPY_ARRAY_FARRAY       (NPY_ARRAY_F_CONTIGUOUS | \
-     928             :                                 NPY_ARRAY_BEHAVED)
-     929             : #define NPY_ARRAY_FARRAY_RO    (NPY_ARRAY_F_CONTIGUOUS | \
-     930             :                                 NPY_ARRAY_ALIGNED)
-     931             : #define NPY_ARRAY_DEFAULT      (NPY_ARRAY_CARRAY)
-     932             : #define NPY_ARRAY_IN_ARRAY     (NPY_ARRAY_CARRAY_RO)
-     933             : #define NPY_ARRAY_OUT_ARRAY    (NPY_ARRAY_CARRAY)
-     934             : #define NPY_ARRAY_INOUT_ARRAY  (NPY_ARRAY_CARRAY)
-     935             : #define NPY_ARRAY_INOUT_ARRAY2 (NPY_ARRAY_CARRAY | \
-     936             :                                 NPY_ARRAY_WRITEBACKIFCOPY)
-     937             : #define NPY_ARRAY_IN_FARRAY    (NPY_ARRAY_FARRAY_RO)
-     938             : #define NPY_ARRAY_OUT_FARRAY   (NPY_ARRAY_FARRAY)
-     939             : #define NPY_ARRAY_INOUT_FARRAY (NPY_ARRAY_FARRAY)
-     940             : #define NPY_ARRAY_INOUT_FARRAY2 (NPY_ARRAY_FARRAY | \
-     941             :                                 NPY_ARRAY_WRITEBACKIFCOPY)
-     942             : 
-     943             : #define NPY_ARRAY_UPDATE_ALL   (NPY_ARRAY_C_CONTIGUOUS | \
-     944             :                                 NPY_ARRAY_F_CONTIGUOUS | \
-     945             :                                 NPY_ARRAY_ALIGNED)
-     946             : 
-     947             : /* This flag is for the array interface, not PyArrayObject */
-     948             : #define NPY_ARR_HAS_DESCR  0x0800
-     949             : 
-     950             : 
-     951             : 
-     952             : 
-     953             : /*
-     954             :  * Size of internal buffers used for alignment Make BUFSIZE a multiple
-     955             :  * of sizeof(npy_cdouble) -- usually 16 so that ufunc buffers are aligned
-     956             :  */
-     957             : #define NPY_MIN_BUFSIZE ((int)sizeof(npy_cdouble))
-     958             : #define NPY_MAX_BUFSIZE (((int)sizeof(npy_cdouble))*1000000)
-     959             : #define NPY_BUFSIZE 8192
-     960             : /* buffer stress test size: */
-     961             : /*#define NPY_BUFSIZE 17*/
-     962             : 
-     963             : #define PyArray_MAX(a,b) (((a)>(b))?(a):(b))
-     964             : #define PyArray_MIN(a,b) (((a)<(b))?(a):(b))
-     965             : #define PyArray_CLT(p,q) ((((p).real==(q).real) ? ((p).imag < (q).imag) : \
-     966             :                                ((p).real < (q).real)))
-     967             : #define PyArray_CGT(p,q) ((((p).real==(q).real) ? ((p).imag > (q).imag) : \
-     968             :                                ((p).real > (q).real)))
-     969             : #define PyArray_CLE(p,q) ((((p).real==(q).real) ? ((p).imag <= (q).imag) : \
-     970             :                                ((p).real <= (q).real)))
-     971             : #define PyArray_CGE(p,q) ((((p).real==(q).real) ? ((p).imag >= (q).imag) : \
-     972             :                                ((p).real >= (q).real)))
-     973             : #define PyArray_CEQ(p,q) (((p).real==(q).real) && ((p).imag == (q).imag))
-     974             : #define PyArray_CNE(p,q) (((p).real!=(q).real) || ((p).imag != (q).imag))
-     975             : 
-     976             : /*
-     977             :  * C API: consists of Macros and functions.  The MACROS are defined
-     978             :  * here.
-     979             :  */
-     980             : 
-     981             : 
-     982             : #define PyArray_ISCONTIGUOUS(m) PyArray_CHKFLAGS((m), NPY_ARRAY_C_CONTIGUOUS)
-     983             : #define PyArray_ISWRITEABLE(m) PyArray_CHKFLAGS((m), NPY_ARRAY_WRITEABLE)
-     984             : #define PyArray_ISALIGNED(m) PyArray_CHKFLAGS((m), NPY_ARRAY_ALIGNED)
-     985             : 
-     986             : #define PyArray_IS_C_CONTIGUOUS(m) PyArray_CHKFLAGS((m), NPY_ARRAY_C_CONTIGUOUS)
-     987             : #define PyArray_IS_F_CONTIGUOUS(m) PyArray_CHKFLAGS((m), NPY_ARRAY_F_CONTIGUOUS)
-     988             : 
-     989             : /* the variable is used in some places, so always define it */
-     990             : #define NPY_BEGIN_THREADS_DEF PyThreadState *_save=NULL;
-     991             : #if NPY_ALLOW_THREADS
-     992             : #define NPY_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
-     993             : #define NPY_END_ALLOW_THREADS Py_END_ALLOW_THREADS
-     994             : #define NPY_BEGIN_THREADS do {_save = PyEval_SaveThread();} while (0);
-     995             : #define NPY_END_THREADS   do { if (_save) \
-     996             :                 { PyEval_RestoreThread(_save); _save = NULL;} } while (0);
-     997             : #define NPY_BEGIN_THREADS_THRESHOLDED(loop_size) do { if ((loop_size) > 500) \
-     998             :                 { _save = PyEval_SaveThread();} } while (0);
-     999             : 
-    1000             : #define NPY_BEGIN_THREADS_DESCR(dtype) \
-    1001             :         do {if (!(PyDataType_FLAGCHK((dtype), NPY_NEEDS_PYAPI))) \
-    1002             :                 NPY_BEGIN_THREADS;} while (0);
-    1003             : 
-    1004             : #define NPY_END_THREADS_DESCR(dtype) \
-    1005             :         do {if (!(PyDataType_FLAGCHK((dtype), NPY_NEEDS_PYAPI))) \
-    1006             :                 NPY_END_THREADS; } while (0);
-    1007             : 
-    1008             : #define NPY_ALLOW_C_API_DEF  PyGILState_STATE __save__;
-    1009             : #define NPY_ALLOW_C_API      do {__save__ = PyGILState_Ensure();} while (0);
-    1010             : #define NPY_DISABLE_C_API    do {PyGILState_Release(__save__);} while (0);
-    1011             : #else
-    1012             : #define NPY_BEGIN_ALLOW_THREADS
-    1013             : #define NPY_END_ALLOW_THREADS
-    1014             : #define NPY_BEGIN_THREADS
-    1015             : #define NPY_END_THREADS
-    1016             : #define NPY_BEGIN_THREADS_THRESHOLDED(loop_size)
-    1017             : #define NPY_BEGIN_THREADS_DESCR(dtype)
-    1018             : #define NPY_END_THREADS_DESCR(dtype)
-    1019             : #define NPY_ALLOW_C_API_DEF
-    1020             : #define NPY_ALLOW_C_API
-    1021             : #define NPY_DISABLE_C_API
-    1022             : #endif
-    1023             : 
-    1024             : /**********************************
-    1025             :  * The nditer object, added in 1.6
-    1026             :  **********************************/
-    1027             : 
-    1028             : /* The actual structure of the iterator is an internal detail */
-    1029             : typedef struct NpyIter_InternalOnly NpyIter;
-    1030             : 
-    1031             : /* Iterator function pointers that may be specialized */
-    1032             : typedef int (NpyIter_IterNextFunc)(NpyIter *iter);
-    1033             : typedef void (NpyIter_GetMultiIndexFunc)(NpyIter *iter,
-    1034             :                                       npy_intp *outcoords);
-    1035             : 
-    1036             : /*** Global flags that may be passed to the iterator constructors ***/
-    1037             : 
-    1038             : /* Track an index representing C order */
-    1039             : #define NPY_ITER_C_INDEX                    0x00000001
-    1040             : /* Track an index representing Fortran order */
-    1041             : #define NPY_ITER_F_INDEX                    0x00000002
-    1042             : /* Track a multi-index */
-    1043             : #define NPY_ITER_MULTI_INDEX                0x00000004
-    1044             : /* User code external to the iterator does the 1-dimensional innermost loop */
-    1045             : #define NPY_ITER_EXTERNAL_LOOP              0x00000008
-    1046             : /* Convert all the operands to a common data type */
-    1047             : #define NPY_ITER_COMMON_DTYPE               0x00000010
-    1048             : /* Operands may hold references, requiring API access during iteration */
-    1049             : #define NPY_ITER_REFS_OK                    0x00000020
-    1050             : /* Zero-sized operands should be permitted, iteration checks IterSize for 0 */
-    1051             : #define NPY_ITER_ZEROSIZE_OK                0x00000040
-    1052             : /* Permits reductions (size-0 stride with dimension size > 1) */
-    1053             : #define NPY_ITER_REDUCE_OK                  0x00000080
-    1054             : /* Enables sub-range iteration */
-    1055             : #define NPY_ITER_RANGED                     0x00000100
-    1056             : /* Enables buffering */
-    1057             : #define NPY_ITER_BUFFERED                   0x00000200
-    1058             : /* When buffering is enabled, grows the inner loop if possible */
-    1059             : #define NPY_ITER_GROWINNER                  0x00000400
-    1060             : /* Delay allocation of buffers until first Reset* call */
-    1061             : #define NPY_ITER_DELAY_BUFALLOC             0x00000800
-    1062             : /* When NPY_KEEPORDER is specified, disable reversing negative-stride axes */
-    1063             : #define NPY_ITER_DONT_NEGATE_STRIDES        0x00001000
-    1064             : /*
-    1065             :  * If output operands overlap with other operands (based on heuristics that
-    1066             :  * has false positives but no false negatives), make temporary copies to
-    1067             :  * eliminate overlap.
-    1068             :  */
-    1069             : #define NPY_ITER_COPY_IF_OVERLAP            0x00002000
-    1070             : 
-    1071             : /*** Per-operand flags that may be passed to the iterator constructors ***/
-    1072             : 
-    1073             : /* The operand will be read from and written to */
-    1074             : #define NPY_ITER_READWRITE                  0x00010000
-    1075             : /* The operand will only be read from */
-    1076             : #define NPY_ITER_READONLY                   0x00020000
-    1077             : /* The operand will only be written to */
-    1078             : #define NPY_ITER_WRITEONLY                  0x00040000
-    1079             : /* The operand's data must be in native byte order */
-    1080             : #define NPY_ITER_NBO                        0x00080000
-    1081             : /* The operand's data must be aligned */
-    1082             : #define NPY_ITER_ALIGNED                    0x00100000
-    1083             : /* The operand's data must be contiguous (within the inner loop) */
-    1084             : #define NPY_ITER_CONTIG                     0x00200000
-    1085             : /* The operand may be copied to satisfy requirements */
-    1086             : #define NPY_ITER_COPY                       0x00400000
-    1087             : /* The operand may be copied with WRITEBACKIFCOPY to satisfy requirements */
-    1088             : #define NPY_ITER_UPDATEIFCOPY               0x00800000
-    1089             : /* Allocate the operand if it is NULL */
-    1090             : #define NPY_ITER_ALLOCATE                   0x01000000
-    1091             : /* If an operand is allocated, don't use any subtype */
-    1092             : #define NPY_ITER_NO_SUBTYPE                 0x02000000
-    1093             : /* This is a virtual array slot, operand is NULL but temporary data is there */
-    1094             : #define NPY_ITER_VIRTUAL                    0x04000000
-    1095             : /* Require that the dimension match the iterator dimensions exactly */
-    1096             : #define NPY_ITER_NO_BROADCAST               0x08000000
-    1097             : /* A mask is being used on this array, affects buffer -> array copy */
-    1098             : #define NPY_ITER_WRITEMASKED                0x10000000
-    1099             : /* This array is the mask for all WRITEMASKED operands */
-    1100             : #define NPY_ITER_ARRAYMASK                  0x20000000
-    1101             : /* Assume iterator order data access for COPY_IF_OVERLAP */
-    1102             : #define NPY_ITER_OVERLAP_ASSUME_ELEMENTWISE 0x40000000
-    1103             : 
-    1104             : #define NPY_ITER_GLOBAL_FLAGS               0x0000ffff
-    1105             : #define NPY_ITER_PER_OP_FLAGS               0xffff0000
-    1106             : 
-    1107             : 
-    1108             : /*****************************
-    1109             :  * Basic iterator object
-    1110             :  *****************************/
-    1111             : 
-    1112             : /* FWD declaration */
-    1113             : typedef struct PyArrayIterObject_tag PyArrayIterObject;
-    1114             : 
-    1115             : /*
-    1116             :  * type of the function which translates a set of coordinates to a
-    1117             :  * pointer to the data
-    1118             :  */
-    1119             : typedef char* (*npy_iter_get_dataptr_t)(
-    1120             :         PyArrayIterObject* iter, const npy_intp*);
-    1121             : 
-    1122             : struct PyArrayIterObject_tag {
-    1123             :         PyObject_HEAD
-    1124             :         int               nd_m1;            /* number of dimensions - 1 */
-    1125             :         npy_intp          index, size;
-    1126             :         npy_intp          coordinates[NPY_MAXDIMS];/* N-dimensional loop */
-    1127             :         npy_intp          dims_m1[NPY_MAXDIMS];    /* ao->dimensions - 1 */
-    1128             :         npy_intp          strides[NPY_MAXDIMS];    /* ao->strides or fake */
-    1129             :         npy_intp          backstrides[NPY_MAXDIMS];/* how far to jump back */
-    1130             :         npy_intp          factors[NPY_MAXDIMS];     /* shape factors */
-    1131             :         PyArrayObject     *ao;
-    1132             :         char              *dataptr;        /* pointer to current item*/
-    1133             :         npy_bool          contiguous;
-    1134             : 
-    1135             :         npy_intp          bounds[NPY_MAXDIMS][2];
-    1136             :         npy_intp          limits[NPY_MAXDIMS][2];
-    1137             :         npy_intp          limits_sizes[NPY_MAXDIMS];
-    1138             :         npy_iter_get_dataptr_t translate;
-    1139             : } ;
-    1140             : 
-    1141             : 
-    1142             : /* Iterator API */
-    1143             : #define PyArrayIter_Check(op) PyObject_TypeCheck((op), &PyArrayIter_Type)
-    1144             : 
-    1145             : #define _PyAIT(it) ((PyArrayIterObject *)(it))
-    1146             : #define PyArray_ITER_RESET(it) do { \
-    1147             :         _PyAIT(it)->index = 0; \
-    1148             :         _PyAIT(it)->dataptr = PyArray_BYTES(_PyAIT(it)->ao); \
-    1149             :         memset(_PyAIT(it)->coordinates, 0, \
-    1150             :                (_PyAIT(it)->nd_m1+1)*sizeof(npy_intp)); \
-    1151             : } while (0)
-    1152             : 
-    1153             : #define _PyArray_ITER_NEXT1(it) do { \
-    1154             :         (it)->dataptr += _PyAIT(it)->strides[0]; \
-    1155             :         (it)->coordinates[0]++; \
-    1156             : } while (0)
-    1157             : 
-    1158             : #define _PyArray_ITER_NEXT2(it) do { \
-    1159             :         if ((it)->coordinates[1] < (it)->dims_m1[1]) { \
-    1160             :                 (it)->coordinates[1]++; \
-    1161             :                 (it)->dataptr += (it)->strides[1]; \
-    1162             :         } \
-    1163             :         else { \
-    1164             :                 (it)->coordinates[1] = 0; \
-    1165             :                 (it)->coordinates[0]++; \
-    1166             :                 (it)->dataptr += (it)->strides[0] - \
-    1167             :                         (it)->backstrides[1]; \
-    1168             :         } \
-    1169             : } while (0)
-    1170             : 
-    1171             : #define PyArray_ITER_NEXT(it) do { \
-    1172             :         _PyAIT(it)->index++; \
-    1173             :         if (_PyAIT(it)->nd_m1 == 0) { \
-    1174             :                 _PyArray_ITER_NEXT1(_PyAIT(it)); \
-    1175             :         } \
-    1176             :         else if (_PyAIT(it)->contiguous) \
-    1177             :                 _PyAIT(it)->dataptr += PyArray_DESCR(_PyAIT(it)->ao)->elsize; \
-    1178             :         else if (_PyAIT(it)->nd_m1 == 1) { \
-    1179             :                 _PyArray_ITER_NEXT2(_PyAIT(it)); \
-    1180             :         } \
-    1181             :         else { \
-    1182             :                 int __npy_i; \
-    1183             :                 for (__npy_i=_PyAIT(it)->nd_m1; __npy_i >= 0; __npy_i--) { \
-    1184             :                         if (_PyAIT(it)->coordinates[__npy_i] < \
-    1185             :                             _PyAIT(it)->dims_m1[__npy_i]) { \
-    1186             :                                 _PyAIT(it)->coordinates[__npy_i]++; \
-    1187             :                                 _PyAIT(it)->dataptr += \
-    1188             :                                         _PyAIT(it)->strides[__npy_i]; \
-    1189             :                                 break; \
-    1190             :                         } \
-    1191             :                         else { \
-    1192             :                                 _PyAIT(it)->coordinates[__npy_i] = 0; \
-    1193             :                                 _PyAIT(it)->dataptr -= \
-    1194             :                                         _PyAIT(it)->backstrides[__npy_i]; \
-    1195             :                         } \
-    1196             :                 } \
-    1197             :         } \
-    1198             : } while (0)
-    1199             : 
-    1200             : #define PyArray_ITER_GOTO(it, destination) do { \
-    1201             :         int __npy_i; \
-    1202             :         _PyAIT(it)->index = 0; \
-    1203             :         _PyAIT(it)->dataptr = PyArray_BYTES(_PyAIT(it)->ao); \
-    1204             :         for (__npy_i = _PyAIT(it)->nd_m1; __npy_i>=0; __npy_i--) { \
-    1205             :                 if (destination[__npy_i] < 0) { \
-    1206             :                         destination[__npy_i] += \
-    1207             :                                 _PyAIT(it)->dims_m1[__npy_i]+1; \
-    1208             :                 } \
-    1209             :                 _PyAIT(it)->dataptr += destination[__npy_i] * \
-    1210             :                         _PyAIT(it)->strides[__npy_i]; \
-    1211             :                 _PyAIT(it)->coordinates[__npy_i] = \
-    1212             :                         destination[__npy_i]; \
-    1213             :                 _PyAIT(it)->index += destination[__npy_i] * \
-    1214             :                         ( __npy_i==_PyAIT(it)->nd_m1 ? 1 : \
-    1215             :                           _PyAIT(it)->dims_m1[__npy_i+1]+1) ; \
-    1216             :         } \
-    1217             : } while (0)
-    1218             : 
-    1219             : #define PyArray_ITER_GOTO1D(it, ind) do { \
-    1220             :         int __npy_i; \
-    1221             :         npy_intp __npy_ind = (npy_intp)(ind); \
-    1222             :         if (__npy_ind < 0) __npy_ind += _PyAIT(it)->size; \
-    1223             :         _PyAIT(it)->index = __npy_ind; \
-    1224             :         if (_PyAIT(it)->nd_m1 == 0) { \
-    1225             :                 _PyAIT(it)->dataptr = PyArray_BYTES(_PyAIT(it)->ao) + \
-    1226             :                         __npy_ind * _PyAIT(it)->strides[0]; \
-    1227             :         } \
-    1228             :         else if (_PyAIT(it)->contiguous) \
-    1229             :                 _PyAIT(it)->dataptr = PyArray_BYTES(_PyAIT(it)->ao) + \
-    1230             :                         __npy_ind * PyArray_DESCR(_PyAIT(it)->ao)->elsize; \
-    1231             :         else { \
-    1232             :                 _PyAIT(it)->dataptr = PyArray_BYTES(_PyAIT(it)->ao); \
-    1233             :                 for (__npy_i = 0; __npy_i<=_PyAIT(it)->nd_m1; \
-    1234             :                      __npy_i++) { \
-    1235             :                         _PyAIT(it)->coordinates[__npy_i] = \
-    1236             :                                 (__npy_ind / _PyAIT(it)->factors[__npy_i]); \
-    1237             :                         _PyAIT(it)->dataptr += \
-    1238             :                                 (__npy_ind / _PyAIT(it)->factors[__npy_i]) \
-    1239             :                                 * _PyAIT(it)->strides[__npy_i]; \
-    1240             :                         __npy_ind %= _PyAIT(it)->factors[__npy_i]; \
-    1241             :                 } \
-    1242             :         } \
-    1243             : } while (0)
-    1244             : 
-    1245             : #define PyArray_ITER_DATA(it) ((void *)(_PyAIT(it)->dataptr))
-    1246             : 
-    1247             : #define PyArray_ITER_NOTDONE(it) (_PyAIT(it)->index < _PyAIT(it)->size)
-    1248             : 
-    1249             : 
-    1250             : /*
-    1251             :  * Any object passed to PyArray_Broadcast must be binary compatible
-    1252             :  * with this structure.
-    1253             :  */
-    1254             : 
-    1255             : typedef struct {
-    1256             :         PyObject_HEAD
-    1257             :         int                  numiter;                 /* number of iters */
-    1258             :         npy_intp             size;                    /* broadcasted size */
-    1259             :         npy_intp             index;                   /* current index */
-    1260             :         int                  nd;                      /* number of dims */
-    1261             :         npy_intp             dimensions[NPY_MAXDIMS]; /* dimensions */
-    1262             :         PyArrayIterObject    *iters[NPY_MAXARGS];     /* iterators */
-    1263             : } PyArrayMultiIterObject;
-    1264             : 
-    1265             : #define _PyMIT(m) ((PyArrayMultiIterObject *)(m))
-    1266             : #define PyArray_MultiIter_RESET(multi) do {                                   \
-    1267             :         int __npy_mi;                                                         \
-    1268             :         _PyMIT(multi)->index = 0;                                             \
-    1269             :         for (__npy_mi=0; __npy_mi < _PyMIT(multi)->numiter;  __npy_mi++) {    \
-    1270             :                 PyArray_ITER_RESET(_PyMIT(multi)->iters[__npy_mi]);           \
-    1271             :         }                                                                     \
-    1272             : } while (0)
-    1273             : 
-    1274             : #define PyArray_MultiIter_NEXT(multi) do {                                    \
-    1275             :         int __npy_mi;                                                         \
-    1276             :         _PyMIT(multi)->index++;                                               \
-    1277             :         for (__npy_mi=0; __npy_mi < _PyMIT(multi)->numiter;   __npy_mi++) {   \
-    1278             :                 PyArray_ITER_NEXT(_PyMIT(multi)->iters[__npy_mi]);            \
-    1279             :         }                                                                     \
-    1280             : } while (0)
-    1281             : 
-    1282             : #define PyArray_MultiIter_GOTO(multi, dest) do {                            \
-    1283             :         int __npy_mi;                                                       \
-    1284             :         for (__npy_mi=0; __npy_mi < _PyMIT(multi)->numiter; __npy_mi++) {   \
-    1285             :                 PyArray_ITER_GOTO(_PyMIT(multi)->iters[__npy_mi], dest);    \
-    1286             :         }                                                                   \
-    1287             :         _PyMIT(multi)->index = _PyMIT(multi)->iters[0]->index;              \
-    1288             : } while (0)
-    1289             : 
-    1290             : #define PyArray_MultiIter_GOTO1D(multi, ind) do {                          \
-    1291             :         int __npy_mi;                                                      \
-    1292             :         for (__npy_mi=0; __npy_mi < _PyMIT(multi)->numiter; __npy_mi++) {  \
-    1293             :                 PyArray_ITER_GOTO1D(_PyMIT(multi)->iters[__npy_mi], ind);  \
-    1294             :         }                                                                  \
-    1295             :         _PyMIT(multi)->index = _PyMIT(multi)->iters[0]->index;             \
-    1296             : } while (0)
-    1297             : 
-    1298             : #define PyArray_MultiIter_DATA(multi, i)                \
-    1299             :         ((void *)(_PyMIT(multi)->iters[i]->dataptr))
-    1300             : 
-    1301             : #define PyArray_MultiIter_NEXTi(multi, i)               \
-    1302             :         PyArray_ITER_NEXT(_PyMIT(multi)->iters[i])
-    1303             : 
-    1304             : #define PyArray_MultiIter_NOTDONE(multi)                \
-    1305             :         (_PyMIT(multi)->index < _PyMIT(multi)->size)
-    1306             : 
-    1307             : /*
-    1308             :  * Store the information needed for fancy-indexing over an array. The
-    1309             :  * fields are slightly unordered to keep consec, dataptr and subspace
-    1310             :  * where they were originally.
-    1311             :  */
-    1312             : typedef struct {
-    1313             :         PyObject_HEAD
-    1314             :         /*
-    1315             :          * Multi-iterator portion --- needs to be present in this
-    1316             :          * order to work with PyArray_Broadcast
-    1317             :          */
-    1318             : 
-    1319             :         int                   numiter;                 /* number of index-array
-    1320             :                                                           iterators */
-    1321             :         npy_intp              size;                    /* size of broadcasted
-    1322             :                                                           result */
-    1323             :         npy_intp              index;                   /* current index */
-    1324             :         int                   nd;                      /* number of dims */
-    1325             :         npy_intp              dimensions[NPY_MAXDIMS]; /* dimensions */
-    1326             :         NpyIter               *outer;                  /* index objects
-    1327             :                                                           iterator */
-    1328             :         void                  *unused[NPY_MAXDIMS - 2];
-    1329             :         PyArrayObject         *array;
-    1330             :         /* Flat iterator for the indexed array. For compatibility solely. */
-    1331             :         PyArrayIterObject     *ait;
-    1332             : 
-    1333             :         /*
-    1334             :          * Subspace array. For binary compatibility (was an iterator,
-    1335             :          * but only the check for NULL should be used).
-    1336             :          */
-    1337             :         PyArrayObject         *subspace;
-    1338             : 
-    1339             :         /*
-    1340             :          * if subspace iteration, then this is the array of axes in
-    1341             :          * the underlying array represented by the index objects
-    1342             :          */
-    1343             :         int                   iteraxes[NPY_MAXDIMS];
-    1344             :         npy_intp              fancy_strides[NPY_MAXDIMS];
-    1345             : 
-    1346             :         /* pointer when all fancy indices are 0 */
-    1347             :         char                  *baseoffset;
-    1348             : 
-    1349             :         /*
-    1350             :          * after binding consec denotes at which axis the fancy axes
-    1351             :          * are inserted.
-    1352             :          */
-    1353             :         int                   consec;
-    1354             :         char                  *dataptr;
-    1355             : 
-    1356             :         int                   nd_fancy;
-    1357             :         npy_intp              fancy_dims[NPY_MAXDIMS];
-    1358             : 
-    1359             :         /*
-    1360             :          * Whether the iterator (any of the iterators) requires API.  This is
-    1361             :          * unused by NumPy itself; ArrayMethod flags are more precise.
-    1362             :          */
-    1363             :         int                   needs_api;
-    1364             : 
-    1365             :         /*
-    1366             :          * Extra op information.
-    1367             :          */
-    1368             :         PyArrayObject         *extra_op;
-    1369             :         PyArray_Descr         *extra_op_dtype;         /* desired dtype */
-    1370             :         npy_uint32            *extra_op_flags;         /* Iterator flags */
-    1371             : 
-    1372             :         NpyIter               *extra_op_iter;
-    1373             :         NpyIter_IterNextFunc  *extra_op_next;
-    1374             :         char                  **extra_op_ptrs;
-    1375             : 
-    1376             :         /*
-    1377             :          * Information about the iteration state.
-    1378             :          */
-    1379             :         NpyIter_IterNextFunc  *outer_next;
-    1380             :         char                  **outer_ptrs;
-    1381             :         npy_intp              *outer_strides;
-    1382             : 
-    1383             :         /*
-    1384             :          * Information about the subspace iterator.
-    1385             :          */
-    1386             :         NpyIter               *subspace_iter;
-    1387             :         NpyIter_IterNextFunc  *subspace_next;
-    1388             :         char                  **subspace_ptrs;
-    1389             :         npy_intp              *subspace_strides;
-    1390             : 
-    1391             :         /* Count for the external loop (which ever it is) for API iteration */
-    1392             :         npy_intp              iter_count;
-    1393             : 
-    1394             : } PyArrayMapIterObject;
-    1395             : 
-    1396             : enum {
-    1397             :     NPY_NEIGHBORHOOD_ITER_ZERO_PADDING,
-    1398             :     NPY_NEIGHBORHOOD_ITER_ONE_PADDING,
-    1399             :     NPY_NEIGHBORHOOD_ITER_CONSTANT_PADDING,
-    1400             :     NPY_NEIGHBORHOOD_ITER_CIRCULAR_PADDING,
-    1401             :     NPY_NEIGHBORHOOD_ITER_MIRROR_PADDING
-    1402             : };
-    1403             : 
-    1404             : typedef struct {
-    1405             :     PyObject_HEAD
-    1406             : 
-    1407             :     /*
-    1408             :      * PyArrayIterObject part: keep this in this exact order
-    1409             :      */
-    1410             :     int               nd_m1;            /* number of dimensions - 1 */
-    1411             :     npy_intp          index, size;
-    1412             :     npy_intp          coordinates[NPY_MAXDIMS];/* N-dimensional loop */
-    1413             :     npy_intp          dims_m1[NPY_MAXDIMS];    /* ao->dimensions - 1 */
-    1414             :     npy_intp          strides[NPY_MAXDIMS];    /* ao->strides or fake */
-    1415             :     npy_intp          backstrides[NPY_MAXDIMS];/* how far to jump back */
-    1416             :     npy_intp          factors[NPY_MAXDIMS];     /* shape factors */
-    1417             :     PyArrayObject     *ao;
-    1418             :     char              *dataptr;        /* pointer to current item*/
-    1419             :     npy_bool          contiguous;
-    1420             : 
-    1421             :     npy_intp          bounds[NPY_MAXDIMS][2];
-    1422             :     npy_intp          limits[NPY_MAXDIMS][2];
-    1423             :     npy_intp          limits_sizes[NPY_MAXDIMS];
-    1424             :     npy_iter_get_dataptr_t translate;
-    1425             : 
-    1426             :     /*
-    1427             :      * New members
-    1428             :      */
-    1429             :     npy_intp nd;
-    1430             : 
-    1431             :     /* Dimensions is the dimension of the array */
-    1432             :     npy_intp dimensions[NPY_MAXDIMS];
-    1433             : 
-    1434             :     /*
-    1435             :      * Neighborhood points coordinates are computed relatively to the
-    1436             :      * point pointed by _internal_iter
-    1437             :      */
-    1438             :     PyArrayIterObject* _internal_iter;
-    1439             :     /*
-    1440             :      * To keep a reference to the representation of the constant value
-    1441             :      * for constant padding
-    1442             :      */
-    1443             :     char* constant;
-    1444             : 
-    1445             :     int mode;
-    1446             : } PyArrayNeighborhoodIterObject;
-    1447             : 
-    1448             : /*
-    1449             :  * Neighborhood iterator API
-    1450             :  */
-    1451             : 
-    1452             : /* General: those work for any mode */
-    1453             : static inline int
-    1454             : PyArrayNeighborhoodIter_Reset(PyArrayNeighborhoodIterObject* iter);
-    1455             : static inline int
-    1456             : PyArrayNeighborhoodIter_Next(PyArrayNeighborhoodIterObject* iter);
-    1457             : #if 0
-    1458             : static inline int
-    1459             : PyArrayNeighborhoodIter_Next2D(PyArrayNeighborhoodIterObject* iter);
-    1460             : #endif
-    1461             : 
-    1462             : /*
-    1463             :  * Include inline implementations - functions defined there are not
-    1464             :  * considered public API
-    1465             :  */
-    1466             : #define NUMPY_CORE_INCLUDE_NUMPY__NEIGHBORHOOD_IMP_H_
-    1467             : #include "_neighborhood_iterator_imp.h"
-    1468             : #undef NUMPY_CORE_INCLUDE_NUMPY__NEIGHBORHOOD_IMP_H_
-    1469             : 
-    1470             : 
-    1471             : 
-    1472             : /* The default array type */
-    1473             : #define NPY_DEFAULT_TYPE NPY_DOUBLE
-    1474             : 
-    1475             : /*
-    1476             :  * All sorts of useful ways to look into a PyArrayObject. It is recommended
-    1477             :  * to use PyArrayObject * objects instead of always casting from PyObject *,
-    1478             :  * for improved type checking.
-    1479             :  *
-    1480             :  * In many cases here the macro versions of the accessors are deprecated,
-    1481             :  * but can't be immediately changed to inline functions because the
-    1482             :  * preexisting macros accept PyObject * and do automatic casts. Inline
-    1483             :  * functions accepting PyArrayObject * provides for some compile-time
-    1484             :  * checking of correctness when working with these objects in C.
-    1485             :  */
-    1486             : 
-    1487             : #define PyArray_ISONESEGMENT(m) (PyArray_CHKFLAGS(m, NPY_ARRAY_C_CONTIGUOUS) || \
-    1488             :                                  PyArray_CHKFLAGS(m, NPY_ARRAY_F_CONTIGUOUS))
-    1489             : 
-    1490             : #define PyArray_ISFORTRAN(m) (PyArray_CHKFLAGS(m, NPY_ARRAY_F_CONTIGUOUS) && \
-    1491             :                              (!PyArray_CHKFLAGS(m, NPY_ARRAY_C_CONTIGUOUS)))
-    1492             : 
-    1493             : #define PyArray_FORTRAN_IF(m) ((PyArray_CHKFLAGS(m, NPY_ARRAY_F_CONTIGUOUS) ? \
-    1494             :                                NPY_ARRAY_F_CONTIGUOUS : 0))
-    1495             : 
-    1496             : #if (defined(NPY_NO_DEPRECATED_API) && (NPY_1_7_API_VERSION <= NPY_NO_DEPRECATED_API))
-    1497             : /*
-    1498             :  * Changing access macros into functions, to allow for future hiding
-    1499             :  * of the internal memory layout. This later hiding will allow the 2.x series
-    1500             :  * to change the internal representation of arrays without affecting
-    1501             :  * ABI compatibility.
-    1502             :  */
-    1503             : 
-    1504             : static inline int
-    1505             : PyArray_NDIM(const PyArrayObject *arr)
-    1506             : {
-    1507             :     return ((PyArrayObject_fields *)arr)->nd;
-    1508             : }
-    1509             : 
-    1510             : static inline void *
-    1511             : PyArray_DATA(PyArrayObject *arr)
-    1512             : {
-    1513           0 :     return ((PyArrayObject_fields *)arr)->data;
-    1514             : }
-    1515             : 
-    1516             : static inline char *
-    1517             : PyArray_BYTES(PyArrayObject *arr)
-    1518             : {
-    1519             :     return ((PyArrayObject_fields *)arr)->data;
-    1520             : }
-    1521             : 
-    1522             : static inline npy_intp *
-    1523             : PyArray_DIMS(PyArrayObject *arr)
-    1524             : {
-    1525           0 :     return ((PyArrayObject_fields *)arr)->dimensions;
-    1526             : }
-    1527             : 
-    1528             : static inline npy_intp *
-    1529             : PyArray_STRIDES(PyArrayObject *arr)
-    1530             : {
-    1531             :     return ((PyArrayObject_fields *)arr)->strides;
-    1532             : }
-    1533             : 
-    1534             : static inline npy_intp
-    1535             : PyArray_DIM(const PyArrayObject *arr, int idim)
-    1536             : {
-    1537             :     return ((PyArrayObject_fields *)arr)->dimensions[idim];
-    1538             : }
-    1539             : 
-    1540             : static inline npy_intp
-    1541             : PyArray_STRIDE(const PyArrayObject *arr, int istride)
-    1542             : {
-    1543             :     return ((PyArrayObject_fields *)arr)->strides[istride];
-    1544             : }
-    1545             : 
-    1546             : static inline NPY_RETURNS_BORROWED_REF PyObject *
-    1547             : PyArray_BASE(PyArrayObject *arr)
-    1548             : {
-    1549             :     return ((PyArrayObject_fields *)arr)->base;
-    1550             : }
-    1551             : 
-    1552             : static inline NPY_RETURNS_BORROWED_REF PyArray_Descr *
-    1553             : PyArray_DESCR(PyArrayObject *arr)
-    1554             : {
-    1555             :     return ((PyArrayObject_fields *)arr)->descr;
-    1556             : }
-    1557             : 
-    1558             : static inline int
-    1559             : PyArray_FLAGS(const PyArrayObject *arr)
-    1560             : {
-    1561           0 :     return ((PyArrayObject_fields *)arr)->flags;
-    1562             : }
-    1563             : 
-    1564             : static inline npy_intp
-    1565             : PyArray_ITEMSIZE(const PyArrayObject *arr)
-    1566             : {
-    1567             :     return ((PyArrayObject_fields *)arr)->descr->elsize;
-    1568             : }
-    1569             : 
-    1570             : static inline int
-    1571             : PyArray_TYPE(const PyArrayObject *arr)
-    1572             : {
-    1573           0 :     return ((PyArrayObject_fields *)arr)->descr->type_num;
-    1574             : }
-    1575             : 
-    1576             : static inline int
-    1577             : PyArray_CHKFLAGS(const PyArrayObject *arr, int flags)
-    1578             : {
-    1579           0 :     return (PyArray_FLAGS(arr) & flags) == flags;
-    1580             : }
-    1581             : 
-    1582             : static inline PyObject *
-    1583             : PyArray_GETITEM(const PyArrayObject *arr, const char *itemptr)
-    1584             : {
-    1585             :     return ((PyArrayObject_fields *)arr)->descr->f->getitem(
-    1586             :                                         (void *)itemptr, (PyArrayObject *)arr);
-    1587             : }
-    1588             : 
-    1589             : /*
-    1590             :  * SETITEM should only be used if it is known that the value is a scalar
-    1591             :  * and of a type understood by the arrays dtype.
-    1592             :  * Use `PyArray_Pack` if the value may be of a different dtype.
-    1593             :  */
-    1594             : static inline int
-    1595             : PyArray_SETITEM(PyArrayObject *arr, char *itemptr, PyObject *v)
-    1596             : {
-    1597             :     return ((PyArrayObject_fields *)arr)->descr->f->setitem(v, itemptr, arr);
-    1598             : }
-    1599             : 
-    1600             : #else
-    1601             : 
-    1602             : /* These macros are deprecated as of NumPy 1.7. */
-    1603             : #define PyArray_NDIM(obj) (((PyArrayObject_fields *)(obj))->nd)
-    1604             : #define PyArray_BYTES(obj) (((PyArrayObject_fields *)(obj))->data)
-    1605             : #define PyArray_DATA(obj) ((void *)((PyArrayObject_fields *)(obj))->data)
-    1606             : #define PyArray_DIMS(obj) (((PyArrayObject_fields *)(obj))->dimensions)
-    1607             : #define PyArray_STRIDES(obj) (((PyArrayObject_fields *)(obj))->strides)
-    1608             : #define PyArray_DIM(obj,n) (PyArray_DIMS(obj)[n])
-    1609             : #define PyArray_STRIDE(obj,n) (PyArray_STRIDES(obj)[n])
-    1610             : #define PyArray_BASE(obj) (((PyArrayObject_fields *)(obj))->base)
-    1611             : #define PyArray_DESCR(obj) (((PyArrayObject_fields *)(obj))->descr)
-    1612             : #define PyArray_FLAGS(obj) (((PyArrayObject_fields *)(obj))->flags)
-    1613             : #define PyArray_CHKFLAGS(m, FLAGS) \
-    1614             :         ((((PyArrayObject_fields *)(m))->flags & (FLAGS)) == (FLAGS))
-    1615             : #define PyArray_ITEMSIZE(obj) \
-    1616             :                     (((PyArrayObject_fields *)(obj))->descr->elsize)
-    1617             : #define PyArray_TYPE(obj) \
-    1618             :                     (((PyArrayObject_fields *)(obj))->descr->type_num)
-    1619             : #define PyArray_GETITEM(obj,itemptr) \
-    1620             :         PyArray_DESCR(obj)->f->getitem((char *)(itemptr), \
-    1621             :                                      (PyArrayObject *)(obj))
-    1622             : 
-    1623             : #define PyArray_SETITEM(obj,itemptr,v) \
-    1624             :         PyArray_DESCR(obj)->f->setitem((PyObject *)(v), \
-    1625             :                                      (char *)(itemptr), \
-    1626             :                                      (PyArrayObject *)(obj))
-    1627             : #endif
-    1628             : 
-    1629             : static inline PyArray_Descr *
-    1630             : PyArray_DTYPE(PyArrayObject *arr)
-    1631             : {
-    1632             :     return ((PyArrayObject_fields *)arr)->descr;
-    1633             : }
-    1634             : 
-    1635             : static inline npy_intp *
-    1636             : PyArray_SHAPE(PyArrayObject *arr)
-    1637             : {
-    1638             :     return ((PyArrayObject_fields *)arr)->dimensions;
-    1639             : }
-    1640             : 
-    1641             : /*
-    1642             :  * Enables the specified array flags. Does no checking,
-    1643             :  * assumes you know what you're doing.
-    1644             :  */
-    1645             : static inline void
-    1646             : PyArray_ENABLEFLAGS(PyArrayObject *arr, int flags)
-    1647             : {
-    1648             :     ((PyArrayObject_fields *)arr)->flags |= flags;
-    1649             : }
-    1650             : 
-    1651             : /*
-    1652             :  * Clears the specified array flags. Does no checking,
-    1653             :  * assumes you know what you're doing.
-    1654             :  */
-    1655             : static inline void
-    1656             : PyArray_CLEARFLAGS(PyArrayObject *arr, int flags)
-    1657             : {
-    1658             :     ((PyArrayObject_fields *)arr)->flags &= ~flags;
-    1659             : }
-    1660             : 
-    1661             : #if NPY_FEATURE_VERSION >= NPY_1_22_API_VERSION
-    1662             :     static inline NPY_RETURNS_BORROWED_REF PyObject *
-    1663             :     PyArray_HANDLER(PyArrayObject *arr)
-    1664             :     {
-    1665             :         return ((PyArrayObject_fields *)arr)->mem_handler;
-    1666             :     }
-    1667             : #endif
-    1668             : 
-    1669             : #define PyTypeNum_ISBOOL(type) ((type) == NPY_BOOL)
-    1670             : 
-    1671             : #define PyTypeNum_ISUNSIGNED(type) (((type) == NPY_UBYTE) ||   \
-    1672             :                                  ((type) == NPY_USHORT) ||     \
-    1673             :                                  ((type) == NPY_UINT) ||       \
-    1674             :                                  ((type) == NPY_ULONG) ||      \
-    1675             :                                  ((type) == NPY_ULONGLONG))
-    1676             : 
-    1677             : #define PyTypeNum_ISSIGNED(type) (((type) == NPY_BYTE) ||      \
-    1678             :                                ((type) == NPY_SHORT) ||        \
-    1679             :                                ((type) == NPY_INT) ||          \
-    1680             :                                ((type) == NPY_LONG) ||         \
-    1681             :                                ((type) == NPY_LONGLONG))
-    1682             : 
-    1683             : #define PyTypeNum_ISINTEGER(type) (((type) >= NPY_BYTE) &&     \
-    1684             :                                 ((type) <= NPY_ULONGLONG))
-    1685             : 
-    1686             : #define PyTypeNum_ISFLOAT(type) ((((type) >= NPY_FLOAT) && \
-    1687             :                               ((type) <= NPY_LONGDOUBLE)) || \
-    1688             :                               ((type) == NPY_HALF))
-    1689             : 
-    1690             : #define PyTypeNum_ISNUMBER(type) (((type) <= NPY_CLONGDOUBLE) || \
-    1691             :                                   ((type) == NPY_HALF))
-    1692             : 
-    1693             : #define PyTypeNum_ISSTRING(type) (((type) == NPY_STRING) ||    \
-    1694             :                                   ((type) == NPY_UNICODE))
-    1695             : 
-    1696             : #define PyTypeNum_ISCOMPLEX(type) (((type) >= NPY_CFLOAT) &&   \
-    1697             :                                 ((type) <= NPY_CLONGDOUBLE))
-    1698             : 
-    1699             : #define PyTypeNum_ISPYTHON(type) (((type) == NPY_LONG) ||      \
-    1700             :                                   ((type) == NPY_DOUBLE) ||    \
-    1701             :                                   ((type) == NPY_CDOUBLE) ||   \
-    1702             :                                   ((type) == NPY_BOOL) ||      \
-    1703             :                                   ((type) == NPY_OBJECT ))
-    1704             : 
-    1705             : #define PyTypeNum_ISFLEXIBLE(type) (((type) >=NPY_STRING) &&  \
-    1706             :                                     ((type) <=NPY_VOID))
-    1707             : 
-    1708             : #define PyTypeNum_ISDATETIME(type) (((type) >=NPY_DATETIME) &&  \
-    1709             :                                     ((type) <=NPY_TIMEDELTA))
-    1710             : 
-    1711             : #define PyTypeNum_ISUSERDEF(type) (((type) >= NPY_USERDEF) && \
-    1712             :                                    ((type) < NPY_USERDEF+     \
-    1713             :                                     NPY_NUMUSERTYPES))
-    1714             : 
-    1715             : #define PyTypeNum_ISEXTENDED(type) (PyTypeNum_ISFLEXIBLE(type) ||  \
-    1716             :                                     PyTypeNum_ISUSERDEF(type))
-    1717             : 
-    1718             : #define PyTypeNum_ISOBJECT(type) ((type) == NPY_OBJECT)
-    1719             : 
-    1720             : 
-    1721             : #define PyDataType_ISBOOL(obj) PyTypeNum_ISBOOL(((PyArray_Descr*)(obj))->type_num)
-    1722             : #define PyDataType_ISUNSIGNED(obj) PyTypeNum_ISUNSIGNED(((PyArray_Descr*)(obj))->type_num)
-    1723             : #define PyDataType_ISSIGNED(obj) PyTypeNum_ISSIGNED(((PyArray_Descr*)(obj))->type_num)
-    1724             : #define PyDataType_ISINTEGER(obj) PyTypeNum_ISINTEGER(((PyArray_Descr*)(obj))->type_num )
-    1725             : #define PyDataType_ISFLOAT(obj) PyTypeNum_ISFLOAT(((PyArray_Descr*)(obj))->type_num)
-    1726             : #define PyDataType_ISNUMBER(obj) PyTypeNum_ISNUMBER(((PyArray_Descr*)(obj))->type_num)
-    1727             : #define PyDataType_ISSTRING(obj) PyTypeNum_ISSTRING(((PyArray_Descr*)(obj))->type_num)
-    1728             : #define PyDataType_ISCOMPLEX(obj) PyTypeNum_ISCOMPLEX(((PyArray_Descr*)(obj))->type_num)
-    1729             : #define PyDataType_ISPYTHON(obj) PyTypeNum_ISPYTHON(((PyArray_Descr*)(obj))->type_num)
-    1730             : #define PyDataType_ISFLEXIBLE(obj) PyTypeNum_ISFLEXIBLE(((PyArray_Descr*)(obj))->type_num)
-    1731             : #define PyDataType_ISDATETIME(obj) PyTypeNum_ISDATETIME(((PyArray_Descr*)(obj))->type_num)
-    1732             : #define PyDataType_ISUSERDEF(obj) PyTypeNum_ISUSERDEF(((PyArray_Descr*)(obj))->type_num)
-    1733             : #define PyDataType_ISEXTENDED(obj) PyTypeNum_ISEXTENDED(((PyArray_Descr*)(obj))->type_num)
-    1734             : #define PyDataType_ISOBJECT(obj) PyTypeNum_ISOBJECT(((PyArray_Descr*)(obj))->type_num)
-    1735             : #define PyDataType_HASFIELDS(obj) (((PyArray_Descr *)(obj))->names != NULL)
-    1736             : #define PyDataType_HASSUBARRAY(dtype) ((dtype)->subarray != NULL)
-    1737             : #define PyDataType_ISUNSIZED(dtype) ((dtype)->elsize == 0 && \
-    1738             :                                       !PyDataType_HASFIELDS(dtype))
-    1739             : #define PyDataType_MAKEUNSIZED(dtype) ((dtype)->elsize = 0)
-    1740             : 
-    1741             : #define PyArray_ISBOOL(obj) PyTypeNum_ISBOOL(PyArray_TYPE(obj))
-    1742             : #define PyArray_ISUNSIGNED(obj) PyTypeNum_ISUNSIGNED(PyArray_TYPE(obj))
-    1743             : #define PyArray_ISSIGNED(obj) PyTypeNum_ISSIGNED(PyArray_TYPE(obj))
-    1744             : #define PyArray_ISINTEGER(obj) PyTypeNum_ISINTEGER(PyArray_TYPE(obj))
-    1745             : #define PyArray_ISFLOAT(obj) PyTypeNum_ISFLOAT(PyArray_TYPE(obj))
-    1746             : #define PyArray_ISNUMBER(obj) PyTypeNum_ISNUMBER(PyArray_TYPE(obj))
-    1747             : #define PyArray_ISSTRING(obj) PyTypeNum_ISSTRING(PyArray_TYPE(obj))
-    1748             : #define PyArray_ISCOMPLEX(obj) PyTypeNum_ISCOMPLEX(PyArray_TYPE(obj))
-    1749             : #define PyArray_ISPYTHON(obj) PyTypeNum_ISPYTHON(PyArray_TYPE(obj))
-    1750             : #define PyArray_ISFLEXIBLE(obj) PyTypeNum_ISFLEXIBLE(PyArray_TYPE(obj))
-    1751             : #define PyArray_ISDATETIME(obj) PyTypeNum_ISDATETIME(PyArray_TYPE(obj))
-    1752             : #define PyArray_ISUSERDEF(obj) PyTypeNum_ISUSERDEF(PyArray_TYPE(obj))
-    1753             : #define PyArray_ISEXTENDED(obj) PyTypeNum_ISEXTENDED(PyArray_TYPE(obj))
-    1754             : #define PyArray_ISOBJECT(obj) PyTypeNum_ISOBJECT(PyArray_TYPE(obj))
-    1755             : #define PyArray_HASFIELDS(obj) PyDataType_HASFIELDS(PyArray_DESCR(obj))
-    1756             : 
-    1757             :     /*
-    1758             :      * FIXME: This should check for a flag on the data-type that
-    1759             :      * states whether or not it is variable length.  Because the
-    1760             :      * ISFLEXIBLE check is hard-coded to the built-in data-types.
-    1761             :      */
-    1762             : #define PyArray_ISVARIABLE(obj) PyTypeNum_ISFLEXIBLE(PyArray_TYPE(obj))
-    1763             : 
-    1764             : #define PyArray_SAFEALIGNEDCOPY(obj) (PyArray_ISALIGNED(obj) && !PyArray_ISVARIABLE(obj))
-    1765             : 
-    1766             : 
-    1767             : #define NPY_LITTLE '<'
-    1768             : #define NPY_BIG '>'
-    1769             : #define NPY_NATIVE '='
-    1770             : #define NPY_SWAP 's'
-    1771             : #define NPY_IGNORE '|'
-    1772             : 
-    1773             : #if NPY_BYTE_ORDER == NPY_BIG_ENDIAN
-    1774             : #define NPY_NATBYTE NPY_BIG
-    1775             : #define NPY_OPPBYTE NPY_LITTLE
-    1776             : #else
-    1777             : #define NPY_NATBYTE NPY_LITTLE
-    1778             : #define NPY_OPPBYTE NPY_BIG
-    1779             : #endif
-    1780             : 
-    1781             : #define PyArray_ISNBO(arg) ((arg) != NPY_OPPBYTE)
-    1782             : #define PyArray_IsNativeByteOrder PyArray_ISNBO
-    1783             : #define PyArray_ISNOTSWAPPED(m) PyArray_ISNBO(PyArray_DESCR(m)->byteorder)
-    1784             : #define PyArray_ISBYTESWAPPED(m) (!PyArray_ISNOTSWAPPED(m))
-    1785             : 
-    1786             : #define PyArray_FLAGSWAP(m, flags) (PyArray_CHKFLAGS(m, flags) &&       \
-    1787             :                                     PyArray_ISNOTSWAPPED(m))
-    1788             : 
-    1789             : #define PyArray_ISCARRAY(m) PyArray_FLAGSWAP(m, NPY_ARRAY_CARRAY)
-    1790             : #define PyArray_ISCARRAY_RO(m) PyArray_FLAGSWAP(m, NPY_ARRAY_CARRAY_RO)
-    1791             : #define PyArray_ISFARRAY(m) PyArray_FLAGSWAP(m, NPY_ARRAY_FARRAY)
-    1792             : #define PyArray_ISFARRAY_RO(m) PyArray_FLAGSWAP(m, NPY_ARRAY_FARRAY_RO)
-    1793             : #define PyArray_ISBEHAVED(m) PyArray_FLAGSWAP(m, NPY_ARRAY_BEHAVED)
-    1794             : #define PyArray_ISBEHAVED_RO(m) PyArray_FLAGSWAP(m, NPY_ARRAY_ALIGNED)
-    1795             : 
-    1796             : 
-    1797             : #define PyDataType_ISNOTSWAPPED(d) PyArray_ISNBO(((PyArray_Descr *)(d))->byteorder)
-    1798             : #define PyDataType_ISBYTESWAPPED(d) (!PyDataType_ISNOTSWAPPED(d))
-    1799             : 
-    1800             : /************************************************************
-    1801             :  * A struct used by PyArray_CreateSortedStridePerm, new in 1.7.
-    1802             :  ************************************************************/
-    1803             : 
-    1804             : typedef struct {
-    1805             :     npy_intp perm, stride;
-    1806             : } npy_stride_sort_item;
-    1807             : 
-    1808             : /************************************************************
-    1809             :  * This is the form of the struct that's stored in the
-    1810             :  * PyCapsule returned by an array's __array_struct__ attribute. See
-    1811             :  * https://docs.scipy.org/doc/numpy/reference/arrays.interface.html for the full
-    1812             :  * documentation.
-    1813             :  ************************************************************/
-    1814             : typedef struct {
-    1815             :     int two;              /*
-    1816             :                            * contains the integer 2 as a sanity
-    1817             :                            * check
-    1818             :                            */
-    1819             : 
-    1820             :     int nd;               /* number of dimensions */
-    1821             : 
-    1822             :     char typekind;        /*
-    1823             :                            * kind in array --- character code of
-    1824             :                            * typestr
-    1825             :                            */
-    1826             : 
-    1827             :     int itemsize;         /* size of each element */
-    1828             : 
-    1829             :     int flags;            /*
-    1830             :                            * how should be data interpreted. Valid
-    1831             :                            * flags are CONTIGUOUS (1), F_CONTIGUOUS (2),
-    1832             :                            * ALIGNED (0x100), NOTSWAPPED (0x200), and
-    1833             :                            * WRITEABLE (0x400).  ARR_HAS_DESCR (0x800)
-    1834             :                            * states that arrdescr field is present in
-    1835             :                            * structure
-    1836             :                            */
-    1837             : 
-    1838             :     npy_intp *shape;       /*
-    1839             :                             * A length-nd array of shape
-    1840             :                             * information
-    1841             :                             */
-    1842             : 
-    1843             :     npy_intp *strides;    /* A length-nd array of stride information */
-    1844             : 
-    1845             :     void *data;           /* A pointer to the first element of the array */
-    1846             : 
-    1847             :     PyObject *descr;      /*
-    1848             :                            * A list of fields or NULL (ignored if flags
-    1849             :                            * does not have ARR_HAS_DESCR flag set)
-    1850             :                            */
-    1851             : } PyArrayInterface;
-    1852             : 
-    1853             : /*
-    1854             :  * This is a function for hooking into the PyDataMem_NEW/FREE/RENEW functions.
-    1855             :  * See the documentation for PyDataMem_SetEventHook.
-    1856             :  */
-    1857             : typedef void (PyDataMem_EventHookFunc)(void *inp, void *outp, size_t size,
-    1858             :                                        void *user_data);
-    1859             : 
-    1860             : 
-    1861             : /*
-    1862             :  * PyArray_DTypeMeta related definitions.
-    1863             :  *
-    1864             :  * As of now, this API is preliminary and will be extended as necessary.
-    1865             :  */
-    1866             : #if defined(NPY_INTERNAL_BUILD) && NPY_INTERNAL_BUILD
-    1867             :     /*
-    1868             :      * The Structures defined in this block are currently considered
-    1869             :      * private API and may change without warning!
-    1870             :      * Part of this (at least the size) is expected to be public API without
-    1871             :      * further modifications.
-    1872             :      */
-    1873             :     /* TODO: Make this definition public in the API, as soon as its settled */
-    1874             :     NPY_NO_EXPORT extern PyTypeObject PyArrayDTypeMeta_Type;
-    1875             : 
-    1876             :     /*
-    1877             :      * While NumPy DTypes would not need to be heap types the plan is to
-    1878             :      * make DTypes available in Python at which point they will be heap types.
-    1879             :      * Since we also wish to add fields to the DType class, this looks like
-    1880             :      * a typical instance definition, but with PyHeapTypeObject instead of
-    1881             :      * only the PyObject_HEAD.
-    1882             :      * This must only be exposed very extremely careful consideration, since
-    1883             :      * it is a fairly complex construct which may be better to allow
-    1884             :      * refactoring of.
-    1885             :      */
-    1886             :     typedef struct {
-    1887             :         PyHeapTypeObject super;
-    1888             : 
-    1889             :         /*
-    1890             :          * Most DTypes will have a singleton default instance, for the
-    1891             :          * parametric legacy DTypes (bytes, string, void, datetime) this
-    1892             :          * may be a pointer to the *prototype* instance?
-    1893             :          */
-    1894             :         PyArray_Descr *singleton;
-    1895             :         /* Copy of the legacy DTypes type number, usually invalid. */
-    1896             :         int type_num;
-    1897             : 
-    1898             :         /* The type object of the scalar instances (may be NULL?) */
-    1899             :         PyTypeObject *scalar_type;
-    1900             :         /*
-    1901             :          * DType flags to signal legacy, parametric, or
-    1902             :          * abstract.  But plenty of space for additional information/flags.
-    1903             :          */
-    1904             :         npy_uint64 flags;
-    1905             : 
-    1906             :         /*
-    1907             :          * Use indirection in order to allow a fixed size for this struct.
-    1908             :          * A stable ABI size makes creating a static DType less painful
-    1909             :          * while also ensuring flexibility for all opaque API (with one
-    1910             :          * indirection due the pointer lookup).
-    1911             :          */
-    1912             :         void *dt_slots;
-    1913             :         void *reserved[3];
-    1914             :     } PyArray_DTypeMeta;
-    1915             : 
-    1916             : #endif  /* NPY_INTERNAL_BUILD */
-    1917             : 
-    1918             : 
-    1919             : /*
-    1920             :  * Use the keyword NPY_DEPRECATED_INCLUDES to ensure that the header files
-    1921             :  * npy_*_*_deprecated_api.h are only included from here and nowhere else.
-    1922             :  */
-    1923             : #ifdef NPY_DEPRECATED_INCLUDES
-    1924             : #error "Do not use the reserved keyword NPY_DEPRECATED_INCLUDES."
-    1925             : #endif
-    1926             : #define NPY_DEPRECATED_INCLUDES
-    1927             : #if !defined(NPY_NO_DEPRECATED_API) || \
-    1928             :     (NPY_NO_DEPRECATED_API < NPY_1_7_API_VERSION)
-    1929             : #include "npy_1_7_deprecated_api.h"
-    1930             : #endif
-    1931             : /*
-    1932             :  * There is no file npy_1_8_deprecated_api.h since there are no additional
-    1933             :  * deprecated API features in NumPy 1.8.
-    1934             :  *
-    1935             :  * Note to maintainers: insert code like the following in future NumPy
-    1936             :  * versions.
-    1937             :  *
-    1938             :  * #if !defined(NPY_NO_DEPRECATED_API) || \
-    1939             :  *     (NPY_NO_DEPRECATED_API < NPY_1_9_API_VERSION)
-    1940             :  * #include "npy_1_9_deprecated_api.h"
-    1941             :  * #endif
-    1942             :  */
-    1943             : #undef NPY_DEPRECATED_INCLUDES
-    1944             : 
-    1945             : #endif  /* NUMPY_CORE_INCLUDE_NUMPY_NDARRAYTYPES_H_ */
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/AssocVector.h.func-sort-c.html b/doc/coverageReport/include/crpropa/AssocVector.h.func-sort-c.html deleted file mode 100644 index c39d31005..000000000 --- a/doc/coverageReport/include/crpropa/AssocVector.h.func-sort-c.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/AssocVector.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - AssocVector.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:2121100.0 %
Date:2024-04-08 14:58:22Functions:55100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN4Loki11AssocVectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7crpropa7VariantESt4lessIS6_ESaISt4pairIS6_S8_EEE4findERKS6_5
_ZN4Loki11AssocVectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7crpropa7VariantESt4lessIS6_ESaISt4pairIS6_S8_EEEaSERKSE_30
_ZNK4Loki11AssocVectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7crpropa7VariantESt4lessIS6_ESaISt4pairIS6_S8_EEE4findERKS6_41
_ZN4Loki11AssocVectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7crpropa7VariantESt4lessIS6_ESaISt4pairIS6_S8_EEE6insertERKSC_1143
_ZN4Loki11AssocVectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7crpropa7VariantESt4lessIS6_ESaISt4pairIS6_S8_EEEixERKS6_1143
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/AssocVector.h.func.html b/doc/coverageReport/include/crpropa/AssocVector.h.func.html deleted file mode 100644 index 206af8f4c..000000000 --- a/doc/coverageReport/include/crpropa/AssocVector.h.func.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/AssocVector.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - AssocVector.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:2121100.0 %
Date:2024-04-08 14:58:22Functions:55100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN4Loki11AssocVectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7crpropa7VariantESt4lessIS6_ESaISt4pairIS6_S8_EEE4findERKS6_5
_ZN4Loki11AssocVectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7crpropa7VariantESt4lessIS6_ESaISt4pairIS6_S8_EEE6insertERKSC_1143
_ZN4Loki11AssocVectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7crpropa7VariantESt4lessIS6_ESaISt4pairIS6_S8_EEEaSERKSE_30
_ZN4Loki11AssocVectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7crpropa7VariantESt4lessIS6_ESaISt4pairIS6_S8_EEEixERKS6_1143
_ZNK4Loki11AssocVectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7crpropa7VariantESt4lessIS6_ESaISt4pairIS6_S8_EEE4findERKS6_41
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/AssocVector.h.gcov.html b/doc/coverageReport/include/crpropa/AssocVector.h.gcov.html deleted file mode 100644 index 6e1f36ba8..000000000 --- a/doc/coverageReport/include/crpropa/AssocVector.h.gcov.html +++ /dev/null @@ -1,457 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/AssocVector.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - AssocVector.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:2121100.0 %
Date:2024-04-08 14:58:22Functions:55100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : ////////////////////////////////////////////////////////////////////////////////
-       2             : // The Loki Library
-       3             : // Copyright (c) 2001 by Andrei Alexandrescu
-       4             : // This code accompanies the book:
-       5             : // Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
-       6             : //     Patterns Applied". Copyright (c) 2001. Addison-Wesley.
-       7             : //
-       8             : // Permission is hereby granted, free of charge, to any person obtaining a copy
-       9             : // of this software and associated documentation files (the "Software"), to deal
-      10             : // in the Software without restriction, including without limitation the rights
-      11             : // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-      12             : // copies of the Software, and to permit persons to whom the Software is
-      13             : // furnished to do so, subject to the following conditions:
-      14             : //
-      15             : // The above copyright notice and this permission notice shall be included in
-      16             : // all copies or substantial portions of the Software.
-      17             : //
-      18             : // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-      19             : // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-      20             : // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-      21             : // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-      22             : // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-      23             : // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-      24             : // SOFTWARE.
-      25             : ////////////////////////////////////////////////////////////////////////////////
-      26             : #ifndef LOKI_ASSOCVECTOR_INC_
-      27             : #define LOKI_ASSOCVECTOR_INC_
-      28             : 
-      29             : // $Id$
-      30             : 
-      31             : 
-      32             : #include <algorithm>
-      33             : #include <functional>
-      34             : #include <vector>
-      35             : #include <utility>
-      36             : #include <iterator>
-      37             : #include <map>
-      38             : 
-      39             : 
-      40             : namespace Loki
-      41             : {
-      42             : ////////////////////////////////////////////////////////////////////////////////
-      43             : // class template AssocVectorCompare
-      44             : // Used by AssocVector
-      45             : ////////////////////////////////////////////////////////////////////////////////
-      46             : 
-      47             :     namespace Private
-      48             :     {
-      49             :         template <class Value, class C>
-      50             :         class AssocVectorCompare : public C
-      51             :         {
-      52             :             typedef std::pair<typename C::first_argument_type, Value>
-      53             :                 Data;
-      54             :             typedef typename C::first_argument_type first_argument_type;
-      55             : 
-      56             :         public:
-      57             :             AssocVectorCompare()
-      58             :             {}
-      59             : 
-      60             :             AssocVectorCompare(const C& src) : C(src)
-      61             :             {}
-      62             : 
-      63             :             bool operator()(const first_argument_type& lhs,
-      64             :                 const first_argument_type& rhs) const
-      65             :             { return C::operator()(lhs, rhs); }
-      66             : 
-      67             :             bool operator()(const Data& lhs, const Data& rhs) const
-      68             :             { return operator()(lhs.first, rhs.first); }
-      69             : 
-      70             :             bool operator()(const Data& lhs,
-      71             :                 const first_argument_type& rhs) const
-      72          57 :             { return operator()(lhs.first, rhs); }
-      73             : 
-      74             :             bool operator()(const first_argument_type& lhs,
-      75             :                 const Data& rhs) const
-      76             :             { return operator()(lhs, rhs.first); }
-      77             :         };
-      78             :     }
-      79             : 
-      80             : ////////////////////////////////////////////////////////////////////////////////
-      81             : // class template AssocVector
-      82             : // An associative vector built as a syntactic drop-in replacement for std::map
-      83             : // BEWARE: AssocVector doesn't respect all map's guarantees, the most important
-      84             : //     being:
-      85             : // * iterators are invalidated by insert and erase operations
-      86             : // * the complexity of insert/erase is O(N) not O(log N)
-      87             : // * value_type is std::pair<K, V> not std::pair<const K, V>
-      88             : // * iterators are random
-      89             : ////////////////////////////////////////////////////////////////////////////////
-      90             : 
-      91             : 
-      92             :     template
-      93             :     <
-      94             :         class K,
-      95             :         class V,
-      96             :         class C = std::less<K>,
-      97             :         class A = std::allocator< std::pair<K, V> >
-      98             :     >
-      99          30 :     class AssocVector
-     100             :         : private std::vector< std::pair<K, V>, A >
-     101             :         , private Private::AssocVectorCompare<V, C>
-     102             :     {
-     103             :         typedef std::vector<std::pair<K, V>, A> Base;
-     104             :         typedef Private::AssocVectorCompare<V, C> MyCompare;
-     105             : 
-     106             :     public:
-     107             :         typedef K key_type;
-     108             :         typedef V mapped_type;
-     109             :         typedef typename Base::value_type value_type;
-     110             : 
-     111             :         typedef C key_compare;
-     112             :         typedef A allocator_type;
-     113             :         typedef typename A::reference reference;
-     114             :         typedef typename A::const_reference const_reference;
-     115             :         typedef typename Base::iterator iterator;
-     116             :         typedef typename Base::const_iterator const_iterator;
-     117             :         typedef typename Base::size_type size_type;
-     118             :         typedef typename Base::difference_type difference_type;
-     119             :         typedef typename A::pointer pointer;
-     120             :         typedef typename A::const_pointer const_pointer;
-     121             :         typedef typename Base::reverse_iterator reverse_iterator;
-     122             :         typedef typename Base::const_reverse_iterator const_reverse_iterator;
-     123             : 
-     124             :         class value_compare
-     125             :             : public std::binary_function<value_type, value_type, bool>
-     126             :             , private key_compare
-     127             :         {
-     128             :             friend class AssocVector;
-     129             : 
-     130             :         protected:
-     131             :             value_compare(key_compare pred) : key_compare(pred)
-     132             :             {}
-     133             : 
-     134             :         public:
-     135             :             bool operator()(const value_type& lhs, const value_type& rhs) const
-     136             :             { return key_compare::operator()(lhs.first, rhs.first); }
-     137             :         };
-     138             : 
-     139             :         // 23.3.1.1 construct/copy/destroy
-     140             : 
-     141             :         explicit AssocVector(const key_compare& comp = key_compare(),
-     142             :             const A& alloc = A())
-     143             :         : Base(alloc), MyCompare(comp)
-     144             :         {}
-     145             : 
-     146             :         template <class InputIterator>
-     147             :         AssocVector(InputIterator first, InputIterator last,
-     148             :             const key_compare& comp = key_compare(),
-     149             :             const A& alloc = A())
-     150             :         : Base( alloc ), MyCompare( comp )
-     151             :         {
-     152             :             typedef ::std::vector< ::std::pair< K, V >, A > BaseType;
-     153             :             typedef ::std::map< K, V, C, A > TempMap;
-     154             :             typedef ::std::back_insert_iterator< Base > MyInserter;
-     155             :             MyCompare & me = *this;
-     156             :             const A tempAlloc;
-     157             :             // Make a temporary map similar to this type to prevent any duplicate elements.
-     158             :             TempMap temp( first, last, me, tempAlloc );
-     159             :             Base::reserve( temp.size() );
-     160             :             BaseType & target = static_cast< BaseType & >( *this );
-     161             :             MyInserter myInserter = ::std::back_inserter( target );
-     162             :             ::std::copy( temp.begin(), temp.end(), myInserter );
-     163             :         }
-     164             : 
-     165          30 :         AssocVector& operator=(const AssocVector& rhs)
-     166             :         {
-     167          30 :             AssocVector(rhs).swap(*this);
-     168          30 :             return *this;
-     169             :         }
-     170             : 
-     171             :         // iterators:
-     172             :         // The following are here because MWCW gets 'using' wrong
-     173             :         iterator begin() { return Base::begin(); }
-     174             :         const_iterator begin() const { return Base::begin(); }
-     175             :         iterator end() { return Base::end(); }
-     176             :         const_iterator end() const { return Base::end(); }
-     177             :         reverse_iterator rbegin() { return Base::rbegin(); }
-     178             :         const_reverse_iterator rbegin() const { return Base::rbegin(); }
-     179             :         reverse_iterator rend() { return Base::rend(); }
-     180             :         const_reverse_iterator rend() const { return Base::rend(); }
-     181             : 
-     182             :         // capacity:
-     183             :         bool empty() const { return Base::empty(); }
-     184             :         size_type size() const { return Base::size(); }
-     185             :         size_type max_size() { return Base::max_size(); }
-     186             : 
-     187             :         // 23.3.1.2 element access:
-     188        1143 :         mapped_type& operator[](const key_type& key)
-     189        1143 :         { return insert(value_type(key, mapped_type())).first->second; }
-     190             : 
-     191             :         // modifiers:
-     192        1143 :         std::pair<iterator, bool> insert(const value_type& val)
-     193             :         {
-     194             :             bool found(true);
-     195        1143 :             iterator i(lower_bound(val.first));
-     196             : 
-     197          13 :             if (i == end() || this->operator()(val.first, i->first))
-     198             :             {
-     199        1134 :                 i = Base::insert(i, val);
-     200             :                 found = false;
-     201             :             }
-     202        1143 :             return std::make_pair(i, !found);
-     203             :         }
-     204             :         //Section [23.1.2], Table 69
-     205             :         //http://developer.apple.com/documentation/DeveloperTools/gcc-3.3/libstdc++/23_containers/howto.html#4
-     206             :         iterator insert(iterator pos, const value_type& val)
-     207             :         {
-     208             :             if( (pos == begin() || this->operator()(*(pos-1),val)) &&
-     209             :                 (pos == end()    || this->operator()(val, *pos)) )
-     210             :             {
-     211             :                 return Base::insert(pos, val);
-     212             :             }
-     213             :             return insert(val).first;
-     214             :         }
-     215             : 
-     216             :         template <class InputIterator>
-     217             :         void insert(InputIterator first, InputIterator last)
-     218             :         { for (; first != last; ++first) insert(*first); }
-     219             : 
-     220             :         void erase(iterator pos)
-     221           5 :         { Base::erase(pos); }
-     222             : 
-     223             :         size_type erase(const key_type& k)
-     224             :         {
-     225             :             iterator i(find(k));
-     226             :             if (i == end()) return 0;
-     227             :             erase(i);
-     228             :             return 1;
-     229             :         }
-     230             : 
-     231             :         void erase(iterator first, iterator last)
-     232             :         { Base::erase(first, last); }
-     233             : 
-     234             :         void swap(AssocVector& other)
-     235             :         {
-     236             :             Base::swap(other);
-     237             :             MyCompare& me = *this;
-     238             :             MyCompare& rhs = other;
-     239             :             std::swap(me, rhs);
-     240             :         }
-     241             : 
-     242             :         void clear()
-     243             :         { Base::clear(); }
-     244             : 
-     245             :         // observers:
-     246             :         key_compare key_comp() const
-     247             :         { return *this; }
-     248             : 
-     249             :         value_compare value_comp() const
-     250             :         {
-     251             :             const key_compare& comp = *this;
-     252             :             return value_compare(comp);
-     253             :         }
-     254             : 
-     255             :         // 23.3.1.3 map operations:
-     256           5 :         iterator find(const key_type& k)
-     257             :         {
-     258             :             iterator i(lower_bound(k));
-     259           5 :             if (i != end() && this->operator()(k, i->first))
-     260             :             {
-     261             :                 i = end();
-     262             :             }
-     263           5 :             return i;
-     264             :         }
-     265             : 
-     266          41 :         const_iterator find(const key_type& k) const
-     267             :         {
-     268             :             const_iterator i(lower_bound(k));
-     269          33 :             if (i != end() && this->operator()(k, i->first))
-     270             :             {
-     271             :                 i = end();
-     272             :             }
-     273          41 :             return i;
-     274             :         }
-     275             : 
-     276             :         size_type count(const key_type& k) const
-     277             :         { return find(k) != end(); }
-     278             : 
-     279             :         iterator lower_bound(const key_type& k)
-     280             :         {
-     281             :             MyCompare& me = *this;
-     282        1148 :             return std::lower_bound(begin(), end(), k, me);
-     283             :         }
-     284             : 
-     285             :         const_iterator lower_bound(const key_type& k) const
-     286             :         {
-     287             :             const MyCompare& me = *this;
-     288          41 :             return std::lower_bound(begin(), end(), k, me);
-     289             :         }
-     290             : 
-     291             :         iterator upper_bound(const key_type& k)
-     292             :         {
-     293             :             MyCompare& me = *this;
-     294             :             return std::upper_bound(begin(), end(), k, me);
-     295             :         }
-     296             : 
-     297             :         const_iterator upper_bound(const key_type& k) const
-     298             :         {
-     299             :             const MyCompare& me = *this;
-     300             :             return std::upper_bound(begin(), end(), k, me);
-     301             :         }
-     302             : 
-     303             :         std::pair<iterator, iterator> equal_range(const key_type& k)
-     304             :         {
-     305             :             MyCompare& me = *this;
-     306             :             return std::equal_range(begin(), end(), k, me);
-     307             :         }
-     308             : 
-     309             :         std::pair<const_iterator, const_iterator> equal_range(
-     310             :             const key_type& k) const
-     311             :         {
-     312             :             const MyCompare& me = *this;
-     313             :             return std::equal_range(begin(), end(), k, me);
-     314             :         }
-     315             : 
-     316             :         template <class K1, class V1, class C1, class A1>
-     317             :         friend bool operator==(const AssocVector<K1, V1, C1, A1>& lhs,
-     318             :                         const AssocVector<K1, V1, C1, A1>& rhs);
-     319             : 
-     320             :         bool operator<(const AssocVector& rhs) const
-     321             :         {
-     322             :             const Base& me = *this;
-     323             :             const Base& yo = rhs;
-     324             :             return me < yo;
-     325             :         }
-     326             : 
-     327             :         template <class K1, class V1, class C1, class A1>
-     328             :         friend bool operator!=(const AssocVector<K1, V1, C1, A1>& lhs,
-     329             :                                const AssocVector<K1, V1, C1, A1>& rhs);
-     330             : 
-     331             :         template <class K1, class V1, class C1, class A1>
-     332             :         friend bool operator>(const AssocVector<K1, V1, C1, A1>& lhs,
-     333             :                               const AssocVector<K1, V1, C1, A1>& rhs);
-     334             : 
-     335             :         template <class K1, class V1, class C1, class A1>
-     336             :         friend bool operator>=(const AssocVector<K1, V1, C1, A1>& lhs,
-     337             :                                const AssocVector<K1, V1, C1, A1>& rhs);
-     338             : 
-     339             :         template <class K1, class V1, class C1, class A1>
-     340             :         friend bool operator<=(const AssocVector<K1, V1, C1, A1>& lhs,
-     341             :                                const AssocVector<K1, V1, C1, A1>& rhs);
-     342             :     };
-     343             : 
-     344             :     template <class K, class V, class C, class A>
-     345             :     inline bool operator==(const AssocVector<K, V, C, A>& lhs,
-     346             :                            const AssocVector<K, V, C, A>& rhs)
-     347             :     {
-     348             :       const std::vector<std::pair<K, V>, A>& me = lhs;
-     349             :       return me == rhs;
-     350             :     }
-     351             : 
-     352             :     template <class K, class V, class C, class A>
-     353             :     inline bool operator!=(const AssocVector<K, V, C, A>& lhs,
-     354             :                            const AssocVector<K, V, C, A>& rhs)
-     355             :     { return !(lhs == rhs); }
-     356             : 
-     357             :     template <class K, class V, class C, class A>
-     358             :     inline bool operator>(const AssocVector<K, V, C, A>& lhs,
-     359             :                           const AssocVector<K, V, C, A>& rhs)
-     360             :     { return rhs < lhs; }
-     361             : 
-     362             :     template <class K, class V, class C, class A>
-     363             :     inline bool operator>=(const AssocVector<K, V, C, A>& lhs,
-     364             :                            const AssocVector<K, V, C, A>& rhs)
-     365             :     { return !(lhs < rhs); }
-     366             : 
-     367             :     template <class K, class V, class C, class A>
-     368             :     inline bool operator<=(const AssocVector<K, V, C, A>& lhs,
-     369             :                            const AssocVector<K, V, C, A>& rhs)
-     370             :     { return !(rhs < lhs); }
-     371             : 
-     372             : 
-     373             :     // specialized algorithms:
-     374             :     template <class K, class V, class C, class A>
-     375             :     void swap(AssocVector<K, V, C, A>& lhs, AssocVector<K, V, C, A>& rhs)
-     376             :     { lhs.swap(rhs); }
-     377             : 
-     378             : } // namespace Loki
-     379             : 
-     380             : #endif // end file guardian
-     381             : 
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Candidate.h.func-sort-c.html b/doc/coverageReport/include/crpropa/Candidate.h.func-sort-c.html deleted file mode 100644 index 311549a2e..000000000 --- a/doc/coverageReport/include/crpropa/Candidate.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Candidate.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Candidate.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Candidate.h.func.html b/doc/coverageReport/include/crpropa/Candidate.h.func.html deleted file mode 100644 index 2a4fbcad6..000000000 --- a/doc/coverageReport/include/crpropa/Candidate.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Candidate.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Candidate.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Candidate.h.gcov.html b/doc/coverageReport/include/crpropa/Candidate.h.gcov.html deleted file mode 100644 index 393563bad..000000000 --- a/doc/coverageReport/include/crpropa/Candidate.h.gcov.html +++ /dev/null @@ -1,258 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Candidate.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Candidate.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_CANDIDATE_H
-       2             : #define CRPROPA_CANDIDATE_H
-       3             : 
-       4             : #include "crpropa/ParticleState.h"
-       5             : #include "crpropa/Referenced.h"
-       6             : #include "crpropa/AssocVector.h"
-       7             : #include "crpropa/Variant.h"
-       8             : 
-       9             : #include <vector>
-      10             : #include <map>
-      11             : #include <sstream>
-      12             : #include <stdint.h>
-      13             : 
-      14             : namespace crpropa {
-      15             : /**
-      16             :  * \addtogroup Core
-      17             :  * @{
-      18             :  */
-      19             : 
-      20             : /**
-      21             :  @class Candidate Candidate.h include/crpropa/Candidate.h
-      22             :  @brief All information about the cosmic ray.
-      23             : 
-      24             :  The Candidate is a passive object, that holds the information about the state
-      25             :  of the cosmic ray and the simulation itself.
-      26             :  */
-      27             : class Candidate: public Referenced {
-      28             : public:
-      29             :         ParticleState source; /**< Particle state at the source */
-      30             :         ParticleState created; /**< Particle state of parent particle at the time of creation */
-      31             :         ParticleState current; /**< Current particle state */
-      32             :         ParticleState previous; /**< Particle state at the end of the previous step */
-      33             : 
-      34             :         std::vector<ref_ptr<Candidate> > secondaries; /**< Secondary particles from interactions */
-      35             : 
-      36             :         typedef Loki::AssocVector<std::string, Variant> PropertyMap;
-      37             :         PropertyMap properties; /**< Map of property names and their values. */
-      38             : 
-      39             :         /** Parent candidate. 0 if no parent (initial particle). Must not be a ref_ptr to prevent circular referencing. */
-      40             :         Candidate *parent;
-      41             : 
-      42             : private:
-      43             :         bool active; /**< Active status */
-      44             :         double weight; /**< Weight of the candidate */
-      45             :         double redshift; /**< Current simulation time-point in terms of redshift z */
-      46             :         double trajectoryLength; /**< Comoving distance [m] the candidate has traveled so far */
-      47             :         double currentStep; /**< Size of the currently performed step in [m] comoving units */
-      48             :         double nextStep; /**< Proposed size of the next propagation step in [m] comoving units */
-      49             :         std::string tagOrigin; /**< Name of interaction/source process which created this candidate*/
-      50             : 
-      51             :         static uint64_t nextSerialNumber;
-      52             :         uint64_t serialNumber;
-      53             : 
-      54             : public:
-      55             :         Candidate(
-      56             :                 int id = 0,
-      57             :                 double energy = 0,
-      58             :                 Vector3d position = Vector3d(0, 0, 0),
-      59             :                 Vector3d direction = Vector3d(-1, 0, 0),
-      60             :                 double z = 0,
-      61             :                 double weight = 1., 
-      62             :                 std::string tagOrigin = "PRIM"
-      63             :         );
-      64             : 
-      65             :         /**
-      66             :          Creates a candidate, initializing the Candidate::source, Candidate::created,
-      67             :          Candidate::previous and Candidate::current state with the argument.
-      68             :          */
-      69             :         Candidate(const ParticleState &state);
-      70             : 
-      71             :         bool isActive() const;
-      72             :         void setActive(bool b);
-      73             : 
-      74             :         void setTrajectoryLength(double length);
-      75             :         double getTrajectoryLength() const;
-      76             : 
-      77             :         void setRedshift(double z);
-      78             :         double getRedshift() const;
-      79             : 
-      80             :         /**
-      81             :          Sets weight of each candidate.
-      82             :          Weights are calculated for each tracked secondary.
-      83             :          */
-      84             :         void setWeight(double weight);
-      85             :     void updateWeight(double weight);
-      86             :         double getWeight() const;
-      87             : 
-      88             :         /**
-      89             :          Sets the current step and increases the trajectory length accordingly.
-      90             :          Only the propagation module should use this.
-      91             :          */
-      92             :         void setCurrentStep(double step);
-      93             :         double getCurrentStep() const;
-      94             : 
-      95             :         /**
-      96             :          Sets the proposed next step.
-      97             :          Only the propagation module should use this.
-      98             :          */
-      99             :         void setNextStep(double step);
-     100             :         double getNextStep() const;
-     101             : 
-     102             :         /**
-     103             :          Sets the tagOrigin of the candidate. Can be used to trace back the interactions
-     104             :          */
-     105             :         void setTagOrigin(std::string tagOrigin);
-     106             :         std::string getTagOrigin() const;
-     107             : 
-     108             :         /**
-     109             :          Make a bid for the next step size: the lowest wins.
-     110             :          */
-     111             :         void limitNextStep(double step);
-     112             : 
-     113             :         void setProperty(const std::string &name, const Variant &value);
-     114             :         const Variant &getProperty(const std::string &name) const;
-     115             :         bool removeProperty(const std::string &name);
-     116             :         bool hasProperty(const std::string &name) const;
-     117             : 
-     118             :         /**
-     119             :          Add a new candidate to the list of secondaries.
-     120             :          @param c Candidate
-     121             : 
-     122             :          Adds a new candidate to the list of secondaries of this candidate.
-     123             :          The secondaries Candidate::source and Candidate::previous state are set to the _source_ and _previous_ state of its parent.
-     124             :          The secondaries Candidate::created and Candidate::current state are set to the _current_ state of its parent, except for the secondaries current energy and particle id.
-     125             :          Trajectory length and redshift are copied from the parent.
-     126             :          */
-     127             :         void addSecondary(Candidate *c);
-     128           4 :         inline void addSecondary(ref_ptr<Candidate> c) { addSecondary(c.get()); };
-     129             :         /**
-     130             :          Add a new candidate to the list of secondaries.
-     131             :          @param id                      particle ID of the secondary
-     132             :          @param energy          energy of the secondary
-     133             :          @param w                       weight of the secondary
-     134             :          @param tagOrigin       tag of the secondary
-     135             :          */
-     136             :         void addSecondary(int id, double energy, double w = 1., std::string tagOrigin = "SEC");
-     137             :         /**
-     138             :          Add a new candidate to the list of secondaries.
-     139             :          @param id                      particle ID of the secondary
-     140             :          @param energy          energy of the secondary
-     141             :          @param position        start position of the secondary
-     142             :          @param w                       weight of the secondary
-     143             :          @param tagOrigin       tag of the secondary
-     144             :          */
-     145             :         void addSecondary(int id, double energy, Vector3d position, double w = 1., std::string tagOrigin = "SEC");
-     146             :         void clearSecondaries();
-     147             : 
-     148             :         std::string getDescription() const;
-     149             : 
-     150             :         /** Unique (inside process) serial number (id) of candidate */
-     151             :         uint64_t getSerialNumber() const;
-     152             :         void setSerialNumber(const uint64_t snr);
-     153             : 
-     154             :         /** Serial number of candidate at source*/
-     155             :         uint64_t getSourceSerialNumber() const;
-     156             : 
-     157             :         /** Serial number of candidate at creation */
-     158             :         uint64_t getCreatedSerialNumber() const;
-     159             : 
-     160             :         /** Set the next serial number to use */
-     161             :         static void setNextSerialNumber(uint64_t snr);
-     162             : 
-     163             :         /** Get the next serial number that will be assigned */
-     164             :         static uint64_t getNextSerialNumber();
-     165             : 
-     166             :         /**
-     167             :          Create an exact clone of candidate
-     168             :          @param recursive       recursively clone and add the secondaries
-     169             :          */
-     170             :         ref_ptr<Candidate> clone(bool recursive = false) const;
-     171             : 
-     172             :         /**
-     173             :          Copy the source particle state to the current state
-     174             :          and activate it if inactive, e.g. restart it
-     175             :         */
-     176             :         void restart();
-     177             : };
-     178             : 
-     179             : /** @}*/
-     180             : } // namespace crpropa
-     181             : 
-     182             : #endif // CRPROPA_CANDIDATE_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Common.h.func-sort-c.html b/doc/coverageReport/include/crpropa/Common.h.func-sort-c.html deleted file mode 100644 index b6011ea62..000000000 --- a/doc/coverageReport/include/crpropa/Common.h.func-sort-c.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Common.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Common.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:1010100.0 %
Date:2024-04-08 14:58:22Functions:22100.0 %
-
- -
- - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa8gaussIntIZNS_20common_gaussInt_Test8TestBodyEvEUldE0_EEdOT_dd1
_ZN7crpropa8gaussIntIZNKS_19PhotoPionProduction7probEpsEdbddEUldE_EEdOT_dd10660
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Common.h.func.html b/doc/coverageReport/include/crpropa/Common.h.func.html deleted file mode 100644 index 480121887..000000000 --- a/doc/coverageReport/include/crpropa/Common.h.func.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Common.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Common.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:1010100.0 %
Date:2024-04-08 14:58:22Functions:22100.0 %
-
- -
- - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa8gaussIntIZNKS_19PhotoPionProduction7probEpsEdbddEUldE_EEdOT_dd10660
_ZN7crpropa8gaussIntIZNS_20common_gaussInt_Test8TestBodyEvEUldE0_EEdOT_dd1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Common.h.gcov.html b/doc/coverageReport/include/crpropa/Common.h.gcov.html deleted file mode 100644 index 13a42780e..000000000 --- a/doc/coverageReport/include/crpropa/Common.h.gcov.html +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Common.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Common.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:1010100.0 %
Date:2024-04-08 14:58:22Functions:22100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_COMMON_H
-       2             : #define CRPROPA_COMMON_H
-       3             : 
-       4             : #include <string>
-       5             : #include <vector>
-       6             : /**
-       7             :  @file
-       8             :  @brief Common helper functions
-       9             :  */
-      10             : 
-      11             : namespace crpropa {
-      12             : /**
-      13             :  * \addtogroup Core
-      14             :  * @{
-      15             :  */
-      16             : 
-      17             : // Returns the full path to a CRPropa data file
-      18             : std::string getDataPath(std::string filename);
-      19             : 
-      20             : // Returns the install prefix
-      21             : std::string getInstallPrefix();
-      22             : 
-      23             : // Returns a certain digit from a given integer
-      24             : inline int digit(const int& value, const int& d) {
-      25        1249 :         return (value % (d * 10)) / d;
-      26             : }
-      27             : 
-      28             : // Return value xclip which is the closest to x, so that lower <= xclip <= upper
-      29             : template <typename T>
-      30             : T clip(const T& x, const T& lower, const T& upper) {
-      31      499341 :         return std::max(lower, std::min(x, upper));
-      32             : }
-      33             : 
-      34             : // Perform linear interpolation on a set of n tabulated data points X[0 .. n-1] -> Y[0 .. n-1]
-      35             : // Returns Y[0] if x < X[0] and Y[n-1] if x > X[n-1]
-      36             : double interpolate(double x, const std::vector<double>& X,
-      37             :                 const std::vector<double>& Y);
-      38             : 
-      39             : 
-      40             : // Perform bilinear interpolation on a set of (n,m) tabulated data points X[0 .. n-1], Y[0 .. m-1] -> Z[0.. n-1*m-1]
-      41             : // Returns 0 if x < X[0] or x > X[n-1] or y < Y[0] or y > Y[m-1]
-      42             : double interpolate2d(double x, double y, const std::vector<double>& X,
-      43             :                 const std::vector<double>& Y, const std::vector<double>& Z);
-      44             : 
-      45             : // Perform linear interpolation on equidistant tabulated data
-      46             : // Returns Y[0] if x < lo and Y[n-1] if x > hi
-      47             : double interpolateEquidistant(double x, double lo, double hi,
-      48             :                 const std::vector<double>& Y);
-      49             : 
-      50             : // Find index of value in a sorted vector X that is closest to x
-      51             : size_t closestIndex(double x, const std::vector<double> &X);
-      52             : /** @}*/
-      53             : 
-      54             : 
-      55             : // pow implementation as template for integer exponents pow_integer<2>(x)
-      56             : // evaluates to x*x
-      57             : template <unsigned int exponent>
-      58             : inline double pow_integer(double base)
-      59             : {
-      60       63069 :   return pow_integer<(exponent >> 1)>(base*base) * (((exponent & 1) > 0) ? base : 1);
-      61             : }
-      62             : 
-      63             : template <>
-      64             : inline double pow_integer<0>(double base)
-      65             : {
-      66             :   return 1;
-      67             : }
-      68             : 
-      69             : // - input:  function over which to integrate, integration limits A and B
-      70             : // - output: 8-points Gauß-Legendre integral
-      71             : static const double X[8] = {.0950125098, .2816035507, .4580167776, .6178762444, .7554044083, .8656312023, .9445750230, .9894009349};
-      72             : static const double W[8] = {.1894506104, .1826034150, .1691565193, .1495959888, .1246289712, .0951585116, .0622535239, .0271524594};
-      73             : template<typename Integrand>
-      74       10661 : double gaussInt(Integrand&& integrand, double A, double B) {
-      75       10661 :         const double XM = 0.5 * (B + A);
-      76       10661 :         const double XR = 0.5 * (B - A);
-      77             :         double SS = 0.;
-      78       95958 :         for (int i = 0; i < 8; ++i) {
-      79       85296 :                 double DX = XR * X[i];
-      80       85296 :                 SS += W[i] * (integrand(XM + DX) + integrand(XM - DX));
-      81             :         }
-      82       10661 :         return XR * SS;
-      83             : }
-      84             : 
-      85             : } // namespace crpropa
-      86             : 
-      87             : #endif // CRPROPA_COMMON_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/EmissionMap.h.func-sort-c.html b/doc/coverageReport/include/crpropa/EmissionMap.h.func-sort-c.html deleted file mode 100644 index a2a1cc9dd..000000000 --- a/doc/coverageReport/include/crpropa/EmissionMap.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/EmissionMap.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - EmissionMap.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/EmissionMap.h.func.html b/doc/coverageReport/include/crpropa/EmissionMap.h.func.html deleted file mode 100644 index fd1749d15..000000000 --- a/doc/coverageReport/include/crpropa/EmissionMap.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/EmissionMap.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - EmissionMap.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/EmissionMap.h.gcov.html b/doc/coverageReport/include/crpropa/EmissionMap.h.gcov.html deleted file mode 100644 index deeb84f2e..000000000 --- a/doc/coverageReport/include/crpropa/EmissionMap.h.gcov.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/EmissionMap.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - EmissionMap.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_EMISSION_MAP_H
-       2             : #define CRPROPA_EMISSION_MAP_H
-       3             : 
-       4             : #include "Referenced.h"
-       5             : #include "Candidate.h"
-       6             : 
-       7             : namespace crpropa {
-       8             : 
-       9             : /**
-      10             :  @class CylindricalProjectionMap
-      11             :  @brief 2D histogram of spherical coordinates in equal-area projection
-      12             :  */
-      13             : class CylindricalProjectionMap : public Referenced {
-      14             : private:
-      15             :         size_t nPhi, nTheta;
-      16             :         double sPhi, sTheta;
-      17             :         mutable bool dirty;
-      18             :         std::vector<double> pdf;
-      19             :         mutable std::vector<double> cdf;
-      20             : 
-      21             :         /** Calculate the cdf from the pdf */
-      22             :         void updateCdf() const;
-      23             : 
-      24             : public:
-      25             :         CylindricalProjectionMap();
-      26             :         /** constructur
-      27             :          * @param nPhi number of bins for phi (0-2pi)
-      28             :          * @param nTheta number of bins for theta (0-pi)
-      29             :          */
-      30             :         CylindricalProjectionMap(size_t nPhi, size_t nTheta);
-      31             : 
-      32             :         /** Increment the bin value in direction by weight. */
-      33             :         void fillBin(const Vector3d& direction, double weight = 1.);
-      34             : 
-      35             :         /** Increment the bin value by weight. */
-      36             :         void fillBin(size_t bin, double weight = 1.);
-      37             : 
-      38             :         /** Draw a random vector from the distribution. */
-      39             :         Vector3d drawDirection() const;
-      40             : 
-      41             :         /** Check if the direction has a non zero propabiliy. */
-      42             :         bool checkDirection(const Vector3d &direction) const;
-      43             : 
-      44             :         const std::vector<double>& getPdf() const;
-      45             :         std::vector<double>& getPdf();
-      46             : 
-      47             :         const std::vector<double>& getCdf() const;
-      48             : 
-      49             :         size_t getNPhi();
-      50             :         size_t getNTheta();
-      51             : 
-      52             :         /** Calculate the bin from a direction */
-      53             :         size_t binFromDirection(const Vector3d& direction) const;
-      54             : 
-      55             :         /** Calculate a random vector inside the bin boundaries */
-      56             :         Vector3d directionFromBin(size_t bin) const;
-      57             : };
-      58             : 
-      59             : /**
-      60             :  @class EmissionMap
-      61             :  @brief Particle Type and energy binned emission maps.
-      62             : 
-      63             :  Use SourceEmissionMap to suppress directions at the source. Use EmissionMapFiller to create EmissionMap from Observer.
-      64             :  */
-      65           2 : class EmissionMap : public Referenced {
-      66             : public:
-      67             :         typedef std::pair<int, size_t> key_t;
-      68             :         typedef std::map<key_t, ref_ptr<CylindricalProjectionMap> > map_t;
-      69             : 
-      70             :         EmissionMap();
-      71             :         /**
-      72             :          * @param nPhi number of bins for phi (0-2pi)
-      73             :          * @param nTheta number of bins for theta (0-pi)
-      74             :          * @param nEnergy number of bins for energy (1e-4 - 1e4 EeV)
-      75             :          */
-      76             :         EmissionMap(size_t nPhi, size_t nTheta, size_t nEnergy);
-      77             : 
-      78             :         /**
-      79             :          * @param nPhi number of bins for phi (0-2pi)
-      80             :          * @param nTheta number of bins for theta (0-pi)
-      81             :          * @param nEnergy number of bins for energy (1e-4 - 1e4 EeV)
-      82             :          * @param minEnergy minimum energy for binning
-      83             :          * @param maxEnergy maximum energy for binning
-      84             :          */
-      85             :         EmissionMap(size_t nPhi, size_t nTheta, size_t nEnergy, double minEnergy, double maxEnergy);
-      86             : 
-      87             :         /** Calculate energy from bin */
-      88             :         double energyFromBin(size_t bin) const;
-      89             : 
-      90             :         /** Calculate bin from energy */
-      91             :         size_t binFromEnergy(double energy) const;
-      92             : 
-      93             :         map_t &getMaps();
-      94             :         const map_t &getMaps() const;
-      95             : 
-      96             :         /** Increment the value for particle type, energy and direction by weight. */
-      97             :         void fillMap(int pid, double energy, const Vector3d& direction, double weight = 1.);
-      98             :         /** Increment the value for the particle state by weight. */
-      99             :         void fillMap(const ParticleState& state, double weight = 1.);
-     100             : 
-     101             :         /** Draw a random vector from the distribution. */
-     102             :         bool drawDirection(int pid, double energy, Vector3d& direction) const;
-     103             :         /** Draw a random vector from the distribution. */
-     104             :         bool drawDirection(const ParticleState& state, Vector3d& direction) const;
-     105             : 
-     106             :         /** Check if the direction has a non zero propabiliy. */
-     107             :         bool checkDirection(int pid, double energy, const Vector3d& direction) const;
-     108             :         /** Check if the direction has a non zero propabiliy. */
-     109             :         bool checkDirection(const ParticleState& state) const;
-     110             : 
-     111             :         /** Check if a valid map exists */
-     112             :         bool hasMap(int pid, double energy);
-     113             : 
-     114             :         /** Get the map for the specified pid and energy */
-     115             :         ref_ptr<CylindricalProjectionMap> getMap(int pid, double energy);
-     116             : 
-     117             :         /** Save the content of the maps into a text file */
-     118             :         void save(const std::string &filename);
-     119             :         /** Load the content of the maps from a text file */
-     120             :         void load(const std::string &filename);
-     121             : 
-     122             :         /** Merge other maps, add pdfs */
-     123             :         void merge(const EmissionMap *other);
-     124             : 
-     125             :         /** Merge maps from file */
-     126             :         void merge(const std::string &filename);
-     127             : 
-     128             : protected:
-     129             :         double minEnergy, maxEnergy, logStep;
-     130             :         size_t nPhi, nTheta, nEnergy;
-     131             :         map_t maps;
-     132             : };
-     133             : 
-     134             : } // namespace crpropa
-     135             : 
-     136             : #endif // CRPROPA_EMISSION_MAP_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Geometry.h.func-sort-c.html b/doc/coverageReport/include/crpropa/Geometry.h.func-sort-c.html deleted file mode 100644 index 6b4cfc036..000000000 --- a/doc/coverageReport/include/crpropa/Geometry.h.func-sort-c.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Geometry.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Geometry.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:3475.0 %
Date:2024-04-08 14:58:22Functions:010.0 %
-
- -
- - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa7Surface14getDescriptionB5cxx11Ev0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Geometry.h.func.html b/doc/coverageReport/include/crpropa/Geometry.h.func.html deleted file mode 100644 index 9e2e188ad..000000000 --- a/doc/coverageReport/include/crpropa/Geometry.h.func.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Geometry.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Geometry.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:3475.0 %
Date:2024-04-08 14:58:22Functions:010.0 %
-
- -
- - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa7Surface14getDescriptionB5cxx11Ev0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Geometry.h.gcov.html b/doc/coverageReport/include/crpropa/Geometry.h.gcov.html deleted file mode 100644 index f7e267162..000000000 --- a/doc/coverageReport/include/crpropa/Geometry.h.gcov.html +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Geometry.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Geometry.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:3475.0 %
Date:2024-04-08 14:58:22Functions:010.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_GEOMETRY_H
-       2             : #define CRPROPA_GEOMETRY_H
-       3             : 
-       4             : #include <vector>
-       5             : #include <string>
-       6             : 
-       7             : #include "crpropa/Candidate.h"
-       8             : #include "crpropa/Vector3.h"
-       9             : #include "crpropa/Referenced.h"
-      10             : 
-      11             : namespace crpropa {
-      12             : /**
-      13             :  * \addtogroup Core
-      14             :  * @{
-      15             :  */
-      16             : 
-      17             : /**
-      18             :  @class Surface
-      19             :  @brief A geometrical surface
-      20             : 
-      21             :  Defines a surface. Can be queried if the candidate has crossed the surface in the last step.
-      22             :  */
-      23             : class Surface : public Referenced {
-      24             : public:
-      25             :         /** Returns the distance of a point to the surface. Negative on the one side,
-      26             :          positive on the other. For closed surfaces it is negative on the inside.
-      27             :          @param point   vector corresponding to the point to which compute the distance
-      28             :          */
-      29             :         virtual double distance(const Vector3d& point) const = 0;
-      30             :         /**  Returns the normal to the surface at a point. Negative on the one side,
-      31             :          positive on the other. For closed surfaces it is negative on the inside.
-      32             :          @param point   vector corresponding to the point to which compute the normal vector
-      33             :          */
-      34             :         virtual Vector3d normal(const Vector3d& point) const = 0;
-      35           0 :         virtual std::string getDescription() const {return "Surface without description.";};
-      36             : };
-      37             : 
-      38             : 
-      39             : /**
-      40             :  @class Plane
-      41             :  @brief A plane given by a point x0 and two axes v1 and v2 with normal n = v1.cross(v2) or the normal n. Note that distance is negative on one side of the plane and positive on the other, depending on the orientation of the normal vector.
-      42             :  */
-      43           1 : class Plane: public Surface {
-      44             : private:
-      45             :         Vector3d x0, n;
-      46             : public:
-      47             :         Plane(const Vector3d& x0, const Vector3d& v1,const Vector3d& v2);
-      48             :         Plane(const Vector3d& x0, const Vector3d& n);
-      49             :         virtual double distance(const Vector3d &x) const;
-      50             :         virtual Vector3d normal(const Vector3d& point) const;
-      51             :         virtual std::string getDescription() const;
-      52             : };
-      53             : 
-      54             : 
-      55             : /**
-      56             :  @class Sphere
-      57             :  @brief A sphere around point _center with radius _radius.
-      58             :  */
-      59           1 : class Sphere: public Surface {
-      60             : private:
-      61             :         Vector3d center;
-      62             :         double radius;
-      63             : public:
-      64             :         Sphere(const Vector3d& center, double radius);
-      65             :         virtual double distance(const Vector3d &point) const;
-      66             :         virtual Vector3d normal(const Vector3d& point) const;
-      67             :         virtual std::string getDescription() const;
-      68             : };
-      69             : 
-      70             : 
-      71             : /**
-      72             :  @class ParaxialBox
-      73             :  @brief A box with perpendicular surfaces aligned to the x,y,z-axes.
-      74             :  */
-      75           1 : class ParaxialBox: public Surface {
-      76             : private:
-      77             :         Vector3d corner, size;
-      78             : public:
-      79             :         ParaxialBox(const Vector3d& corner, const Vector3d& size);
-      80             :         virtual double distance(const Vector3d &point) const;
-      81             :         virtual Vector3d normal(const Vector3d& point) const;
-      82             :         virtual std::string getDescription() const;
-      83             : };
-      84             : 
-      85             : 
-      86             : /** @}*/
-      87             : } // namespace crpropa
-      88             : 
-      89             : #endif // CRPROPA_GEOMETRY_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Grid.h.func-sort-c.html b/doc/coverageReport/include/crpropa/Grid.h.func-sort-c.html deleted file mode 100644 index 3c651a9f5..000000000 --- a/doc/coverageReport/include/crpropa/Grid.h.func-sort-c.html +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Grid.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Grid.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:17319588.7 %
Date:2024-04-08 14:58:22Functions:235641.1 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa14GridPropertiesD2Ev0
_ZN7crpropa4GridINS_7Vector3IdEEE11interpolateERKS2_0
_ZN7crpropa4GridINS_7Vector3IdEEE11setGridSizeEmmm0
_ZN7crpropa4GridINS_7Vector3IdEEE20setInterpolationTypeENS_17interpolationTypeE0
_ZN7crpropa4GridINS_7Vector3IdEEEC2ERKNS_14GridPropertiesE0
_ZN7crpropa4GridINS_7Vector3IdEEEC2ES2_md0
_ZN7crpropa4GridINS_7Vector3IdEEEC2ES2_mmmS2_0
_ZN7crpropa4GridINS_7Vector3IdEEEC2ES2_mmmd0
_ZN7crpropa4GridINS_7Vector3IfEEE20setInterpolationTypeENS_17interpolationTypeE0
_ZN7crpropa4GridINS_7Vector3IfEEEC2ENS1_IdEEmmmS4_0
_ZN7crpropa4GridIdE11interpolateERKNS_7Vector3IdEE0
_ZN7crpropa4GridIdE11setGridSizeEmmm0
_ZN7crpropa4GridIdE20setInterpolationTypeENS_17interpolationTypeE0
_ZN7crpropa4GridIdEC2ENS_7Vector3IdEEmd0
_ZN7crpropa4GridIdEC2ENS_7Vector3IdEEmmmS3_0
_ZN7crpropa4GridIdEC2ENS_7Vector3IdEEmmmd0
_ZN7crpropa4GridIdEC2ERKNS_14GridPropertiesE0
_ZN7crpropa4GridIfE20setInterpolationTypeENS_17interpolationTypeE0
_ZNK7crpropa4GridINS_7Vector3IdEEE12closestValueERKS2_0
_ZNK7crpropa4GridINS_7Vector3IdEEE13reflectiveGetEmmm0
_ZNK7crpropa4GridINS_7Vector3IdEEE17positionFromIndexEi0
_ZNK7crpropa4GridINS_7Vector3IdEEE17simdreflectiveGetEmmm0
_ZNK7crpropa4GridINS_7Vector3IdEEE19tricubicInterpolateENS1_IfEERKS2_0
_ZNK7crpropa4GridINS_7Vector3IdEEE20trilinearInterpolateERKS2_0
_ZNK7crpropa4GridINS_7Vector3IfEEE13reflectiveGetEmmm0
_ZNK7crpropa4GridINS_7Vector3IfEEE17positionFromIndexEi0
_ZNK7crpropa4GridIdE12closestValueERKNS_7Vector3IdEE0
_ZNK7crpropa4GridIdE13reflectiveGetEmmm0
_ZNK7crpropa4GridIdE17positionFromIndexEi0
_ZNK7crpropa4GridIdE19tricubicInterpolateEdRKNS_7Vector3IdEE0
_ZNK7crpropa4GridIdE20trilinearInterpolateERKNS_7Vector3IdEE0
_ZNK7crpropa4GridIdE22CubicInterpolateScalarEddddd0
_ZNK7crpropa4GridIfE13reflectiveGetEmmm0
_ZN7crpropa4GridINS_7Vector3IfEEEC2ENS1_IdEEmmmd1
_ZN7crpropa4GridIfEC2ENS_7Vector3IdEEmmmS3_1
_ZN7crpropa14GridPropertiesD0Ev2
_ZN7crpropa4GridIfEC2ENS_7Vector3IdEEmd2
_ZN7crpropa4GridIfEC2ERKNS_14GridPropertiesE3
_ZNK7crpropa4GridIfE19tricubicInterpolateEdRKNS_7Vector3IdEE3
_ZN7crpropa4GridINS_7Vector3IfEEEC2ERKNS_14GridPropertiesE6
_ZN7crpropa4GridIfEC2ENS_7Vector3IdEEmmmd6
_ZNK7crpropa4GridIfE12closestValueERKNS_7Vector3IdEE7
_ZN7crpropa4GridINS_7Vector3IfEEEC2ENS1_IdEEmd9
_ZNK7crpropa4GridIfE20trilinearInterpolateERKNS_7Vector3IdEE9
_ZNK7crpropa4GridINS_7Vector3IfEEE12closestValueERKNS1_IdEE10
_ZN7crpropa4GridIfE11setGridSizeEmmm12
_ZNK7crpropa4GridINS_7Vector3IfEEE19tricubicInterpolateES2_RKNS1_IdEE15
_ZN7crpropa4GridINS_7Vector3IfEEE11setGridSizeEmmm16
_ZN7crpropa4GridIfE11interpolateERKNS_7Vector3IdEE18
_ZN7crpropa15reflectiveClampEdiRiS0_Rd20
_ZN7crpropa5roundEd51
_ZNK7crpropa4GridIfE22CubicInterpolateScalarEddddd63
_ZNK7crpropa4GridINS_7Vector3IfEEE17simdreflectiveGetEmmm384
_ZNK7crpropa4GridIfE17positionFromIndexEi10103
_ZNK7crpropa4GridINS_7Vector3IfEEE20trilinearInterpolateERKNS1_IdEE100046
_ZN7crpropa4GridINS_7Vector3IfEEE11interpolateERKNS1_IdEE100073
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Grid.h.func.html b/doc/coverageReport/include/crpropa/Grid.h.func.html deleted file mode 100644 index 0b9457ac3..000000000 --- a/doc/coverageReport/include/crpropa/Grid.h.func.html +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Grid.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Grid.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:17319588.7 %
Date:2024-04-08 14:58:22Functions:235641.1 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa14GridPropertiesD0Ev2
_ZN7crpropa14GridPropertiesD2Ev0
_ZN7crpropa15reflectiveClampEdiRiS0_Rd20
_ZN7crpropa4GridINS_7Vector3IdEEE11interpolateERKS2_0
_ZN7crpropa4GridINS_7Vector3IdEEE11setGridSizeEmmm0
_ZN7crpropa4GridINS_7Vector3IdEEE20setInterpolationTypeENS_17interpolationTypeE0
_ZN7crpropa4GridINS_7Vector3IdEEEC2ERKNS_14GridPropertiesE0
_ZN7crpropa4GridINS_7Vector3IdEEEC2ES2_md0
_ZN7crpropa4GridINS_7Vector3IdEEEC2ES2_mmmS2_0
_ZN7crpropa4GridINS_7Vector3IdEEEC2ES2_mmmd0
_ZN7crpropa4GridINS_7Vector3IfEEE11interpolateERKNS1_IdEE100073
_ZN7crpropa4GridINS_7Vector3IfEEE11setGridSizeEmmm16
_ZN7crpropa4GridINS_7Vector3IfEEE20setInterpolationTypeENS_17interpolationTypeE0
_ZN7crpropa4GridINS_7Vector3IfEEEC2ENS1_IdEEmd9
_ZN7crpropa4GridINS_7Vector3IfEEEC2ENS1_IdEEmmmS4_0
_ZN7crpropa4GridINS_7Vector3IfEEEC2ENS1_IdEEmmmd1
_ZN7crpropa4GridINS_7Vector3IfEEEC2ERKNS_14GridPropertiesE6
_ZN7crpropa4GridIdE11interpolateERKNS_7Vector3IdEE0
_ZN7crpropa4GridIdE11setGridSizeEmmm0
_ZN7crpropa4GridIdE20setInterpolationTypeENS_17interpolationTypeE0
_ZN7crpropa4GridIdEC2ENS_7Vector3IdEEmd0
_ZN7crpropa4GridIdEC2ENS_7Vector3IdEEmmmS3_0
_ZN7crpropa4GridIdEC2ENS_7Vector3IdEEmmmd0
_ZN7crpropa4GridIdEC2ERKNS_14GridPropertiesE0
_ZN7crpropa4GridIfE11interpolateERKNS_7Vector3IdEE18
_ZN7crpropa4GridIfE11setGridSizeEmmm12
_ZN7crpropa4GridIfE20setInterpolationTypeENS_17interpolationTypeE0
_ZN7crpropa4GridIfEC2ENS_7Vector3IdEEmd2
_ZN7crpropa4GridIfEC2ENS_7Vector3IdEEmmmS3_1
_ZN7crpropa4GridIfEC2ENS_7Vector3IdEEmmmd6
_ZN7crpropa4GridIfEC2ERKNS_14GridPropertiesE3
_ZN7crpropa5roundEd51
_ZNK7crpropa4GridINS_7Vector3IdEEE12closestValueERKS2_0
_ZNK7crpropa4GridINS_7Vector3IdEEE13reflectiveGetEmmm0
_ZNK7crpropa4GridINS_7Vector3IdEEE17positionFromIndexEi0
_ZNK7crpropa4GridINS_7Vector3IdEEE17simdreflectiveGetEmmm0
_ZNK7crpropa4GridINS_7Vector3IdEEE19tricubicInterpolateENS1_IfEERKS2_0
_ZNK7crpropa4GridINS_7Vector3IdEEE20trilinearInterpolateERKS2_0
_ZNK7crpropa4GridINS_7Vector3IfEEE12closestValueERKNS1_IdEE10
_ZNK7crpropa4GridINS_7Vector3IfEEE13reflectiveGetEmmm0
_ZNK7crpropa4GridINS_7Vector3IfEEE17positionFromIndexEi0
_ZNK7crpropa4GridINS_7Vector3IfEEE17simdreflectiveGetEmmm384
_ZNK7crpropa4GridINS_7Vector3IfEEE19tricubicInterpolateES2_RKNS1_IdEE15
_ZNK7crpropa4GridINS_7Vector3IfEEE20trilinearInterpolateERKNS1_IdEE100046
_ZNK7crpropa4GridIdE12closestValueERKNS_7Vector3IdEE0
_ZNK7crpropa4GridIdE13reflectiveGetEmmm0
_ZNK7crpropa4GridIdE17positionFromIndexEi0
_ZNK7crpropa4GridIdE19tricubicInterpolateEdRKNS_7Vector3IdEE0
_ZNK7crpropa4GridIdE20trilinearInterpolateERKNS_7Vector3IdEE0
_ZNK7crpropa4GridIdE22CubicInterpolateScalarEddddd0
_ZNK7crpropa4GridIfE12closestValueERKNS_7Vector3IdEE7
_ZNK7crpropa4GridIfE13reflectiveGetEmmm0
_ZNK7crpropa4GridIfE17positionFromIndexEi10103
_ZNK7crpropa4GridIfE19tricubicInterpolateEdRKNS_7Vector3IdEE3
_ZNK7crpropa4GridIfE20trilinearInterpolateERKNS_7Vector3IdEE9
_ZNK7crpropa4GridIfE22CubicInterpolateScalarEddddd63
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Grid.h.gcov.html b/doc/coverageReport/include/crpropa/Grid.h.gcov.html deleted file mode 100644 index cad5f1688..000000000 --- a/doc/coverageReport/include/crpropa/Grid.h.gcov.html +++ /dev/null @@ -1,640 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Grid.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Grid.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:17319588.7 %
Date:2024-04-08 14:58:22Functions:235641.1 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_GRID_H
-       2             : #define CRPROPA_GRID_H
-       3             : 
-       4             : #include "crpropa/Referenced.h"
-       5             : #include "crpropa/Vector3.h"
-       6             : 
-       7             : #include "kiss/string.h"
-       8             : #include "kiss/logger.h"
-       9             : 
-      10             : #include <vector>
-      11             : #include <type_traits>
-      12             : #if HAVE_SIMD
-      13             : #include <immintrin.h>
-      14             : #include <smmintrin.h>
-      15             : #endif // HAVE_SIMD
-      16             : 
-      17             : namespace crpropa {
-      18             : 
-      19             : /** If set to TRILINEAR, use trilinear interpolation (standard)
-      20             : If set to TRICUBIC, use tricubic interpolation instead of trilinear interpolation
-      21             : If set to NEAREST_NEIGHBOUR , use nearest neighbour interpolation instead of trilinear interpolation */
-      22             : enum interpolationType {
-      23             :   TRILINEAR = 0,
-      24             :   TRICUBIC,
-      25             :   NEAREST_NEIGHBOUR
-      26             : };
-      27             : 
-      28             : /** Lower and upper neighbour in a periodically continued unit grid */
-      29             : inline void periodicClamp(double x, int n, int &lo, int &hi) {
-      30      100051 :         lo = ((int(floor(x)) % (n)) + (n)) % (n);
-      31          10 :         hi = (lo + 1) % (n);
-      32             : }
-      33             : 
-      34             : /** grid index in a reflective continued unit grid */
-      35             : inline int reflectiveBoundary(int index, int n) {
-      36        1963 :         while ((index < -0.5) or (index > (n-0.5)))
-      37         806 :                 index = 2 * n * (index > (n-0.5)) - index-1;
-      38             :         return index;
-      39             : }
-      40             : 
-      41             : /** grid index in a periodically continued unit grid */
-      42             : inline int periodicBoundary(int index, int n) {
-      43         768 :         return ((index % (n)) + (n)) % (n);
-      44             : }
-      45             : 
-      46             : /** Lower and upper neighbour in a reflectively repeated unit grid */
-      47          20 : inline void reflectiveClamp(double x, int n, int &lo, int &hi, double &res) {
-      48          36 :         while ((x < -0.5) or (x > (n-0.5)))
-      49          16 :                 x = 2 * n * (x > (n-0.5)) -x-1;
-      50          20 :         res = x;
-      51          20 :         lo = floor(x);
-      52          20 :         hi = lo + (lo < n-1);
-      53          20 :         if (x<0) {
-      54          10 :                 lo=0; 
-      55          10 :                 hi=0;
-      56             :         }
-      57          20 : }
-      58             : 
-      59             : /** Symmetrical round */
-      60          51 : inline double round(double r) {
-      61          51 :         return (r > 0.0) ? floor(r + 0.5) : ceil(r - 0.5);
-      62             : }
-      63             : 
-      64             : /**
-      65             :  * \addtogroup Core
-      66             :  * @{
-      67             :  */
-      68             : 
-      69             : /**
-      70             :  @class GridProperties
-      71             :  @brief Combines parameters that uniquely define Grid class
-      72             :  */
-      73             : class GridProperties: public Referenced {
-      74             : public:
-      75             :         size_t Nx, Ny, Nz;      // Number of grid points
-      76             :         Vector3d origin;        // Position of the lower left front corner of the volume
-      77             :         Vector3d spacing;       // Spacing vector between gridpoints
-      78             :         bool reflective;        // using reflective repetition of the grid instead of periodic
-      79             :         interpolationType ipol; // Interpolation type used between grid points
-      80             :         bool clipVolume;        // Set grid values to 0 outside the volume if true
-      81             : 
-      82             :         /** Constructor for cubic grid
-      83             :          @param origin  Position of the lower left front corner of the volume
-      84             :          @param N               Number of grid points in one direction
-      85             :          @param spacing Spacing between grid points
-      86             :          */
-      87           6 :         GridProperties(Vector3d origin, size_t N, double spacing) :
-      88           6 :                 origin(origin), Nx(N), Ny(N), Nz(N), spacing(Vector3d(spacing)), reflective(false), ipol(TRILINEAR), clipVolume(false) {
-      89             :         }
-      90             : 
-      91             :         /** Constructor for non-cubic grid
-      92             :          @param origin  Position of the lower left front corner of the volume
-      93             :          @param Nx              Number of grid points in x-direction
-      94             :          @param Ny              Number of grid points in y-direction
-      95             :          @param Nz              Number of grid points in z-direction
-      96             :          @param spacing Spacing between grid points
-      97             :          */
-      98           0 :         GridProperties(Vector3d origin, size_t Nx, size_t Ny, size_t Nz, double spacing) :
-      99           0 :                 origin(origin), Nx(Nx), Ny(Ny), Nz(Nz), spacing(Vector3d(spacing)), reflective(false), ipol(TRILINEAR), clipVolume(false) {
-     100             :         }
-     101             : 
-     102             :         /** Constructor for non-cubic grid with spacing vector
-     103             :          @param origin  Position of the lower left front corner of the volume
-     104             :          @param Nx              Number of grid points in x-direction
-     105             :          @param Ny              Number of grid points in y-direction
-     106             :          @param Nz              Number of grid points in z-direction
-     107             :          @param spacing Spacing vector between grid points
-     108             :         */
-     109           1 :         GridProperties(Vector3d origin, size_t Nx, size_t Ny, size_t Nz, Vector3d spacing) :
-     110           1 :                 origin(origin), Nx(Nx), Ny(Ny), Nz(Nz), spacing(spacing), reflective(false), ipol(TRILINEAR), clipVolume(false) {
-     111             :         }
-     112             :         
-     113           2 :         virtual ~GridProperties() {
-     114           4 :         }
-     115             :         
-     116             :         /** If True, the repetition of the grid is refletive instead of periodic. */
-     117             :         void setReflective(bool b) {
-     118           0 :                 reflective = b;
-     119             :         }
-     120             : 
-     121             :         /** set the type of interpolation between grid points.
-     122             :          * @param i: interpolationType (TRILINEAR, TRICUBIC, NEAREST_NEIGHBOUR) */
-     123             :         void setInterpolationType(interpolationType i) {
-     124           0 :                 ipol = i;
-     125             :         }
-     126             : 
-     127             :         /** If True, the grid is set to zero outside of the volume. */
-     128             :         void setClipVolume(bool b) {
-     129           0 :                 clipVolume = b;
-     130             :         }
-     131             : };
-     132             : 
-     133             : /**
-     134             :  @class Grid
-     135             :  @brief Template class for fields on a periodic grid with trilinear interpolation
-     136             : 
-     137             :  The grid spacing is constant with diffrent resolution along all three axes.
-     138             :  Values are calculated by trilinear interpolation of the surrounding 8 grid points.
-     139             :  The grid is periodically (default) or reflectively extended.
-     140             :  The grid sample positions are at 1/2 * size/N, 3/2 * size/N ... (2N-1)/2 * size/N.
-     141             :  */
-     142             : template<typename T>
-     143          17 : class Grid: public Referenced {
-     144             :         std::vector<T> grid;
-     145             :         size_t Nx, Ny, Nz; /**< Number of grid points */
-     146             :         Vector3d origin; /**< Origin of the volume that is represented by the grid. */
-     147             :         Vector3d gridOrigin; /**< Grid origin */
-     148             :         Vector3d spacing; /**< Distance between grid points, determines the extension of the grid */
-     149             :         bool clipVolume; /**< If set to true, all values outside of the grid will be 0*/
-     150             :         bool reflective; /**< If set to true, the grid is repeated reflectively instead of periodically */
-     151             :         interpolationType ipolType; /**< Type of interpolation between the grid points */
-     152             : 
-     153             : public:
-     154             :         /** Constructor for cubic grid
-     155             :          @param origin  Position of the lower left front corner of the volume
-     156             :          @param N               Number of grid points in one direction
-     157             :          @param spacing Spacing between grid points
-     158             :          */
-     159          11 :         Grid(Vector3d origin, size_t N, double spacing) {
-     160             :                 setOrigin(origin);
-     161          11 :                 setGridSize(N, N, N);
-     162             :                 setSpacing(Vector3d(spacing));
-     163             :                 setReflective(false);
-     164             :                 setClipVolume(false);
-     165             :                 setInterpolationType(TRILINEAR);
-     166          11 :         }
-     167             : 
-     168             :         /** Constructor for non-cubic grid
-     169             :          @param origin  Position of the lower left front corner of the volume
-     170             :          @param Nx              Number of grid points in x-direction
-     171             :          @param Ny              Number of grid points in y-direction
-     172             :          @param Nz              Number of grid points in z-direction
-     173             :          @param spacing Spacing between grid points
-     174             :          */
-     175           7 :         Grid(Vector3d origin, size_t Nx, size_t Ny, size_t Nz, double spacing) {
-     176             :                 setOrigin(origin);
-     177           7 :                 setGridSize(Nx, Ny, Nz);
-     178             :                 setSpacing(Vector3d(spacing));
-     179             :                 setReflective(false);
-     180             :                 setClipVolume(false);
-     181             :                 setInterpolationType(TRILINEAR);
-     182           7 :         }
-     183             : 
-     184             :         /** Constructor for non-cubic grid with spacing vector
-     185             :          @param origin  Position of the lower left front corner of the volume
-     186             :          @param Nx              Number of grid points in x-direction
-     187             :          @param Ny              Number of grid points in y-direction
-     188             :          @param Nz              Number of grid points in z-direction
-     189             :          @param spacing Spacing vector between grid points
-     190             :         */
-     191           1 :         Grid(Vector3d origin, size_t Nx, size_t Ny, size_t Nz, Vector3d spacing) {
-     192             :                 setOrigin(origin);
-     193           1 :                 setGridSize(Nx, Ny, Nz);
-     194             :                 setSpacing(spacing);
-     195             :                 setReflective(false);
-     196             :                 setClipVolume(false);
-     197             :                 setInterpolationType(TRILINEAR);
-     198           1 :         }
-     199             : 
-     200             :         /** Constructor for GridProperties
-     201             :          @param p       GridProperties instance
-     202             :      */
-     203           9 :         Grid(const GridProperties &p) :
-     204           9 :                 origin(p.origin), spacing(p.spacing), reflective(p.reflective), ipolType(p.ipol) {
-     205           9 :                 setGridSize(p.Nx, p.Ny, p.Nz);
-     206           9 :                 setClipVolume(p.clipVolume);
-     207           9 :         }
-     208             : 
-     209             :         void setOrigin(Vector3d origin) {
-     210             :                 this->origin = origin;
-     211             :                 this->gridOrigin = origin + spacing/2;
-     212             :         }
-     213             : 
-     214             :         /** Resize grid, also enlarges the volume as the spacing stays constant */
-     215          28 :         void setGridSize(size_t Nx, size_t Ny, size_t Nz) {
-     216          28 :                 this->Nx = Nx;
-     217          28 :                 this->Ny = Ny;
-     218          28 :                 this->Nz = Nz;
-     219          28 :                 grid.resize(Nx * Ny * Nz);
-     220             :                 setOrigin(origin);
-     221          28 :         }
-     222             : 
-     223             :         void setSpacing(Vector3d spacing) {
-     224             :                 this->spacing = spacing;
-     225             :                 setOrigin(origin);
-     226             :         }
-     227             : 
-     228             :         void setReflective(bool b) {
-     229           8 :                 reflective = b;
-     230             :         }
-     231             : 
-     232             :         // If set to true, all values outside of the grid will be 0.
-     233             :         void setClipVolume(bool b) {
-     234          21 :                 clipVolume = b;
-     235             :         }
-     236             : 
-     237             :         /** Change the interpolation type to the routine specified by the user. Check if this routine is
-     238             :                 contained in the enum interpolationType and thus supported by CRPropa.*/
-     239           0 :         void setInterpolationType(interpolationType ipolType) {
-     240           0 :                 if (ipolType == TRILINEAR || ipolType == TRICUBIC || ipolType == NEAREST_NEIGHBOUR) {
-     241          30 :                         this->ipolType = ipolType;
-     242           0 :                         if ((ipolType == TRICUBIC) && (std::is_same<T, Vector3d>::value)) {
-     243           0 :                                 KISS_LOG_WARNING << "Tricubic interpolation on Grid3d works only with float-precision, doubles will be downcasted";
-     244             :                 }
-     245             :                 } else {
-     246           0 :                         throw std::runtime_error("InterpolationType: unknown interpolation type");
-     247             :                 }
-     248           0 :         }
-     249             : 
-     250             :         /** returns the position of the lower left front corner of the volume */
-     251             :         Vector3d getOrigin() const {
-     252             :                 return origin;
-     253             :         }
-     254             : 
-     255             :         bool getClipVolume() const {
-     256           0 :                 return clipVolume;
-     257             :         }
-     258             : 
-     259             :         size_t getNx() const {
-     260         728 :                 return Nx;
-     261             :         }
-     262             : 
-     263             :         size_t getNy() const {
-     264       41792 :                 return Ny;
-     265             :         }
-     266             : 
-     267             :         size_t getNz() const {
-     268     2663721 :                 return Nz;
-     269             :         }
-     270             : 
-     271             :         /** Calculates the total size of the grid in bytes */
-     272             :         size_t getSizeOf() const {
-     273           0 :                 return sizeof(grid) + (sizeof(grid[0]) * grid.size());
-     274             :         }
-     275             : 
-     276             :         Vector3d getSpacing() const {
-     277             :                 return spacing;
-     278             :         }
-     279             : 
-     280             :         bool isReflective() const {
-     281           0 :                 return reflective;
-     282             :         }
-     283             : 
-     284             :         /** Choose the interpolation algorithm based on the set interpolation type.
-     285             :           By default this it the trilinear interpolation. The user can change the
-     286             :           routine with the setInterpolationType function.*/
-     287      100091 :         T interpolate(const Vector3d &position) {
-     288             :                 // check for volume
-     289      100091 :                 if (clipVolume) {
-     290           5 :                         Vector3d edge = origin + Vector3d(Nx, Ny, Nz) * spacing;
-     291           5 :                         bool isInVolume = (position.x >= origin.x) && (position.x <= edge.x);
-     292           5 :                         isInVolume &= (position.y >= origin.y) && (position.y <= edge.y);
-     293           5 :                         isInVolume &= (position.z >= origin.z) && (position.z <= edge.z);
-     294           5 :                         if (!isInVolume) 
-     295             :                                 return T(0.);
-     296             :                 } 
-     297             : 
-     298      100086 :                 if (ipolType == TRICUBIC)
-     299          18 :                         return tricubicInterpolate(T(), position);
-     300      100068 :                 else if (ipolType == NEAREST_NEIGHBOUR)
-     301          13 :                         return closestValue(position);
-     302             :                 else
-     303      100055 :                         return trilinearInterpolate(position);
-     304             :         }
-     305             : 
-     306             :         /** Inspector & Mutator */
-     307             :         T &get(size_t ix, size_t iy, size_t iz) {
-     308     8391022 :                 return grid[ix * Ny * Nz + iy * Nz + iz];
-     309             :         }
-     310             : 
-     311             :         /** Inspector */
-     312             :         const T &get(size_t ix, size_t iy, size_t iz) const {
-     313      100072 :                 return grid[ix * Ny * Nz + iy * Nz + iz];
-     314             :         }
-     315             : 
-     316             :         const T &periodicGet(size_t ix, size_t iy, size_t iz) const {
-     317         192 :                 ix = periodicBoundary(ix, Nx);
-     318         192 :                 iy = periodicBoundary(iy, Ny);
-     319         192 :                 iz = periodicBoundary(iz, Nz);
-     320         192 :                 return grid[ix * Ny * Nz + iy * Nz + iz];
-     321             :         }
-     322             : 
-     323           0 :         const T &reflectiveGet(size_t ix, size_t iy, size_t iz) const {
-     324           0 :                 ix = reflectiveBoundary(ix, Nx);
-     325           0 :                 iy = reflectiveBoundary(iy, Ny);
-     326           0 :                 iz = reflectiveBoundary(iz, Nz);
-     327           0 :                 return grid[ix * Ny * Nz + iy * Nz + iz];
-     328             :         }
-     329             : 
-     330             :         T getValue(size_t ix, size_t iy, size_t iz) {
-     331           0 :                 return grid[ix * Ny * Nz + iy * Nz + iz];
-     332             :         }
-     333             : 
-     334             :         void setValue(size_t ix, size_t iy, size_t iz, T value) {
-     335           0 :                 grid[ix * Ny * Nz + iy * Nz + iz] = value;
-     336             :         }
-     337             : 
-     338             :         /** Return a reference to the grid values */
-     339             :         std::vector<T> &getGrid() {
-     340       10102 :                 return grid;
-     341             :         }
-     342             : 
-     343             :         /** Position of the grid point of a given index */
-     344       10103 :         Vector3d positionFromIndex(int index) const {
-     345       10103 :                 int ix = index / (Ny * Nz);
-     346       10103 :                 int iy = (index / Nz) % Ny;
-     347       10103 :                 int iz = index % Nz;
-     348       10103 :                 return Vector3d(ix, iy, iz) * spacing + gridOrigin;
-     349             :         }
-     350             : 
-     351             :         /** Value of a grid point that is closest to a given position / nearest neighbour interpolation */
-     352          17 :         T closestValue(const Vector3d &position) const {
-     353             :                 Vector3d r = (position - gridOrigin) / spacing;
-     354             :                 int ix, iy, iz;
-     355          17 :                 if (reflective) {
-     356           6 :                         ix = round(r.x);
-     357           6 :                         iy = round(r.y);
-     358           6 :                         iz = round(r.z);
-     359           9 :                         while ((ix < -0.5) or (ix > (Nx-0.5)))
-     360           3 :                                 ix = 2 * Nx * (ix > (Nx-0.5)) - ix-1;
-     361          11 :                         while ((iy < -0.5) or (iy > (Ny-0.5)))
-     362           5 :                                 iy = 2 * Ny * (iy > (Ny-0.5)) - iy-1;
-     363           9 :                         while ((iz < -0.5) or (iz > (Nz-0.5)))
-     364           3 :                                 iz = 2 * Nz * (iz > (Nz-0.5)) - iz-1;
-     365             :                 } else {
-     366          11 :                         ix = round(fmod(r.x, Nx));
-     367          11 :                         iy = round(fmod(r.y, Ny));
-     368          11 :                         iz = round(fmod(r.z, Nz));
-     369          11 :                         ix = (ix + Nx * (ix < 0)) % Nx;
-     370          11 :                         iy = (iy + Ny * (iy < 0)) % Ny;
-     371          11 :                         iz = (iz + Nz * (iz < 0)) % Nz;
-     372             :                 }
-     373          17 :                 return get(ix, iy, iz);
-     374             :         }
-     375             : 
-     376             : private:
-     377             :         #ifdef HAVE_SIMD
-     378             :         __m128 simdperiodicGet(size_t ix, size_t iy, size_t iz) const {
-     379         576 :                 ix = periodicBoundary(ix, Nx);
-     380         576 :                 iy = periodicBoundary(iy, Ny);
-     381         576 :                 iz = periodicBoundary(iz, Nz);
-     382         576 :                 return convertVector3fToSimd(grid[ix * Ny * Nz + iy * Nz + iz]);
-     383             :         }
-     384             : 
-     385         384 :         __m128 simdreflectiveGet(size_t ix, size_t iy, size_t iz) const {
-     386         384 :                 ix = reflectiveBoundary(ix, Nx);
-     387         384 :                 iy = reflectiveBoundary(iy, Ny);
-     388         384 :                 iz = reflectiveBoundary(iz, Nz);
-     389         384 :                 return convertVector3fToSimd(grid[ix * Ny * Nz + iy * Nz + iz]);
-     390             :         }
-     391             : 
-     392             :         __m128 convertVector3fToSimd(const Vector3f v) const {
-     393             :                 __m128 simdVar = _mm_set_ps(0,v.z,v.y,v.x);
-     394             :                 return simdVar;
-     395             :         }
-     396             :         
-     397             :         Vector3f convertSimdToVector3f(__m128 res) const {
-     398             :                 float vec[4];   
-     399             :                 _mm_store_ps(&vec[0], res);
-     400             :                 Vector3f result = Vector3f(vec[0], vec[1], vec[2]);
-     401             :                 return result;
-     402             :         }
-     403             : 
-     404             :         /** Vectorized cubic Interpolator in 1D */
-     405             :         __m128 CubicInterpolate(__m128 p0,__m128 p1,__m128 p2,__m128 p3,double position) const {
-     406             :                 __m128 c1 = _mm_set1_ps (1/2.);
-     407             :                 __m128 c2 = _mm_set1_ps (3/2.);
-     408             :                 __m128 c3 = _mm_set1_ps (2.);
-     409             :                 __m128 c4 = _mm_set1_ps (5/2.);
-     410             : 
-     411         315 :                 __m128 pos  = _mm_set1_ps (position);
-     412         315 :                 __m128 pos2 = _mm_set1_ps (position*position);
-     413         300 :                 __m128 pos3 = _mm_set1_ps (position*position*position);
-     414             : 
-     415             :                 /** SIMD optimized routine to calculate 'res = ((-0.5*p0+3/2.*p1-3/2.*p2+0.5*p3)*pos*pos*pos+(p0-5/2.*p1+p2*2-0.5*p3)*pos*pos+(-0.5*p0+0.5*p2)*pos+p1);'
-     416             :                          where terms are used as:
-     417             :                         term = (-0.5*p0+0.5*p2)*pos
-     418             :                         term2 = (p0-5/2.*p1+p2*2-0.5*p3)*pos*pos;
-     419             :                         term3 = (-0.5*p0+3/2.*p1-3/2.*p2+0.5*p3)*pos*pos*pos;  */
-     420             :                 __m128 term = _mm_mul_ps(_mm_sub_ps(_mm_mul_ps(c1,p2),_mm_mul_ps(c1,p0)),pos);
-     421             :                 __m128 term2 = _mm_mul_ps(_mm_sub_ps(_mm_add_ps(p0,_mm_mul_ps(c3,p2)),_mm_add_ps(_mm_mul_ps(c4,p1),_mm_mul_ps(c1,p3))),pos2);
-     422             :                 __m128 term3 = _mm_mul_ps(_mm_sub_ps(_mm_add_ps(_mm_mul_ps(c2,p1),_mm_mul_ps(c1,p3)),_mm_add_ps(_mm_mul_ps(c1,p0),_mm_mul_ps(c2,p2))),pos3);
-     423             :                 __m128 res = _mm_add_ps(_mm_add_ps(_mm_add_ps(term3,term2),term),p1);
-     424             :                 return res;
-     425             :         }
-     426             :         #endif // HAVE_SIMD
-     427             :         /** Interpolate the grid tricubic at a given position (see https://www.paulinternet.nl/?page=bicubic, http://graphics.cs.cmu.edu/nsp/course/15-462/Fall04/assts/catmullRom.pdf) */
-     428          15 :         Vector3f tricubicInterpolate(Vector3f, const Vector3d &position) const {
-     429             :                 #ifdef HAVE_SIMD
-     430             :                 // position on a unit grid
-     431             :                 Vector3d r = (position - gridOrigin) / spacing;
-     432             : 
-     433             :                 int iX0, iY0, iZ0;
-     434          15 :                 iX0 = floor(r.x);
-     435          15 :                 iY0 = floor(r.y);
-     436          15 :                 iZ0 = floor(r.z);
-     437             : 
-     438             :                 double fX, fY, fZ;
-     439          15 :                 fX = r.x - iX0;
-     440          15 :                 fY = r.y - iY0;
-     441          15 :                 fZ = r.z - iZ0;
-     442             : 
-     443             :                 int nrCubicInterpolations = 4;
-     444          15 :                 __m128 interpolateVaryX[nrCubicInterpolations];
-     445          15 :                 __m128 interpolateVaryY[nrCubicInterpolations];
-     446          15 :                 __m128 interpolateVaryZ[nrCubicInterpolations];
-     447             :                 /** Perform 1D interpolations while iterating in each for loop over the index of another direction */
-     448          75 :                 for (int iLoopX = -1; iLoopX < nrCubicInterpolations-1; iLoopX++) {
-     449         300 :                         for (int iLoopY = -1; iLoopY < nrCubicInterpolations-1; iLoopY++) {
-     450        1200 :                                 for (int iLoopZ = -1; iLoopZ < nrCubicInterpolations-1; iLoopZ++) {
-     451         960 :                                         if (reflective)
-     452         384 :                                                 interpolateVaryZ[iLoopZ+1] = simdreflectiveGet(iX0+iLoopX, iY0+iLoopY, iZ0+iLoopZ);
-     453             :                                         else 
-     454         576 :                                                 interpolateVaryZ[iLoopZ+1] = simdperiodicGet(iX0+iLoopX, iY0+iLoopY, iZ0+iLoopZ);
-     455             :                                 }
-     456         240 :                                 interpolateVaryY[iLoopY+1] = CubicInterpolate(interpolateVaryZ[0], interpolateVaryZ[1], interpolateVaryZ[2], interpolateVaryZ[3], fZ);
-     457             :                         }
-     458          60 :                         interpolateVaryX[iLoopX+1] = CubicInterpolate(interpolateVaryY[0], interpolateVaryY[1], interpolateVaryY[2], interpolateVaryY[3], fY);
-     459             :                 }
-     460          15 :                 __m128 result = CubicInterpolate(interpolateVaryX[0], interpolateVaryX[1], interpolateVaryX[2], interpolateVaryX[3], fX);
-     461          15 :                 return convertSimdToVector3f(result);
-     462             :                 #else // HAVE_SIMD
-     463             :                 throw std::runtime_error( "Tried to use tricubic Interpolation without SIMD_EXTENSION. SIMD Optimization is necessary for tricubic interpolation of vector grids.\n");
-     464             :                 #endif // HAVE_SIMD     
-     465          15 :         }
-     466             : 
-     467             :         /** Vectorized cubic Interpolator in 1D that returns a scalar (see https://www.paulinternet.nl/?page=bicubic, http://graphics.cs.cmu.edu/nsp/course/15-462/Fall04/assts/catmullRom.pdf) */
-     468          63 :         double CubicInterpolateScalar(double p0,double p1,double p2,double p3,double pos) const {
-     469          63 :                 return((-0.5*p0+3/2.*p1-3/2.*p2+0.5*p3)*pos*pos*pos+(p0-5/2.*p1+p2*2-0.5*p3)*pos*pos+(-0.5*p0+0.5*p2)*pos+p1);
-     470             :         }
-     471             : 
-     472             :   /** Interpolate the grid tricubic at a given position (see https://www.paulinternet.nl/?page=bicubic, http://graphics.cs.cmu.edu/nsp/course/15-462/Fall04/assts/catmullRom.pdf) */
-     473           3 :         double tricubicInterpolate(double, const Vector3d &position) const {
-     474             :                 /** position on a unit grid */
-     475             :                 Vector3d r = (position - gridOrigin) / spacing;
-     476             : 
-     477             :                 int iX0, iY0, iZ0;
-     478           3 :                 iX0 = floor(r.x);
-     479           3 :                 iY0 = floor(r.y);
-     480           3 :                 iZ0 = floor(r.z);
-     481             : 
-     482             :                 double fX, fY, fZ;
-     483           3 :                 fX = r.x - iX0;
-     484           3 :                 fY = r.y - iY0;
-     485           3 :                 fZ = r.z - iZ0;
-     486             : 
-     487             :                 int nrCubicInterpolations = 4;
-     488           3 :                 double interpolateVaryX[nrCubicInterpolations];
-     489           3 :                 double interpolateVaryY[nrCubicInterpolations];
-     490           3 :                 double interpolateVaryZ[nrCubicInterpolations];
-     491             :                 /** Perform 1D interpolations while iterating in each for loop over the index of another direction */
-     492          15 :                 for (int iLoopX = -1; iLoopX < nrCubicInterpolations-1; iLoopX++) {
-     493          60 :                         for (int iLoopY = -1; iLoopY < nrCubicInterpolations-1; iLoopY++) {
-     494         240 :                                 for (int iLoopZ = -1; iLoopZ < nrCubicInterpolations-1; iLoopZ++) {
-     495         192 :                                         if (reflective)
-     496           0 :                                                 interpolateVaryZ[iLoopZ+1] = reflectiveGet(iX0+iLoopX, iY0+iLoopY, iZ0+iLoopZ);
-     497             :                                         else
-     498         192 :                                                 interpolateVaryZ[iLoopZ+1] = periodicGet(iX0+iLoopX, iY0+iLoopY, iZ0+iLoopZ);
-     499             :                                 }
-     500          48 :                                 interpolateVaryY[iLoopY+1] = CubicInterpolateScalar(interpolateVaryZ[0], interpolateVaryZ[1], interpolateVaryZ[2], interpolateVaryZ[3], fZ);
-     501             :                         }
-     502          12 :                         interpolateVaryX[iLoopX+1] = CubicInterpolateScalar(interpolateVaryY[0], interpolateVaryY[1], interpolateVaryY[2], interpolateVaryY[3], fY);
-     503             :                 }
-     504           3 :                 double result = CubicInterpolateScalar(interpolateVaryX[0], interpolateVaryX[1], interpolateVaryX[2], interpolateVaryX[3], fX);
-     505           3 :                 return result;
-     506           3 :         }
-     507             : 
-     508             :         /** Interpolate the grid trilinear at a given position */
-     509      100055 :         T trilinearInterpolate(const Vector3d &position) const {
-     510             :                 /** position on a unit grid */
-     511             :                 Vector3d r = (position - gridOrigin) / spacing;
-     512             : 
-     513             :                 /** indices of lower (0) and upper (1) neighbours. The neighbours span a grid
-     514             :                   with the origin at [iX0, iY0, iZ0] and the most distant corner [iX1, iY1, iZ1]. */
-     515             :                 int iX0, iX1, iY0, iY1, iZ0, iZ1;
-     516             :                 double resX, resY, resZ, fX0, fY0, fZ0;
-     517             : 
-     518      100055 :                 if (reflective) {
-     519           6 :                         reflectiveClamp(r.x, Nx, iX0, iX1, resX);
-     520           6 :                         reflectiveClamp(r.y, Ny, iY0, iY1, resY);
-     521           6 :                         reflectiveClamp(r.z, Nz, iZ0, iZ1, resZ);
-     522           6 :                         fX0 = resX - floor(resX);
-     523           6 :                         fY0 = resY - floor(resY);
-     524           6 :                         fZ0 = resZ - floor(resZ);
-     525             :                 } else {
-     526      100049 :                         periodicClamp(r.x, Nx, iX0, iX1);
-     527      100049 :                         periodicClamp(r.y, Ny, iY0, iY1);
-     528      100049 :                         periodicClamp(r.z, Nz, iZ0, iZ1);
-     529      100049 :                         fX0 = r.x - floor(r.x);
-     530      100049 :                         fY0 = r.y - floor(r.y);
-     531      100049 :                         fZ0 = r.z - floor(r.z);
-     532             :                 }
-     533             : 
-     534             :                 /** linear fraction to upper neighbours based on lower neighbours calculated above */
-     535      100055 :                 double fX1 = 1 - fX0;
-     536      100055 :                 double fY1 = 1 - fY0;
-     537      100055 :                 double fZ1 = 1 - fZ0;
-     538             : 
-     539             :                 /** trilinear interpolation (see http://paulbourke.net/miscellaneous/interpolation) */
-     540             :                 T b(0.);
-     541      100055 :                 b += get(iX0, iY0, iZ0) * fX1 * fY1 * fZ1;
-     542      100055 :                 b += get(iX1, iY0, iZ0) * fX0 * fY1 * fZ1;
-     543      100055 :                 b += get(iX0, iY1, iZ0) * fX1 * fY0 * fZ1;
-     544      100055 :                 b += get(iX0, iY0, iZ1) * fX1 * fY1 * fZ0;
-     545           9 :                 b += get(iX1, iY0, iZ1) * fX0 * fY1 * fZ0;
-     546           9 :                 b += get(iX0, iY1, iZ1) * fX1 * fY0 * fZ0;
-     547           9 :                 b += get(iX1, iY1, iZ0) * fX0 * fY0 * fZ1;
-     548           9 :                 b += get(iX1, iY1, iZ1) * fX0 * fY0 * fZ0;
-     549             : 
-     550      100055 :                 return b;
-     551             :         }
-     552             : 
-     553             : }; // class Grid
-     554             : 
-     555             : typedef Grid<double> Grid1d;
-     556             : typedef Grid<float> Grid1f;
-     557             : typedef Grid<Vector3f> Grid3f;
-     558             : typedef Grid<Vector3d> Grid3d;
-     559             : 
-     560             : /** @}*/
-     561             : 
-     562             : } // namespace crpropa
-     563             : 
-     564             : #endif // CRPROPA_GRID_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Logging.h.func-sort-c.html b/doc/coverageReport/include/crpropa/Logging.h.func-sort-c.html deleted file mode 100644 index df316be7f..000000000 --- a/doc/coverageReport/include/crpropa/Logging.h.func-sort-c.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Logging.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Logging.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0180.0 %
Date:2024-04-08 14:58:22Functions:060.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_Z10logWarningRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_Z11setLogLeveli0
_Z12setLogStreamRSo0
_Z7logInfoRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_Z8logDebugRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_Z8logErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Logging.h.func.html b/doc/coverageReport/include/crpropa/Logging.h.func.html deleted file mode 100644 index 118e0b0b8..000000000 --- a/doc/coverageReport/include/crpropa/Logging.h.func.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Logging.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Logging.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0180.0 %
Date:2024-04-08 14:58:22Functions:060.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_Z10logWarningRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_Z11setLogLeveli0
_Z12setLogStreamRSo0
_Z7logInfoRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_Z8logDebugRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_Z8logErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Logging.h.gcov.html b/doc/coverageReport/include/crpropa/Logging.h.gcov.html deleted file mode 100644 index adb602fd6..000000000 --- a/doc/coverageReport/include/crpropa/Logging.h.gcov.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Logging.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Logging.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0180.0 %
Date:2024-04-08 14:58:22Functions:060.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_LOGGING_H
-       2             : #define CRPROPA_LOGGING_H
-       3             : 
-       4             : #include "crpropa/Version.h"
-       5             : 
-       6             : #include "kiss/logger.h"
-       7             : 
-       8             : #include <fstream>
-       9             : 
-      10             : // make the kiss log functions available in python
-      11           0 : void inline logError(const std::string &log) {
-      12           0 :         KISS_LOG_ERROR << log;
-      13           0 : }
-      14             : 
-      15           0 : void inline logInfo(const std::string &log) {
-      16           0 :         KISS_LOG_INFO << log;
-      17           0 : }
-      18             : 
-      19           0 : void inline logWarning(const std::string &log) {
-      20           0 :         KISS_LOG_WARNING << log;
-      21           0 : }
-      22             : 
-      23           0 : void inline logDebug(const std::string &log) {
-      24           0 :         KISS_LOG_DEBUG << log;
-      25           0 : }
-      26             : 
-      27           0 : void setLogStream(std::ostream &stream) {
-      28           0 :         kiss::Logger::setLogStream(stream);
-      29           0 : }
-      30             : 
-      31           0 : void setLogLevel(int level) {
-      32           0 :         kiss::Logger::setLogLevel(static_cast<kiss::eLogLevel>(level));
-      33           0 : }
-      34             : 
-      35             : #endif // CRPROPA_LOGGING_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Module.h.func-sort-c.html b/doc/coverageReport/include/crpropa/Module.h.func-sort-c.html deleted file mode 100644 index 33e798596..000000000 --- a/doc/coverageReport/include/crpropa/Module.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Module.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Module.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:2825.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Module.h.func.html b/doc/coverageReport/include/crpropa/Module.h.func.html deleted file mode 100644 index 1d53a83bf..000000000 --- a/doc/coverageReport/include/crpropa/Module.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Module.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Module.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:2825.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Module.h.gcov.html b/doc/coverageReport/include/crpropa/Module.h.gcov.html deleted file mode 100644 index be630b8ed..000000000 --- a/doc/coverageReport/include/crpropa/Module.h.gcov.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Module.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Module.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:2825.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_MODULE_H
-       2             : #define CRPROPA_MODULE_H
-       3             : 
-       4             : #include "crpropa/Candidate.h"
-       5             : #include "crpropa/Referenced.h"
-       6             : #include "crpropa/Common.h"
-       7             : 
-       8             : #include <string>
-       9             : 
-      10             : namespace crpropa {
-      11             : 
-      12             : class Candidate;
-      13             : 
-      14             : /**
-      15             :  @class Module
-      16             :  @brief Abstract base class for modules
-      17             :  */
-      18             : class Module: public Referenced {
-      19             :         std::string description;
-      20             : public:
-      21             :         Module();
-      22          37 :         virtual ~Module() {
-      23           4 :         }
-      24             :         virtual std::string getDescription() const;
-      25             :         void setDescription(const std::string &description);
-      26             :         virtual void process(Candidate *candidate) const = 0;
-      27             :         inline void process(ref_ptr<Candidate> candidate) const {
-      28           0 :                 process(candidate.get());
-      29           0 :         }
-      30             : };
-      31             : 
-      32             : 
-      33             : /**
-      34             :  @class AbstractCondition
-      35             :  @brief Abstract Module providing common features for conditional modules.
-      36             :  */
-      37             : class AbstractCondition: public Module {
-      38             : protected:
-      39             :         ref_ptr<Module> rejectAction, acceptAction;
-      40             :         bool makeRejectedInactive, makeAcceptedInactive;
-      41             :         std::string rejectFlagKey, rejectFlagValue;
-      42             :         std::string acceptFlagKey, acceptFlagValue;
-      43             : 
-      44             :         void reject(Candidate *candidate) const;
-      45             :         inline void reject(ref_ptr<Candidate> candidate) const {
-      46           0 :                 reject(candidate.get());
-      47           0 :         }
-      48             : 
-      49             :         void accept(Candidate *candidate) const;
-      50             :         inline void accept(ref_ptr<Candidate> candidate) const {
-      51           0 :                 accept(candidate.get());
-      52           0 :         }
-      53             : 
-      54             : public:
-      55             :         AbstractCondition();
-      56             :         void onReject(Module *rejectAction);
-      57             :         void onAccept(Module *acceptAction);
-      58             :         void setMakeRejectedInactive(bool makeInactive);
-      59             :         void setMakeAcceptedInactive(bool makeInactive);
-      60             :         void setRejectFlag(std::string key, std::string value);
-      61             :         void setAcceptFlag(std::string key, std::string value);
-      62             : };
-      63             : } // namespace crpropa
-      64             : 
-      65             : #endif /* CRPROPA_MODULE_H */
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/ParticleState.h.func-sort-c.html b/doc/coverageReport/include/crpropa/ParticleState.h.func-sort-c.html deleted file mode 100644 index 71558e0b3..000000000 --- a/doc/coverageReport/include/crpropa/ParticleState.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/ParticleState.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - ParticleState.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/ParticleState.h.func.html b/doc/coverageReport/include/crpropa/ParticleState.h.func.html deleted file mode 100644 index 0ff39823d..000000000 --- a/doc/coverageReport/include/crpropa/ParticleState.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/ParticleState.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - ParticleState.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/ParticleState.h.gcov.html b/doc/coverageReport/include/crpropa/ParticleState.h.gcov.html deleted file mode 100644 index 3c2bcfa41..000000000 --- a/doc/coverageReport/include/crpropa/ParticleState.h.gcov.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/ParticleState.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - ParticleState.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_PARTICLE_STATE_H
-       2             : #define CRPROPA_PARTICLE_STATE_H
-       3             : 
-       4             : #include "crpropa/Vector3.h"
-       5             : 
-       6             : namespace crpropa {
-       7             : /**
-       8             :  * \addtogroup Core
-       9             :  * @{
-      10             :  */
-      11             : 
-      12             : /**
-      13             :  @class ParticleState
-      14             :  @brief State of the particle: ID, energy, position, direction
-      15             : 
-      16             :  The ParticleState defines the state of an ultra-high energy cosmic ray, which
-      17             :  is assumed to be traveling at the exact speed of light.
-      18             :  The cosmic ray state is defined by particle ID, energy and position and
-      19             :  direction vector.
-      20             :  For faster lookup mass and charge of the particle are stored as members.
-      21             :  */
-      22     7199005 : class ParticleState {
-      23             : private:
-      24             :         int id; ///< particle ID (Particle Data Group numbering scheme)
-      25             :         double energy; ///< total energy
-      26             :         Vector3d position; ///< position vector in comoving coordinates
-      27             :         Vector3d direction; ///< unit vector of velocity or momentum
-      28             :         double pmass; ///< particle rest mass
-      29             :         double charge; ///< particle charge
-      30             : 
-      31             : public:
-      32             :         /** Constructor for a particle state.
-      33             :          @param id                      id of the particle following the PDG numbering scheme
-      34             :          @param energy          energy of the particle [in Joules]
-      35             :          @param position        vector containing the coordinates of the particle [in meters]
-      36             :          @param direction       vector containing the direction of motion of the particle
-      37             :          */
-      38             :         ParticleState(int id = 0, double energy = 0,
-      39             :                         Vector3d position = Vector3d(0, 0, 0),
-      40             :                         Vector3d direction = Vector3d(-1, 0, 0));
-      41             : 
-      42             :         /** Set particle position.
-      43             :          In simulations including cosmological effects, the position is given in comoving coordinates.
-      44             :          @param pos             vector containing the coordinates of the particle [in meters]
-      45             :         */
-      46             :         void setPosition(const Vector3d &pos);
-      47             :         /** Get position of particle.
-      48             :          @returns Position vector of particle. If cosmological effects are included, the coordinates are comoving.
-      49             :          */
-      50             :         const Vector3d &getPosition() const;
-      51             : 
-      52             :         /** Set direction unit vector, non unit-vectors are normalized
-      53             :          @param dir     vector containing the direction of motion of the particle
-      54             :          */
-      55             :         void setDirection(const Vector3d &dir);
-      56             :         /** Get direction unit vector
-      57             :          @returns Normalized vector containing direction of motion of particle.
-      58             :          */
-      59             :         const Vector3d &getDirection() const;
-      60             : 
-      61             :         /** Set energy of particle.
-      62             :          @param newEnergy       energy to be assigned to particle [in Joules]
-      63             :          */
-      64             :         void setEnergy(double newEnergy);
-      65             :         /** Get energy of particle.
-      66             :          @returns Energy of particle [in Joules]
-      67             :          */
-      68             :         double getEnergy() const;
-      69             :         /** Get rigidity of particle, defined as E/(Z*e).
-      70             :          @returns Rigidity of the particle [in Volts]
-      71             :          */
-      72             :         double getRigidity() const;
-      73             : 
-      74             :         /** Set particle ID.
-      75             :          This follows the PDG numbering scheme:
-      76             :           https://pdg.lbl.gov/2019/reviews/rpp2019-rev-monte-carlo-numbering.pdf
-      77             :          @param newId           id to be assigned to the particle 
-      78             :          */
-      79             :         void setId(int newId);
-      80             :         /** Get particle ID
-      81             :          @returns Particle ID (in PDG format).
-      82             :          */
-      83             :         int getId() const;
-      84             : 
-      85             :         std::string getDescription() const;
-      86             : 
-      87             :         // ======== Helper methods ========
-      88             : 
-      89             :         /** Get electrical charge of the particle.
-      90             :          @returns Charge of the particle [in Coulombs]
-      91             :          */
-      92             :         double getCharge() const;
-      93             :         /** Get mass of the particle.
-      94             :          @returns Mass of the particle [kg]
-      95             :          */
-      96             :         double getMass() const;
-      97             : 
-      98             :         /** Set Lorentz factor and modify the particle's energy accordingly.
-      99             :          @param gamma           Lorentz factor
-     100             :          */
-     101             :         void setLorentzFactor(double gamma);
-     102             :         /** Get Lorentz factor
-     103             :          @returns Lorentz factor of particle
-     104             :          */
-     105             :         double getLorentzFactor() const;
-     106             : 
-     107             :         /** Get velocity: direction times the speed of light.
-     108             :          @returns Velocity of particle [m/s]
-     109             :          */
-     110             :         Vector3d getVelocity() const;
-     111             :         /** Get momentum: direction times energy divided by the speed of light 
-     112             :          @returns The momentum [kg m/s]
-     113             :         */
-     114             :         Vector3d getMomentum() const;
-     115             : };
-     116             : /** @}*/
-     117             : 
-     118             : } // namespace crpropa
-     119             : 
-     120             : #endif // CRPROPA_PARTICLE_STATE_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/PhotonBackground.h.func-sort-c.html b/doc/coverageReport/include/crpropa/PhotonBackground.h.func-sort-c.html deleted file mode 100644 index 167da8226..000000000 --- a/doc/coverageReport/include/crpropa/PhotonBackground.h.func-sort-c.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/PhotonBackground.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - PhotonBackground.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:222781.5 %
Date:2024-04-08 14:58:22Functions:171989.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa19IRB_Saldana21_lowerC2Ev0
_ZN7crpropa19IRB_Saldana21_upperC2Ev0
_ZN7crpropa12URB_Fixsen11C2Ev4
_ZN7crpropa13IRB_Saldana21C2Ev4
_ZN7crpropa15URB_Protheroe96C2Ev6
_ZN7crpropa11IRB_Finke10C2Ev7
_ZN7crpropa11IRB_Finke22C2Ev7
_ZN7crpropa13IRB_Gilmore12C2Ev7
_ZN7crpropa13IRB_Stecker05C2Ev7
_ZN7crpropa15IRB_Dominguez11C2Ev7
_ZN7crpropa18IRB_Franceschini08C2Ev7
_ZN7crpropa19IRB_Stecker16_lowerC2Ev7
_ZN7crpropa19IRB_Stecker16_upperC2Ev7
_ZN7crpropa10URB_Nitu21C2Ev11
_ZN7crpropa13IRB_Kneiske04C2Ev13
_ZN7crpropa3CMBC2Ev40
_ZN7crpropa11PhotonFieldC2Ev135
_ZNK7crpropa11PhotonField12getFieldNameB5cxx11Ev175
_ZNK7crpropa11PhotonField18getRedshiftScalingEd16549
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/PhotonBackground.h.func.html b/doc/coverageReport/include/crpropa/PhotonBackground.h.func.html deleted file mode 100644 index f8d9a9eee..000000000 --- a/doc/coverageReport/include/crpropa/PhotonBackground.h.func.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/PhotonBackground.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - PhotonBackground.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:222781.5 %
Date:2024-04-08 14:58:22Functions:171989.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa10URB_Nitu21C2Ev11
_ZN7crpropa11IRB_Finke10C2Ev7
_ZN7crpropa11IRB_Finke22C2Ev7
_ZN7crpropa11PhotonFieldC2Ev135
_ZN7crpropa12URB_Fixsen11C2Ev4
_ZN7crpropa13IRB_Gilmore12C2Ev7
_ZN7crpropa13IRB_Kneiske04C2Ev13
_ZN7crpropa13IRB_Saldana21C2Ev4
_ZN7crpropa13IRB_Stecker05C2Ev7
_ZN7crpropa15IRB_Dominguez11C2Ev7
_ZN7crpropa15URB_Protheroe96C2Ev6
_ZN7crpropa18IRB_Franceschini08C2Ev7
_ZN7crpropa19IRB_Saldana21_lowerC2Ev0
_ZN7crpropa19IRB_Saldana21_upperC2Ev0
_ZN7crpropa19IRB_Stecker16_lowerC2Ev7
_ZN7crpropa19IRB_Stecker16_upperC2Ev7
_ZN7crpropa3CMBC2Ev40
_ZNK7crpropa11PhotonField12getFieldNameB5cxx11Ev175
_ZNK7crpropa11PhotonField18getRedshiftScalingEd16549
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/PhotonBackground.h.gcov.html b/doc/coverageReport/include/crpropa/PhotonBackground.h.gcov.html deleted file mode 100644 index 0a582c195..000000000 --- a/doc/coverageReport/include/crpropa/PhotonBackground.h.gcov.html +++ /dev/null @@ -1,398 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/PhotonBackground.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - PhotonBackground.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:222781.5 %
Date:2024-04-08 14:58:22Functions:171989.5 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_PHOTONBACKGROUND_H
-       2             : #define CRPROPA_PHOTONBACKGROUND_H
-       3             : 
-       4             : #include "crpropa/Common.h"
-       5             : #include "crpropa/Referenced.h"
-       6             : 
-       7             : #include <vector>
-       8             : #include <string>
-       9             : 
-      10             : namespace crpropa {
-      11             : /**
-      12             :  * \addtogroup PhotonFields
-      13             :  * @{
-      14             :  */
-      15             : 
-      16             : /**
-      17             :  @class PhotonField
-      18             :  @brief Abstract base class for photon fields.
-      19             :  */
-      20           1 : class PhotonField: public Referenced {
-      21             : public:
-      22         135 :         PhotonField() {
-      23             :                 this->fieldName = "AbstractPhotonField";
-      24         135 :                 this->isRedshiftDependent = false;
-      25         135 :         }
-      26             : 
-      27             :         /**
-      28             :          returns comoving photon density [1/m^3].
-      29             :          multiply with (1+z^3) for physical number density.
-      30             :          @param ePhoton         photon energy [J]
-      31             :          @param z                       redshift (if redshift dependent, default = 0.)
-      32             :          */
-      33             :         virtual double getPhotonDensity(double ePhoton, double z = 0.) const = 0;
-      34             :         virtual double getMinimumPhotonEnergy(double z) const = 0;
-      35             :         virtual double getMaximumPhotonEnergy(double z) const = 0;
-      36         175 :         virtual std::string getFieldName() const {
-      37         175 :                 return this->fieldName;
-      38             :         }
-      39             : 
-      40             :         /**
-      41             :          returns overall comoving scaling factor
-      42             :          (cf. CRPropa3-data/calc_scaling.py)
-      43             :          @param z               redshift
-      44             :          */
-      45       16549 :         virtual double getRedshiftScaling(double z) const {
-      46       16549 :                 return 1.;
-      47             :         };
-      48             : 
-      49             :         bool hasRedshiftDependence() const {
-      50           0 :                 return this->isRedshiftDependent;
-      51             :         }
-      52             : 
-      53             :         void setFieldName(std::string fieldName) {
-      54           0 :                 this->fieldName = fieldName;
-      55           0 :         }
-      56             : 
-      57             : protected:
-      58             :         std::string fieldName;
-      59             :         bool isRedshiftDependent;
-      60             : };
-      61             : 
-      62             : /**
-      63             :  @class TabularPhotonField
-      64             :  @brief Photon field decorator for tabulated photon fields.
-      65             : 
-      66             :  This class reads photon field data from files;
-      67             :  The first file must be a list of photon energies [J], named fieldName_photonEnergy.txt
-      68             :  The second file must be a list of comoving photon field densities [1/m^3], named fieldName_photonDensity.txt
-      69             :  Optionally, a third file contains redshifts, named fieldName_redshift.txt
-      70             :  */
-      71             : class TabularPhotonField: public PhotonField {
-      72             : public:
-      73             :         TabularPhotonField(const std::string fieldName, const bool isRedshiftDependent = true);
-      74             : 
-      75             :         double getPhotonDensity(double ePhoton, double z = 0.) const;
-      76             :         double getRedshiftScaling(double z) const;
-      77             :         double getMinimumPhotonEnergy(double z) const;
-      78             :         double getMaximumPhotonEnergy(double z) const;
-      79             : 
-      80             : protected:
-      81             :         void readPhotonEnergy(std::string filePath);
-      82             :         void readPhotonDensity(std::string filePath);
-      83             :         void readRedshift(std::string filePath);
-      84             :         void initRedshiftScaling();
-      85             :         void checkInputData() const;
-      86             : 
-      87             :         std::vector<double> photonEnergies;
-      88             :         std::vector<double> photonDensity;
-      89             :         std::vector<double> redshifts;
-      90             :         std::vector<double> redshiftScalings;
-      91             : };
-      92             : 
-      93             : /**
-      94             :  @class IRB_Kneiske04
-      95             :  @brief Extragalactic background light model from Kneiske et al. 2004
-      96             : 
-      97             :  Source info:
-      98             :  DOI:10.1051/0004-6361:20031542,
-      99             :  https://www.aanda.org/articles/aa/pdf/2004/03/aa3848.pdf, figure 1 ("Best-fit" model)
-     100             :  */
-     101             : class IRB_Kneiske04: public TabularPhotonField {
-     102             : public:
-     103          26 :         IRB_Kneiske04() : TabularPhotonField("IRB_Kneiske04", true) {}
-     104             : };
-     105             : 
-     106             : /**
-     107             :  @class IRB_Stecker05
-     108             :  @brief Extragalactic background light model by Stecker at al. 2005
-     109             : 
-     110             :  Source info:
-     111             :  DOI:10.1086/506188, astro-ph/0510449
-     112             :  https://iopscience.iop.org/article/10.1086/506188/pdf
-     113             :  */
-     114             : class IRB_Stecker05: public TabularPhotonField {
-     115             : public:
-     116          14 :         IRB_Stecker05() : TabularPhotonField("IRB_Stecker05", true) {}
-     117             : };
-     118             : 
-     119             : /**
-     120             :  @class IRB_Franceschini08
-     121             :  @brief Extragalactic background light model from Franceschini et al. 2008
-     122             : 
-     123             :  Source info:
-     124             :  DOI:10.1051/0004-6361:200809691
-     125             :  https://arxiv.org/pdf/0805.1841.pdf, tables 1 and 2
-     126             :  */
-     127             : class IRB_Franceschini08: public TabularPhotonField {
-     128             : public:
-     129          14 :         IRB_Franceschini08() : TabularPhotonField("IRB_Franceschini08", true) {}
-     130             : };
-     131             : 
-     132             : /**
-     133             :  @class IRB_Finke10
-     134             :  @brief Extragalactic background light model from Finke et al. 2010
-     135             : 
-     136             :  Source info:
-     137             :  DOI:10.1088/0004-637X/712/1/238
-     138             :  https://iopscience.iop.org/article/10.1088/0004-637X/712/1/238/pdf
-     139             :  */
-     140             : class IRB_Finke10: public TabularPhotonField {
-     141             : public:
-     142          14 :         IRB_Finke10() : TabularPhotonField("IRB_Finke10", true) {}
-     143             : };
-     144             : 
-     145             : /**
-     146             :  @class IRB_Dominguez11
-     147             :  @brief Extragalactic background light model from Dominguez et al. 2011
-     148             : 
-     149             :  Source info:
-     150             :  DOI:10.1111/j.1365-2966.2010.17631.x
-     151             :  https://academic.oup.com/mnras/article/410/4/2556/1008012
-     152             :  */
-     153             : class IRB_Dominguez11: public TabularPhotonField {
-     154             : public:
-     155          14 :         IRB_Dominguez11() : TabularPhotonField("IRB_Dominguez11", true) {}
-     156             : };
-     157             : 
-     158             : /**
-     159             :  @class IRB_Gilmore12
-     160             :  @brief Extragalactic background light model from Gilmore et al. 2012
-     161             : 
-     162             :  Source info:
-     163             :  DOI:10.1111/j.1365-2966.2012.20841.x
-     164             :  https://academic.oup.com/mnras/article/422/4/3189/1050758
-     165             :  */
-     166             : class IRB_Gilmore12: public TabularPhotonField {
-     167             : public:
-     168          14 :         IRB_Gilmore12() : TabularPhotonField("IRB_Gilmore12", true) {}
-     169             : };
-     170             : 
-     171             : /**
-     172             :  @class IRB_Stecker16_upper
-     173             :  @brief Extragalactic background light model from Stecker et al. 2016 (upper-bound model)
-     174             : 
-     175             :  Source info:
-     176             :  DOI:10.3847/0004-637X/827/1/6
-     177             :  https://iopscience.iop.org/article/10.3847/0004-637X/827/1/6
-     178             :  */
-     179             : class IRB_Stecker16_upper: public TabularPhotonField {
-     180             : public:
-     181          14 :         IRB_Stecker16_upper() : TabularPhotonField("IRB_Stecker16_upper", true) {}
-     182             : };
-     183             : 
-     184             : /**
-     185             :  @class IRB_Stecker16_lower
-     186             :  @brief Extragalactic background light model from Stecker et al. 2016 (lower-bound model)
-     187             : 
-     188             :  Source info:
-     189             :  DOI:10.3847/0004-637X/827/1/6
-     190             :  https://iopscience.iop.org/article/10.3847/0004-637X/827/1/6
-     191             :  */
-     192             : class IRB_Stecker16_lower: public TabularPhotonField {
-     193             : public:
-     194          14 :         IRB_Stecker16_lower() : TabularPhotonField("IRB_Stecker16_lower", true) {}
-     195             : };
-     196             : 
-     197             : /**
-     198             :  @class IRB_Saldana21
-     199             :  @brief Extragalactic background light model from Saldana-Lopez et al. 2021
-     200             : 
-     201             :  Source info:
-     202             :  DOI:10.1093/mnras/stab2393
-     203             :  https://ui.adsabs.harvard.edu/abs/2021MNRAS.507.5144S/abstract
-     204             :  */
-     205             : class IRB_Saldana21: public TabularPhotonField {
-     206             : public:
-     207           8 :         IRB_Saldana21() : TabularPhotonField("IRB_Saldana21", true) {}
-     208             : };
-     209             : 
-     210             : /**
-     211             :  @class IRB_Saldana21_upper
-     212             :  @brief Extragalactic background light model from Saldana-Lopez et al. 2021 (upper-bound model)
-     213             : 
-     214             :  Source info:
-     215             :  DOI:10.1093/mnras/stab2393
-     216             :  https://ui.adsabs.harvard.edu/abs/2021MNRAS.507.5144S/abstract
-     217             :  */
-     218             : class IRB_Saldana21_upper: public TabularPhotonField {
-     219             : public:
-     220           0 :         IRB_Saldana21_upper() : TabularPhotonField("IRB_Saldana21_upper", true) {}
-     221             : };
-     222             : 
-     223             : /**
-     224             :  @class IRB_Saldana21_lower
-     225             :  @brief Extragalactic background light model from Saldana-Lopez et al. 2021 (lower-bound model)
-     226             : 
-     227             :  Source info:
-     228             :  DOI:10.1093/mnras/stab2393
-     229             :  https://ui.adsabs.harvard.edu/abs/2021MNRAS.507.5144S/abstract
-     230             :  */
-     231             : class IRB_Saldana21_lower: public TabularPhotonField {
-     232             : public:
-     233           0 :         IRB_Saldana21_lower() : TabularPhotonField("IRB_Saldana21_lower", true) {}
-     234             : };
-     235             : 
-     236             : /**
-     237             :  @class IRB_Finke22
-     238             :  @brief Extragalactic background light model from Finke et al. 2022
-     239             : 
-     240             :  Source info:
-     241             :  DOI:10.3847/1538-4357/ac9843
-     242             :  https://iopscience.iop.org/article/10.3847/1538-4357/ac9843/pdf
-     243             :  */
-     244             : class IRB_Finke22: public TabularPhotonField {
-     245             : public:
-     246          14 :         IRB_Finke22() : TabularPhotonField("IRB_Finke22", true) {}
-     247             : };
-     248             : 
-     249             : /**
-     250             :  @class URB
-     251             :  @brief Extragalactic background light model from Protheroe & Biermann 1996
-     252             : 
-     253             :  Source info:
-     254             :  DOI:10.1016/S0927-6505(96)00041-2
-     255             :  https://www.sciencedirect.com/science/article/abs/pii/S0927650596000412
-     256             :  */
-     257             : class URB_Protheroe96: public TabularPhotonField {
-     258             : public:
-     259          12 :         URB_Protheroe96() : TabularPhotonField("URB_Protheroe96", false) {}
-     260             : };
-     261             : 
-     262             : /**
-     263             :  @class URB
-     264             :  @brief Extragalactic background light model based on ARCADE2 observations, by Fixsen et al.
-     265             :  Note that this model does not cover the same energy range as other URB models. Here, only ~10 MHz - 10 GHz is considered.
-     266             :  Therefore, it only makes sense to use this model in very specific studies.
-     267             : 
-     268             :  Source info:
-     269             :  DOI:10.1088/0004-637X/734/1/5
-     270             :  https://iopscience.iop.org/article/10.1088/0004-637X/734/1/5
-     271             :  */
-     272             : class URB_Fixsen11: public TabularPhotonField {
-     273             : public:
-     274           8 :         URB_Fixsen11() : TabularPhotonField("URB_Fixsen11", false) {}
-     275             : };
-     276             : 
-     277             : /**
-     278             :  @class URB
-     279             :  @brief Extragalactic background light model by Nitu et al.
-     280             : 
-     281             :  Source info:
-     282             :  DOI:10.1016/j.astropartphys.2020.102532
-     283             :  https://www.sciencedirect.com/science/article/pii/S0927650520301043?
-     284             :  */
-     285             : class URB_Nitu21: public TabularPhotonField {
-     286             : public:
-     287          22 :         URB_Nitu21() : TabularPhotonField("URB_Nitu21", false) {}
-     288             : };
-     289             : 
-     290             : /**
-     291             :  @class BlackbodyPhotonField
-     292             :  @brief Photon field decorator for black body photon fields.
-     293             :  */
-     294             : class BlackbodyPhotonField: public PhotonField {
-     295             : public:
-     296             :         BlackbodyPhotonField(const std::string fieldName, const double blackbodyTemperature);
-     297             :         double getPhotonDensity(double ePhoton, double z = 0.) const;
-     298             :         double getMinimumPhotonEnergy(double z) const;
-     299             :         double getMaximumPhotonEnergy(double z) const;
-     300             :         void setQuantile(double q);
-     301             : 
-     302             : protected:
-     303             :         double blackbodyTemperature;
-     304             :         double quantile;
-     305             : };
-     306             : 
-     307             : /**
-     308             :  @class CMB
-     309             :  @brief Cosmic mircowave background photon field
-     310             : 
-     311             :  Source info:
-     312             :  This field is an isotropic blackbody photon field with temperature T = 2.73 K
-     313             :  */
-     314             : class CMB: public BlackbodyPhotonField {
-     315             : public:
-     316          80 :         CMB() : BlackbodyPhotonField("CMB", 2.73) {}
-     317             : };
-     318             : 
-     319             : 
-     320             : } // namespace crpropa
-     321             : 
-     322             : #endif // CRPROPA_PHOTONBACKGROUND_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Random.h.func-sort-c.html b/doc/coverageReport/include/crpropa/Random.h.func-sort-c.html deleted file mode 100644 index e8f69e8b4..000000000 --- a/doc/coverageReport/include/crpropa/Random.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Random.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Random.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:7887.5 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Random.h.func.html b/doc/coverageReport/include/crpropa/Random.h.func.html deleted file mode 100644 index 16cf98e23..000000000 --- a/doc/coverageReport/include/crpropa/Random.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Random.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Random.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:7887.5 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Random.h.gcov.html b/doc/coverageReport/include/crpropa/Random.h.gcov.html deleted file mode 100644 index 5799cec29..000000000 --- a/doc/coverageReport/include/crpropa/Random.h.gcov.html +++ /dev/null @@ -1,317 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Random.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Random.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:7887.5 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : // Random.h
-       2             : // Mersenne Twister random number generator -- a C++ class Random
-       3             : // Based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus
-       4             : // Richard J. Wagner  v1.0  15 May 2003  rjwagner@writeme.com
-       5             : 
-       6             : // The Mersenne Twister is an algorithm for generating random numbers.  It
-       7             : // was designed with consideration of the flaws in various other generators.
-       8             : // The period, 2^19937-1, and the order of equidistribution, 623 dimensions,
-       9             : // are far greater.  The generator is also fast; it avoids multiplication and
-      10             : // division, and it benefits from caches and pipelines.  For more information
-      11             : // see the inventors' web page at http://www.math.keio.ac.jp/~matumoto/emt.html
-      12             : 
-      13             : // Reference
-      14             : // M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-Dimensionally
-      15             : // Equidistributed Uniform Pseudo-Random Number Generator", ACM Transactions on
-      16             : // Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3-30.
-      17             : 
-      18             : // Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
-      19             : // Copyright (C) 2000 - 2003, Richard J. Wagner
-      20             : // All rights reserved.
-      21             : //
-      22             : // Redistribution and use in source and binary forms, with or without
-      23             : // modification, are permitted provided that the following conditions
-      24             : // are met:
-      25             : //
-      26             : //   1. Redistributions of source code must retain the above copyright
-      27             : //      notice, this list of conditions and the following disclaimer.
-      28             : //
-      29             : //   2. Redistributions in binary form must reproduce the above copyright
-      30             : //      notice, this list of conditions and the following disclaimer in the
-      31             : //      documentation and/or other materials provided with the distribution.
-      32             : //
-      33             : //   3. The names of its contributors may not be used to endorse or promote
-      34             : //      products derived from this software without specific prior written
-      35             : //      permission.
-      36             : //
-      37             : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-      38             : // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-      39             : // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-      40             : // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-      41             : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-      42             : // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-      43             : // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-      44             : // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-      45             : // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-      46             : // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-      47             : // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-      48             : 
-      49             : // The original code included the following notice:
-      50             : //
-      51             : //     When you use this, send an email to: matumoto@math.keio.ac.jp
-      52             : //     with an appropriate reference to your work.
-      53             : //
-      54             : // It would be nice to CC: rjwagner@writeme.com and Cokus@math.washington.edu
-      55             : // when you write.
-      56             : 
-      57             : // Parts of this file are modified beginning in 29.10.09 for adaption in PXL.
-      58             : // Parts of this file are modified beginning in 10.02.12 for adaption in CRPropa.
-      59             : 
-      60             : #ifndef RANDOM_H
-      61             : #define RANDOM_H
-      62             : 
-      63             : // Not thread safe (unless auto-initialization is avoided and each thread has
-      64             : // its own Random object)
-      65             : #include "crpropa/Vector3.h"
-      66             : 
-      67             : #include <iostream>
-      68             : #include <limits>
-      69             : #include <ctime>
-      70             : #include <cmath>
-      71             : #include <vector>
-      72             : #include <stdexcept>
-      73             : #include <algorithm>
-      74             : 
-      75             : #include <stdint.h>
-      76             : #include <string>
-      77             : 
-      78             : //necessary for win32
-      79             : #ifndef M_PI
-      80             : #define M_PI 3.14159265358979323846
-      81             : #endif
-      82             : 
-      83             : namespace crpropa {
-      84             : 
-      85             : /**
-      86             :  * \addtogroup Core
-      87             :  * @{
-      88             :  */
-      89             : /**
-      90             :  @class Random
-      91             :  @brief Random number generator.
-      92             : 
-      93             :  Mersenne Twister random number generator -- a C++ class Random
-      94             :  Based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus
-      95             :  Richard J. Wagner  v1.0  15 May 2003  rjwagner@writeme.com
-      96             :  */
-      97           3 : class Random {
-      98             : public:
-      99             :         enum {N = 624}; // length of state vector
-     100             :         enum {SAVE = N + 1}; // length of array for save()
-     101             : 
-     102             : protected:
-     103             :         enum {M = 397}; // period parameter
-     104             :         uint32_t state[N];// internal state
-     105             :         std::vector<uint32_t> initial_seed;//
-     106             :         uint32_t *pNext;// next value to get from state
-     107             :         int left;// number of values left before reload needed
-     108             : 
-     109             : //Methods
-     110             : public:
-     111             :         /// initialize with a simple uint32_t
-     112             :         Random( const uint32_t& oneSeed );
-     113             :         // initialize with an array
-     114             :         Random( uint32_t *const bigSeed, uint32_t const seedLength = N );
-     115             :         /// auto-initialize with /dev/urandom or time() and clock()
-     116             :         /// Do NOT use for CRYPTOGRAPHY without securely hashing several returned
-     117             :         /// values together, otherwise the generator state can be learned after
-     118             :         /// reading 624 consecutive values.
-     119             :         Random();
-     120             :         // Access to 32-bit random numbers
-     121             :         double rand();///< real number in [0,1]
-     122             :         double rand( const double& n );///< real number in [0,n]
-     123             :         double randExc();///< real number in [0,1)
-     124             :         double randExc( const double& n );///< real number in [0,n)
-     125             :         double randDblExc();///< real number in (0,1)
-     126             :         double randDblExc( const double& n );///< real number in (0,n)
-     127             :         // Pull a 32-bit integer from the generator state
-     128             :         // Every other access function simply transforms the numbers extracted here
-     129             :         uint32_t randInt();///< integer in [0,2**32-1]
-     130             :         uint32_t randInt( const uint32_t& n );///< integer in [0,n] for n < 2**32
-     131             : 
-     132             :         uint64_t randInt64(); ///< integer in [0, 2**64 -1]. PROBABLY NOT SECURE TO USE
-     133             :         uint64_t randInt64(const uint64_t &n); ///< integer in [0, n] for n < 2**64 -1. PROBABLY NOT SECURE TO USE
-     134             : 
-     135           0 :         double operator()() {return rand();} ///< same as rand()
-     136             : 
-     137             :         // Access to 53-bit random numbers (capacity of IEEE double precision)
-     138             :         double rand53();///< real number in [0,1)  (capacity of IEEE double precision)
-     139             :         ///Exponential distribution in (0,inf)
-     140             :         double randExponential();
-     141             :         /// Normal distributed random number
-     142     1715954 :         double randNorm( const double& mean = 0.0, const double& variance = 1.0 );
-     143             :         /// Uniform distribution in [min, max]
-     144             :         double randUniform(double min, double max);
-     145             :         /// Rayleigh distributed random number
-     146             :         double randRayleigh(double sigma);
-     147             :         /// Fisher distributed random number
-     148             :         double randFisher(double k);
-     149             : 
-     150             :         /// Draw a random bin from a (unnormalized) cumulative distribution function, without leading zero.
-     151             :         size_t randBin(const std::vector<float> &cdf);
-     152             :         size_t randBin(const std::vector<double> &cdf);
-     153             : 
-     154             :         /// Random point on a unit-sphere
-     155             :         Vector3d randVector();
-     156             :         /// Random vector with given angular separation around mean direction
-     157             :         Vector3d randVectorAroundMean(const Vector3d &meanDirection, double angle);
-     158             :         /// Fisher distributed random vector
-     159             :         Vector3d randFisherVector(const Vector3d &meanDirection, double kappa);
-     160             :         /// Uniform distributed random vector inside a cone
-     161             :         Vector3d randConeVector(const Vector3d &meanDirection, double angularRadius);
-     162             :         /// Random lamberts distributed vector with theta distribution: sin(t) * cos(t),
-     163             :         /// aka cosine law (https://en.wikipedia.org/wiki/Lambert%27s_cosine_law),
-     164             :         /// for a surface element with normal vector pointing in positive z-axis (0, 0, 1)
-     165             :         Vector3d randVectorLamberts();
-     166             :         /// Same as above but rotated to the respective normalVector of surface element
-     167             :         Vector3d randVectorLamberts(const Vector3d &normalVector);
-     168             :         ///_Position vector uniformly distributed within propagation step size bin
-     169             :         Vector3d randomInterpolatedPosition(const Vector3d &a, const Vector3d &b);
-     170             : 
-     171             :         /// Power-law distribution of a given differential spectral index
-     172             :         double randPowerLaw(double index, double min, double max);
-     173             :         /// Broken power-law distribution
-     174             :         double randBrokenPowerLaw(double index1, double index2, double breakpoint, double min, double max );
-     175             : 
-     176             :         /// Seed the generator with a simple uint32_t
-     177             :         void seed( const uint32_t oneSeed );
-     178             :         /// Seed the generator with an array of uint32_t's
-     179             :         /// There are 2^19937-1 possible initial states.  This function allows
-     180             :         /// all of those to be accessed by providing at least 19937 bits (with a
-     181             :         /// default seed length of N = 624 uint32_t's).  Any bits above the lower 32
-     182             :         /// in each element are discarded.
-     183             :         /// Just call seed() if you want to get array from /dev/urandom
-     184             :         void seed( uint32_t *const bigSeed, const uint32_t seedLength = N );
-     185             :         // seed via an b64 encoded string
-     186             :         void seed( const std::string &b64Seed);
-     187             :         /// Seed the generator with an array from /dev/urandom if available
-     188             :         /// Otherwise use a hash of time() and clock() values
-     189             :         void seed();
-     190             : 
-     191             :         // Saving and loading generator state
-     192             :         void save( uint32_t* saveArray ) const;// to array of size SAVE
-     193             :         void load( uint32_t *const loadArray );// from such array
-     194             :         const std::vector<uint32_t> &getSeed() const; // copy the seed to the array
-     195             :         const std::string getSeed_base64() const; // get the base 64 encoded seed
-     196             : 
-     197             :         friend std::ostream& operator<<( std::ostream& os, const Random& mtrand );
-     198             :         friend std::istream& operator>>( std::istream& is, Random& mtrand );
-     199             : 
-     200             :         static Random &instance();
-     201             :         static void seedThreads(const uint32_t oneSeed);
-     202             :         static std::vector< std::vector<uint32_t> > getSeedThreads();
-     203             : 
-     204             : protected:
-     205             :         /// Initialize generator state with seed
-     206             :         /// See Knuth TAOCP Vol 2, 3rd Ed, p.106 for multiplier.
-     207             :         /// In previous versions, most significant bits (MSBs) of the seed affect
-     208             :         /// only MSBs of the state array.  Modified 9 Jan 2002 by Makoto Matsumoto.
-     209             :         void initialize( const uint32_t oneSeed );
-     210             : 
-     211             :         /// Generate N new values in state
-     212             :         /// Made clearer and faster by Matthew Bellew (matthew.bellew@home.com)
-     213             :         void reload();
-     214    28904304 :         uint32_t hiBit( const uint32_t& u ) const {return u & 0x80000000UL;}
-     215    28904304 :         uint32_t loBit( const uint32_t& u ) const {return u & 0x00000001UL;}
-     216    28904304 :         uint32_t loBits( const uint32_t& u ) const {return u & 0x7fffffffUL;}
-     217             :         uint32_t mixBits( const uint32_t& u, const uint32_t& v ) const
-     218    28904304 :         {       return hiBit(u) | loBits(v);}
-     219             : 
-     220             : #ifdef _MSC_VER
-     221             : #pragma warning( push )
-     222             : #pragma warning( disable : 4146 )
-     223             : #endif
-     224             :         uint32_t twist( const uint32_t& m, const uint32_t& s0, const uint32_t& s1 ) const
-     225    28857983 :         {       return m ^ (mixBits(s0,s1)>>1) ^ (-loBit(s1) & 0x9908b0dfUL);}
-     226             : 
-     227             : #ifdef _MSC_VER
-     228             : #pragma warning( pop )
-     229             : #endif
-     230             : 
-     231             :         /// Get a uint32_t from t and c
-     232             :         /// Better than uint32_t(x) in case x is floating point in [0,1]
-     233             :         /// Based on code by Lawrence Kirby (fred@genesis.demon.co.uk)
-     234             :         static uint32_t hash( time_t t, clock_t c );
-     235             : 
-     236             : };
-     237             : /** @}*/
-     238             : 
-     239             : } //namespace crpropa
-     240             : 
-     241             : #endif  // RANDOM_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Referenced.h.func-sort-c.html b/doc/coverageReport/include/crpropa/Referenced.h.func-sort-c.html deleted file mode 100644 index ce69cfb72..000000000 --- a/doc/coverageReport/include/crpropa/Referenced.h.func-sort-c.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Referenced.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Referenced.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:415673.2 %
Date:2024-04-08 14:58:22Functions:101952.6 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa10ReferencedD0Ev0
_ZN7crpropa10ReferencedD2Ev0
_ZN7crpropa7ref_ptrINS_10ModuleListEE6assignIS1_EEvRKNS0_IT_EE0
_ZN7crpropa7ref_ptrINS_11EmissionMapEEaSEPS1_0
_ZN7crpropa7ref_ptrINS_4GridINS_7Vector3IfEEEEE6assignIS4_EEvRKNS0_IT_EE0
_ZN7crpropa7ref_ptrINS_4GridIfEEE6assignIS2_EEvRKNS0_IT_EE0
_ZN7crpropa7ref_ptrINS_4GridIfEEEaSEPS2_0
_ZN7crpropa7ref_ptrINS_6ModuleEE6assignIS1_EEvRKNS0_IT_EE0
_ZN7crpropa7ref_ptrINS_7DensityEE6assignIS1_EEvRKNS0_IT_EE0
_ZN7crpropa7ref_ptrINS_13MagneticFieldEEaSEPS1_2
_ZN7crpropa7ref_ptrINS_6ModuleEEaSEPS1_4
_ZN7crpropa7ref_ptrINS_24CylindricalProjectionMapEE6assignIS1_EEvRKNS0_IT_EE5
_ZN7crpropa7ref_ptrINS_14AdvectionFieldEE6assignIS1_EEvRKNS0_IT_EE6
_ZN7crpropa7ref_ptrINS_4GridINS_7Vector3IfEEEEEaSEPS4_6
_ZN7crpropa7ref_ptrINS_13MagneticFieldEE6assignIS1_EEvRKNS0_IT_EE46
_ZN7crpropa7ref_ptrINS_11PhotonFieldEEaSEPS1_66
_ZN7crpropa7ref_ptrINS_11PhotonFieldEE6assignIS1_EEvRKNS0_IT_EE159
_ZN7crpropa7ref_ptrINS_9CandidateEE6assignIS1_EEvRKNS0_IT_EE1103
_ZNK7crpropa10Referenced15removeReferenceEv10914622
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Referenced.h.func.html b/doc/coverageReport/include/crpropa/Referenced.h.func.html deleted file mode 100644 index 1897f7f51..000000000 --- a/doc/coverageReport/include/crpropa/Referenced.h.func.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Referenced.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Referenced.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:415673.2 %
Date:2024-04-08 14:58:22Functions:101952.6 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa10ReferencedD0Ev0
_ZN7crpropa10ReferencedD2Ev0
_ZN7crpropa7ref_ptrINS_10ModuleListEE6assignIS1_EEvRKNS0_IT_EE0
_ZN7crpropa7ref_ptrINS_11EmissionMapEEaSEPS1_0
_ZN7crpropa7ref_ptrINS_11PhotonFieldEE6assignIS1_EEvRKNS0_IT_EE159
_ZN7crpropa7ref_ptrINS_11PhotonFieldEEaSEPS1_66
_ZN7crpropa7ref_ptrINS_13MagneticFieldEE6assignIS1_EEvRKNS0_IT_EE46
_ZN7crpropa7ref_ptrINS_13MagneticFieldEEaSEPS1_2
_ZN7crpropa7ref_ptrINS_14AdvectionFieldEE6assignIS1_EEvRKNS0_IT_EE6
_ZN7crpropa7ref_ptrINS_24CylindricalProjectionMapEE6assignIS1_EEvRKNS0_IT_EE5
_ZN7crpropa7ref_ptrINS_4GridINS_7Vector3IfEEEEE6assignIS4_EEvRKNS0_IT_EE0
_ZN7crpropa7ref_ptrINS_4GridINS_7Vector3IfEEEEEaSEPS4_6
_ZN7crpropa7ref_ptrINS_4GridIfEEE6assignIS2_EEvRKNS0_IT_EE0
_ZN7crpropa7ref_ptrINS_4GridIfEEEaSEPS2_0
_ZN7crpropa7ref_ptrINS_6ModuleEE6assignIS1_EEvRKNS0_IT_EE0
_ZN7crpropa7ref_ptrINS_6ModuleEEaSEPS1_4
_ZN7crpropa7ref_ptrINS_7DensityEE6assignIS1_EEvRKNS0_IT_EE0
_ZN7crpropa7ref_ptrINS_9CandidateEE6assignIS1_EEvRKNS0_IT_EE1103
_ZNK7crpropa10Referenced15removeReferenceEv10914622
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Referenced.h.gcov.html b/doc/coverageReport/include/crpropa/Referenced.h.gcov.html deleted file mode 100644 index 5a9b12d1c..000000000 --- a/doc/coverageReport/include/crpropa/Referenced.h.gcov.html +++ /dev/null @@ -1,320 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Referenced.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Referenced.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:415673.2 %
Date:2024-04-08 14:58:22Functions:101952.6 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_REFERENCED_H
-       2             : #define CRPROPA_REFERENCED_H
-       3             : 
-       4             : #include <cstddef>
-       5             : 
-       6             : #ifdef DEBUG
-       7             : #include <iostream>
-       8             : #include <typeinfo>
-       9             : #endif
-      10             : 
-      11             : namespace crpropa {
-      12             : /**
-      13             :  * \addtogroup Core
-      14             :  * @{
-      15             :  */
-      16             : 
-      17             : /**
-      18             :  @class Referenced
-      19             :  @brief Base class for reference counting
-      20             : 
-      21             :  A form of memory management is needed to prevent memory leaks when using MPC in Python via SWIG.
-      22             :  This base class enables reference counting.
-      23             :  Every reference increases the reference counter, every dereference decreases it.
-      24             :  When the counter is decreased to 0, the object is deleted.
-      25             :  Candidate, Module, MagneticField and Source inherit from this class
-      26             :  */
-      27             : class Referenced {
-      28             : public:
-      29             : 
-      30     3369415 :         inline Referenced() :
-      31     3369394 :                         _referenceCount(0) {
-      32             :         }
-      33             : 
-      34           0 :         inline Referenced(const Referenced&) :
-      35           0 :                         _referenceCount(0) {
-      36             :         }
-      37             : 
-      38             :         inline Referenced& operator =(const Referenced&) {
-      39             :                 return *this;
-      40             :         }
-      41             : 
-      42             :         inline size_t addReference() const {
-      43             :                 int newRef;
-      44             : #if defined(OPENMP_3_1)
-      45             :                 #pragma omp atomic capture
-      46             :                 {newRef = _referenceCount++;}
-      47             : #elif defined(__GNUC__)
-      48    10913236 :                 newRef = __sync_add_and_fetch(&_referenceCount, 1);
-      49             : #else
-      50             :                 #pragma omp critical
-      51             :                 {newRef = _referenceCount++;}
-      52             : #endif
-      53     7546128 :                 return newRef;
-      54             :         }
-      55             : 
-      56    10914622 :         inline size_t removeReference() const {
-      57             : #ifdef DEBUG
-      58             :                 if (_referenceCount == 0)
-      59             :                         std::cerr
-      60             :                                         << "WARNING: Remove reference from Object with NO references: "
-      61             :                                         << typeid(*this).name() << std::endl;
-      62             : #endif
-      63             :                 int newRef;
-      64             : #if defined(OPENMP_3_1)
-      65             :                 #pragma omp atomic capture
-      66             :                 {newRef = _referenceCount--;}
-      67             : #elif defined(__GNUC__)
-      68    10914622 :                 newRef = __sync_sub_and_fetch(&_referenceCount, 1);
-      69             : #else
-      70             :                 #pragma omp critical
-      71             :                 {newRef = _referenceCount--;}
-      72             : #endif
-      73             : 
-      74    10914622 :                 if (newRef == 0) {
-      75     3367410 :                         delete this;
-      76             :                 }
-      77    10914622 :                 return newRef;
-      78             :         }
-      79             : 
-      80             :         int removeReferenceNoDelete() const {
-      81           0 :                 return --_referenceCount;
-      82             :         }
-      83             : 
-      84             :         inline size_t getReferenceCount() const {
-      85           0 :                 return _referenceCount;
-      86             :         }
-      87             : 
-      88             : protected:
-      89             : 
-      90           0 :         virtual inline ~Referenced() {
-      91             : #ifdef DEBUG
-      92             :                 if (_referenceCount)
-      93             :                         std::cerr << "WARNING: Deleting Object with references: "
-      94             :                                         << typeid(*this).name() << std::endl;
-      95             : #endif
-      96           0 :         }
-      97             : 
-      98             :         mutable size_t _referenceCount;
-      99             : };
-     100             : 
-     101             : inline void intrusive_ptr_add_ref(Referenced* p) {
-     102             :         p->addReference();
-     103             : }
-     104             : inline void intrusive_ptr_release(Referenced* p) {
-     105           0 :         p->removeReference();
-     106             : }
-     107             : 
-     108             : /**
-     109             :  @class ref_ptr
-     110             :  @brief Referenced pointer
-     111             :  */
-     112             : template<class T>
-     113             : class ref_ptr {
-     114             : public:
-     115             :         typedef T element_type;
-     116             : 
-     117         167 :         ref_ptr() :
-     118         167 :                         _ptr(0) {
-     119             :         }
-     120     3328293 :         ref_ptr(T* ptr) :
-     121     3330334 :                         _ptr(ptr) {
-     122        3307 :                 if (_ptr)
-     123             :                         _ptr->addReference();
-     124             :         }
-     125     7541490 :         ref_ptr(const ref_ptr& rp) :
-     126     7541372 :                         _ptr(rp._ptr) {
-     127     7541428 :                 if (_ptr)
-     128             :                         _ptr->addReference();
-     129           2 :         }
-     130           4 :         template<class Other> ref_ptr(const ref_ptr<Other>& rp) :
-     131           4 :                         _ptr(rp._ptr) {
-     132             :                 if (_ptr)
-     133             :                         _ptr->addReference();
-     134             :         }
-     135             : 
-     136             :         ~ref_ptr() {
-     137    10870856 :                 if (_ptr)
-     138    10870929 :                         _ptr->removeReference();
-     139             :                 _ptr = 0;
-     140    10870851 :         }
-     141             : 
-     142             :         ref_ptr& operator =(const ref_ptr& rp) {
-     143         218 :                 assign(rp);
-     144           0 :                 return *this;
-     145             :         }
-     146             : 
-     147             :         template<class Other> ref_ptr& operator =(const ref_ptr<Other>& rp) {
-     148             :                 assign(rp);
-     149             :                 return *this;
-     150             :         }
-     151             : 
-     152          78 :         inline ref_ptr& operator =(T* ptr) {
-     153          78 :                 if (_ptr == ptr)
-     154             :                         return *this;
-     155             :                 T* tmp_ptr = _ptr;
-     156          78 :                 _ptr = ptr;
-     157          78 :                 if (_ptr)
-     158             :                         _ptr->addReference();
-     159          78 :                 if (tmp_ptr)
-     160          68 :                         tmp_ptr->removeReference();
-     161             :                 return *this;
-     162             :         }
-     163             : 
-     164             :         operator T*() const {
-     165      481185 :                 return _ptr;
-     166             :         }
-     167             : 
-     168             :         T& operator*() const {
-     169        6611 :                 return *_ptr;
-     170             :         }
-     171             :         T* operator->() const {
-     172     6292284 :                 return _ptr;
-     173             :         }
-     174             :         T* get() const {
-     175          37 :                 return _ptr;
-     176             :         }
-     177             : 
-     178             :         bool operator!() const {
-     179           0 :                 return _ptr == 0;
-     180             :         } // not required
-     181             :         bool valid() const {
-     182     5881570 :                 return _ptr != 0;
-     183             :         }
-     184             : 
-     185             :         T* release() {
-     186           0 :                 T* tmp = _ptr;
-     187           0 :                 if (_ptr)
-     188             :                         _ptr->removeReferenceNoDelete();
-     189           0 :                 _ptr = 0;
-     190             :                 return tmp;
-     191             :         }
-     192             : 
-     193             :         void swap(ref_ptr& rp) {
-     194           0 :                 T* tmp = _ptr;
-     195           0 :                 _ptr = rp._ptr;
-     196           0 :                 rp._ptr = tmp;
-     197             :         }
-     198             : 
-     199             : private:
-     200             : 
-     201        1319 :         template<class Other> void assign(const ref_ptr<Other>& rp) {
-     202        1319 :                 if (_ptr == rp._ptr)
-     203             :                         return;
-     204             :                 T* tmp_ptr = _ptr;
-     205        1315 :                 _ptr = rp._ptr;
-     206        1315 :                 if (_ptr)
-     207             :                         _ptr->addReference();
-     208        1315 :                 if (tmp_ptr)
-     209          91 :                         tmp_ptr->removeReference();
-     210             :         }
-     211             : 
-     212             :         template<class Other> friend class ref_ptr;
-     213             : 
-     214             :         T* _ptr;
-     215             : };
-     216             : 
-     217             : template<class T> inline
-     218             : void swap(ref_ptr<T>& rp1, ref_ptr<T>& rp2) {
-     219             :         rp1.swap(rp2);
-     220             : }
-     221             : 
-     222             : template<class T> inline T* get_pointer(const ref_ptr<T>& rp) {
-     223             :         return rp.get();
-     224             : }
-     225             : 
-     226             : template<class T, class Y> inline ref_ptr<T> static_pointer_cast(
-     227             :                 const ref_ptr<Y>& rp) {
-     228             :         return static_cast<T*>(rp.get());
-     229             : }
-     230             : 
-     231             : template<class T, class Y> inline ref_ptr<T> dynamic_pointer_cast(
-     232             :                 const ref_ptr<Y>& rp) {
-     233             :         return dynamic_cast<T*>(rp.get());
-     234             : }
-     235             : 
-     236             : template<class T, class Y> inline ref_ptr<T> const_pointer_cast(
-     237             :                 const ref_ptr<Y>& rp) {
-     238             :         return const_cast<T*>(rp.get());
-     239             : }
-     240             : 
-     241             : /** @}*/
-     242             : } // namespace crpropa
-     243             : 
-     244             : #endif // CRPROPA_REFERENCED_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Source.h.func-sort-c.html b/doc/coverageReport/include/crpropa/Source.h.func-sort-c.html deleted file mode 100644 index e0c693ff0..000000000 --- a/doc/coverageReport/include/crpropa/Source.h.func-sort-c.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Source.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Source.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:141877.8 %
Date:2024-04-08 14:58:22Functions:010.0 %
-
- -
- - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa13SourceFeature15prepareParticleERNS_13ParticleStateE0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Source.h.func.html b/doc/coverageReport/include/crpropa/Source.h.func.html deleted file mode 100644 index 646b8d073..000000000 --- a/doc/coverageReport/include/crpropa/Source.h.func.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Source.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Source.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:141877.8 %
Date:2024-04-08 14:58:22Functions:010.0 %
-
- -
- - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa13SourceFeature15prepareParticleERNS_13ParticleStateE0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Source.h.gcov.html b/doc/coverageReport/include/crpropa/Source.h.gcov.html deleted file mode 100644 index 82cca4d84..000000000 --- a/doc/coverageReport/include/crpropa/Source.h.gcov.html +++ /dev/null @@ -1,1002 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Source.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Source.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:141877.8 %
Date:2024-04-08 14:58:22Functions:010.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_SOURCE_H
-       2             : #define CRPROPA_SOURCE_H
-       3             : 
-       4             : #include "crpropa/Candidate.h"
-       5             : #include "crpropa/Grid.h"
-       6             : #include "crpropa/EmissionMap.h"
-       7             : #include "crpropa/massDistribution/Density.h"
-       8             : 
-       9             : 
-      10             : #include <vector>
-      11             : 
-      12             : namespace crpropa {
-      13             : /** @addtogroup SourceFeatures
-      14             :  *  @{
-      15             :  */
-      16             : 
-      17             : 
-      18             : /**
-      19             :  @class SourceFeature
-      20             :  @brief Abstract base class for specific source features
-      21             :  */
-      22           7 : class SourceFeature: public Referenced {
-      23             : protected:
-      24             :         std::string description;
-      25             : public:
-      26           0 :         virtual void prepareParticle(ParticleState& particle) const {};
-      27             :         virtual void prepareCandidate(Candidate& candidate) const;
-      28             :         std::string getDescription() const;
-      29             : };
-      30             : 
-      31             : 
-      32             : /**
-      33             :  @class SourceInterface
-      34             :  @brief Abstract base class for sources
-      35             :  */
-      36             : class SourceInterface : public Referenced {
-      37             : public:
-      38             :         virtual ref_ptr<Candidate> getCandidate() const = 0;
-      39             :         virtual std::string getDescription() const = 0;
-      40             : };
-      41             : 
-      42             : 
-      43             : /**
-      44             :  @class Source
-      45             :  @brief General source of particles
-      46             : 
-      47             :  This class is a container for source features.
-      48             :  The source prepares a new candidate by passing it to all its source features
-      49             :  to be modified accordingly.
-      50             :  */
-      51          10 : class Source: public SourceInterface {
-      52             :         std::vector<ref_ptr<SourceFeature> > features;
-      53             : public:
-      54             :         void add(SourceFeature* feature);
-      55             :         ref_ptr<Candidate> getCandidate() const;
-      56             :         std::string getDescription() const;
-      57             : };
-      58             : 
-      59             : 
-      60             : /**
-      61             :  @class SourceList
-      62             :  @brief List of particle sources of individual luminosities.
-      63             : 
-      64             :  The SourceList is a source itself. It can be used if several sources are
-      65             :  needed in one simulation.
-      66             :  */
-      67           3 : class SourceList: public SourceInterface {
-      68             :         std::vector<ref_ptr<Source> > sources;
-      69             :         std::vector<double> cdf;
-      70             : public:
-      71             :         /** Add an individual source to the list.
-      72             :          @param source          source to be added
-      73             :          @param weight          weight of the source; defaults to 1.
-      74             :          */
-      75             :         void add(Source* source, double weight = 1);
-      76             :         ref_ptr<Candidate> getCandidate() const;
-      77             :         std::string getDescription() const;
-      78             : };
-      79             : 
-      80             : 
-      81             : /**
-      82             :  @class SourceParticleType
-      83             :  @brief Particle type at the source
-      84             : 
-      85             :  This feature assigns a single particle type to the source.
-      86             :  For multiple types, use e.g. SourceMultipleParticleTypes.
-      87             :  Particles are identified following the PDG numbering scheme:
-      88             :    https://pdg.lbl.gov/2019/reviews/rpp2019-rev-monte-carlo-numbering.pdf
-      89             :  */
-      90             : class SourceParticleType: public SourceFeature {
-      91             :         int id;
-      92             : public:
-      93             :         /** Constructor for a source with a sign
-      94             :          @param id              id of the particle following the PDG numbering scheme
-      95             :         */
-      96             :         SourceParticleType(int id);
-      97             :         void prepareParticle(ParticleState &particle) const;
-      98             :         void setDescription();
-      99             : };
-     100             : 
-     101             : 
-     102             : /**
-     103             :  @class SourceMultipleParticleTypes
-     104             :  @brief Multiple particle types with individual relative abundances
-     105             : 
-     106             :  This feature assigns particle types to the events emitted by the sources.
-     107             :  It is possible to control the relative abundance of each particle species.
-     108             :  Particles are identified following the PDG numbering scheme:
-     109             :    https://pdg.lbl.gov/2019/reviews/rpp2019-rev-monte-carlo-numbering.pdf
-     110             :  */
-     111             : class SourceMultipleParticleTypes: public SourceFeature {
-     112             :         std::vector<int> particleTypes;
-     113             :         std::vector<double> cdf;
-     114             : public:
-     115             :         /** Constructor
-     116             :          */
-     117             :         SourceMultipleParticleTypes();
-     118             :         /** Add an individual particle type.
-     119             :          @param id                      id of the particle following the PDG numbering scheme
-     120             :          @param weight          relative abundance of individual particle species
-     121             :          */
-     122             :         void add(int id, double weight = 1);
-     123             :         void prepareParticle(ParticleState &particle) const;
-     124             :         void setDescription();
-     125             : };
-     126             : 
-     127             : 
-     128             : /**
-     129             :  @class SourceEnergy
-     130             :  @brief Sets the initial energy of the emitted particles to a specific value
-     131             : 
-     132             :  This feature assigns a monochromatic spectrum, i.e., a single energy to all particles.
-     133             :  */
-     134             : class SourceEnergy: public SourceFeature {
-     135             :         double E;
-     136             : public:
-     137             :         /** Constructor
-     138             :          @param energy          energy of the particle (in Joules)
-     139             :          */
-     140             :         SourceEnergy(double energy);
-     141             :         void prepareParticle(ParticleState &particle) const;
-     142             :         void setDescription();
-     143             : };
-     144             : 
-     145             : 
-     146             : /**
-     147             :  @class SourcePowerLawSpectrum
-     148             :  @brief Particle energy following a power-law spectrum
-     149             : 
-     150             :  The power law is of the form: dN/dE ~ E^index, for energies in the interval [Emin, Emax].
-     151             :  */
-     152           1 : class SourcePowerLawSpectrum: public SourceFeature {
-     153             :         double Emin;
-     154             :         double Emax;
-     155             :         double index;
-     156             : public:
-     157             :         /** Constructor
-     158             :          @param Emin            minimum energy (in Joules)
-     159             :          @param Emax            maximum energy (in Joules)
-     160             :          @param index           spectral index of the power law
-     161             :          */
-     162             :         SourcePowerLawSpectrum(double Emin, double Emax, double index);
-     163             :         void prepareParticle(ParticleState &particle) const;
-     164             :         void setDescription();
-     165             : };
-     166             : 
-     167             : 
-     168             : /**
-     169             :  @class SourceComposition
-     170             :  @brief Multiple nuclear species with a rigidity-dependent power-law spectrum
-     171             : 
-     172             :  The power law is of the form: E^index, for energies in the interval [Emin, Z * Rmax].
-     173             :  */
-     174             : class SourceComposition: public SourceFeature {
-     175             :         double Emin;
-     176             :         double Rmax;
-     177             :         double index;
-     178             :         std::vector<int> nuclei;
-     179             :         std::vector<double> cdf;
-     180             : public:
-     181             :         /** Constructor
-     182             :          @param Emin            minimum energy (in Joules)
-     183             :          @param Rmax            maximum rigidity (in Volts)
-     184             :          @param index           spectral index of the power law
-     185             :          */
-     186             :         SourceComposition(double Emin, double Rmax, double index);
-     187             :         /** Add individual particle species with a given abundance
-     188             :          @param id                      id of the particle following the PDG numbering scheme
-     189             :          @param abundance       relative abundance of the particle species
-     190             :          */
-     191             :         void add(int id, double abundance);
-     192             :         /** Add individual particle species with a given abundance
-     193             :          @param A                       atomic mass of the cosmic-ray nucleus
-     194             :          @param Z                       atomic number of the cosmic-ray nucleus
-     195             :          @param abundance       relative abundance of the particle species
-     196             :          */
-     197             :         void add(int A, int Z, double abundance);
-     198             :         void prepareParticle(ParticleState &particle) const;
-     199             :         void setDescription();
-     200             : };
-     201             : 
-     202             : 
-     203             : /**
-     204             :  @class SourcePosition
-     205             :  @brief Position of a point source
-     206             :  */
-     207           1 : class SourcePosition: public SourceFeature {
-     208             :         Vector3d position; 
-     209             : public:
-     210             :         /** Constructor for a source in 3D
-     211             :          @param position        vector containing the coordinates of the point source [in meters]
-     212             :          */
-     213             :         SourcePosition(Vector3d position);
-     214             :         /** Constructor for a source in 1D
-     215             :          @param d       distance of the point source to the observer at x = 0 [in meters]; 
-     216             :                                 internally this will be converted to a vector with x-coordinate equal to d
-     217             :          */
-     218             :         SourcePosition(double d);
-     219             :         void prepareParticle(ParticleState &state) const;
-     220             :         void setDescription();
-     221             : };
-     222             : 
-     223             : 
-     224             : /**
-     225             :  @class SourceMultiplePositions
-     226             :  @brief Multiple point-source positions with individual luminosities
-     227             :  */
-     228             : class SourceMultiplePositions: public SourceFeature {
-     229             :         std::vector<Vector3d> positions;
-     230             :         std::vector<double> cdf;
-     231             : public:
-     232             :         /** Constructor.
-     233             :          The sources must be added individually to the object.
-     234             :          */
-     235             :         SourceMultiplePositions();
-     236             :         /** Add an individual source with a given luminosity/contribution.
-     237             :          @param position        vector containing the coordinates of the point source [in meters]
-     238             :          @param weight          luminosity/contribution of the individual source
-     239             :          */
-     240             :         void add(Vector3d position, double weight = 1);
-     241             :         void prepareParticle(ParticleState &particle) const;
-     242             :         void setDescription();
-     243             : };
-     244             : 
-     245             : 
-     246             : /**
-     247             :  @class SourceUniformSphere
-     248             :  @brief Uniform distribution of sources in a spherical volume
-     249             :  */
-     250           1 : class SourceUniformSphere: public SourceFeature {
-     251             :         Vector3d center;
-     252             :         double radius;
-     253             : public:
-     254             :         /** Constructor
-     255             :          @param center          vector containing the coordinates of the center of the sphere
-     256             :          @param radius          radius of the sphere
-     257             :          */
-     258             :         SourceUniformSphere(Vector3d center, double radius);
-     259             :         void prepareParticle(ParticleState &particle) const;
-     260             :         void setDescription();
-     261             : };
-     262             : 
-     263             : 
-     264             : /**
-     265             :  @class SourceUniformHollowSphere
-     266             :  @brief Uniform distribution of sources between two spheres
-     267             :  */
-     268           1 : class SourceUniformHollowSphere: public SourceFeature {
-     269             :         Vector3d center;
-     270             :         double radius_inner;
-     271             :         double radius_outer;
-     272             : public:
-     273             :         /** Constructor
-     274             :          @param center                  vector containing the coordinates of the center of the sphere
-     275             :          @param radius_inner    radius of the inner sphere
-     276             :          @param radius_outer    radius of the outer sphere
-     277             :          */
-     278             :         SourceUniformHollowSphere(Vector3d center,
-     279             :                         double radius_inner, double radius_outer);
-     280             :         void prepareParticle(ParticleState &particle) const;
-     281             :         void setDescription();
-     282             : };
-     283             : 
-     284             : 
-     285             : /**
-     286             :  @class SourceUniformShell
-     287             :  @brief Uniform distribution of source positions on the surface of a sphere
-     288             :  */
-     289             : class SourceUniformShell: public SourceFeature {
-     290             :         Vector3d center;
-     291             :         double radius;
-     292             : public:
-     293             :         /** Constructor
-     294             :          @param center          vector containing the coordinates of the center of the sphere
-     295             :          @param radius          radius of the sphere
-     296             :          */
-     297             :         SourceUniformShell(Vector3d center, double radius);
-     298             :         void prepareParticle(ParticleState &particle) const;
-     299             :         void setDescription();
-     300             : };
-     301             : 
-     302             : 
-     303             : /**
-     304             :  @class SourceUniformBox
-     305             :  @brief Uniform random source positions inside a box. The box is aligned with the coordinate axes.
-     306             :  */
-     307           1 : class SourceUniformBox: public SourceFeature {
-     308             :         Vector3d origin;        // lower box corner
-     309             :         Vector3d size;          // sizes along each coordinate axes.
-     310             : public:
-     311             :         /** Constructor
-     312             :          @param origin  vector corresponding to the lower box corner
-     313             :          @param size    vector corresponding to the box sizes along each direction
-     314             :          */
-     315             :         SourceUniformBox(Vector3d origin, Vector3d size);
-     316             :         void prepareParticle(ParticleState &particle) const;
-     317             :         void setDescription();
-     318             : };
-     319             : 
-     320             : 
-     321             : /**
-     322             :  @class SourceUniformCylinder
-     323             :  @brief Uniform distribution of source positions inside the volume of a cylinder whose axis is along the z-axis. 
-     324             : 
-     325             :  The circle of the cylinder lays in the xy-plane and the height is along the z-axis.
-     326             :  */
-     327           1 : class SourceUniformCylinder: public SourceFeature {
-     328             :         Vector3d origin;        // central point of cylinder 
-     329             :         double height;          // total height of the cylinder along z-axis. Half over/under the center.
-     330             :         double radius;          // radius of the cylinder in the xy-plane
-     331             : public:
-     332             :         /** Constructor
-     333             :          @param origin  vector corresponding to the center of the cylinder axis
-     334             :          @param height  height of the cylinder, half lays over the origin, half is lower
-     335             :          @param radius  radius of the cylinder
-     336             :          */
-     337             :         SourceUniformCylinder(Vector3d origin, double height, double radius);
-     338             :         void prepareParticle(ParticleState &particle) const;
-     339             :         void setDescription();
-     340             : };
-     341             : 
-     342             : 
-     343             : /**
-     344             :  @class SourceSNRDistribution
-     345             :  @brief Source distribution that follows the Galactic SNR distribution in 2D
-     346             : 
-     347             :  The origin of the distribution is the Galactic center. The default maximum radius is set 
-     348             :  to rMax=20 kpc and the default maximum height is zMax = 5 kpc.
-     349             :  See G. Case and D. Bhattacharya (1996) for the details of the distribution.
-     350             :  */
-     351           1 : class SourceSNRDistribution: public SourceFeature {
-     352             :         double rEarth; // parameter given by observation
-     353             :         double alpha; // parameter to shift the maximum in R direction
-     354             :         double beta; // parameter to shift the maximum in R direction
-     355             :         double zg; // exponential cut parameter in z direction
-     356             :         double frMax; // helper for efficient sampling
-     357             :         double fzMax; // helper for efficient sampling
-     358             :         double rMax; // maximum radial distance - default 20 kpc 
-     359             :                       // (due to the extension of the JF12 field)
-     360             :         double zMax; // maximum distance from galactic plane - default 5 kpc
-     361             :         void setFrMax(); // calculate frMax with the current parameter. 
-     362             : 
-     363             : public:
-     364             :         /** Default constructor. 
-     365             :          Default parameters are:
-     366             :          . rEarth = 8.5 kpc
-     367             :          . alpha = 2
-     368             :          . beta = 3.53
-     369             :          . zg = 300 pc
-     370             :          . rMax = 20 kpc
-     371             :          . zMax = 5 kpc
-     372             :         */ 
-     373             :         SourceSNRDistribution();
-     374             :         /** Generic constructor
-     375             :          @param rEarth    distance from Earth to the Galactic centre [in meters]
-     376             :          @param alpha     parameter that shifts radially the maximum of the distributions
-     377             :          @param beta      parameter that shifts radially the maximum of the distributions 
-     378             :          @param zg                exponential cut-off parameter in the z-direction [in meters]
-     379             :         */      
-     380             :         SourceSNRDistribution(double rEarth,double alpha, double beta, double zg);
-     381             : 
-     382             :         void prepareParticle(ParticleState &particle) const;
-     383             :         /**
-     384             :          radial distribution of the SNR density.
-     385             :          @param r       galactocentric radius in [meter]
-     386             :         */
-     387             :         double fr(double r) const;
-     388             :         /**
-     389             :          height distribution of the SNR density.
-     390             :          @param z       height over/under the galactic plane in [meter]
-     391             :         */
-     392             :         double fz(double z) const;
-     393             : 
-     394             :         /**
-     395             :          Set the exponential cut-off parameter in the z-direction.
-     396             :          @param Zg      cut-off parameter
-     397             :         */
-     398             :         void setFzMax(double Zg);
-     399             : 
-     400             :         /**
-     401             :          @param rMax maximal radius up to which sources are possible
-     402             :         */
-     403             :         void setRMax(double rMax);
-     404             : 
-     405             :         /**
-     406             :          @param zMax maximal height up to which sources are possible
-     407             :         */
-     408             :         void setZMax(double zMax);
-     409             : 
-     410             :         // parameter for the raidal distribution
-     411             :         void setAlpha(double a);
-     412             :         // parameter for the exponential cut-off in the radial distribution
-     413             :         void setBeta(double b);
-     414             :         double getFrMax() const;
-     415             :         double getFzMax() const;
-     416             :         double getRMax() const;
-     417             :         double getZMax() const;
-     418             :         double getAlpha() const;
-     419             :         double getBeta() const;
-     420             :         void setDescription();
-     421             : };
-     422             : 
-     423             : 
-     424             : /**
-     425             :  @class SourcePulsarDistribution
-     426             :  @brief Source distribution following the Galactic pulsar distribution
-     427             : 
-     428             :  A logarithmic spiral with four arms is used for the radial distribution.
-     429             :  The z-distribution is a simple exponentially decaying distribution.
-     430             :  The pulsar distribution is explained in detail in C.-A. Faucher-Giguere
-     431             :  and V. M. Kaspi, ApJ 643 (May, 2006) 332. The radial distribution is 
-     432             :  parametrized as in Blasi and Amato, JCAP 1 (Jan., 2012) 10.
-     433             :  */
-     434             : class SourcePulsarDistribution: public SourceFeature {
-     435             :         double rEarth; // parameter given by observation
-     436             :         double beta; // parameter to shift the maximum in R direction
-     437             :         double zg; // exponential cut parameter in z direction
-     438             :         double frMax; // helper for efficient sampling
-     439             :         double fzMax; // helper for efficient sampling
-     440             :         double rMax; // maximum radial distance - default 22 kpc 
-     441             :         double zMax; // maximum distance from galactic plane - default 5 kpc
-     442             :         double rBlur; // relative smearing factor for the radius
-     443             :         double thetaBlur; // smearing factor for the angle. Unit = [1/length]
-     444             : public:
-     445             :         /** Default constructor. 
-     446             :          Default parameters are:
-     447             :          . rEarth = 8.5 kpc
-     448             :          . beta = 3.53
-     449             :          . zg = 300 pc
-     450             :          . Rmax = 22 kpc
-     451             :          . Zmax = 5 kpc
-     452             :          . rBlur = 0.07
-     453             :          . thetaBlur = 0.35 / kpc
-     454             :          */ 
-     455             :         SourcePulsarDistribution();     
-     456             :         /** Generic constructor
-     457             :          @param rEarth          distance from Earth to the Galactic centre [in meters]
-     458             :          @param beta            parameter that shifts radially the maximum of the distributions 
-     459             :          @param zg                      exponential cut-off parameter in the z-direction [in meters]
-     460             :          @param rBlur           relative smearing factor for radius
-     461             :          @param thetaBlur       smearing factor for the angle [in 1 / meters]
-     462             :          */     
-     463             :         SourcePulsarDistribution(double rEarth, double beta, double zg, double rBlur, double thetaBlur);
-     464             :         void prepareParticle(ParticleState &particle) const;
-     465             : 
-     466             :         /** 
-     467             :          radial distribution of pulsars
-     468             :          @param r       galactocentric radius
-     469             :         */
-     470             :         double fr(double r) const;
-     471             :         /**
-     472             :          z distribution of pulsars
-     473             :          @param z       height over/under the galactic plane
-     474             :         */
-     475             :         double fz(double z) const;
-     476             :         double ftheta(int i, double r) const;
-     477             :         double blurR(double r_tilde) const;
-     478             :         double blurTheta(double theta_tilde, double r_tilde) const;
-     479             :         void setFrMax(double R, double b);
-     480             :         void setFzMax(double zg);
-     481             :         void setRMax(double rMax);
-     482             :         void setZMax(double zMax);
-     483             :         void setRBlur(double rBlur);
-     484             :         void setThetaBlur(double thetaBlur);
-     485             :         double getFrMax();
-     486             :         double getFzMax();
-     487             :         double getRMax();
-     488             :         double getZMax();
-     489             :         double getRBlur();
-     490             :         double getThetaBlur();
-     491             :         void setDescription();
-     492             : };
-     493             : 
-     494             : 
-     495             : /**
-     496             :  @class SourceUniform1D
-     497             :  @brief Uniform source distribution in 1D
-     498             : 
-     499             :  This source property sets random x-coordinates according to a uniform source
-     500             :  distribution in a given distance interval. If cosmological effects are included, 
-     501             :  this is done by drawing a light-travel distance from a flat distribution and
-     502             :  converting to a comoving distance. In the absence of cosmological effects, the
-     503             :  positions are drawn uniformly in the light-travel distance interval (as opposed
-     504             :  to a comoving interval).
-     505             :  The source positions are assigned to the x-coordinate (Vector3d(distance, 0, 0))
-     506             :  in this one-dimensional case.
-     507             :  */
-     508             : class SourceUniform1D: public SourceFeature {
-     509             :         double minD; // minimum light-travel distance
-     510             :         double maxD; // maximum light-travel distance
-     511             :         bool withCosmology;     // whether to account for cosmological effects (expansion of the Universe)
-     512             : public:
-     513             :         /** Constructor
-     514             :          @param minD                    minimum distance; comoving if withCosmology is True
-     515             :          @param maxD                    maximum distance; comoving if withCosmology is True
-     516             :          @param withCosmology   whether to account for cosmological effects (expansion of the Universe)
-     517             :          */
-     518             :         SourceUniform1D(double minD, double maxD, bool withCosmology = true);
-     519             :         void prepareParticle(ParticleState& particle) const;
-     520             :         void setDescription();
-     521             : };
-     522             : 
-     523             : 
-     524             : /**
-     525             :  @class SourceDensityGrid
-     526             :  @brief Random source positions from a density grid
-     527             :  */
-     528             : class SourceDensityGrid: public SourceFeature {
-     529             :         ref_ptr<Grid1f> grid;
-     530             : public:
-     531             :         /** Constructor
-     532             :          @param densityGrid     3D grid containing the density of sources in each cell
-     533             :          */
-     534             :         SourceDensityGrid(ref_ptr<Grid1f> densityGrid);
-     535             :         void prepareParticle(ParticleState &particle) const;
-     536             :         void setDescription();
-     537             : };
-     538             : 
-     539             : 
-     540             : /**
-     541             :  @class SourceDensityGrid1D
-     542             :  @brief Random source positions from a 1D density grid
-     543             :  */
-     544             : class SourceDensityGrid1D: public SourceFeature {
-     545             :         ref_ptr<Grid1f> grid;     // 1D grid with Ny = Nz = 1
-     546             : public:
-     547             :         /** Constructor
-     548             :          @param densityGrid     1D grid containing the density of sources in each cell, Ny and Nz must be 1
-     549             :          */
-     550             :         SourceDensityGrid1D(ref_ptr<Grid1f> densityGrid);
-     551             :         void prepareParticle(ParticleState &particle) const;
-     552             :         void setDescription();
-     553             : };
-     554             : 
-     555             : 
-     556             : /**
-     557             :  @class SourceIsotropicEmission
-     558             :  @brief Isotropic emission from a source
-     559             :  */
-     560             : class SourceIsotropicEmission: public SourceFeature {
-     561             : public:
-     562             :         /** Constructor
-     563             :          */
-     564             :         SourceIsotropicEmission();
-     565             :         void prepareParticle(ParticleState &particle) const;
-     566             :         void setDescription();
-     567             : };
-     568             : 
-     569             : 
-     570             : /**
-     571             :  @class SourceDirectedEmission
-     572             :  @brief Directed emission from a source from the von-Mises-Fisher distribution 
-     573             :  
-     574             :  The emission from the source is generated following the von-Mises-Fisher distribution
-     575             :  with mean direction mu and concentration parameter kappa.
-     576             :  The sampling from the vMF distribution follows this document by Julian Straub:
-     577             :  http://people.csail.mit.edu/jstraub/download/straub2017vonMisesFisherInference.pdf
-     578             :  The emitted particles are assigned a weight so that the detected particles can be
-     579             :  reweighted to an isotropic emission distribution instead of a vMF distribution.
-     580             :  For details, see PoS (ICRC2019) 447.
-     581             :  */
-     582           1 : class SourceDirectedEmission: public SourceFeature {
-     583             :         Vector3d mu; // Mean emission direction in the vMF distribution
-     584             :         double kappa; // Concentration parameter of the vMF distribution
-     585             : public:
-     586             :         /** Constructor
-     587             :          @param mu      mean direction of the emission, mu should be normelized
-     588             :          @param kappa   concentration parameter
-     589             :         */
-     590             :         SourceDirectedEmission(Vector3d mu, double kappa);
-     591             :         void prepareCandidate(Candidate &candidate) const;
-     592             :         void setDescription();
-     593             : };
-     594             : 
-     595             : /**
-     596             :  @class SourceLambertDistributionOnSphere
-     597             :  @brief Uniform random position on a sphere with isotropic Lamberts distributed directions.
-     598             : 
-     599             :  This function should be used for crosschecking the arrival distribution for a
-     600             :  Galactic propagation with an isotropic arrival distribution at the Edge of our
-     601             :  Galaxy. Note, that for simulation speed you should rather use the backtracking
-     602             :  technique: see e.g. http://physik.rwth-aachen.de/parsec
-     603             :  */
-     604             : class SourceLambertDistributionOnSphere: public SourceFeature {
-     605             :         Vector3d center;        // center of the sphere
-     606             :         double radius;          // radius of the sphere
-     607             :         bool inward;            // if true, direction point inwards
-     608             : public:
-     609             :         /** Constructor
-     610             :          @param center          vector containing the coordinates of the center of the sphere
-     611             :          @param radius          radius of the sphere
-     612             :          @param inward          if true, the directions point inwards
-     613             :          */
-     614             :         SourceLambertDistributionOnSphere(const Vector3d &center, double radius, bool inward);
-     615             :         void prepareParticle(ParticleState &particle) const;
-     616             :         void setDescription();
-     617             : };
-     618             : 
-     619             : 
-     620             : /**
-     621             :  @class SourceDirection
-     622             :  @brief Collimated emission along a specific direction
-     623             :  */
-     624             : class SourceDirection: public SourceFeature {
-     625             :         Vector3d direction;
-     626             : public:
-     627             :         /** Constructor
-     628             :          @param direction       Vector3d corresponding to the direction of emission
-     629             :          */
-     630             :         SourceDirection(Vector3d direction = Vector3d(-1, 0, 0));
-     631             :         void prepareParticle(ParticleState &particle) const;
-     632             :         void setDescription();
-     633             : };
-     634             : 
-     635             : 
-     636             : /**
-     637             :  @class SourceEmissionMap
-     638             :  @brief Deactivate Candidate if it has zero probability in provided EmissionMap. 
-     639             : 
-     640             :         This feature does not change the direction of the candidate. Therefore a usefull direction feature (isotropic or directed emission)
-     641             :         must be added to the sources before. The propability of the emission map is not taken into account. 
-     642             :  */
-     643             : class SourceEmissionMap: public SourceFeature {
-     644             :         ref_ptr<EmissionMap> emissionMap;
-     645             : public:
-     646             :         /** Constructor
-     647             :          @param emissionMap             emission map containing probabilities of emission in various directions
-     648             :          */
-     649             :         SourceEmissionMap(EmissionMap *emissionMap);
-     650             :         void prepareCandidate(Candidate &candidate) const;
-     651             :         void setEmissionMap(EmissionMap *emissionMap);
-     652             :         void setDescription();
-     653             : };
-     654             : 
-     655             : 
-     656             : /**
-     657             :  @class SourceEmissionCone
-     658             :  @brief Uniform emission within a cone
-     659             :  */
-     660           1 : class SourceEmissionCone: public SourceFeature {
-     661             :         Vector3d direction;
-     662             :         double aperture;
-     663             : public:
-     664             :         /** Constructor
-     665             :          @param direction               Vector3d corresponding to the cone axis 
-     666             :          @param aperture                opening angle of the cone
-     667             :          */
-     668             :         SourceEmissionCone(Vector3d direction, double aperture);
-     669             :         void prepareParticle(ParticleState &particle) const;
-     670             : 
-     671             :         /**
-     672             :          @param direction Vector3d corresponding to the cone axis
-     673             :         */
-     674             :         void setDirection(Vector3d direction);
-     675             :         void setDescription();
-     676             : };
-     677             : 
-     678             : 
-     679             : /**
-     680             :  @class SourceRedshift
-     681             :  @brief Emission of particles at a specific redshift (or time)
-     682             : 
-     683             :  The redshift coordinate is used to treat cosmological effects and as a time coordinate.
-     684             :  Consider, for instance, a source located at a distance corresponding to a redshift z. 
-     685             :  In the absence of processes that cause time delays (e.g., magnetic deflections), particles
-     686             :  from this source could arrive after a time corresponding to the source redshift. Charged 
-     687             :  particles, on the other hand, can arrive at a time later than the corresponding straight-
-     688             :  line travel duration. 
-     689             :  This treatment is also useful for time-dependent studies (e.g. transient sources).
-     690             :  */
-     691             : class SourceRedshift: public SourceFeature {
-     692             :         double z;
-     693             : public:
-     694             :         /** Constructor
-     695             :          @param z               redshift of emission
-     696             :          */
-     697             :         SourceRedshift(double z);
-     698             :         void prepareCandidate(Candidate &candidate) const;
-     699             :         void setDescription();
-     700             : };
-     701             : 
-     702             : 
-     703             : /**
-     704             :  @class SourceUniformRedshift
-     705             :  @brief Random redshift (time of emission) from a uniform distribution
-     706             : 
-     707             :  This function assigns random redshifts to the particles emitted by a given source.
-     708             :  These values are drawn from a uniform redshift distribution in the interval [zmin, zmax].
-     709             :  The redshift coordinate is used to treat cosmological effects and as a time coordinate.
-     710             :  Consider, for instance, a source located at a distance corresponding to a redshift z. 
-     711             :  In the absence of processes that cause time delays (e.g., magnetic deflections), particles
-     712             :  from this source could arrive after a time corresponding to the source redshift. Charged 
-     713             :  particles, on the other hand, can arrive at a time later than the corresponding straight-
-     714             :  line travel duration. 
-     715             :  This treatment is also useful for time-dependent studies (e.g. transient sources).
-     716             :  */
-     717             : class SourceUniformRedshift: public SourceFeature {
-     718             :         double zmin, zmax;
-     719             : public:
-     720             :         /** Constructor
-     721             :          @param zmin    minimum redshift
-     722             :          @param zmax    maximum redshift
-     723             :          */
-     724             :         SourceUniformRedshift(double zmin, double zmax);
-     725             :         void prepareCandidate(Candidate &candidate) const;
-     726             :         void setDescription();
-     727             : };
-     728             : 
-     729             : 
-     730             : /**
-     731             :  @class SourceRedshiftEvolution
-     732             :  @brief Random redshift (time of emission) from (1+z)^m distribution
-     733             : 
-     734             :  This assigns redshifts to a given source according to a typical power-law distribution.
-     735             :  The redshift coordinate is used to treat cosmological effects and as a time coordinate.
-     736             :  Consider, for instance, a source located at a distance corresponding to a redshift z. 
-     737             :  In the absence of processes that cause time delays (e.g., magnetic deflections), particles
-     738             :  from this source could arrive after a time corresponding to the source redshift. Charged 
-     739             :  particles, on the other hand, can arrive at a time later than the corresponding straight-
-     740             :  line travel duration. 
-     741             :  This treatment is also useful for time-dependent studies (e.g. transient sources).
-     742             :  */
-     743           2 : class SourceRedshiftEvolution: public SourceFeature {
-     744             :         double zmin, zmax;
-     745             :         double m;
-     746             : public:
-     747             :         /** Constructor
-     748             :          @param m               index of the power law (1 + z)^m
-     749             :          @param zmin    minimum redshift
-     750             :          @param zmax    maximum redshift
-     751             :          */
-     752             :         SourceRedshiftEvolution(double m, double zmin, double zmax);
-     753             :         void prepareCandidate(Candidate &candidate) const;
-     754             : };
-     755             : 
-     756             : 
-     757             : /**
-     758             :  @class SourceRedshift1D
-     759             :  @brief Redshift according to the distance to 0
-     760             : 
-     761             :  This source property sets the redshift according to the distance from 
-     762             :  the source to the origin (0, 0, 0). 
-     763             :  It must be added after the position of the source is set because it
-     764             :  computes the redshifts based on the source distance.
-     765             :  */
-     766             : class SourceRedshift1D: public SourceFeature {
-     767             : public:
-     768             :         /** Constructor
-     769             :          */
-     770             :         SourceRedshift1D();
-     771             :         void prepareCandidate(Candidate &candidate) const;
-     772             :         void setDescription();
-     773             : };
-     774             : 
-     775             : 
-     776             : #ifdef CRPROPA_HAVE_MUPARSER
-     777             : /**
-     778             :  @class SourceGenericComposition
-     779             :  @brief Add multiple cosmic rays with energies described by an expression string
-     780             : 
-     781             :  This is particularly useful if an arbitrary combination of nuclei types with 
-     782             :  specific energy spectra. The strings parsed may contain 'A' (atomic mass), 
-     783             :  'Z' (atomic number).  The following units are recognized as part of the strings:
-     784             :  GeV, TeV, PeV, EeV.  The variable for energy is 'E', with limits 'Emin', 'Emax'.
-     785             :  This property only works if muparser is available.
-     786             :  For details about the library see:
-     787             :         https://beltoforion.de/en/muparser/
-     788             :  */
-     789             : class SourceGenericComposition: public SourceFeature {
-     790             : public:
-     791           7 :         struct Nucleus {
-     792             :                 int id;
-     793             :                 std::vector<double> cdf;
-     794             :         };
-     795             :         /** Constructor
-     796             :          @param Emin            minimum energy [in Joules]
-     797             :          @param Emax            maximum energy [in Joules]
-     798             :          @param expression      string containing the expression to generate the composition
-     799             :          @param bins            number of energy bins
-     800             :          */
-     801             :         SourceGenericComposition(double Emin, double Emax, std::string expression, size_t bins = 1024);
-     802             :         /** Add an individual particle id.
-     803             :          @param id                      id of the particle following the PDG numbering scheme
-     804             :          @param abundance       relative abundance of individual particle species
-     805             :          */
-     806             :         void add(int id, double abundance);
-     807             :         /** Add an individual particle id.
-     808             :          @param A                       atomic mass of the cosmic-ray nucleus
-     809             :          @param Z                       atomic number of the cosmic-ray nucleus
-     810             :          @param abundance       relative abundance of individual particle species
-     811             :          */
-     812             :         void add(int A, int Z, double abundance);
-     813             :         void prepareParticle(ParticleState &particle) const;
-     814             :         void setDescription();
-     815             : 
-     816             :         const std::vector<double> *getNucleusCDF(int id) const {
-     817           0 :                 for (size_t i = 0; i < nuclei.size(); i++) {
-     818           0 :                         if (nuclei[i].id == id)
-     819           0 :                                 return &nuclei[i].cdf;
-     820             :                 }
-     821             :                 return 0;
-     822             :         }
-     823             : 
-     824             : protected:
-     825             :         double Emin, Emax;
-     826             :         size_t bins;
-     827             :         std::string expression;
-     828             :         std::vector<double> energy;
-     829             : 
-     830             :         std::vector<Nucleus> nuclei;
-     831             :         std::vector<double> cdf;
-     832             : 
-     833             : };
-     834             : #endif
-     835             : 
-     836             : /**
-     837             :  * @class SourceTag
-     838             :  * @brief All candidates from this source get a given tag. This can be used to distinguish between different sources that follow the same spatial distribution
-     839             :  * 
-     840             :  * Sets the tag of the candidate. Can be used to trace back additional candidate properties, e.g. production interaction or source type. 
-     841             :  * The interaction overwrites the candidate tag from the source for all secondaries. 
-     842             :  */
-     843             : 
-     844             : class SourceTag: public SourceFeature {
-     845             : private:
-     846             :         std::string sourceTag;
-     847             : 
-     848             : public:
-     849             :         SourceTag(std::string tag);
-     850             :         void prepareCandidate(Candidate &candidate) const;
-     851             :         void setDescription();
-     852             :         void setTag(std::string tag);
-     853             : };
-     854             : 
-     855             : /**
-     856             :         @class SourceMassDistribution
-     857             :         @brief  Source position follows a given mass distribution
-     858             : 
-     859             :         The (source)position of the candidate is sampled from a given mass distribution. The distribution uses the getDensity function of the density module. 
-     860             :         If a weighting for different components is desired, the use of different densities in a densityList is recommended.
-     861             : 
-     862             :         The sampling range of the position can be restricted. Default is a sampling for x in [-20, 20] * kpc, y in [-20, 20] * kpc and z in [-4, 4] * kpc.
-     863             : */
-     864             : class SourceMassDistribution: public SourceFeature {
-     865             : private: 
-     866             :         ref_ptr<Density> density; //< density distribution
-     867             :         double maxDensity;                      //< maximal value of the density in the region of interest
-     868             :         double xMin, xMax;                      //< x-range to sample positions
-     869             :         double yMin, yMax;                      //< y-range to sample positions
-     870             :         double zMin, zMax;                      //< z-range to sample positions
-     871             :         int maxTries = 10000;           //< maximal number of tries to sample the position 
-     872             : 
-     873             : public: 
-     874             :         /** Constructor
-     875             :         @param density: CRPropa mass distribution 
-     876             :         @param maxDensity:      maximal density in the region where the position should be sampled
-     877             :         @param x:       the position will be sampled in the range [-x, x]. Non symmetric values can be set with setXrange.
-     878             :         @param y:       the position will be sampled in the range [-y, y]. Non symmetric values can be set with setYrange.
-     879             :         @param z:       the position will be sampled in the range [-z, z]. Non symmetric values can be set with setZrange.
-     880             :         */
-     881             :         SourceMassDistribution(ref_ptr<Density> density, double maxDensity = 0, double x = 20 * kpc, double y = 20 * kpc, double z = 4 * kpc);
-     882             : 
-     883             :         void prepareParticle(ParticleState &particle) const;
-     884             : 
-     885             :         /** Set the maximal density in the region of interest. This parameter is necessary for the sampling
-     886             :         @param maxDensity:      maximal density in [particle / m^3]
-     887             :         */
-     888             :         void setMaximalDensity(double maxDensity);
-     889             : 
-     890             :         /** set x-range in which the position of the candidate will be sampled. x in [xMin, xMax].
-     891             :         @param xMin: minimal x value of the allowed sample range in [m]
-     892             :         @param xMax: maximal x value of the allowed sample range in [m]
-     893             :         */
-     894             :         void setXrange(double xMin, double xMax);
-     895             : 
-     896             :         /** set y-range in which the position of the candidate will be sampled. y in [yMin, yMax].
-     897             :         @param yMin: minimal y value of the allowed sample range in [m]
-     898             :         @param yMax: maximal y value of the allowed sample range in [m]
-     899             :         */
-     900             :         void setYrange(double yMin, double yMax);
-     901             : 
-     902             :         /** set z-range in which the position of the candidate will be sampled. z in [zMin, zMax].
-     903             :         @param zMin: minimal z value of the allowed sample range in [m]
-     904             :         @param zMax: maximal z value of the allowed sample range in [m]
-     905             :         */
-     906             :         void setZrange(double zMin, double zMax);
-     907             : 
-     908             :         /*      samples the position. Can be used for testing.
-     909             :                 @return Vector3d with sampled position
-     910             :         */
-     911             :         Vector3d samplePosition() const;
-     912             : 
-     913             : 
-     914             :         /** set the number of maximal tries until the sampling routine breaks.
-     915             :                 @param tries: number of the maximal tries
-     916             :         */
-     917             :         void setMaximalTries(int tries);
-     918             : 
-     919             :         std::string getDescription();
-     920             : };
-     921             : 
-     922             : /**  @} */ // end of group SourceFeature
-     923             : 
-     924             : } // namespace crpropa
-     925             : 
-     926             : #endif // CRPROPA_SOURCE_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Variant.h.func-sort-c.html b/doc/coverageReport/include/crpropa/Variant.h.func-sort-c.html deleted file mode 100644 index fa4e80473..000000000 --- a/doc/coverageReport/include/crpropa/Variant.h.func-sort-c.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Variant.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Variant.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:133537.1 %
Date:2024-04-08 14:58:22Functions:41625.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa10safeDeleteINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEvRPT_0
_ZN7crpropa10safeDeleteISt6vectorINS_7VariantESaIS2_EEEEvRPT_0
_ZN7crpropa7Variant14bad_conversionC2ENS0_4TypeES2_0
_ZN7crpropa7Variant14bad_conversionD0Ev0
_ZN7crpropa7Variant14bad_conversionD2Ev0
_ZN7crpropa7VariantaSERKNS_7Vector3ISt7complexIdEEE0
_ZN7crpropa7VariantaSERKNS_7Vector3IdEE0
_ZN7crpropa7VariantaSERKNS_7Vector3IfEE0
_ZN7crpropa7VariantaSERKSt6vectorIS0_SaIS0_EE0
_ZN7crpropa7VariantaSERKSt7complexIdE0
_ZN7crpropa7VariantaSERKSt7complexIfE0
_ZNK7crpropa7Variant14bad_conversion4whatEv0
_ZN7crpropa7VariantC2ERKSt6vectorIS0_SaIS0_EE1
_ZNK7crpropa7VariantcvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEv1
_ZN7crpropa7VariantC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1130
_ZN7crpropa7VariantaSERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1136
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Variant.h.func.html b/doc/coverageReport/include/crpropa/Variant.h.func.html deleted file mode 100644 index 070430d10..000000000 --- a/doc/coverageReport/include/crpropa/Variant.h.func.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Variant.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Variant.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:133537.1 %
Date:2024-04-08 14:58:22Functions:41625.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa10safeDeleteINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEvRPT_0
_ZN7crpropa10safeDeleteISt6vectorINS_7VariantESaIS2_EEEEvRPT_0
_ZN7crpropa7Variant14bad_conversionC2ENS0_4TypeES2_0
_ZN7crpropa7Variant14bad_conversionD0Ev0
_ZN7crpropa7Variant14bad_conversionD2Ev0
_ZN7crpropa7VariantC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1130
_ZN7crpropa7VariantC2ERKSt6vectorIS0_SaIS0_EE1
_ZN7crpropa7VariantaSERKNS_7Vector3ISt7complexIdEEE0
_ZN7crpropa7VariantaSERKNS_7Vector3IdEE0
_ZN7crpropa7VariantaSERKNS_7Vector3IfEE0
_ZN7crpropa7VariantaSERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1136
_ZN7crpropa7VariantaSERKSt6vectorIS0_SaIS0_EE0
_ZN7crpropa7VariantaSERKSt7complexIdE0
_ZN7crpropa7VariantaSERKSt7complexIfE0
_ZNK7crpropa7Variant14bad_conversion4whatEv0
_ZNK7crpropa7VariantcvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Variant.h.gcov.html b/doc/coverageReport/include/crpropa/Variant.h.gcov.html deleted file mode 100644 index a97907206..000000000 --- a/doc/coverageReport/include/crpropa/Variant.h.gcov.html +++ /dev/null @@ -1,410 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Variant.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Variant.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:133537.1 %
Date:2024-04-08 14:58:22Functions:41625.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : //-------------------------------------------------------------
-       2             : // Based on Variant.hh of the Physics eXtension Library (PXL) -
-       3             : // http://vispa.physik.rwth-aachen.de/                        -
-       4             : // Licensed under a LGPL-2 or later license                   -
-       5             : //-------------------------------------------------------------
-       6             : 
-       7             : #ifndef CRPROPA_VARIANT_H
-       8             : #define CRPROPA_VARIANT_H
-       9             : 
-      10             : #include <complex>
-      11             : #include <cstdint>
-      12             : #include <cstdlib>
-      13             : #include <cstring>
-      14             : #include <iostream>
-      15             : #include <limits>
-      16             : #include <string>
-      17             : #include <sstream>
-      18             : #include <stdexcept>
-      19             : #include <typeinfo>
-      20             : 
-      21             : #include "crpropa/Vector3.h"
-      22             : 
-      23             : 
-      24             : 
-      25             : // defines copy constructor X(const X&), isX(), asX(), fromX(), toX(), op(), op=, op==, op!=
-      26             : #define VARIANT_ADD_TYPE_DECL_POD(NAME, TYPE, VALUE, FIELD) \
-      27             :         Variant(const VALUE& v) { \
-      28             :                 data._t_##FIELD = v; \
-      29             :                 type = TYPE;  \
-      30             :         } \
-      31             :         bool is##NAME() const { \
-      32             :                 return type == TYPE; \
-      33             :         } \
-      34             :         VALUE& as##NAME() { \
-      35             :                 check(TYPE); \
-      36             :                 return data._t_##FIELD; \
-      37             :         } \
-      38             :         const VALUE& as##NAME() const { \
-      39             :                 check(TYPE); \
-      40             :                 return data._t_##FIELD; \
-      41             :         } \
-      42             :         static Variant from##NAME(const VALUE& v) { \
-      43             :                 return Variant(v); \
-      44             :         } \
-      45             :         VALUE to##NAME() const; \
-      46             :         operator VALUE() const { \
-      47             :                 return to##NAME(); \
-      48             :         } \
-      49             :         Variant& operator=(const VALUE& v) { \
-      50             :                 clear(); \
-      51             :                 type = TYPE; \
-      52             :                 data._t_##FIELD = v; \
-      53             :                 return *this; \
-      54             :         } \
-      55             :         bool operator==(const VALUE& v) const { \
-      56             :                 check(TYPE); \
-      57             :                 return data._t_##FIELD == v; \
-      58             :         } \
-      59             :         bool operator!=(const VALUE& v) const { \
-      60             :                 check(TYPE); \
-      61             :                 return data._t_##FIELD != v; \
-      62             :         } \
-      63             : 
-      64             : // defines isX(), asX(), fromX()
-      65             : #define VARIANT_ADD_TYPE_DECL_PTR_BASE(NAME, TYPE, VALUE, FIELD) \
-      66             :         bool is##NAME() const { \
-      67             :                 return type == TYPE; \
-      68             :         } \
-      69             :         VALUE& as##NAME() { \
-      70             :                 check(TYPE); \
-      71             :                 return *data._t_##FIELD; \
-      72             :         } \
-      73             :         const VALUE& as##NAME() const { \
-      74             :                 check(TYPE); \
-      75             :                 return *data._t_##FIELD; \
-      76             :         } \
-      77             :         static Variant from##NAME(const VALUE& v) { \
-      78             :                 return Variant(v); \
-      79             :         } \
-      80             : 
-      81             : // defines isX(), asX(), fromX(), and copy constructor X(const X&), op=, op==, op!=
-      82             : #define VARIANT_ADD_TYPE_DECL_PTR(NAME, TYPE, VALUE, FIELD) \
-      83             :         VARIANT_ADD_TYPE_DECL_PTR_BASE(NAME, TYPE, VALUE, FIELD) \
-      84             :         Variant(const VALUE& v) { \
-      85             :                 data._t_##FIELD = new VALUE(v); \
-      86             :                 type = TYPE; \
-      87             :         } \
-      88             :         Variant& operator=(const VALUE& v) { \
-      89             :                 if (type != TYPE) { \
-      90             :                         clear(); \
-      91             :                         data._t_##FIELD = new VALUE();\
-      92             :                 } \
-      93             :                 type = TYPE; \
-      94             :                 (*data._t_##FIELD) = v; \
-      95             :                 return *this; \
-      96             :         } \
-      97             :         bool operator==(const VALUE& v) const { \
-      98             :                 check(TYPE); \
-      99             :                 return *data._t_##FIELD == v; \
-     100             :         } \
-     101             :         bool operator!=(const VALUE& v) const { \
-     102             :                 return !(*this == v); \
-     103             :         } \
-     104             : 
-     105             : #define VARIANT_ADD_ITER_DECL_PTR(NAME, TYPE, FIELD) \
-     106             :         typedef FIELD##_t::iterator FIELD##_iterator; \
-     107             :         typedef FIELD##_t::const_iterator FIELD##_const_iterator; \
-     108             :         inline FIELD##_iterator begin##NAME() { \
-     109             :                 check(TYPE); \
-     110             :                 return data._t_##FIELD->begin(); \
-     111             :         } \
-     112             :         inline FIELD##_iterator end##NAME() { \
-     113             :                 check(TYPE); \
-     114             :                 return data._t_##FIELD->end(); \
-     115             :         } \
-     116             :         inline FIELD##_const_iterator begin##NAME() const { \
-     117             :                 check(TYPE); \
-     118             :                 return data._t_##FIELD->begin(); \
-     119             :         } \
-     120             :         inline FIELD##_const_iterator end##NAME() const { \
-     121             :                 check(TYPE); \
-     122             :                 return data._t_##FIELD->end(); \
-     123             :         }                                                                                
-     124             : 
-     125             : 
-     126             : 
-     127             : namespace crpropa {
-     128             : 
-     129             : /**
-     130             :  @class Variant
-     131             :  @brief storage container for data types as e.g. int, float, string, etc.
-     132             : 
-     133             :  Allows storage of multiple data types in one base class. Used to construct a map of `arbitrary' data types.
-     134             :  Note that most default C++ types allow default conversions from `Variant` to the corresponding type.
-     135             :  Types that require an explicit call via `toTargetType()` are: complex (float and double), Vector3, and vector<Variant>.
-     136             :  */
-     137             : class Variant {
-     138             : public:
-     139             :         enum Type {
-     140             :                 TYPE_NONE = 0,
-     141             :                 TYPE_BOOL,
-     142             :                 TYPE_CHAR,
-     143             :                 TYPE_UCHAR,
-     144             :                 TYPE_INT16,
-     145             :                 TYPE_UINT16,
-     146             :                 TYPE_INT32,
-     147             :                 TYPE_UINT32,
-     148             :                 TYPE_INT64,
-     149             :                 TYPE_UINT64,
-     150             :                 TYPE_FLOAT,
-     151             :                 TYPE_DOUBLE,
-     152             :                 TYPE_LONGDOUBLE,
-     153             :                 TYPE_COMPLEXF,
-     154             :                 TYPE_COMPLEXD,
-     155             :                 TYPE_STRING,
-     156             :                 TYPE_VECTOR3F,
-     157             :                 TYPE_VECTOR3D,
-     158             :                 TYPE_VECTOR3C,
-     159             :                 TYPE_VECTOR
-     160             :         };
-     161             : 
-     162             :         class bad_conversion: public std::exception {
-     163             :                 protected:
-     164             :                         std::string msg;
-     165             :                 public:
-     166           0 :                         const char* what() const throw () {
-     167           0 :                                 return msg.c_str();
-     168             :                         }
-     169             : 
-     170           0 :                         bad_conversion(Type f, Type t) {
-     171             :                                 msg = "Variant: bad conversion from '";
-     172           0 :                                 msg += Variant::getTypeName(f);
-     173             :                                 msg += "' to '";
-     174           0 :                                 msg += Variant::getTypeName(t);
-     175             :                                 msg += "'";
-     176           0 :                         }
-     177             : 
-     178           0 :                         ~bad_conversion() throw () {
-     179           0 :                         }
-     180             :         };
-     181             : 
-     182             :         typedef std::complex<float> complex_f;
-     183             :         typedef std::complex<double> complex_d;
-     184             :         typedef Vector3<std::complex<double>> Vector3c;
-     185             :         typedef std::vector<Variant> vector_t;
-     186             : 
-     187             : protected:
-     188             :         Type type;
-     189             : 
-     190             :         union {
-     191             :                 bool _t_bool;
-     192             :                 char _t_char;
-     193             :                 unsigned char _t_uchar;
-     194             :                 int16_t _t_int16;
-     195             :                 uint16_t _t_uint16;
-     196             :                 int32_t _t_int32;
-     197             :                 uint32_t _t_uint32;
-     198             :                 int64_t _t_int64;
-     199             :                 uint64_t _t_uint64;
-     200             :                 float _t_float;
-     201             :                 double _t_double;
-     202             :                 long double _t_ldouble;
-     203             :                 complex_f* _t_complex_f;
-     204             :                 complex_d* _t_complex_d;
-     205             :                 std::string* _t_string;
-     206             :                 Vector3f* _t_vector3f;
-     207             :                 Vector3d* _t_vector3d;
-     208             :                 Vector3c* _t_vector3c;
-     209             :                 vector_t* _t_vector;
-     210             :         } data;
-     211             : 
-     212             : 
-     213             : public:
-     214             :         Variant();
-     215             :         Variant(Type t);
-     216             :         Variant(const Variant& v);
-     217             :         Variant(const char* s);
-     218             :         ~Variant();
-     219             :         inline Type getType() const {
-     220           2 :                 return type;
-     221             :         }
-     222             :         const char* getTypeName() const;
-     223             :         static const char* getTypeName(Type t);
-     224             :         const std::type_info& getTypeInfo() const;
-     225             :         static Type toType(const std::string& name);                
-     226             :         std::string toString(const std::string& delimiter = "\t") const;
-     227             :         std::complex<float> toComplexFloat() const;
-     228             :         std::complex<double> toComplexDouble() const;
-     229             :         Vector3f toVector3f() const;
-     230             :         Vector3d toVector3d() const;
-     231             :         Vector3c toVector3c() const;
-     232             :         vector_t toVector() const;
-     233             :         static Variant fromString(const std::string& str, Type type);
-     234             :         void clear(Type t = TYPE_NONE);
-     235             :         bool isValid() const;
-     236             :         size_t size() const;
-     237             :         size_t getSizeOf() const;
-     238             :         size_t getSize() const;
-     239             :         void resize(size_t i);
-     240             :         size_t copyToBuffer(void* buffer);
-     241           1 :         operator std::string() const {
-     242           2 :                 return toString();
-     243             :         }
-     244             :         Variant& operator=(const Variant& v);
-     245             :         bool operator==(const Variant& v) const;
-     246             :         bool operator!=(const Variant& v) const;
-     247             :         bool operator!=(const char* a) const;
-     248             :         Variant& operator[](size_t i);
-     249             :         inline Variant& operator[](int i) {
-     250             :                 return operator[]((size_t) i);
-     251             :         }
-     252             :         const Variant& operator[](size_t i) const;
-     253             :         const Variant& operator[](int i) const {
-     254             :                 return operator[]((size_t) i);
-     255             :         }
-     256             :         operator vector_t&();
-     257             :         operator const vector_t&() const;
-     258             : 
-     259             : 
-     260             :         template<class T>
-     261             :         T to() const {
-     262             :                 throw bad_conversion(type, TYPE_NONE);
-     263             :         }
-     264             : 
-     265             :         // automatically-generated functions    
-     266           6 :         VARIANT_ADD_TYPE_DECL_POD(Bool, TYPE_BOOL, bool, bool)
-     267           0 :         VARIANT_ADD_TYPE_DECL_POD(Char, TYPE_CHAR, char, char)
-     268           0 :         VARIANT_ADD_TYPE_DECL_POD(UChar, TYPE_UCHAR, unsigned char, uchar)
-     269           0 :         VARIANT_ADD_TYPE_DECL_POD(Int16, TYPE_INT16, int16_t, int16)
-     270           0 :         VARIANT_ADD_TYPE_DECL_POD(UInt16, TYPE_UINT16, uint16_t, uint16)
-     271          12 :         VARIANT_ADD_TYPE_DECL_POD(Int32, TYPE_INT32, int32_t, int32)
-     272           0 :         VARIANT_ADD_TYPE_DECL_POD(UInt32, TYPE_UINT32, uint32_t, uint32)
-     273           6 :         VARIANT_ADD_TYPE_DECL_POD(Int64, TYPE_INT64, int64_t, int64)
-     274          16 :         VARIANT_ADD_TYPE_DECL_POD(UInt64, TYPE_UINT64, uint64_t, uint64)
-     275           0 :         VARIANT_ADD_TYPE_DECL_POD(Float, TYPE_FLOAT, float, float)
-     276          34 :         VARIANT_ADD_TYPE_DECL_POD(Double, TYPE_DOUBLE, double, double)
-     277           0 :         VARIANT_ADD_TYPE_DECL_POD(LongDouble, TYPE_LONGDOUBLE, long double, ldouble)
-     278           0 :         VARIANT_ADD_TYPE_DECL_PTR(ComplexFloat, TYPE_COMPLEXF, std::complex<float>, complex_f)
-     279           1 :         VARIANT_ADD_TYPE_DECL_PTR(ComplexDouble, TYPE_COMPLEXD, std::complex<double>, complex_d)
-     280        3396 :         VARIANT_ADD_TYPE_DECL_PTR(String, TYPE_STRING, std::string, string)
-     281           0 :         VARIANT_ADD_TYPE_DECL_PTR(Vector3f, TYPE_VECTOR3F, Vector3f, vector3f)
-     282           1 :         VARIANT_ADD_TYPE_DECL_PTR(Vector3d, TYPE_VECTOR3D, Vector3d, vector3d)
-     283           1 :         VARIANT_ADD_TYPE_DECL_PTR(Vector3c, TYPE_VECTOR3C, Vector3c, vector3c)
-     284           2 :         VARIANT_ADD_TYPE_DECL_PTR(Vector, TYPE_VECTOR, vector_t, vector)
-     285             :         VARIANT_ADD_ITER_DECL_PTR(Vector, TYPE_VECTOR, vector)
-     286             :                 
-     287             : private:
-     288             :         void copy(const Variant& v);
-     289             :         void check(const Type t) const;
-     290             :         void check(const Type t);
-     291             : };
-     292             : 
-     293             : #define VARIANT_TO_DECL(NAME, VALUE) \
-     294             :         template<> inline VALUE Variant::to<VALUE>() const { \
-     295             :                 return to##NAME(); \
-     296             :         } \
-     297             : 
-     298             : // declare type conversion functions
-     299             : // not implemented for Vector3 and complex_*
-     300             : VARIANT_TO_DECL(Bool, bool)
-     301             : VARIANT_TO_DECL(Char, char)
-     302             : VARIANT_TO_DECL(UChar, unsigned char)
-     303             : VARIANT_TO_DECL(Int16, int16_t)
-     304             : VARIANT_TO_DECL(UInt16, uint16_t)
-     305             : VARIANT_TO_DECL(Int32, int32_t)
-     306             : VARIANT_TO_DECL(UInt32, uint32_t)
-     307             : VARIANT_TO_DECL(Int64, int64_t)
-     308             : VARIANT_TO_DECL(UInt64, uint64_t)
-     309             : VARIANT_TO_DECL(Float, float)
-     310             : VARIANT_TO_DECL(Double, double)
-     311             : VARIANT_TO_DECL(LongDouble, long double)
-     312             : VARIANT_TO_DECL(String, std::string)
-     313             : VARIANT_TO_DECL(Vector, Variant::vector_t)
-     314             : 
-     315             : std::ostream& operator <<(std::ostream& os, const Variant &v);
-     316             : 
-     317             : 
-     318             : /**
-     319             :  Taken from PXL
-     320             :  https://git.rwth-aachen.de/3pia/pxl/pxl/-/blob/master/core/include/pxl/core/Functions.hh
-     321             :  */
-     322             : template <class T> 
-     323           0 : inline void safeDelete(T*& p) {
-     324           0 :         if (p) {
-     325           0 :                 delete p;
-     326           0 :                 p = 0;
-     327             :         }
-     328           0 : }
-     329             : 
-     330             : 
-     331             : 
-     332             : } // namespace crpropa 
-     333             : 
-     334             : #endif // CRPROPA_VARIANT
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Vector3.h.func-sort-c.html b/doc/coverageReport/include/crpropa/Vector3.h.func-sort-c.html deleted file mode 100644 index b44071763..000000000 --- a/doc/coverageReport/include/crpropa/Vector3.h.func-sort-c.html +++ /dev/null @@ -1,236 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Vector3.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Vector3.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:9915165.6 %
Date:2024-04-08 14:58:22Functions:164139.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa7Vector3IdE4setREd0
_ZN7crpropa7Vector3IdErMERKS1_0
_ZN7crpropa7Vector3IfE12setRThetaPhiEfff0
_ZN7crpropa7Vector3IfE4setREf0
_ZN7crpropa7Vector3IfErMERKS1_0
_ZN7crpropa7Vector3IfErMERKf0
_ZN7crpropalsISt7complexIdEEERSoS3_RKNS_7Vector3IT_EE0
_ZNK7crpropa7Vector3IdE4ceilEv0
_ZNK7crpropa7Vector3IdE4clipEdd0
_ZNK7crpropa7Vector3IdErmERKS1_0
_ZNK7crpropa7Vector3IdErmERKd0
_ZNK7crpropa7Vector3IfE10getRotatedERKS1_f0
_ZNK7crpropa7Vector3IfE13getDistanceToERKS1_0
_ZNK7crpropa7Vector3IfE13getParallelToERKS1_0
_ZNK7crpropa7Vector3IfE13getUnitVectorEv0
_ZNK7crpropa7Vector3IfE16getUnitVectorPhiEv0
_ZNK7crpropa7Vector3IfE18getPerpendicularToERKS1_0
_ZNK7crpropa7Vector3IfE18getUnitVectorThetaEv0
_ZNK7crpropa7Vector3IfE4ceilEv0
_ZNK7crpropa7Vector3IfE4clipEff0
_ZNK7crpropa7Vector3IfE5floorEv0
_ZNK7crpropa7Vector3IfE6getPhiEv0
_ZNK7crpropa7Vector3IfE8getThetaEv0
_ZNK7crpropa7Vector3IfErmERKS1_0
_ZNK7crpropa7Vector3IfErmERKf0
_ZN7crpropa7Vector3IdErMERKd1
_ZNK7crpropa7Vector3IdE18getPerpendicularToERKS1_1
_ZNK7crpropa7Vector3IdE18getUnitVectorThetaEv1
_ZNK7crpropa7Vector3IdE13getParallelToERKS1_2
_ZN7crpropa7Vector3IdE12setRThetaPhiEddd3
_ZNK7crpropa7Vector3IdE16getUnitVectorPhiEv4
_ZNK7crpropa7Vector3IdE5floorEv6
_ZNK7crpropa7Vector3IdE10getAngleToERKS1_8
_ZNK7crpropa7Vector3IdE8getThetaEv8
_ZN7crpropalsIdEERSoS1_RKNS_7Vector3IT_EE11
_ZNK7crpropa7Vector3IdE6getPhiEv19
_ZN7crpropalsIfEERSoS1_RKNS_7Vector3IT_EE27
_ZNK7crpropa7Vector3IdE13getDistanceToERKS1_110
_ZNK7crpropa7Vector3IdE10getRotatedERKS1_d481006
_ZNK7crpropa7Vector3IfE10getAngleToERKS1_691017
_ZNK7crpropa7Vector3IdE13getUnitVectorEv7201361
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Vector3.h.func.html b/doc/coverageReport/include/crpropa/Vector3.h.func.html deleted file mode 100644 index 8b3511c68..000000000 --- a/doc/coverageReport/include/crpropa/Vector3.h.func.html +++ /dev/null @@ -1,236 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Vector3.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Vector3.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:9915165.6 %
Date:2024-04-08 14:58:22Functions:164139.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa7Vector3IdE12setRThetaPhiEddd3
_ZN7crpropa7Vector3IdE4setREd0
_ZN7crpropa7Vector3IdErMERKS1_0
_ZN7crpropa7Vector3IdErMERKd1
_ZN7crpropa7Vector3IfE12setRThetaPhiEfff0
_ZN7crpropa7Vector3IfE4setREf0
_ZN7crpropa7Vector3IfErMERKS1_0
_ZN7crpropa7Vector3IfErMERKf0
_ZN7crpropalsISt7complexIdEEERSoS3_RKNS_7Vector3IT_EE0
_ZN7crpropalsIdEERSoS1_RKNS_7Vector3IT_EE11
_ZN7crpropalsIfEERSoS1_RKNS_7Vector3IT_EE27
_ZNK7crpropa7Vector3IdE10getAngleToERKS1_8
_ZNK7crpropa7Vector3IdE10getRotatedERKS1_d481006
_ZNK7crpropa7Vector3IdE13getDistanceToERKS1_110
_ZNK7crpropa7Vector3IdE13getParallelToERKS1_2
_ZNK7crpropa7Vector3IdE13getUnitVectorEv7201361
_ZNK7crpropa7Vector3IdE16getUnitVectorPhiEv4
_ZNK7crpropa7Vector3IdE18getPerpendicularToERKS1_1
_ZNK7crpropa7Vector3IdE18getUnitVectorThetaEv1
_ZNK7crpropa7Vector3IdE4ceilEv0
_ZNK7crpropa7Vector3IdE4clipEdd0
_ZNK7crpropa7Vector3IdE5floorEv6
_ZNK7crpropa7Vector3IdE6getPhiEv19
_ZNK7crpropa7Vector3IdE8getThetaEv8
_ZNK7crpropa7Vector3IdErmERKS1_0
_ZNK7crpropa7Vector3IdErmERKd0
_ZNK7crpropa7Vector3IfE10getAngleToERKS1_691017
_ZNK7crpropa7Vector3IfE10getRotatedERKS1_f0
_ZNK7crpropa7Vector3IfE13getDistanceToERKS1_0
_ZNK7crpropa7Vector3IfE13getParallelToERKS1_0
_ZNK7crpropa7Vector3IfE13getUnitVectorEv0
_ZNK7crpropa7Vector3IfE16getUnitVectorPhiEv0
_ZNK7crpropa7Vector3IfE18getPerpendicularToERKS1_0
_ZNK7crpropa7Vector3IfE18getUnitVectorThetaEv0
_ZNK7crpropa7Vector3IfE4ceilEv0
_ZNK7crpropa7Vector3IfE4clipEff0
_ZNK7crpropa7Vector3IfE5floorEv0
_ZNK7crpropa7Vector3IfE6getPhiEv0
_ZNK7crpropa7Vector3IfE8getThetaEv0
_ZNK7crpropa7Vector3IfErmERKS1_0
_ZNK7crpropa7Vector3IfErmERKf0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/Vector3.h.gcov.html b/doc/coverageReport/include/crpropa/Vector3.h.gcov.html deleted file mode 100644 index f1fbcd9c0..000000000 --- a/doc/coverageReport/include/crpropa/Vector3.h.gcov.html +++ /dev/null @@ -1,516 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/Vector3.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa - Vector3.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:9915165.6 %
Date:2024-04-08 14:58:22Functions:164139.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_VECTOR3_H
-       2             : #define CRPROPA_VECTOR3_H
-       3             : 
-       4             : #include <iostream>
-       5             : #include <cmath>
-       6             : #include <vector>
-       7             : #include <limits>
-       8             : #include <algorithm>
-       9             : 
-      10             : namespace crpropa {
-      11             : 
-      12             : /**
-      13             :  * \addtogroup Core
-      14             :  * @{
-      15             :  */
-      16             : 
-      17             : /**
-      18             :  @class Vector3
-      19             :  @brief Template class for 3-vectors of type float, double, ...
-      20             : 
-      21             :  Allows accessing and changing the elements x, y, z directly or  through the
-      22             :  corresponding get and set methods.
-      23             : 
-      24             :  Angle definitions are
-      25             :  phi [-pi, pi]: azimuthal angle in the x-y plane, 0 pointing in x-direction
-      26             :  theta [0, pi]: zenith angle towards the z axis, 0 pointing in z-direction
-      27             :  */
-      28             : template<typename T>
-      29             : class Vector3 {
-      30             : public:
-      31             :         union {
-      32             :                 struct
-      33             :                 {
-      34             :                         T x;
-      35             :                         T y;
-      36             :                         T z;
-      37             :                 };
-      38             :                 T data[3];
-      39             :         };
-      40             : 
-      41     3187045 :         Vector3() : data{0., 0., 0.} {
-      42             :         }
-      43             : 
-      44             :         // avoid creation of default non-conversion constructor
-      45    20387451 :         Vector3(const Vector3 &v) : data{v.data[0], v.data[1], v.data[2]} {
-      46           0 :         }
-      47             : 
-      48             :         // Provides implicit conversion
-      49             :         template<typename U>
-      50           0 :         Vector3(const Vector3<U> &v) {
-      51          14 :                 data[0] = v.x;
-      52           4 :                 data[1] = v.y;
-      53           4 :                 data[2] = v.z;
-      54           0 :         }
-      55             : 
-      56             :         ~Vector3()
-      57             :         {
-      58    26216757 :         }
-      59             : 
-      60           0 :         explicit Vector3(const double *v) {
-      61           0 :                 data[0] = v[0];
-      62           0 :                 data[1] = v[1];
-      63           0 :                 data[2] = v[2];
-      64             :         }
-      65             : 
-      66           0 :         explicit Vector3(const float *v) {
-      67           0 :                 data[0] = v[0];
-      68           0 :                 data[1] = v[1];
-      69           0 :                 data[2] = v[2];
-      70             :         }
-      71             : 
-      72    12617888 :         explicit Vector3(const T &X, const T &Y, const T &Z) : data{X, Y, Z} {
-      73             :         }
-      74             : 
-      75    18504508 :         explicit Vector3(T t) : data{t, t, t} {
-      76           1 :         }
-      77             : 
-      78             :         void setX(const T X) {
-      79           1 :                 x = X;
-      80             :         }
-      81             : 
-      82             :         void setY(const T Y) {
-      83           0 :                 y = Y;
-      84             :         }
-      85             : 
-      86             :         void setZ(const T Z) {
-      87           0 :                 z = Z;
-      88             :         }
-      89             : 
-      90             :         void setXYZ(const T X, const T Y, const T Z) {
-      91     1351680 :                 x = X;
-      92     1351680 :                 y = Y;
-      93     1351680 :                 z = Z;
-      94             :         }
-      95             : 
-      96           0 :         void setR(const T r) {
-      97           0 :                 *this *= r / getR();
-      98           0 :         }
-      99             : 
-     100           3 :         void setRThetaPhi(const T r, const T theta, const T phi) {
-     101           3 :                 x = r * sin(theta) * cos(phi);
-     102           3 :                 y = r * sin(theta) * sin(phi);
-     103           3 :                 z = r * cos(theta);
-     104           3 :         }
-     105             : 
-     106             :         T getX() const {
-     107      370007 :                 return x;
-     108             :         }
-     109             : 
-     110             :         T getY() const {
-     111      370006 :                 return y;
-     112             :         }
-     113             : 
-     114             :         T getZ() const {
-     115       40006 :                 return z;
-     116             :         }
-     117             : 
-     118             :         // magnitude (2-norm) of the vector
-     119             :         T getR() const {
-     120    25099477 :                 return std::sqrt(x * x + y * y + z * z);
-     121             :         }
-     122             : 
-     123             :         // square of magnitude of the vector
-     124             :         T getR2() const {
-     125     2883584 :                 return x * x + y * y + z * z;
-     126             :         }
-     127             : 
-     128             :         // return the azimuth angle
-     129          19 :         T getPhi() const {
-     130             :                 T eps = std::numeric_limits < T > ::min();
-     131          19 :                 if ((fabs(x) < eps) && (fabs(y) < eps))
-     132             :                         return 0.0;
-     133             :                 else
-     134          18 :                         return std::atan2(y, x);
-     135             :         }
-     136             : 
-     137             :         // return the zenith angle
-     138           8 :         T getTheta() const {
-     139             :                 T eps = std::numeric_limits < T > ::min();
-     140           8 :                 if ((fabs(x) < eps) && (fabs(y) < eps) && (fabs(z) < eps))
-     141             :                         return 0.0;
-     142             :                 else
-     143           8 :                         return atan2((T) sqrt(x * x + y * y), z);
-     144             :         }
-     145             : 
-     146             :         // return the unit-vector e_r
-     147     7201361 :         Vector3<T> getUnitVector() const {
-     148     7201361 :                 return *this / getR();
-     149             :         }
-     150             : 
-     151             :         // return the unit-vector e_theta
-     152           1 :         Vector3<T> getUnitVectorTheta() const {
-     153           1 :                 T theta = getTheta();
-     154           1 :                 T phi = getPhi();
-     155           1 :                 return Vector3<T>(cos(theta) * cos(phi), cos(theta) * sin(phi),
-     156           1 :                                 -sin(theta));
-     157             :         }
-     158             : 
-     159             :         // return the unit-vector e_phi
-     160           4 :         Vector3<T> getUnitVectorPhi() const {
-     161           4 :                 return Vector3<T>(-sin(getPhi()), cos(getPhi()), 0);
-     162             :         }
-     163             : 
-     164             :         // return the angle [0, pi] between the vectors
-     165      691025 :         T getAngleTo(const Vector3<T> &v) const {
-     166      691025 :                 T cosdistance = dot(v) / v.getR() / getR();
-     167             :                 // In some directions cosdistance is > 1 on some compilers
-     168             :                 // This ensures that the correct result is returned
-     169      691025 :                 if (cosdistance >= 1.)
-     170             :                         return 0;
-     171      690880 :                 else if (cosdistance <= -1.)
-     172             :                         return M_PI;
-     173             :                 else
-     174      690880 :                         return acos(cosdistance);
-     175             :         }
-     176             : 
-     177             :         // return true if the angle between the vectors is smaller than a threshold
-     178             :         bool isParallelTo(const Vector3<T> &v, T maxAngle) const {
-     179      691017 :                 return getAngleTo(v) < maxAngle;
-     180             :         }
-     181             : 
-     182             :         // linear distance to a given vector
-     183         110 :         T getDistanceTo(const Vector3<T> &point) const {
-     184             :                 Vector3<T> d = *this - point;
-     185         110 :                 return d.getR();
-     186             :         }
-     187             : 
-     188             :         // return the component parallel to a second vector
-     189             :         // 0 if the second vector has 0 magnitude
-     190           2 :         Vector3<T> getParallelTo(const Vector3<T> &v) const {
-     191             :                 T vmag = v.getR();
-     192           2 :                 if (vmag == std::numeric_limits < T > ::min())
-     193             :                         return Vector3<T>(0.);
-     194             :                 return v * dot(v) / vmag;
-     195             :         }
-     196             : 
-     197             :         // return the component perpendicular to a second vector
-     198             :         // 0 if the second vector has 0 magnitude
-     199           1 :         Vector3<T> getPerpendicularTo(const Vector3<T> &v) const {
-     200           1 :                 if (v.getR() == std::numeric_limits < T > ::min())
-     201             :                         return Vector3<T>(0.);
-     202           1 :                 return (*this) - getParallelTo(v);
-     203             :         }
-     204             : 
-     205             :         // rotate the vector around a given axis by a given angle
-     206      481006 :         Vector3<T> getRotated(const Vector3<T> &axis, T angle) const {
-     207             :                 Vector3<T> u = axis;
-     208      481006 :                 if (u.getR() != 0.)
-     209             :                         u = u / u.getR();
-     210      481006 :                 T c = cos(angle);
-     211      481006 :                 T s = sin(angle);
-     212      481006 :                 Vector3<T> Rx(c + u.x * u.x * (1 - c), u.x * u.y * (1 - c) - u.z * s,
-     213      481006 :                                 u.x * u.z * (1 - c) + u.y * s);
-     214      481006 :                 Vector3<T> Ry(u.y * u.x * (1 - c) + u.z * s, c + u.y * u.y * (1 - c),
-     215      481006 :                                 u.y * u.z * (1 - c) - u.x * s);
-     216      481006 :                 Vector3<T> Rz(u.z * u.x * (1 - c) - u.y * s,
-     217      481006 :                                 u.z * u.y * (1 - c) + u.x * s, c + u.z * u.z * (1 - c));
-     218      481006 :                 return Vector3<T>(dot(Rx), dot(Ry), dot(Rz));
-     219             :         }
-     220             : 
-     221             :         // return vector with values limited to the range [lower, upper]
-     222           0 :         Vector3<T> clip(T lower, T upper) const {
-     223             :                 Vector3<T> out;
-     224           0 :                 out.x = std::max(lower, std::min(x, upper));
-     225           0 :                 out.y = std::max(lower, std::min(y, upper));
-     226           0 :                 out.z = std::max(lower, std::min(z, upper));
-     227           0 :                 return out;
-     228             :         }
-     229             : 
-     230             :         // return vector with absolute values
-     231             :         Vector3<T> abs() const {
-     232           0 :                 return Vector3<T>(std::abs(x), std::abs(y), std::abs(z));
-     233             :         }
-     234             : 
-     235             :         // return vector with floored values
-     236           6 :         Vector3<T> floor() const {
-     237           6 :                 return Vector3<T>(std::floor(x), std::floor(y), std::floor(z));
-     238             :         }
-     239             : 
-     240             :         // return vector with ceiled values
-     241           0 :         Vector3<T> ceil() const {
-     242           0 :                 return Vector3<T>(std::ceil(x), std::ceil(y), std::ceil(z));
-     243             :         }
-     244             : 
-     245             :         // minimum element
-     246             :         T min() const {
-     247           4 :                 return std::min(x, std::min(y, z));
-     248             :         }
-     249             : 
-     250             :         // maximum element
-     251             :         T max() const {
-     252           4 :                 return std::max(x, std::max(y, z));
-     253             :         }
-     254             : 
-     255             :         // dot product
-     256             :         T dot(const Vector3<T> &v) const {
-     257      692583 :                 return x * v.x + y * v.y + z * v.z;
-     258             :         }
-     259             : 
-     260             :         // cross product
-     261             :         Vector3<T> cross(const Vector3<T> &v) const {
-     262     2132230 :                 return Vector3<T>(y * v.z - v.y * z, z * v.x - v.z * x,
-     263     1652230 :                                 x * v.y - v.x * y);
-     264             :         }
-     265             : 
-     266             :         // returns true if all elements of the two vectors are equal
-     267             :         bool operator ==(const Vector3<T> &v) const {
-     268          33 :                 if (x != v.x)
-     269             :                         return false;
-     270          33 :                 if (y != v.y)
-     271             :                         return false;
-     272          33 :                 if (z != v.z)
-     273           0 :                         return false;
-     274             :                 return true;
-     275             :         }
-     276             : 
-     277             :         Vector3<T> operator +(const Vector3<T> &v) const {
-     278     4339186 :                 return Vector3(x + v.x, y + v.y, z + v.z);
-     279             :         }
-     280             : 
-     281             :         Vector3<T> operator +(const T &f) const {
-     282           0 :                 return Vector3(x + f, y + f, z + f);
-     283             :         }
-     284             : 
-     285             :         Vector3<T> operator -(const Vector3<T> &v) const {
-     286     7533903 :                 return Vector3(x - v.x, y - v.y, z - v.z);
-     287             :         }
-     288             : 
-     289             :         Vector3<T> operator -(const T &f) const {
-     290           0 :                 return Vector3(x - f, y - f, z - f);
-     291             :         }
-     292             : 
-     293             :         // element-wise multiplication
-     294             :         Vector3<T> operator *(const Vector3<T> &v) const {
-     295          20 :                 return Vector3(x * v.x, y * v.y, z * v.z);
-     296             :         }
-     297             : 
-     298             :         Vector3<T> operator *(T v) const {
-     299     1191262 :                 return Vector3(data[0] * v, data[1] * v, data[2] * v);
-     300             :         }
-     301             : 
-     302             :         // element-wise division
-     303             :         Vector3<T> operator /(const Vector3<T> &v) const {
-     304      100097 :                 return Vector3(x / v.x, y / v.y, z / v.z);
-     305             :         }
-     306             : 
-     307             :         Vector3<T> operator /(const T &f) const {
-     308     6242639 :                 return Vector3(x / f, y / f, z / f);
-     309             :         }
-     310             : 
-     311             :         // element-wise modulo operation
-     312           0 :         Vector3<T> operator %(const Vector3<T> &v) const {
-     313           0 :                 return Vector3(fmod(x, v.x), fmod(y, v.y), fmod(z, v.z));
-     314             :         }
-     315             : 
-     316           0 :         Vector3<T> operator %(const T &f) const {
-     317           0 :                 return Vector3(fmod(x, f), fmod(y, f), fmod(z, f));
-     318             :         }
-     319             : 
-     320             :         Vector3<T> &operator -=(const Vector3<T> &v) {
-     321           0 :                 data[0] -= v.x;
-     322           0 :                 data[1] -= v.y;
-     323           0 :                 data[2] -= v.z;
-     324             :                 return *this;
-     325             :         }
-     326             : 
-     327             :         Vector3<T> &operator -=(const T &f) {
-     328           0 :                 data[0] -= f;
-     329           0 :                 data[1] -= f;
-     330           0 :                 data[2] -= f;
-     331             :                 return *this;
-     332             :         }
-     333             : 
-     334             :         Vector3<T> &operator +=(const Vector3<T> &v) {
-     335    20664839 :                 data[0] += v.x;
-     336    20664839 :                 data[1] += v.y;
-     337    20544720 :                 data[2] += v.z;
-     338             :                 return *this;
-     339             :         }
-     340             : 
-     341             :         Vector3<T> &operator +=(const T &f) {
-     342           0 :                 data[0] += f;
-     343           0 :                 data[1] += f;
-     344           0 :                 data[2] += f;
-     345             :                 return *this;
-     346             :         }
-     347             : 
-     348             :         // element-wise multiplication
-     349             :         Vector3<T> &operator *=(const Vector3<T> &v) {
-     350           0 :                 data[0] *= v.x;
-     351           0 :                 data[1] *= v.y;
-     352           0 :                 data[2] *= v.z;
-     353             :                 return *this;
-     354             :         }
-     355             : 
-     356             :         Vector3<T> &operator *=(const T &f) {
-     357     3312538 :                 data[0] *= f;
-     358     3312538 :                 data[1] *= f;
-     359     3312538 :                 data[2] *= f;
-     360             :                 return *this;
-     361             :         }
-     362             : 
-     363             :         // element-wise division
-     364             :         Vector3<T> &operator /=(const Vector3<T> &v) {
-     365           0 :                 data[0] /= v.x;
-     366           0 :                 data[1] /= v.y;
-     367           0 :                 data[2] /= v.z;
-     368             :                 return *this;
-     369             :         }
-     370             : 
-     371             :         Vector3<T> &operator /=(const T &f) {
-     372      691019 :                 data[0] /= f;
-     373      691019 :                 data[1] /= f;
-     374      691019 :                 data[2] /= f;
-     375             :                 return *this;
-     376             :         }
-     377             : 
-     378             :         // element-wise modulo operation
-     379           0 :         Vector3<T> &operator %=(const Vector3<T> &v) {
-     380           0 :                 data[0] = fmod(x, v.x);
-     381           0 :                 data[1] = fmod(y, v.y);
-     382           0 :                 data[2] = fmod(z, v.z);
-     383           0 :                 return *this;
-     384             :         }
-     385             : 
-     386           1 :         Vector3<T> &operator %=(const T &f) {
-     387           1 :                 data[0] = fmod(x, f);
-     388           1 :                 data[1] = fmod(y, f);
-     389           1 :                 data[2] = fmod(z, f);
-     390           1 :                 return *this;
-     391             :         }
-     392             : 
-     393             :         Vector3<T> &operator =(const Vector3<T> &v) {
-     394    64125712 :                 data[0] = v.x;
-     395    64125726 :                 data[1] = v.y;
-     396    63640105 :                 data[2] = v.z;
-     397           0 :                 return *this;
-     398             :         }
-     399             : 
-     400             :         //Vector3<T> &operator =(Vector3<T> &&v) noexcept {
-     401             :         //      data[0] = v.data[0];
-     402             :         //      data[1] = v.data[1];
-     403             :         //      data[2] = v.data[2];
-     404             :         //      return *this;
-     405             :         //}
-     406             : 
-     407             :         Vector3<T> &operator =(const T &f) {
-     408             :                 data[0] = f;
-     409             :                 data[1] = f;
-     410             :                 data[2] = f;
-     411             :                 return *this;
-     412             :         }
-     413             : };
-     414             : 
-     415             : #ifndef SWIG
-     416             : template<typename T>
-     417          38 : inline std::ostream &operator <<(std::ostream &out, const Vector3<T> &v) {
-     418         114 :         out << v.x << " " << v.y << " " << v.z;
-     419          38 :         return out;
-     420             : }
-     421             : 
-     422             : template<typename T>
-     423             : inline std::istream &operator >>(std::istream &in, Vector3<T> &v) {
-     424             :         in >> v.x >> v.y >> v.z;
-     425             :         return in;
-     426             : }
-     427             : #endif
-     428             : 
-     429             : template<typename T>
-     430             : inline Vector3<T> operator *(T f, const Vector3<T> &v) {
-     431     3628978 :         return Vector3<T>(v.x * f, v.y * f, v.z * f);
-     432             : }
-     433             : 
-     434             : typedef Vector3<double> Vector3d;
-     435             : typedef Vector3<float> Vector3f;
-     436             : 
-     437             : /** @}*/
-     438             : }  // namespace crpropa
-     439             : 
-     440             : #endif  // CRPROPA_VECTOR3_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/advectionField/AdvectionField.h.func-sort-c.html b/doc/coverageReport/include/crpropa/advectionField/AdvectionField.h.func-sort-c.html deleted file mode 100644 index 429d191a5..000000000 --- a/doc/coverageReport/include/crpropa/advectionField/AdvectionField.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/advectionField/AdvectionField.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/advectionField - AdvectionField.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:55100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/advectionField/AdvectionField.h.func.html b/doc/coverageReport/include/crpropa/advectionField/AdvectionField.h.func.html deleted file mode 100644 index 74fd9621e..000000000 --- a/doc/coverageReport/include/crpropa/advectionField/AdvectionField.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/advectionField/AdvectionField.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/advectionField - AdvectionField.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:55100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/advectionField/AdvectionField.h.gcov.html b/doc/coverageReport/include/crpropa/advectionField/AdvectionField.h.gcov.html deleted file mode 100644 index 4be5bf68f..000000000 --- a/doc/coverageReport/include/crpropa/advectionField/AdvectionField.h.gcov.html +++ /dev/null @@ -1,367 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/advectionField/AdvectionField.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/advectionField - AdvectionField.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:55100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_ADVECTIONFIELD_H
-       2             : #define CRPROPA_ADVECTIONFIELD_H
-       3             : 
-       4             : 
-       5             : #include <string>
-       6             : #include <iostream>
-       7             : #include <cmath>
-       8             : #include <cstdlib>
-       9             : #include <sstream>
-      10             : 
-      11             : #include "crpropa/Vector3.h"
-      12             : #include "crpropa/Referenced.h"
-      13             : #include "crpropa/Units.h"
-      14             : 
-      15             : namespace crpropa {
-      16             : 
-      17             : /**
-      18             :  @class AdvectionField
-      19             :  @brief Abstract base class for advection fields. These are used to model 
-      20             :         the deterministic part of the Fokker-Planck equation. The getDivergence()
-      21             :         method is used to model the adibatic cooling/heating.
-      22             :  */
-      23             : class AdvectionField: public Referenced {
-      24             : public:
-      25             :         virtual ~AdvectionField() {
-      26             :         }
-      27             :         virtual Vector3d getField(const Vector3d &position) const = 0;
-      28             :         virtual double getDivergence(const Vector3d &position) const = 0;
-      29             : };
-      30             : 
-      31             : 
-      32             : /**
-      33             :  @class AdvectionFieldList
-      34             :  @brief Advection field decorator implementing a superposition of fields.
-      35             :  */
-      36           2 : class AdvectionFieldList: public AdvectionField {
-      37             :         std::vector<ref_ptr<AdvectionField> > fields;
-      38             : public:
-      39             :         void addField(ref_ptr<AdvectionField> field);
-      40             :         Vector3d getField(const Vector3d &position) const;
-      41             :         double getDivergence(const Vector3d &position) const;
-      42             : };
-      43             : 
-      44             : 
-      45             : /**
-      46             :  @class UniformAdvectionField
-      47             :  @brief Advection field with one velocity/advection-field vector.
-      48             :  */
-      49           1 : class UniformAdvectionField: public AdvectionField {
-      50             :         Vector3d value;
-      51             : public:
-      52             :         UniformAdvectionField(const Vector3d &value);
-      53             :         Vector3d getField(const Vector3d &position) const;
-      54             :         double getDivergence(const Vector3d &position) const;
-      55             : 
-      56             :         std::string getDescription() const;
-      57             : };
-      58             : 
-      59             : 
-      60             : /**
-      61             : @class ConstantSphericalAdvectionField
-      62             : @brief Spherical advection field with a constant wind speed
-      63             : */
-      64             : 
-      65           1 : class ConstantSphericalAdvectionField: public AdvectionField {
-      66             :         Vector3d origin; //origin of the advection sphere
-      67             :         double vWind; // wind velocity
-      68             : public:
-      69             :         /** Constructor
-      70             :          @param origin  Origin of the advection field
-      71             :          @param vWind   Constant wind velocity
-      72             : 
-      73             : */
-      74             : 
-      75             :         ConstantSphericalAdvectionField(const Vector3d origin, double vWind);
-      76             :         Vector3d getField(const Vector3d &position) const;
-      77             :         double getDivergence(const Vector3d &position) const;
-      78             : 
-      79             :         void setOrigin(const Vector3d origin);
-      80             :         void setVWind(double vMax);
-      81             : 
-      82             :         Vector3d getOrigin() const;
-      83             :         double getVWind() const;
-      84             : 
-      85             :         std::string getDescription() const;
-      86             : 
-      87             :         
-      88             : };
-      89             :         
-      90             : /**
-      91             :  @class SphericalAdvectionField
-      92             :  @brief Spherical advection with a exponentially increasing and
-      93             :         exponentially constant velocity.
-      94             : */
-      95             : 
-      96           1 : class SphericalAdvectionField: public AdvectionField {
-      97             :         Vector3d origin; //origin of the advection sphere
-      98             :         double radius; //radius of the advection sphere
-      99             :         double vMax; // maximum wind velocity
-     100             :         double tau; // transition distance
-     101             :         double alpha; //tuning parameter
-     102             : public:
-     103             :         /** Constructor
-     104             :         @param origin   Origin of the advection sphere
-     105             :         @param radius   Radius of the advection sphere
-     106             :         @param vMax     Maximum wind velocity
-     107             :         @param tau      Transition distance
-     108             :         @param alpha    Tuning parameter
-     109             : */
-     110             :         SphericalAdvectionField(const Vector3d origin, double radius, double vMax, double tau, double alpha);
-     111             :         Vector3d getField(const Vector3d &position) const;
-     112             :         double getDivergence(const Vector3d &position) const;
-     113             : 
-     114             :         double getV(const double &r) const;
-     115             : 
-     116             :         void setOrigin(const Vector3d origin);
-     117             :         void setRadius(double radius);
-     118             :         void setVMax(double vMax);
-     119             :         void setTau(double tau);
-     120             :         void setAlpha(double alpha);
-     121             : 
-     122             :         Vector3d getOrigin() const;
-     123             :         double getRadius() const;
-     124             :         double getVMax() const;
-     125             :         double getTau() const;
-     126             :         double getAlpha() const;
-     127             :         
-     128             :         std::string getDescription() const;
-     129             : };
-     130             : 
-     131             : /**
-     132             :  @class OneDimensionalCartesianShock
-     133             :  @brief Advection field in x-direction with shock at x = 0 and width lShock approximated by tanh() 
-     134             :                 with variable compression ratio vUp/vDown
-     135             :  */
-     136             : class OneDimensionalCartesianShock: public AdvectionField {
-     137             :         double compressionRatio; //compression ratio of shock
-     138             :         double vUp; //upstream velocity 
-     139             :         double lShock; //shock width
-     140             : public:
-     141             : /** Constructor
-     142             :         @param compressionRatio //compression ratio of shock
-     143             :         @param vUp //upstream velocity 
-     144             :         @param lShock //shock width
-     145             : */
-     146             :         OneDimensionalCartesianShock(double compressionRatio, double vUp, double lShock);
-     147             :         Vector3d getField(const Vector3d &position) const;
-     148             :         double getDivergence(const Vector3d &position) const;
-     149             : 
-     150             :         void setComp(double compressionRatio);
-     151             :         void setVup(double vUp);
-     152             :         void setShockwidth(double lShock);
-     153             : 
-     154             :         double getComp() const;
-     155             :         double getVup() const; 
-     156             :         double getShockwidth() const;
-     157             : 
-     158             :         std::string getDescription() const;
-     159             : };
-     160             : 
-     161             : /**
-     162             :  @class OneDimensionalSphericalShock
-     163             :  @brief Advection field in x-direction with shock at rShock and width lShock approximated by tanh() 
-     164             :                 with variable compression ratio ratio vUp/vDown
-     165             :  */
-     166             : class OneDimensionalSphericalShock: public AdvectionField {
-     167             :         double compressionRatio;        //compression ratio of shock
-     168             :         double vUp;     //upstream velocity 
-     169             :         double lShock;  //shock width
-     170             :         double rShock;  //shock radius
-     171             :         bool coolUpstream;      //flag for upstream cooling
-     172             : public:
-     173             : /** Constructor
-     174             :         @param compressionRatio //compression ratio of shock
-     175             :         @param vUp      //upstream velocity 
-     176             :         @param lShock   //shock width
-     177             :         @param rShock   //shock radius
-     178             :         @param coolUpstream //flag for upstream cooling
-     179             : */
-     180             :         OneDimensionalSphericalShock(double rShock, double vUp, double compressionRatio, double lShock, bool coolUpstream);
-     181             :         Vector3d getField(const Vector3d &position) const;
-     182             :         double getDivergence(const Vector3d &position) const;
-     183             : 
-     184             :         void setComp(double compressionRatio);
-     185             :         void setVup(double vUp);
-     186             :         void setShockwidth(double lShock);
-     187             :         void setShockRadius(double rShock);
-     188             :         void setCooling(bool coolUpstream);
-     189             : 
-     190             :         double getComp() const; 
-     191             :         double getVup() const;
-     192             :         double getShockwidth() const;
-     193             :         double getShockRadius() const;
-     194             :         bool getCooling() const;
-     195             : 
-     196             :         std::string getDescription() const;
-     197             : };
-     198             : 
-     199             : /**
-     200             :  @class ObliqueAdvectionShock
-     201             :  @brief Advection field in x-y-direction with shock at x = 0 and width x_sh approximated by tanh() 
-     202             :                 with variable compression ratio r_comp = vx_up/vx_down. The y component vy is not shocked 
-     203             :                 and remains constant. 
-     204             :  */
-     205             : class ObliqueAdvectionShock: public AdvectionField {
-     206             :         double compressionRatio; //compression ratio of shock
-     207             :         double vXUp; //upstream velocity x-component
-     208             :         double vY; //constant velocity y-component
-     209             :         double lShock; //shock width
-     210             :         
-     211             : public:
-     212             : /** Constructor
-     213             :         @param compressionRatio //compression ratio of shock
-     214             :         @param vXUp //upstream velocity x-component
-     215             :         @param vY //constant velocity y-component
-     216             :         @param lShock //shock width
-     217             :         
-     218             : */
-     219             :         ObliqueAdvectionShock(double compressionRatio, double vXUp, double vY, double lShock);
-     220             :         Vector3d getField(const Vector3d &position) const;
-     221             :         double getDivergence(const Vector3d &position) const;
-     222             : 
-     223             :         void setComp(double compressionRatio);
-     224             :         void setVup(double vXUp);
-     225             :         void setVy(double vY);
-     226             :         void setShockwidth(double lShock);
-     227             : 
-     228             :         double getComp() const; 
-     229             :         double getVup() const;
-     230             :         double getVy() const;
-     231             :         double getShockwidth() const;
-     232             :         
-     233             :         std::string getDescription() const;
-     234             : };
-     235             : 
-     236             : /**
-     237             :  @class SphericalAdvectionShock
-     238             :  @brief Spherical advection with a constant velocity for r<r_0
-     239             :         at the the shock the velocity drops to v_0/4. followed by
-     240             :         a decrease proportional to 1/r^2.
-     241             : */
-     242             : 
-     243           1 : class SphericalAdvectionShock: public AdvectionField {
-     244             :         Vector3d origin; // origin of the advection sphere
-     245             :         double r_0; // position of the shock
-     246             :         double v_0; // constant velocity
-     247             :         double lambda; //transition width
-     248             :         double r_rot; // normalization radius for rotation speed
-     249             :         double v_phi; // rotation speed at r_rot
-     250             : 
-     251             : public:
-     252             :         /** Constructor
-     253             :         @param origin   Origin of the advection sphere
-     254             :         @param r_0      Position of the shock
-     255             :         @param v_0      Constant velocity (r<<r_o)
-     256             :         @param lambda   Transition width / width of the shock
-     257             : */
-     258             :         SphericalAdvectionShock(const Vector3d origin, double r_0, double v_0, double lambda);
-     259             : 
-     260             :         Vector3d getField(const Vector3d &position) const;
-     261             :         double getDivergence(const Vector3d &position) const;
-     262             : 
-     263             :         double g(double R) const;
-     264             :         double g_prime(double R) const;
-     265             : 
-     266             :         void setOrigin(const Vector3d Origin);
-     267             :         void setR0(double r);
-     268             :         void setV0(double v);
-     269             :         void setLambda(double l);
-     270             :         void setRRot(double r);
-     271             :         void setAzimuthalSpeed(double vPhi);
-     272             : 
-     273             :         Vector3d getOrigin() const;
-     274             :         double getR0() const;
-     275             :         double getV0() const;
-     276             :         double getLambda() const;
-     277             :         /**
-     278             :          * @param r Normalization radius for rotation speed
-     279             :         */      
-     280             :         double getRRot() const;
-     281             :         /**
-     282             :          * @param vPhi  Rotation speed at r_rot
-     283             :         */      
-     284             :         double getAzimuthalSpeed() const;
-     285             : 
-     286             :         std::string getDescription() const;
-     287             : };
-     288             : 
-     289             : } // namespace crpropa
-     290             : 
-     291             : #endif // CRPROPA_ADVECTIONFIELD_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/advectionField/index-sort-f.html b/doc/coverageReport/include/crpropa/advectionField/index-sort-f.html deleted file mode 100644 index 4f7addbb4..000000000 --- a/doc/coverageReport/include/crpropa/advectionField/index-sort-f.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/advectionField - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/advectionFieldHitTotalCoverage
Test:coverage.info.cleanedLines:55100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
AdvectionField.h -
100.0%
-
100.0 %5 / 5-0 / 0
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/advectionField/index-sort-l.html b/doc/coverageReport/include/crpropa/advectionField/index-sort-l.html deleted file mode 100644 index dd1aafc93..000000000 --- a/doc/coverageReport/include/crpropa/advectionField/index-sort-l.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/advectionField - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/advectionFieldHitTotalCoverage
Test:coverage.info.cleanedLines:55100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
AdvectionField.h -
100.0%
-
100.0 %5 / 5-0 / 0
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/advectionField/index.html b/doc/coverageReport/include/crpropa/advectionField/index.html deleted file mode 100644 index b7333515c..000000000 --- a/doc/coverageReport/include/crpropa/advectionField/index.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/advectionField - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/advectionFieldHitTotalCoverage
Test:coverage.info.cleanedLines:55100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
AdvectionField.h -
100.0%
-
100.0 %5 / 5-0 / 0
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/index-sort-f.html b/doc/coverageReport/include/crpropa/index-sort-f.html deleted file mode 100644 index 3e4666a0f..000000000 --- a/doc/coverageReport/include/crpropa/index-sort-f.html +++ /dev/null @@ -1,233 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropaHitTotalCoverage
Test:coverage.info.cleanedLines:40855473.6 %
Date:2024-04-08 14:58:22Functions:7716646.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Source.h -
77.8%77.8%
-
77.8 %14 / 180.0 %0 / 1
Geometry.h -
75.0%75.0%
-
75.0 %3 / 40.0 %0 / 1
Logging.h -
0.0%
-
0.0 %0 / 180.0 %0 / 6
Variant.h -
37.1%37.1%
-
37.1 %13 / 3525.0 %4 / 16
Vector3.h -
65.6%65.6%
-
65.6 %99 / 15139.0 %16 / 41
Grid.h -
88.7%88.7%
-
88.7 %173 / 19541.1 %23 / 56
Referenced.h -
73.2%73.2%
-
73.2 %41 / 5652.6 %10 / 19
PhotonBackground.h -
81.5%81.5%
-
81.5 %22 / 2789.5 %17 / 19
ParticleState.h -
100.0%
-
100.0 %1 / 1-0 / 0
Module.h -
25.0%25.0%
-
25.0 %2 / 8-0 / 0
Candidate.h -
100.0%
-
100.0 %1 / 1-0 / 0
EmissionMap.h -
100.0%
-
100.0 %1 / 1-0 / 0
Random.h -
87.5%87.5%
-
87.5 %7 / 8-0 / 0
Common.h -
100.0%
-
100.0 %10 / 10100.0 %2 / 2
AssocVector.h -
100.0%
-
100.0 %21 / 21100.0 %5 / 5
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/index-sort-l.html b/doc/coverageReport/include/crpropa/index-sort-l.html deleted file mode 100644 index f2d075e22..000000000 --- a/doc/coverageReport/include/crpropa/index-sort-l.html +++ /dev/null @@ -1,233 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropaHitTotalCoverage
Test:coverage.info.cleanedLines:40855473.6 %
Date:2024-04-08 14:58:22Functions:7716646.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Logging.h -
0.0%
-
0.0 %0 / 180.0 %0 / 6
Module.h -
25.0%25.0%
-
25.0 %2 / 8-0 / 0
Variant.h -
37.1%37.1%
-
37.1 %13 / 3525.0 %4 / 16
Vector3.h -
65.6%65.6%
-
65.6 %99 / 15139.0 %16 / 41
Referenced.h -
73.2%73.2%
-
73.2 %41 / 5652.6 %10 / 19
Geometry.h -
75.0%75.0%
-
75.0 %3 / 40.0 %0 / 1
Source.h -
77.8%77.8%
-
77.8 %14 / 180.0 %0 / 1
PhotonBackground.h -
81.5%81.5%
-
81.5 %22 / 2789.5 %17 / 19
Random.h -
87.5%87.5%
-
87.5 %7 / 8-0 / 0
Grid.h -
88.7%88.7%
-
88.7 %173 / 19541.1 %23 / 56
ParticleState.h -
100.0%
-
100.0 %1 / 1-0 / 0
Candidate.h -
100.0%
-
100.0 %1 / 1-0 / 0
EmissionMap.h -
100.0%
-
100.0 %1 / 1-0 / 0
Common.h -
100.0%
-
100.0 %10 / 10100.0 %2 / 2
AssocVector.h -
100.0%
-
100.0 %21 / 21100.0 %5 / 5
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/index.html b/doc/coverageReport/include/crpropa/index.html deleted file mode 100644 index e5683710b..000000000 --- a/doc/coverageReport/include/crpropa/index.html +++ /dev/null @@ -1,233 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropaHitTotalCoverage
Test:coverage.info.cleanedLines:40855473.6 %
Date:2024-04-08 14:58:22Functions:7716646.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
AssocVector.h -
100.0%
-
100.0 %21 / 21100.0 %5 / 5
Candidate.h -
100.0%
-
100.0 %1 / 1-0 / 0
Common.h -
100.0%
-
100.0 %10 / 10100.0 %2 / 2
EmissionMap.h -
100.0%
-
100.0 %1 / 1-0 / 0
Geometry.h -
75.0%75.0%
-
75.0 %3 / 40.0 %0 / 1
Grid.h -
88.7%88.7%
-
88.7 %173 / 19541.1 %23 / 56
Logging.h -
0.0%
-
0.0 %0 / 180.0 %0 / 6
Module.h -
25.0%25.0%
-
25.0 %2 / 8-0 / 0
ParticleState.h -
100.0%
-
100.0 %1 / 1-0 / 0
PhotonBackground.h -
81.5%81.5%
-
81.5 %22 / 2789.5 %17 / 19
Random.h -
87.5%87.5%
-
87.5 %7 / 8-0 / 0
Referenced.h -
73.2%73.2%
-
73.2 %41 / 5652.6 %10 / 19
Source.h -
77.8%77.8%
-
77.8 %14 / 180.0 %0 / 1
Variant.h -
37.1%37.1%
-
37.1 %13 / 3525.0 %4 / 16
Vector3.h -
65.6%65.6%
-
65.6 %99 / 15139.0 %16 / 41
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/GalacticMagneticField.h.func-sort-c.html b/doc/coverageReport/include/crpropa/magneticField/GalacticMagneticField.h.func-sort-c.html deleted file mode 100644 index afe0c0f07..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/GalacticMagneticField.h.func-sort-c.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField/GalacticMagneticField.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticField - GalacticMagneticField.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:3838100.0 %
Date:2024-04-08 14:58:22Functions:44100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa22LogarithmicSpiralField11updatePhaseEv1
_ZN7crpropa22LogarithmicSpiralField16updatePitchAngleEv1
_ZNK7crpropa22LogarithmicSpiralField8getFieldENS_7Vector3IdEE1
_ZN7crpropa17ToroidalHaloField8getFieldENS_7Vector3IdEE2
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/GalacticMagneticField.h.func.html b/doc/coverageReport/include/crpropa/magneticField/GalacticMagneticField.h.func.html deleted file mode 100644 index d44a00d58..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/GalacticMagneticField.h.func.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField/GalacticMagneticField.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticField - GalacticMagneticField.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:3838100.0 %
Date:2024-04-08 14:58:22Functions:44100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa17ToroidalHaloField8getFieldENS_7Vector3IdEE2
_ZN7crpropa22LogarithmicSpiralField11updatePhaseEv1
_ZN7crpropa22LogarithmicSpiralField16updatePitchAngleEv1
_ZNK7crpropa22LogarithmicSpiralField8getFieldENS_7Vector3IdEE1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/GalacticMagneticField.h.gcov.html b/doc/coverageReport/include/crpropa/magneticField/GalacticMagneticField.h.gcov.html deleted file mode 100644 index 6ae2c08a8..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/GalacticMagneticField.h.gcov.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField/GalacticMagneticField.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticField - GalacticMagneticField.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:3838100.0 %
Date:2024-04-08 14:58:22Functions:44100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_GALACTICMAGNETICFIELD_H
-       2             : #define CRPROPA_GALACTICMAGNETICFIELD_H
-       3             : 
-       4             : #include "crpropa/magneticField/MagneticField.h"
-       5             : #include <cmath>
-       6             : 
-       7             : namespace crpropa {
-       8             : /**
-       9             :  * \addtogroup MagneticFields
-      10             :  * @{
-      11             :  */
-      12             : 
-      13             : /**
-      14             :  @class ToroidalHaloField
-      15             :  @brief Galactic halo field model from Prouza & Smida 2003 and Sun et al. 2008
-      16             :  */
-      17             : class ToroidalHaloField: public MagneticField {
-      18             :         double b0; // halo field strength
-      19             :         double z0; // vertical position
-      20             :         double z1; // vertical scale
-      21             :         double r0; // radial scale
-      22             : 
-      23             : public:
-      24             :         /**
-      25             :          * Constructor
-      26             :          * @param b0 halo field strength
-      27             :          * @param z0 vertical position
-      28             :          * @param z1 vertical scale
-      29             :          * @param r0 radial scale
-      30             :         */
-      31           1 :         ToroidalHaloField(double b0 = 1., double z0 = 1., double z1 = 1., double r0 = 1.) {
-      32             :                 setParameters(b0, z0, z1, r0);
-      33             :         }
-      34             : 
-      35             :         void setParameters(double b0, double z0, double z1, double r0) {
-      36           1 :                 this->b0 = b0;
-      37           1 :                 this->z0 = z0;
-      38           1 :                 this->z1 = z1;
-      39           1 :                 this->r0 = r0;
-      40             :         }
-      41             : 
-      42           2 :         Vector3d getField(Vector3d pos) {
-      43           2 :                 double r = sqrt(pos.x * pos.x + pos.y * pos.y) / r0; // in-plane radius in units of the radial scale
-      44           2 :                 double b = b0 / (1 + pow((std::fabs(pos.z) - z0) / z1, 2)) * r * exp(1 - r);
-      45           2 :                 double phi = pos.getPhi(); // azimuth
-      46           2 :                 return Vector3d(cos(phi), sin(phi), 0) * b;
-      47             :         }
-      48             : };
-      49             : /** @} */
-      50             : 
-      51             : /**
-      52             :  * \addtogroup MagneticFields
-      53             :  * @{
-      54             :  */
-      55             : 
-      56             : /**
-      57             :  @class LogarithmicSpiralField
-      58             :  @brief Galactic disk field model of axisymmetric (ASS) or bisymmetric (BSS) logarithmic spiral shape
-      59             :  */
-      60             : class LogarithmicSpiralField: public MagneticField {
-      61             : private:
-      62             :         bool isBSS;   // true for BSS, false for ASS
-      63             :         double b0;    // field strength
-      64             :         double pitch; // pitch angle [rad]
-      65             :         double rsol;  // distance of sun to galactic center
-      66             :         double rc;    // radius of central region with constant field strength
-      67             :         double d;     // distance to the first field reversal
-      68             :         double z0;    // vertical attenuation length
-      69             : 
-      70             :         double phase; // phase of the spiral arms
-      71             :         double cosPhase;
-      72             :         double sinPitch;
-      73             :         double cosPitch;
-      74             :         double tanPitch;
-      75             : 
-      76           1 :         void updatePitchAngle() {
-      77           1 :                 sinPitch = sin(pitch);
-      78           1 :                 cosPitch = cos(pitch);
-      79           1 :                 tanPitch = tan(pitch);
-      80           1 :         }
-      81             : 
-      82           1 :         void updatePhase() {
-      83           1 :                 phase = log(1 + d / rsol) / tanPitch - M_PI / 2;
-      84           1 :                 cosPhase = cos(phase);
-      85           1 :         }
-      86             : 
-      87             : public:
-      88             :         /**
-      89             :          * Constructor
-      90             :          * @param isBSS switch for the magnetic field model
-      91             :          *                              true for BSS, false for ASS
-      92             :          * @param b0    magnetic field strength
-      93             :          * @param pitch pitch angle [rad]
-      94             :          * @param rsol  distance of sun from Galactic center
-      95             :          * @param rc    radius of central region with constant field
-      96             :          * @param d             distance to first field reversal
-      97             :          * @param z0    vertical attenuation length
-      98             :         */
-      99             :         LogarithmicSpiralField(bool isBSS = true, double b0 = 1., double pitch = M_1_PI/4.,
-     100           1 :                 double rsol = 8.5*kpc, double rc = 3*kpc, double d = 5*kpc, double z0 = 3*kpc) {
-     101             :                 setParameters(isBSS, b0, pitch, rsol, rc, d, z0);
-     102             :         }
-     103             : 
-     104             :         void setParameters(bool isBSS, double b0, double pitch, double rsol,
-     105             :                         double rc, double d, double z0) {
-     106           1 :                 this->isBSS = isBSS;
-     107           1 :                 this->b0 = b0;
-     108           1 :                 this->pitch = pitch;
-     109           1 :                 this->rsol = rsol;
-     110           1 :                 this->rc = rc;
-     111           1 :                 this->d = d;
-     112           1 :                 this->z0 = z0;
-     113           1 :                 updatePitchAngle();
-     114           1 :                 updatePhase();
-     115             :         }
-     116             : 
-     117           1 :         Vector3d getField(Vector3d pos) const {
-     118           1 :                 double r = sqrt(pos.x * pos.x + pos.y * pos.y); // in-plane radius
-     119           1 :                 double b = b0 / cosPhase * rsol / std::max(r, rc);
-     120             : 
-     121           1 :                 double phi = pos.getPhi();
-     122           1 :                 double c = cos(phi - log(r / rsol) / tanPitch + phase);
-     123           1 :                 if (isBSS)
-     124           1 :                         c = std::fabs(c);
-     125           1 :                 b *= c * exp(-std::fabs(pos.z) / z0);
-     126             : 
-     127           1 :                 return Vector3d(cosPitch * cos(phi), sinPitch * sin(phi), 0) * b;
-     128             :         }
-     129             : };
-     130             : /** @} */
-     131             : 
-     132             : }// namespace crpropa
-     133             : 
-     134             : #endif // CRPROPA_GALACTICMAGNETICFIELD_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/MagneticField.h.func-sort-c.html b/doc/coverageReport/include/crpropa/magneticField/MagneticField.h.func-sort-c.html deleted file mode 100644 index 841410136..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/MagneticField.h.func-sort-c.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField/MagneticField.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticField - MagneticField.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:121770.6 %
Date:2024-04-08 14:58:22Functions:3742.9 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa13MagneticFieldD0Ev0
_ZN7crpropa13MagneticFieldD2Ev0
_ZN7crpropa24RenormalizeMagneticFieldD0Ev0
_ZNK7crpropa13MagneticField8getFieldERKNS_7Vector3IdEE0
_ZN7crpropa24RenormalizeMagneticFieldD2Ev1
_ZNK7crpropa20UniformMagneticField8getFieldERKNS_7Vector3IdEE5760340
_ZNK7crpropa13MagneticField8getFieldERKNS_7Vector3IdEEd5760379
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/MagneticField.h.func.html b/doc/coverageReport/include/crpropa/magneticField/MagneticField.h.func.html deleted file mode 100644 index 8ed4d10b3..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/MagneticField.h.func.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField/MagneticField.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticField - MagneticField.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:121770.6 %
Date:2024-04-08 14:58:22Functions:3742.9 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa13MagneticFieldD0Ev0
_ZN7crpropa13MagneticFieldD2Ev0
_ZN7crpropa24RenormalizeMagneticFieldD0Ev0
_ZN7crpropa24RenormalizeMagneticFieldD2Ev1
_ZNK7crpropa13MagneticField8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa13MagneticField8getFieldERKNS_7Vector3IdEEd5760379
_ZNK7crpropa20UniformMagneticField8getFieldERKNS_7Vector3IdEE5760340
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/MagneticField.h.gcov.html b/doc/coverageReport/include/crpropa/magneticField/MagneticField.h.gcov.html deleted file mode 100644 index 2866a8501..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/MagneticField.h.gcov.html +++ /dev/null @@ -1,248 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField/MagneticField.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticField - MagneticField.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:121770.6 %
Date:2024-04-08 14:58:22Functions:3742.9 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_MAGNETICFIELD_H
-       2             : #define CRPROPA_MAGNETICFIELD_H
-       3             : 
-       4             : #include "crpropa/Units.h"
-       5             : #include "crpropa/Vector3.h"
-       6             : #include "crpropa/Referenced.h"
-       7             : 
-       8             : #ifdef CRPROPA_HAVE_MUPARSER
-       9             : #include "muParser.h"
-      10             : #endif
-      11             : 
-      12             : namespace crpropa {
-      13             : /**
-      14             :  * \addtogroup MagneticFields
-      15             :  * @{
-      16             :  */
-      17             : 
-      18             : /**
-      19             :  @class MagneticField
-      20             :  @brief Abstract base class for magnetic fields.
-      21             :  */
-      22           0 : class MagneticField: public Referenced {
-      23             : public:
-      24           0 :         virtual ~MagneticField() {
-      25           0 :         }
-      26           0 :         virtual Vector3d getField(const Vector3d &position) const {
-      27           0 :                 return Vector3d(0,0,0);
-      28             :         };
-      29     5760379 :         virtual Vector3d getField(const Vector3d &position, double z) const {
-      30     5760379 :                 return getField(position);
-      31             :         };
-      32             : };
-      33             : 
-      34             : /**
-      35             :  @class PeriodicMagneticField
-      36             :  @brief Magnetic field decorator implementing periodic fields.
-      37             : 
-      38             :  The periodic cube is defined by its origin (Vector3d) and an
-      39             :  extends parameter (Vector3d). All points x=(x_1, x_2, x_3) 
-      40             :  that are described by x_i = origin_i + epsilon * extend_i, 
-      41             :  with epsilon = 0...1 are within the base cube. Magnetic field
-      42             :  strengths for all positions outside of this cube are calculated 
-      43             :  based on the values in the base cube. 
-      44             :  This can be done periodically or reflectively.
-      45             : */
-      46             : 
-      47             : class PeriodicMagneticField: public MagneticField {
-      48             :         ref_ptr<MagneticField> field;
-      49             :         Vector3d origin, extends;
-      50             :         bool reflective;
-      51             : public:
-      52             :         /**
-      53             :          * Constructor
-      54             :          * @param field magnetic field reference pointer
-      55             :          * @param extends length, width, and height of the base cube 
-      56             :         */
-      57             :         PeriodicMagneticField(ref_ptr<MagneticField> field,
-      58             :                         const Vector3d &extends);
-      59             :         /**
-      60             :          * Constructor
-      61             :          * @param field magnetic field reference pointer
-      62             :          * @param extends length, width, and height of the base cube
-      63             :          * @param origin defines the reference position 
-      64             :          * @param reflective for periodic or reflective behavior  
-      65             :         */
-      66             :         PeriodicMagneticField(ref_ptr<MagneticField> field, const Vector3d &extends,
-      67             :                         const Vector3d &origin, bool reflective);
-      68             :         Vector3d &getOrigin();
-      69             :         void setOrigin(const Vector3d &origin);
-      70             :         Vector3d &getExtends();
-      71             :         void setExtends(const Vector3d &origin);
-      72             :         bool isReflective();
-      73             :         void setReflective(bool reflective);
-      74             :         Vector3d getField(const Vector3d &position) const;
-      75             : };
-      76             : 
-      77             : /**
-      78             :  @class MagneticFieldList
-      79             :  @brief Magnetic field decorator implementing a superposition of fields.
-      80             :  */
-      81           2 : class MagneticFieldList: public MagneticField {
-      82             :         std::vector<ref_ptr<MagneticField> > fields;
-      83             : public:
-      84             :         void addField(ref_ptr<MagneticField> field);
-      85             :         Vector3d getField(const Vector3d &position) const;
-      86             : };
-      87             : 
-      88             : /**
-      89             :  @class MagneticFieldEvolution
-      90             :  @brief Magnetic field decorator implementing an evolution of type (1+z)^m.
-      91             :  */
-      92           2 : class MagneticFieldEvolution: public MagneticField {
-      93             :         ref_ptr<MagneticField> field;
-      94             :         double m;
-      95             : public:
-      96             :         /**
-      97             :          * Constructor
-      98             :          * @param field magnetic field reference pointer
-      99             :          * @param m cosmic evolution parameter 
-     100             :         */
-     101             :         MagneticFieldEvolution(ref_ptr<MagneticField> field, double m);
-     102             :         Vector3d getField(const Vector3d &position, double z = 0) const;
-     103             : };
-     104             : 
-     105             : /**
-     106             :  @class UniformMagneticField
-     107             :  @brief Magnetic field with one B-field vector.
-     108             :  */
-     109             : class UniformMagneticField: public MagneticField {
-     110             :         Vector3d value;
-     111             : public:
-     112             :         /**
-     113             :          * Constructor
-     114             :          * @param value magnetic field strength
-     115             :         */
-     116          33 :         UniformMagneticField(const Vector3d &value) :
-     117          33 :                         value(value) {
-     118             :         }
-     119     5760340 :         Vector3d getField(const Vector3d &position) const {
-     120     5760340 :                 return value;
-     121             :         }
-     122             : };
-     123             : 
-     124             : /**
-     125             :  @class MagneticDipoleField
-     126             :  @brief Magnetic dipole field defined by the magnetic moment and the 'core' radius.
-     127             :  */
-     128           1 : class MagneticDipoleField: public MagneticField {
-     129             :         Vector3d origin;
-     130             :         Vector3d moment;
-     131             :         double radius;
-     132             : public:
-     133             :         /**
-     134             :          * Constructor
-     135             :          * @param origin        singularity of the dipole field
-     136             :          * @param moment        magnetic moment of the dipole field
-     137             :          * @param radius        inside a radius around the origin the 
-     138             :          *                                      magnetic field is constant: moment * 2 * mu0 / 3  
-     139             :         */
-     140           1 :         MagneticDipoleField(const Vector3d &origin, const Vector3d &moment, const double radius) :
-     141           1 :                         origin(origin), moment(moment), radius(radius) {
-     142             :         }
-     143             :         Vector3d getField(const Vector3d &position) const;
-     144             : };
-     145             : 
-     146             : #ifdef CRPROPA_HAVE_MUPARSER
-     147             : /**
-     148             :  @class RenormalizeMagneticField
-     149             :  @brief Renormalize strength of a given field by expression in which B is the strength variable.
-     150             :  */
-     151             : class RenormalizeMagneticField: public MagneticField {
-     152             :         ref_ptr<MagneticField> field;
-     153             :         std::string expression;
-     154             :         mu::Parser *p;
-     155             :         double Bmag;
-     156             : public:
-     157             :         /**
-     158             :          * Constructor
-     159             :          * @param field                 magnetic field reference pointer
-     160             :          * @param expression    muParser expression used to renormalize the field, 
-     161             :          *                                              e.g., "gauss". 
-     162             :         */
-     163             :         RenormalizeMagneticField(ref_ptr<MagneticField> field, std::string expression);
-     164           1 :         ~RenormalizeMagneticField() { delete p; }
-     165             :         Vector3d getField(const Vector3d &position);
-     166             : };
-     167             : #endif
-     168             : 
-     169             : /** @} */
-     170             : } // namespace crpropa
-     171             : 
-     172             : #endif // CRPROPA_MAGNETICFIELD_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/MagneticFieldGrid.h.func-sort-c.html b/doc/coverageReport/include/crpropa/magneticField/MagneticFieldGrid.h.func-sort-c.html deleted file mode 100644 index 62ce25a19..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/MagneticFieldGrid.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField/MagneticFieldGrid.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticField - MagneticFieldGrid.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:010.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/MagneticFieldGrid.h.func.html b/doc/coverageReport/include/crpropa/magneticField/MagneticFieldGrid.h.func.html deleted file mode 100644 index 04a253ccc..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/MagneticFieldGrid.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField/MagneticFieldGrid.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticField - MagneticFieldGrid.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:010.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/MagneticFieldGrid.h.gcov.html b/doc/coverageReport/include/crpropa/magneticField/MagneticFieldGrid.h.gcov.html deleted file mode 100644 index 7d0df9558..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/MagneticFieldGrid.h.gcov.html +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField/MagneticFieldGrid.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticField - MagneticFieldGrid.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:010.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_MAGNETICFIELDGRID_H
-       2             : #define CRPROPA_MAGNETICFIELDGRID_H
-       3             : 
-       4             : #include "crpropa/magneticField/MagneticField.h"
-       5             : #include "crpropa/Grid.h"
-       6             : 
-       7             : namespace crpropa {
-       8             : /**
-       9             :  * \addtogroup MagneticFields
-      10             :  * @{
-      11             :  */
-      12             : 
-      13             : /**
-      14             :  @class MagneticFieldGrid
-      15             :  @brief Magnetic field on a periodic (or reflective), cartesian grid with trilinear interpolation.
-      16             : 
-      17             :  This class wraps a Grid3f to serve as a MagneticField.
-      18             :  */
-      19             : class MagneticFieldGrid: public MagneticField {
-      20             :         ref_ptr<Grid3f> grid;
-      21             : public:
-      22             :         /**
-      23             :          *Constructor
-      24             :          @param grid Grid3f storing the magnetic field vectors
-      25             :         */
-      26             :         MagneticFieldGrid(ref_ptr<Grid3f> grid);
-      27             :         void setGrid(ref_ptr<Grid3f> grid);
-      28             :         ref_ptr<Grid3f> getGrid();
-      29             :         Vector3d getField(const Vector3d &position) const;
-      30             : };
-      31             : 
-      32             : /**
-      33             :  @class ModulatedMagneticFieldGrid
-      34             :  @brief Modulated magnetic field on a periodic grid.
-      35             : 
-      36             :  This class wraps a Grid3f to serve as a MagneticField.
-      37             :  The field is modulated on-the-fly with a Grid1f.
-      38             :  The Grid3f and Grid1f do not need to share the same origin, spacing or size.
-      39             :  */
-      40             : class ModulatedMagneticFieldGrid: public MagneticField {
-      41             :         ref_ptr<Grid3f> grid;
-      42             :         ref_ptr<Grid1f> modGrid;
-      43             : public:
-      44           0 :         ModulatedMagneticFieldGrid() {
-      45             :         }
-      46             :         /**
-      47             :          *Constructor
-      48             :          @param grid    Grid3f storing the magnetic field vectors
-      49             :          @param modGrid Grid1f used to scale the magnetic field strength
-      50             :                                         B^new_i = B^old_i * scale 
-      51             :         */
-      52             :         ModulatedMagneticFieldGrid(ref_ptr<Grid3f> grid, ref_ptr<Grid1f> modGrid);
-      53             :         void setGrid(ref_ptr<Grid3f> grid);
-      54             :         void setModulationGrid(ref_ptr<Grid1f> modGrid);
-      55             :         ref_ptr<Grid3f> getGrid();
-      56             :         ref_ptr<Grid1f> getModulationGrid();
-      57             :         void setReflective(bool gridReflective, bool modGridReflective);
-      58             :         Vector3d getField(const Vector3d &position) const;
-      59             : };
-      60             : /** @} */
-      61             : } // namespace crpropa
-      62             : 
-      63             : #endif // CRPROPA_MAGNETICFIELDGRID_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/index-sort-f.html b/doc/coverageReport/include/crpropa/magneticField/index-sort-f.html deleted file mode 100644 index 08da227af..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/index-sort-f.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticFieldHitTotalCoverage
Test:coverage.info.cleanedLines:505689.3 %
Date:2024-04-08 14:58:22Functions:71163.6 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
MagneticField.h -
70.6%70.6%
-
70.6 %12 / 1742.9 %3 / 7
MagneticFieldGrid.h -
0.0%
-
0.0 %0 / 1-0 / 0
GalacticMagneticField.h -
100.0%
-
100.0 %38 / 38100.0 %4 / 4
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/index-sort-l.html b/doc/coverageReport/include/crpropa/magneticField/index-sort-l.html deleted file mode 100644 index 3a378c7d3..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/index-sort-l.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticFieldHitTotalCoverage
Test:coverage.info.cleanedLines:505689.3 %
Date:2024-04-08 14:58:22Functions:71163.6 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
MagneticFieldGrid.h -
0.0%
-
0.0 %0 / 1-0 / 0
MagneticField.h -
70.6%70.6%
-
70.6 %12 / 1742.9 %3 / 7
GalacticMagneticField.h -
100.0%
-
100.0 %38 / 38100.0 %4 / 4
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/index.html b/doc/coverageReport/include/crpropa/magneticField/index.html deleted file mode 100644 index 9cd37eb4a..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/index.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticFieldHitTotalCoverage
Test:coverage.info.cleanedLines:505689.3 %
Date:2024-04-08 14:58:22Functions:71163.6 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
GalacticMagneticField.h -
100.0%
-
100.0 %38 / 38100.0 %4 / 4
MagneticField.h -
70.6%70.6%
-
70.6 %12 / 1742.9 %3 / 7
MagneticFieldGrid.h -
0.0%
-
0.0 %0 / 1-0 / 0
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/GridTurbulence.h.func-sort-c.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/GridTurbulence.h.func-sort-c.html deleted file mode 100644 index 3432fc3a9..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/turbulentField/GridTurbulence.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField/GridTurbulence.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticField/turbulentField - GridTurbulence.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/GridTurbulence.h.func.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/GridTurbulence.h.func.html deleted file mode 100644 index fd3be85af..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/turbulentField/GridTurbulence.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField/GridTurbulence.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticField/turbulentField - GridTurbulence.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/GridTurbulence.h.gcov.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/GridTurbulence.h.gcov.html deleted file mode 100644 index 29f802928..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/turbulentField/GridTurbulence.h.gcov.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField/GridTurbulence.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticField/turbulentField - GridTurbulence.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_GRIDTURBULENCE_H
-       2             : #define CRPROPA_GRIDTURBULENCE_H
-       3             : 
-       4             : #ifdef CRPROPA_HAVE_FFTW3F
-       5             : 
-       6             : #include "crpropa/Grid.h"
-       7             : #include "crpropa/magneticField/turbulentField/TurbulentField.h"
-       8             : 
-       9             : #include "fftw3.h"
-      10             : 
-      11             : namespace crpropa {
-      12             : /**
-      13             :  * \addtogroup MagneticFields
-      14             :  * @{
-      15             :  */
-      16             : 
-      17             : /**
-      18             :  @class GridTurbulence
-      19             :  @brief Turbulent grid-based magnetic field with a general energy spectrum
-      20             :  */
-      21           6 : class GridTurbulence : public TurbulentField {
-      22             :   protected:
-      23             :         unsigned int seed;
-      24             :         ref_ptr<Grid3f> gridPtr;
-      25             : 
-      26             :         void initGrid(const GridProperties &grid);
-      27             :         void initTurbulence();
-      28             : 
-      29             :   public:
-      30             :         /**
-      31             :          Create a random initialization of a turbulent field.
-      32             :          @param spectrum    TurbulenceSpectrum instance to define the spectrum of
-      33             :          turbulence
-      34             :          @param gridProp        GridProperties instance to define the underlying grid
-      35             :          @param seed     Random seed
-      36             :          */
-      37             :         GridTurbulence(const TurbulenceSpectrum &spectrum,
-      38             :                        const GridProperties &gridProp, unsigned int seed = 0);
-      39             : 
-      40             :         Vector3d getField(const Vector3d &pos) const;
-      41             : 
-      42             :         /** Return a const reference to the grid */
-      43             :         const ref_ptr<Grid3f> &getGrid() const;
-      44             : 
-      45             :         /* Helper functions for synthetic turbulent field models */
-      46             :         // Check the grid properties before the FFT procedure
-      47             :         static void checkGridRequirements(ref_ptr<Grid3f> grid, double lMin,
-      48             :                                           double lMax);
-      49             :         // Execute inverse discrete FFT in-place for a 3D grid, from complex to real
-      50             :         // space
-      51             :         static void executeInverseFFTInplace(ref_ptr<Grid3f> grid,
-      52             :                                              fftwf_complex *Bkx, fftwf_complex *Bky,
-      53             :                                              fftwf_complex *Bkz);
-      54             : 
-      55             :         // Usefull checks for a grid field
-      56             :         /** Evaluate the mean vector of all grid points */
-      57             :         Vector3f getMeanFieldVector() const;
-      58             :         /** Evaluate the mean of all grid points */
-      59             :         double getMeanFieldStrength() const;
-      60             :         /** Evaluate the RMS of all grid points */
-      61             :         double getRmsFieldStrength() const;
-      62             :         /** Evaluate the RMS of all grid points per axis */
-      63             :         std::array<float, 3> getRmsFieldStrengthPerAxis() const;
-      64             :         /** Evaluate generated power-spectrum */
-      65             :         std::vector<std::pair<int, float>> getPowerSpectrum() const;
-      66             :         /** Dump a Grid3f to a binary file */
-      67             :         void dumpToFile(std::string filename) const;
-      68             : };
-      69             : 
-      70             : /** @}*/
-      71             : } // namespace crpropa
-      72             : 
-      73             : #endif // CRPROPA_HAVE_FFTW3F
-      74             : 
-      75             : #endif // CRPROPA_GRIDTURBULENCE_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h.func-sort-c.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h.func-sort-c.html deleted file mode 100644 index 0c515e402..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h.func-sort-c.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticField/turbulentField - HelicalGridTurbulence.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:050.0 %
Date:2024-04-08 14:58:22Functions:010.0 %
-
- -
- - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa21initHelicalTurbulenceENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEddddid0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h.func.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h.func.html deleted file mode 100644 index b4ddcbe9c..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h.func.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticField/turbulentField - HelicalGridTurbulence.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:050.0 %
Date:2024-04-08 14:58:22Functions:010.0 %
-
- -
- - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa21initHelicalTurbulenceENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEddddid0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h.gcov.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h.gcov.html deleted file mode 100644 index f2108a9f4..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h.gcov.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField/HelicalGridTurbulence.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticField/turbulentField - HelicalGridTurbulence.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:050.0 %
Date:2024-04-08 14:58:22Functions:010.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_HELICALGRIDTURBULENCE_H
-       2             : #define CRPROPA_HELICALGRIDTURBULENCE_H
-       3             : 
-       4             : #ifdef CRPROPA_HAVE_FFTW3F
-       5             : 
-       6             : #include "crpropa/Grid.h"
-       7             : #include "crpropa/magneticField/turbulentField/SimpleGridTurbulence.h"
-       8             : 
-       9             : #include "kiss/logger.h"
-      10             : #include "kiss/string.h"
-      11             : 
-      12             : namespace crpropa {
-      13             : /**
-      14             :  * \addtogroup MagneticFields
-      15             :  * @{
-      16             :  */
-      17             : 
-      18             : /**
-      19             :  @class HelicalGridTurbulence
-      20             :  @brief Turbulent grid-based magnetic field with a simple power-law spectrum
-      21             :  */
-      22             : class HelicalGridTurbulence : public SimpleGridTurbulence {
-      23             :   private:
-      24             :         double H;
-      25             : 
-      26             :   public:
-      27             :         /**
-      28             :          Create a random initialization of a turbulent field.
-      29             :          @param spectrum    TurbulenceSpectrum instance to define the spectrum of
-      30             :          turbulence
-      31             :          @param gridProp        GridProperties instance to define the underlying grid
-      32             :          @param H       Helicity
-      33             :          @param seed     Random seed
-      34             :          */
-      35             :         HelicalGridTurbulence(const SimpleTurbulenceSpectrum &spectrum,
-      36             :                               const GridProperties &gridProp, double H,
-      37             :                               unsigned int seed = 0);
-      38             : 
-      39             :         static void initTurbulence(ref_ptr<Grid3f> grid, double Brms, double lMin,
-      40             :                                    double lMax, double alpha, int seed, double H);
-      41             : };
-      42             : 
-      43             : // Compatibility with old functions from GridTurbulence:
-      44             : 
-      45             : /**
-      46             :  Create a random initialization of a turbulent field including helicity
-      47             :  @param grid    grid on which the turbulence is calculated
-      48             :  @param Brms    RMS field strength
-      49             :  @param lMin    Minimum wavelength of the turbulence
-      50             :  @param lMax    Maximum wavelength of the turbulence
-      51             :  @param alpha   Power law index of <B^2(k)> ~ k^alpha (alpha = -11/3 corresponds
-      52             :  to a Kolmogorov spectrum)
-      53             :  @param seed    Random seed
-      54             :  @param H               Helicity
-      55             : */
-      56           0 : void initHelicalTurbulence(ref_ptr<Grid3f> grid, double Brms, double lMin,
-      57             :                            double lMax, double alpha = -11 / 3., int seed = 0,
-      58             :                            double H = 0) {
-      59           0 :         KISS_LOG_WARNING
-      60             :             << "initTurbulence is deprecated and will be removed in the future. "
-      61           0 :                "Replace it with a more appropriate turbulent field model instance.";
-      62           0 :         HelicalGridTurbulence::initTurbulence(grid, Brms, lMin, lMax, alpha, seed,
-      63             :                                               H);
-      64           0 : }
-      65             : 
-      66             : /** @}*/
-      67             : } // namespace crpropa
-      68             : 
-      69             : #endif // CRPROPA_HAVE_FFTW3F
-      70             : 
-      71             : #endif // CRPROPA_HELICALGRIDTURBULENCE_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h.func-sort-c.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h.func-sort-c.html deleted file mode 100644 index e3787874e..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h.func-sort-c.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticField/turbulentField - SimpleGridTurbulence.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:172181.0 %
Date:2024-04-08 14:58:22Functions:4757.1 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa24SimpleTurbulenceSpectrumD0Ev0
_ZN7crpropa24SimpleTurbulenceSpectrumD2Ev0
_ZNK7crpropa24SimpleTurbulenceSpectrum20getCorrelationLengthEv0
_ZN7crpropa24SimpleTurbulenceSpectrum26turbulentCorrelationLengthEddd1
_ZN7crpropa26turbulentCorrelationLengthEddd1
_ZN7crpropa14initTurbulenceENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEddddi4
_ZNK7crpropa24SimpleTurbulenceSpectrum14energySpectrumEd206961
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h.func.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h.func.html deleted file mode 100644 index c913f5f27..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h.func.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticField/turbulentField - SimpleGridTurbulence.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:172181.0 %
Date:2024-04-08 14:58:22Functions:4757.1 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa14initTurbulenceENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEddddi4
_ZN7crpropa24SimpleTurbulenceSpectrum26turbulentCorrelationLengthEddd1
_ZN7crpropa24SimpleTurbulenceSpectrumD0Ev0
_ZN7crpropa24SimpleTurbulenceSpectrumD2Ev0
_ZN7crpropa26turbulentCorrelationLengthEddd1
_ZNK7crpropa24SimpleTurbulenceSpectrum14energySpectrumEd206961
_ZNK7crpropa24SimpleTurbulenceSpectrum20getCorrelationLengthEv0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h.gcov.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h.gcov.html deleted file mode 100644 index 57422a4cb..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h.gcov.html +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField/SimpleGridTurbulence.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticField/turbulentField - SimpleGridTurbulence.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:172181.0 %
Date:2024-04-08 14:58:22Functions:4757.1 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_SIMPLEGRIDTURBULENCE_H
-       2             : #define CRPROPA_SIMPLEGRIDTURBULENCE_H
-       3             : 
-       4             : #ifdef CRPROPA_HAVE_FFTW3F
-       5             : 
-       6             : #include "crpropa/magneticField/turbulentField/GridTurbulence.h"
-       7             : 
-       8             : #include "kiss/logger.h"
-       9             : #include "kiss/string.h"
-      10             : 
-      11             : namespace crpropa {
-      12             : /**
-      13             :  * \addtogroup MagneticFields
-      14             :  * @{
-      15             :  */
-      16             : 
-      17             : /**
-      18             :  @class SimpleTurbulenceSpectrum
-      19             :  @brief Defines the energy spectrum of simple power-law turbulence
-      20             :  */
-      21             : class SimpleTurbulenceSpectrum : public TurbulenceSpectrum {
-      22             :         const int constScaleBendover = 1000;    // define the bandover scale as 1000 * lMax to ensure k * lBendover >> 1. The bendover scale is necessary for the implementation of PlaneWaveTurbulence. 
-      23             :   public:
-      24             :         /**
-      25             :          * The bend-over scale is set to 1000 times lMax to ensure to be in the inertial range. This should not be changed.
-      26             :          @param Brms            Root mean square field strength for generated field
-      27             :          @param lMin            Minimum physical scale of the turbulence
-      28             :          @param lMax            Maximum physical scale of the turbulence
-      29             :          @param sIndex          Spectral index of the energy spectrum in the inertial range
-      30             :         */
-      31             :         SimpleTurbulenceSpectrum(double Brms, double lMin, double lMax,
-      32             :                                  double sIndex = 5. / 3)
-      33           2 :             : TurbulenceSpectrum(Brms, lMin, lMax, constScaleBendover * lMax, sIndex, 0) {}
-      34           0 :         ~SimpleTurbulenceSpectrum() {}
-      35             : 
-      36             :         /**
-      37             :         General energy spectrum for synthetic turbulence models
-      38             :         */
-      39      206961 :         double energySpectrum(double k) const {
-      40      206961 :                 return std::pow(k, -getSindex() - 2);
-      41             :         }
-      42             : 
-      43             :         /**
-      44             :             @brief       compute the magnetic field coherence length according to
-      45             :            the formula in  Harari et al. JHEP03(2002)045
-      46             :             @return Lc   coherence length of the magnetic field
-      47             :         */
-      48           0 :         double getCorrelationLength() const {
-      49           0 :                 return turbulentCorrelationLength(getLmin(), getLmax(),
-      50           0 :                                                   getSindex());
-      51             :         }
-      52           1 :         static double turbulentCorrelationLength(double lMin, double lMax,
-      53             :                                                  double s) {
-      54           1 :                 double r = lMin / lMax;
-      55           1 :                 return lMax / 2 * (s - 1) / s * (1 - pow(r, s)) / (1 - pow(r, s - 1));
-      56             :         }
-      57             : };
-      58             : 
-      59             : /**
-      60             :  @class SimpleGridTurbulence
-      61             :  @brief Turbulent grid-based magnetic field with a simple power-law spectrum
-      62             :  */
-      63           3 : class SimpleGridTurbulence : public GridTurbulence {
-      64             :   public:
-      65             :         /**
-      66             :          Create a random initialization of a turbulent field.
-      67             :          @param spectrum    TurbulenceSpectrum instance to define the spectrum of
-      68             :          turbulence
-      69             :          @param gridProp        GridProperties instance to define the underlying grid
-      70             :          @param seed     Random seed
-      71             :          */
-      72             :         SimpleGridTurbulence(const SimpleTurbulenceSpectrum &spectrum,
-      73             :                              const GridProperties &gridProp, unsigned int seed = 0);
-      74             : 
-      75             :         static void initTurbulence(ref_ptr<Grid3f> grid, double Brms, double lMin,
-      76             :                                    double lMax, double alpha, int seed);
-      77             : };
-      78             : 
-      79             : // Compatibility with old functions from GridTurbulence:
-      80             : 
-      81             : /** Analytically calculate the correlation length of the simple model turbulent
-      82             :  * field */
-      83           1 : inline double turbulentCorrelationLength(double lMin, double lMax,
-      84             :                                          double alpha = -11 / 3.) {
-      85           2 :         KISS_LOG_WARNING
-      86             :             << "turbulentCorrelationLength is deprecated and will be "
-      87             :                "removed in the future. Replace it with a more appropriate "
-      88           1 :                "turbulent field model and call getCorrelationLength().";
-      89           1 :         return SimpleTurbulenceSpectrum::turbulentCorrelationLength(lMin, lMax,
-      90           1 :                                                                     -alpha - 2);
-      91             : }
-      92             : 
-      93             : /**
-      94             :  Create a random initialization of a turbulent field.
-      95             :  @param grid    grid on which the turbulence is calculated
-      96             :  @param lMin    Minimum wavelength of the turbulence
-      97             :  @param lMax    Maximum wavelength of the turbulence
-      98             :  @param alpha   Power law index of <B^2(k)> ~ k^alpha (alpha = -11/3 corresponds
-      99             :  to a Kolmogorov spectrum)
-     100             :  @param Brms    RMS field strength
-     101             :  @param seed    Random seed
-     102             :  */
-     103           4 : inline void initTurbulence(ref_ptr<Grid3f> grid, double Brms, double lMin,
-     104             :                            double lMax, double alpha = -11 / 3., int seed = 0) {
-     105           8 :         KISS_LOG_WARNING
-     106             :             << "initTurbulence is deprecated and will be removed in the future. "
-     107           4 :                "Replace it with a more appropriate turbulent field model instance.";
-     108           4 :         SimpleGridTurbulence::initTurbulence(grid, Brms, lMin, lMax, alpha, seed);
-     109           1 : }
-     110             : 
-     111             : /** @}*/
-     112             : } // namespace crpropa
-     113             : 
-     114             : #endif // CRPROPA_HAVE_FFTW3F
-     115             : 
-     116             : #endif // CRPROPA_SIMPLEGRIDTURBULENCE_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/TurbulentField.h.func-sort-c.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/TurbulentField.h.func-sort-c.html deleted file mode 100644 index e588a9cfb..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/turbulentField/TurbulentField.h.func-sort-c.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField/TurbulentField.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticField/turbulentField - TurbulentField.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:253278.1 %
Date:2024-04-08 14:58:22Functions:4944.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa14TurbulentFieldD0Ev0
_ZN7crpropa14TurbulentFieldD2Ev0
_ZN7crpropa18TurbulenceSpectrumD2Ev0
_ZNK7crpropa14TurbulentField20getCorrelationLengthEv0
_ZNK7crpropa18TurbulenceSpectrum20getCorrelationLengthEv0
_ZNK7crpropa18TurbulenceSpectrum21spectrumNormalizationEv1
_ZN7crpropa18TurbulenceSpectrumD0Ev2
_ZN7crpropa18TurbulenceSpectrumC2Edddddd9
_ZNK7crpropa18TurbulenceSpectrum14energySpectrumEd208128
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/TurbulentField.h.func.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/TurbulentField.h.func.html deleted file mode 100644 index 6e9224a7c..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/turbulentField/TurbulentField.h.func.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField/TurbulentField.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticField/turbulentField - TurbulentField.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:253278.1 %
Date:2024-04-08 14:58:22Functions:4944.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa14TurbulentFieldD0Ev0
_ZN7crpropa14TurbulentFieldD2Ev0
_ZN7crpropa18TurbulenceSpectrumC2Edddddd9
_ZN7crpropa18TurbulenceSpectrumD0Ev2
_ZN7crpropa18TurbulenceSpectrumD2Ev0
_ZNK7crpropa14TurbulentField20getCorrelationLengthEv0
_ZNK7crpropa18TurbulenceSpectrum14energySpectrumEd208128
_ZNK7crpropa18TurbulenceSpectrum20getCorrelationLengthEv0
_ZNK7crpropa18TurbulenceSpectrum21spectrumNormalizationEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/TurbulentField.h.gcov.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/TurbulentField.h.gcov.html deleted file mode 100644 index dd676ef0c..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/turbulentField/TurbulentField.h.gcov.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField/TurbulentField.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticField/turbulentField - TurbulentField.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:253278.1 %
Date:2024-04-08 14:58:22Functions:4944.4 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_TURBULENTFIELD_H
-       2             : #define CRPROPA_TURBULENTFIELD_H
-       3             : 
-       4             : #include "crpropa/magneticField/MagneticField.h"
-       5             : #include <cmath>
-       6             : 
-       7             : namespace crpropa {
-       8             : /**
-       9             :  * \addtogroup MagneticFields
-      10             :  * @{
-      11             :  */
-      12             : 
-      13             : /**
-      14             :  @class TurbulenceSpectrum
-      15             :  @brief Defines the energy spectrum of turbulence parametrizied by A(k) ~ k^q /(1 + k^2)^{(s + q)/2 + 1}
-      16             :  */
-      17             : class TurbulenceSpectrum : public Referenced {
-      18             :   private:
-      19             :         const double Brms; /**< Brms value of the turbulent field (normalization) */
-      20             :         const double sIndex; /**< Spectral index for the inertial range, for example
-      21             :                           s=5/3 for Kolmogorov spectrum; in some parts of the code this
-      22             :                           parameter is referred by alpha which is the total 3D isotropic
-      23             :                           spectrum with additional k^2 and the minus sign, e.g.,
-      24             :                           for Kolmogorov: alpha = -(s + 2) */
-      25             :         const double qIndex; /**< Spectral index for the injection range, for
-      26             :                           example q=4 for 3D homogeneous turbulence */
-      27             :         const double lBendover;  /**< the bend-over scale */
-      28             :         const double lMin, lMax; /**< Min and Max scale of turbulence */
-      29             : 
-      30             :   protected:
-      31             :         /**
-      32             :         Normalization for the below defined Lc
-      33             :         */
-      34           1 :         double spectrumNormalization() const {
-      35           1 :                 return std::tgamma((sIndex + qIndex) / 2.0) /
-      36           1 :                        (2.0 * std::tgamma((sIndex - 1) / 2.0) *
-      37           1 :                         std::tgamma((qIndex + 1) / 2.0));
-      38             :         }
-      39             : 
-      40             :   public:
-      41             :         /**
-      42             :          * @param Brms         root mean square field strength for generated field
-      43             :          * @param lMin   Minimum physical scale of the turbulence
-      44             :          * @param lMax   Maximum physical scale of the turbulence
-      45             :          * @param lBendover        the bend-over scale
-      46             :          * @param sIndex         Spectral index of the energy spectrum in the inertial range
-      47             :          * @param qIndex         Spectral index of the energy spectrum in the energy range
-      48             :         */
-      49           9 :         TurbulenceSpectrum(double Brms, double lMin, double lMax,
-      50             :                            double lBendover = 1, double sIndex = (5. / 3.),
-      51             :                            double qIndex = 4)
-      52           9 :             : Brms(Brms), lMin(lMin), lMax(lMax), lBendover(lBendover),
-      53           9 :               sIndex(sIndex), qIndex(qIndex) {
-      54           9 :                 if (lMin > lMax) {
-      55           0 :                         throw std::runtime_error("TurbulenceSpectrum: lMin > lMax");
-      56             :                 }
-      57           9 :                 if (lMin <= 0) {
-      58           0 :                         throw std::runtime_error("TurbulenceSpectrum: lMin <= 0");
-      59             :                 }
-      60           9 :         }
-      61             : 
-      62           7 :         ~TurbulenceSpectrum() {}
-      63             : 
-      64          31 :         double getBrms() const { return Brms; }
-      65          19 :         double getLmin() const { return lMin; }
-      66          19 :         double getLmax() const { return lMax; }
-      67          22 :         double getLbendover() const { return lBendover; }
-      68           5 :         double getSindex() const { return sIndex; }
-      69           2 :         double getQindex() const { return qIndex; }
-      70             :         
-      71             :         /**
-      72             :         General energy spectrum for synthetic turbulence models (not normalized!)
-      73             :         with normalized ^k = k*lBendover
-      74             :         */
-      75      208128 :         virtual double energySpectrum(double k) const {
-      76      208128 :                 double kHat = k * lBendover;
-      77      208128 :                 return std::pow(kHat, qIndex) /
-      78      208128 :                                        std::pow(1.0 + kHat * kHat,
-      79      208128 :                                         (sIndex + qIndex) / 2.0 + 1.0);
-      80             :         }
-      81             : 
-      82             :         /**
-      83             :   Computes the magnetic field coherence length
-      84             :         Obtained from the definition of \f$l_c = 1/B_{\rm rms}^2 \int_0^\infty dr\langleB(0)B^*(r)\rangle \f$
-      85             :         Approximates the true value correctly as long as lBendover <= lMax/8 (~5%
-      86             :   error) (for the true value the above integral should go from lMin to lMax)
-      87             :         */
-      88           0 :         virtual double getCorrelationLength() const {
-      89           1 :                 return 4 * M_PI / ((sIndex + 2.0) * sIndex) * spectrumNormalization() *
-      90           1 :                        lBendover;
-      91             :         }
-      92             : };
-      93             : 
-      94             : /**
-      95             :  @class TurbulentField
-      96             :  @brief An abstract base class for different models of turbulent magnetic fields
-      97             : 
-      98             :  This module provides common methods for all turbulent (synthetic) magnetic
-      99             :  fields. Does not actually implement any turbulent field.
-     100             :  */
-     101             : class TurbulentField : public MagneticField {
-     102             :   protected:
-     103             :         const TurbulenceSpectrum &spectrum;
-     104             : 
-     105             :   public:
-     106           8 :         TurbulentField(const TurbulenceSpectrum &spectrum) : spectrum(spectrum) {}
-     107           0 :         virtual ~TurbulentField() {}
-     108             : 
-     109           0 :         double getBrms() const { return spectrum.getBrms(); }
-     110           0 :         virtual double getCorrelationLength() const {
-     111           0 :                 return spectrum.getCorrelationLength();
-     112             :         }
-     113             : };
-     114             : 
-     115             : /** @}*/
-     116             : 
-     117             : } // namespace crpropa
-     118             : 
-     119             : #endif // CRPROPA_TURBULENTFIELD_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/index-sort-f.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/index-sort-f.html deleted file mode 100644 index 297188998..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/turbulentField/index-sort-f.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticField/turbulentFieldHitTotalCoverage
Test:coverage.info.cleanedLines:435972.9 %
Date:2024-04-08 14:58:22Functions:81747.1 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
HelicalGridTurbulence.h -
0.0%
-
0.0 %0 / 50.0 %0 / 1
TurbulentField.h -
78.1%78.1%
-
78.1 %25 / 3244.4 %4 / 9
SimpleGridTurbulence.h -
81.0%81.0%
-
81.0 %17 / 2157.1 %4 / 7
GridTurbulence.h -
100.0%
-
100.0 %1 / 1-0 / 0
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/index-sort-l.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/index-sort-l.html deleted file mode 100644 index 133acd288..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/turbulentField/index-sort-l.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticField/turbulentFieldHitTotalCoverage
Test:coverage.info.cleanedLines:435972.9 %
Date:2024-04-08 14:58:22Functions:81747.1 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
HelicalGridTurbulence.h -
0.0%
-
0.0 %0 / 50.0 %0 / 1
TurbulentField.h -
78.1%78.1%
-
78.1 %25 / 3244.4 %4 / 9
SimpleGridTurbulence.h -
81.0%81.0%
-
81.0 %17 / 2157.1 %4 / 7
GridTurbulence.h -
100.0%
-
100.0 %1 / 1-0 / 0
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticField/turbulentField/index.html b/doc/coverageReport/include/crpropa/magneticField/turbulentField/index.html deleted file mode 100644 index c75493324..000000000 --- a/doc/coverageReport/include/crpropa/magneticField/turbulentField/index.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticField/turbulentField - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticField/turbulentFieldHitTotalCoverage
Test:coverage.info.cleanedLines:435972.9 %
Date:2024-04-08 14:58:22Functions:81747.1 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
GridTurbulence.h -
100.0%
-
100.0 %1 / 1-0 / 0
HelicalGridTurbulence.h -
0.0%
-
0.0 %0 / 50.0 %0 / 1
SimpleGridTurbulence.h -
81.0%81.0%
-
81.0 %17 / 2157.1 %4 / 7
TurbulentField.h -
78.1%78.1%
-
78.1 %25 / 3244.4 %4 / 9
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticLens/MagneticLens.h.func-sort-c.html b/doc/coverageReport/include/crpropa/magneticLens/MagneticLens.h.func-sort-c.html deleted file mode 100644 index 1aa082456..000000000 --- a/doc/coverageReport/include/crpropa/magneticLens/MagneticLens.h.func-sort-c.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticLens/MagneticLens.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticLens - MagneticLens.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:204247.6 %
Date:2024-04-08 14:58:22Functions:4666.7 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa12MagneticLensC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa8LensPartC2Ev0
_ZN7crpropa12MagneticLensC2Eh3
_ZN7crpropa12MagneticLensD2Ev3
_ZN7crpropa8LensPartC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEdd3
_ZN7crpropa8LensPartD2Ev3
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticLens/MagneticLens.h.func.html b/doc/coverageReport/include/crpropa/magneticLens/MagneticLens.h.func.html deleted file mode 100644 index 41eba5bb7..000000000 --- a/doc/coverageReport/include/crpropa/magneticLens/MagneticLens.h.func.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticLens/MagneticLens.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticLens - MagneticLens.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:204247.6 %
Date:2024-04-08 14:58:22Functions:4666.7 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa12MagneticLensC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa12MagneticLensC2Eh3
_ZN7crpropa12MagneticLensD2Ev3
_ZN7crpropa8LensPartC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEdd3
_ZN7crpropa8LensPartC2Ev0
_ZN7crpropa8LensPartD2Ev3
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticLens/MagneticLens.h.gcov.html b/doc/coverageReport/include/crpropa/magneticLens/MagneticLens.h.gcov.html deleted file mode 100644 index 1a6c474df..000000000 --- a/doc/coverageReport/include/crpropa/magneticLens/MagneticLens.h.gcov.html +++ /dev/null @@ -1,352 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticLens/MagneticLens.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticLens - MagneticLens.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:204247.6 %
Date:2024-04-08 14:58:22Functions:4666.7 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : //----------------------------------------------------------------------
-       2             : // This file is part of PARSEC (http://physik.rwth-aachen.de/parsec)
-       3             : // a parametrized simulation engine for cosmic rays.
-       4             : //
-       5             : // Copyright (C) 2011   Martin Erdmann, Peter Schiffer, Tobias Winchen
-       6             : //                                                                               RWTH Aachen University, Germany
-       7             : // Contact: winchen@physik.rwth-aachen.de
-       8             : //
-       9             : //      This program is free software: you can redistribute it and/or
-      10             : //      modify it under the terms of the GNU General Public License as
-      11             : //      published by the Free Software Foundation, either version 3 of
-      12             : //      the License, or (at your option) any later version.
-      13             : //
-      14             : //      This program is distributed in the hope that it will be useful,
-      15             : //      but WITHOUT ANY WARRANTY; without even the implied warranty of
-      16             : //      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    See the
-      17             : //      GNU General Public License for more details.
-      18             : //
-      19             : //      You should have received a copy of the GNU General Public License
-      20             : //      along with this program. If not, see <http://www.gnu.org/licenses/>.
-      21             : //----------------------------------------------------------------------
-      22             : 
-      23             : #ifndef MAGNETICLENS_HH
-      24             : #define MAGNETICLENS_HH
-      25             : 
-      26             : #include "crpropa/magneticLens/ModelMatrix.h"
-      27             : #include "crpropa/magneticLens/Pixelization.h"
-      28             : #include "crpropa/Units.h"
-      29             : #include "crpropa/Vector3.h"
-      30             : 
-      31             : #include <vector>
-      32             : #include <string>
-      33             : #include <stdexcept>
-      34             : #include <fstream>
-      35             : #include <sstream>
-      36             : #include <iostream>
-      37             : #include <stdint.h>
-      38             : 
-      39             : 
-      40             : namespace crpropa
-      41             : {
-      42             : 
-      43             : /// Holds one matrix for the lens and information about the rigidity range
-      44             : class LensPart
-      45             : {
-      46             :         string _filename;
-      47             :         double _rigidityMin;
-      48             :         double _rigidityMax;
-      49             :         ModelMatrixType M;
-      50             :         double _maximumSumOfColumns;
-      51             :         bool _maximumSumOfColumns_calculated;
-      52             : 
-      53             : public:
-      54           0 :         LensPart()
-      55           0 :         {
-      56           0 :         }
-      57             :         /// File containing the matrix to be used in the range rigidityMin,
-      58             :         /// rigidityMax in Joule
-      59           3 :         LensPart(const std::string &filename, double rigidityMin, double rigidityMax) :
-      60           3 :                         _filename(filename), _rigidityMin(rigidityMin), _rigidityMax(rigidityMax), _maximumSumOfColumns_calculated(
-      61           3 :                                         false), _maximumSumOfColumns(0)
-      62             :         {
-      63           3 :         }
-      64             : 
-      65           3 :         ~LensPart()
-      66             :         {
-      67           3 :         }
-      68             : 
-      69             :         /// Loads the matrix from file
-      70             :         void loadMatrixFromFile()
-      71             :         {
-      72           0 :                 deserialize(_filename, M);
-      73           0 :         }
-      74             : 
-      75             :         /// Returns the filename of the matrix
-      76             :         const std::string& getFilename()
-      77             :         {
-      78             :                 return _filename;
-      79             :         }
-      80             : 
-      81             :         /// Calculates the maximum of the sums of columns for the matrix
-      82             :         double getMaximumOfSumsOfColumns()
-      83             :         {
-      84           0 :                 if (!_maximumSumOfColumns_calculated)
-      85             :                 { // lazy calculation of maximum
-      86           0 :                         _maximumSumOfColumns = maximumOfSumsOfColumns(M);
-      87           0 :                         _maximumSumOfColumns_calculated = true;
-      88             :                 }
-      89           0 :                 return _maximumSumOfColumns;
-      90             :         }
-      91             : 
-      92             :         /// Returns the minimum of the rigidity range for the lenspart in eV
-      93             :         double getMinimumRigidity()
-      94             :         {
-      95       12293 :                 return _rigidityMin / eV;
-      96             :         }
-      97             : 
-      98             :         /// Returns the maximum of the rigidity range for the lenspart in eV
-      99             :         double getMaximumRigidity()
-     100             :         {
-     101       12292 :                 return _rigidityMax / eV;
-     102             :         }
-     103             : 
-     104             :         /// Returns the modelmatrix
-     105             :         ModelMatrixType& getMatrix()
-     106             :         {
-     107           0 :                 return M;
-     108             :         }
-     109             : 
-     110             :         /// Sets the modelmatrix
-     111             :         void setMatrix(const ModelMatrixType& m)
-     112             :         {
-     113           3 :                 M = m;
-     114           0 :         }
-     115             : 
-     116             : 
-     117             : };
-     118             : 
-     119             : /// Function to calculate the mean deflection [rad] of the matrix M, given a pixelization
-     120             : //double calculateMeanDeflection(const ModelMatrix &M,
-     121             : //              const Pixelization &pixelization)
-     122             : //{
-     123             : //      double totalDeflection = 0;
-     124             : //      double weightSum = 0;
-     125             : //      for (const_i2_t it1 = M.begin2(); it1 != (M.end2()); it1++)
-     126             : //      {
-     127             : //              for (const_i1_t it2 = it1.begin(); it2 != it1.end(); it2++)
-     128             : //              {
-     129             : //                      totalDeflection+= pixelization.angularDistance(it2.index1(),
-     130             : //                                      it2.index2()) * (*it2) ;
-     131             : //                      weightSum+= (*it2);
-     132             : //              }
-     133             : //      }
-     134             : //      return totalDeflection / weightSum;
-     135             : //}
-     136             : 
-     137             : typedef std::vector<LensPart*>::iterator LensPartIter;
-     138             : typedef std::vector<LensPart*>::const_iterator const_LensPartIter;
-     139             : 
-     140             : /**
-     141             :  * \addtogroup MagneticLenses 
-     142             :  * @{
-     143             :  */
-     144             : 
-     145             : /// The lens for the galactic magnetic field.
-     146             : /// Note that the energies refer to protons (Z=1). To be used with other particles with a different charge number please select the rigidity accordingly.
-     147             : class MagneticLens
-     148             : {
-     149             : 
-     150             :         void updateRigidityBounds(double rigidityMin, double rigidityMax);
-     151             : 
-     152             :         /// Loads part of a lens (one matrix) from file to use it in given rigidity range.
-     153             :         void loadLensPart(const string &filename, double rigidityMin,
-     154             :                         double rigidityMax);
-     155             : 
-     156             :         // Stores the individual lenses
-     157             :         std::vector<LensPart*> _lensParts;
-     158             :         Pixelization* _pixelization;
-     159             :         // Checks Matrix, raises Errors if not ok - also generate
-     160             :         // _pixelization if called first time
-     161             :         void _checkMatrix(const ModelMatrixType &M);
-     162             :         // minimum / maximum rigidity that is covered by the lens [Joule]
-     163             :         double _minimumRigidity;
-     164             :         double _maximumRigidity;
-     165             :         static bool _randomSeeded;
-     166             :         double _norm;
-     167             : 
-     168             : public:
-     169             :         /// Default constructor
-     170           0 :         MagneticLens() :
-     171           0 :                         _pixelization(NULL), _minimumRigidity(DBL_MAX), _maximumRigidity(DBL_MIN), _norm(1)
-     172             :         {
-     173             :         }
-     174             : 
-     175             :         /// Constructs lens with predefined healpix order
-     176           3 :         MagneticLens(uint8_t healpixorder) :
-     177           3 :                         _pixelization(NULL), _minimumRigidity(DBL_MAX), _maximumRigidity(DBL_MIN)
-     178             :         {
-     179           3 :                 _pixelization = new Pixelization(healpixorder);
-     180           3 :         }
-     181             : 
-     182             :         /// Construct lens and load lens from file
-     183           0 :         MagneticLens(const string &filename) :
-     184           0 :                         _pixelization(NULL), _minimumRigidity(DBL_MAX), _maximumRigidity(DBL_MIN)
-     185             :         {
-     186           0 :                 loadLens(filename);
-     187           0 :         }
-     188             : 
-     189             :         /// Returns the pixelization used
-     190             :         const Pixelization& getPixelization() const
-     191             :         {
-     192           0 :                 return (*_pixelization);
-     193             :         }
-     194             : 
-     195             :         /// Default destructor
-     196           3 :         ~MagneticLens()
-     197             :         {
-     198           3 :                 if (_pixelization)
-     199           3 :                         delete _pixelization;
-     200           3 :                 for (std::vector<LensPart*>::iterator iter = _lensParts.begin();
-     201           6 :                                 iter != _lensParts.end(); iter++)
-     202             :                 {
-     203           3 :                         delete (*iter);
-     204             :                 }
-     205             :                 _lensParts.clear();
-     206           3 :         }
-     207             : 
-     208             :         /// Try to transform the comsic ray to a new direction.
-     209             :         /// Returns false and does not change phi and theta if the cosmic ray is
-     210             :         /// lost due to conservation of cosmic ray flux.
-     211             :         /// Rigidity is given in Joule, phi and theta in rad
-     212             :         bool transformCosmicRay(double rigidity, double& phi, double& theta);
-     213             : 
-     214             :         /// Tries transform a cosmic ray with momentum vector p
-     215             :         bool transformCosmicRay(double rigidity, Vector3d &p);
-     216             : 
-     217             :         /// transforms the model array assuming that model points to an array of the
-     218             :         /// correct size. Rigidity is given in Joule
-     219             :         void transformModelVector(double* model, double rigidity) const;
-     220             : 
-     221             :         /// Loads M as part of a lens and use it in given rigidity range with
-     222             :         /// rigidities given in Joule
-     223             :         void setLensPart(const ModelMatrixType &M, double rigidityMin, double rigidityMax);
-     224             : 
-     225             :         /// Loads a lens from a given file, containing lines like
-     226             :         /// lensefile.MLDAT rigidityMin rigidityMax
-     227             :         /// rigidities are given in logarithmic units [log10(E / eV)]
-     228             :         void loadLens(const string &filename);
-     229             : 
-     230             :         /// Normalizes the lens parts to the maximum of sums of columns of
-     231             :         /// every lenspart. By doing this, the lens won't distort the spectrum
-     232             :         void normalizeLens();
-     233             : 
-     234             :         /// Normalizes the lens parts individually. Normalized this way, the
-     235             :         /// lens generally distorts the spectrum of the sources, but deflects
-     236             :         /// the UHECR more efficiently.
-     237             :         void normalizeLensparts();
-     238             : 
-     239             :         /// Checks if rigidity [Joule] is covered by lens
-     240             :         bool rigidityCovered(double rigidity) const;
-     241             : 
-     242             :         /// Normalizes all matrix columns - the lens will then create fake
-     243             :         /// anisotropies, but won't drop particles
-     244             :         void normalizeMatrixColumns();
-     245             : 
-     246             :         /// Returns minimum rigidity covered by lens, in eV
-     247             :         double getMinimumRigidity() const
-     248             :         {
-     249           0 :                 return _minimumRigidity / eV;
-     250             :         }
-     251             :         /// Returns maximum rigidity covered by lens, in eV
-     252             :         double getMaximumRigidity() const
-     253             :         {
-     254           0 :                 return _maximumRigidity / eV;
-     255             :         }
-     256             : 
-     257             :         //      returns the norm used for the lenses
-     258             :         double getNorm()
-     259             :         {
-     260           0 :                 return _norm;
-     261             :         }
-     262             : 
-     263             :         /// Returns iterator to the lens part with rigidity Joule
-     264             :         LensPart* getLensPart(double rigidity) const;
-     265             : 
-     266             :         /// Returns all lens parts
-     267             :         const std::vector<LensPart*>& getLensParts() const
-     268             :         {
-     269           0 :                 return _lensParts;
-     270             :         }
-     271             : };
-     272             : 
-     273             : /** @}*/
-     274             : } // namespace
-     275             : 
-     276             : #endif // MAGNETICLENS_HH
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticLens/ParticleMapsContainer.h.func-sort-c.html b/doc/coverageReport/include/crpropa/magneticLens/ParticleMapsContainer.h.func-sort-c.html deleted file mode 100644 index 907daed16..000000000 --- a/doc/coverageReport/include/crpropa/magneticLens/ParticleMapsContainer.h.func-sort-c.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticLens/ParticleMapsContainer.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticLens - ParticleMapsContainer.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:21020.0 %
Date:2024-04-08 14:58:22Functions:1250.0 %
-
- -
- - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa21ParticleMapsContainer9getWeightEid0
_ZN7crpropa21ParticleMapsContainerC2Edd2
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticLens/ParticleMapsContainer.h.func.html b/doc/coverageReport/include/crpropa/magneticLens/ParticleMapsContainer.h.func.html deleted file mode 100644 index 1197e3fa1..000000000 --- a/doc/coverageReport/include/crpropa/magneticLens/ParticleMapsContainer.h.func.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticLens/ParticleMapsContainer.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticLens - ParticleMapsContainer.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:21020.0 %
Date:2024-04-08 14:58:22Functions:1250.0 %
-
- -
- - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa21ParticleMapsContainer9getWeightEid0
_ZN7crpropa21ParticleMapsContainerC2Edd2
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticLens/ParticleMapsContainer.h.gcov.html b/doc/coverageReport/include/crpropa/magneticLens/ParticleMapsContainer.h.gcov.html deleted file mode 100644 index b652fe992..000000000 --- a/doc/coverageReport/include/crpropa/magneticLens/ParticleMapsContainer.h.gcov.html +++ /dev/null @@ -1,221 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticLens/ParticleMapsContainer.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticLens - ParticleMapsContainer.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:21020.0 %
Date:2024-04-08 14:58:22Functions:1250.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_PARTICLEMAPSCONTAINER_HH
-       2             : #define CRPROPA_PARTICLEMAPSCONTAINER_HH
-       3             : 
-       4             : #include <map>
-       5             : #include <vector>
-       6             : #include "crpropa/magneticLens/Pixelization.h"
-       7             : #include "crpropa/magneticLens/MagneticLens.h"
-       8             : 
-       9             : #include "crpropa/Vector3.h"
-      10             : 
-      11             : namespace crpropa {
-      12             : /**
-      13             :  * \addtogroup MagneticLenses 
-      14             :  * @{
-      15             :  */
-      16             : 
-      17             : /** 
-      18             :  @class ParticleMapsContainer
-      19             :  @brief A container for particle maps
-      20             : 
-      21             :  The maps are stored with discrete energies on a logarithmic scale. The
-      22             :  default energy width is 0.02 with an energy bin from 10**17.99 - 10**18.01 eV.
-      23             :  */
-      24             : class ParticleMapsContainer {
-      25             : private:
-      26             :         std::map<int, std::map <int, double*> > _data;
-      27             :         Pixelization _pixelization;
-      28             :         double _deltaLogE;
-      29             :         double _bin0lowerEdge;
-      30             : 
-      31             :         // get the bin number of the energy
-      32             :         int energy2Idx(double energy) const;
-      33             :         double idx2Energy(int idx) const;
-      34             : 
-      35             :         // weights of the particles
-      36             :         double _sumOfWeights;
-      37             :         std::map<int, double > _weightsPID;
-      38             :         std::map<int, map<int, double> > _weights_pidEnergy;
-      39             : 
-      40             :         // lazy update of weights
-      41             :         bool _weightsUpToDate;
-      42             :         void _updateWeights();
-      43             : 
-      44             : public:
-      45             :         /** Constructor.
-      46             :          @param deltaLogE               width of logarithmic energy bin [in eV]
-      47             :          @param bin0lowerEdge   logarithm of energy of the lower edge of first bin [in log(eV)]
-      48             :          */
-      49           2 :         ParticleMapsContainer(double deltaLogE = 0.02, double bin0lowerEdge = 17.99) : _deltaLogE(deltaLogE), _bin0lowerEdge(bin0lowerEdge), _pixelization(6), _weightsUpToDate(false), _sumOfWeights(0) {
-      50           2 :         }
-      51             :         /** Destructor.
-      52             :          */
-      53             :         ~ParticleMapsContainer();
-      54             : 
-      55             :         size_t getNumberOfPixels() {
-      56           0 :                 return _pixelization.getNumberOfPixels();
-      57             :         }
-      58             : 
-      59             :         /** Get the map for the particleId with the given energy.
-      60             :          @param particleId              id of the particle following the PDG numbering scheme
-      61             :          @param energy                  the energy of the particle [in Joules]
-      62             :          @returns The map for a given particleId with a given energy
-      63             :          */
-      64             :         double *getMap(const int particleId, double energy);
-      65             : 
-      66             :         /** Adds a particle to the map container.
-      67             :          @param particleId                      id of the particle following the PDG numbering scheme
-      68             :          @param energy                          the energy of the particle [in Joules]
-      69             :          @param galacticLongitude       galactic longitude [radians]
-      70             :          @param galacticLatitude        galactic latitude [radians]
-      71             :          @param weight                          relative weight for the specific particle
-      72             :         */
-      73             :         void addParticle(const int particleId, double energy, double galacticLongitude, double galacticLatitude, double weight = 1);
-      74             :         /** Adds a particle to the map container.
-      75             :          @param particleId                      id of the particle following the PDG numbering scheme
-      76             :          @param energy                          the energy of the particle [in Joules]
-      77             :          @param v                                       vector containing the arrival directions of a particle
-      78             :          @param weight                          relative weight for the specific particle
-      79             :         */
-      80             :         void addParticle(const int particleId, double energy, const Vector3d &v, double weight = 1);
-      81             : 
-      82             :         /** Get all particle ids in the map.
-      83             :          @returns Vector of all ids.
-      84             :          */
-      85             :         std::vector<int> getParticleIds();
-      86             : 
-      87             :         /** Get energies in map.
-      88             :          @param pid     id of the particle following the PDG numbering scheme
-      89             :          @returns Energies are returned in units of eV (unlike in other CRPropa modules) for performance reasons
-      90             :          */
-      91             :         std::vector<double> getEnergies(int pid);
-      92             : 
-      93             :         void applyLens(MagneticLens &lens);;
-      94             : 
-      95             :         /** Get random particles from map.
-      96             :          The arguments are the vectors where the information will be stored.
-      97             :          @param N                                       number of particles to be selected
-      98             :          @param particleId                      id of the particle following the PDG numbering scheme
-      99             :          @param energy                          energy of interest [in eV]
-     100             :          @param galacticLongitudes      longitude in the interval [-pi, pi] [in radians]
-     101             :          @param galacticLatitudes       latitude in the interval [-pi/2, pi/2] [in radians]
-     102             :          */
-     103             :         void getRandomParticles(size_t N, vector<int> &particleId,
-     104             :                 vector<double> &energy, vector<double> &galacticLongitudes,
-     105             :                 vector<double> &galacticLatitudes);
-     106             : 
-     107             :         /** Places a particle with given id and energy according to the  probability maps. 
-     108             :          @param pid                                     id of the particle following the PDG numbering scheme
-     109             :          @param energy                          energy of interest [in eV]
-     110             :          @param galacticLongitude       longitude in the interval [-pi, pi] [in radians]
-     111             :          @param galacticLatitude        latitude in the interval [-pi/2, pi/2] [in radians]
-     112             :          @returns Returns false if operation not possible; true otherwise.
-     113             :          */
-     114             :         bool placeOnMap(int pid, double energy, double &galacticLongitude, double &galacticLatitude);
-     115             : 
-     116             :         /** Force weight update prior to getting random particles. 
-     117             :          Only necessary when reusing pointer to maps after calculating weights.
-     118             :         */
-     119             :         void forceWeightUpdate();
-     120             : 
-     121             :         /** Get sum of weights of the maps.
-     122             :          @returns Sum of all weights.
-     123             :          */
-     124             :         double getSumOfWeights() {
-     125           0 :                 if (!_weightsUpToDate)
-     126           0 :                         _updateWeights();
-     127           0 :                 return _sumOfWeights;
-     128             :         }
-     129             : 
-     130             :         /** Get weight for a given particle and energy
-     131             :          @param pid                                     id of the particle following the PDG numbering scheme
-     132             :          @param energy                          energy of interest [in eV]
-     133             :          @returns Weight for the chosen particle and energy.
-     134             :          */
-     135           0 :         double getWeight(int pid, double energy) {
-     136           0 :                 if (!_weightsUpToDate)
-     137           0 :                         _updateWeights();
-     138           0 :                 return _weights_pidEnergy[pid][energy2Idx(energy)];
-     139             :         }
-     140             : };
-     141             : /** @}*/
-     142             : 
-     143             : } // namespace crpropa
-     144             : 
-     145             : #endif // CRPROPA_PARTICLEMAPSCONTAINER_HH
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticLens/Pixelization.h.func-sort-c.html b/doc/coverageReport/include/crpropa/magneticLens/Pixelization.h.func-sort-c.html deleted file mode 100644 index 728ad5e1e..000000000 --- a/doc/coverageReport/include/crpropa/magneticLens/Pixelization.h.func-sort-c.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticLens/Pixelization.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticLens - Pixelization.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:81844.4 %
Date:2024-04-08 14:58:22Functions:1333.3 %
-
- -
- - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa12Pixelization15getPixelsInConeEdddRSt6vectorIiSaIiEE0
_ZN7crpropa12PixelizationC2Ev0
_ZN7crpropa12PixelizationC2Eh10
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticLens/Pixelization.h.func.html b/doc/coverageReport/include/crpropa/magneticLens/Pixelization.h.func.html deleted file mode 100644 index cc5239816..000000000 --- a/doc/coverageReport/include/crpropa/magneticLens/Pixelization.h.func.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticLens/Pixelization.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticLens - Pixelization.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:81844.4 %
Date:2024-04-08 14:58:22Functions:1333.3 %
-
- -
- - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa12Pixelization15getPixelsInConeEdddRSt6vectorIiSaIiEE0
_ZN7crpropa12PixelizationC2Eh10
_ZN7crpropa12PixelizationC2Ev0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticLens/Pixelization.h.gcov.html b/doc/coverageReport/include/crpropa/magneticLens/Pixelization.h.gcov.html deleted file mode 100644 index 370ed122b..000000000 --- a/doc/coverageReport/include/crpropa/magneticLens/Pixelization.h.gcov.html +++ /dev/null @@ -1,217 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticLens/Pixelization.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticLens - Pixelization.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:81844.4 %
Date:2024-04-08 14:58:22Functions:1333.3 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : //----------------------------------------------------------------------
-       2             : // This file is part of PARSEC (http://physik.rwth-aachen.de/parsec)
-       3             : // a parametrized simulation engine for cosmic rays.
-       4             : //
-       5             : // Copyright (C) 2011  Martin Erdmann, Peter Schiffer, Tobias Winchen
-       6             : //                     RWTH Aachen University, Germany
-       7             : // Contact: winchen@physik.rwth-aachen.de
-       8             : //
-       9             : //  This program is free software: you can redistribute it and/or
-      10             : //  modify it under the terms of the GNU General Public License as
-      11             : //  published by the Free Software Foundation, either version 3 of
-      12             : //  the License, or (at your option) any later version.
-      13             : //
-      14             : //  This program is distributed in the hope that it will be useful,
-      15             : //  but WITHOUT ANY WARRANTY; without even the implied warranty of
-      16             : //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-      17             : //  GNU General Public License for more details.
-      18             : //
-      19             : //  You should have received a copy of the GNU General Public License
-      20             : //  along with this program. If not, see <http://www.gnu.org/licenses/>.
-      21             : //----------------------------------------------------------------------
-      22             : 
-      23             : 
-      24             : #ifndef PIXELIZATION_HH
-      25             : #define PIXELIZATION_HH
-      26             : 
-      27             : #include "healpix_base/healpix_base.h"
-      28             : #include <cmath>
-      29             : #include <stdint.h>
-      30             : 
-      31             : namespace crpropa
-      32             : {
-      33             : /**
-      34             :  * \addtogroup MagneticLenses
-      35             :  * @{
-      36             :  */
-      37             : 
-      38             : /// Helpers to makes work with Healpix smooth
-      39             : const uint8_t _nOrder_max = 13;
-      40             : const uint32_t _nPix[] =
-      41             : {
-      42             :                 48,
-      43             :                 192,
-      44             :                 768,
-      45             :                 3072,
-      46             :                 12288,
-      47             :                 49152,
-      48             :                 196608,
-      49             :                 786432,
-      50             :                 3145728,
-      51             :                 12582912,
-      52             :                 50331648,
-      53             :                 201326592,
-      54             :                 805306368
-      55             : };
-      56             : 
-      57             : /// Every communication with healpix is done through this class to avoid
-      58             : /// bugs with missmatching coordinates (and make python hooks easier)
-      59             : class Pixelization
-      60             : {
-      61             : public:
-      62           0 :         Pixelization()
-      63           0 :         {
-      64           0 :                 _healpix = new healpix::T_Healpix_Base<int>(6, healpix::RING);
-      65           0 :         }
-      66             : 
-      67             :         /// Constructor creating Pixelization with healpix order 6 (about
-      68             :         /// 50000 pixels)
-      69          10 :         Pixelization(uint8_t order)
-      70          10 :         {
-      71          10 :                 _healpix = new healpix::T_Healpix_Base<int>(order, healpix::RING);
-      72          10 :         }
-      73             : 
-      74             :         ~Pixelization()
-      75             :         {
-      76          10 :                 delete _healpix;
-      77          10 :         }
-      78             : 
-      79             :         /// Returns the number of the pixel which includes the direction (phi,theta)
-      80             :         /// phi in [-pi, pi], theta in [-pi/2, pi/2]
-      81             :         uint32_t direction2Pix(double longitude, double latitude) const;
-      82             : 
-      83             :         /// Returns the number of pixels of the pixelization
-      84             :         uint32_t nPix() const
-      85             :         {
-      86       86026 :                 return _healpix->Npix();
-      87             :         }
-      88             : 
-      89             :         /// Returns the number of pixels given by healpix order
-      90             :         static uint32_t nPix(uint8_t order);
-      91             : 
-      92             :         /// Returns the number of pixels of the pixelization
-      93             :         int getNumberOfPixels()
-      94             :         {
-      95    10317737 :                 return _healpix->Npix();
-      96             :         }
-      97             : 
-      98             :         /// Returns the order, a given pixel number corresponds to. 0 if no
-      99             :         /// match!
-     100             :         static uint8_t pix2Order(uint32_t pix);
-     101             : 
-     102             :         /// Gives the center of pixel i in longitude [rad] and latitude [rad]
-     103             :         void pix2Direction(uint32_t i, double &longitude, double &latitude) const;
-     104             : 
-     105             :         /// Calculate the angle [rad] between the vectors pointing to pixels i and j
-     106             :         double angularDistance(uint32_t i, uint32_t j) const;
-     107             : 
-     108             :         /// Returns the maximum possible pixelization order
-     109             :         uint8_t getMaxOrder() const
-     110             :         {
-     111             :                 return _nOrder_max;
-     112             :         }
-     113             : 
-     114             :   /// Returns healpix order
-     115             :   uint8_t getOrder() const
-     116             :   {
-     117           0 :     return _healpix->Order();
-     118             :   }
-     119             : 
-     120             :         void getRandomDirectionInPixel(uint32_t pixel, double &longitude, double &latitude);
-     121             : 
-     122           0 :         void getPixelsInCone(double longitude, double latitude,double radius, std::vector<int>& listpix)
-     123             :         {
-     124             :                 healpix::vec3 v;
-     125           0 :                 spherCo2Vec(longitude, latitude, v);
-     126             :                 healpix::pointing p;
-     127           0 :                 p.from_vec3(v);
-     128           0 :                 _healpix->query_disc(p, radius, listpix);
-     129           0 :         }
-     130             : 
-     131             : private:
-     132             :         void spherCo2Vec(double phi, double theta, healpix::vec3 &V) const;
-     133             :         void vec2SphereCo(double &phi , double &theta, const healpix::vec3 &V) const;
-     134             :         healpix::T_Healpix_Base<int> *_healpix;
-     135             :         static healpix::T_Healpix_Base<healpix::int64> _healpix_nest;
-     136             : };
-     137             : 
-     138             : 
-     139             : /** @}*/
-     140             : } // namespace
-     141             : #endif // PIXELIZATION_HH
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticLens/index-sort-f.html b/doc/coverageReport/include/crpropa/magneticLens/index-sort-f.html deleted file mode 100644 index 6f02276e0..000000000 --- a/doc/coverageReport/include/crpropa/magneticLens/index-sort-f.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticLens - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticLensHitTotalCoverage
Test:coverage.info.cleanedLines:307042.9 %
Date:2024-04-08 14:58:22Functions:61154.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Pixelization.h -
44.4%44.4%
-
44.4 %8 / 1833.3 %1 / 3
ParticleMapsContainer.h -
20.0%20.0%
-
20.0 %2 / 1050.0 %1 / 2
MagneticLens.h -
47.6%47.6%
-
47.6 %20 / 4266.7 %4 / 6
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticLens/index-sort-l.html b/doc/coverageReport/include/crpropa/magneticLens/index-sort-l.html deleted file mode 100644 index 053630cae..000000000 --- a/doc/coverageReport/include/crpropa/magneticLens/index-sort-l.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticLens - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticLensHitTotalCoverage
Test:coverage.info.cleanedLines:307042.9 %
Date:2024-04-08 14:58:22Functions:61154.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
ParticleMapsContainer.h -
20.0%20.0%
-
20.0 %2 / 1050.0 %1 / 2
Pixelization.h -
44.4%44.4%
-
44.4 %8 / 1833.3 %1 / 3
MagneticLens.h -
47.6%47.6%
-
47.6 %20 / 4266.7 %4 / 6
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/magneticLens/index.html b/doc/coverageReport/include/crpropa/magneticLens/index.html deleted file mode 100644 index 279e0695b..000000000 --- a/doc/coverageReport/include/crpropa/magneticLens/index.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/magneticLens - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/magneticLensHitTotalCoverage
Test:coverage.info.cleanedLines:307042.9 %
Date:2024-04-08 14:58:22Functions:61154.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
MagneticLens.h -
47.6%47.6%
-
47.6 %20 / 4266.7 %4 / 6
ParticleMapsContainer.h -
20.0%20.0%
-
20.0 %2 / 1050.0 %1 / 2
Pixelization.h -
44.4%44.4%
-
44.4 %8 / 1833.3 %1 / 3
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/massDistribution/Cordes.h.func-sort-c.html b/doc/coverageReport/include/crpropa/massDistribution/Cordes.h.func-sort-c.html deleted file mode 100644 index 2d2c7d39b..000000000 --- a/doc/coverageReport/include/crpropa/massDistribution/Cordes.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Cordes.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/massDistribution - Cordes.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/massDistribution/Cordes.h.func.html b/doc/coverageReport/include/crpropa/massDistribution/Cordes.h.func.html deleted file mode 100644 index 8ec13117b..000000000 --- a/doc/coverageReport/include/crpropa/massDistribution/Cordes.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Cordes.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/massDistribution - Cordes.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/massDistribution/Cordes.h.gcov.html b/doc/coverageReport/include/crpropa/massDistribution/Cordes.h.gcov.html deleted file mode 100644 index 0ec8b1bff..000000000 --- a/doc/coverageReport/include/crpropa/massDistribution/Cordes.h.gcov.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Cordes.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/massDistribution - Cordes.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_CORDES_H
-       2             : #define CRPROPA_CORDES_H
-       3             : 
-       4             : #include "crpropa/massDistribution/Density.h"
-       5             : 
-       6             : #include <cmath>
-       7             : #include <string>
-       8             : 
-       9             : namespace crpropa {
-      10             : /**
-      11             :         @class Cordes
-      12             :         @brief Cylindrical symetrical model of the density of ionised hydrogen (HII) of the Milky Way
-      13             :         Cordes et al., 1991, Nature 353,737
-      14             :         */
-      15           1 : class Cordes: public Density {
-      16             : private:
-      17             :         // DO NOT CHANGE model type!
-      18             :         bool isforHI = false;
-      19             :         bool isforHII = true;
-      20             :         bool isforH2 = false;
-      21             : 
-      22             : public:
-      23             :         /** @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
-      24             :          @return density in parts/m^3 */
-      25             :         double getDensity(const Vector3d &position) const;
-      26             :         /** @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
-      27             :          @return density of ionised hydrogen in parts/m^3, equal getDensity thus no other type is included for Cordes */
-      28             :         double getHIIDensity(const Vector3d &position) const;
-      29             :         /** @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
-      30             :          @return density of nucleons in parts/m^3, equal getDensity thus only HII is included for Cordes */
-      31             :         double getNucleonDensity(const Vector3d &position) const;
-      32             : 
-      33             :         /** @return activation status of HI */
-      34             :         bool getIsForHI();
-      35             :         /** @return activation status of HII */
-      36             :         bool getIsForHII();
-      37             :         /** @return activation status of H2 */
-      38             :         bool getIsForH2();
-      39             : 
-      40             :         std::string getDescription();
-      41             : };
-      42             : 
-      43             : }  // namespace crpropa
-      44             : 
-      45             : #endif  // CRPROPA_CORDES_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/massDistribution/Density.h.func-sort-c.html b/doc/coverageReport/include/crpropa/massDistribution/Density.h.func-sort-c.html deleted file mode 100644 index 61d743401..000000000 --- a/doc/coverageReport/include/crpropa/massDistribution/Density.h.func-sort-c.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Density.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/massDistribution - Density.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0210.0 %
Date:2024-04-08 14:58:22Functions:0110.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa7Density10getIsForH2Ev0
_ZN7crpropa7Density10getIsForHIEv0
_ZN7crpropa7Density11getIsForHIIEv0
_ZN7crpropa7Density14getDescriptionB5cxx11Ev0
_ZN7crpropa7DensityD0Ev0
_ZN7crpropa7DensityD2Ev0
_ZNK7crpropa7Density10getDensityERKNS_7Vector3IdEE0
_ZNK7crpropa7Density12getH2DensityERKNS_7Vector3IdEE0
_ZNK7crpropa7Density12getHIDensityERKNS_7Vector3IdEE0
_ZNK7crpropa7Density13getHIIDensityERKNS_7Vector3IdEE0
_ZNK7crpropa7Density17getNucleonDensityERKNS_7Vector3IdEE0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/massDistribution/Density.h.func.html b/doc/coverageReport/include/crpropa/massDistribution/Density.h.func.html deleted file mode 100644 index f9ed0dff3..000000000 --- a/doc/coverageReport/include/crpropa/massDistribution/Density.h.func.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Density.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/massDistribution - Density.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0210.0 %
Date:2024-04-08 14:58:22Functions:0110.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa7Density10getIsForH2Ev0
_ZN7crpropa7Density10getIsForHIEv0
_ZN7crpropa7Density11getIsForHIIEv0
_ZN7crpropa7Density14getDescriptionB5cxx11Ev0
_ZN7crpropa7DensityD0Ev0
_ZN7crpropa7DensityD2Ev0
_ZNK7crpropa7Density10getDensityERKNS_7Vector3IdEE0
_ZNK7crpropa7Density12getH2DensityERKNS_7Vector3IdEE0
_ZNK7crpropa7Density12getHIDensityERKNS_7Vector3IdEE0
_ZNK7crpropa7Density13getHIIDensityERKNS_7Vector3IdEE0
_ZNK7crpropa7Density17getNucleonDensityERKNS_7Vector3IdEE0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/massDistribution/Density.h.gcov.html b/doc/coverageReport/include/crpropa/massDistribution/Density.h.gcov.html deleted file mode 100644 index 5b9e5404b..000000000 --- a/doc/coverageReport/include/crpropa/massDistribution/Density.h.gcov.html +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Density.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/massDistribution - Density.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0210.0 %
Date:2024-04-08 14:58:22Functions:0110.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_DENSITY_H
-       2             : #define CRPROPA_DENSITY_H
-       3             : 
-       4             : #include "crpropa/Units.h"
-       5             : #include "crpropa/Vector3.h"
-       6             : #include "crpropa/Referenced.h"
-       7             : 
-       8             : namespace crpropa {
-       9             : 
-      10             : /**
-      11             :  @class Density
-      12             :  @brief Abstract base class for target densities
-      13             :  */
-      14           0 : class Density: public Referenced {
-      15             : public:
-      16           0 :         virtual ~Density() {
-      17           0 :         }
-      18             : 
-      19           0 :         virtual double getDensity(const Vector3d &position) const {  // sum of all densities
-      20           0 :                 return 0;
-      21             :         }
-      22             : 
-      23           0 :         virtual double getHIDensity(const Vector3d &position) const {
-      24           0 :                 return 0;
-      25             :         }
-      26             : 
-      27           0 :         virtual double getHIIDensity(const Vector3d &position) const {
-      28           0 :                 return 0;
-      29             :         }
-      30             : 
-      31           0 :         virtual double getH2Density(const Vector3d &position) const {
-      32           0 :                 return 0;
-      33             :         }
-      34             : 
-      35           0 :         virtual double getNucleonDensity(const Vector3d &position) const {  // sum of nucleons (H2 with factor 2)
-      36           0 :                 return 0;
-      37             :         }
-      38             : 
-      39           0 :         virtual bool getIsForHI() {
-      40           0 :                 return false;
-      41             :         }
-      42             : 
-      43           0 :         virtual bool getIsForHII() {
-      44           0 :                 return false;
-      45             :         }
-      46             : 
-      47           0 :         virtual bool getIsForH2() {
-      48           0 :                 return false;
-      49             :         }
-      50             : 
-      51           0 :         virtual std::string getDescription() {
-      52           0 :                 return "Abstract Density Module\n";
-      53             :         }
-      54             : };
-      55             : 
-      56             : }  // namespace crpropa
-      57             : 
-      58             : #endif  // CRPROPA_DENSITY_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/massDistribution/Ferriere.h.func-sort-c.html b/doc/coverageReport/include/crpropa/massDistribution/Ferriere.h.func-sort-c.html deleted file mode 100644 index 7bb1afb24..000000000 --- a/doc/coverageReport/include/crpropa/massDistribution/Ferriere.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Ferriere.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/massDistribution - Ferriere.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/massDistribution/Ferriere.h.func.html b/doc/coverageReport/include/crpropa/massDistribution/Ferriere.h.func.html deleted file mode 100644 index 9357468f5..000000000 --- a/doc/coverageReport/include/crpropa/massDistribution/Ferriere.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Ferriere.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/massDistribution - Ferriere.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/massDistribution/Ferriere.h.gcov.html b/doc/coverageReport/include/crpropa/massDistribution/Ferriere.h.gcov.html deleted file mode 100644 index f69801f4a..000000000 --- a/doc/coverageReport/include/crpropa/massDistribution/Ferriere.h.gcov.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Ferriere.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/massDistribution - Ferriere.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_FERRIERE_H
-       2             : #define CRPROPA_FERRIERE_H
-       3             : 
-       4             : #include "crpropa/massDistribution/Density.h"
-       5             : 
-       6             : #include <cmath>
-       7             : #include <string>
-       8             : 
-       9             : namespace crpropa {
-      10             : /**
-      11             :  @class Ferriere
-      12             :  @brief model of the distribution of hydrogen in the Milky Way
-      13             :   Here in model Ferriere 2007
-      14             :   seperated in 2 regions (inner, outer). The border is for R=3 kpc in galactocentric radius.
-      15             :   model is discribed in
-      16             : outer: ApJ, 497, 759
-      17             : inner:  arxiv:  astro-ph/0702532
-      18             : */
-      19           2 : class Ferriere: public Density {
-      20             : private:
-      21             :         // standard for all types of distribution
-      22             :         bool isforHI = true;
-      23             :         bool isforHII = true;
-      24             :         bool isforH2 = true;
-      25             :         double Rsun = 8.5 * kpc;  // distance sun-galactic center
-      26             : 
-      27             : public:
-      28             :         /** Coordinate transformation for the CentralMolecularZone region. Rotation arround z-axis such that X is the major axis and Y is the minor axis
-      29             :         @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
-      30             :         @return position in local coordinates for the CMZ region
-      31             :         */
-      32             :         Vector3d CMZTransformation(const Vector3d &position) const;
-      33             :         
-      34             :         /** Coordinate transformation for the galactic bulge disk region in galactic center. Rotation arround the x-axis, the y'-axis and the x''-axis. Difened with X along the major axis, Y along the minor axis and Z along the northern normal
-      35             :         @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
-      36             :         @return position in local coordinates for the GB disk region
-      37             :         */
-      38             :         Vector3d DiskTransformation(const Vector3d &position) const;
-      39             : 
-      40             :         /** @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
-      41             :          @return density in parts/m^3, only acitvated parts are summed up */
-      42             :         double getDensity(const Vector3d &position) const;
-      43             :         /** @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
-      44             :          @return density of atomic hydrogen in parts/m^3 */
-      45             :         double getHIDensity(const Vector3d &position) const;
-      46             :         /** @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
-      47             :          @return density of ionised hydrogen in parts/m^3 */
-      48             :         double getHIIDensity(const Vector3d &position) const;
-      49             :         /** @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
-      50             :          @return density of molecular hydrogen in parts/m^3 */
-      51             :         double getH2Density(const Vector3d &position) const;
-      52             :         /** @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
-      53             :          @return nucleon density in parts/m^3, only activated parts are summed up and H2 is weighted twice */
-      54             :         double getNucleonDensity(const Vector3d &position) const;
-      55             : 
-      56             :         /** changes activation status for atomic hydrogen */
-      57             :         void setIsForHI(bool HI);
-      58             :         /** changes activation status for ionised hydrogen */
-      59             :         void setIsForHII(bool HII);
-      60             :         /** changes activation status for molecular hydrogen */
-      61             :         void setIsForH2(bool H2);
-      62             : 
-      63             :         /** @return activation status for atomic hydrogen */
-      64             :         bool getIsForHI();
-      65             :         /** @return activation status for ionised hydrogen */
-      66             :         bool getIsForHII();
-      67             :         /** @return activation status for molecular hydrogen */
-      68             :         bool getIsForH2();
-      69             : 
-      70             :         std::string getDescription();
-      71             : };
-      72             : 
-      73             : }  // namespace crpropa
-      74             : 
-      75             : #endif  // CRPROPA_FERRIERE_H
-      76             : 
-      77             : 
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/massDistribution/Massdistribution.h.func-sort-c.html b/doc/coverageReport/include/crpropa/massDistribution/Massdistribution.h.func-sort-c.html deleted file mode 100644 index f746939ad..000000000 --- a/doc/coverageReport/include/crpropa/massDistribution/Massdistribution.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Massdistribution.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/massDistribution - Massdistribution.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:22100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/massDistribution/Massdistribution.h.func.html b/doc/coverageReport/include/crpropa/massDistribution/Massdistribution.h.func.html deleted file mode 100644 index af406a149..000000000 --- a/doc/coverageReport/include/crpropa/massDistribution/Massdistribution.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Massdistribution.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/massDistribution - Massdistribution.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:22100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/massDistribution/Massdistribution.h.gcov.html b/doc/coverageReport/include/crpropa/massDistribution/Massdistribution.h.gcov.html deleted file mode 100644 index a34abbae2..000000000 --- a/doc/coverageReport/include/crpropa/massDistribution/Massdistribution.h.gcov.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Massdistribution.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/massDistribution - Massdistribution.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:22100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_MASSDISTRIBUTION_H
-       2             : #define CRPROPA_MASSDISTRIBUTION_H
-       3             : 
-       4             : #include "crpropa/massDistribution/Density.h"
-       5             : #include "crpropa/Vector3.h"
-       6             : #include "crpropa/Grid.h"
-       7             : 
-       8             : #include "kiss/logger.h"
-       9             : 
-      10             : #include <vector>
-      11             : 
-      12             : namespace crpropa {
-      13             : 
-      14             : /**
-      15             :  @class DensityList
-      16             :  @brief Superposition of density models.
-      17             :  The addDensity function adds a new density to the list.
-      18             :  The getDensity function handles the activated types in loaded densities, whereas get(type)Density disregards the activation state.
-      19             : */
-      20           2 : class DensityList: public Density {
-      21             : private:
-      22             :         std::vector<ref_ptr<Density> > DensityList ;
-      23             : 
-      24             : public:
-      25             :         /** Add new density to list.
-      26             :          @param density density to add
-      27             :         */
-      28             :         void addDensity(ref_ptr<Density> density);
-      29             : 
-      30             :         /** Get density at a given position.
-      31             :          @param position position in Galactic coordinates with Earth at (-8.5 kpc, 0, 0)
-      32             :          @returns Density in particles/m^3, sum up densities from added densities 
-      33             :         */
-      34             :         double getDensity(const Vector3d &position) const;
-      35             :         /** Get HI density at a given position.
-      36             :          @param position position in Galactic coordinates with Earth at (-8.5 kpc, 0, 0)
-      37             :          @returns Density of HI at given position in particles/m^3, sum up all HI densities from added densities
-      38             :          */
-      39             :         double getHIDensity(const Vector3d &position) const;
-      40             :         /** Get HII density at a given position.
-      41             :          @param position position in Galactic coordinates with Earth at (-8.5 kpc, 0, 0)
-      42             :          @returns Density of HII at given position in particles/m^3, sum up all HII densities from added densities 
-      43             :          */
-      44             :         double getHIIDensity(const Vector3d &position) const;
-      45             :         /** Get H2 density at a given position.
-      46             :          @param position position in Galactic coordinates with Earth at (-8.5 kpc, 0, 0)
-      47             :          @returns Density of H2 at given position in particles/m^3, sum up all H2 densities from added densities 
-      48             :          */
-      49             :         double getH2Density(const Vector3d &position) const;
-      50             :         /** Get the density of nucleons.
-      51             :          This is the number of nucleons per volume, summed up all activated density and weight molecular hydrogyen twice
-      52             :          @param position position in Galactic coordinates with Earth at (-8.5 kpc, 0, 0)
-      53             :          @returns Density of nucleons at given position in particles/m^3, sum up all nucleon densities from added densities 
-      54             :          */
-      55             :         double getNucleonDensity(const Vector3d &position) const;
-      56             : 
-      57             :         std::string getDescription();
-      58             : };
-      59             : 
-      60             : /**
-      61             :  @class DensityGrid
-      62             :  @brief Wrapper to use a Grid1f for a density
-      63             : 
-      64             :  The DensityGrid uses a given grid for the chosen density type. More than one type can be chosen to follow the same distribution.
-      65             :  If no type is chosen a warning will be raised and all densities are 0.
-      66             : */
-      67           4 : class DensityGrid: public Density {
-      68             : private: 
-      69             :         ref_ptr<Grid1f> grid; //< Grid with data
-      70             :         bool isForHI, isForHII, isForH2; 
-      71             :         void checkAndWarn(); //< raise a warning if all density types are deactivated.
-      72             : 
-      73             : public:
-      74             :         DensityGrid(ref_ptr<Grid1f> grid, bool isForHI = false, bool isForHII = false, bool isForH2 = false);
-      75             :         
-      76             :         /** Get HI density at a given position.
-      77             :          @param position position in Galactic coordinates with Earth at (-8.5 kpc, 0, 0)
-      78             :          @returns Density of HI at given position in particles/m^3, sum up all HI densities from added densities
-      79             :          */
-      80             :         double getHIDensity(const Vector3d &position) const;
-      81             :         
-      82             :         /** Get HII density at a given position.
-      83             :          @param position position in Galactic coordinates with Earth at (-8.5 kpc, 0, 0)
-      84             :          @returns Density of HII at given position in particles/m^3, sum up all HII densities from added densities 
-      85             :          */
-      86             :         double getHIIDensity(const Vector3d &position) const;
-      87             :         
-      88             :         /** Get H2 density at a given position.
-      89             :          @param position position in Galactic coordinates with Earth at (-8.5 kpc, 0, 0)
-      90             :          @returns Density of H2 at given position in particles/m^3, sum up all H2 densities from added densities 
-      91             :          */
-      92             :         double getH2Density(const Vector3d &position) const;
-      93             : 
-      94             :         /** Get density at a given position.
-      95             :          @param position position in Galactic coordinates with Earth at (-8.5 kpc, 0, 0)
-      96             :          @returns Density in particles/m^3, sum up densities from added densities 
-      97             :         */
-      98             :         double getDensity(const Vector3d &position) const;
-      99             :         
-     100             :         /** Get the density of nucleons.
-     101             :          This is the number of nucleons per volume, summed up all activated density and weight molecular hydrogyen twice
-     102             :          @param position position in Galactic coordinates with Earth at (-8.5 kpc, 0, 0)
-     103             :          @returns Density of nucleons at given position in particles/m^3, sum up all nucleon densities from added densities 
-     104             :          */
-     105             :         double getNucleonDensity(const Vector3d &position) const;
-     106             : 
-     107             :         bool getIsForHI();
-     108             :         bool getIsForHII();
-     109             :         bool getIsForH2();
-     110             : 
-     111             :         /* set if the density is for HI type. 
-     112             :          @param b if True the density is used for HI
-     113             :         */
-     114             :         void setIsForHI(bool b);
-     115             : 
-     116             :         /* set if the density is for HII type. 
-     117             :          @param b if True the density is used for HII
-     118             :         */
-     119             :         void setIsForHII(bool b);
-     120             : 
-     121             :         /* set if the density is for H2 type. 
-     122             :          @param b if True the density is used for H2
-     123             :         */
-     124             :         void setIsForH2(bool b);
-     125             :         
-     126             :         /* Change the grid for the density
-     127             :          @param grid (Grid1f) new grid for the density. 
-     128             :         */
-     129             :         void setGrid(ref_ptr<Grid1f> grid);
-     130             : 
-     131             :         std::string getDescription();
-     132             : };
-     133             : 
-     134             : }  // namespace crpropa
-     135             : 
-     136             : #endif  // CRPROPA_MASSDISTRIBUTION_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/massDistribution/Nakanishi.h.func-sort-c.html b/doc/coverageReport/include/crpropa/massDistribution/Nakanishi.h.func-sort-c.html deleted file mode 100644 index 6bb472b29..000000000 --- a/doc/coverageReport/include/crpropa/massDistribution/Nakanishi.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Nakanishi.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/massDistribution - Nakanishi.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/massDistribution/Nakanishi.h.func.html b/doc/coverageReport/include/crpropa/massDistribution/Nakanishi.h.func.html deleted file mode 100644 index 4a26d7662..000000000 --- a/doc/coverageReport/include/crpropa/massDistribution/Nakanishi.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Nakanishi.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/massDistribution - Nakanishi.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/massDistribution/Nakanishi.h.gcov.html b/doc/coverageReport/include/crpropa/massDistribution/Nakanishi.h.gcov.html deleted file mode 100644 index b3dc30cd8..000000000 --- a/doc/coverageReport/include/crpropa/massDistribution/Nakanishi.h.gcov.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/massDistribution/Nakanishi.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/massDistribution - Nakanishi.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_NAKANISHI_H
-       2             : #define CRPROPA_NAKANISHI_H
-       3             : 
-       4             : #include "crpropa/massDistribution/Density.h"
-       5             : 
-       6             : #include <cmath>
-       7             : #include <string>
-       8             : 
-       9             : namespace crpropa {
-      10             : /**
-      11             :  @class Nakanishi
-      12             :  @brief Cylindrical symetrical model of the density distribution of the Milky Way for atomic (HI) and molecular (H2) hydrogen
-      13             :         Modell for HI arXiv:astro-ph/0304338
-      14             :         Modell for H2 arxiv:astro-ph/0610769
-      15             :         fit of the models given in arXiv:1607.07886
-      16             : */
-      17           1 : class Nakanishi: public Density {
-      18             : private:
-      19             :         bool isforHI = true;
-      20             :         bool isforHII = false;
-      21             :         bool isforH2 = true;
-      22             : 
-      23             : public:
-      24             :         /** @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
-      25             :          @returns density in parts/m^3, only activated parts are summed up */
-      26             :         double getDensity(const Vector3d &position) const;
-      27             :         /** @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
-      28             :          @returns density of atomic hydrogen in parts/m^3 */
-      29             :         double getHIDensity(const Vector3d &position) const;
-      30             :         /** @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
-      31             :          @returns density of molecular hydrogen in parts/m^3 */
-      32             :         double getH2Density(const Vector3d &position) const;
-      33             :         /** @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
-      34             :          @returns nucleon density in parts/m^3, only activated parts are summed up and H2 is weighted twice */
-      35             :         double getNucleonDensity(const Vector3d &position) const;
-      36             : 
-      37             :         /** the scale height over the galactic plane of atomic hydrogen is fitted by polynom of degree 3
-      38             :         @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
-      39             :         @returns scale height at given position */
-      40             :         double getHIScaleheight(const Vector3d &position)const;
-      41             :         /** the plane density is fittet by two exponential components with e^-R and e^-(R^2)
-      42             :         @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
-      43             :         @returns plane density in parts/m^3 */
-      44             :         double getHIPlanedensity(const Vector3d &position)const;
-      45             : 
-      46             :         /** the scale height over the galactic plane of molecular hydrogen is fitted by exponential function
-      47             :         @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
-      48             :         @returns scale height at given position */
-      49             :         double getH2Scaleheight(const Vector3d &position)const;
-      50             :         /** the plane density is fitted by two exponential components
-      51             :         @param position position in galactic coordinates with Earth at (-8.5kpc, 0, 0)
-      52             :         @returns plane density in parts/m^3 */
-      53             :         double getH2Planedensity(const Vector3d &position)const;
-      54             : 
-      55             :         /** changes activation status for atomic hydrogen */
-      56             :         void setIsForHI(bool HI);
-      57             :         /** changes activation status for molecular hydrogen */
-      58             :         void setIsForH2(bool H2);
-      59             : 
-      60             :         /** @returns activation status for atomic hydrogen */
-      61             :         bool getIsForHI();
-      62             :         /** @returns activation status for ionised hydrogen */
-      63             :         bool getIsForHII();
-      64             :         /** @returns activation status for molecular hydrogen */
-      65             :         bool getIsForH2();
-      66             :         std::string getDescription();
-      67             : };
-      68             : 
-      69             : }  // namespace crpropa
-      70             : 
-      71             : #endif  // CRPROPA_NAKANISHI_H
-      72             : 
-      73             : 
-      74             : 
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/massDistribution/index-sort-f.html b/doc/coverageReport/include/crpropa/massDistribution/index-sort-f.html deleted file mode 100644 index 3be7402d0..000000000 --- a/doc/coverageReport/include/crpropa/massDistribution/index-sort-f.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/massDistribution - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/massDistributionHitTotalCoverage
Test:coverage.info.cleanedLines:52619.2 %
Date:2024-04-08 14:58:22Functions:0110.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Density.h -
0.0%
-
0.0 %0 / 210.0 %0 / 11
Nakanishi.h -
100.0%
-
100.0 %1 / 1-0 / 0
Cordes.h -
100.0%
-
100.0 %1 / 1-0 / 0
Ferriere.h -
100.0%
-
100.0 %1 / 1-0 / 0
Massdistribution.h -
100.0%
-
100.0 %2 / 2-0 / 0
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/massDistribution/index-sort-l.html b/doc/coverageReport/include/crpropa/massDistribution/index-sort-l.html deleted file mode 100644 index 5bc81ca8e..000000000 --- a/doc/coverageReport/include/crpropa/massDistribution/index-sort-l.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/massDistribution - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/massDistributionHitTotalCoverage
Test:coverage.info.cleanedLines:52619.2 %
Date:2024-04-08 14:58:22Functions:0110.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Density.h -
0.0%
-
0.0 %0 / 210.0 %0 / 11
Nakanishi.h -
100.0%
-
100.0 %1 / 1-0 / 0
Cordes.h -
100.0%
-
100.0 %1 / 1-0 / 0
Ferriere.h -
100.0%
-
100.0 %1 / 1-0 / 0
Massdistribution.h -
100.0%
-
100.0 %2 / 2-0 / 0
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/massDistribution/index.html b/doc/coverageReport/include/crpropa/massDistribution/index.html deleted file mode 100644 index b39e47962..000000000 --- a/doc/coverageReport/include/crpropa/massDistribution/index.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/massDistribution - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/massDistributionHitTotalCoverage
Test:coverage.info.cleanedLines:52619.2 %
Date:2024-04-08 14:58:22Functions:0110.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Cordes.h -
100.0%
-
100.0 %1 / 1-0 / 0
Density.h -
0.0%
-
0.0 %0 / 210.0 %0 / 11
Ferriere.h -
100.0%
-
100.0 %1 / 1-0 / 0
Massdistribution.h -
100.0%
-
100.0 %2 / 2-0 / 0
Nakanishi.h -
100.0%
-
100.0 %1 / 1-0 / 0
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/Boundary.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/Boundary.h.func-sort-c.html deleted file mode 100644 index e449df2d8..000000000 --- a/doc/coverageReport/include/crpropa/module/Boundary.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/Boundary.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - Boundary.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:66100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/Boundary.h.func.html b/doc/coverageReport/include/crpropa/module/Boundary.h.func.html deleted file mode 100644 index 18325e255..000000000 --- a/doc/coverageReport/include/crpropa/module/Boundary.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/Boundary.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - Boundary.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:66100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/Boundary.h.gcov.html b/doc/coverageReport/include/crpropa/module/Boundary.h.gcov.html deleted file mode 100644 index 2eb065210..000000000 --- a/doc/coverageReport/include/crpropa/module/Boundary.h.gcov.html +++ /dev/null @@ -1,283 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/Boundary.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - Boundary.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:66100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_BOUNDARY_H
-       2             : #define CRPROPA_BOUNDARY_H
-       3             : 
-       4             : #include "crpropa/Module.h"
-       5             : 
-       6             : namespace crpropa {
-       7             : /**
-       8             :  * \addtogroup Condition
-       9             :  * @{
-      10             :  */
-      11             : 
-      12             : /**
-      13             :  @class PeriodicBox
-      14             :  @brief Rectangular box with periodic boundaries.
-      15             : 
-      16             :  If a particle passes on of the sides it is placed at the opposite side and its initial (source) position changed accordingly.
-      17             :  This implements periodic boundaries, that keep the particle inside the box and instead move the source away periodically.
-      18             :  Particles can overshoot (be outside of the box during the step) since the step size is not limited by this module.
-      19             :  */
-      20           2 : class PeriodicBox: public Module {
-      21             : private:
-      22             :         Vector3d origin;
-      23             :         Vector3d size;
-      24             : 
-      25             : public:
-      26             :         /** Default constructor
-      27             :          */
-      28             :         PeriodicBox();
-      29             :         /** Constructor
-      30             :          @param origin  vector corresponding to the lower box corner
-      31             :          @param size    vector corresponding to the box sizes along each direction
-      32             :          */
-      33             :         PeriodicBox(Vector3d origin, Vector3d size);
-      34             :         void process(Candidate *candidate) const;
-      35             :         void setOrigin(Vector3d origin);
-      36             :         void setSize(Vector3d size);
-      37             :         std::string getDescription() const;
-      38             : };
-      39             : 
-      40             : /**
-      41             :  @class ReflectiveBox
-      42             :  @brief Rectangular box with reflective boundaries.
-      43             : 
-      44             :  If a particle passes on of the sides it is reflected back inside (position and velocity) and its initial position changed as if the particle had come from that side.
-      45             :  This implements periodic boundaries, that keep the particle inside the box and instead move the source away reflectively.
-      46             :  Particles can overshoot (be outside of the box during the step) since the step size is not limited by this module.
-      47             :  */
-      48           1 : class ReflectiveBox: public Module {
-      49             : private:
-      50             :         Vector3d origin;
-      51             :         Vector3d size;
-      52             : 
-      53             : public:
-      54             :         /** Default constructor
-      55             :          */
-      56             :         ReflectiveBox();
-      57             :         /** Constructor
-      58             :          @param origin  vector corresponding to the lower box corner
-      59             :          @param size    vector corresponding to the box sizes along each direction
-      60             :          */
-      61             :         ReflectiveBox(Vector3d origin, Vector3d size);
-      62             :         void process(Candidate *candidate) const;
-      63             :         void setOrigin(Vector3d origin);
-      64             :         void setSize(Vector3d size);
-      65             :         std::string getDescription() const;
-      66             : };
-      67             : 
-      68             : /**
-      69             :  @class CubicBoundary
-      70             :  @brief Flags a particle when exiting the cube.
-      71             : 
-      72             :  The particle is made inactive and flagged as "Rejected".
-      73             :  By default the module prevents overshooting the boundary by more than a margin of 0.1 kpc.
-      74             :  This corresponds to the default minimum step size of the propagation modules (PropagationCK and SimplePropagation).
-      75             :  */
-      76           4 : class CubicBoundary: public AbstractCondition {
-      77             : private:
-      78             :         Vector3d origin;
-      79             :         double size;
-      80             :         double margin;
-      81             :         bool limitStep;
-      82             : 
-      83             : public:
-      84             :         /** Default constructor
-      85             :          */
-      86             :         CubicBoundary();
-      87             :         /** Constructor
-      88             :          @param origin  vector corresponding to the lower box corner
-      89             :          @param size    vector corresponding to the box sizes along each direction
-      90             :          */
-      91             :         CubicBoundary(Vector3d origin, double size);
-      92             :         void process(Candidate *candidate) const;
-      93             :         void setOrigin(Vector3d origin);
-      94             :         void setSize(double size);
-      95             :         void setMargin(double margin);
-      96             :         void setLimitStep(bool limitStep);
-      97             :         std::string getDescription() const;
-      98             : };
-      99             : 
-     100             : /**
-     101             :  @class SphericalBoundary
-     102             :  @brief Flag a particle when leaving the sphere.
-     103             : 
-     104             :  The particle is made inactive and flagged as "Rejected".
-     105             :  By default the module prevents overshooting the boundary by more than a margin of 0.1 kpc.
-     106             :  This corresponds to the default minimum step size of the propagation modules (PropagationCK and SimplePropagation).
-     107             :  */
-     108           3 : class SphericalBoundary: public AbstractCondition {
-     109             : private:
-     110             :         Vector3d center;
-     111             :         double radius;
-     112             :         double margin;
-     113             :         bool limitStep;
-     114             : 
-     115             : public:
-     116             :         /** Default constructor
-     117             :          */
-     118             :         SphericalBoundary();
-     119             :         /** Constructor
-     120             :          @param center          vector containing the coordinates of the center of the sphere
-     121             :          @param radius          radius of the sphere
-     122             :          */
-     123             :         SphericalBoundary(Vector3d center, double radius);
-     124             :         void process(Candidate *candidate) const;
-     125             :         void setCenter(Vector3d center);
-     126             :         void setRadius(double size);
-     127             :         void setMargin(double margin);
-     128             :         void setLimitStep(bool limitStep);
-     129             :         std::string getDescription() const;
-     130             : };
-     131             : 
-     132             : /**
-     133             :  @class EllipsoidalBoundary
-     134             :  @brief Flags a particle when leaving the ellipsoid.
-     135             : 
-     136             :  This module flags particles when outside of the ellipsoid, defined by two focal points and a major axis (length).
-     137             :  The particle is made inactive and flagged as "Rejected".
-     138             :  By default the module prevents overshooting the boundary by more than a margin of 0.1 kpc.
-     139             :  This corresponds to the default minimum step size of the propagation modules (PropagationCK and SimplePropagation).
-     140             :  */
-     141           3 : class EllipsoidalBoundary: public AbstractCondition {
-     142             : private:
-     143             :         Vector3d focalPoint1;
-     144             :         Vector3d focalPoint2;
-     145             :         double majorAxis;
-     146             :         double margin;
-     147             :         bool limitStep;
-     148             : 
-     149             : public:
-     150             :         /** Default constructor
-     151             :          */
-     152             :         EllipsoidalBoundary();
-     153             :         /** Constructor
-     154             :          @param focalPoint1             one of the foci of the ellipsoid
-     155             :          @param focalPoint2             the other foci of the ellipsoid
-     156             :          @param majorAxis               length of the major axis of the ellipsoid
-     157             :          */
-     158             :         EllipsoidalBoundary(Vector3d focalPoint1, Vector3d focalPoint2,
-     159             :                         double majorAxis);
-     160             :         void process(Candidate *candidate) const;
-     161             :         void setFocalPoints(Vector3d focalPoint1, Vector3d focalPoint2);
-     162             :         void setMajorAxis(double size);
-     163             :         void setMargin(double margin);
-     164             :         void setLimitStep(bool limitStep);
-     165             :         std::string getDescription() const;
-     166             : };
-     167             : 
-     168             : 
-     169             : /**
-     170             :  @class CylindricalBoundary
-     171             :  @brief Flags a particle when leaving the cylinder whose axis is along the z-axis.
-     172             :  This module flags particles when outside of the cylinder, defined by a radius and a height.
-     173             :  The particle is made inactive and by default is flagged "OutOfBounds".
-     174             :  Optionally the module can ensure the candidate does not overshoot the boundary by more than a set margin.
-     175             :  */
-     176           3 : class CylindricalBoundary: public AbstractCondition {
-     177             : private:
-     178             :         Vector3d origin;
-     179             :         double height;
-     180             :         double radius;
-     181             :         double margin;
-     182             :         bool limitStep;
-     183             : 
-     184             : public:
-     185             :         /** Default constructor
-     186             :          */
-     187             :         CylindricalBoundary();
-     188             :         /** Constructor
-     189             :          @param origin  vector corresponding to the lower part of the cylinder axis
-     190             :          @param height  height of the cylinder
-     191             :          @param radius  radius of the cylinder
-     192             :          */
-     193             :         CylindricalBoundary(Vector3d origin, double height,
-     194             :                         double radius);
-     195             :         void process(Candidate *candidate) const;
-     196             :         void setOrigin(Vector3d origin);
-     197             :         void setHeight(double height);
-     198             :         void setRadius(double radius);
-     199             :         void setMargin(double margin);
-     200             :         void setLimitStep(bool limitStep);
-     201             :         std::string getDescription() const;
-     202             : };
-     203             : /** @}*/
-     204             : 
-     205             : } // namespace crpropa
-     206             : 
-     207             : #endif // CRPROPA_BOUNDARY_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/BreakCondition.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/BreakCondition.h.func-sort-c.html deleted file mode 100644 index 5eddfe368..000000000 --- a/doc/coverageReport/include/crpropa/module/BreakCondition.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/BreakCondition.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - BreakCondition.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:44100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/BreakCondition.h.func.html b/doc/coverageReport/include/crpropa/module/BreakCondition.h.func.html deleted file mode 100644 index bcf7545eb..000000000 --- a/doc/coverageReport/include/crpropa/module/BreakCondition.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/BreakCondition.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - BreakCondition.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:44100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/BreakCondition.h.gcov.html b/doc/coverageReport/include/crpropa/module/BreakCondition.h.gcov.html deleted file mode 100644 index 58e693670..000000000 --- a/doc/coverageReport/include/crpropa/module/BreakCondition.h.gcov.html +++ /dev/null @@ -1,221 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/BreakCondition.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - BreakCondition.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:44100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_BREAKCONDITION_H
-       2             : #define CRPROPA_BREAKCONDITION_H
-       3             : 
-       4             : #include "crpropa/Module.h"
-       5             : 
-       6             : namespace crpropa {
-       7             : /**
-       8             :  * \addtogroup Condition 
-       9             :  * @{
-      10             :  */
-      11             : 
-      12             : /**
-      13             :  @class MaximumTrajectoryLength
-      14             :  @brief Deactivates the candidate beyond a maximum trajectory length
-      15             : 
-      16             :  This module deactivates the candidate at a given maximum trajectory length.
-      17             :  In that case the property ("Deactivated", module::description) is set.
-      18             :  It also limits the candidates next step size to ensure the maximum trajectory length is not exceeded.
-      19             :  */
-      20             : class MaximumTrajectoryLength: public AbstractCondition {
-      21             :         double maxLength;
-      22             :         std::vector<Vector3d> observerPositions;
-      23             : public:
-      24             :         MaximumTrajectoryLength(double length = 0);
-      25             :         void setMaximumTrajectoryLength(double length);
-      26             :         double getMaximumTrajectoryLength() const;
-      27             :         void addObserverPosition(const Vector3d &position);
-      28             :         const std::vector<Vector3d>& getObserverPositions() const;
-      29             :         std::string getDescription() const;
-      30             :         void process(Candidate *candidate) const;
-      31             : };
-      32             : 
-      33             : /**
-      34             :  @class MinimumEnergy
-      35             :  @brief Deactivates the candidate below a minimum energy
-      36             : 
-      37             :  This module deactivates the candidate below a given minimum energy.
-      38             :  In that case the property ("Deactivated", module::description) is set.
-      39             :  */
-      40           1 : class MinimumEnergy: public AbstractCondition {
-      41             :         double minEnergy;
-      42             : public:
-      43             :         MinimumEnergy(double minEnergy = 0);
-      44             :         void setMinimumEnergy(double energy);
-      45             :         double getMinimumEnergy() const;
-      46             :         std::string getDescription() const;
-      47             :         void process(Candidate *candidate) const;
-      48             : };
-      49             : 
-      50             : 
-      51             : /**
-      52             :  @class MinimumRigidity
-      53             :  @brief Deactivates the candidate below a minimum rigidity
-      54             : 
-      55             :  This module deactivates the candidate below a given minimum rigidity (E/Z in EeV).
-      56             :  In that case the property ("Deactivated", module::description) is set.
-      57             :  */
-      58             : class MinimumRigidity: public AbstractCondition {
-      59             :         double minRigidity;
-      60             : public:
-      61             :         MinimumRigidity(double minRigidity = 0);
-      62             :         void setMinimumRigidity(double minRigidity);
-      63             :         double getMinimumRigidity() const;
-      64             :         std::string getDescription() const;
-      65             :         void process(Candidate *candidate) const;
-      66             : };
-      67             : 
-      68             : /**
-      69             :  @class MinimumRedshift
-      70             :  @brief Deactivates the candidate below a minimum redshift
-      71             : 
-      72             :  This module deactivates the candidate below a given minimum redshift.
-      73             :  In that case the property ("Deactivated", module::description) is set.
-      74             :  */
-      75           1 : class MinimumRedshift: public AbstractCondition {
-      76             :         double zmin;
-      77             : public:
-      78             :         MinimumRedshift(double zmin = 0);
-      79             :         void setMinimumRedshift(double z);
-      80             :         double getMinimumRedshift();
-      81             :         std::string getDescription() const;
-      82             :         void process(Candidate *candidate) const;
-      83             : };
-      84             : 
-      85             : /**
-      86             :  @class MinimumChargeNumber
-      87             :  @brief Deactivates the candidate below a minimum number
-      88             : 
-      89             :  This module deactivates the candidate below a given minimum charge number.
-      90             :  A minimum charge number of 26 deactivates all (anti-) isotopes which 
-      91             :  are ranked in the periodic table before iron (Fe). 
-      92             :  In that case the property ("Deactivated", module::description) is set.
-      93             :  */
-      94           1 : class MinimumChargeNumber: public AbstractCondition {
-      95             :         int minChargeNumber;
-      96             : public:
-      97             :         MinimumChargeNumber(int minChargeNumber = 0);
-      98             :         void setMinimumChargeNumber(int chargeNumber);
-      99             :         int getMinimumChargeNumber() const;
-     100             :         std::string getDescription() const;
-     101             :         void process(Candidate *candidate) const;
-     102             : };
-     103             : 
-     104             : /**
-     105             :  @class MinimumEnergyPerParticleId
-     106             :  @brief Deactivates the candidate below a minimum energy for specific particle Ids.
-     107             : 
-     108             :  This module deactivates the candidate below a given minimum energy for specific particle types.
-     109             :  In that case the property ("Deactivated", module::description) is set.
-     110             :  All particles whose minimum energy is not specified follow the more general minEnergyOthers condition.
-     111             :  */
-     112             : class MinimumEnergyPerParticleId: public AbstractCondition {
-     113             :         std::vector<double> minEnergies;
-     114             :         std::vector<int> particleIds;
-     115             :         double minEnergyOthers;
-     116             : public:
-     117             :         MinimumEnergyPerParticleId(double minEnergyOthers = 0);
-     118             :         void setMinimumEnergyOthers(double energy);
-     119             :         double getMinimumEnergyOthers() const;
-     120             :         void add(int id, double energy);
-     121             :         std::string getDescription() const;
-     122             :         void process(Candidate *candidate) const;
-     123             : };
-     124             : 
-     125             : 
-     126             : /**
-     127             :  @class DetectionLength
-     128             :  @brief Detects the candidate at a given trajectoryLength
-     129             :  
-     130             :  This break condition can be used for non-regular time observation of the particle density. See also ObserverTimeEvolution.
-     131             :  */
-     132           1 : class DetectionLength: public AbstractCondition {
-     133             :         double detLength;
-     134             : public:
-     135             :         DetectionLength(double length = 0);
-     136             :         void setDetectionLength(double length);
-     137             :         double getDetectionLength() const;
-     138             :         std::string getDescription() const;
-     139             :         void process(Candidate *candidate) const;
-     140             : };
-     141             : /** @}*/
-     142             : 
-     143             : } // namespace crpropa
-     144             : 
-     145             : #endif // CRPROPA_BREAKCONDITION_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/HDF5Output.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/HDF5Output.h.func-sort-c.html deleted file mode 100644 index 6be660edc..000000000 --- a/doc/coverageReport/include/crpropa/module/HDF5Output.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/HDF5Output.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - HDF5Output.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:010.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/HDF5Output.h.func.html b/doc/coverageReport/include/crpropa/module/HDF5Output.h.func.html deleted file mode 100644 index b0f0e622a..000000000 --- a/doc/coverageReport/include/crpropa/module/HDF5Output.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/HDF5Output.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - HDF5Output.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:010.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/HDF5Output.h.gcov.html b/doc/coverageReport/include/crpropa/module/HDF5Output.h.gcov.html deleted file mode 100644 index 1db93380e..000000000 --- a/doc/coverageReport/include/crpropa/module/HDF5Output.h.gcov.html +++ /dev/null @@ -1,217 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/HDF5Output.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - HDF5Output.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:010.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifdef CRPROPA_HAVE_HDF5
-       2             : 
-       3             : #ifndef CRPROPA_HDF5OUTPUT_H
-       4             : #define CRPROPA_HDF5OUTPUT_H
-       5             : 
-       6             : 
-       7             : #include "crpropa/module/Output.h"
-       8             : #include <stdint.h>
-       9             : #include <ctime>
-      10             : 
-      11             : #include <H5Ipublic.h>
-      12             : 
-      13             : namespace crpropa {
-      14             : 
-      15             : const size_t propertyBufferSize = 1024;
-      16             : 
-      17             : /**
-      18             :  * \addtogroup Output
-      19             :  * @{
-      20             :  */
-      21             : 
-      22             : /**
-      23             :  @class HDF5Output
-      24             :  @brief Output to HDF5 Format.
-      25             : The base class gives an overview of possible columns
-      26             : 
-      27             : HDF5 structure:
-      28             : ```
-      29             : HDF5 "FILENAME.h5" {
-      30             : GROUP "/" {
-      31             : DATASET "OUTPUTTYPE" {
-      32             :   DATATYPE  H5T_COMPOUND {
-      33             :   ...
-      34             :  }
-      35             :  DATASPACE  SIMPLE { ( 1 ) / ( H5S_UNLIMITED ) }
-      36             :  DATA {
-      37             :   ...
-      38             :  }
-      39             :   ATTRIBUTE "Version" {
-      40             :   DATATYPE  H5T_STRING {
-      41             :       STRSIZE 100;
-      42             :       STRPAD H5T_STR_NULLTERM;
-      43             :       CSET H5T_CSET_ASCII;
-      44             :       CTYPE H5T_C_S1;
-      45             :       }
-      46             :   DATASPACE  SCALAR
-      47             :   DATA { (0): "VERSION" }
-      48             :  }
-      49             : } } }
-      50             : ```
-      51             : 
-      52             :  */
-      53             : class HDF5Output: public Output {
-      54             : 
-      55           0 :         typedef struct OutputRow {
-      56             :                 double D;
-      57             :                 double z;
-      58             :                 uint64_t SN;
-      59             :                 int32_t ID;
-      60             :                 double E;
-      61             :                 double X;
-      62             :                 double Y;
-      63             :                 double Z;
-      64             :                 double Px;
-      65             :                 double Py;
-      66             :                 double Pz;
-      67             :                 uint64_t SN0;
-      68             :                 int32_t ID0;
-      69             :                 double E0;
-      70             :                 double X0;
-      71             :                 double Y0;
-      72             :                 double Z0;
-      73             :                 double P0x;
-      74             :                 double P0y;
-      75             :                 double P0z;
-      76             :                 uint64_t SN1;
-      77             :                 int32_t ID1;
-      78             :                 double E1;
-      79             :                 double X1;
-      80             :                 double Y1;
-      81             :                 double Z1;
-      82             :                 double P1x;
-      83             :                 double P1y;
-      84             :                 double P1z;
-      85             :                 double weight;
-      86             :                 std::string tag;
-      87             :                 unsigned char propertyBuffer[propertyBufferSize];
-      88             :         } OutputRow;
-      89             : 
-      90             :         std::string filename;
-      91             : 
-      92             :         hid_t file, sid;
-      93             :         hid_t dset, dataspace;
-      94             :         mutable std::vector<OutputRow> buffer;
-      95             : 
-      96             :         time_t lastFlush;
-      97             :         unsigned int flushLimit;
-      98             :         unsigned int candidatesSinceFlush;
-      99             : public:
-     100             :         /** Default constructor.
-     101             :                 Does not run from scratch.
-     102             :             At least open() has to be called in addition.
-     103             :                 Units of energy and length are, by default, EeV and Mpc.
-     104             :                 This can be changed with setEnergyScale and setLengthScale.
-     105             :          */
-     106             :         HDF5Output();
-     107             :         /** Constructor with the default OutputType (everything).
-     108             :                 @param filename string containing name of output hdf5 file
-     109             :          */
-     110             :         HDF5Output(const std::string &filename);
-     111             :         /** Constructor
-     112             :                 @param outputtype       type of output: Trajectory1D, Trajectory3D, Event1D, Event3D, Everything
-     113             :                 @param filename string containing name of output hdf5 file
-     114             :          */
-     115             :         HDF5Output(const std::string &filename, OutputType outputtype);
-     116             :         ~HDF5Output();
-     117             : 
-     118             :         void process(Candidate *candidate) const;
-     119             :         herr_t insertStringAttribute(const std::string &key, const std::string &value);
-     120             :         herr_t insertDoubleAttribute(const std::string &key, const double &value);
-     121             :         std::string getDescription() const;
-     122             : 
-     123             :         /// Force flush after N events. In long running applications with scarse
-     124             :         /// output this can be set to 1 or 0 to avoid data corruption. In applications
-     125             :         /// with frequent output this should be set to a high number (default)
-     126             :         void setFlushLimit(unsigned int N);
-     127             : 
-     128             :         /** Create and prepare a file as HDF5-file.
-     129             :          */
-     130             :         void open(const std::string &filename);
-     131             :         void close();
-     132             :         void flush() const;
-     133             : 
-     134             : };
-     135             : /** @}*/
-     136             : 
-     137             : } // namespace crpropa
-     138             : 
-     139             : #endif // CRPROPA_HDF5OUTPUT_H
-     140             : 
-     141             : #endif // CRPROPA_HAVE_HDF5
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/NuclearDecay.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/NuclearDecay.h.func-sort-c.html deleted file mode 100644 index 7c09d8ac5..000000000 --- a/doc/coverageReport/include/crpropa/module/NuclearDecay.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/NuclearDecay.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - NuclearDecay.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/NuclearDecay.h.func.html b/doc/coverageReport/include/crpropa/module/NuclearDecay.h.func.html deleted file mode 100644 index ffb262df7..000000000 --- a/doc/coverageReport/include/crpropa/module/NuclearDecay.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/NuclearDecay.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - NuclearDecay.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/NuclearDecay.h.gcov.html b/doc/coverageReport/include/crpropa/module/NuclearDecay.h.gcov.html deleted file mode 100644 index 9bd7d125c..000000000 --- a/doc/coverageReport/include/crpropa/module/NuclearDecay.h.gcov.html +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/NuclearDecay.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - NuclearDecay.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_NUCLEARDECAY_H
-       2             : #define CRPROPA_NUCLEARDECAY_H
-       3             : 
-       4             : #include "crpropa/Module.h"
-       5             : 
-       6             : #include <vector>
-       7             : 
-       8             : namespace crpropa {
-       9             : /**
-      10             :  * \addtogroup EnergyLosses
-      11             :  * @{
-      12             :  */
-      13             : 
-      14             : /**
-      15             :  @class NuclearDecay
-      16             :  @brief Nuclear decay of unstable nuclei.
-      17             : 
-      18             :  This module simulates the nuclear decay of unstable nuclei using data from NuDat2.
-      19             :  All decay modes are considered: alpha, beta+- and gamma decay, as well as proton- and neutron dripping.
-      20             :  The resulting non-hadronic secondary particles (e+, e-, neutrinos, gamma) can optionally be created.
-      21             : 
-      22             :  For details on the preprocessing of the NuDat2 data refer to "CRPropa3-data/calc_decay.py".
-      23             :  */
-      24             : class NuclearDecay: public Module {
-      25             : private:
-      26             :         double limit;
-      27             :         bool haveElectrons;
-      28             :         bool havePhotons;
-      29             :         bool haveNeutrinos;
-      30        1800 :         struct DecayMode {
-      31             :                 int channel; // (#beta- #beta+ #alpha #proton #neutron)
-      32             :                 double rate; // decay rate in [1/m]
-      33             :                 std::vector<double> energy; // photon energies of ensuing gamma decays
-      34             :                 std::vector<double> intensity; // probabilities of ensuing gamma decays
-      35             :         };
-      36             :         std::vector<std::vector<DecayMode> > decayTable; // decayTable[Z * 31 + N] = vector<DecayMode>
-      37             :         std::string interactionTag = "ND";
-      38             : 
-      39             : public:
-      40             :         /** Constructor.
-      41             :          @param electrons               if true, add secondary photons as candidates
-      42             :          @param photons                 if true, add secondary photons as candidates
-      43             :          @param neutrinos               if true, add secondary neutrinos as candidates
-      44             :          @param limit                   step size limit as fraction of mean free path
-      45             :          */
-      46             :         NuclearDecay(bool electrons = false, bool photons = false, bool neutrinos = false, double limit = 0.1);
-      47             : 
-      48             :         /** Limit the propagation step to a fraction of the mean free path
-      49             :          * @param limit fraction of the mean free path
-      50             :          */
-      51             :         void setLimit(double limit);
-      52             : 
-      53             :         // decide if secondary electrons are added to the simulation    
-      54             :         void setHaveElectrons(bool b);
-      55             : 
-      56             :         // decide if secondary photons are added to the simulation      
-      57             :         void setHavePhotons(bool b);
-      58             : 
-      59             :         // decide if secondary neutrinos are added to the simulation    
-      60             :         void setHaveNeutrinos(bool b);
-      61             : 
-      62             :         /** set a custom interaction tag to trace back this interaction
-      63             :          * @param tag string that will be added to the candidate and output
-      64             :          */
-      65             :         void setInteractionTag(std::string tag);
-      66             :         std::string getInteractionTag() const;
-      67             : 
-      68             :         void process(Candidate *candidate) const;
-      69             :         void performInteraction(Candidate *candidate, int channel) const;
-      70             :         void gammaEmission(Candidate *candidate, int channel) const;
-      71             :         void betaDecay(Candidate *candidate, bool isBetaPlus) const;
-      72             :         void nucleonEmission(Candidate *candidate, int dA, int dZ) const;
-      73             : 
-      74             :         /**
-      75             :          Return the mean free path.
-      76             :          This is not used in the simulation.
-      77             :          @param id      PDG particle id
-      78             :          @param gamma   Lorentz factor of particle
-      79             :          @returns The mean free path [in meters]
-      80             :          */
-      81             :         double meanFreePath(int id, double gamma);
-      82             : };
-      83             : /** @}*/
-      84             : 
-      85             : } // namespace crpropa
-      86             : 
-      87             : #endif // CRPROPA_NUCLEARDECAY_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/Observer.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/Observer.h.func-sort-c.html deleted file mode 100644 index 9075a3567..000000000 --- a/doc/coverageReport/include/crpropa/module/Observer.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/Observer.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - Observer.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:3837.5 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/Observer.h.func.html b/doc/coverageReport/include/crpropa/module/Observer.h.func.html deleted file mode 100644 index 9f9969a72..000000000 --- a/doc/coverageReport/include/crpropa/module/Observer.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/Observer.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - Observer.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:3837.5 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/Observer.h.gcov.html b/doc/coverageReport/include/crpropa/module/Observer.h.gcov.html deleted file mode 100644 index 216df472e..000000000 --- a/doc/coverageReport/include/crpropa/module/Observer.h.gcov.html +++ /dev/null @@ -1,351 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/Observer.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - Observer.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:3837.5 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_OBSERVER_H
-       2             : #define CRPROPA_OBSERVER_H
-       3             : 
-       4             : #include <fstream>
-       5             : #include <limits>
-       6             : #include <string>
-       7             : #include <vector>
-       8             : 
-       9             : #include "../Candidate.h"
-      10             : #include "../Module.h"
-      11             : #include "../Referenced.h"
-      12             : #include "../Vector3.h"
-      13             : #include "../Geometry.h"
-      14             : 
-      15             : namespace crpropa {
-      16             : 
-      17             : enum DetectionState {
-      18             :         DETECTED, VETO, NOTHING
-      19             : };
-      20             : 
-      21             : /** \addtogroup Observer
-      22             :  * @{
-      23             :  */
-      24             : 
-      25             : 
-      26             : /**
-      27             :  @class ObserverFeature
-      28             :  @brief Abstract base class for features of observers
-      29             :  */
-      30           1 : class ObserverFeature: public Referenced {
-      31             : protected:
-      32             :         std::string description;
-      33             : public:
-      34             :         virtual DetectionState checkDetection(Candidate *candidate) const;
-      35             :         virtual void onDetection(Candidate *candidate) const;
-      36             :         virtual std::string getDescription() const;
-      37             : };
-      38             : 
-      39             : 
-      40             : /**
-      41             :  @class Observer
-      42             :  @brief General particle observer
-      43             :  */
-      44             : class Observer: public Module {
-      45             :         std::string flagKey;
-      46             :         std::string flagValue;
-      47             : private:
-      48             :         std::vector<ref_ptr<ObserverFeature> > features;
-      49             :         ref_ptr<Module> detectionAction;
-      50             :         bool clone;
-      51             :         bool makeInactive;
-      52             : public:
-      53             :         /** Default observer constructor
-      54             :          */
-      55             :         Observer();
-      56             :         /** Add a feature to the observer
-      57             :          @param feature         observer feature to be added to the Observer object
-      58             :          */
-      59             :         void add(ObserverFeature *feature);
-      60             :         /** Perform some specific actions upon detection of candidate
-      61             :          @param action          module that performs a given action when candidate is detected
-      62             :          @param clone           if true, clone candidate
-      63             :          */
-      64             :         void onDetection(Module *action, bool clone = false);
-      65             :         void process(Candidate *candidate) const;
-      66             :         std::string getDescription() const;
-      67             :         void setFlag(std::string key, std::string value);
-      68             :         /** Determine whether candidate should be deactivated on detection
-      69             :          @param deactivate      if true, deactivate detected particles; if false, continue tracking them
-      70             :          */
-      71             :         void setDeactivateOnDetection(bool deactivate);
-      72             : };
-      73             : 
-      74             : 
-      75             : /**
-      76             :  @class ObserverDetectAll
-      77             :  @brief Detects all particles
-      78             :  */
-      79           2 : class ObserverDetectAll: public ObserverFeature {
-      80             : public:
-      81             :         DetectionState checkDetection(Candidate *candidate) const;
-      82             :         std::string getDescription() const;
-      83             : };
-      84             : 
-      85             : 
-      86             : /**
-      87             :  @class ObserverSurface
-      88             :  @brief Detects particles crossing the boundaries of a defined surface (see, e.g., `Geometry` module)
-      89             :  */
-      90             : class ObserverSurface: public ObserverFeature {
-      91             : private:
-      92             :         ref_ptr<Surface> surface;
-      93             : public:
-      94             :         /** Constructor
-      95             :          @param surface         object with some specific geometric (see Geometry.h)
-      96             :         */
-      97             :         ObserverSurface(Surface* surface);
-      98             :         DetectionState checkDetection(Candidate *candidate) const;
-      99             :         std::string getDescription() const;
-     100             : };
-     101             : 
-     102             : 
-     103             : /**
-     104             :  @class ObserverTracking
-     105             :  @brief Tracks particles inside a sphere
-     106             :  */
-     107             : class ObserverTracking: public ObserverFeature {
-     108             : private:
-     109             :         Vector3d center;
-     110             :         double radius;
-     111             :     double stepSize;
-     112             : public:
-     113             :         /** Constructor
-     114             :          @param center          vector containing the coordinates of the center of the sphere
-     115             :          @param radius          radius of the sphere
-     116             :          @param stepSize        observer will keep track of particles at every step with this size
-     117             :         */
-     118             :         ObserverTracking(Vector3d center, double radius, double stepSize = 0);
-     119             :         DetectionState checkDetection(Candidate *candidate) const;
-     120             :         std::string getDescription() const;
-     121             : };
-     122             : 
-     123             : 
-     124             : /**
-     125             :  @class Observer1D
-     126             :  @brief Detects particles when reaching x = 0
-     127             : 
-     128             :  This module detects particles when reaching x = 0 and also limits the next step size to prevent candidates from overshooting.
-     129             :  */
-     130           3 : class Observer1D: public ObserverFeature {
-     131             : public:
-     132             :         DetectionState checkDetection(Candidate *candidate) const;
-     133             :         std::string getDescription() const;
-     134             : };
-     135             : 
-     136             : 
-     137             : /**
-     138             :  @class ObserverRedshiftWindow
-     139             :  @brief Detects particles in a given redshift window
-     140             : 
-     141             :  When added to an observer, this feature generalizes it to four dimensions.
-     142             :  The fourth dimension is the redshift, a proxy for time. This is particularly
-     143             :  useful in "4D" studies, including either time-dependence (e.g. flaring objects),
-     144             :  or in 3D studies including cosmological evolution.
-     145             :  Note that redshifts should be assigned to sources when using this feature.
-     146             :  This can be done with: SourceRedshift, SourceRedshift1D, SourceUniformRedshift,
-     147             :  and SourceRedshiftEvolution.
-     148             :  */
-     149             : class ObserverRedshiftWindow: public ObserverFeature {
-     150             : private:
-     151             :         double zmin, zmax;
-     152             : public:
-     153             :         /** Constructor
-     154             :          @param zmin    lower bound of redshift interval
-     155             :          @param zmax    upper bound of redshift interval
-     156             :          */
-     157             :         ObserverRedshiftWindow(double zmin = 0, double zmax = 0.1);
-     158             :         DetectionState checkDetection(Candidate *candidate) const;
-     159             :         std::string getDescription() const;
-     160             : };
-     161             : 
-     162             : 
-     163             : /**
-     164             :  @class ObserverInactiveVeto
-     165             :  @brief Veto for inactive candidates
-     166             :  */
-     167           0 : class ObserverInactiveVeto: public ObserverFeature {
-     168             : public:
-     169             :         DetectionState checkDetection(Candidate *candidate) const;
-     170             :         std::string getDescription() const;
-     171             : };
-     172             : 
-     173             : 
-     174             : /**
-     175             :  @class ObserverNucleusVeto
-     176             :  @brief Veto for nuclei (including protons and neutrons)
-     177             :  */
-     178           0 : class ObserverNucleusVeto: public ObserverFeature {
-     179             : public:
-     180             :         DetectionState checkDetection(Candidate *candidate) const;
-     181             :         std::string getDescription() const;
-     182             : };
-     183             : 
-     184             : 
-     185             : /**
-     186             :  @class ObserverNeutrinoVeto
-     187             :  @brief Veto for neutrinos
-     188             :  */
-     189           0 : class ObserverNeutrinoVeto: public ObserverFeature {
-     190             : public:
-     191             :         DetectionState checkDetection(Candidate *candidate) const;
-     192             :         std::string getDescription() const;
-     193             : };
-     194             : 
-     195             : 
-     196             : /**
-     197             :  @class ObserverPhotonVeto
-     198             :  @brief Veto for photons
-     199             :  */
-     200           0 : class ObserverPhotonVeto: public ObserverFeature {
-     201             : public:
-     202             :         DetectionState checkDetection(Candidate *candidate) const;
-     203             :         std::string getDescription() const;
-     204             : };
-     205             : 
-     206             : 
-     207             : /**
-     208             :  @class ObserverElectronVeto
-     209             :  @brief Veto for electrons and positrons
-     210             :  */
-     211           0 : class ObserverElectronVeto: public ObserverFeature {
-     212             : public:
-     213             :         DetectionState checkDetection(Candidate *candidate) const;
-     214             :         std::string getDescription() const;
-     215             : };
-     216             : 
-     217             : 
-     218             : /**
-     219             :  @class ObserverParticleIdVeto
-     220             :  @brief Custom veto for user-defined particle types
-     221             :  Vetoes for more than one type of particle can be added by calling this
-     222             :  feature multiple times.
-     223             :  */
-     224             : class ObserverParticleIdVeto: public ObserverFeature {
-     225             : private:
-     226             :         int vetoParticleId;
-     227             : public:
-     228             :         /** Constructor
-     229             :          @param id              id of the particle following the PDG numbering scheme
-     230             :          */
-     231             :         ObserverParticleIdVeto(int id);
-     232             :         DetectionState checkDetection(Candidate *candidate) const;
-     233             :         std::string getDescription() const;
-     234             : };
-     235             : 
-     236             : 
-     237             : /**
-     238             :  @class ObserverTimeEvolution
-     239             :  @brief Observes the time evolution of the candidates (phase-space elements)
-     240             :  This observer is very useful if the time evolution of the particle density is needed. It detects all candidates in lin-spaced, log-spaced, or user-defined time intervals and limits the nextStep of candidates to prevent overshooting of detection intervals.
-     241             :  */
-     242             : class ObserverTimeEvolution: public ObserverFeature {
-     243             : private:
-     244             :         std::vector<double> detList;
-     245             : public:
-     246             :         /** Default constructor
-     247             :          */
-     248             :         ObserverTimeEvolution();
-     249             :         /** Constructor
-     250             :          @param min             minimum time
-     251             :          @param dist    time interval for detection
-     252             :          @param numb    number of time intervals
-     253             :          */
-     254             :         ObserverTimeEvolution(double min, double dist, double numb);
-     255             :         /** Constructor
-     256             :          @param min             minimum time
-     257             :          @param max         maximum time
-     258             :          @param numb    number of time intervals
-     259             :          @param log     log (input: true) or lin (input: false) scaling between min and max with numb steps
-     260             :          */
-     261             :         ObserverTimeEvolution(double min, double max, double numb, bool log);
-     262             :         // Add a new time step to the detection time list of the observer
-     263             :         void addTime(const double &position);
-     264             :         // Using log or lin spacing of times in the range between min and
-     265             :         // max for observing particles
-     266             :         void addTimeRange(double min, double max, double numb, bool log = false);
-     267             :         const std::vector<double>& getTimes() const;
-     268             :         DetectionState checkDetection(Candidate *candidate) const;
-     269             :         std::string getDescription() const;
-     270             : };
-     271             : /** @} */
-     272             : 
-     273             : }
-     274             : 
-     275             : #endif // CRPROPA_OBSERVER_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/OutputShell.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/OutputShell.h.func-sort-c.html deleted file mode 100644 index 743d7dacc..000000000 --- a/doc/coverageReport/include/crpropa/module/OutputShell.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/OutputShell.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - OutputShell.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:030.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/OutputShell.h.func.html b/doc/coverageReport/include/crpropa/module/OutputShell.h.func.html deleted file mode 100644 index 2db467b91..000000000 --- a/doc/coverageReport/include/crpropa/module/OutputShell.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/OutputShell.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - OutputShell.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:030.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/OutputShell.h.gcov.html b/doc/coverageReport/include/crpropa/module/OutputShell.h.gcov.html deleted file mode 100644 index c24dcbcbf..000000000 --- a/doc/coverageReport/include/crpropa/module/OutputShell.h.gcov.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/OutputShell.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - OutputShell.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:030.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_OUTPUTSHELL_H
-       2             : #define CRPROPA_OUTPUTSHELL_H
-       3             : 
-       4             : #include "crpropa/Module.h"
-       5             : #include "crpropa/AssocVector.h"
-       6             : #include "crpropa/Variant.h"
-       7             : 
-       8             : namespace crpropa {
-       9             : /**
-      10             :  * \addtogroup Output
-      11             :  * @{
-      12             :  */
-      13             : 
-      14             : /**
-      15             :  @class ShellOutput
-      16             :  @brief Show the trajectory in the shell.
-      17             :  */
-      18           0 : class ShellOutput: public Module {
-      19             : public:
-      20             :         void process(Candidate *candidate) const;
-      21             :         std::string getDescription() const;
-      22             : };
-      23             : 
-      24             : /**
-      25             :  @class ShellOutput1D
-      26             :  @brief Show the trajectory in the shell.
-      27             :  */
-      28           0 : class ShellOutput1D: public Module {
-      29             : public:
-      30             :         void process(Candidate *candidate) const;
-      31             :         std::string getDescription() const;
-      32             : };
-      33             : 
-      34             : /**
-      35             :  @class ShellPropertyOutput
-      36             :  @brief Show the candidate properties in the shell.
-      37             :  */
-      38           0 : class ShellPropertyOutput: public Module {
-      39             : public:
-      40             :         typedef Loki::AssocVector<std::string, Variant> PropertyMap;
-      41             :         void process(Candidate *candidate) const;
-      42             :         std::string getDescription() const;
-      43             : };
-      44             : /** @}*/
-      45             : 
-      46             : } // namespace cprpropa
-      47             : 
-      48             : #endif // CRPROPA_OUTPUTSHELL_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/PhotoDisintegration.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/PhotoDisintegration.h.func-sort-c.html deleted file mode 100644 index 182218a99..000000000 --- a/doc/coverageReport/include/crpropa/module/PhotoDisintegration.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/PhotoDisintegration.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - PhotoDisintegration.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:22100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/PhotoDisintegration.h.func.html b/doc/coverageReport/include/crpropa/module/PhotoDisintegration.h.func.html deleted file mode 100644 index fa9ee8229..000000000 --- a/doc/coverageReport/include/crpropa/module/PhotoDisintegration.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/PhotoDisintegration.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - PhotoDisintegration.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:22100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/PhotoDisintegration.h.gcov.html b/doc/coverageReport/include/crpropa/module/PhotoDisintegration.h.gcov.html deleted file mode 100644 index 04ff87a36..000000000 --- a/doc/coverageReport/include/crpropa/module/PhotoDisintegration.h.gcov.html +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/PhotoDisintegration.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - PhotoDisintegration.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:22100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_PHOTODISINTEGRATION_H
-       2             : #define CRPROPA_PHOTODISINTEGRATION_H
-       3             : 
-       4             : #include "crpropa/Module.h"
-       5             : #include "crpropa/PhotonBackground.h"
-       6             : 
-       7             : #include <vector>
-       8             : #include <map>
-       9             : 
-      10             : namespace crpropa {
-      11             : /**
-      12             :  * \addtogroup EnergyLosses
-      13             :  * @{
-      14             :  */
-      15             :  
-      16             : /**
-      17             :  @class PhotoDisintegration
-      18             :  @brief Photodisintegration of nuclei by background photons.
-      19             :  */
-      20             : class PhotoDisintegration: public Module {
-      21             : private:
-      22             :         ref_ptr<PhotonField> photonField;
-      23             :         double limit; // fraction of mean free path for limiting the next step
-      24             :         bool havePhotons;
-      25             :         std::string interactionTag = "PD";
-      26             : 
-      27      203566 :         struct Branch {
-      28             :                 int channel; // number of emitted (n, p, H2, H3, He3, He4)
-      29             :                 std::vector<double> branchingRatio; // branching ratio as function of nucleus Lorentz factor
-      30             :         };
-      31             : 
-      32      858506 :         struct PhotonEmission {
-      33             :                 double energy; // energy of emitted photon [J]
-      34             :                 std::vector<double> emissionProbability; // emission probability as function of nucleus Lorentz factor
-      35             :         };
-      36             : 
-      37             :         std::vector<std::vector<double> > pdRate; // pdRate[Z * 31 + N] = total interaction rate
-      38             :         std::vector<std::vector<Branch> > pdBranch; // pdTable[Z * 31 + N] = branching ratios
-      39             :         mutable std::map<int, std::vector<PhotonEmission> > pdPhoton; // map of emitted photon energies and photon emission probabilities
-      40             : 
-      41             :         static const double lgmin; // minimum log10(Lorentz-factor)
-      42             :         static const double lgmax; // maximum log10(Lorentz-factor)
-      43             :         static const size_t nlg; // number of Lorentz-factor steps
-      44             : 
-      45             : public:
-      46             :         /** Constructor.
-      47             :          @param photonField             target photon field
-      48             :          @param havePhotons             if true, add secondary photons as candidates
-      49             :          @param limit                   step size limit as fraction of mean free path
-      50             :          */
-      51             :         PhotoDisintegration(ref_ptr<PhotonField> photonField, bool havePhotons = false, double limit = 0.1);
-      52             : 
-      53             :         // set the target photon field
-      54             :         void setPhotonField(ref_ptr<PhotonField> photonField);
-      55             : 
-      56             :         // decide if secondary photons are added to the simulation
-      57             :         void setHavePhotons(bool havePhotons);
-      58             : 
-      59             :         /** Limit the propagation step to a fraction of the mean free path
-      60             :          * @param limit fraction of the mean free path
-      61             :          */
-      62             :         void setLimit(double limit);
-      63             : 
-      64             :         /** set a custom interaction tag to trace back this interaction
-      65             :          * @param tag string that will be added to the candidate and output
-      66             :          */
-      67             :         void setInteractionTag(std::string tag);
-      68             :         std::string getInteractionTag() const;
-      69             : 
-      70             :         void initRate(std::string filename);
-      71             :         void initBranching(std::string filename);
-      72             :         void initPhotonEmission(std::string filename);
-      73             : 
-      74             :         void process(Candidate *candidate) const;
-      75             :         void performInteraction(Candidate *candidate, int channel) const;
-      76             : 
-      77             :         /**
-      78             :          Calculates the loss length E dx/dE in [m] physical distance.
-      79             :          This is not used in the simulation.
-      80             :          @param id              PDG particle id
-      81             :          @param gamma   Lorentz factor of particle
-      82             :          @param z               redshift
-      83             :          @returns E dx/dE [in meters]
-      84             :          */
-      85             :         double lossLength(int id, double gamma, double z = 0);
-      86             : };
-      87             : 
-      88             : /** @}*/
-      89             : } // namespace crpropa
-      90             : 
-      91             : #endif // CRPROPA_PHOTODISINTEGRATION_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/PropagationBP.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/PropagationBP.h.func-sort-c.html deleted file mode 100644 index b51198676..000000000 --- a/doc/coverageReport/include/crpropa/module/PropagationBP.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/PropagationBP.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - PropagationBP.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:22100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/PropagationBP.h.func.html b/doc/coverageReport/include/crpropa/module/PropagationBP.h.func.html deleted file mode 100644 index dbb675695..000000000 --- a/doc/coverageReport/include/crpropa/module/PropagationBP.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/PropagationBP.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - PropagationBP.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:22100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/PropagationBP.h.gcov.html b/doc/coverageReport/include/crpropa/module/PropagationBP.h.gcov.html deleted file mode 100644 index c1056913b..000000000 --- a/doc/coverageReport/include/crpropa/module/PropagationBP.h.gcov.html +++ /dev/null @@ -1,225 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/PropagationBP.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - PropagationBP.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:22100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_PROPAGATIONBP_H
-       2             : #define CRPROPA_PROPAGATIONBP_H
-       3             : 
-       4             : #include "crpropa/Module.h"
-       5             : #include "crpropa/Units.h"
-       6             : #include "crpropa/magneticField/MagneticField.h"
-       7             : #include "kiss/logger.h"
-       8             : 
-       9             : namespace crpropa {
-      10             : /**
-      11             :  * \addtogroup Propagation
-      12             :  * @{
-      13             :  */
-      14             : 
-      15             : /**
-      16             :  @class PropagationBP
-      17             :  @brief Propagation through magnetic fields using the Boris method.
-      18             : 
-      19             :  This module solves the equations of motion of a relativistic charged particle when propagating through a magnetic field.\n
-      20             :  It uses the Boris push integration method.\n
-      21             :  It can be used with a fixed step size or an adaptive version which supports the step size control.
-      22             :  The step size control tries to keep the relative error close to, but smaller than the designated tolerance.
-      23             :  Additionally a minimum and maximum size for the steps can be set.
-      24             :  For neutral particles a rectilinear propagation is applied and a next step of the maximum step size proposed.
-      25             :  */
-      26             : class PropagationBP: public Module {
-      27             : 
-      28             : public:
-      29          84 :         class Y {
-      30             :         public:
-      31             :                 Vector3d x, u; /*< phase-point: position and direction */
-      32             : 
-      33             :                 Y() {
-      34             :                 }
-      35             : 
-      36          37 :                 Y(const Vector3d &x, const Vector3d &u) :
-      37             :                                 x(x), u(u) {
-      38             :                 }
-      39             : 
-      40             :                 Y(double f) :
-      41             :                                 x(Vector3d(f, f, f)), u(Vector3d(f, f, f)) {
-      42             :                 }
-      43             : 
-      44             :                 Y operator *(double f) const {
-      45             :                         return Y(x * f, u * f);
-      46             :                 }
-      47             : 
-      48             :                 Y &operator +=(const Y &y) {
-      49             :                         x += y.x;
-      50             :                         u += y.u;
-      51             :                         return *this;
-      52             :                 }
-      53             :         };
-      54             : 
-      55             : private:
-      56             :         ref_ptr<MagneticField> field;
-      57             :         double tolerance; /** target relative error of the numerical integration */
-      58             :         double minStep; /** minimum step size of the propagation */
-      59             :         double maxStep; /** maximum step size of the propagation */
-      60             : 
-      61             : public:
-      62             :         /** Default constructor for the Boris push. It is constructed with a fixed step size.
-      63             :          * @param field
-      64             :          * @param fixedStep 
-      65             :          */
-      66             :         PropagationBP(ref_ptr<MagneticField> field = NULL, double fixedStep = 1. * kpc);
-      67             : 
-      68             :         /** Constructor for the adaptive Boris push.
-      69             :          * @param field
-      70             :          * @param tolerance      tolerance is criterion for step adjustment. Step adjustment takes place only if minStep < maxStep
-      71             :          * @param minStep          minStep/c_light is the minimum integration time step
-      72             :          * @param maxStep          maxStep/c_light is the maximum integration time step. 
-      73             :          */
-      74             :     PropagationBP(ref_ptr<MagneticField> field, double tolerance, double minStep, double maxStep);
-      75             : 
-      76             :         /** Propagates the particle. Is called once per iteration.
-      77             :          * @param candidate      The Candidate is a passive object, that holds the information about the state of the cosmic ray and the simulation itself. */
-      78             :         void process(Candidate *candidate) const;
-      79             : 
-      80             :         /** Calculates the new position and direction of the particle based on the solution of the Lorentz force
-      81             :          * @param pos   current position of the candidate
-      82             :          * @param dir   current direction of the candidate
-      83             :          * @param step  current step size of the candidate
-      84             :          * @param z             current redshift is needed to calculate the magnetic field
-      85             :          * @param q             current charge of the candidate
-      86             :          * @param m             current mass of the candidate
-      87             :          * @return        return the new calculated position and direction of the candidate 
-      88             :          */
-      89             :         Y dY(Vector3d  pos, Vector3d  dir, double step, double z, double q, double m) const;
-      90             : 
-      91             :         /** comparison of the position after one step with the position after two steps with step/2.
-      92             :          * @param x1    position after one step of size step
-      93             :          * @param x2    position after two steps of size step/2
-      94             :          * @param step  current step size
-      95             :          * @return        measurement of the error of the step 
-      96             :          */
-      97             :         double errorEstimation(const Vector3d x1, const Vector3d x2, double step) const;
-      98             : 
-      99             :         /** Get magnetic field vector at current candidate position
-     100             :          * @param pos   current position of the candidate
-     101             :          * @param z      current redshift is needed to calculate the magnetic field
-     102             :          * @return        magnetic field vector at the position pos 
-     103             :          */
-     104             :         Vector3d getFieldAtPosition(Vector3d pos, double z) const;
-     105             : 
-     106             :         /** Adapt step size if required and calculates the new position and direction of the particle with the usage of the function dY
-     107             :          * @param y              current position and direction of candidate
-     108             :          * @param out      position and direction of candidate after the step
-     109             :          * @param error  error for the current step
-     110             :          * @param h              current step size
-     111             :          * @param p              current particle state
-     112             :          * @param z              current red shift
-     113             :          * @param q              current charge of the candidate 
-     114             :          * @param m              current mass of the candidate
-     115             :          */
-     116             :         void tryStep(const Y &y, Y &out, Y &error, double h, ParticleState &p, double z, double q, double m) const;
-     117             : 
-     118             :         /** Set functions for the parameters of the class PropagationBP */
-     119             : 
-     120             :         /** Set a specific magnetic field
-     121             :          * @param field  specific magnetic field 
-     122             :          */
-     123             :         void setField(ref_ptr<MagneticField> field);
-     124             :         /** Set a specific tolerance for the step size adaption
-     125             :          * @param tolerance      tolerance is criterion for step adjustment. Step adjustment takes place only if minStep < maxStep. 
-     126             :          */
-     127             :         void setTolerance(double tolerance);
-     128             :         /** Set the minimum step for the Boris push
-     129             :          * @param minStep          minStep/c_light is the minimum integration time step 
-     130             :          */
-     131             :         void setMinimumStep(double minStep);
-     132             :         /** Set the maximum step for the Boris push
-     133             :          * @param maxStep          maxStep/c_light is the maximum integration time step 
-     134             :          */
-     135             :         void setMaximumStep(double maxStep);
-     136             : 
-     137             :         /** Get functions for the parameters of the class PropagationBP, similar to the set functions */
-     138             : 
-     139             :         ref_ptr<MagneticField> getField() const;
-     140             :         double getTolerance() const;
-     141             :         double getMinimumStep() const;
-     142             :         double getMaximumStep() const;
-     143             :         std::string getDescription() const;
-     144             : };
-     145             : /** @}*/
-     146             : 
-     147             : } // namespace crpropa
-     148             : 
-     149             : #endif // PROPAGATIONBP_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/PropagationCK.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/PropagationCK.h.func-sort-c.html deleted file mode 100644 index bd00cdf4d..000000000 --- a/doc/coverageReport/include/crpropa/module/PropagationCK.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/PropagationCK.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - PropagationCK.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:22100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/PropagationCK.h.func.html b/doc/coverageReport/include/crpropa/module/PropagationCK.h.func.html deleted file mode 100644 index 80cd4d8d7..000000000 --- a/doc/coverageReport/include/crpropa/module/PropagationCK.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/PropagationCK.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - PropagationCK.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:22100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/PropagationCK.h.gcov.html b/doc/coverageReport/include/crpropa/module/PropagationCK.h.gcov.html deleted file mode 100644 index 1703a86ae..000000000 --- a/doc/coverageReport/include/crpropa/module/PropagationCK.h.gcov.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/PropagationCK.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - PropagationCK.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:22100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_PROPAGATIONCK_H
-       2             : #define CRPROPA_PROPAGATIONCK_H
-       3             : 
-       4             : #include "crpropa/Module.h"
-       5             : #include "crpropa/Units.h"
-       6             : #include "crpropa/magneticField/MagneticField.h"
-       7             : #include "kiss/logger.h"
-       8             : 
-       9             : namespace crpropa {
-      10             : /**
-      11             :  * \addtogroup Propagation 
-      12             :  * @{
-      13             :  */
-      14             : 
-      15             : /**
-      16             :  @class PropagationCK
-      17             :  @brief Rectilinear propagation through magnetic fields using the Cash-Karp method.
-      18             : 
-      19             :  This module solves the equations of motion of a relativistic charged particle when propagating through a magnetic field.\n
-      20             :  It uses the Runge-Kutta integration method with Cash-Karp coefficients.\n
-      21             :  The step size control tries to keep the relative error close to, but smaller than the designated tolerance.
-      22             :  Additionally a minimum and maximum size for the steps can be set.
-      23             :  For neutral particles a rectilinear propagation is applied and a next step of the maximum step size proposed.
-      24             :  */
-      25             : class PropagationCK: public Module {
-      26             : public:
-      27         286 :         class Y {
-      28             :         public:
-      29             :                 Vector3d x, u; /*< phase-point: position and direction */
-      30             : 
-      31             :                 Y() {
-      32             :                 }
-      33             : 
-      34          34 :                 Y(const Vector3d &x, const Vector3d &u) :
-      35             :                                 x(x), u(u) {
-      36             :                 }
-      37             : 
-      38             :                 Y(double f) :
-      39             :                                 x(Vector3d(f, f, f)), u(Vector3d(f, f, f)) {
-      40             :                 }
-      41             : 
-      42             :                 Y operator *(double f) const {
-      43             :                         return Y(x * f, u * f);
-      44             :                 }
-      45             : 
-      46             :                 Y &operator +=(const Y &y) {
-      47             :                         x += y.x;
-      48             :                         u += y.u;
-      49             :                         return *this;
-      50             :                 }
-      51             :         };
-      52             : 
-      53             : private:
-      54             :         std::vector<double> a, b, bs; /*< Cash-Karp coefficients */
-      55             :         ref_ptr<MagneticField> field;
-      56             :         double tolerance; /*< target relative error of the numerical integration */
-      57             :         double minStep; /*< minimum step size of the propagation */
-      58             :         double maxStep; /*< maximum step size of the propagation */
-      59             : 
-      60             : public:
-      61             :         /** Constructor for the adaptive Kash Carp.
-      62             :          * @param field
-      63             :          * @param tolerance      tolerance is criterion for step adjustment. Step adjustment takes place only if minStep < maxStep
-      64             :          * @param minStep          minStep/c_light is the minimum integration time step
-      65             :          * @param maxStep          maxStep/c_light is the maximum integration time step. 
-      66             :          */
-      67             :     PropagationCK(ref_ptr<MagneticField> field = NULL, double tolerance = 1e-4,
-      68             :                         double minStep = (0.1 * kpc), double maxStep = (1 * Gpc));
-      69             : 
-      70             :         void process(Candidate *candidate) const;
-      71             : 
-      72             :         // derivative of phase point, dY/dt = d/dt(x, u) = (v, du/dt)
-      73             :         // du/dt = q*c^2/E * (u x B)
-      74             :         Y dYdt(const Y &y, ParticleState &p, double z) const;
-      75             : 
-      76             :         void tryStep(const Y &y, Y &out, Y &error, double t,
-      77             :                         ParticleState &p, double z) const;
-      78             : 
-      79             :         void setField(ref_ptr<MagneticField> field);
-      80             :         void setTolerance(double tolerance);
-      81             :         void setMinimumStep(double minStep);
-      82             :         void setMaximumStep(double maxStep);
-      83             : 
-      84             :          /** get functions for the parameters of the class PropagationCK, similar to the set functions */
-      85             :         ref_ptr<MagneticField> getField() const;
-      86             :         
-      87             :         /** get magnetic field vector at current candidate position
-      88             :          * @param pos   current position of the candidate
-      89             :          * @param z      current redshift is needed to calculate the magnetic field
-      90             :          * @return        magnetic field vector at the position pos */
-      91             :         Vector3d getFieldAtPosition(Vector3d pos, double z) const;
-      92             : 
-      93             :         double getTolerance() const;
-      94             :         double getMinimumStep() const;
-      95             :         double getMaximumStep() const;
-      96             :         std::string getDescription() const;
-      97             : };
-      98             : /** @}*/
-      99             : 
-     100             : } // namespace crpropa
-     101             : 
-     102             : #endif // CRPROPA_PROPAGATIONCK_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/Redshift.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/Redshift.h.func-sort-c.html deleted file mode 100644 index 3041fd90b..000000000 --- a/doc/coverageReport/include/crpropa/module/Redshift.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/Redshift.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - Redshift.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:1250.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/Redshift.h.func.html b/doc/coverageReport/include/crpropa/module/Redshift.h.func.html deleted file mode 100644 index b7380b3ff..000000000 --- a/doc/coverageReport/include/crpropa/module/Redshift.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/Redshift.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - Redshift.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:1250.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/Redshift.h.gcov.html b/doc/coverageReport/include/crpropa/module/Redshift.h.gcov.html deleted file mode 100644 index 9cbeaec26..000000000 --- a/doc/coverageReport/include/crpropa/module/Redshift.h.gcov.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/Redshift.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - Redshift.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:1250.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_REDSHIFT_H
-       2             : #define CRPROPA_REDSHIFT_H
-       3             : 
-       4             : #include "crpropa/Module.h"
-       5             : 
-       6             : namespace crpropa {
-       7             : /**
-       8             :  * \addtogroup EnergyLosses
-       9             :  * @{
-      10             :  */
-      11             : 
-      12             : /**
-      13             :  @class Redshift
-      14             :  @brief Updates redshift and applies adiabatic energy loss according to the traveled distance.
-      15             :  */
-      16           5 : class Redshift: public Module {
-      17             : public:
-      18             :         void process(Candidate *candidate) const;
-      19             :         std::string getDescription() const;
-      20             : };
-      21             : 
-      22             : /**
-      23             :  @class FutureRedshift
-      24             :  @brief Updates redshift and applies adiabatic energy loss according to the traveled distance. Extends to negative redshift values to allow for symmetric time windows around z=0.
-      25             :  */
-      26           0 : class FutureRedshift: public Module {
-      27             : public:
-      28             :         void process(Candidate *candidate) const;
-      29             :         std::string getDescription() const;
-      30             : };
-      31             : 
-      32             : /** @}*/
-      33             : } // namespace crpropa
-      34             : 
-      35             : #endif // CRPROPA_REDSHIFT_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/SimplePropagation.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/SimplePropagation.h.func-sort-c.html deleted file mode 100644 index 487472bfc..000000000 --- a/doc/coverageReport/include/crpropa/module/SimplePropagation.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/SimplePropagation.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - SimplePropagation.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/SimplePropagation.h.func.html b/doc/coverageReport/include/crpropa/module/SimplePropagation.h.func.html deleted file mode 100644 index 340e30412..000000000 --- a/doc/coverageReport/include/crpropa/module/SimplePropagation.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/SimplePropagation.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - SimplePropagation.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/SimplePropagation.h.gcov.html b/doc/coverageReport/include/crpropa/module/SimplePropagation.h.gcov.html deleted file mode 100644 index 5cd3cb7b6..000000000 --- a/doc/coverageReport/include/crpropa/module/SimplePropagation.h.gcov.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/SimplePropagation.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - SimplePropagation.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11100.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef SIMPLEPROPAGATION_H
-       2             : #define SIMPLEPROPAGATION_H
-       3             : 
-       4             : #include "crpropa/Module.h"
-       5             : #include "crpropa/Units.h"
-       6             : 
-       7             : namespace crpropa {
-       8             : /**
-       9             :  * \addtogroup Propagation 
-      10             :  * @{
-      11             :  */
-      12             : 
-      13             : /**
-      14             :  @class SimplePropagation
-      15             :  @brief Simple rectilinear propagation in absence of magnetic fields.
-      16             : 
-      17             :  This module implements rectilinear propagation.
-      18             :  The step size is guaranteed to be larger than minStep and smaller than maxStep.
-      19             :  It always proposes a next step size of maxStep.
-      20             :  */
-      21           1 : class SimplePropagation: public Module {
-      22             : private:
-      23             :         double minStep, maxStep;
-      24             : 
-      25             : public:
-      26             :         SimplePropagation(double minStep = (0.1 * kpc), double maxStep = (1 * Gpc));
-      27             :         void process(Candidate *candidate) const;
-      28             :         void setMinimumStep(double minStep);
-      29             :         void setMaximumStep(double maxStep);
-      30             :         double getMinimumStep() const;
-      31             :         double getMaximumStep() const;
-      32             :         std::string getDescription() const;
-      33             : };
-      34             : /** @}*/
-      35             : 
-      36             : } // namespace crpropa
-      37             : 
-      38             : #endif // SIMPLEPROPAGATION_H
-      39             : 
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/TextOutput.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/TextOutput.h.func-sort-c.html deleted file mode 100644 index a060bcffd..000000000 --- a/doc/coverageReport/include/crpropa/module/TextOutput.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/TextOutput.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - TextOutput.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:010.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/TextOutput.h.func.html b/doc/coverageReport/include/crpropa/module/TextOutput.h.func.html deleted file mode 100644 index 52ca0025f..000000000 --- a/doc/coverageReport/include/crpropa/module/TextOutput.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/TextOutput.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - TextOutput.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:010.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/TextOutput.h.gcov.html b/doc/coverageReport/include/crpropa/module/TextOutput.h.gcov.html deleted file mode 100644 index e9fc25846..000000000 --- a/doc/coverageReport/include/crpropa/module/TextOutput.h.gcov.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/TextOutput.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - TextOutput.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:010.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_TEXTOUTPUT_H
-       2             : #define CRPROPA_TEXTOUTPUT_H
-       3             : 
-       4             : #include "crpropa/module/Output.h"
-       5             : #include "crpropa/module/ParticleCollector.h"
-       6             : 
-       7             : #include <fstream>
-       8             : 
-       9             : namespace crpropa {
-      10             : /**
-      11             :  * \addtogroup Output
-      12             :  * @{
-      13             :  */
-      14             : 
-      15             : /**
-      16             :  @class TextOutput
-      17             :  @brief Configurable plain text output for particle information.
-      18             :  This type of output can also be used to generate a .tar.gz file if
-      19             :  the library zlib is available. For details see:
-      20             :         http://zlib.net/
-      21             :  */
-      22             : class TextOutput: public Output {
-      23             : protected:
-      24             :         std::ostream *out;
-      25             :         std::ofstream outfile;
-      26             :         std::string filename;
-      27             :         bool storeRandomSeeds;
-      28             :         
-      29             :         void printHeader() const;
-      30             : 
-      31             : public:
-      32             :         /** Default constructor
-      33             :          */
-      34             :         TextOutput();
-      35             :         /** Constructor
-      36             :          @param outputType      type of output: Trajectory1D, Trajectory3D, Event1D, Event3D, Everything
-      37             :          */
-      38             :         TextOutput(OutputType outputType);
-      39             :         /** Constructor
-      40             :          @param out                     output stream
-      41             :          */
-      42             :         TextOutput(std::ostream &out);
-      43             :         /** Constructor
-      44             :          @param out                     output stream
-      45             :          @param outputType      type of output: Trajectory1D, Trajectory3D, Event1D, Event3D, Everything
-      46             :          */
-      47             :         TextOutput(std::ostream &out, OutputType outputType);
-      48             :         /** Constructor with the default OutputType (everything).
-      49             :          @param filename        string containing name of output text file
-      50             :          */
-      51             :         TextOutput(const std::string &filename);
-      52             :         /** Constructor
-      53             :          @param filename        string containing name of output text file
-      54             :          @param outputType      type of output: Trajectory1D, Trajectory3D, Event1D, Event3D, Everything
-      55             :          */
-      56             :         TextOutput(const std::string &filename, OutputType outputType);
-      57             :         /** Destructor
-      58             :          */
-      59             :         ~TextOutput();
-      60             :         /** Whether to store the random seeds used in the simulation.
-      61             :          This enables reproducibility of each realisation of the simulation.
-      62             :          */
-      63           0 :         void enableRandomSeeds() {storeRandomSeeds = true;};
-      64             :         void close();
-      65             :         void gzip();
-      66             :         void process(Candidate *candidate) const;
-      67             :         /** Loads a file to a particle collector.
-      68             :          This is useful for analysis involving, e.g., magnetic lenses.
-      69             :          @param filename        string containing the name of the file to be loaded
-      70             :          @param collector       object of type ParticleCollector that will store the information
-      71             :          */
-      72             :         static void load(const std::string &filename, ParticleCollector *collector);
-      73             :         std::string getDescription() const;
-      74             : };
-      75             : /** @}*/
-      76             : 
-      77             : } // namespace crpropa
-      78             : 
-      79             : #endif // CRPROPA_TEXTOUTPUT_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/Tools.h.func-sort-c.html b/doc/coverageReport/include/crpropa/module/Tools.h.func-sort-c.html deleted file mode 100644 index 4ce957e1c..000000000 --- a/doc/coverageReport/include/crpropa/module/Tools.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/Tools.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - Tools.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:020.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/Tools.h.func.html b/doc/coverageReport/include/crpropa/module/Tools.h.func.html deleted file mode 100644 index d4f77327f..000000000 --- a/doc/coverageReport/include/crpropa/module/Tools.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/Tools.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - Tools.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:020.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/Tools.h.gcov.html b/doc/coverageReport/include/crpropa/module/Tools.h.gcov.html deleted file mode 100644 index ff73e05a6..000000000 --- a/doc/coverageReport/include/crpropa/module/Tools.h.gcov.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module/Tools.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/module - Tools.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:020.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef CRPROPA_MODULETOOLS_H
-       2             : #define CRPROPA_MODULETOOLS_H
-       3             : 
-       4             : #include "crpropa/Module.h"
-       5             : #include "crpropa/EmissionMap.h"
-       6             : 
-       7             : #include <vector>
-       8             : #include <set>
-       9             : 
-      10             : namespace crpropa {
-      11             : /**
-      12             :  * \addtogroup Tools
-      13             :  * @{
-      14             :  */
-      15             : 
-      16             : /**
-      17             :  @class PerformanceModule
-      18             :  @brief Module to monitor the simulation performance
-      19             : 
-      20             :  Add modules under investigation to this module instead of the ModuleList.
-      21             :  */
-      22           0 : class PerformanceModule: public Module {
-      23             : private:
-      24           0 :         struct _module_info {
-      25             :                 double time;
-      26             :                 ref_ptr<Module> module;
-      27             :         };
-      28             : 
-      29             :         mutable std::vector<_module_info> modules;
-      30             :         mutable size_t calls;
-      31             : 
-      32             : public:
-      33             :         ~PerformanceModule();
-      34             :         void add(Module* module);
-      35             :         void process(Candidate* candidate) const;
-      36             :         std::string getDescription() const;
-      37             : };
-      38             : 
-      39             : /**
-      40             :   @class ParticleFilter
-      41             :   @brief Reject Particles not listed in filter.
-      42             : */
-      43             : class ParticleFilter: public AbstractCondition {
-      44             :         std::set<int> ids;
-      45             : 
-      46             : public:
-      47             :         ParticleFilter();
-      48             :         ParticleFilter(const std::set<int> &ids);
-      49             :         void addId(int id);
-      50             :         void removeId(int remove);
-      51             :         std::set<int> &getIds();
-      52             : 
-      53             :         void process(Candidate* candidate) const;
-      54             :         std::string getDescription() const;
-      55             : };
-      56             : 
-      57             : 
-      58             : /**
-      59             :   @class EmissionMapFiller
-      60             :   @brief Fill EmissionMap with source particle state
-      61             : */
-      62             : class EmissionMapFiller: public Module {
-      63             :         ref_ptr<EmissionMap> emissionMap;
-      64             : public:
-      65             :         EmissionMapFiller(EmissionMap *emissionMap);
-      66             :         void setEmissionMap(EmissionMap *emissionMap);
-      67             :         void process(Candidate* candidate) const;
-      68             :         std::string getDescription() const;
-      69             : };
-      70             : 
-      71             : /** @}*/
-      72             : } // namespace crpropa
-      73             : 
-      74             : #endif // CRPROPA_MODULETOOLS_H
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/index-sort-f.html b/doc/coverageReport/include/crpropa/module/index-sort-f.html deleted file mode 100644 index 14233aa5e..000000000 --- a/doc/coverageReport/include/crpropa/module/index-sort-f.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/moduleHitTotalCoverage
Test:coverage.info.cleanedLines:223562.9 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
OutputShell.h -
0.0%
-
0.0 %0 / 3-0 / 0
TextOutput.h -
0.0%
-
0.0 %0 / 1-0 / 0
SimplePropagation.h -
100.0%
-
100.0 %1 / 1-0 / 0
BreakCondition.h -
100.0%
-
100.0 %4 / 4-0 / 0
Boundary.h -
100.0%
-
100.0 %6 / 6-0 / 0
PhotoDisintegration.h -
100.0%
-
100.0 %2 / 2-0 / 0
Tools.h -
0.0%
-
0.0 %0 / 2-0 / 0
PropagationCK.h -
100.0%
-
100.0 %2 / 2-0 / 0
PropagationBP.h -
100.0%
-
100.0 %2 / 2-0 / 0
HDF5Output.h -
0.0%
-
0.0 %0 / 1-0 / 0
Observer.h -
37.5%37.5%
-
37.5 %3 / 8-0 / 0
NuclearDecay.h -
100.0%
-
100.0 %1 / 1-0 / 0
Redshift.h -
50.0%50.0%
-
50.0 %1 / 2-0 / 0
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/index-sort-l.html b/doc/coverageReport/include/crpropa/module/index-sort-l.html deleted file mode 100644 index 5ff9027ea..000000000 --- a/doc/coverageReport/include/crpropa/module/index-sort-l.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/moduleHitTotalCoverage
Test:coverage.info.cleanedLines:223562.9 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
TextOutput.h -
0.0%
-
0.0 %0 / 1-0 / 0
HDF5Output.h -
0.0%
-
0.0 %0 / 1-0 / 0
Tools.h -
0.0%
-
0.0 %0 / 2-0 / 0
OutputShell.h -
0.0%
-
0.0 %0 / 3-0 / 0
Observer.h -
37.5%37.5%
-
37.5 %3 / 8-0 / 0
Redshift.h -
50.0%50.0%
-
50.0 %1 / 2-0 / 0
SimplePropagation.h -
100.0%
-
100.0 %1 / 1-0 / 0
NuclearDecay.h -
100.0%
-
100.0 %1 / 1-0 / 0
PhotoDisintegration.h -
100.0%
-
100.0 %2 / 2-0 / 0
PropagationCK.h -
100.0%
-
100.0 %2 / 2-0 / 0
PropagationBP.h -
100.0%
-
100.0 %2 / 2-0 / 0
BreakCondition.h -
100.0%
-
100.0 %4 / 4-0 / 0
Boundary.h -
100.0%
-
100.0 %6 / 6-0 / 0
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/include/crpropa/module/index.html b/doc/coverageReport/include/crpropa/module/index.html deleted file mode 100644 index 5483b4fa7..000000000 --- a/doc/coverageReport/include/crpropa/module/index.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - include/crpropa/module - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - include/crpropa/moduleHitTotalCoverage
Test:coverage.info.cleanedLines:223562.9 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Boundary.h -
100.0%
-
100.0 %6 / 6-0 / 0
BreakCondition.h -
100.0%
-
100.0 %4 / 4-0 / 0
HDF5Output.h -
0.0%
-
0.0 %0 / 1-0 / 0
NuclearDecay.h -
100.0%
-
100.0 %1 / 1-0 / 0
Observer.h -
37.5%37.5%
-
37.5 %3 / 8-0 / 0
OutputShell.h -
0.0%
-
0.0 %0 / 3-0 / 0
PhotoDisintegration.h -
100.0%
-
100.0 %2 / 2-0 / 0
PropagationBP.h -
100.0%
-
100.0 %2 / 2-0 / 0
PropagationCK.h -
100.0%
-
100.0 %2 / 2-0 / 0
Redshift.h -
50.0%50.0%
-
50.0 %1 / 2-0 / 0
SimplePropagation.h -
100.0%
-
100.0 %1 / 1-0 / 0
TextOutput.h -
0.0%
-
0.0 %0 / 1-0 / 0
Tools.h -
0.0%
-
0.0 %0 / 2-0 / 0
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/index-sort-f.html b/doc/coverageReport/index-sort-f.html deleted file mode 100644 index 2f53c4197..000000000 --- a/doc/coverageReport/index-sort-f.html +++ /dev/null @@ -1,293 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top levelHitTotalCoverage
Test:coverage.info.cleanedLines:87351426261.2 %
Date:2024-04-08 14:58:22Functions:1124206954.3 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Directory Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
include/crpropa/massDistribution -
19.2%19.2%
-
19.2 %5 / 260.0 %0 / 11
libs/healpix_base/include/healpix_base -
19.1%19.1%
-
19.1 %33 / 1738.1 %5 / 62
libs/healpix_base -
14.1%14.1%
-
14.1 %112 / 7929.4 %10 / 106
libs/kiss/include/kiss -
57.9%57.9%
-
57.9 %11 / 1920.9 %14 / 67
src/magneticField -
18.2%18.2%
-
18.2 %166 / 91021.0 %29 / 138
libs/HepPID/src -
11.4%11.4%
-
11.4 %50 / 44022.9 %11 / 48
libs/kiss/src -
28.1%28.1%
-
28.1 %34 / 12139.1 %9 / 23
include/crpropa -
73.6%73.6%
-
73.6 %408 / 55446.4 %77 / 166
include/crpropa/magneticField/turbulentField -
72.9%72.9%
-
72.9 %43 / 5947.1 %8 / 17
src/magneticLens -
45.7%45.7%
-
45.7 %147 / 32251.2 %21 / 41
src/advectionField -
42.5%42.5%
-
42.5 %131 / 30852.4 %44 / 84
include/crpropa/magneticLens -
42.9%42.9%
-
42.9 %30 / 7054.5 %6 / 11
src/magneticField/turbulentField -
71.1%71.1%
-
71.1 %187 / 26357.9 %11 / 19
src -
50.3%50.3%
-
50.3 %1361 / 270758.5 %251 / 429
src/module -
63.4%63.4%
-
63.4 %2250 / 354759.0 %286 / 485
include/crpropa/magneticField -
89.3%89.3%
-
89.3 %50 / 5663.6 %7 / 11
src/massDistribution -
83.9%83.9%
-
83.9 %349 / 41690.8 %69 / 76
test -
97.9%97.9%
-
97.9 %3320 / 339196.7 %264 / 273
include/crpropa/module -
62.9%62.9%
-
62.9 %22 / 35-0 / 0
include/crpropa/advectionField -
100.0%
-
100.0 %5 / 5-0 / 0
/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy -
43.8%43.8%
-
43.8 %21 / 48100.0 %2 / 2
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/index-sort-l.html b/doc/coverageReport/index-sort-l.html deleted file mode 100644 index ae168257c..000000000 --- a/doc/coverageReport/index-sort-l.html +++ /dev/null @@ -1,293 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top levelHitTotalCoverage
Test:coverage.info.cleanedLines:87351426261.2 %
Date:2024-04-08 14:58:22Functions:1124206954.3 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Directory Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
libs/HepPID/src -
11.4%11.4%
-
11.4 %50 / 44022.9 %11 / 48
libs/healpix_base -
14.1%14.1%
-
14.1 %112 / 7929.4 %10 / 106
src/magneticField -
18.2%18.2%
-
18.2 %166 / 91021.0 %29 / 138
libs/healpix_base/include/healpix_base -
19.1%19.1%
-
19.1 %33 / 1738.1 %5 / 62
include/crpropa/massDistribution -
19.2%19.2%
-
19.2 %5 / 260.0 %0 / 11
libs/kiss/src -
28.1%28.1%
-
28.1 %34 / 12139.1 %9 / 23
src/advectionField -
42.5%42.5%
-
42.5 %131 / 30852.4 %44 / 84
include/crpropa/magneticLens -
42.9%42.9%
-
42.9 %30 / 7054.5 %6 / 11
/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy -
43.8%43.8%
-
43.8 %21 / 48100.0 %2 / 2
src/magneticLens -
45.7%45.7%
-
45.7 %147 / 32251.2 %21 / 41
src -
50.3%50.3%
-
50.3 %1361 / 270758.5 %251 / 429
libs/kiss/include/kiss -
57.9%57.9%
-
57.9 %11 / 1920.9 %14 / 67
include/crpropa/module -
62.9%62.9%
-
62.9 %22 / 35-0 / 0
src/module -
63.4%63.4%
-
63.4 %2250 / 354759.0 %286 / 485
src/magneticField/turbulentField -
71.1%71.1%
-
71.1 %187 / 26357.9 %11 / 19
include/crpropa/magneticField/turbulentField -
72.9%72.9%
-
72.9 %43 / 5947.1 %8 / 17
include/crpropa -
73.6%73.6%
-
73.6 %408 / 55446.4 %77 / 166
src/massDistribution -
83.9%83.9%
-
83.9 %349 / 41690.8 %69 / 76
include/crpropa/magneticField -
89.3%89.3%
-
89.3 %50 / 5663.6 %7 / 11
test -
97.9%97.9%
-
97.9 %3320 / 339196.7 %264 / 273
include/crpropa/advectionField -
100.0%
-
100.0 %5 / 5-0 / 0
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/index.html b/doc/coverageReport/index.html deleted file mode 100644 index 11a901d77..000000000 --- a/doc/coverageReport/index.html +++ /dev/null @@ -1,293 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top levelHitTotalCoverage
Test:coverage.info.cleanedLines:87351426261.2 %
Date:2024-04-08 14:58:22Functions:1124206954.3 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Directory Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
/home/runner/.local/lib/python3.10/site-packages/numpy/core/include/numpy -
43.8%43.8%
-
43.8 %21 / 48100.0 %2 / 2
include/crpropa -
73.6%73.6%
-
73.6 %408 / 55446.4 %77 / 166
include/crpropa/advectionField -
100.0%
-
100.0 %5 / 5-0 / 0
include/crpropa/magneticField -
89.3%89.3%
-
89.3 %50 / 5663.6 %7 / 11
include/crpropa/magneticField/turbulentField -
72.9%72.9%
-
72.9 %43 / 5947.1 %8 / 17
include/crpropa/magneticLens -
42.9%42.9%
-
42.9 %30 / 7054.5 %6 / 11
include/crpropa/massDistribution -
19.2%19.2%
-
19.2 %5 / 260.0 %0 / 11
include/crpropa/module -
62.9%62.9%
-
62.9 %22 / 35-0 / 0
libs/HepPID/src -
11.4%11.4%
-
11.4 %50 / 44022.9 %11 / 48
libs/healpix_base -
14.1%14.1%
-
14.1 %112 / 7929.4 %10 / 106
libs/healpix_base/include/healpix_base -
19.1%19.1%
-
19.1 %33 / 1738.1 %5 / 62
libs/kiss/include/kiss -
57.9%57.9%
-
57.9 %11 / 1920.9 %14 / 67
libs/kiss/src -
28.1%28.1%
-
28.1 %34 / 12139.1 %9 / 23
src -
50.3%50.3%
-
50.3 %1361 / 270758.5 %251 / 429
src/advectionField -
42.5%42.5%
-
42.5 %131 / 30852.4 %44 / 84
src/magneticField -
18.2%18.2%
-
18.2 %166 / 91021.0 %29 / 138
src/magneticField/turbulentField -
71.1%71.1%
-
71.1 %187 / 26357.9 %11 / 19
src/magneticLens -
45.7%45.7%
-
45.7 %147 / 32251.2 %21 / 41
src/massDistribution -
83.9%83.9%
-
83.9 %349 / 41690.8 %69 / 76
src/module -
63.4%63.4%
-
63.4 %2250 / 354759.0 %286 / 485
test -
97.9%97.9%
-
97.9 %3320 / 339196.7 %264 / 273
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/HepPID/src/ParticleIDMethods.cc.func-sort-c.html b/doc/coverageReport/libs/HepPID/src/ParticleIDMethods.cc.func-sort-c.html deleted file mode 100644 index 295e10399..000000000 --- a/doc/coverageReport/libs/HepPID/src/ParticleIDMethods.cc.func-sort-c.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/HepPID/src/ParticleIDMethods.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/HepPID/src - ParticleIDMethods.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:5024920.1 %
Date:2024-04-08 14:58:22Functions:113234.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN6HepPID10hasStrangeERKi0
_ZN6HepPID12_GLOBAL__N_15findQERKiS2_0
_ZN6HepPID12isPentaquarkERKi0
_ZN6HepPID18hasFundamentalAntiERKi0
_ZN6HepPID5hasUpERKi0
_ZN6HepPID5jSpinERKi0
_ZN6HepPID5lSpinERKi0
_ZN6HepPID5sSpinERKi0
_ZN6HepPID6hasTopERKi0
_ZN6HepPID6isSUSYERKi0
_ZN6HepPID6lambdaERKi0
_ZN6HepPID7hasDownERKi0
_ZN6HepPID7isMesonERKi0
_ZN6HepPID7isValidERKi0
_ZN6HepPID8hasCharmERKi0
_ZN6HepPID8isBaryonERKi0
_ZN6HepPID8isHadronERKi0
_ZN6HepPID8isLeptonERKi0
_ZN6HepPID9hasBottomERKi0
_ZN6HepPID9isDiQuarkERKi0
_ZN6HepPID9isRhadronERKi0
_ZN6HepPID1AERKi202818
_ZN6HepPID1ZERKi364529
_ZN6HepPID6isDyonERKi3325562
_ZN6HepPID13fundamentalIDERKi20168250
_ZN6HepPID6chargeERKi20168251
_ZN6HepPID11threeChargeERKi20168252
_ZN6HepPID9isNucleusERKi20937352
_ZN6HepPID7isQBallERKi23493806
_ZN6HepPID9extraBitsERKi50313164
_ZN6HepPID5digitENS_8locationERKi146041016
_ZN6HepPID6abspidERKi260299484
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/HepPID/src/ParticleIDMethods.cc.func.html b/doc/coverageReport/libs/HepPID/src/ParticleIDMethods.cc.func.html deleted file mode 100644 index 078e3d9b7..000000000 --- a/doc/coverageReport/libs/HepPID/src/ParticleIDMethods.cc.func.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/HepPID/src/ParticleIDMethods.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/HepPID/src - ParticleIDMethods.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:5024920.1 %
Date:2024-04-08 14:58:22Functions:113234.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN6HepPID10hasStrangeERKi0
_ZN6HepPID11threeChargeERKi20168252
_ZN6HepPID12_GLOBAL__N_15findQERKiS2_0
_ZN6HepPID12isPentaquarkERKi0
_ZN6HepPID13fundamentalIDERKi20168250
_ZN6HepPID18hasFundamentalAntiERKi0
_ZN6HepPID1AERKi202818
_ZN6HepPID1ZERKi364529
_ZN6HepPID5digitENS_8locationERKi146041016
_ZN6HepPID5hasUpERKi0
_ZN6HepPID5jSpinERKi0
_ZN6HepPID5lSpinERKi0
_ZN6HepPID5sSpinERKi0
_ZN6HepPID6abspidERKi260299484
_ZN6HepPID6chargeERKi20168251
_ZN6HepPID6hasTopERKi0
_ZN6HepPID6isDyonERKi3325562
_ZN6HepPID6isSUSYERKi0
_ZN6HepPID6lambdaERKi0
_ZN6HepPID7hasDownERKi0
_ZN6HepPID7isMesonERKi0
_ZN6HepPID7isQBallERKi23493806
_ZN6HepPID7isValidERKi0
_ZN6HepPID8hasCharmERKi0
_ZN6HepPID8isBaryonERKi0
_ZN6HepPID8isHadronERKi0
_ZN6HepPID8isLeptonERKi0
_ZN6HepPID9extraBitsERKi50313164
_ZN6HepPID9hasBottomERKi0
_ZN6HepPID9isDiQuarkERKi0
_ZN6HepPID9isNucleusERKi20937352
_ZN6HepPID9isRhadronERKi0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/HepPID/src/ParticleIDMethods.cc.gcov.html b/doc/coverageReport/libs/HepPID/src/ParticleIDMethods.cc.gcov.html deleted file mode 100644 index de197c29e..000000000 --- a/doc/coverageReport/libs/HepPID/src/ParticleIDMethods.cc.gcov.html +++ /dev/null @@ -1,641 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/HepPID/src/ParticleIDMethods.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/HepPID/src - ParticleIDMethods.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:5024920.1 %
Date:2024-04-08 14:58:22Functions:113234.4 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : // ----------------------------------------------------------------------
-       2             : //
-       3             : // ParticleIDMethods.cc
-       4             : //
-       5             : // ----------------------------------------------------------------------
-       6             : 
-       7             : #include <cmath>  // for pow()
-       8             : 
-       9             : #include "HepPID/ParticleIDMethods.hh"
-      10             : #include "HepPID/ParticleName.hh"
-      11             : 
-      12             : namespace HepPID {
-      13             : 
-      14             : namespace {
-      15             : 
-      16             : // internal function used by hasXXX methods
-      17           0 : bool findQ( const int & pid, const int & q )
-      18             : {
-      19           0 :     if( isDyon(pid) ) { return false; }
-      20           0 :     if( isRhadron(pid) ) {
-      21             :         int iz = 7;
-      22           0 :         for( int i=6; i > 1; --i ) {
-      23           0 :            if( digit(location(i),pid) == 0 ) {
-      24             :                iz = i;
-      25           0 :            } else if ( i == iz-1 ) {
-      26             :                // ignore squark or gluino
-      27             :            } else {
-      28           0 :                if( digit(location(i),pid) == q ) { return true; }
-      29             :            }
-      30             :         }
-      31             :         return false;
-      32             :     }
-      33           0 :     if( digit(nq3,pid) == q || digit(nq2,pid) == q || digit(nq1,pid) == q ) { return true; }
-      34           0 :     if( isPentaquark(pid) ) { 
-      35           0 :         if( digit(nl,pid) == q || digit(nr,pid) == q ) { return true; }
-      36             :     }
-      37             :     return false;
-      38             : }
-      39             : 
-      40             : }
-      41             : 
-      42             : // absolute value
-      43   260299484 : int abspid( const int & pid )
-      44             : {
-      45   260299484 :   return (pid < 0) ? -pid : pid;
-      46             : }
-      47             : 
-      48             : // returns everything beyond the 7th digit (e.g. outside the numbering scheme)
-      49    50313164 : int extraBits( const int & pid )
-      50             : {
-      51    50313164 :     return abspid(pid)/10000000;
-      52             : }
-      53             : 
-      54             : //  split the PID into constituent integers
-      55   146041016 : unsigned short digit( location loc, const int & pid )
-      56             : {
-      57             :     //  PID digits (base 10) are: n nr nl nq1 nq2 nq3 nj
-      58             :     //  the location enum provides a convenient index into the PID
-      59             :                 //
-      60             :                 //  Modified for CRPropa: use precalculated values isntead of pow for
-      61             :                 //  performance
-      62             :                 static unsigned int p10[] = { 1, 10, 100, 1000,  10000, 100000, 1000000,
-      63             :                         10000000, 100000000, 1000000000};
-      64   146041016 :     return (abspid(pid)/ p10[loc-1])%10;
-      65             : //    int numerator = (int) std::pow(10.0,(loc-1));
-      66             : //    return (abspid(pid)/numerator)%10;
-      67             : }
-      68             : 
-      69             : //  return the first two digits if this is a "fundamental" particle
-      70             : //  ID = 100 is a special case (internal generator ID's are 81-100)
-      71    20168250 : int fundamentalID( const int & pid )
-      72             : {
-      73    20168250 :     if( extraBits(pid) > 0 ) return 0;
-      74    20168243 :     if( digit(nq2,pid) == 0 && digit(nq1,pid) == 0) {
-      75    20168243 :         return abspid(pid)%10000;
-      76           0 :     } else if( abspid(pid) <= 100 ) {
-      77           0 :         return abspid(pid);
-      78             :     } else {
-      79             :         return 0;
-      80             :     }
-      81             : }
-      82             : 
-      83             : // Ion numbers are +/- 10LZZZAAAI. 
-      84      364529 : int Z( const int & pid )
-      85             : {
-      86             :     // a proton can also be a Hydrogen nucleus
-      87      364529 :     if( abspid(pid) == 2212 ) { return 1; }
-      88      364529 :     if( isNucleus(pid) ) return (abspid(pid)/10000)%1000;
-      89             :     return 0;
-      90             : }
-      91             : 
-      92             : // Ion numbers are +/- 10LZZZAAAI. 
-      93      202818 : int A( const int & pid )
-      94             : {
-      95             :     // a proton can also be a Hydrogen nucleus
-      96      202818 :     if( abspid(pid) == 2212 ) { return 1; }
-      97      202818 :     if( isNucleus(pid) ) return (abspid(pid)/10)%1000;
-      98             :     return 0;
-      99             : }
-     100             : 
-     101             : // if this is a nucleus (ion), get nLambda
-     102             : // Ion numbers are +/- 10LZZZAAAI. 
-     103           0 : int lambda( const int & pid )
-     104             : {
-     105             :     // a proton can also be a Hydrogen nucleus
-     106           0 :     if( abspid(pid) == 2212 ) { return 0; }
-     107           0 :     if( isNucleus(pid) ) return digit(n8,pid);
-     108             :     return 0;
-     109             : }
-     110             : 
-     111             : 
-     112             : // ---  boolean methods:
-     113             : //
-     114             : 
-     115             : //  check to see if this is a valid PID
-     116           0 : bool isValid( const int & pid )
-     117             : {
-     118           0 :     if( extraBits(pid) > 0 ) {
-     119           0 :         if( isNucleus(pid) )   { return true; }
-     120           0 :         if( isQBall(pid) )   { return true; }
-     121           0 :         return false; 
-     122             :     }
-     123           0 :     if( isSUSY(pid) ) { return true; }
-     124           0 :     if( isRhadron(pid) ) { return true; }
-     125           0 :     if( isDyon(pid) ) { return true; }
-     126             :     // Meson signature
-     127           0 :     if( isMeson(pid) )   { return true; }
-     128             :     // Baryon signature
-     129           0 :     if( isBaryon(pid) )  { return true; }
-     130             :     // DiQuark signature
-     131           0 :     if( isDiQuark(pid) ) { return true; }
-     132             :     // fundamental particle
-     133           0 :     if( fundamentalID(pid) > 0 ) { 
-     134           0 :       if(pid > 0 ) { 
-     135             :         return true; 
-     136             :       } else {
-     137           0 :         if( hasFundamentalAnti(pid) ) { return true; }
-     138           0 :         return false;
-     139             :       }
-     140             :     }
-     141             :     // pentaquark
-     142           0 :     if( isPentaquark(pid) ) { return true; }
-     143             :     // don't recognize this number
-     144             :     return false;
-     145             : }
-     146             : 
-     147             : // if this is a fundamental particle, does it have a valid antiparticle?
-     148           0 : bool hasFundamentalAnti( const int & pid )
-     149             : {
-     150             :     // these are defined by the generator and therefore are always valid
-     151           0 :     if( fundamentalID(pid) <= 100 && fundamentalID(pid) >= 80 ) { return true; }
-     152             :     // check id's from 1 to 79
-     153           0 :     if( fundamentalID(pid) > 0 && fundamentalID(pid) < 80 ) { 
-     154           0 :        if( validParticleName(-pid) ) { return true; }
-     155             :     }
-     156             :     return false;
-     157             : }
-     158             : 
-     159             : //  check to see if this is a valid meson
-     160           0 : bool isMeson( const int & pid )
-     161             : {
-     162           0 :     if( extraBits(pid) > 0 ) { return false; }
-     163           0 :     if( abspid(pid) <= 100 ) { return false; }
-     164           0 :     if( fundamentalID(pid) <= 100 && fundamentalID(pid) > 0 ) { return false; }
-     165           0 :     if( isRhadron(pid) ) { return false; }
-     166           0 :     int aid = abspid(pid);
-     167           0 :     if( aid == 130 || aid == 310 || aid == 210 ) { return true; }
-     168             :     // EvtGen uses some odd numbers
-     169           0 :     if( aid == 150 || aid == 350 || aid == 510 || aid == 530 ) { return true; }
-     170             :     // pomeron, etc.
-     171           0 :     if( pid == 110 || pid == 990 || pid == 9990 ) { return true; }
-     172           0 :     if(    digit(nj,pid) > 0 && digit(nq3,pid) > 0 
-     173           0 :         && digit(nq2,pid) > 0 && digit(nq1,pid) == 0 ) {
-     174             :         // check for illegal antiparticles
-     175           0 :         if( digit(nq3,pid) == digit(nq2,pid) && pid < 0 ) {
-     176           0 :             return false;
-     177             :         } else {
-     178             :             return true;
-     179             :         }
-     180             :     }
-     181             :     return false;
-     182             : }
-     183             : 
-     184             : //  check to see if this is a valid baryon
-     185           0 : bool isBaryon( const int & pid )
-     186             : {
-     187           0 :     if( extraBits(pid) > 0 ) { return false; }
-     188           0 :     if( abspid(pid) <= 100 ) { return false; }
-     189           0 :     if( fundamentalID(pid) <= 100 && fundamentalID(pid) > 0 ) { return false; }
-     190           0 :     if( isRhadron(pid) ) { return false; }
-     191           0 :     if( isPentaquark(pid) ) { return false; }
-     192           0 :     if( abspid(pid) == 2110 || abspid(pid) == 2210 ) { return true; }
-     193           0 :     if(    digit(nj,pid) > 0  && digit(nq3,pid) > 0 
-     194           0 :         && digit(nq2,pid) > 0 && digit(nq1,pid) > 0 ) { return true; }
-     195             :     return false;
-     196             : }
-     197             : 
-     198             : //  check to see if this is a valid diquark
-     199           0 : bool isDiQuark( const int & pid )
-     200             : {
-     201           0 :     if( extraBits(pid) > 0 ) { return false; }
-     202           0 :     if( abspid(pid) <= 100 ) { return false; }
-     203           0 :     if( fundamentalID(pid) <= 100 && fundamentalID(pid) > 0 ) { return false; }
-     204           0 :     if(    digit(nj,pid) > 0  && digit(nq3,pid) == 0 
-     205           0 :         && digit(nq2,pid) > 0 && digit(nq1,pid) > 0 ) {  // diquark signature
-     206             :        // EvtGen uses the diquarks for quark pairs, so, for instance, 
-     207             :        //   5501 is a valid "diquark" for EvtGen
-     208             :        //if( digit(nj) == 1 && digit(nq2) == digit(nq1) ) {     // illegal
-     209             :        //   return false; 
-     210             :        //} else {
-     211           0 :           return true;
-     212             :        //}
-     213             :     }
-     214             :     return false;
-     215             : }
-     216             : 
-     217             : // is this a valid hadron ID?
-     218           0 : bool isHadron( const int & pid )
-     219             : {
-     220           0 :     if( extraBits(pid) > 0 ) { return false; }
-     221           0 :     if( isMeson(pid) )   { return true; }
-     222           0 :     if( isBaryon(pid) )  { return true; }
-     223           0 :     if( isPentaquark(pid) ) { return true; }
-     224           0 :     if( isRhadron(pid) ) { return true; }
-     225             :     return false;
-     226             : }
-     227             : // is this a valid lepton ID?
-     228           0 : bool isLepton( const int & pid )
-     229             : {
-     230           0 :     if( extraBits(pid) > 0 ) { return false; }
-     231           0 :     if( fundamentalID(pid) >= 11 && fundamentalID(pid) <= 18 ) { return true; }
-     232             :     return false;
-     233             : }
-     234             : 
-     235             : //
-     236             : // This implements the 2006 Monte Carlo nuclear code scheme.
-     237             : // Ion numbers are +/- 10LZZZAAAI. 
-     238             : // AAA is A - total baryon number
-     239             : // ZZZ is Z - total charge
-     240             : // L is the total number of strange quarks.
-     241             : // I is the isomer number, with I=0 corresponding to the ground state.
-     242    20937352 : bool isNucleus( const int & pid )
-     243             : {
-     244             :      // a proton can also be a Hydrogen nucleus
-     245    20937352 :      if( abspid(pid) == 2212 ) { return true; }
-     246             :      // new standard: +/- 10LZZZAAAI
-     247    20937336 :      if( ( digit(n10,pid) == 1 ) && ( digit(n9,pid) == 0 ) ) {
-     248             :         // charge should always be less than or equal to baryon number
-     249             :         // the following line is A >= Z
-     250      769143 :         if( (abspid(pid)/10)%1000 >= (abspid(pid)/10000)%1000 ) { return true; }
-     251             :      }
-     252             :      return false;
-     253             : }
-     254             : 
-     255             : //  check to see if this is a valid pentaquark
-     256           0 : bool isPentaquark( const int & pid )
-     257             : {
-     258             :     // a pentaquark is of the form 9abcdej,
-     259             :     // where j is the spin and a, b, c, d, and e are quarks
-     260           0 :     if( extraBits(pid) > 0 ) { return false; }
-     261           0 :     if( digit(n,pid) != 9 )  { return false; }
-     262           0 :     if( digit(nr,pid) == 9 || digit(nr,pid) == 0 )  { return false; }
-     263           0 :     if( digit(nj,pid) == 9 || digit(nl,pid) == 0 )  { return false; }
-     264           0 :     if( digit(nq1,pid) == 0 )  { return false; }
-     265           0 :     if( digit(nq2,pid) == 0 )  { return false; }
-     266           0 :     if( digit(nq3,pid) == 0 )  { return false; }
-     267           0 :     if( digit(nj,pid) == 0 )  { return false; }
-     268             :     // check ordering
-     269           0 :     if( digit(nq2,pid) > digit(nq1,pid) )  { return false; }
-     270           0 :     if( digit(nq1,pid) > digit(nl,pid) )  { return false; }
-     271           0 :     if( digit(nl,pid) > digit(nr,pid) )  { return false; }
-     272             :     return true;
-     273             : }
-     274             : 
-     275             : // is this a SUSY?
-     276           0 : bool isSUSY( const int & pid )
-     277             : {
-     278             :     // fundamental SUSY particles have n = 1 or 2
-     279           0 :     if( extraBits(pid) > 0 ) { return false; }
-     280           0 :     if( digit(n,pid) != 1 && digit(n,pid) != 2 )  { return false; }
-     281           0 :     if( digit(nr,pid) != 0 )  { return false; }
-     282             :     // check fundamental part
-     283           0 :     if( fundamentalID(pid) == 0 )  { return false; }
-     284             :     return true;
-     285             : }
-     286             : 
-     287             : // is this an R-hadron?
-     288           0 : bool isRhadron( const int & pid )
-     289             : {
-     290             :     // an R-hadron is of the form 10abcdj, 100abcj, or 1000abj
-     291             :     // where j is the spin, b, c, and d are quarks or gluons,
-     292             :     // and a (the digit following the zero's) is a SUSY particle
-     293           0 :     if( extraBits(pid) > 0 ) { return false; }
-     294           0 :     if( digit(n,pid) != 1 )  { return false; }
-     295           0 :     if( digit(nr,pid) != 0 )  { return false; }
-     296             :     // make sure this isn't a SUSY particle
-     297           0 :     if( isSUSY(pid) ) { return false; }
-     298             :     // All R-hadrons have at least 3 core digits
-     299           0 :     if( digit(nq2,pid) == 0 )  { return false; }
-     300           0 :     if( digit(nq3,pid) == 0 )  { return false; }
-     301           0 :     if( digit(nj,pid) == 0 )  { return false; }
-     302             :     return true;
-     303             : }
-     304             : 
-     305             : // is this a Dyon (magnetic monopole)?
-     306     3325562 : bool isDyon( const int & pid )
-     307             : {
-     308             :     ///Magnetic monopoles and Dyons are assumed to have one unit of 
-     309             :     ///Dirac monopole charge and a variable integer number xyz units 
-     310             :     ///of electric charge.  
-     311             :     ///
-     312             :     ///Codes 411xyz0 are then used when the magnetic and electrical 
-     313             :     ///charge sign agree and 412xyz0 when they disagree, 
-     314             :     ///with the overall sign of the particle set by the magnetic charge.  
-     315             :     ///For now no spin information is provided.
-     316             :     ///
-     317     3325562 :     if( extraBits(pid) > 0 ) { return false; }
-     318     3325562 :     if( digit(n,pid) != 4 )  { return false; }
-     319           0 :     if( digit(nr,pid) != 1 )  { return false; }
-     320           0 :     if( (digit(nl,pid) != 1) && (digit(nl,pid) != 2) )  { return false; }
-     321             :     // All Dyons have at least 1 core digit
-     322           0 :     if( digit(nq3,pid) == 0 )  { return false; }
-     323             :     // Dyons have spin zero for now
-     324           0 :     if( digit(nj,pid) != 0 )  { return false; }
-     325             :     return true;
-     326             : }
-     327             : 
-     328             : // Check for QBalls
-     329             : // Ad-hoc numbering for such particles is 100xxxx0, 
-     330             : // where xxxx is the charge in tenths. 
-     331    23493806 : bool isQBall( const int & pid )
-     332             : {
-     333    23493806 :     if( extraBits(pid) != 1 ) { return false; }
-     334           0 :     if( digit(n,pid) != 0 )  { return false; }
-     335           0 :     if( digit(nr,pid) != 0 )  { return false; }
-     336             :     // check the core number
-     337           0 :     if( (abspid(pid)/10)%10000 == 0 )  { return false; }
-     338             :     // these particles have spin zero for now
-     339           0 :     if( digit(nj,pid) != 0 )  { return false; }
-     340             :     return true;
-     341             : }
-     342             : 
-     343             : // does this particle contain an up quark?
-     344           0 : bool hasUp( const int & pid)
-     345             : {
-     346           0 :     if( extraBits(pid) > 0 ) { return false; }
-     347           0 :     if( fundamentalID(pid) > 0 ) { return false; }
-     348           0 :     return findQ(pid,2);
-     349             : }
-     350             : // does this particle contain a down quark?
-     351           0 : bool hasDown( const int & pid)
-     352             : {
-     353           0 :     if( extraBits(pid) > 0 ) { return false; }
-     354           0 :     if( fundamentalID(pid) > 0 ) { return false; }
-     355           0 :     return findQ(pid,1);
-     356             : }
-     357             : // does this particle contain a strange quark?
-     358           0 : bool hasStrange( const int & pid )
-     359             : {
-     360           0 :     if( extraBits(pid) > 0 ) { return false; }
-     361           0 :     if( fundamentalID(pid) > 0 ) { return false; }
-     362           0 :     return findQ(pid,3);
-     363             : }
-     364             : // does this particle contain a charm quark?
-     365           0 : bool hasCharm( const int & pid )
-     366             : {
-     367           0 :     if( extraBits(pid) > 0 ) { return false; }
-     368           0 :     if( fundamentalID(pid) > 0 ) { return false; }
-     369           0 :     return findQ(pid,4);
-     370             : }
-     371             : // does this particle contain a bottom quark?
-     372           0 : bool hasBottom( const int & pid )
-     373             : {
-     374           0 :     if( extraBits(pid) > 0 ) { return false; }
-     375           0 :     if( fundamentalID(pid) > 0 ) { return false; }
-     376           0 :     return findQ(pid,5);
-     377             : }
-     378             : // does this particle contain a top quark?
-     379           0 : bool hasTop( const int & pid )
-     380             : {
-     381           0 :     if( extraBits(pid) > 0 ) { return false; }
-     382           0 :     if( fundamentalID(pid) > 0 ) { return false; }
-     383           0 :     return findQ(pid,6);
-     384             : }
-     385             : 
-     386             : // ---  other information
-     387             : //
-     388             : // jSpin returns 2J+1, where J is the total spin
-     389           0 : int  jSpin( const int & pid )
-     390             : {
-     391           0 :     if( fundamentalID(pid) > 0 ) { 
-     392             :         // some of these are known
-     393           0 :         int fund = fundamentalID(pid);
-     394           0 :         if( fund > 0 && fund < 7 ) return 2;
-     395           0 :         if( fund == 9 ) return 3; 
-     396           0 :         if( fund > 10 && fund < 17 ) return 2;
-     397           0 :         if( fund > 20 && fund < 25 ) return 3;
-     398           0 :         return 0; 
-     399           0 :     } else if( extraBits(pid) > 0 ) { 
-     400             :         return 0; 
-     401             :     }
-     402           0 :     return abspid(pid)%10;
-     403             : }
-     404             : // sSpin returns 2S+1, where S is the spin
-     405           0 : int  sSpin( const int & pid )
-     406             : {
-     407           0 :     if( !isMeson(pid) ) { return 0; }
-     408           0 :     int inl = digit(nl,pid);
-     409             :     //int tent = digit(n,pid);
-     410           0 :     int js = digit(nj,pid);
-     411           0 :     if( digit(n,pid) == 9 ) { return 0; }       // tentative ID
-     412             :     //if( tent == 9 ) { return 0; }     // tentative assignment
-     413           0 :     if( inl == 0 && js >= 3 ) { 
-     414             :         return 1;
-     415           0 :     } else if( inl == 0  && js == 1 ) {
-     416             :         return 0;
-     417           0 :     } else if( inl == 1  && js >= 3 ) {
-     418             :         return 0;
-     419           0 :     } else if( inl == 2  && js >= 3 ) {
-     420             :         return 1;
-     421           0 :     } else if( inl == 1  && js == 1 ) {
-     422             :         return 1;
-     423           0 :     } else if( inl == 3  && js >= 3 ) {
-     424           0 :         return 1;
-     425             :     }
-     426             :     // default to zero
-     427             :     return 0;
-     428             : }
-     429             : // lSpin returns 2L+1, where L is the orbital angular momentum
-     430           0 : int  lSpin( const int & pid )
-     431             : {
-     432           0 :     if( !isMeson(pid) ) { return 0; }
-     433           0 :     int inl = digit(nl,pid);
-     434             :     //int tent = digit(n,pid);
-     435           0 :     int js = digit(nj,pid);
-     436           0 :     if( digit(n,pid) == 9 ) { return 0; }       // tentative ID
-     437           0 :     if( inl == 0 && js == 3 ) { 
-     438             :         return 0;
-     439           0 :     } else if( inl == 0 && js == 5 ) {
-     440             :         return 1;
-     441           0 :     } else if( inl == 0 && js == 7 ) {
-     442             :         return 2;
-     443           0 :     } else if( inl == 0 && js == 9 ) {
-     444             :         return 3;
-     445           0 :     } else if( inl == 0  && js == 1 ) {
-     446             :         return 0;
-     447           0 :     } else if( inl == 1  && js == 3 ) {
-     448             :         return 1;
-     449           0 :     } else if( inl == 1  && js == 5 ) {
-     450             :         return 2;
-     451           0 :     } else if( inl == 1  && js == 7 ) {
-     452             :         return 3;
-     453           0 :     } else if( inl == 1  && js == 9 ) {
-     454             :         return 4;
-     455           0 :     } else if( inl == 2  && js == 3 ) {
-     456             :         return 1;
-     457           0 :     } else if( inl == 2  && js == 5 ) {
-     458             :         return 2;
-     459           0 :     } else if( inl == 2  && js == 7 ) {
-     460             :         return 3;
-     461           0 :     } else if( inl == 2  && js == 9 ) {
-     462             :         return 4;
-     463           0 :     } else if( inl == 1  && js == 1 ) {
-     464             :         return 1;
-     465           0 :     } else if( inl == 3  && js == 3 ) {
-     466             :         return 2;
-     467           0 :     } else if( inl == 3  && js == 5 ) {
-     468             :         return 3;
-     469           0 :     } else if( inl == 3  && js == 7 ) {
-     470             :         return 4;
-     471           0 :     } else if( inl == 3  && js == 9 ) {
-     472           0 :         return 5;
-     473             :     }
-     474             :     // default to zero
-     475             :     return 0;
-     476             : }
-     477             : 
-     478             : // 3 times the charge
-     479    20168252 : int threeCharge( const int & pid )
-     480             : {
-     481             :     int charge=0;
-     482             :     int ida, sid;
-     483             :     unsigned short q1, q2, q3, ql;
-     484             :     static int ch100[] = { -1, 2,-1, 2,-1, 2,-1, 2, 0, 0,
-     485             :                        -3, 0,-3, 0,-3, 0,-3, 0, 0, 0,
-     486             :                         0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
-     487             :                         0, 0, 0, 3, 0, 0, 3, 0, 0, 0,
-     488             :                         0, -1, 0, 0, 0, 0, 0, 0, 0, 0,
-     489             :                         0, 6, 3, 6, 0, 0, 0, 0, 0, 0,
-     490             :                         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-     491             :                         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-     492             :                         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-     493             :                         0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
-     494    20168252 :     q1 = digit(nq1,pid);
-     495    20168249 :     q2 = digit(nq2,pid);
-     496    20168248 :     q3 = digit(nq3,pid);
-     497    20168250 :     ql = digit(nl,pid);
-     498    20168251 :     ida = abspid(pid);
-     499    20168250 :     sid = fundamentalID(pid);
-     500    20168244 :     if( ida == 0 ) {      // illegal
-     501             :         return 0;
-     502     3325563 :     } else if( isQBall(pid) ) {         // QBall
-     503           0 :        charge = 3*((abspid(pid)/10)%10000);
-     504     3325563 :     } else if( extraBits(pid) > 0 ) {                // ion
-     505             :         return 0;
-     506     3325562 :     } else if( isDyon(pid) ) {          // Dyon
-     507           0 :         charge = 3*( (abspid(pid)/10)%1000 );
-     508             :         // this is half right
-     509             :         // the charge sign will be changed below if pid < 0
-     510           0 :         if( ql == 2 ) {
-     511           0 :             charge = -charge; 
-     512             :         }
-     513     3325562 :     } else if( sid > 0 && sid <= 100 ) {  // use table
-     514     3325562 :         charge = ch100[sid-1];
-     515     3325562 :         if(ida==1000017 || ida==1000018) { charge = 0; }
-     516     3325562 :         if(ida==1000034 || ida==1000052) { charge = 0; }
-     517     3325562 :         if(ida==1000053 || ida==1000054) { charge = 0; }
-     518     3325562 :         if(ida==5100061 || ida==5100062) { charge = 6; }
-     519           0 :     } else if( digit(nj,pid) == 0 ) {           // KL, Ks, or undefined
-     520             :         return 0;
-     521           0 :     } else if( isMeson(pid) ) {                 // mesons
-     522           0 :             if( q2 == 3 || q2 == 5 ) {
-     523           0 :                 charge = ch100[q3-1] - ch100[q2-1];
-     524             :             } else {
-     525           0 :                 charge = ch100[q2-1] - ch100[q3-1];
-     526             :             }
-     527           0 :     } else if( isRhadron(pid) ) {               // Rhadron
-     528           0 :         if (( q1 == 0 ) || ( q1 == 9 )) {
-     529           0 :             if( q2 == 3 || q2 == 5 ) {
-     530           0 :                 charge = ch100[q3-1] - ch100[q2-1];
-     531             :             } else {
-     532           0 :                 charge = ch100[q2-1] - ch100[q3-1];
-     533             :             }
-     534           0 :         } else if( ql == 0 ) {
-     535           0 :             charge = ch100[q3-1] + ch100[q2-1] + ch100[q1-1];
-     536           0 :         } else if ( digit(nr,pid) == 0 ) {
-     537           0 :             charge = ch100[q3-1] + ch100[q2-1] + ch100[q1-1] + ch100[ql-1];
-     538             :         }
-     539           0 :     } else if( isDiQuark(pid) ) {                       // diquarks
-     540           0 :         charge = ch100[q2-1] + ch100[q1-1];
-     541           0 :     } else if( isBaryon(pid) ) {                        // baryons
-     542           0 :         charge = ch100[q3-1] + ch100[q2-1] + ch100[q1-1];
-     543             :     } else {            // unknown
-     544             :         return 0;
-     545             :     }
-     546     3325562 :     if( charge == 0 ) {
-     547     3310494 :         return 0;
-     548       15068 :     } else if( pid < 0 ) {
-     549        7103 :         charge = -charge; 
-     550             :     }
-     551             :     return charge;
-     552             : }
-     553             : 
-     554             : // the actual charge
-     555    20168251 : double charge( const int & pid )
-     556             : {
-     557    20168251 :    int tc = threeCharge(pid);
-     558    20168244 :    if( isQBall(pid) ) {
-     559           0 :        return double(tc)/30.;
-     560             :    } else {
-     561    20168248 :        return double(tc)/3.;
-     562             :    }
-     563             : }
-     564             : 
-     565             : } // HepPID
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/HepPID/src/ParticleName.cc.func-sort-c.html b/doc/coverageReport/libs/HepPID/src/ParticleName.cc.func-sort-c.html deleted file mode 100644 index 399175d29..000000000 --- a/doc/coverageReport/libs/HepPID/src/ParticleName.cc.func-sort-c.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/HepPID/src/ParticleName.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/HepPID/src - ParticleName.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:01830.0 %
Date:2024-04-08 14:58:22Functions:0130.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN6HepPID12_GLOBAL__N_116ParticleNameInitEv0
_ZN6HepPID12_GLOBAL__N_121writeParticleNameLineEiRSo0
_ZN6HepPID12_GLOBAL__N_123checkForSpecialParticleERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN6HepPID12_GLOBAL__N_18dyonNameERKi0
_ZN6HepPID12_GLOBAL__N_19qballNameERKi0
_ZN6HepPID12particleNameB5cxx11ERKi0
_ZN6HepPID12particleNameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN6HepPID15ParticleNameMapC2ESt3mapIiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4lessIiESaISt4pairIKiS7_EEES1_IS7_iS8_IS7_ESaISA_IKS7_iEEE0
_ZN6HepPID15ParticleNameMapD2Ev0
_ZN6HepPID17listParticleNamesERSo0
_ZN6HepPID17validParticleNameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN6HepPID17validParticleNameERKi0
_ZN6HepPID18getParticleNameMapEv0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/HepPID/src/ParticleName.cc.func.html b/doc/coverageReport/libs/HepPID/src/ParticleName.cc.func.html deleted file mode 100644 index 392fe15ed..000000000 --- a/doc/coverageReport/libs/HepPID/src/ParticleName.cc.func.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/HepPID/src/ParticleName.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/HepPID/src - ParticleName.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:01830.0 %
Date:2024-04-08 14:58:22Functions:0130.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN6HepPID12_GLOBAL__N_116ParticleNameInitEv0
_ZN6HepPID12_GLOBAL__N_121writeParticleNameLineEiRSo0
_ZN6HepPID12_GLOBAL__N_123checkForSpecialParticleERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN6HepPID12_GLOBAL__N_18dyonNameERKi0
_ZN6HepPID12_GLOBAL__N_19qballNameERKi0
_ZN6HepPID12particleNameB5cxx11ERKi0
_ZN6HepPID12particleNameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN6HepPID15ParticleNameMapC2ESt3mapIiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4lessIiESaISt4pairIKiS7_EEES1_IS7_iS8_IS7_ESaISA_IKS7_iEEE0
_ZN6HepPID15ParticleNameMapD2Ev0
_ZN6HepPID17listParticleNamesERSo0
_ZN6HepPID17validParticleNameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN6HepPID17validParticleNameERKi0
_ZN6HepPID18getParticleNameMapEv0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/HepPID/src/ParticleName.cc.gcov.html b/doc/coverageReport/libs/HepPID/src/ParticleName.cc.gcov.html deleted file mode 100644 index c67d5715b..000000000 --- a/doc/coverageReport/libs/HepPID/src/ParticleName.cc.gcov.html +++ /dev/null @@ -1,2075 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/HepPID/src/ParticleName.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/HepPID/src - ParticleName.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:01830.0 %
Date:2024-04-08 14:58:22Functions:0130.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : // ----------------------------------------------------------------------
-       2             : //
-       3             : // ParticleName.cc
-       4             : // Author: Lynn Garren and Walter Brown
-       5             : //
-       6             : //  Create a map that gives a standard name for each pre-defined 
-       7             : //  particle ID number.   Also create a map for the reverse lookup of 
-       8             : //  the ID number from a string.  These maps are initialized if and only if 
-       9             : //  the public functions are called. Because the maps are static, 
-      10             : //  the initialization happens only once.
-      11             : //
-      12             : //  The user NEVER calls ParticleNameInit()
-      13             : //  We use a data table (struct Snames) so that compile time is not impacted.
-      14             : //
-      15             : //  public functions:
-      16             : //     PartcleIdMap const &  getPartcleIdMap()
-      17             : //     std::string              ParticleName( const int pid )
-      18             : //     void                     listParticleNames( std::ostream & os  )
-      19             : //
-      20             : // ----------------------------------------------------------------------
-      21             : 
-      22             : #include <string>
-      23             : #include <map>
-      24             : #include <iostream>
-      25             : #include <sstream>
-      26             : #include <iomanip>        // width
-      27             : #include <utility>        // make_pair
-      28             : 
-      29             : #include "HepPID/ParticleName.hh"
-      30             : #include "HepPID/ParticleIDMethods.hh"
-      31             : #include "HepPID/Version.hh"
-      32             : 
-      33             : namespace HepPID {
-      34             : 
-      35             : typedef  std::map< int, std::string >  PartcleIdMap;
-      36             : typedef  std::map< std::string, int >  ParticleLookupMap;
-      37             : 
-      38             : ///
-      39             : /// \class ParticleNameMap
-      40             : /// \author Lynn Garren
-      41             : ///
-      42             : /// Used internally to store the static maps
-      43             : ///
-      44             : class ParticleNameMap{
-      45             : 
-      46             : public:
-      47             : 
-      48             :    typedef PartcleIdMap::const_iterator      idIterator;
-      49             :    typedef ParticleLookupMap::const_iterator nameIterator;
-      50             :    
-      51           0 :    ParticleNameMap(PartcleIdMap m1,ParticleLookupMap m2)
-      52           0 :    : itsNameMap(m1), itsLookupMap(m2) {}
-      53           0 :    ~ParticleNameMap() {}
-      54             :    
-      55             :    PartcleIdMap       nameMap()    const { return itsNameMap; }
-      56             :    ParticleLookupMap lookupMap()  const { return itsLookupMap; }
-      57             :    idIterator   begin()               const { return itsNameMap.begin(); }
-      58             :    idIterator   end()                 const { return itsNameMap.end(); }
-      59             :    idIterator   find( const int & id) const { return itsNameMap.find(id); }
-      60             :    nameIterator beginLookupMap()      const { return itsLookupMap.begin(); }
-      61             :    nameIterator endLookupMap()        const { return itsLookupMap.end(); }
-      62             :    nameIterator findString( const std::string & s) const { return itsLookupMap.find(s); }
-      63             : 
-      64             : private:
-      65             :    
-      66             :    PartcleIdMap       itsNameMap;
-      67             :    ParticleLookupMap itsLookupMap;
-      68             :    
-      69             :    // copies are not allowed
-      70             :    ParticleNameMap( const ParticleNameMap & );
-      71             :    ParticleNameMap & operator = ( const ParticleNameMap & );
-      72             :    
-      73             : };
-      74             : 
-      75             : namespace {     // ParticleNameInit and ParticleNameMap are private
-      76             : 
-      77           0 : ParticleNameMap const &  ParticleNameInit()
-      78             : {
-      79             : 
-      80             :   PartcleIdMap  m;
-      81             :   ParticleLookupMap nameMap;
-      82             : 
-      83             :   static const struct {
-      84             :       int pid;
-      85             :       const char* pname;
-      86             :   } SNames[] = {
-      87             :       {          0, "" },
-      88             :       {          1, "d" },
-      89             :       {         -1, "d~" },
-      90             :       {          2, "u" },
-      91             :       {         -2, "u~" },
-      92             :       {          3, "s" },
-      93             :       {         -3, "s~" },
-      94             :       {          4, "c" },
-      95             :       {         -4, "c~" },
-      96             :       {          5, "b" },
-      97             :       {         -5, "b~" },
-      98             :       {          6, "t" },
-      99             :       {         -6, "t~" },
-     100             :       {          7, "b'" },
-     101             :       {         -7, "b'~" },
-     102             :       {          8, "t'" },
-     103             :       {         -8, "t'~" },
-     104             :       {         11, "e^-" },
-     105             :       {        -11, "e^+" },
-     106             :       {         12, "nu_e" },
-     107             :       {        -12, "nu_e~" },
-     108             :       {         13, "mu^-" },
-     109             :       {        -13, "mu^+" },
-     110             :       {         14, "nu_mu" },
-     111             :       {        -14, "nu_mu~" },
-     112             :       {         15, "tau^-" },
-     113             :       {        -15, "tau^+" },
-     114             :       {         16, "nu_tau" },
-     115             :       {        -16, "nu_tau~" },
-     116             :       {         17, "tau'^-" },
-     117             :       {        -17, "tau'^+" },
-     118             :       {         18, "nu_tau'" },
-     119             :       {        -18, "nu_tau'~" },
-     120             :       {         21, "g" },
-     121             :       {         22, "gamma" },
-     122             :       {      10022, "virtual-photon" },
-     123             :       {      20022, "Cerenkov-radiation" },
-     124             :       {         23, "Z^0" },
-     125             :       {         24, "W^+" },
-     126             :       {        -24, "W^-" },
-     127             :       {         25, "H_1^0" },
-     128             :       {         32, "Z_2^0" },
-     129             :       {         33, "Z_3^0" },
-     130             :       {         34, "W_2^+" },
-     131             :       {        -34, "W_2^-" },
-     132             :       {         35, "H_2^0" },
-     133             :       {         36, "H_3^0" },
-     134             :       {         37, "H^+" },
-     135             :       {        -37, "H^-" },
-     136             :       {         39, "G"  },
-     137             :       {         41, "R^0" },
-     138             :       {        -41, "R~^0" },
-     139             :       {         42, "LQ_c" },
-     140             :       {        -42, "LQ_c~" },
-     141             :       {         43, "Xu^0" },
-     142             :       {         44, "Xu^+" },
-     143             :       {        -44, "Xu^-" },
-     144             :       {         51, "H_L^0" },
-     145             :       {         52, "H_1^++" },
-     146             :       {        -52, "H_1^--" },
-     147             :       {         53, "H_2^+" },
-     148             :       {        -53, "H_2^-" },
-     149             :       {         54, "H_2^++" },
-     150             :       {        -54, "H_2^--" },
-     151             :       {         55, "H_4^0" },
-     152             :       {        -55, "H_4~^0" },
-     153             :       {         81, "generator-specific+81" },
-     154             :       {         82, "generator-specific+82" },
-     155             :       {         83, "generator-specific+83" },
-     156             :       {         84, "generator-specific+84" },
-     157             :       {         85, "generator-specific+85" },
-     158             :       {         86, "generator-specific+86" },
-     159             :       {         87, "generator-specific+87" },
-     160             :       {         88, "generator-specific+88" },
-     161             :       {         89, "generator-specific+89" },
-     162             :       {         90, "generator-specific+90" },
-     163             :       {         91, "generator-specific+91" },
-     164             :       {         92, "generator-specific+92" },
-     165             :       {         93, "generator-specific+93" },
-     166             :       {         94, "generator-specific+94" },
-     167             :       {         95, "generator-specific+95" },
-     168             :       {         96, "generator-specific+96" },
-     169             :       {         97, "generator-specific+97" },
-     170             :       {         98, "generator-specific+98" },
-     171             :       {         99, "generator-specific+99" },
-     172             :       {        -81, "generator-specific-81" },
-     173             :       {        -82, "generator-specific-82" },
-     174             :       {        -83, "generator-specific-83" },
-     175             :       {        -84, "generator-specific-84" },
-     176             :       {        -85, "generator-specific-85" },
-     177             :       {        -86, "generator-specific-86" },
-     178             :       {        -87, "generator-specific-87" },
-     179             :       {        -88, "generator-specific-88" },
-     180             :       {        -89, "generator-specific-89" },
-     181             :       {        -90, "generator-specific-90" },
-     182             :       {        -91, "generator-specific-91" },
-     183             :       {        -92, "generator-specific-92" },
-     184             :       {        -93, "generator-specific-93" },
-     185             :       {        -94, "generator-specific-94" },
-     186             :       {        -95, "generator-specific-95" },
-     187             :       {        -96, "generator-specific-96" },
-     188             :       {        -97, "generator-specific-97" },
-     189             :       {        -98, "generator-specific-98" },
-     190             :       {        -99, "generator-specific-99" },
-     191             :       {        100, "generator-specific+100" },
-     192             :       {       -100, "generator-specific-100" },
-     193             :       {        101, "geantino" },
-     194             :       {        102, "charged-geantino" },
-     195             :       {        110, "reggeon" },
-     196             :       {        130, "K_L^0" },
-     197             :       {        310, "K_S^0" },
-     198             :       {        990, "pomeron" },
-     199             :       {       9990, "odderon" },
-     200             :       {    1000001, "susy-d_L" },
-     201             :       {   -1000001, "susy-d_L~" },
-     202             :       {    1000002, "susy-u_L" },
-     203             :       {   -1000002, "susy-u_L~" },
-     204             :       {    1000003, "susy-s_L" },
-     205             :       {   -1000003, "susy-s_L~" },
-     206             :       {    1000004, "susy-c_L" },
-     207             :       {   -1000004, "susy-c_L~" },
-     208             :       {    1000005, "susy-b_1" },
-     209             :       {   -1000005, "susy-b_1~" },
-     210             :       {    1000006, "susy-t_1" },
-     211             :       {   -1000006, "susy-t_1~" },
-     212             :       {    1000011, "susy-e_L^-" },
-     213             :       {   -1000011, "susy-e_L^+" },
-     214             :       {    1000012, "susy-nu_eL" },
-     215             :       {   -1000012, "susy-nu_eL~" },
-     216             :       {    1000013, "susy-mu_L^-" },
-     217             :       {   -1000013, "susy-mu_L^+" },
-     218             :       {    1000014, "susy-nu_muL" },
-     219             :       {   -1000014, "susy-nu_muL~" },
-     220             :       {    1000015, "susy-tau_L^-" },
-     221             :       {   -1000015, "susy-tau_L^+" },
-     222             :       {    1000016, "susy-nu_tauL" },
-     223             :       {   -1000016, "susy-nu_tauL~" },
-     224             :       {    1000021, "gluino" },
-     225             :       {    1000022, "susy-chi_1^0" },
-     226             :       {    1000023, "susy-chi_2^0" },
-     227             :       {    1000024, "susy-chi_1^+" },
-     228             :       {   -1000024, "susy-chi_1^-" },
-     229             :       {    1000025, "susy-chi_3^0" },
-     230             :       {    1000035, "susy-chi_4^0" },
-     231             :       {    1000037, "susy-chi_2^+" },
-     232             :       {   -1000037, "susy-chi_2^-" },
-     233             :       {    1000039, "gravitino" },
-     234             :       {    2000001, "susy-d_R" },
-     235             :       {   -2000001, "susy-d_R~" },
-     236             :       {    2000002, "susy-u_R" },
-     237             :       {   -2000002, "susy-u_R~" },
-     238             :       {    2000003, "susy-s_R" },
-     239             :       {   -2000003, "susy-s_R~" },
-     240             :       {    2000004, "susy-c_R" },
-     241             :       {   -2000004, "susy-c_R~" },
-     242             :       {    2000005, "susy-b_R" },
-     243             :       {   -2000005, "susy-b_R~" },
-     244             :       {    2000006, "susy-t_R" },
-     245             :       {   -2000006, "susy-t_R~" },
-     246             :       {    2000011, "susy-e_R^-" },
-     247             :       {   -2000011, "susy-e_R^+" },
-     248             :       {    2000012, "susy-nu_eR" },
-     249             :       {   -2000012, "susy-nu_eR~" },
-     250             :       {    2000013, "susy-mu_R^-" },
-     251             :       {   -2000013, "susy-mu_R^+" },
-     252             :       {    2000014, "susy-nu_muR" },
-     253             :       {   -2000014, "susy-nu_muR~" },
-     254             :       {    2000015, "susy-tau_R^-" },
-     255             :       {   -2000015, "susy-tau_R^+" },
-     256             :       {    2000016, "susy-nu_tauR" },
-     257             :       {   -2000016, "susy-nu_tauR~" },
-     258             :       {    3100021, "V8_tech" },
-     259             :       {   -3100021, "V8_tech~" },
-     260             :       {    3000111, "pi_tech^0" },
-     261             :       {    3000115, "a_tech^0" },
-     262             :       {    3060111, "pi_tech_22_1" },
-     263             :       {    3160111, "pi_tech_22_8" },
-     264             :       {    3000113, "rho_tech^0" },
-     265             :       {    3130113, "rho_tech_11" },
-     266             :       {    3140113, "rho_tech_12" },
-     267             :       {    3150113, "rho_tech_21" },
-     268             :       {    3160113, "rho_tech_22" },
-     269             :       {    3000211, "pi_tech^+" },
-     270             :       {   -3000211, "pi_tech^-" },
-     271             :       {    3000213, "rho_tech^+" },
-     272             :       {   -3000213, "rho_tech^-" },
-     273             :       {    3000215, "a_tech^+" },
-     274             :       {   -3000215, "a_tech^-" },
-     275             :       {    3000221, "pi'_tech" },
-     276             :       {    3100221, "eta_tech" },
-     277             :       {    3000223, "omega_tech" },
-     278             :       {    4000001, "d*" },
-     279             :       {   -4000001, "d*~" },
-     280             :       {    4000002, "u*" },
-     281             :       {   -4000002, "u*~" },
-     282             :       {    4000011, "e*^-" },
-     283             :       {   -4000011, "e*^+" },
-     284             :       {    4000012, "nu*_e" },
-     285             :       {   -4000012, "nu*_e~" },
-     286             :       {    4000039, "G*" },
-     287             :       {   -4000039, "G*~" },
-     288             :       {    5000040, "black_hole" },
-     289             :       {    5100001, "d_L^(1)" },
-     290             :       {   -5100001, "d~_L^(1)" },
-     291             :       {    5100002, "u_L^(1)" },
-     292             :       {   -5100002, "u~_L^(1)" },
-     293             :       {    5100003, "s_L^(1)" },
-     294             :       {   -5100003, "s~_L^(1)" },
-     295             :       {    5100004, "c_L^(1)" },
-     296             :       {   -5100004, "c~_L^(1)" },
-     297             :       {    5100005, "b_L^(1)" },
-     298             :       {   -5100005, "b~_L^(1)" },
-     299             :       {    5100006, "t_L^(1)" },
-     300             :       {   -5100006, "t~_L^(1)" },
-     301             :       {    5100011, "e_L^(1)-" },
-     302             :       {   -5100011, "e_L^(1)+" },
-     303             :       {    5100012, "nu_eL^(1)" },
-     304             :       {   -5100012, "nu_eL~^(1)" },
-     305             :       {    5100013, "mu_L^(1)-" },
-     306             :       {   -5100013, "mu_L^(1)+" },
-     307             :       {    5100014, "nu_muL^(1)" },
-     308             :       {   -5100014, "nu_muL~^(1)" },
-     309             :       {    5100015, "tau_L^(1)-" },
-     310             :       {   -5100015, "tau_L^(1)+" },
-     311             :       {    5100016, "nu_tauL^(1)" },
-     312             :       {   -5100016, "nu_tauL~^(1)" },
-     313             :       {    6100001, "d_R^(1)" },
-     314             :       {   -6100001, "d~_R^(1)" },
-     315             :       {    6100002, "u_R^(1)" },
-     316             :       {   -6100002, "u~_R^(1)" },
-     317             :       {    6100003, "s_R^(1)" },
-     318             :       {   -6100003, "s~_R^(1)" },
-     319             :       {    6100004, "c_R^(1)" },
-     320             :       {   -6100004, "c~_R^(1)" },
-     321             :       {    6100005, "b_R^(1)" },
-     322             :       {   -6100005, "b~_R^(1)" },
-     323             :       {    6100006, "t_R^(1)" },
-     324             :       {   -6100006, "t~_R^(1)" },
-     325             :       {    6100011, "e_R^(1)-" },
-     326             :       {   -6100011, "e_R^(1)+" },
-     327             :       {    6100012, "nu_eR^(1)" },
-     328             :       {   -6100012, "nu_eR~^(1)" },
-     329             :       {    6100013, "mu_R^(1)-" },
-     330             :       {   -6100013, "mu_R^(1)+" },
-     331             :       {    6100014, "nu_muR^(1)" },
-     332             :       {   -6100014, "nu_muR~^(1)" },
-     333             :       {    6100015, "tau_R^(1)-" },
-     334             :       {   -6100015, "tau_R^(1)+" },
-     335             :       {    6100016, "nu_tauR^(1)" },
-     336             :       {   -6100016, "nu_tauR~^(1)" },
-     337             :       {    5100021, "g^(1)" },
-     338             :       {    5100022, "gamma^(1)" },
-     339             :       {    5100023, "Z^(1)0" },
-     340             :       {    5100024, "W^(1)+" },
-     341             :       {   -5100024, "W^(1)-" },
-     342             :       {    5100025, "h^(1)0" },
-     343             :       {    5100039, "G^(1)" },
-     344             :       {    9900012, "nu_Re" },
-     345             :       {   -9900012, "nu_Re~" },
-     346             :       {    9900014, "nu_Rmu" },
-     347             :       {   -9900014, "nu_Rmu~" },
-     348             :       {    9900016, "nu_Rtau" },
-     349             :       {   -9900016, "nu_Rtau~" },
-     350             :       {    9900023, "Z_R^0" },
-     351             :       {   -9900023, "Z_R~^0" },
-     352             :       {    9900024, "W_R^+" },
-     353             :       {   -9900024, "W_R^-" },
-     354             :       {    9900041, "H_L^++" },
-     355             :       {   -9900041, "H_L^--" },
-     356             :       {    9900042, "H_R^++" },
-     357             :       {   -9900042, "H_R^--" },
-     358             :       {    9910113, "rho_diffr^0" },
-     359             :       {    9910211, "pi_diffr^+" },
-     360             :       {   -9910211, "pi_diffr^-" },
-     361             :       {    9910223, "omega_diffr" },
-     362             :       {    9910333, "phi_diffr" },
-     363             :       {    9910443, "psi_diffr" },
-     364             :       {    9912112, "n_diffr^0" },
-     365             :       {   -9912112, "n_diffr~^0" },
-     366             :       {    9912212, "p_diffr^+" },
-     367             :       {   -9912212, "p_diffr~^-" },
-     368             :       {    9920022, "remnant photon" },
-     369             :       {    9922212, "remnant nucleon" },
-     370             :       {   -9922212, "remnant nucleon~" },
-     371             :       {    9900441, "cc~[1S08]" },     
-     372             :       {    9910441, "cc~[3P08]" },     
-     373             :       {    9900443, "cc~[3S18]" },     
-     374             :       {    9900551, "bb~[1S08]" },     
-     375             :       {    9910551, "bb~[3P08]" },     
-     376             :       {    9900553, "bb~[3S18]" },    
-     377             :       {       1103, "dd_1" },
-     378             :       {      -1103, "dd_1~" },
-     379             :       {       2101, "ud_0" },
-     380             :       {      -2101, "ud_0~" },
-     381             :       {       2103, "ud_1" },
-     382             :       {      -2103, "ud_1~" },
-     383             :       {       2203, "uu_1" },
-     384             :       {      -2203, "uu_1~" },
-     385             :       {       3101, "sd_0" },
-     386             :       {      -3101, "sd_0~" },
-     387             :       {       3103, "sd_1" },
-     388             :       {      -3103, "sd_1~" },
-     389             :       {       3201, "su_0" },
-     390             :       {      -3201, "su_0~" },
-     391             :       {       3203, "su_1" },
-     392             :       {      -3203, "su_1~" },
-     393             :       {       3303, "ss_1" },
-     394             :       {      -3303, "ss_1~" },
-     395             :       {       4101, "cd_0" },
-     396             :       {      -4101, "cd_0~" },
-     397             :       {       4103, "cd_1" },
-     398             :       {      -4103, "cd_1~" },
-     399             :       {       4201, "cu_0" },
-     400             :       {      -4201, "cu_0~" },
-     401             :       {       4203, "cu_1" },
-     402             :       {      -4203, "cu_1~" },
-     403             :       {       4301, "cs_0" },
-     404             :       {      -4301, "cs_0~" },
-     405             :       {       4303, "cs_1" },
-     406             :       {      -4303, "cs_1~" },
-     407             :       {       4403, "cc_1" },
-     408             :       {      -4403, "cc_1~" },
-     409             :       {       5101, "bd_0" },
-     410             :       {      -5101, "bd_0~" },
-     411             :       {       5103, "bd_1" },
-     412             :       {      -5103, "bd_1~" },
-     413             :       {       5201, "bu_0" },
-     414             :       {      -5201, "bu_0~" },
-     415             :       {       5203, "bu_1" },
-     416             :       {      -5203, "bu_1~" },
-     417             :       {       5301, "bs_0" },
-     418             :       {      -5301, "bs_0~" },
-     419             :       {       5303, "bs_1" },
-     420             :       {      -5303, "bs_1~" },
-     421             :       {       5401, "bc_0" },
-     422             :       {      -5401, "bc_0~" },
-     423             :       {       5403, "bc_1" },
-     424             :       {      -5403, "bc_1~" },
-     425             :       {       5503, "bb_1" },
-     426             :       {      -5503, "bb_1~" },
-     427             :       {       6101, "td_0" },
-     428             :       {      -6101, "td_0~" },
-     429             :       {       6103, "td_1" },
-     430             :       {      -6103, "td_1~" },
-     431             :       {       6201, "tu_0" },
-     432             :       {      -6201, "tu_0~" },
-     433             :       {       6203, "tu_1" },
-     434             :       {      -6203, "tu_1~" },
-     435             :       {       6301, "ts_0" },
-     436             :       {      -6301, "ts_0~" },
-     437             :       {       6303, "ts_1" },
-     438             :       {      -6303, "ts_1~" },
-     439             :       {       6401, "tc_0" },
-     440             :       {      -6401, "tc_0~" },
-     441             :       {       6403, "tc_1" },
-     442             :       {      -6403, "tc_1~" },
-     443             :       {       6501, "tb_0" },
-     444             :       {      -6501, "tb_0~" },
-     445             :       {       6503, "tb_1" },
-     446             :       {      -6503, "tb_1~" },
-     447             :       {       6603, "tt_1" },
-     448             :       {      -6603, "tt_1~" },
-     449             :       {       7101, "b'd_0" },
-     450             :       {      -7101, "b'd_0~" },
-     451             :       {       7103, "b'd_1" },
-     452             :       {      -7103, "b'd_1~" },
-     453             :       {       7201, "b'u_0" },
-     454             :       {      -7201, "b'u_0~" },
-     455             :       {       7203, "b'u_1" },
-     456             :       {      -7203, "b'u_1~" },
-     457             :       {       7301, "b's_0" },
-     458             :       {      -7301, "b's_0~" },
-     459             :       {       7303, "b's_1" },
-     460             :       {      -7303, "b's_1~" },
-     461             :       {       7401, "b'c_0" },
-     462             :       {      -7401, "b'c_0~" },
-     463             :       {       7403, "b'c_1" },
-     464             :       {      -7403, "b'c_1~" },
-     465             :       {       7501, "b'b_0" },
-     466             :       {      -7501, "b'b_0~" },
-     467             :       {       7503, "b'b_1" },
-     468             :       {      -7503, "b'b_1~" },
-     469             :       {       7601, "b't_0" },
-     470             :       {      -7601, "b't_0~" },
-     471             :       {       7603, "b't_1" },
-     472             :       {      -7603, "b't_1~" },
-     473             :       {       7703, "b'b'_1" },
-     474             :       {      -7703, "b'b'_1~" },
-     475             :       {       8101, "t'd_0" },
-     476             :       {      -8101, "t'd_0~" },
-     477             :       {       8103, "t'd_1" },
-     478             :       {      -8103, "t'd_1~" },
-     479             :       {       8201, "t'u_0" },
-     480             :       {      -8201, "t'u_0~" },
-     481             :       {       8203, "t'u_1" },
-     482             :       {      -8203, "t'u_1~" },
-     483             :       {       8301, "t's_0" },
-     484             :       {      -8301, "t's_0~" },
-     485             :       {       8303, "t's_1" },
-     486             :       {      -8303, "t's_1~" },
-     487             :       {       8401, "t'c_0" },
-     488             :       {      -8401, "t'c_0~" },
-     489             :       {       8403, "t'c_1" },
-     490             :       {      -8403, "t'c_1~" },
-     491             :       {       8501, "t'b_0" },
-     492             :       {      -8501, "t'b_0~" },
-     493             :       {       8503, "t'b_1" },
-     494             :       {      -8503, "t'b_1~" },
-     495             :       {       8601, "t't_0" },
-     496             :       {      -8601, "t't_0~" },
-     497             :       {       8603, "t't_1" },
-     498             :       {      -8603, "t't_1~" },
-     499             :       {       8701, "t'b'_0" },
-     500             :       {      -8701, "t'b'_0~" },
-     501             :       {       8703, "t'b'_1" },
-     502             :       {      -8703, "t'b'_1~" },
-     503             :       {       8803, "t't'_1" },
-     504             :       {      -8803, "t't'_1~" },
-     505             :       {        111, "pi^0" },
-     506             :       {    9000111, "a_0(980)^0" },
-     507             :       {      10111, "a_0(1450)^0" },
-     508             :       {     100111, "pi(1300)^0" },
-     509             :       {    9010111, "pi(1800)^0" },
-     510             :       {        113, "rho(770)^0" },
-     511             :       {      10113, "b_1(1235)^0" },
-     512             :       {      20113, "a_1(1260)^0" },
-     513             :       {    9000113, "pi_1(1400)^0" },
-     514             :       {     100113, "rho(1450)^0" },
-     515             :       {    9010113, "pi_1(1600)^0" },
-     516             :       {    9020113, "a_1(1640)^0" },
-     517             :       {      30113, "rho(1700)^0" },
-     518             :       {    9030113, "rho(1900)^0" },
-     519             :       {    9040113, "rho(2150)^0" },
-     520             :       {        115, "a_2(1320)^0" },
-     521             :       {      10115, "pi_2(1670)^0" },
-     522             :       {    9000115, "a_2(1700)^0" },
-     523             :       {    9010115, "pi_2(2100)^0" },
-     524             :       {        117, "rho_3(1690)^0" },
-     525             :       {    9000117, "rho_3(1990)^0" },
-     526             :       {    9010117, "rho_3(2250)^0" },
-     527             :       {        119, "a_4(2040)^0" },
-     528             :       {        211, "pi^+" },
-     529             :       {       -211, "pi^-" },
-     530             :       {    9000211, "a_0(980)^+" },
-     531             :       {   -9000211, "a_0(980)^-" },
-     532             :       {      10211, "a_0(1450)^+" },
-     533             :       {     -10211, "a_0(1450)^-" },
-     534             :       {     100211, "pi(1300)^+" },
-     535             :       {    -100211, "pi(1300)^-" },
-     536             :       {    9010211, "pi(1800)^+" },
-     537             :       {   -9010211, "pi(1800)^-" },
-     538             :       {        213, "rho(770)^+" },
-     539             :       {       -213, "rho(770)^-" },
-     540             :       {      10213, "b_1(1235)^+" },
-     541             :       {     -10213, "b_1(1235)^-" },
-     542             :       {      20213, "a_1(1260)^+" },
-     543             :       {     -20213, "a_1(1260)^-" },
-     544             :       {    9000213, "pi_1(1400)^+" },
-     545             :       {   -9000213, "pi_1(1400)^-" },
-     546             :       {     100213, "rho(1450)^+" },
-     547             :       {    -100213, "rho(1450)^-" },
-     548             :       {    9010213, "pi_1(1600)^+" },
-     549             :       {   -9010213, "pi_1(1600)^-" },
-     550             :       {    9020213, "a_1(1640)^+" },
-     551             :       {   -9020213, "a_1(1640)^-" },
-     552             :       {      30213, "rho(1700)^+" },
-     553             :       {     -30213, "rho(1700)^-" },
-     554             :       {    9030213, "rho(1900)^+" },
-     555             :       {   -9030213, "rho(1900)^-" },
-     556             :       {    9040213, "rho(2150)^+" },
-     557             :       {   -9040213, "rho(2150)^-" },
-     558             :       {        215, "a_2(1320)^+" },
-     559             :       {       -215, "a_2(1320)^-" },
-     560             :       {      10215, "pi_2(1670)^+" },
-     561             :       {     -10215, "pi_2(1670)^-" },
-     562             :       {    9000215, "a_2(1700)^+" },
-     563             :       {   -9000215, "a_2(1700)^-" },
-     564             :       {    9010215, "pi_2(2100)^+" },
-     565             :       {   -9010215, "pi_2(2100)^-" },
-     566             :       {        217, "rho_3(1690)^+" },
-     567             :       {       -217, "rho_3(1690)^-" },
-     568             :       {    9000217, "rho_3(1990)^+" },
-     569             :       {   -9000217, "rho_3(1990)^-" },
-     570             :       {    9010217, "rho_3(2250)^+" },
-     571             :       {   -9010217, "rho_3(2250)^-" },
-     572             :       {        219, "a_4(2040)^+" },
-     573             :       {       -219, "a_4(2040)^-" },
-     574             :       {        221, "eta" },
-     575             :       {    9000221, "f_0(600)" },
-     576             :       {      10221, "f_0(1370)" },
-     577             :       {    9010221, "f_0(980)" },
-     578             :       {    9020221, "eta(1405)" },
-     579             :       {    9030221, "f_0(1500)" },
-     580             :       {    9040221, "eta(1760)" },
-     581             :       {    9050221, "f_0(2020)" },
-     582             :       {    9060221, "f_0(2100)" },
-     583             :       {    9070221, "f_0(2200)" },
-     584             :       {    9080221, "eta(2225)" },
-     585             :       {    9090221, "sigma_0" },
-     586             :       {     100221, "eta(1295)" },
-     587             :       {        331, "eta'(958)" },
-     588             :       {      10331, "f_0(1710)" },
-     589             :       {     100331, "eta(1475)" },
-     590             :       {        223, "omega(782)" },
-     591             :       {    9000223, "f_1(1510)" },
-     592             :       {    9010223, "h_1(1595)" },
-     593             :       {      10223, "h_1(1170)" },
-     594             :       {      20223, "f_1(1285)" },
-     595             :       {      30223, "omega(1650)" },
-     596             :       {     100223, "omega(1420)" },
-     597             :       {        333, "phi(1020)" },
-     598             :       {      10333, "h_1(1380)" },
-     599             :       {      20333, "f_1(1420)" },
-     600             :       {     100333, "phi(1680)" },
-     601             :       {        225, "f_2(1270)" },
-     602             :       {    9000225, "f_2(1430)" },
-     603             :       {      10225, "eta_2(1645)" },
-     604             :       {    9010225, "f_2(1565)" },
-     605             :       {    9020225, "f_2(1640)" },
-     606             :       {    9030225, "f_2(1810)" },
-     607             :       {    9040225, "f_2(1910)" },
-     608             :       {    9050225, "f_2(1950)" },
-     609             :       {    9060225, "f_2(2010)" },
-     610             :       {    9070225, "f_2(2150)" },
-     611             :       {    9080225, "f_2(2300)" },
-     612             :       {    9090225, "f_2(2340)" },
-     613             :       {        335, "f'_2(1525)" },
-     614             :       {      10335, "eta_2(1870)" },
-     615             :       {        227, "omega_3(1670)" },
-     616             :       {        337, "phi_3(1850)" },
-     617             :       {        229, "f_4(2050)" },
-     618             :       {    9000229, "f_J(2220)" },
-     619             :       {    9010229, "f_4(2300)" },
-     620             :       {        311, "K^0" },
-     621             :       {       -311, "K~^0" },
-     622             :       {    9000311, "K*_0(800)^0" },
-     623             :       {   -9000311, "K*_0(800)~^0" },
-     624             :       {      10311, "K*_0(1430)^0" },
-     625             :       {     -10311, "K*_0(1430)~^0" },
-     626             :       {     100311, "K(1460)^0" },
-     627             :       {    -100311, "K(1460)~^0" },
-     628             :       {    9010311, "K(1830)^0" },
-     629             :       {   -9010311, "K(1830)~^0" },
-     630             :       {    9020311, "K*_0(1950)^0" },
-     631             :       {   -9020311, "K*_0(1950)~^0" },
-     632             :       {        321, "K^+" },
-     633             :       {       -321, "K^-" },
-     634             :       {    9000321, "K*_0(800)^+" },
-     635             :       {   -9000321, "K*_0(800)^-" },
-     636             :       {      10321, "K*_0(1430)^+" },
-     637             :       {     -10321, "K*_0(1430)^-" },
-     638             :       {     100321, "K(1460)^+" },
-     639             :       {    -100321, "K(1460)^-" },
-     640             :       {    9010321, "K(1830)^+" },
-     641             :       {   -9010321, "K(1830)^-" },
-     642             :       {    9020321, "K*_0(1950)^+" },
-     643             :       {   -9020321, "K*_0(1950)^-" },
-     644             :       {        313, "K*(892)^0" },
-     645             :       {       -313, "K*(892)~^0" },
-     646             :       {      10313, "K_1(1270)^0" },
-     647             :       {     -10313, "K_1(1270)~^0" },
-     648             :       {      20313, "K_1(1400)^0" },
-     649             :       {     -20313, "K_1(1400)~^0" },
-     650             :       {      30313, "K*(1680)^0" },
-     651             :       {     -30313, "K*(1680)~^0" },
-     652             :       {     100313, "K*(1410)^0" },
-     653             :       {    -100313, "K*(1410)~^0" },
-     654             :       {    9000313, "K_1(1650)^0" },
-     655             :       {   -9000313, "K_1(1650)~^0" },
-     656             :       {        323, "K*(892)^+" },
-     657             :       {       -323, "K*(892)^-" },
-     658             :       {      10323, "K_1(1270)^+" },
-     659             :       {     -10323, "K_1(1270)^-" },
-     660             :       {      20323, "K_1(1400)^+" },
-     661             :       {     -20323, "K_1(1400)^-" },
-     662             :       {      30323, "K*(1680)^+" },
-     663             :       {     -30323, "K*(1680)^-" },
-     664             :       {     100323, "K*(1410)^+" },
-     665             :       {    -100323, "K*(1410)^-" },
-     666             :       {    9000323, "K_1(1650)^+" },
-     667             :       {   -9000323, "K_1(1650)^-" },
-     668             :       {        315, "K*_2(1430)^0" },
-     669             :       {       -315, "K*_2(1430)~^0" },
-     670             :       {    9000315, "K_2(1580)^0" },
-     671             :       {   -9000315, "K_2(1580)~^0" },
-     672             :       {      10315, "K_2(1770)^0" },
-     673             :       {     -10315, "K_2(1770)~^0" },
-     674             :       {    9010315, "K*_2(1980)^0" },
-     675             :       {   -9010315, "K*_2(1980)~^0" },
-     676             :       {    9020315, "K_2(2250)^0" },
-     677             :       {   -9020315, "K_2(2250)~^0" },
-     678             :       {      20315, "K_2(1820)^0" },
-     679             :       {     -20315, "K_2(1820)~^0" },
-     680             :       {        325, "K*_2(1430)^+" },
-     681             :       {       -325, "K*_2(1430)^-" },
-     682             :       {    9000325, "K_2(1580)^+" },
-     683             :       {   -9000325, "K_2(1580)^-" },
-     684             :       {      10325, "K_2(1770)^+" },
-     685             :       {     -10325, "K_2(1770)^-" },
-     686             :       {    9010325, "K*_2(1980)^+" },
-     687             :       {   -9010325, "K*_2(1980)^-" },
-     688             :       {    9020325, "K_2(2250)^+" },
-     689             :       {   -9020325, "K_2(2250)^-" },
-     690             :       {      20325, "K_2(1820)^+" },
-     691             :       {     -20325, "K_2(1820)^-" },
-     692             :       {     100325, "K_2(1980)^+" },
-     693             :       {    -100325, "K_2(1980)^-" },
-     694             :       {        317, "K*_3(1780)^0" },
-     695             :       {       -317, "K*_3(1780)~^0" },
-     696             :       {    9010317, "K_3(2320)^0" },
-     697             :       {   -9010317, "K_3(2320)~^0" },
-     698             :       {        327, "K*_3(1780)^+" },
-     699             :       {       -327, "K*_3(1780)^-" },
-     700             :       {    9010327, "K_3(2320)^+" },
-     701             :       {   -9010327, "K_3(2320)^-" },
-     702             :       {        319, "K*_4(2045)^0" },
-     703             :       {       -319, "K*_4(2045)~^0" },
-     704             :       {    9000319, "K_4(2500)^0" },
-     705             :       {   -9000319, "K_4(2500)~^0" },
-     706             :       {        329, "K*_4(2045)^+" },
-     707             :       {       -329, "K*_4(2045)^-" },
-     708             :       {    9000329, "K_4(2500)^+" },
-     709             :       {   -9000329, "K_4(2500)^-" },
-     710             :       {        411, "D^+" },
-     711             :       {       -411, "D^-" },
-     712             :       {      10411, "D*_0(2400)^+" },
-     713             :       {     -10411, "D*_0(2400)^-" },
-     714             :       {     100411, "D(2S)^+" },
-     715             :       {    -100411, "D(2S)^-" },
-     716             :       {        413, "D*(2010)^+" },
-     717             :       {       -413, "D*(2010)^-" },
-     718             :       {      10413, "D_1(2420)^+" },
-     719             :       {     -10413, "D_1(2420)^-" },
-     720             :       {      20413, "D_1(H)^+" },
-     721             :       {     -20413, "D_1(H)^-" },
-     722             :       {     100413, "D*(2S)^+" },
-     723             :       {    -100413, "D*(2S)^-" },
-     724             :       {        415, "D*_2(2460)^+" },
-     725             :       {       -415, "D*_2(2460)^-" },
-     726             :       {        421, "D^0" },
-     727             :       {       -421, "D~^0" },
-     728             :       {      10421, "D*_0(2400)^0" },
-     729             :       {     -10421, "D*_0(2400)~^0" },
-     730             :       {     100421, "D(2S)^0" },
-     731             :       {    -100421, "D(2S)~^0" },
-     732             :       {        423, "D*(2007)^0" },
-     733             :       {       -423, "D*(2007)~^0" },
-     734             :       {      10423, "D_1(2420)^0" },
-     735             :       {     -10423, "D_1(2420)~^0" },
-     736             :       {      20423, "D_1(2430)^0" },
-     737             :       {     -20423, "D_1(2430)~^0" },
-     738             :       {     100423, "D*(2S)^0" },
-     739             :       {    -100423, "D*(2S)~^0" },
-     740             :       {        425, "D*_2(2460)^0" },
-     741             :       {       -425, "D*_2(2460)~^0" },
-     742             :       {        431, "D_s^+" },
-     743             :       {       -431, "D_s^-" },
-     744             :       {      10431, "D*_s0(2317)^+" },
-     745             :       {     -10431, "D*_s0(2317)^-" },
-     746             :       {        433, "D*_s^+" },
-     747             :       {       -433, "D*_s^-" },
-     748             :       {      10433, "D_s1(2536)^+" },
-     749             :       {     -10433, "D_s1(2536)^-" },
-     750             :       {      20433, "D_s1(2460)^+" },
-     751             :       {     -20433, "D_s1(2460)^-" },
-     752             :       {        435, "D*_s2(2573)^+" },
-     753             :       {       -435, "D*_s2(2573)^-" },
-     754             :       {        441, "eta_c(1S)" },
-     755             :       {      10441, "chi_c0(1P)" },
-     756             :       {     100441, "eta_c(2S)" },
-     757             :       {        443, "J/psi(1S)" },
-     758             :       {    9000443, "psi(4040)" },
-     759             :       {      10443, "hc(1P)" },
-     760             :       {    9010443, "psi(4160)" },
-     761             :       {      20443, "chi_c1(1P)" },
-     762             :       {    9020443, "psi(4415)" },
-     763             :       {      30443, "psi(3770)" },
-     764             :       {     100443, "psi(2S)" },
-     765             :       {        445, "chi_c2(1P)" },
-     766             :       {     100445, "chi_c2(2P)" },
-     767             :       {        511, "B^0" },
-     768             :       {       -511, "B~^0" },
-     769             :       {      10511, "B*_0^0" },
-     770             :       {     -10511, "B*_0~^0" },
-     771             :       {        513, "B*^0" },
-     772             :       {       -513, "B*~^0" },
-     773             :       {      10513, "B_1(L)^0" },
-     774             :       {     -10513, "B_1(L)~^0" },
-     775             :       {      20513, "B_1(H)^0" },
-     776             :       {     -20513, "B_1(H)~^0" },
-     777             :       {        515, "B*_2^0" },
-     778             :       {       -515, "B*_2~^0" },
-     779             :       {        521, "B^+" },
-     780             :       {       -521, "B^-" },
-     781             :       {      10521, "B*_0^+" },
-     782             :       {     -10521, "B*_0^-" },
-     783             :       {        523, "B*^+" },
-     784             :       {       -523, "B*^-" },
-     785             :       {      10523, "B_1(L)^+" },
-     786             :       {     -10523, "B_1(L)^-" },
-     787             :       {      20523, "B_1(H)^+" },
-     788             :       {     -20523, "B_1(H)^-" },
-     789             :       {        525, "B*_2^+" },
-     790             :       {       -525, "B*_2^-" },
-     791             :       {        531, "B_s^0" },
-     792             :       {       -531, "B_s~^0" },
-     793             :       {      10531, "B*_s0^0" },
-     794             :       {     -10531, "B*_s0~^0" },
-     795             :       {        533, "B*_s^0" },
-     796             :       {       -533, "B*_s~^0" },
-     797             :       {      10533, "B_s1(L)^0" },
-     798             :       {     -10533, "B_s1(L)~^0" },
-     799             :       {      20533, "B_s1(H)^0" },
-     800             :       {     -20533, "B_s1(H)~^0" },
-     801             :       {        535, "B*_s2^0" },
-     802             :       {       -535, "B*_s2~^0" },
-     803             :       {        541, "B_c^+" },
-     804             :       {       -541, "B_c^-" },
-     805             :       {      10541, "B*_c0^+" },
-     806             :       {     -10541, "B*_c0^-" },
-     807             :       {        543, "B*_c^+" },
-     808             :       {       -543, "B*_c^-" },
-     809             :       {      10543, "B_c1(L)^+" },
-     810             :       {     -10543, "B_c1(L)^-" },
-     811             :       {      20543, "B_c1(H)^+" },
-     812             :       {     -20543, "B_c1(H)^-" },
-     813             :       {        545, "B*_c2^+" },
-     814             :       {       -545, "B*_c2^-" },
-     815             :       {        551, "eta_b(1S)" },
-     816             :       {      10551, "chi_b0(1P)" },
-     817             :       {     100551, "eta_b(2S)" },
-     818             :       {     110551, "chi_b0(2P)" },
-     819             :       {     200551, "eta_b(3S)" },
-     820             :       {     210551, "chi_b0(3P)" },
-     821             :       {        553, "Upsilon(1S)" },
-     822             :       {    9000553, "Upsilon(10860)" },
-     823             :       {      10553, "h_b(1P)" },
-     824             :       {    9010553, "Upsilon(11020)" },
-     825             :       {      20553, "chi_b1(1P)" },
-     826             :       {    9020553, "Upsilon(7S)" },
-     827             :       {      30553, "Upsilon_1(1D)" },
-     828             :       {     100553, "Upsilon(2S)" },
-     829             :       {     110553, "h_b(2P)" },
-     830             :       {     120553, "chi_b1(2P)" },
-     831             :       {     130553, "Upsilon_1(2D)" },
-     832             :       {     200553, "Upsilon(3S)" },
-     833             :       {     210553, "h_b(3P)" },
-     834             :       {     220553, "chi_b1(3P)" },
-     835             :       {     300553, "Upsilon(4S)" },
-     836             :       {        555, "chi_b2(1P)" },
-     837             :       {      10555, "eta_b2(1D)" },
-     838             :       {      20555, "Upsilon_2(1D)" },
-     839             :       {     100555, "chi_b2(2P)" },
-     840             :       {     110555, "eta_b2(2D)" },
-     841             :       {     120555, "Upsilon_2(2D)" },
-     842             :       {     200555, "chi_b2(3P)" },
-     843             :       {        557, "Upsilon_3(1D)" },
-     844             :       {     100557, "Upsilon_3(2D)" },
-     845             :       {        611, "T^+" },
-     846             :       {       -611, "T^-" },
-     847             :       {        613, "T*^+" },
-     848             :       {       -613, "T*^-" },
-     849             :       {        621, "T^0" },
-     850             :       {       -621, "T~^0" },
-     851             :       {        623, "T*^0" },
-     852             :       {       -623, "T*~^0" },
-     853             :       {        631, "T_s^+" },
-     854             :       {       -631, "T_s^-" },
-     855             :       {        633, "T*_s^+" },
-     856             :       {       -633, "T*_s^-" },
-     857             :       {        641, "T_c^0" },
-     858             :       {       -641, "T_c~^0" },
-     859             :       {        643, "T*_c^0" },
-     860             :       {       -643, "T*_c~^0" },
-     861             :       {        651, "T_b^+" },
-     862             :       {       -651, "T_b^-" },
-     863             :       {        653, "T*_b^+" },
-     864             :       {       -653, "T*_b^-" },
-     865             :       {        661, "eta_t" },
-     866             :       {        663, "theta" },
-     867             :       {        711, "L^0" },
-     868             :       {       -711, "L~^0" },
-     869             :       {        713, "L*^0" },
-     870             :       {       -713, "L*~^0" },
-     871             :       {        721, "L^-" },
-     872             :       {       -721, "L^+" },
-     873             :       {        723, "L*^-" },
-     874             :       {       -723, "L*^+" },
-     875             :       {        731, "L_s^0" },
-     876             :       {       -731, "L_s~^0" },
-     877             :       {        733, "L*_s^0" },
-     878             :       {       -733, "L*_s~^0" },
-     879             :       {        741, "L_c^-" },
-     880             :       {       -741, "L_c^+" },
-     881             :       {        743, "L*_c^-" },
-     882             :       {       -743, "L*_c^+" },
-     883             :       {        751, "L_b^0" },
-     884             :       {       -751, "L_b~^0" },
-     885             :       {        753, "L*_b^0" },
-     886             :       {       -753, "L*_b~^0" },
-     887             :       {        761, "L_t^-" },
-     888             :       {       -761, "L_t^+" },
-     889             :       {        763, "L*_t^-" },
-     890             :       {       -763, "L*_t^+" },
-     891             :       {        771, "eta_l" },
-     892             :       {        773, "theta_l" },
-     893             :       {        811, "X^+" },
-     894             :       {       -811, "X^-" },
-     895             :       {        813, "X*^+" },
-     896             :       {       -813, "X*^-" },
-     897             :       {        821, "X^0" },
-     898             :       {       -821, "X~^0" },
-     899             :       {        823, "X*^0" },
-     900             :       {       -823, "X*~^0" },
-     901             :       {        831, "X_s^+" },
-     902             :       {       -831, "X_s^-" },
-     903             :       {        833, "X*_s^+" },
-     904             :       {       -833, "X*_s^-" },
-     905             :       {        841, "X_c^0" },
-     906             :       {       -841, "X_c~^0" },
-     907             :       {        843, "X*_c^0" },
-     908             :       {       -843, "X*_c~^0" },
-     909             :       {        851, "X_b^+" },
-     910             :       {       -851, "X_b^-" },
-     911             :       {        853, "X*_b^+" },
-     912             :       {       -853, "X*_b^-" },
-     913             :       {        861, "X_t^0" },
-     914             :       {       -861, "X_t~^0" },
-     915             :       {        863, "X*_t^0" },
-     916             :       {       -863, "X*_t~^0" },
-     917             :       {        871, "X_l^+" },
-     918             :       {       -871, "X_l^-" },
-     919             :       {        873, "X*_l^+" },
-     920             :       {       -873, "X*_l^-" },
-     921             :       {        881, "eta_h" },
-     922             :       {        883, "theta_H" },
-     923             :       {      30343, "Xsd" },
-     924             :       {     -30343, "anti-Xsd" },
-     925             :       {      30353, "Xsu" },
-     926             :       {     -30353, "anti-Xsu" },
-     927             :       {      30363, "Xss" },
-     928             :       {     -30363, "anti-Xss" },
-     929             :       {      30373, "Xdd" },
-     930             :       {     -30373, "anti-Xdd" },
-     931             :       {      30383, "Xdu" },
-     932             :       {     -30383, "anti-Xdu" },
-     933             :       {       2112, "n^0" },
-     934             :       {      -2112, "n~^0" },
-     935             :       {       2212, "p^+" },
-     936             :       {      -2212, "p~^-" },
-     937             :     {        12212,        "N(1440)^+"},
-     938             :     {        12112,        "N(1440)^0"},
-     939             :     {        22212,        "N(1535)^+"},
-     940             :     {        22112,        "N(1535)^0"},
-     941             :     {        32212,        "N(1650)^+"},
-     942             :     {        32112,        "N(1650)^0"},
-     943             :     {        42212,        "N(1710)^+"},
-     944             :     {        42112,        "N(1710)^0"},
-     945             :     {         1214,         "N(1520)^0"},
-     946             :     {         2124,         "N(1520)^+"},
-     947             :     {        21214,        "N(1700)^0"},
-     948             :     {        22124,        "N(1700)^+"},
-     949             :     {        31214,        "N(1720)^0"},
-     950             :     {        32124,        "N(1720)^+"},
-     951             :     {         2116,         "N(1675)^0"},
-     952             :     {         2216,         "N(1675)^+"},
-     953             :     {        12116,        "N(1680)^0"},
-     954             :     {        12216,        "N(1680)^+"},
-     955             :     {         1218,         "N(2190)^0"},
-     956             :     {         2128,        "N(2190)^+" },
-     957             :       {       1114, "Delta^-" },
-     958             :       {      -1114, "Delta~^+" },
-     959             :       {       2114, "Delta^0" },
-     960             :       {      -2114, "Delta~^0" },
-     961             :       {       2214, "Delta^+" },
-     962             :       {      -2214, "Delta~^-" },
-     963             :       {       2224, "Delta^++" },
-     964             :       {      -2224, "Delta~^--" },
-     965             :     {        31114,   "Delta(1600)^-"      },
-     966             :     {        32114,   "Delta(1600)^0"      },
-     967             :     {        32214,    "Delta(1600)^+"     },
-     968             :     {        32224,     "Delta(1600)^++"    },
-     969             :     {         1112,    "Delta(1620)^-"     },
-     970             :     {         1212,    "Delta(1620)^0"     },
-     971             :     {         2122,    "Delta(1620)^+"     },
-     972             :     {         2222,     "Delta(1620)^++"    },
-     973             :     {        11114,     "Delta(1700)^-"    },
-     974             :     {        12114,     "Delta(1700)^0"    },
-     975             :     {        12214,     "Delta(1700)^+"    },
-     976             :     {        12224,      "Delta(1700)^++"   },
-     977             :     {         1116,     "Delta(1905)^-"    },
-     978             :     {         1216,     "Delta(1905)^0"    },
-     979             :     {         2126,     "Delta(1905)^+"    },
-     980             :     {         2226,      "Delta(1905)^++"   },
-     981             :     {        21112,    "Delta(1910)^-"    },
-     982             :     {        21212,     "Delta(1910)^0"   },
-     983             :     {        22122,     "Delta(1910)^+"   },
-     984             :     {        22222,     "Delta(1910)^++"   },
-     985             :     {        21114,    "Delta(1920)^-"    },
-     986             :     {        22114,     "Delta(1920)^0"   },
-     987             :     {        22214,     "Delta(1920)^+"   },
-     988             :     {        22224,    "Delta(1920)^++"    },
-     989             :     {        11116,    "Delta(1930)^-"    },
-     990             :     {        11216,     "Delta(1930)^0"   },
-     991             :     {        12126,     "Delta(1930)^+"   },
-     992             :     {        12226,     "Delta(1930)^++"   },
-     993             :     {         1118,     "Delta(1950)^-"    },
-     994             :     {         2118,      "Delta(1950)^0"   },
-     995             :     {         2218,      "Delta(1950)^+"   },
-     996             :     {         2228,     "Delta(1950)^++"    },
-     997             :       {       3122, "Lambda^0" },
-     998             :       {      -3122, "Lambda~^0" },
-     999             :       {      13122, "Lambda(1405)^0" },
-    1000             :       {     -13122, "Lambda~(1405)^0" },
-    1001             :       {      23122, "Lambda(1600)^0" },
-    1002             :       {     -23122, "Lambda~(1600)^0" },
-    1003             :       {      33122, "Lambda(1670)^0" },
-    1004             :       {     -33122, "Lambda~(1670)^0" },
-    1005             :       {      43122, "Lambda(1800)^0" },
-    1006             :       {     -43122, "Lambda~(1800)^0" },
-    1007             :       {      53122, "Lambda(1810)^0" },
-    1008             :       {     -53122, "Lambda~(1810)^0" },
-    1009             :       {       3124, "Lambda(1520)^0" },
-    1010             :       {      -3124, "Lambda~(1520)^0" },
-    1011             :       {      13124, "Lambda(1690)^0" },
-    1012             :       {     -13124, "Lambda~(1690)^0" },
-    1013             :       {      23124, "Lambda(1890)^0" },
-    1014             :       {     -23124, "Lambda~(1890)^0" },
-    1015             :       {       3126, "Lambda(1820)^0" },
-    1016             :       {      -3126, "Lambda~(1820)^0" },
-    1017             :       {      13126, "Lambda(1830)^0" },
-    1018             :       {     -13126, "Lambda~(1830)^0" },
-    1019             :       {      23126, "Lambda(2110)^0" },
-    1020             :       {     -23126, "Lambda~(2110)^0" },
-    1021             :       {       3128, "Lambda(2100)^0" },
-    1022             :       {      -3128, "Lambda~(2100)^0" },
-    1023             :       {       3112, "Sigma^-" },
-    1024             :       {      -3112, "Sigma~^+" },
-    1025             :       {       3212, "Sigma^0" },
-    1026             :       {      -3212, "Sigma~^0" },
-    1027             :       {       3222, "Sigma^+" },
-    1028             :       {      -3222, "Sigma~^-" },
-    1029             :       {      13222, "Sigma(1660)^+" },
-    1030             :       {     -13222, "Sigma~(1660)^+" },
-    1031             :       {      13212, "Sigma(1660)^0" },
-    1032             :       {     -13212, "Sigma~(1660)^0" },
-    1033             :       {      13112, "Sigma(1660)^-" },
-    1034             :       {     -13112, "Sigma~(1660)^-" },
-    1035             :       {      23112, "Sigma(1750)^-" },
-    1036             :       {     -23112, "Sigma~(1750)^-" },
-    1037             :       {      23212, "Sigma(1750)^0" },
-    1038             :       {     -23212, "Sigma~(1750)^0" },
-    1039             :       {      23222, "Sigma(1750)^+" },
-    1040             :       {     -23222, "Sigma~(1750)^+" },
-    1041             :       {       3114, "Sigma*^-" },
-    1042             :       {      -3114, "Sigma*~^+" },
-    1043             :       {       3214, "Sigma*^0" },
-    1044             :       {      -3214, "Sigma*~^0" },
-    1045             :       {       3224, "Sigma*^+" },
-    1046             :       {      -3224, "Sigma*~^-" },
-    1047             :       {      13224, "Sigma(1670)^+" },
-    1048             :       {     -13224, "Sigma~(1670)^+" },
-    1049             :       {      13214, "Sigma(1670)^0" },
-    1050             :       {     -13214, "Sigma~(1670)^0" },
-    1051             :       {      13114, "Sigma(1670)^-" },
-    1052             :       {     -13114, "Sigma~(1670)^-" },
-    1053             :       {      23224, "Sigma(1940)^+" },
-    1054             :       {     -23224, "Sigma~(1940)^+" },
-    1055             :       {      23214, "Sigma(1940)^0" },
-    1056             :       {     -23214, "Sigma~(1940)^0" },
-    1057             :       {      23114, "Sigma(1940)^-" },
-    1058             :       {     -23114, "Sigma~(1940)^-" },
-    1059             :       {       3226, "Sigma(1775)^+" },
-    1060             :       {      -3226, "Sigma~(1775)^+" },
-    1061             :       {       3216, "Sigma(1775)^0" },
-    1062             :       {      -3216, "Sigma~(1775)^0" },
-    1063             :       {       3116, "Sigma(1775)^-" },
-    1064             :       {      -3116, "Sigma~(1775)^-" },
-    1065             :       {      13226, "Sigma(1915)^+" },
-    1066             :       {     -13226, "Sigma~(1915)^+" },
-    1067             :       {      13216, "Sigma(1915)^0" },
-    1068             :       {     -13216, "Sigma~(1915)^0" },
-    1069             :       {      13116, "Sigma(1915)^-" },
-    1070             :       {     -13116, "Sigma~(1915)^-" },
-    1071             :       {       3228, "Sigma(2030)^+" },
-    1072             :       {      -3228, "Sigma~(2030)^+" },
-    1073             :       {       3218, "Sigma(2030)^0" },
-    1074             :       {      -3218, "Sigma~(2030)^0" },
-    1075             :       {       3118, "Sigma(2030)^-" },
-    1076             :       {      -3118, "Sigma~(2030)^-" },
-    1077             :       {       3312, "Xi^-" },
-    1078             :       {      -3312, "Xi~^+" },
-    1079             :       {       3322, "Xi^0" },
-    1080             :       {      -3322, "Xi~^0" },
-    1081             :       {       3314, "Xi*^-" },
-    1082             :       {      -3314, "Xi*~^+" },
-    1083             :       {       3324, "Xi*^0" },
-    1084             :       {      -3324, "Xi*~^0" },
-    1085             :       {      13314, "Xi(1820)^-" },
-    1086             :       {     -13314, "Xi(1820)~^+" },
-    1087             :       {      13324, "Xi(1820)^0" },
-    1088             :       {     -13324, "Xi(1820)~^0" },
-    1089             :       {       3334, "Omega^-" },
-    1090             :       {      -3334, "Omega~^+" },
-    1091             :       {       4112, "Sigma_c^0" },
-    1092             :       {      -4112, "Sigma_c~^0" },
-    1093             :       {       4114, "Sigma*_c^0" },
-    1094             :       {      -4114, "Sigma*_c~^0" },
-    1095             :       {       4122, "Lambda_c^+" },
-    1096             :       {      -4122, "Lambda_c~^-" },
-    1097             :       {      14122, "Lambda_c(2593)^+" },
-    1098             :       {     -14122, "Lambda_c~(2593)^-" },
-    1099             :       {      14124, "Lambda_c(2625)^+" },
-    1100             :       {     -14124, "Lambda_c~(2625)^-" },
-    1101             :       {       4132, "Xi_c^0" },
-    1102             :       {      -4132, "Xi_c~^0" },
-    1103             :       {       4212, "Sigma_c^+" },
-    1104             :       {      -4212, "Sigma_c~^-" },
-    1105             :       {       4214, "Sigma*_c^+" },
-    1106             :       {      -4214, "Sigma*_c~^-" },
-    1107             :       {       4222, "Sigma_c^++" },
-    1108             :       {      -4222, "Sigma_c~^--" },
-    1109             :       {       4224, "Sigma*_c^++" },
-    1110             :       {      -4224, "Sigma*_c~^--" },
-    1111             :       {       4232, "Xi_c^+" },
-    1112             :       {      -4232, "Xi_c~^-" },
-    1113             :       {       4312, "Xi'_c^0" },
-    1114             :       {      -4312, "Xi'_c~^0" },
-    1115             :       {       4314, "Xi*_c^0" },
-    1116             :       {      -4314, "Xi*_c~^0" },
-    1117             :       {       4322, "Xi'_c^+" },
-    1118             :       {      -4322, "Xi'_c~^-" },
-    1119             :       {       4324, "Xi*_c^+" },
-    1120             :       {      -4324, "Xi*_c~^-" },
-    1121             :       {       4332, "Omega_c^0" },
-    1122             :       {      -4332, "Omega_c~^0" },
-    1123             :       {       4334, "Omega*_c^0" },
-    1124             :       {      -4334, "Omega*_c~^0" },
-    1125             :       {       4412, "Xi_cc^+" },
-    1126             :       {      -4412, "Xi_cc~^-" },
-    1127             :       {       4414, "Xi*_cc^+" },
-    1128             :       {      -4414, "Xi*_cc~^-" },
-    1129             :       {       4422, "Xi_cc^++" },
-    1130             :       {      -4422, "Xi_cc~^--" },
-    1131             :       {       4424, "Xi*_cc^++" },
-    1132             :       {      -4424, "Xi*_cc~^--" },
-    1133             :       {       4432, "Omega_cc^+" },
-    1134             :       {      -4432, "Omega_cc~^-" },
-    1135             :       {       4434, "Omega*_cc^+" },
-    1136             :       {      -4434, "Omega*_cc~^-" },
-    1137             :       {       4444, "Omega*_ccc^++" },
-    1138             :       {      -4444, "Omega*_ccc~^--" },
-    1139             :       {       5112, "Sigma_b^-" },
-    1140             :       {      -5112, "Sigma_b~^+" },
-    1141             :       {       5114, "Sigma*_b^-" },
-    1142             :       {      -5114, "Sigma*_b~^+" },
-    1143             :       {       5122, "Lambda_b^0" },
-    1144             :       {      -5122, "Lambda_b~^0" },
-    1145             :       {       5132, "Xi_b^-" },
-    1146             :       {      -5132, "Xi_b~^+" },
-    1147             :       {       5142, "Xi_bc^0" },
-    1148             :       {      -5142, "Xi_bc~^0" },
-    1149             :       {       5212, "Sigma_b^0" },
-    1150             :       {      -5212, "Sigma_b~^0" },
-    1151             :       {       5214, "Sigma*_b^0" },
-    1152             :       {      -5214, "Sigma*_b~^0" },
-    1153             :       {       5222, "Sigma_b^+" },
-    1154             :       {      -5222, "Sigma_b~^-" },
-    1155             :       {       5224, "Sigma*_b^+" },
-    1156             :       {      -5224, "Sigma*_b~^-" },
-    1157             :       {       5232, "Xi_b^0" },
-    1158             :       {      -5232, "Xi_b~^0" },
-    1159             :       {       5242, "Xi_bc^+" },
-    1160             :       {      -5242, "Xi_bc~^-" },
-    1161             :       {       5312, "Xi'_b^-" },
-    1162             :       {      -5312, "Xi'_b~^+" },
-    1163             :       {       5314, "Xi*_b^-" },
-    1164             :       {      -5314, "Xi*_b~^+" },
-    1165             :       {       5322, "Xi'_b^0" },
-    1166             :       {      -5322, "Xi'_b~^0" },
-    1167             :       {       5324, "Xi*_b^0" },
-    1168             :       {      -5324, "Xi*_b~^0" },
-    1169             :       {       5332, "Omega_b^-" },
-    1170             :       {      -5332, "Omega_b~^+" },
-    1171             :       {       5334, "Omega*_b^-" },
-    1172             :       {      -5334, "Omega*_b~^+" },
-    1173             :       {       5342, "Omega_bc^0" },
-    1174             :       {      -5342, "Omega_bc~^0" },
-    1175             :       {       5412, "Xi'_bc^0" },
-    1176             :       {      -5412, "Xi'_bc~^0" },
-    1177             :       {       5414, "Xi*_bc^0" },
-    1178             :       {      -5414, "Xi*_bc~^0" },
-    1179             :       {       5422, "Xi'_bc^+" },
-    1180             :       {      -5422, "Xi'_bc~^-" },
-    1181             :       {       5424, "Xi*_bc^+" },
-    1182             :       {      -5424, "Xi*_bc~^-" },
-    1183             :       {       5432, "Omega'_bc^0" },
-    1184             :       {      -5432, "Omega'_bc~^0" },
-    1185             :       {       5434, "Omega*_bc^0" },
-    1186             :       {      -5434, "Omega*_bc~^0" },
-    1187             :       {       5442, "Omega_bcc^+" },
-    1188             :       {      -5442, "Omega_bcc~^-" },
-    1189             :       {       5444, "Omega*_bcc^+" },
-    1190             :       {      -5444, "Omega*_bcc~^-" },
-    1191             :       {       5512, "Xi_bb^-" },
-    1192             :       {      -5512, "Xi_bb~^+" },
-    1193             :       {       5514, "Xi*_bb^-" },
-    1194             :       {      -5514, "Xi*_bb~^+" },
-    1195             :       {       5522, "Xi_bb^0" },
-    1196             :       {      -5522, "Xi_bb~^0" },
-    1197             :       {       5524, "Xi*_bb^0" },
-    1198             :       {      -5524, "Xi*_bb~^0" },
-    1199             :       {       5532, "Omega_bb^-" },
-    1200             :       {      -5532, "Omega_bb~^+" },
-    1201             :       {       5534, "Omega*_bb^-" },
-    1202             :       {      -5534, "Omega*_bb~^+" },
-    1203             :       {       5542, "Omega_bbc^0" },
-    1204             :       {      -5542, "Omega_bbc~^0" },
-    1205             :       {       5544, "Omega*_bbc^0" },
-    1206             :       {      -5544, "Omega*_bbc~^0" },
-    1207             :       {       5554, "Omega*_bbb^-" },
-    1208             :       {      -5554, "Omega*_bbb~^+" },
-    1209             :       {       6112, "Sigma_t^0" },
-    1210             :       {      -6112, "Sigma_t~^0" },
-    1211             :       {       6114, "Sigma*_t^0" },
-    1212             :       {      -6114, "Sigma*_t~^0" },
-    1213             :       {       6122, "Lambda_t^+" },
-    1214             :       {      -6122, "Lambda_t~^-" },
-    1215             :       {       6132, "Xi_t^0" },
-    1216             :       {      -6132, "Xi_t~^0" },
-    1217             :       {       6142, "Xi_tc^+" },
-    1218             :       {      -6142, "Xi_tc~^-" },
-    1219             :       {       6152, "Xi_tb^0" },
-    1220             :       {      -6152, "Xi_tb~^0" },
-    1221             :       {       6212, "Sigma_t^+" },
-    1222             :       {      -6212, "Sigma_t~^-" },
-    1223             :       {       6214, "Sigma*_t^+" },
-    1224             :       {      -6214, "Sigma*_t~^-" },
-    1225             :       {       6222, "Sigma_t^++" },
-    1226             :       {      -6222, "Sigma_t~^--" },
-    1227             :       {       6224, "Sigma*_t^++" },
-    1228             :       {      -6224, "Sigma*_t~^--" },
-    1229             :       {       6232, "Xi_t^+" },
-    1230             :       {      -6232, "Xi_t~^-" },
-    1231             :       {       6242, "Xi_tc^++" },
-    1232             :       {      -6242, "Xi_tc~^--" },
-    1233             :       {       6252, "Xi_tb^+" },
-    1234             :       {      -6252, "Xi_tb~^-" },
-    1235             :       {       6312, "Xi'_t^0" },
-    1236             :       {      -6312, "Xi'_t~^0" },
-    1237             :       {       6314, "Xi*_t^0" },
-    1238             :       {      -6314, "Xi*_t~^0" },
-    1239             :       {       6322, "Xi'_t^+" },
-    1240             :       {      -6322, "Xi'_t~^-" },
-    1241             :       {       6324, "Xi*_t^+" },
-    1242             :       {      -6324, "Xi*_t~^-" },
-    1243             :       {       6332, "Omega_t^0" },
-    1244             :       {      -6332, "Omega_t~^0" },
-    1245             :       {       6334, "Omega*_t^0" },
-    1246             :       {      -6334, "Omega*_t~^0" },
-    1247             :       {       6342, "Omega_tc^+" },
-    1248             :       {      -6342, "Omega_tc~^-" },
-    1249             :       {       6352, "Omega_tb^0" },
-    1250             :       {      -6352, "Omega_tb~^0" },
-    1251             :       {       6412, "Xi'_tc^+" },
-    1252             :       {      -6412, "Xi'_tc~^-" },
-    1253             :       {       6414, "Xi*_tc^+" },
-    1254             :       {      -6414, "Xi*_tc~^-" },
-    1255             :       {       6422, "Xi'_tc^++" },
-    1256             :       {      -6422, "Xi'_tc~^--" },
-    1257             :       {       6424, "Xi*_tc^++" },
-    1258             :       {      -6424, "Xi*_tc~^--" },
-    1259             :       {       6432, "Omega'_tc^+" },
-    1260             :       {      -6432, "Omega'_tc~^-" },
-    1261             :       {       6434, "Omega*_tc^+" },
-    1262             :       {      -6434, "Omega*_tc~^-" },
-    1263             :       {       6442, "Omega_tcc^++" },
-    1264             :       {      -6442, "Omega_tcc~^--" },
-    1265             :       {       6444, "Omega*_tcc^++" },
-    1266             :       {      -6444, "Omega*_tcc~^--" },
-    1267             :       {       6452, "Omega_tbc^+" },
-    1268             :       {      -6452, "Omega_tbc~^-" },
-    1269             :       {       6512, "Xi'_tb^0" },
-    1270             :       {      -6512, "Xi'_tb~^0" },
-    1271             :       {       6514, "Xi*_tb^0" },
-    1272             :       {      -6514, "Xi*_tb~^0" },
-    1273             :       {       6522, "Xi'_tb^+" },
-    1274             :       {      -6522, "Xi'_tb~^-" },
-    1275             :       {       6524, "Xi*_tb^+" },
-    1276             :       {      -6524, "Xi*_tb~^-" },
-    1277             :       {       6532, "Omega'_tb^0" },
-    1278             :       {      -6532, "Omega'_tb~^0" },
-    1279             :       {       6534, "Omega*_tb^0" },
-    1280             :       {      -6534, "Omega*_tb~^0" },
-    1281             :       {       6542, "Omega'_tbc^+" },
-    1282             :       {      -6542, "Omega'_tbc~^-" },
-    1283             :       {       6544, "Omega*_tbc^+" },
-    1284             :       {      -6544, "Omega*_tbc~^-" },
-    1285             :       {       6552, "Omega_tbb^0" },
-    1286             :       {      -6552, "Omega_tbb~^0" },
-    1287             :       {       6554, "Omega*_tbb^0" },
-    1288             :       {      -6554, "Omega*_tbb~^0" },
-    1289             :       {       6612, "Xi_tt^+" },
-    1290             :       {      -6612, "Xi_tt~^-" },
-    1291             :       {       6614, "Xi*_tt^+" },
-    1292             :       {      -6614, "Xi*_tt~^-" },
-    1293             :       {       6622, "Xi_tt^++" },
-    1294             :       {      -6622, "Xi_tt~^--" },
-    1295             :       {       6624, "Xi*_tt^++" },
-    1296             :       {      -6624, "Xi*_tt~^--" },
-    1297             :       {       6632, "Omega_tt^+" },
-    1298             :       {      -6632, "Omega_tt~^-" },
-    1299             :       {       6634, "Omega*_tt^+" },
-    1300             :       {      -6634, "Omega*_tt~^-" },
-    1301             :       {       6642, "Omega_ttc^++" },
-    1302             :       {      -6642, "Omega_ttc~^--" },
-    1303             :       {       6644, "Omega*_ttc^++" },
-    1304             :       {      -6644, "Omega*_ttc~^--" },
-    1305             :       {       6652, "Omega_ttb^+" },
-    1306             :       {      -6652, "Omega_ttb~^-" },
-    1307             :       {       6654, "Omega*_ttb^+" },
-    1308             :       {      -6654, "Omega*_ttb~^-" },
-    1309             :       {       6664, "Omega*_ttt^++" },
-    1310             :       {      -6664, "Omega*_ttt~^--" },
-    1311             :       {       7112, "Sigma_b'^-" },
-    1312             :       {      -7112, "Sigma_b'~^+" },
-    1313             :       {       7114, "Sigma*_b'^-" },
-    1314             :       {      -7114, "Sigma*_b'~^+" },
-    1315             :       {       7122, "Lambda_b'^0" },
-    1316             :       {      -7122, "Lambda_b'~^0" },
-    1317             :       {       7132, "Xi_b'^-" },
-    1318             :       {      -7132, "Xi_b'~^+" },
-    1319             :       {       7142, "Xi_b'c^0" },
-    1320             :       {      -7142, "Xi_b'c~^0" },
-    1321             :       {       7152, "Xi_b'b^-" },
-    1322             :       {      -7152, "Xi_b'b~^+" },
-    1323             :       {       7162, "Xi_b't^0" },
-    1324             :       {      -7162, "Xi_b't~^0" },
-    1325             :       {       7212, "Sigma_b'^0" },
-    1326             :       {      -7212, "Sigma_b'~^0" },
-    1327             :       {       7214, "Sigma*_b'^0" },
-    1328             :       {      -7214, "Sigma*_b'~^0" },
-    1329             :       {       7222, "Sigma_b'^+" },
-    1330             :       {      -7222, "Sigma_b'~^-" },
-    1331             :       {       7224, "Sigma*_b'^+" },
-    1332             :       {      -7224, "Sigma*_b'~^-" },
-    1333             :       {       7232, "Xi_b'^0" },
-    1334             :       {      -7232, "Xi_b'~^0" },
-    1335             :       {       7242, "Xi_b'c^+" },
-    1336             :       {      -7242, "Xi_b'c~^-" },
-    1337             :       {       7252, "Xi_b'b^0" },
-    1338             :       {      -7252, "Xi_b'b~^0" },
-    1339             :       {       7262, "Xi_b't^+" },
-    1340             :       {      -7262, "Xi_b't~^-" },
-    1341             :       {       7312, "Xi'_b'^-" },
-    1342             :       {      -7312, "Xi'_b'~^+" },
-    1343             :       {       7314, "Xi*_b'^-" },
-    1344             :       {      -7314, "Xi*_b'~^+" },
-    1345             :       {       7322, "Xi'_b'^0" },
-    1346             :       {      -7322, "Xi'_b'~^0" },
-    1347             :       {       7324, "Xi*_b'^0" },
-    1348             :       {      -7324, "Xi*_b'~^0" },
-    1349             :       {       7332, "Omega'_b'^-" },
-    1350             :       {      -7332, "Omega'_b'~^+" },
-    1351             :       {       7334, "Omega*_b'^-" },
-    1352             :       {      -7334, "Omega*_b'~^+" },
-    1353             :       {       7342, "Omega_b'c^0" },
-    1354             :       {      -7342, "Omega_b'c~^0" },
-    1355             :       {       7352, "Omega_b'b^-" },
-    1356             :       {      -7352, "Omega_b'b~^+" },
-    1357             :       {       7362, "Omega_b't^0" },
-    1358             :       {      -7362, "Omega_b't~^0" },
-    1359             :       {       7412, "Xi'_b'c^0" },
-    1360             :       {      -7412, "Xi'_b'c~^0" },
-    1361             :       {       7414, "Xi*_b'c^0" },
-    1362             :       {      -7414, "Xi*_b'c~^0" },
-    1363             :       {       7422, "Xi'_b'c^+" },
-    1364             :       {      -7422, "Xi'_b'c~^-" },
-    1365             :       {       7424, "Xi*_b'c^+" },
-    1366             :       {      -7424, "Xi*_b'c~^-" },
-    1367             :       {       7432, "Omega'_b'c^0" },
-    1368             :       {      -7432, "Omega'_b'c~^0" },
-    1369             :       {       7434, "Omega*_b'c^0" },
-    1370             :       {      -7434, "Omega*_b'c~^0" },
-    1371             :       {       7442, "Omega'_b'cc^+" },
-    1372             :       {      -7442, "Omega'_b'cc~^-" },
-    1373             :       {       7444, "Omega*_b'cc^+" },
-    1374             :       {      -7444, "Omega*_b'cc~^-" },
-    1375             :       {       7452, "Omega_b'bc^0" },
-    1376             :       {      -7452, "Omega_b'bc~^0" },
-    1377             :       {       7462, "Omega_b'tc^+" },
-    1378             :       {      -7462, "Omega_b'tc~^-" },
-    1379             :       {       7512, "Xi'_b'b^-" },
-    1380             :       {      -7512, "Xi'_b'b~^+" },
-    1381             :       {       7514, "Xi*_b'b^-" },
-    1382             :       {      -7514, "Xi*_b'b~^+" },
-    1383             :       {       7522, "Xi'_b'b^0" },
-    1384             :       {      -7522, "Xi'_b'b~^0" },
-    1385             :       {       7524, "Xi*_b'b^0" },
-    1386             :       {      -7524, "Xi*_b'b~^0" },
-    1387             :       {       7532, "Omega'_b'b^-" },
-    1388             :       {      -7532, "Omega'_b'b~^+" },
-    1389             :       {       7534, "Omega*_b'b^-" },
-    1390             :       {      -7534, "Omega*_b'b~^+" },
-    1391             :       {       7542, "Omega'_b'bc^0" },
-    1392             :       {      -7542, "Omega'_b'bc~^0" },
-    1393             :       {       7544, "Omega*_b'bc^0" },
-    1394             :       {      -7544, "Omega*_b'bc~^0" },
-    1395             :       {       7552, "Omega'_b'bb^-" },
-    1396             :       {      -7552, "Omega'_b'bb~^+" },
-    1397             :       {       7554, "Omega*_b'bb^-" },
-    1398             :       {      -7554, "Omega*_b'bb~^+" },
-    1399             :       {       7562, "Omega_b'tb^0" },
-    1400             :       {      -7562, "Omega_b'tb~^0" },
-    1401             :       {       7612, "Xi'_b't^0" },
-    1402             :       {      -7612, "Xi'_b't~^0" },
-    1403             :       {       7614, "Xi*_b't^0" },
-    1404             :       {      -7614, "Xi*_b't~^0" },
-    1405             :       {       7622, "Xi'_b't^+" },
-    1406             :       {      -7622, "Xi'_b't~^-" },
-    1407             :       {       7624, "Xi*_b't^+" },
-    1408             :       {      -7624, "Xi*_b't~^-" },
-    1409             :       {       7632, "Omega'_b't^0" },
-    1410             :       {      -7632, "Omega'_b't~^0" },
-    1411             :       {       7634, "Omega*_b't^0" },
-    1412             :       {      -7634, "Omega*_b't~^0" },
-    1413             :       {       7642, "Omega'_b'tc^+" },
-    1414             :       {      -7642, "Omega'_b'tc~^-" },
-    1415             :       {       7644, "Omega*_b'tc^+" },
-    1416             :       {      -7644, "Omega*_b'tc~^-" },
-    1417             :       {       7652, "Omega'_b'tb^0" },
-    1418             :       {      -7652, "Omega'_b'tb~^0" },
-    1419             :       {       7654, "Omega*_b'tb^0" },
-    1420             :       {      -7654, "Omega*_b'tb~^0" },
-    1421             :       {       7662, "Omega'_b'tt^+" },
-    1422             :       {      -7662, "Omega'_b'tt~^-" },
-    1423             :       {       7664, "Omega*_b'tt^+" },
-    1424             :       {      -7664, "Omega*_b'tt~^-" },
-    1425             :       {       7712, "Xi'_b'b'^-" },
-    1426             :       {      -7712, "Xi'_b'b'~^+" },
-    1427             :       {       7714, "Xi*_b'b'^-" },
-    1428             :       {      -7714, "Xi*_b'b'~^+" },
-    1429             :       {       7722, "Xi'_b'b'^0" },
-    1430             :       {      -7722, "Xi'_b'b'~^0" },
-    1431             :       {       7724, "Xi*_b'b'^0" },
-    1432             :       {      -7724, "Xi*_b'b'~^0" },
-    1433             :       {       7732, "Omega'_b'b'^-" },
-    1434             :       {      -7732, "Omega'_b'b'~^+" },
-    1435             :       {       7734, "Omega*_b'b'^-" },
-    1436             :       {      -7734, "Omega*_b'b'~^+" },
-    1437             :       {       7742, "Omega'_b'b'c^0" },
-    1438             :       {      -7742, "Omega'_b'b'c~^0" },
-    1439             :       {       7744, "Omega*_b'b'c^0" },
-    1440             :       {      -7744, "Omega*_b'b'c~^0" },
-    1441             :       {       7752, "Omega'_b'b'b^-" },
-    1442             :       {      -7752, "Omega'_b'b'b~^+" },
-    1443             :       {       7754, "Omega*_b'b'b^-" },
-    1444             :       {      -7754, "Omega*_b'b'b~^+" },
-    1445             :       {       7762, "Omega'_b'b't^0" },
-    1446             :       {      -7762, "Omega'_b'b't~^0" },
-    1447             :       {       7764, "Omega*_b'b't^0" },
-    1448             :       {      -7764, "Omega*_b'b't~^0" },
-    1449             :       {       7774, "Omega*_b'b'b'^-" },
-    1450             :       {      -7774, "Omega*_b'b'b'~^+" },
-    1451             :       {       8112, "Sigma_t'^0" },
-    1452             :       {      -8112, "Sigma_t'~^0" },
-    1453             :       {       8114, "Sigma*_t'^0" },
-    1454             :       {      -8114, "Sigma*_t'~^0" },
-    1455             :       {       8122, "Lambda_t'^+" },
-    1456             :       {      -8122, "Lambda_t'~^-" },
-    1457             :       {       8132, "Xi_t'^0" },
-    1458             :       {      -8132, "Xi_t'~^0" },
-    1459             :       {       8142, "Xi_t'c^+" },
-    1460             :       {      -8142, "Xi_t'c~^-" },
-    1461             :       {       8152, "Xi_t'b^0" },
-    1462             :       {      -8152, "Xi_t'b~^0" },
-    1463             :       {       8162, "Xi_t't^+" },
-    1464             :       {      -8162, "Xi_t't~^-" },
-    1465             :       {       8172, "Xi_t'b'^0" },
-    1466             :       {      -8172, "Xi_t'b'~^0" },
-    1467             :       {       8212, "Sigma_t'^+" },
-    1468             :       {      -8212, "Sigma_t'~^-" },
-    1469             :       {       8214, "Sigma*_t'^+" },
-    1470             :       {      -8214, "Sigma*_t'~^-" },
-    1471             :       {       8222, "Sigma_t'^++" },
-    1472             :       {      -8222, "Sigma_t'~^--" },
-    1473             :       {       8224, "Sigma*_t'^++" },
-    1474             :       {      -8224, "Sigma*_t'~^--" },
-    1475             :       {       8232, "Xi_t'^+" },
-    1476             :       {      -8232, "Xi_t'~^-" },
-    1477             :       {       8242, "Xi_t'c^++" },
-    1478             :       {      -8242, "Xi_t'c~^--" },
-    1479             :       {       8252, "Xi_t'b^+" },
-    1480             :       {      -8252, "Xi_t'b~^-" },
-    1481             :       {       8262, "Xi_t't^++" },
-    1482             :       {      -8262, "Xi_t't~^--" },
-    1483             :       {       8272, "Xi_t'b'^+" },
-    1484             :       {      -8272, "Xi_t'b'~^-" },
-    1485             :       {       8312, "Xi'_t'^0" },
-    1486             :       {      -8312, "Xi'_t'~^0" },
-    1487             :       {       8314, "Xi*_t'^0" },
-    1488             :       {      -8314, "Xi*_t'~^0" },
-    1489             :       {       8322, "Xi'_t'^+" },
-    1490             :       {      -8322, "Xi'_t'~^-" },
-    1491             :       {       8324, "Xi*_t'^+" },
-    1492             :       {      -8324, "Xi*_t'~^-" },
-    1493             :       {       8332, "Omega'_t'^0" },
-    1494             :       {      -8332, "Omega'_t'~^0" },
-    1495             :       {       8334, "Omega*_t'^0" },
-    1496             :       {      -8334, "Omega*_t'~^0" },
-    1497             :       {       8342, "Omega_t'c^+" },
-    1498             :       {      -8342, "Omega_t'c~^-" },
-    1499             :       {       8352, "Omega_t'b^0" },
-    1500             :       {      -8352, "Omega_t'b~^0" },
-    1501             :       {       8362, "Omega_t't^+" },
-    1502             :       {      -8362, "Omega_t't~^-" },
-    1503             :       {       8372, "Omega_t'b'^0" },
-    1504             :       {      -8372, "Omega_t'b'~^0" },
-    1505             :       {       8412, "Xi'_t'c^+" },
-    1506             :       {      -8412, "Xi'_t'c~^-" },
-    1507             :       {       8414, "Xi*_t'c^+" },
-    1508             :       {      -8414, "Xi*_t'c~^-" },
-    1509             :       {       8422, "Xi'_t'c^++" },
-    1510             :       {      -8422, "Xi'_t'c~^--" },
-    1511             :       {       8424, "Xi*_t'c^++" },
-    1512             :       {      -8424, "Xi*_t'c~^--" },
-    1513             :       {       8432, "Omega'_t'c^+" },
-    1514             :       {      -8432, "Omega'_t'c~^-" },
-    1515             :       {       8434, "Omega*_t'c^+" },
-    1516             :       {      -8434, "Omega*_t'c~^-" },
-    1517             :       {       8442, "Omega'_t'cc^++" },
-    1518             :       {      -8442, "Omega'_t'cc~^--" },
-    1519             :       {       8444, "Omega*_t'cc^++" },
-    1520             :       {      -8444, "Omega*_t'cc~^--" },
-    1521             :       {       8452, "Omega_t'bc^+" },
-    1522             :       {      -8452, "Omega_t'bc~^-" },
-    1523             :       {       8462, "Omega_t'tc^++" },
-    1524             :       {      -8462, "Omega_t'tc~^--" },
-    1525             :       {       8472, "Omega_t'b'c ^+" },
-    1526             :       {      -8472, "Omega_t'b'c ~^-" },
-    1527             :       {       8512, "Xi'_t'b^0" },
-    1528             :       {      -8512, "Xi'_t'b~^0" },
-    1529             :       {       8514, "Xi*_t'b^0" },
-    1530             :       {      -8514, "Xi*_t'b~^0" },
-    1531             :       {       8522, "Xi'_t'b^+" },
-    1532             :       {      -8522, "Xi'_t'b~^-" },
-    1533             :       {       8524, "Xi*_t'b^+" },
-    1534             :       {      -8524, "Xi*_t'b~^-" },
-    1535             :       {       8532, "Omega'_t'b^0" },
-    1536             :       {      -8532, "Omega'_t'b~^0" },
-    1537             :       {       8534, "Omega*_t'b^0" },
-    1538             :       {      -8534, "Omega*_t'b~^0" },
-    1539             :       {       8542, "Omega'_t'bc^+" },
-    1540             :       {      -8542, "Omega'_t'bc~^-" },
-    1541             :       {       8544, "Omega*_t'bc^+" },
-    1542             :       {      -8544, "Omega*_t'bc~^-" },
-    1543             :       {       8552, "Omega'_t'bb^0" },
-    1544             :       {      -8552, "Omega'_t'bb~^0" },
-    1545             :       {       8554, "Omega*_t'bb^0" },
-    1546             :       {      -8554, "Omega*_t'bb~^0" },
-    1547             :       {       8562, "Omega_t'tb^+" },
-    1548             :       {      -8562, "Omega_t'tb~^-" },
-    1549             :       {       8572, "Omega_t'b'b ^0" },
-    1550             :       {      -8572, "Omega_t'b'b ~^0" },
-    1551             :       {       8612, "Xi'_t't^+" },
-    1552             :       {      -8612, "Xi'_t't~^-" },
-    1553             :       {       8614, "Xi*_t't^+" },
-    1554             :       {      -8614, "Xi*_t't~^-" },
-    1555             :       {       8622, "Xi'_t't^++" },
-    1556             :       {      -8622, "Xi'_t't~^--" },
-    1557             :       {       8624, "Xi*_t't^++" },
-    1558             :       {      -8624, "Xi*_t't~^--" },
-    1559             :       {       8632, "Omega'_t't^+" },
-    1560             :       {      -8632, "Omega'_t't~^-" },
-    1561             :       {       8634, "Omega*_t't^+" },
-    1562             :       {      -8634, "Omega*_t't~^-" },
-    1563             :       {       8642, "Omega'_t'tc^++" },
-    1564             :       {      -8642, "Omega'_t'tc~^--" },
-    1565             :       {       8644, "Omega*_t'tc^++" },
-    1566             :       {      -8644, "Omega*_t'tc~^--" },
-    1567             :       {       8652, "Omega'_t'tb^+" },
-    1568             :       {      -8652, "Omega'_t'tb~^-" },
-    1569             :       {       8654, "Omega*_t'tb^+" },
-    1570             :       {      -8654, "Omega*_t'tb~^-" },
-    1571             :       {       8662, "Omega'_t'tt^++" },
-    1572             :       {      -8662, "Omega'_t'tt~^--" },
-    1573             :       {       8664, "Omega*_t'tt^++" },
-    1574             :       {      -8664, "Omega*_t'tt~^--" },
-    1575             :       {       8672, "Omega_t'b't ^+" },
-    1576             :       {      -8672, "Omega_t'b't ~^-" },
-    1577             :       {       8712, "Xi'_t'b'^0" },
-    1578             :       {      -8712, "Xi'_t'b'~^0" },
-    1579             :       {       8714, "Xi*_t'b'^0" },
-    1580             :       {      -8714, "Xi*_t'b'~^0" },
-    1581             :       {       8722, "Xi'_t'b'^+" },
-    1582             :       {      -8722, "Xi'_t'b'~^-" },
-    1583             :       {       8724, "Xi*_t'b'^+" },
-    1584             :       {      -8724, "Xi*_t'b'~^-" },
-    1585             :       {       8732, "Omega'_t'b'^0" },
-    1586             :       {      -8732, "Omega'_t'b'~^0" },
-    1587             :       {       8734, "Omega*_t'b'^0" },
-    1588             :       {      -8734, "Omega*_t'b'~^0" },
-    1589             :       {       8742, "Omega'_t'b'c^+" },
-    1590             :       {      -8742, "Omega'_t'b'c~^-" },
-    1591             :       {       8744, "Omega*_t'b'c^+" },
-    1592             :       {      -8744, "Omega*_t'b'c~^-" },
-    1593             :       {       8752, "Omega'_t'b'b^0" },
-    1594             :       {      -8752, "Omega'_t'b'b~^0" },
-    1595             :       {       8754, "Omega*_t'b'b^0" },
-    1596             :       {      -8754, "Omega*_t'b'b~^0" },
-    1597             :       {       8762, "Omega'_t'b't^+" },
-    1598             :       {      -8762, "Omega'_t'b't~^-" },
-    1599             :       {       8764, "Omega*_t'b't^+" },
-    1600             :       {      -8764, "Omega*_t'b't~^-" },
-    1601             :       {       8772, "Omega'_t'b'b'^0" },
-    1602             :       {      -8772, "Omega'_t'b'b'~^0" },
-    1603             :       {       8774, "Omega*_t'b'b'^0" },
-    1604             :       {      -8774, "Omega*_t'b'b'~^0" },
-    1605             :       {       8812, "Xi'_t't'^+" },
-    1606             :       {      -8812, "Xi'_t't'~^-" },
-    1607             :       {       8814, "Xi*_t't'^+" },
-    1608             :       {      -8814, "Xi*_t't'~^-" },
-    1609             :       {       8822, "Xi'_t't'^++" },
-    1610             :       {      -8822, "Xi'_t't'~^--" },
-    1611             :       {       8824, "Xi*_t't'^++" },
-    1612             :       {      -8824, "Xi*_t't'~^--" },
-    1613             :       {       8832, "Omega'_t't'^+" },
-    1614             :       {      -8832, "Omega'_t't'~^-" },
-    1615             :       {       8834, "Omega*_t't'^+" },
-    1616             :       {      -8834, "Omega*_t't'~^-" },
-    1617             :       {       8842, "Omega'_t't'c^++" },
-    1618             :       {      -8842, "Omega'_t't'c~^--" },
-    1619             :       {       8844, "Omega*_t't'c^++" },
-    1620             :       {      -8844, "Omega*_t't'c~^--" },
-    1621             :       {       8852, "Omega'_t't'b^+" },
-    1622             :       {      -8852, "Omega'_t't'b~^-" },
-    1623             :       {       8854, "Omega*_t't'b^+" },
-    1624             :       {      -8854, "Omega*_t't'b~^-" },
-    1625             :       {       8862, "Omega'_t't't^++" },
-    1626             :       {      -8862, "Omega'_t't't~^--" },
-    1627             :       {       8864, "Omega*_t't't^++" },
-    1628             :       {      -8864, "Omega*_t't't~^--" },
-    1629             :       {       8872, "Omega'_t't'b'^+" },
-    1630             :       {      -8872, "Omega'_t't'b'~^-" },
-    1631             :       {       8874, "Omega*_t't'b'^+" },
-    1632             :       {      -8874, "Omega*_t't'b'~^-" },
-    1633             :       {       8884, "Omega*_t't't'^++" },
-    1634             :       {      -8884, "Omega*_t't't'~^--" },
-    1635             :       {    9221132, "Theta^+" },
-    1636             :       {    9331122, "Phi^--" },
-    1637             :       {    1000993, "R_~gg^0" },
-    1638             :       {    1009113, "R_~gd~d^0" },
-    1639             :       {    1009213, "R_~gu~d^+" },
-    1640             :       {    1009223, "R_~gu~u^0" },
-    1641             :       {    1009313, "R_~gd~s^0" },
-    1642             :       {    1009323, "R_~gu~s^+" },
-    1643             :       {    1009333, "R_~gs~s^0" },
-    1644             :       {    1091114, "R_~gddd^-" },
-    1645             :       {    1092114, "R_~gudd^0" },
-    1646             :       {    1092214, "R_~guud^+" },
-    1647             :       {    1092224, "R_~guuu^++" },
-    1648             :       {    1093114, "R_~gsdd^-" },
-    1649             :       {    1093214, "R_~gsud^0" },
-    1650             :       {    1093224, "R_~gsuu^+" },
-    1651             :       {    1093314, "R_~gssd^-" },
-    1652             :       {    1093324, "R_~gssu^0" },
-    1653             :       {    1093334, "R_~gsss^-" },
-    1654             :       {    1000612, "R_~t_1~d^+" },
-    1655             :       {    1000622, "R_~t_1~u^0" },
-    1656             :       {    1000632, "R_~t_1~s^+" },
-    1657             :       {    1000642, "R_~t_1~c^0" },
-    1658             :       {    1000652, "R_~t_1~b^+" },
-    1659             :       {    1006113, "R_~t_1dd_1^0" },
-    1660             :       {    1006211, "R_~t_1ud_0^+" },
-    1661             :       {    1006213, "R_~t_1ud_1^+" },
-    1662             :       {    1006223, "R_~t_1uu_1^++" },
-    1663             :       {    1006311, "R_~t_1sd_0^0" },
-    1664             :       {    1006313, "R_~t_1sd_1^0" },
-    1665             :       {    1006321, "R_~t_1su_0^+" },
-    1666             :       {    1006323, "R_~t_1su_1^+" },
-    1667             :       {    1006333, "R_~t_1ss_1^0" },
-    1668             :       { 1000010010, "Hydrogen" },
-    1669             :       { 1000010020, "Deuterium" },
-    1670             :       {-1000010020, "Anti-Deuterium" },
-    1671             :       { 1000010030, "Tritium" },
-    1672             :       {-1000010030, "Anti-Tritium" },
-    1673             :       { 1000020030, "He3" },
-    1674             :       {-1000020030, "Anti-He3" },
-    1675             :       { 1000020040, "Alpha-(He4)" },
-    1676             :       {-1000020040, "Anti-Alpha-(He4)" }
-    1677             :   };
-    1678             : 
-    1679             :   int lnames = sizeof(SNames)/sizeof(SNames[0]);
-    1680           0 :   for( int k=0; k!=lnames; ++k) {
-    1681           0 :       m.insert( std::make_pair( SNames[k].pid, std::string(SNames[k].pname)) );
-    1682           0 :       nameMap.insert( std::make_pair( std::string(SNames[k].pname), SNames[k].pid ) );
-    1683             :   }
-    1684           0 :   static ParticleNameMap mymaps(m,nameMap);
-    1685             : 
-    1686           0 :   return mymaps;
-    1687             : }  // ParticleNameInit()
-    1688             : 
-    1689           0 : void writeParticleNameLine( int i, std::ostream & os  )
-    1690             : {
-    1691           0 :     if ( validParticleName( i ) ) {
-    1692           0 :         std::string pn = particleName( i );
-    1693           0 :         int pid = particleName( pn );
-    1694           0 :         os << " PDT number: " ;
-    1695           0 :         os.width(12);
-    1696           0 :         os << i << " PDT name: " << pn << std::endl;
-    1697             :         // verify reverse lookup
-    1698           0 :         if( pid != i ) {
-    1699             :             os << "HepPID::writeParticleNameLine ERROR: "
-    1700           0 :                << " got " << pid << " instead of " << i << std::endl;
-    1701             :         }
-    1702             :     }
-    1703           0 :     return;
-    1704             : }  // writeParticleNameLine()
-    1705             : 
-    1706           0 : std::string dyonName( const int & pid )
-    1707             : {
-    1708           0 :     std::ostringstream pn;
-    1709           0 :     pn << "Dyon^" << digit(nq1,pid) << digit(nq2,pid) << digit(nq3,pid);
-    1710           0 :     if ( digit(nl,pid) == 1 ) {
-    1711           0 :        if ( pid > 0 ) {
-    1712           0 :           pn << "++";
-    1713             :        } else {
-    1714           0 :           pn << "--";
-    1715             :        }
-    1716           0 :     } else if ( digit(nl,pid) == 2 ) {
-    1717           0 :        if ( pid > 0 ) {
-    1718           0 :           pn << "+-";
-    1719             :        } else {
-    1720           0 :           pn << "-+";
-    1721             :        }
-    1722             :     }
-    1723           0 :     return pn.str();
-    1724           0 : }
-    1725             : 
-    1726           0 : std::string qballName( const int & pid )
-    1727             : {
-    1728           0 :     std::ostringstream pn;
-    1729           0 :     pn << "QBall^" << ((abspid(pid)/100)%1000) << "." << digit(nq3,pid);
-    1730           0 :     if ( pid > 0 ) {
-    1731           0 :        pn << "+";
-    1732             :     } else {
-    1733           0 :        pn << "-";
-    1734             :     }
-    1735           0 :     return pn.str();
-    1736           0 : }
-    1737             : 
-    1738           0 : int  checkForSpecialParticle( const std::string & s )
-    1739             : {
-    1740             :     int chg, chg2, id;
-    1741             :     int m = 1;
-    1742           0 :     int len = s.length();
-    1743           0 :     if( s.substr(0,4) == "Dyon" ) {
-    1744           0 :        std::istringstream var1(s.substr(5,3).c_str());
-    1745           0 :        var1 >> chg;
-    1746           0 :        if( s.substr(len-2,1) == "+" && s.substr(len-1,1) == "-") m = 2;
-    1747           0 :        if( s.substr(len-2,1) == "-" && s.substr(len-1,1) == "+") m = 2;
-    1748           0 :        id = 4100000 + m*10000 + chg*10;
-    1749           0 :        if( s.substr(len-2,1) == "-" ) id = -id;
-    1750             :        return id;
-    1751           0 :     }
-    1752           0 :     if( s.substr(0,5) == "QBall" ) {
-    1753           0 :        int rem = len - 9;
-    1754           0 :        std::istringstream var2(s.substr(6,rem).c_str());
-    1755           0 :        var2 >> chg;
-    1756           0 :        std::istringstream var3(s.substr(7+rem,1).c_str());
-    1757           0 :        var3 >> chg2;
-    1758           0 :        id = 10000000 + chg*100+chg2*10;
-    1759           0 :        if( s.substr(len-1,1) == "-" ) id = -id;
-    1760             :        return id;
-    1761           0 :     }
-    1762             :     return 0;
-    1763             : }
-    1764             : 
-    1765             : } // unnamed namespace
-    1766             : 
-    1767             : //
-    1768             : // getPartcleIdMap is the ONLY function allowed to call ParticleNameInit
-    1769             : //
-    1770           0 : ParticleNameMap const &  getParticleNameMap()
-    1771             : {
-    1772           0 :   static  ParticleNameMap const &  pmap = ParticleNameInit();
-    1773           0 :   return pmap;
-    1774             : }  // getPartcleIdMap()
-    1775             : 
-    1776           0 : bool validParticleName( const int & pid )
-    1777             : {
-    1778             :     // check for the special cases first
-    1779           0 :     if ( isDyon(pid) ) return true;
-    1780           0 :     if ( isQBall(pid) ) return true;
-    1781             :     
-    1782           0 :     static  ParticleNameMap const &  pmap = getParticleNameMap();
-    1783             : 
-    1784           0 :     ParticleNameMap::idIterator const cit = pmap.find( pid );
-    1785             :     return ( cit == pmap.end() )
-    1786           0 :          ? false
-    1787             :          : true;
-    1788             : }  // validParticleName()
-    1789             : 
-    1790           0 : bool validParticleName( const std::string & s )
-    1791             : {
-    1792           0 :     static  ParticleNameMap const &  pmap = getParticleNameMap();
-    1793           0 :     ParticleNameMap::nameIterator const cit = pmap.findString( s );
-    1794             :     return ( cit == pmap.endLookupMap() )
-    1795           0 :          ? false
-    1796           0 :          : true;
-    1797             : }  // validParticleName()
-    1798             : 
-    1799           0 : std::string  particleName( const int & pid )
-    1800             : {
-    1801             :     // check for the special cases first
-    1802           0 :     if ( isDyon(pid) ) return dyonName(pid);
-    1803           0 :     if ( isQBall(pid) ) return qballName(pid);
-    1804             :     
-    1805           0 :     static  ParticleNameMap const &  pmap = getParticleNameMap();
-    1806             : 
-    1807           0 :     ParticleNameMap::idIterator const cit = pmap.find( pid );
-    1808             :     return ( cit == pmap.end() )
-    1809             :          ? std::string("not defined")
-    1810           0 :          : cit->second;
-    1811             : }  // particleName()
-    1812             : 
-    1813           0 : int  particleName( const std::string & s )
-    1814             : {
-    1815           0 :     static  ParticleNameMap const &  pmap = getParticleNameMap();
-    1816           0 :     ParticleNameMap::nameIterator const cit = pmap.findString( s );
-    1817             :     return ( cit == pmap.endLookupMap() )
-    1818           0 :          ? checkForSpecialParticle(s)
-    1819           0 :          : cit->second;
-    1820             : }  // particleName()
-    1821             : 
-    1822             : //
-    1823             : // list all the defined names
-    1824             : //
-    1825           0 : void  listParticleNames( std::ostream & os  )
-    1826             : {
-    1827           0 :     writeVersion( os );
-    1828             :     os << "     HepPID Particle List" << std::endl;
-    1829             :     os << std::endl;
-    1830             : 
-    1831             :     // simple: static  PartcleIdMap const &  pmap = getPartcleIdMap();
-    1832             :     // simple: for( PartcleIdMap::const_iterator cit = pmap.begin(), mend = pmap.end(); 
-    1833             :     // simple:                                 cit != mend;
-    1834             :         // simple:                        ++cit ) {
-    1835             :         // simple: os << "  PDT number: " ;
-    1836             :         // simple: os.width(12);
-    1837             :         // simple: os << cit->first << "  PDT name: " << cit->second << std::endl;
-    1838             :     // simple: }
-    1839             :     int id, i, j, q1, q2, q3, l, m, n;
-    1840             :     // special cases
-    1841           0 :     for( id=1; id<101; ++id) {
-    1842           0 :         writeParticleNameLine(  id, os );
-    1843           0 :         writeParticleNameLine( -id, os );
-    1844             :     }
-    1845           0 :     for( i=11; i<1000; ++i) {
-    1846           0 :         id = i*10;
-    1847           0 :         writeParticleNameLine(  id, os );
-    1848           0 :         writeParticleNameLine( -id, os );
-    1849             :     }
-    1850             :     // SUSY
-    1851           0 :     for( n=1; n<3; ++n) {
-    1852           0 :         for( q1=0; q1<10; ++q1) {
-    1853           0 :             for( j=0; j<10; ++j) {
-    1854           0 :                 id = 1000000*n+10*q1+j;
-    1855           0 :                 writeParticleNameLine(  id, os );
-    1856           0 :                 writeParticleNameLine( -id, os );
-    1857             :             }
-    1858             :         }
-    1859             :     }
-    1860             :     // technicolor, etc.
-    1861           0 :     for( n=3; n<7; ++n) {
-    1862           0 :         for( q2=0; q2<10; ++q2) {
-    1863           0 :             for( q1=0; q1<10; ++q1) {
-    1864           0 :                 for( j=0; j<10; ++j) {
-    1865           0 :                     for( m=0; m<10; ++m) {
-    1866           0 :                         for( l=0; l<7; ++l) {
-    1867           0 :                             id = 1000000*n+100000*m+10000*l+100*q2+10*q1+j;
-    1868             :                             // save dyons for later
-    1869           0 :                             if( !(n == 4 && m == 1) ) {
-    1870           0 :                             writeParticleNameLine(  id, os );
-    1871           0 :                             writeParticleNameLine( -id, os );
-    1872             :                             }
-    1873             :                         }
-    1874             :                     }
-    1875             :                 }
-    1876             :             }
-    1877             :         }
-    1878             :     }
-    1879             :     // R-hadrons
-    1880           0 :     for( q3=0; q3<10; ++q3) {
-    1881           0 :         for( q2=1; q2<10; ++q2) {
-    1882           0 :             for( q1=1; q1<10; ++q1) {
-    1883           0 :                 for( j=1; j<5; ++j) {
-    1884           0 :                     id = 1000000+1000*q3+100*q2+10*q1+j;
-    1885           0 :                     writeParticleNameLine( id, os );
-    1886           0 :                     if(q3 > 0 ) id = 1000000+90000+1000*q3+100*q2+10*q1+j;
-    1887           0 :                     writeParticleNameLine( id, os );
-    1888             :                 }
-    1889             :             }
-    1890             :         }
-    1891             :     }
-    1892             :     // miscellaneous generator particles
-    1893           0 :     for( l=0; l<9; ++l) {
-    1894           0 :         for( i=1; i<100; ++i) {
-    1895           0 :             id = 9900000+10000*l+i;
-    1896           0 :             writeParticleNameLine(  id, os );
-    1897           0 :             writeParticleNameLine( -id, os );
-    1898             :         }
-    1899           0 :         for( q3=0; q3<10; ++q3) {
-    1900           0 :             for( q2=1; q2<10; ++q2) {
-    1901           0 :                 for( q1=1; q1<10; ++q1) {
-    1902           0 :                     for( j=0; j<10; ++j) {
-    1903           0 :                         id = 9900000+10000*l+1000*q3+100*q2+10*q1+j;
-    1904           0 :                         writeParticleNameLine(  id, os );
-    1905           0 :                         writeParticleNameLine( -id, os );
-    1906             :                     }
-    1907             :                 }
-    1908             :             }
-    1909             :         }
-    1910             :     }
-    1911             :     // diquark
-    1912           0 :     for( i=11; i<100; ++i) {
-    1913           0 :         for( j=0; j<10; ++j) {
-    1914           0 :             id = 100*i+j;
-    1915           0 :             writeParticleNameLine(  id, os );
-    1916           0 :             writeParticleNameLine( -id, os );
-    1917             :         }
-    1918             :     }
-    1919             :     // mesons
-    1920           0 :     for( q2=1; q2<10; ++q2) {
-    1921           0 :         for( q1=1; q1<10; ++q1) {
-    1922           0 :             for( j=1; j<10; ++j) {
-    1923           0 :                 for( m=0; m<9; ++m) {
-    1924           0 :                     for( l=0; l<10; ++l) {
-    1925           0 :                         id = 100000*m+10000*l+100*q2+10*q1+j;
-    1926           0 :                         writeParticleNameLine(  id, os );
-    1927           0 :                         writeParticleNameLine( -id, os );
-    1928           0 :                         id = 9000000+100000*m+10000*l+100*q2+10*q1+j;
-    1929           0 :                         writeParticleNameLine(  id, os );
-    1930           0 :                         writeParticleNameLine( -id, os );
-    1931             :                     }
-    1932             :                 }
-    1933             :             }
-    1934             :         }
-    1935             :     }
-    1936             :     // baryons
-    1937           0 :     for( q3=1; q3<10; ++q3) {
-    1938           0 :         for( q2=1; q2<10; ++q2) {
-    1939           0 :             for( q1=1; q1<10; ++q1) {
-    1940           0 :                 for( j=1; j<10; ++j) {
-    1941           0 :                     for( m=0; m<9; ++m) {
-    1942           0 :                         id = 10000*m+1000*q3+100*q2+10*q1+j;
-    1943           0 :                         writeParticleNameLine(  id, os );
-    1944           0 :                         writeParticleNameLine( -id, os );
-    1945             :                     }
-    1946             :                 }
-    1947             :             }
-    1948             :         }
-    1949             :     }
-    1950             :     // pentaquarks
-    1951           0 :     for( l=1; l<9; ++l ) {
-    1952           0 :         for ( m=1; m<9; ++m ) {
-    1953           0 :             for( q3=1; q3<9; ++q3) {
-    1954           0 :                 for( q2=1; q2<9; ++q2) {
-    1955           0 :                     for( q1=1; q1<9; ++q1) {
-    1956           0 :                         id = 9*1000000+l*100000+m*10000+1000*q3+100*q2+10*q1+2;
-    1957           0 :                         writeParticleNameLine(  id, os );
-    1958           0 :                         writeParticleNameLine( -id, os );
-    1959             :                     }
-    1960             :                 }
-    1961             :             }
-    1962             :         }
-    1963             :     }
-    1964             :     // ions
-    1965           0 :     for( i=1; i<3; ++i) {
-    1966           0 :         for( m=1; m<5; ++m) {
-    1967           0 :                 id = 1000000000+10*m+10000*i;
-    1968           0 :                 writeParticleNameLine(  id, os );
-    1969           0 :                 writeParticleNameLine( -id, os );
-    1970             :         }
-    1971             :     }
-    1972             :     // some Dyons
-    1973           0 :     for( q3=0; q3<2; ++q3) {
-    1974           0 :         for( q2=0; q2<4; ++q2) {
-    1975           0 :             for( q1=0; q1<10; ++q1) {
-    1976           0 :                 ++q1;
-    1977           0 :                 id = 4110000+1000*q3+100*q2+10*q1;
-    1978           0 :                 writeParticleNameLine(  id, os );
-    1979           0 :                 writeParticleNameLine( -id, os );
-    1980           0 :                 id = 4120000+1000*q3+100*q2+10*q1;
-    1981           0 :                 writeParticleNameLine(  id, os );
-    1982           0 :                 writeParticleNameLine( -id, os );
-    1983             :             }
-    1984             :         }
-    1985             :     }
-    1986             :     // a few QBalls
-    1987           0 :     for( i=1; i<199; ++i ) {
-    1988           0 :         for( m=1; m<10; ) {
-    1989           0 :                 id = 10000000+10*m+100*i;
-    1990           0 :                 writeParticleNameLine(  id, os );
-    1991           0 :                 writeParticleNameLine( -id, os );
-    1992           0 :                 m += 3;
-    1993             :         }
-    1994             :         i += 11;
-    1995             :     }
-    1996           0 :     return;
-    1997             : }  // listParticleNames()
-    1998             : 
-    1999             : }       // HepPID
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/HepPID/src/Version.cc.func-sort-c.html b/doc/coverageReport/libs/HepPID/src/Version.cc.func-sort-c.html deleted file mode 100644 index 65c9d6164..000000000 --- a/doc/coverageReport/libs/HepPID/src/Version.cc.func-sort-c.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/HepPID/src/Version.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/HepPID/src - Version.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:080.0 %
Date:2024-04-08 14:58:22Functions:030.0 %
-
- -
- - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN6HepPID11versionNameB5cxx11Ev0
_ZN6HepPID12writeVersionERSo0
_ZN6HepPID7versionEv0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/HepPID/src/Version.cc.func.html b/doc/coverageReport/libs/HepPID/src/Version.cc.func.html deleted file mode 100644 index 0a0efae49..000000000 --- a/doc/coverageReport/libs/HepPID/src/Version.cc.func.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/HepPID/src/Version.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/HepPID/src - Version.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:080.0 %
Date:2024-04-08 14:58:22Functions:030.0 %
-
- -
- - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN6HepPID11versionNameB5cxx11Ev0
_ZN6HepPID12writeVersionERSo0
_ZN6HepPID7versionEv0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/HepPID/src/Version.cc.gcov.html b/doc/coverageReport/libs/HepPID/src/Version.cc.gcov.html deleted file mode 100644 index 1d5d7f616..000000000 --- a/doc/coverageReport/libs/HepPID/src/Version.cc.gcov.html +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/HepPID/src/Version.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/HepPID/src - Version.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:080.0 %
Date:2024-04-08 14:58:22Functions:030.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : // ----------------------------------------------------------------------
-       2             : //
-       3             : // version.cc
-       4             : // Author: Lynn Garren
-       5             : //
-       6             : //  for now, this is a free function
-       7             : //
-       8             : // ----------------------------------------------------------------------
-       9             : 
-      10             : #include "HepPID/Version.hh"
-      11             : 
-      12             : namespace HepPID {
-      13             : 
-      14           0 : std::string versionName( )
-      15             : {
-      16           0 :     return "3.04.01";
-      17             : }
-      18             : 
-      19           0 : void version( )
-      20             : {
-      21           0 :     std::cout << " --------------- HepPID Version " << versionName()
-      22             :               << " --------------- " << std::endl;
-      23           0 : }
-      24             : 
-      25           0 : void writeVersion( std::ostream & os )
-      26             : {
-      27           0 :     os << "             HepPID Version: " << versionName() << std::endl;
-      28           0 : }
-      29             : 
-      30             : }       // HepPID
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/HepPID/src/index-sort-f.html b/doc/coverageReport/libs/HepPID/src/index-sort-f.html deleted file mode 100644 index 0bc408cce..000000000 --- a/doc/coverageReport/libs/HepPID/src/index-sort-f.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/HepPID/src - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/HepPID/srcHitTotalCoverage
Test:coverage.info.cleanedLines:5044011.4 %
Date:2024-04-08 14:58:22Functions:114822.9 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Version.cc -
0.0%
-
0.0 %0 / 80.0 %0 / 3
ParticleName.cc -
0.0%
-
0.0 %0 / 1830.0 %0 / 13
ParticleIDMethods.cc -
20.1%20.1%
-
20.1 %50 / 24934.4 %11 / 32
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/HepPID/src/index-sort-l.html b/doc/coverageReport/libs/HepPID/src/index-sort-l.html deleted file mode 100644 index 5545aaf67..000000000 --- a/doc/coverageReport/libs/HepPID/src/index-sort-l.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/HepPID/src - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/HepPID/srcHitTotalCoverage
Test:coverage.info.cleanedLines:5044011.4 %
Date:2024-04-08 14:58:22Functions:114822.9 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Version.cc -
0.0%
-
0.0 %0 / 80.0 %0 / 3
ParticleName.cc -
0.0%
-
0.0 %0 / 1830.0 %0 / 13
ParticleIDMethods.cc -
20.1%20.1%
-
20.1 %50 / 24934.4 %11 / 32
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/HepPID/src/index.html b/doc/coverageReport/libs/HepPID/src/index.html deleted file mode 100644 index cce8733cc..000000000 --- a/doc/coverageReport/libs/HepPID/src/index.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/HepPID/src - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/HepPID/srcHitTotalCoverage
Test:coverage.info.cleanedLines:5044011.4 %
Date:2024-04-08 14:58:22Functions:114822.9 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
ParticleIDMethods.cc -
20.1%20.1%
-
20.1 %50 / 24934.4 %11 / 32
ParticleName.cc -
0.0%
-
0.0 %0 / 1830.0 %0 / 13
Version.cc -
0.0%
-
0.0 %0 / 80.0 %0 / 3
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/error_handling.cc.func-sort-c.html b/doc/coverageReport/libs/healpix_base/error_handling.cc.func-sort-c.html deleted file mode 100644 index 48630a2e2..000000000 --- a/doc/coverageReport/libs/healpix_base/error_handling.cc.func-sort-c.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/error_handling.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base - error_handling.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0120.0 %
Date:2024-04-08 14:58:22Functions:070.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix11PlanckErrorC2EPKc0
_ZN7healpix11PlanckErrorC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7healpix11PlanckErrorD0Ev0
_ZN7healpix11PlanckErrorD2Ev0
_ZN7healpix16planck_failure__EPKciS1_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7healpix16planck_failure__EPKciS1_S1_0
_ZN7healpix9killjob__Ev0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/error_handling.cc.func.html b/doc/coverageReport/libs/healpix_base/error_handling.cc.func.html deleted file mode 100644 index 3f1abe29a..000000000 --- a/doc/coverageReport/libs/healpix_base/error_handling.cc.func.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/error_handling.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base - error_handling.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0120.0 %
Date:2024-04-08 14:58:22Functions:070.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix11PlanckErrorC2EPKc0
_ZN7healpix11PlanckErrorC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7healpix11PlanckErrorD0Ev0
_ZN7healpix11PlanckErrorD2Ev0
_ZN7healpix16planck_failure__EPKciS1_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7healpix16planck_failure__EPKciS1_S1_0
_ZN7healpix9killjob__Ev0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/error_handling.cc.gcov.html b/doc/coverageReport/libs/healpix_base/error_handling.cc.gcov.html deleted file mode 100644 index d09b41e69..000000000 --- a/doc/coverageReport/libs/healpix_base/error_handling.cc.gcov.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/error_handling.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base - error_handling.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0120.0 %
Date:2024-04-08 14:58:22Functions:070.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : 
-       2             : /*
-       3             :  *  This file is part of libcxxsupport.
-       4             :  *
-       5             :  *  libcxxsupport is free software; you can redistribute it and/or modify
-       6             :  *  it under the terms of the GNU General Public License as published by
-       7             :  *  the Free Software Foundation; either version 2 of the License, or
-       8             :  *  (at your option) any later version.
-       9             :  *
-      10             :  *  libcxxsupport is distributed in the hope that it will be useful,
-      11             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-      12             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-      13             :  *  GNU General Public License for more details.
-      14             :  *
-      15             :  *  You should have received a copy of the GNU General Public License
-      16             :  *  along with libcxxsupport; if not, write to the Free Software
-      17             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-      18             :  */
-      19             : 
-      20             : /*
-      21             :  *  libcxxsupport is being developed at the Max-Planck-Institut fuer Astrophysik
-      22             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
-      23             :  *  (DLR).
-      24             :  */
-      25             : 
-      26             : /*
-      27             :  *  Utilities for error reporting
-      28             :  *
-      29             :  *  Copyright (C) 2003-2011 Max-Planck-Society
-      30             :  *  Author: Martin Reinecke
-      31             :  */
-      32             : 
-      33             : #include "healpix_base/error_handling.h"
-      34             : 
-      35             : namespace healpix{
-      36             : using namespace std;
-      37             : 
-      38           0 : PlanckError::PlanckError(const string &message) : msg (message) {}
-      39           0 : PlanckError::PlanckError(const char *message) : msg (message) {}
-      40             : 
-      41             : //virtual
-      42           0 : PlanckError::~PlanckError() {}
-      43             : 
-      44           0 : void planck_failure__(const char *file, int line, const char *func,
-      45             :   const string &msg)
-      46             :   {
-      47           0 :   cerr << "Error encountered at " << file << ", line " << line << endl;
-      48           0 :   if (func) cerr << "(function " << func << ")" << endl;
-      49           0 :   if (msg!="") cerr << endl << msg << endl;
-      50             :   cerr << endl;
-      51           0 :   }
-      52             : 
-      53           0 : void planck_failure__(const char *file, int line, const char *func,
-      54             :   const char *msg)
-      55           0 :   { planck_failure__ (file,line,func,string(msg)); }
-      56             : 
-      57           0 : void killjob__()
-      58           0 :   { throw; }
-      59             : } // namespace healpix
-      60             : 
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/geom_utils.cc.func-sort-c.html b/doc/coverageReport/libs/healpix_base/geom_utils.cc.func-sort-c.html deleted file mode 100644 index c1777f967..000000000 --- a/doc/coverageReport/libs/healpix_base/geom_utils.cc.func-sort-c.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/geom_utils.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base - geom_utils.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0250.0 %
Date:2024-04-08 14:58:22Functions:030.0 %
-
- -
- - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix10get_circleERKNS_3arrINS_6vec3_tIdEEEEmRS2_Rd0
_ZN7healpix10get_circleERKNS_3arrINS_6vec3_tIdEEEEmmRS2_Rd0
_ZN7healpix21find_enclosing_circleERKNS_3arrINS_6vec3_tIdEEEERS2_Rd0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/geom_utils.cc.func.html b/doc/coverageReport/libs/healpix_base/geom_utils.cc.func.html deleted file mode 100644 index db584b322..000000000 --- a/doc/coverageReport/libs/healpix_base/geom_utils.cc.func.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/geom_utils.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base - geom_utils.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0250.0 %
Date:2024-04-08 14:58:22Functions:030.0 %
-
- -
- - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix10get_circleERKNS_3arrINS_6vec3_tIdEEEEmRS2_Rd0
_ZN7healpix10get_circleERKNS_3arrINS_6vec3_tIdEEEEmmRS2_Rd0
_ZN7healpix21find_enclosing_circleERKNS_3arrINS_6vec3_tIdEEEERS2_Rd0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/geom_utils.cc.gcov.html b/doc/coverageReport/libs/healpix_base/geom_utils.cc.gcov.html deleted file mode 100644 index 2fdacf966..000000000 --- a/doc/coverageReport/libs/healpix_base/geom_utils.cc.gcov.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/geom_utils.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base - geom_utils.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0250.0 %
Date:2024-04-08 14:58:22Functions:030.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : /*
-       2             :  *  This file is part of libcxxsupport.
-       3             :  *
-       4             :  *  libcxxsupport is free software; you can redistribute it and/or modify
-       5             :  *  it under the terms of the GNU General Public License as published by
-       6             :  *  the Free Software Foundation; either version 2 of the License, or
-       7             :  *  (at your option) any later version.
-       8             :  *
-       9             :  *  libcxxsupport is distributed in the hope that it will be useful,
-      10             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-      11             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-      12             :  *  GNU General Public License for more details.
-      13             :  *
-      14             :  *  You should have received a copy of the GNU General Public License
-      15             :  *  along with libcxxsupport; if not, write to the Free Software
-      16             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-      17             :  */
-      18             : 
-      19             : /*
-      20             :  *  libcxxsupport is being developed at the Max-Planck-Institut fuer Astrophysik
-      21             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
-      22             :  *  (DLR).
-      23             :  */
-      24             : 
-      25             : /*
-      26             :  *  Copyright (C) 2011 Max-Planck-Society
-      27             :  *  \author Martin Reinecke
-      28             :  */
-      29             : 
-      30             : #include "healpix_base/geom_utils.h"
-      31             : #include "healpix_base/arr.h"
-      32             : 
-      33             : 
-      34             : namespace healpix{
-      35             : using namespace std;
-      36             : 
-      37             : 
-      38           0 : void get_circle (const arr<vec3> &point, tsize q1, tsize q2, vec3 &center,
-      39             :   double &cosrad)
-      40             :   {
-      41           0 :   center = (point[q1]+point[q2]).Norm();
-      42           0 :   cosrad = dotprod(point[q1],center);
-      43           0 :   for (tsize i=0; i<q1; ++i)
-      44           0 :     if (dotprod(point[i],center)<cosrad) // point outside the current circle
-      45             :       {
-      46           0 :       center=crossprod(point[q1]-point[i],point[q2]-point[i]).Norm();
-      47           0 :       cosrad=dotprod(point[i],center);
-      48           0 :       if (cosrad<0)
-      49           0 :         { center.Flip(); cosrad=-cosrad; }
-      50             :       }
-      51           0 :   }
-      52           0 : void get_circle (const arr<vec3> &point, tsize q, vec3 &center,
-      53             :   double &cosrad)
-      54             :   {
-      55           0 :   center = (point[0]+point[q]).Norm();
-      56           0 :   cosrad = dotprod(point[0],center);
-      57           0 :   for (tsize i=1; i<q; ++i)
-      58           0 :     if (dotprod(point[i],center)<cosrad) // point outside the current circle
-      59           0 :       get_circle(point,i,q,center,cosrad);
-      60           0 :   }
-      61             : 
-      62             : 
-      63           0 : void find_enclosing_circle (const arr<vec3> &point, vec3 &center,
-      64             :   double &cosrad)
-      65             :   {
-      66             :   tsize np=point.size();
-      67           0 :   planck_assert(np>=3,"too few points");
-      68           0 :   center = (point[0]+point[1]).Norm();
-      69           0 :   cosrad = dotprod(point[0],center);
-      70           0 :   for (tsize i=2; i<np; ++i)
-      71           0 :     if (dotprod(point[i],center)<cosrad) // point outside the current circle
-      72           0 :       get_circle(point,i,center,cosrad);
-      73           0 :   }
-      74             : } // namespace healpix
-      75             : 
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/healpix_base.cc.func-sort-c.html b/doc/coverageReport/libs/healpix_base/healpix_base.cc.func-sort-c.html deleted file mode 100644 index 522a3b809..000000000 --- a/doc/coverageReport/libs/healpix_base/healpix_base.cc.func-sort-c.html +++ /dev/null @@ -1,436 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/healpix_base.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base - healpix_base.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11273415.3 %
Date:2024-04-08 14:58:22Functions:109111.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix12_GLOBAL__N_111check_pixelIiiEEviiiiRNS_8rangesetIT0_EET_RSt6vectorISt4pairIS6_iESaIS9_EEbRi0
_ZN7healpix12_GLOBAL__N_111check_pixelIliEEviiiiRNS_8rangesetIT0_EET_RSt6vectorISt4pairIS6_iESaIS9_EEbRi0
_ZN7healpix12_GLOBAL__N_111check_pixelIllEEviiiiRNS_8rangesetIT0_EET_RSt6vectorISt4pairIS6_iESaIS9_EEbRi0
_ZN7healpix12_GLOBAL__N_116check_pixel_ringIiEEbRKNS_14T_Healpix_BaseIT_EES6_S3_S3_S3_idddS3_0
_ZN7healpix12_GLOBAL__N_116check_pixel_ringIlEEbRKNS_14T_Healpix_BaseIT_EES6_S3_S3_S3_idddS3_0
_ZN7healpix12_GLOBAL__N_19locToVec3Edddb0
_ZN7healpix14T_Healpix_BaseIiE10npix2nsideEi0
_ZN7healpix14T_Healpix_BaseIiE11nside2orderEi0
_ZN7healpix14T_Healpix_BaseIiE4swapERS1_0
_ZN7healpix14T_Healpix_BaseIiE8SetNsideEiNS_23Healpix_Ordering_SchemeE0
_ZN7healpix14T_Healpix_BaseIiEC2Ev0
_ZN7healpix14T_Healpix_BaseIlE10npix2nsideEl0
_ZN7healpix14T_Healpix_BaseIlE11nside2orderEl0
_ZN7healpix14T_Healpix_BaseIlE4swapERS1_0
_ZN7healpix14T_Healpix_BaseIlE8SetNsideElNS_23Healpix_Ordering_SchemeE0
_ZN7healpix14T_Healpix_BaseIlEC2Ev0
_ZNK7healpix14T_Healpix_BaseIiE10boundariesEimRSt6vectorINS_6vec3_tIdEESaIS4_EE0
_ZNK7healpix14T_Healpix_BaseIiE10max_pixradEi0
_ZNK7healpix14T_Healpix_BaseIiE10max_pixradEv0
_ZNK7healpix14T_Healpix_BaseIiE10nest2peanoEi0
_ZNK7healpix14T_Healpix_BaseIiE10peano2nestEi0
_ZNK7healpix14T_Healpix_BaseIiE10query_discENS_8pointingEdRNS_8rangesetIiEE0
_ZNK7healpix14T_Healpix_BaseIiE10ring_aboveEd0
_ZNK7healpix14T_Healpix_BaseIiE11query_stripEddbRNS_8rangesetIiEE0
_ZNK7healpix14T_Healpix_BaseIiE11swap_cyclesEv0
_ZNK7healpix14T_Healpix_BaseIiE12get_interpolERKNS_8pointingERNS_7fix_arrIiLm4EEERNS5_IdLm4EEE0
_ZNK7healpix14T_Healpix_BaseIiE13get_ring_infoEiRiS2_RdS3_Rb0
_ZNK7healpix14T_Healpix_BaseIiE13query_polygonERKSt6vectorINS_8pointingESaIS3_EERNS_8rangesetIiEE0
_ZNK7healpix14T_Healpix_BaseIiE14get_ring_info2EiRiS2_RdRb0
_ZNK7healpix14T_Healpix_BaseIiE15query_multidiscIiEEvRKNS_3arrINS_6vec3_tIdEEEERKNS3_IdEEiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIiE17nest_peano_helperEii0
_ZNK7healpix14T_Healpix_BaseIiE19get_ring_info_smallEiRiS2_Rb0
_ZNK7healpix14T_Healpix_BaseIiE19query_disc_internalIiEEvNS_8pointingEdiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIiE20query_disc_inclusiveENS_8pointingEdRNS_8rangesetIiEEi0
_ZNK7healpix14T_Healpix_BaseIiE20query_strip_internalEddbRNS_8rangesetIiEE0
_ZNK7healpix14T_Healpix_BaseIiE22query_polygon_internalIiEEvRKSt6vectorINS_8pointingESaIS4_EEiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIiE23query_multidisc_generalERKNS_3arrINS_6vec3_tIdEEEERKNS2_IdEEbRKSt6vectorIiSaIiEERNS_8rangesetIiEE0
_ZNK7healpix14T_Healpix_BaseIiE23query_polygon_inclusiveERKSt6vectorINS_8pointingESaIS3_EERNS_8rangesetIiEEi0
_ZNK7healpix14T_Healpix_BaseIiE6ring2zEi0
_ZNK7healpix14T_Healpix_BaseIiE7xyf2locEddiRdS2_S2_Rb0
_ZNK7healpix14T_Healpix_BaseIiE8nest2xyfEiRiS2_S2_0
_ZNK7healpix14T_Healpix_BaseIiE8pix2ringEi0
_ZNK7healpix14T_Healpix_BaseIiE8xyf2ringEiii0
_ZNK7healpix14T_Healpix_BaseIiE9neighborsEiRNS_7fix_arrIiLm8EEE0
_ZNK7healpix14T_Healpix_BaseIiE9nest2ringEi0
_ZNK7healpix14T_Healpix_BaseIlE10boundariesElmRSt6vectorINS_6vec3_tIdEESaIS4_EE0
_ZNK7healpix14T_Healpix_BaseIlE10max_pixradEl0
_ZNK7healpix14T_Healpix_BaseIlE10max_pixradEv0
_ZNK7healpix14T_Healpix_BaseIlE10nest2peanoEl0
_ZNK7healpix14T_Healpix_BaseIlE10peano2nestEl0
_ZNK7healpix14T_Healpix_BaseIlE10query_discENS_8pointingEdRNS_8rangesetIlEE0
_ZNK7healpix14T_Healpix_BaseIlE10ring_aboveEd0
_ZNK7healpix14T_Healpix_BaseIlE11query_stripEddbRNS_8rangesetIlEE0
_ZNK7healpix14T_Healpix_BaseIlE11spread_bitsEi0
_ZNK7healpix14T_Healpix_BaseIlE11swap_cyclesEv0
_ZNK7healpix14T_Healpix_BaseIlE12get_interpolERKNS_8pointingERNS_7fix_arrIlLm4EEERNS5_IdLm4EEE0
_ZNK7healpix14T_Healpix_BaseIlE13get_ring_infoElRlS2_RdS3_Rb0
_ZNK7healpix14T_Healpix_BaseIlE13query_polygonERKSt6vectorINS_8pointingESaIS3_EERNS_8rangesetIlEE0
_ZNK7healpix14T_Healpix_BaseIlE14get_ring_info2ElRlS2_RdRb0
_ZNK7healpix14T_Healpix_BaseIlE15query_multidiscIiEEvRKNS_3arrINS_6vec3_tIdEEEERKNS3_IdEEiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIlE15query_multidiscIlEEvRKNS_3arrINS_6vec3_tIdEEEERKNS3_IdEEiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIlE17nest_peano_helperEli0
_ZNK7healpix14T_Healpix_BaseIlE19get_ring_info_smallElRlS2_Rb0
_ZNK7healpix14T_Healpix_BaseIlE19query_disc_internalIiEEvNS_8pointingEdiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIlE19query_disc_internalIlEEvNS_8pointingEdiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIlE20query_disc_inclusiveENS_8pointingEdRNS_8rangesetIlEEi0
_ZNK7healpix14T_Healpix_BaseIlE20query_strip_internalEddbRNS_8rangesetIlEE0
_ZNK7healpix14T_Healpix_BaseIlE22query_polygon_internalIiEEvRKSt6vectorINS_8pointingESaIS4_EEiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIlE22query_polygon_internalIlEEvRKSt6vectorINS_8pointingESaIS4_EEiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIlE23query_multidisc_generalERKNS_3arrINS_6vec3_tIdEEEERKNS2_IdEEbRKSt6vectorIiSaIiEERNS_8rangesetIlEE0
_ZNK7healpix14T_Healpix_BaseIlE23query_polygon_inclusiveERKSt6vectorINS_8pointingESaIS3_EERNS_8rangesetIlEEi0
_ZNK7healpix14T_Healpix_BaseIlE6ring2zEl0
_ZNK7healpix14T_Healpix_BaseIlE7loc2pixEdddb0
_ZNK7healpix14T_Healpix_BaseIlE7xyf2locEddiRdS2_S2_Rb0
_ZNK7healpix14T_Healpix_BaseIlE8pix2ringEl0
_ZNK7healpix14T_Healpix_BaseIlE8ring2xyfElRiS2_S2_0
_ZNK7healpix14T_Healpix_BaseIlE8xyf2nestEiii0
_ZNK7healpix14T_Healpix_BaseIlE8xyf2ringEiii0
_ZNK7healpix14T_Healpix_BaseIlE9neighborsElRNS_7fix_arrIlLm8EEE0
_ZNK7healpix14T_Healpix_BaseIlE9nest2ringEl0
_ZNK7healpix14T_Healpix_BaseIlE9ring2nestEl0
_ZN7healpix14T_Healpix_BaseIiE3SetEiNS_23Healpix_Ordering_SchemeE10
_ZN7healpix14T_Healpix_BaseIlE3SetEiNS_23Healpix_Ordering_SchemeE19
_ZNK7healpix14T_Healpix_BaseIiE8ring2xyfEiRiS2_S2_421
_ZNK7healpix14T_Healpix_BaseIiE8xyf2nestEiii421
_ZNK7healpix14T_Healpix_BaseIiE9ring2nestEi421
_ZNK7healpix14T_Healpix_BaseIlE7pix2locElRdS2_S2_Rb421
_ZNK7healpix14T_Healpix_BaseIlE8nest2xyfElRiS2_S2_421
_ZNK7healpix14T_Healpix_BaseIlE13compress_bitsEl842
_ZNK7healpix14T_Healpix_BaseIiE7loc2pixEdddb24585
_ZNK7healpix14T_Healpix_BaseIiE7pix2locEiRdS2_S2_Rb135172
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/healpix_base.cc.func.html b/doc/coverageReport/libs/healpix_base/healpix_base.cc.func.html deleted file mode 100644 index 30c46e124..000000000 --- a/doc/coverageReport/libs/healpix_base/healpix_base.cc.func.html +++ /dev/null @@ -1,436 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/healpix_base.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base - healpix_base.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11273415.3 %
Date:2024-04-08 14:58:22Functions:109111.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix12_GLOBAL__N_111check_pixelIiiEEviiiiRNS_8rangesetIT0_EET_RSt6vectorISt4pairIS6_iESaIS9_EEbRi0
_ZN7healpix12_GLOBAL__N_111check_pixelIliEEviiiiRNS_8rangesetIT0_EET_RSt6vectorISt4pairIS6_iESaIS9_EEbRi0
_ZN7healpix12_GLOBAL__N_111check_pixelIllEEviiiiRNS_8rangesetIT0_EET_RSt6vectorISt4pairIS6_iESaIS9_EEbRi0
_ZN7healpix12_GLOBAL__N_116check_pixel_ringIiEEbRKNS_14T_Healpix_BaseIT_EES6_S3_S3_S3_idddS3_0
_ZN7healpix12_GLOBAL__N_116check_pixel_ringIlEEbRKNS_14T_Healpix_BaseIT_EES6_S3_S3_S3_idddS3_0
_ZN7healpix12_GLOBAL__N_19locToVec3Edddb0
_ZN7healpix14T_Healpix_BaseIiE10npix2nsideEi0
_ZN7healpix14T_Healpix_BaseIiE11nside2orderEi0
_ZN7healpix14T_Healpix_BaseIiE3SetEiNS_23Healpix_Ordering_SchemeE10
_ZN7healpix14T_Healpix_BaseIiE4swapERS1_0
_ZN7healpix14T_Healpix_BaseIiE8SetNsideEiNS_23Healpix_Ordering_SchemeE0
_ZN7healpix14T_Healpix_BaseIiEC2Ev0
_ZN7healpix14T_Healpix_BaseIlE10npix2nsideEl0
_ZN7healpix14T_Healpix_BaseIlE11nside2orderEl0
_ZN7healpix14T_Healpix_BaseIlE3SetEiNS_23Healpix_Ordering_SchemeE19
_ZN7healpix14T_Healpix_BaseIlE4swapERS1_0
_ZN7healpix14T_Healpix_BaseIlE8SetNsideElNS_23Healpix_Ordering_SchemeE0
_ZN7healpix14T_Healpix_BaseIlEC2Ev0
_ZNK7healpix14T_Healpix_BaseIiE10boundariesEimRSt6vectorINS_6vec3_tIdEESaIS4_EE0
_ZNK7healpix14T_Healpix_BaseIiE10max_pixradEi0
_ZNK7healpix14T_Healpix_BaseIiE10max_pixradEv0
_ZNK7healpix14T_Healpix_BaseIiE10nest2peanoEi0
_ZNK7healpix14T_Healpix_BaseIiE10peano2nestEi0
_ZNK7healpix14T_Healpix_BaseIiE10query_discENS_8pointingEdRNS_8rangesetIiEE0
_ZNK7healpix14T_Healpix_BaseIiE10ring_aboveEd0
_ZNK7healpix14T_Healpix_BaseIiE11query_stripEddbRNS_8rangesetIiEE0
_ZNK7healpix14T_Healpix_BaseIiE11swap_cyclesEv0
_ZNK7healpix14T_Healpix_BaseIiE12get_interpolERKNS_8pointingERNS_7fix_arrIiLm4EEERNS5_IdLm4EEE0
_ZNK7healpix14T_Healpix_BaseIiE13get_ring_infoEiRiS2_RdS3_Rb0
_ZNK7healpix14T_Healpix_BaseIiE13query_polygonERKSt6vectorINS_8pointingESaIS3_EERNS_8rangesetIiEE0
_ZNK7healpix14T_Healpix_BaseIiE14get_ring_info2EiRiS2_RdRb0
_ZNK7healpix14T_Healpix_BaseIiE15query_multidiscIiEEvRKNS_3arrINS_6vec3_tIdEEEERKNS3_IdEEiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIiE17nest_peano_helperEii0
_ZNK7healpix14T_Healpix_BaseIiE19get_ring_info_smallEiRiS2_Rb0
_ZNK7healpix14T_Healpix_BaseIiE19query_disc_internalIiEEvNS_8pointingEdiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIiE20query_disc_inclusiveENS_8pointingEdRNS_8rangesetIiEEi0
_ZNK7healpix14T_Healpix_BaseIiE20query_strip_internalEddbRNS_8rangesetIiEE0
_ZNK7healpix14T_Healpix_BaseIiE22query_polygon_internalIiEEvRKSt6vectorINS_8pointingESaIS4_EEiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIiE23query_multidisc_generalERKNS_3arrINS_6vec3_tIdEEEERKNS2_IdEEbRKSt6vectorIiSaIiEERNS_8rangesetIiEE0
_ZNK7healpix14T_Healpix_BaseIiE23query_polygon_inclusiveERKSt6vectorINS_8pointingESaIS3_EERNS_8rangesetIiEEi0
_ZNK7healpix14T_Healpix_BaseIiE6ring2zEi0
_ZNK7healpix14T_Healpix_BaseIiE7loc2pixEdddb24585
_ZNK7healpix14T_Healpix_BaseIiE7pix2locEiRdS2_S2_Rb135172
_ZNK7healpix14T_Healpix_BaseIiE7xyf2locEddiRdS2_S2_Rb0
_ZNK7healpix14T_Healpix_BaseIiE8nest2xyfEiRiS2_S2_0
_ZNK7healpix14T_Healpix_BaseIiE8pix2ringEi0
_ZNK7healpix14T_Healpix_BaseIiE8ring2xyfEiRiS2_S2_421
_ZNK7healpix14T_Healpix_BaseIiE8xyf2nestEiii421
_ZNK7healpix14T_Healpix_BaseIiE8xyf2ringEiii0
_ZNK7healpix14T_Healpix_BaseIiE9neighborsEiRNS_7fix_arrIiLm8EEE0
_ZNK7healpix14T_Healpix_BaseIiE9nest2ringEi0
_ZNK7healpix14T_Healpix_BaseIiE9ring2nestEi421
_ZNK7healpix14T_Healpix_BaseIlE10boundariesElmRSt6vectorINS_6vec3_tIdEESaIS4_EE0
_ZNK7healpix14T_Healpix_BaseIlE10max_pixradEl0
_ZNK7healpix14T_Healpix_BaseIlE10max_pixradEv0
_ZNK7healpix14T_Healpix_BaseIlE10nest2peanoEl0
_ZNK7healpix14T_Healpix_BaseIlE10peano2nestEl0
_ZNK7healpix14T_Healpix_BaseIlE10query_discENS_8pointingEdRNS_8rangesetIlEE0
_ZNK7healpix14T_Healpix_BaseIlE10ring_aboveEd0
_ZNK7healpix14T_Healpix_BaseIlE11query_stripEddbRNS_8rangesetIlEE0
_ZNK7healpix14T_Healpix_BaseIlE11spread_bitsEi0
_ZNK7healpix14T_Healpix_BaseIlE11swap_cyclesEv0
_ZNK7healpix14T_Healpix_BaseIlE12get_interpolERKNS_8pointingERNS_7fix_arrIlLm4EEERNS5_IdLm4EEE0
_ZNK7healpix14T_Healpix_BaseIlE13compress_bitsEl842
_ZNK7healpix14T_Healpix_BaseIlE13get_ring_infoElRlS2_RdS3_Rb0
_ZNK7healpix14T_Healpix_BaseIlE13query_polygonERKSt6vectorINS_8pointingESaIS3_EERNS_8rangesetIlEE0
_ZNK7healpix14T_Healpix_BaseIlE14get_ring_info2ElRlS2_RdRb0
_ZNK7healpix14T_Healpix_BaseIlE15query_multidiscIiEEvRKNS_3arrINS_6vec3_tIdEEEERKNS3_IdEEiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIlE15query_multidiscIlEEvRKNS_3arrINS_6vec3_tIdEEEERKNS3_IdEEiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIlE17nest_peano_helperEli0
_ZNK7healpix14T_Healpix_BaseIlE19get_ring_info_smallElRlS2_Rb0
_ZNK7healpix14T_Healpix_BaseIlE19query_disc_internalIiEEvNS_8pointingEdiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIlE19query_disc_internalIlEEvNS_8pointingEdiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIlE20query_disc_inclusiveENS_8pointingEdRNS_8rangesetIlEEi0
_ZNK7healpix14T_Healpix_BaseIlE20query_strip_internalEddbRNS_8rangesetIlEE0
_ZNK7healpix14T_Healpix_BaseIlE22query_polygon_internalIiEEvRKSt6vectorINS_8pointingESaIS4_EEiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIlE22query_polygon_internalIlEEvRKSt6vectorINS_8pointingESaIS4_EEiRNS_8rangesetIT_EE0
_ZNK7healpix14T_Healpix_BaseIlE23query_multidisc_generalERKNS_3arrINS_6vec3_tIdEEEERKNS2_IdEEbRKSt6vectorIiSaIiEERNS_8rangesetIlEE0
_ZNK7healpix14T_Healpix_BaseIlE23query_polygon_inclusiveERKSt6vectorINS_8pointingESaIS3_EERNS_8rangesetIlEEi0
_ZNK7healpix14T_Healpix_BaseIlE6ring2zEl0
_ZNK7healpix14T_Healpix_BaseIlE7loc2pixEdddb0
_ZNK7healpix14T_Healpix_BaseIlE7pix2locElRdS2_S2_Rb421
_ZNK7healpix14T_Healpix_BaseIlE7xyf2locEddiRdS2_S2_Rb0
_ZNK7healpix14T_Healpix_BaseIlE8nest2xyfElRiS2_S2_421
_ZNK7healpix14T_Healpix_BaseIlE8pix2ringEl0
_ZNK7healpix14T_Healpix_BaseIlE8ring2xyfElRiS2_S2_0
_ZNK7healpix14T_Healpix_BaseIlE8xyf2nestEiii0
_ZNK7healpix14T_Healpix_BaseIlE8xyf2ringEiii0
_ZNK7healpix14T_Healpix_BaseIlE9neighborsElRNS_7fix_arrIlLm8EEE0
_ZNK7healpix14T_Healpix_BaseIlE9nest2ringEl0
_ZNK7healpix14T_Healpix_BaseIlE9ring2nestEl0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/healpix_base.cc.gcov.html b/doc/coverageReport/libs/healpix_base/healpix_base.cc.gcov.html deleted file mode 100644 index be3123d75..000000000 --- a/doc/coverageReport/libs/healpix_base/healpix_base.cc.gcov.html +++ /dev/null @@ -1,1454 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/healpix_base.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base - healpix_base.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:11273415.3 %
Date:2024-04-08 14:58:22Functions:109111.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : /*
-       2             :  *  This file is part of Healpix_cxx.
-       3             :  *
-       4             :  *  Healpix_cxx is free software; you can redistribute it and/or modify
-       5             :  *  it under the terms of the GNU General Public License as published by
-       6             :  *  the Free Software Foundation; either version 2 of the License, or
-       7             :  *  (at your option) any later version.
-       8             :  *
-       9             :  *  Healpix_cxx is distributed in the hope that it will be useful,
-      10             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-      11             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-      12             :  *  GNU General Public License for more details.
-      13             :  *
-      14             :  *  You should have received a copy of the GNU General Public License
-      15             :  *  along with Healpix_cxx; if not, write to the Free Software
-      16             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-      17             :  *
-      18             :  *  For more information about HEALPix, see http://healpix.sourceforge.net
-      19             :  */
-      20             : 
-      21             : /*
-      22             :  *  Healpix_cxx is being developed at the Max-Planck-Institut fuer Astrophysik
-      23             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
-      24             :  *  (DLR).
-      25             :  */
-      26             : 
-      27             : /*
-      28             :  *  Copyright (C) 2003-2012 Max-Planck-Society
-      29             :  *  Author: Martin Reinecke
-      30             :  */
-      31             : 
-      32             : #include "healpix_base/healpix_base.h"
-      33             : #include "healpix_base/geom_utils.h"
-      34             : #include "healpix_base/lsconstants.h"
-      35             : 
-      36             : namespace healpix{
-      37             : 
-      38             : using namespace std;
-      39             : 
-      40             : template<> const int T_Healpix_Base<int  >::order_max=13;
-      41             : template<> const int T_Healpix_Base<int64>::order_max=29;
-      42             : 
-      43           0 : template<typename I> int T_Healpix_Base<I>::nside2order (I nside)
-      44             :   {
-      45           0 :   planck_assert (nside>I(0), "invalid value for Nside");
-      46           0 :   return ((nside)&(nside-1)) ? -1 : ilog2(nside);
-      47             :   }
-      48           0 : template<typename I> I T_Healpix_Base<I>::npix2nside (I npix)
-      49             :   {
-      50           0 :   I res=isqrt(npix/I(12));
-      51           0 :   planck_assert (npix==res*res*I(12), "invalid value for npix");
-      52           0 :   return res;
-      53             :   }
-      54             : 
-      55           0 : template<typename I> I T_Healpix_Base<I>::ring_above (double z) const
-      56             :   {
-      57             :   double az=abs(z);
-      58           0 :   if (az<=twothird) // equatorial region
-      59           0 :     return I(nside_*(2-1.5*z));
-      60           0 :   I iring = I(nside_*sqrt(3*(1-az)));
-      61           0 :   return (z>0) ? iring : 4*nside_-iring-1;
-      62             :   }
-      63             : 
-      64             : namespace {
-      65             : 
-      66             : /* Short note on the "zone":
-      67             :    zone = 0: pixel lies completely outside the queried shape
-      68             :           1: pixel may overlap with the shape, pixel center is outside
-      69             :           2: pixel center is inside the shape, but maybe not the complete pixel
-      70             :           3: pixel lies completely inside the shape */
-      71             : 
-      72           0 : template<typename I, typename I2> inline void check_pixel (int o, int order_,
-      73             :   int omax, int zone, rangeset<I2> &pixset, I pix, vector<pair<I,int> > &stk,
-      74             :   bool inclusive, int &stacktop)
-      75             :   {
-      76           0 :   if (zone==0) return;
-      77             : 
-      78           0 :   if (o<order_)
-      79             :     {
-      80           0 :     if (zone>=3)
-      81             :       {
-      82           0 :       int sdist=2*(order_-o); // the "bit-shift distance" between map orders
-      83           0 :       pixset.append(pix<<sdist,(pix+1)<<sdist); // output all subpixels
-      84             :       }
-      85             :     else // (zone>=1)
-      86           0 :       for (int i=0; i<4; ++i)
-      87           0 :         stk.push_back(make_pair(4*pix+3-i,o+1)); // add children
-      88             :     }
-      89           0 :   else if (o>order_) // this implies that inclusive==true
-      90             :     {
-      91           0 :     if (zone>=2) // pixel center in shape
-      92             :       {
-      93           0 :       pixset.append(pix>>(2*(o-order_))); // output the parent pixel at order_
-      94           0 :       stk.resize(stacktop); // unwind the stack
-      95             :       }
-      96             :     else // (zone>=1): pixel center in safety range
-      97             :       {
-      98           0 :       if (o<omax) // check sublevels
-      99           0 :         for (int i=0; i<4; ++i) // add children in reverse order
-     100           0 :           stk.push_back(make_pair(4*pix+3-i,o+1));
-     101             :       else // at resolution limit
-     102             :         {
-     103           0 :         pixset.append(pix>>(2*(o-order_))); // output the parent pixel at order_
-     104           0 :         stk.resize(stacktop); // unwind the stack
-     105             :         }
-     106             :       }
-     107             :     }
-     108             :   else // o==order_
-     109             :     {
-     110           0 :     if (zone>=2)
-     111           0 :       pixset.append(pix);
-     112           0 :     else if (inclusive) // and (zone>=1)
-     113             :       {
-     114           0 :       if (order_<omax) // check sublevels
-     115             :         {
-     116           0 :         stacktop=stk.size(); // remember current stack position
-     117           0 :         for (int i=0; i<4; ++i) // add children in reverse order
-     118           0 :           stk.push_back(make_pair(4*pix+3-i,o+1));
-     119             :         }
-     120             :       else // at resolution limit
-     121           0 :         pixset.append(pix); // output the pixel
-     122             :       }
-     123             :     }
-     124             :   }
-     125             : 
-     126           0 : template<typename I> bool check_pixel_ring (const T_Healpix_Base<I> &b1,
-     127             :   const T_Healpix_Base<I> &b2, I pix, I nr, I ipix1, int fct,
-     128             :   double cz, double cphi, double cosrp2, I cpix)
-     129             :   {
-     130           0 :   if (pix>=nr) pix-=nr;
-     131           0 :   if (pix<0) pix+=nr;
-     132           0 :   pix+=ipix1;
-     133           0 :   if (pix==cpix) return false; // disk center in pixel => overlap
-     134             :   int px,py,pf;
-     135           0 :   b1.pix2xyf(pix,px,py,pf);
-     136           0 :   for (int i=0; i<fct-1; ++i) // go along the 4 edges
-     137             :     {
-     138           0 :     I ox=fct*px, oy=fct*py;
-     139             :     double pz,pphi;
-     140           0 :     b2.pix2zphi(b2.xyf2pix(ox+i,oy,pf),pz,pphi);
-     141           0 :     if (cosdist_zphi(pz,pphi,cz,cphi)>cosrp2) // overlap
-     142           0 :       return false;
-     143           0 :     b2.pix2zphi(b2.xyf2pix(ox+fct-1,oy+i,pf),pz,pphi);
-     144           0 :     if (cosdist_zphi(pz,pphi,cz,cphi)>cosrp2) // overlap
-     145             :       return false;
-     146           0 :     b2.pix2zphi(b2.xyf2pix(ox+fct-1-i,oy+fct-1,pf),pz,pphi);
-     147           0 :     if (cosdist_zphi(pz,pphi,cz,cphi)>cosrp2) // overlap
-     148             :       return false;
-     149           0 :     b2.pix2zphi(b2.xyf2pix(ox,oy+fct-1-i,pf),pz,pphi);
-     150           0 :     if (cosdist_zphi(pz,pphi,cz,cphi)>cosrp2) // overlap
-     151             :       return false;
-     152             :     }
-     153             :   return true;
-     154             :   }
-     155             : 
-     156             : } // unnamed namespace
-     157             : 
-     158             : template<typename I> template<typename I2>
-     159           0 :   void T_Healpix_Base<I>::query_disc_internal
-     160             :   (pointing ptg, double radius, int fact, rangeset<I2> &pixset) const
-     161             :   {
-     162           0 :   bool inclusive = (fact!=0);
-     163             :   pixset.clear();
-     164           0 :   ptg.normalize();
-     165             : 
-     166           0 :   if (scheme_==RING)
-     167             :     {
-     168             :     I fct=1;
-     169           0 :     if (inclusive)
-     170             :       {
-     171           0 :       planck_assert (((I(1)<<order_max)/nside_)>=fact,
-     172             :         "invalid oversampling factor");
-     173             :       fct = fact;
-     174             :       }
-     175           0 :     T_Healpix_Base b2;
-     176             :     double rsmall, rbig;
-     177           0 :     if (fct>1)
-     178             :       {
-     179           0 :       b2.SetNside(fct*nside_,RING);
-     180           0 :       rsmall = radius+b2.max_pixrad();
-     181           0 :       rbig = radius+max_pixrad();
-     182             :       }
-     183             :     else
-     184           0 :       rsmall = rbig = inclusive ? radius+max_pixrad() : radius;
-     185             : 
-     186           0 :     if (rsmall>=pi)
-     187           0 :       { pixset.append(0,npix_); return; }
-     188             : 
-     189           0 :     rbig = min(pi,rbig);
-     190             : 
-     191           0 :     double cosrsmall = cos(rsmall);
-     192           0 :     double cosrbig = cos(rbig);
-     193             : 
-     194           0 :     double z0 = cos(ptg.theta);
-     195           0 :     double xa = 1./sqrt((1-z0)*(1+z0));
-     196             : 
-     197           0 :     I cpix=zphi2pix(z0,ptg.phi);
-     198             : 
-     199           0 :     double rlat1 = ptg.theta - rsmall;
-     200           0 :     double zmax = cos(rlat1);
-     201           0 :     I irmin = ring_above (zmax)+1;
-     202             : 
-     203           0 :     if ((rlat1<=0) && (irmin>1)) // north pole in the disk
-     204             :       {
-     205             :       I sp,rp; bool dummy;
-     206           0 :       get_ring_info_small(irmin-1,sp,rp,dummy);
-     207           0 :       pixset.append(0,sp+rp);
-     208             :       }
-     209             : 
-     210           0 :     if ((fct>1) && (rlat1>0)) irmin=max(I(1),irmin-1);
-     211             : 
-     212           0 :     double rlat2 = ptg.theta + rsmall;
-     213           0 :     double zmin = cos(rlat2);
-     214           0 :     I irmax = ring_above (zmin);
-     215             : 
-     216           0 :     if ((fct>1) && (rlat2<pi)) irmax=min(4*nside_-1,irmax+1);
-     217             : 
-     218           0 :     for (I iz=irmin; iz<=irmax; ++iz)
-     219             :       {
-     220           0 :       double z=ring2z(iz);
-     221           0 :       double x = (cosrbig-z*z0)*xa;
-     222           0 :       double ysq = 1-z*z-x*x;
-     223           0 :       double dphi = (ysq<=0) ? pi-1e-15 : atan2(sqrt(ysq),x);
-     224             :       I nr, ipix1;
-     225             :       bool shifted;
-     226           0 :       get_ring_info_small(iz,ipix1,nr,shifted);
-     227           0 :       double shift = shifted ? 0.5 : 0.;
-     228             : 
-     229           0 :       I ipix2 = ipix1 + nr - 1; // highest pixel number in the ring
-     230             : 
-     231           0 :       I ip_lo = ifloor<I>(nr*inv_twopi*(ptg.phi-dphi) - shift)+1;
-     232           0 :       I ip_hi = ifloor<I>(nr*inv_twopi*(ptg.phi+dphi) - shift);
-     233             : 
-     234           0 :       if (fct>1)
-     235             :         {
-     236           0 :         while ((ip_lo<=ip_hi) && check_pixel_ring
-     237           0 :                (*this,b2,ip_lo,nr,ipix1,fct,z0,ptg.phi,cosrsmall,cpix))
-     238           0 :           ++ip_lo;
-     239           0 :         while ((ip_hi>ip_lo) && check_pixel_ring
-     240           0 :                (*this,b2,ip_hi,nr,ipix1,fct,z0,ptg.phi,cosrsmall,cpix))
-     241           0 :           --ip_hi;
-     242             :         }
-     243             : 
-     244           0 :       if (ip_lo<=ip_hi)
-     245             :         {
-     246           0 :         if (ip_hi>=nr)
-     247           0 :           { ip_lo-=nr; ip_hi-=nr; }
-     248           0 :         if (ip_lo<0)
-     249             :           {
-     250           0 :           pixset.append(ipix1,ipix1+ip_hi+1);
-     251           0 :           pixset.append(ipix1+ip_lo+nr,ipix2+1);
-     252             :           }
-     253             :         else
-     254           0 :           pixset.append(ipix1+ip_lo,ipix1+ip_hi+1);
-     255             :         }
-     256             :       }
-     257           0 :     if ((rlat2>=pi) && (irmax+1<4*nside_)) // south pole in the disk
-     258             :       {
-     259             :       I sp,rp; bool dummy;
-     260           0 :       get_ring_info_small(irmax+1,sp,rp,dummy);
-     261           0 :       pixset.append(sp,npix_);
-     262             :       }
-     263             :     }
-     264             :   else // scheme_==NEST
-     265             :     {
-     266           0 :     if (radius>=pi) // disk covers the whole sphere
-     267           0 :       { pixset.append(0,npix_); return; }
-     268             : 
-     269             :     int oplus = 0;
-     270           0 :     if (inclusive)
-     271             :       {
-     272           0 :       planck_assert ((I(1)<<(order_max-order_))>=fact,
-     273             :         "invalid oversampling factor");
-     274           0 :       planck_assert ((fact&(fact-1))==0,
-     275             :         "oversampling factor must be a power of 2");
-     276           0 :       oplus=ilog2(fact);
-     277             :       }
-     278           0 :     int omax=order_+oplus; // the order up to which we test
-     279             : 
-     280             :     vec3 vptg(ptg);
-     281           0 :     arr<T_Healpix_Base<I> > base(omax+1);
-     282             :     arr<double> crpdr(omax+1), crmdr(omax+1);
-     283           0 :     double cosrad=cos(radius);
-     284           0 :     for (int o=0; o<=omax; ++o) // prepare data at the required orders
-     285             :       {
-     286           0 :       base[o].Set(o,NEST);
-     287           0 :       double dr=base[o].max_pixrad(); // safety distance
-     288           0 :       crpdr[o] = (radius+dr>pi) ? -1. : cos(radius+dr);
-     289           0 :       crmdr[o] = (radius-dr<0.) ?  1. : cos(radius-dr);
-     290             :       }
-     291             :     vector<pair<I,int> > stk; // stack for pixel numbers and their orders
-     292           0 :     stk.reserve(12+3*omax); // reserve maximum size to avoid reallocation
-     293           0 :     for (int i=0; i<12; ++i) // insert the 12 base pixels in reverse order
-     294           0 :       stk.push_back(make_pair(I(11-i),0));
-     295             : 
-     296           0 :     int stacktop=0; // a place to save a stack position
-     297             : 
-     298           0 :     while (!stk.empty()) // as long as there are pixels on the stack
-     299             :       {
-     300             :       // pop current pixel number and order from the stack
-     301           0 :       I pix=stk.back().first;
-     302           0 :       int o=stk.back().second;
-     303             :       stk.pop_back();
-     304             : 
-     305             :       double z,phi;
-     306             :       base[o].pix2zphi(pix,z,phi);
-     307             :       // cosine of angular distance between pixel center and disk center
-     308           0 :       double cangdist=cosdist_zphi(vptg.z,ptg.phi,z,phi);
-     309             : 
-     310           0 :       if (cangdist>crpdr[o])
-     311             :         {
-     312           0 :         int zone = (cangdist<cosrad) ? 1 : ((cangdist<=crmdr[o]) ? 2 : 3);
-     313             : 
-     314           0 :         check_pixel (o, order_, omax, zone, pixset, pix, stk, inclusive,
-     315             :           stacktop);
-     316             :         }
-     317             :       }
-     318             :     }
-     319             :   }
-     320             : 
-     321           0 : template<typename I> void T_Healpix_Base<I>::query_disc
-     322             :   (pointing ptg, double radius, rangeset<I> &pixset) const
-     323             :   {
-     324           0 :   query_disc_internal (ptg, radius, 0, pixset);
-     325           0 :   }
-     326             : 
-     327           0 : template<typename I> void T_Healpix_Base<I>::query_disc_inclusive
-     328             :   (pointing ptg, double radius, rangeset<I> &pixset, int fact) const
-     329             :   {
-     330           0 :   planck_assert(fact>0,"fact must be a positive integer");
-     331           0 :   if ((sizeof(I)<8) && (((I(1)<<order_max)/nside_)<fact))
-     332             :     {
-     333           0 :     T_Healpix_Base<int64> base2(nside_,scheme_,SET_NSIDE);
-     334           0 :     base2.query_disc_internal(ptg,radius,fact,pixset);
-     335             :     return;
-     336             :     }
-     337           0 :   query_disc_internal (ptg, radius, fact, pixset);
-     338             :   }
-     339             : 
-     340             : template<typename I> template<typename I2>
-     341           0 :   void T_Healpix_Base<I>::query_multidisc (const arr<vec3> &norm,
-     342             :   const arr<double> &rad, int fact, rangeset<I2> &pixset) const
-     343             :   {
-     344           0 :   bool inclusive = (fact!=0);
-     345             :   tsize nv=norm.size();
-     346           0 :   planck_assert(nv==rad.size(),"inconsistent input arrays");
-     347             :   pixset.clear();
-     348             : 
-     349           0 :   if (scheme_==RING)
-     350             :     {
-     351             :     I fct=1;
-     352           0 :     if (inclusive)
-     353             :       {
-     354           0 :       planck_assert (((I(1)<<order_max)/nside_)>=fact,
-     355             :         "invalid oversampling factor");
-     356             :       fct = fact;
-     357             :       }
-     358           0 :     T_Healpix_Base b2;
-     359             :     double rpsmall, rpbig;
-     360           0 :     if (fct>1)
-     361             :       {
-     362           0 :       b2.SetNside(fct*nside_,RING);
-     363           0 :       rpsmall = b2.max_pixrad();
-     364           0 :       rpbig = max_pixrad();
-     365             :       }
-     366             :     else
-     367           0 :       rpsmall = rpbig = inclusive ? max_pixrad() : 0;
-     368             : 
-     369           0 :     I irmin=1, irmax=4*nside_-1;
-     370             :     vector<double> z0,xa,cosrsmall,cosrbig;
-     371             :     vector<pointing> ptg;
-     372             :     vector<I> cpix;
-     373           0 :     for (tsize i=0; i<nv; ++i)
-     374             :       {
-     375           0 :       double rsmall=rad[i]+rpsmall;
-     376           0 :       if (rsmall<pi)
-     377             :         {
-     378           0 :         double rbig=min(pi,rad[i]+rpbig);
-     379             :         pointing pnt=pointing(norm[i]);
-     380           0 :         cosrsmall.push_back(cos(rsmall));
-     381           0 :         cosrbig.push_back(cos(rbig));
-     382           0 :         double cth=cos(pnt.theta);
-     383           0 :         z0.push_back(cth);
-     384           0 :         if (fct>1) cpix.push_back(zphi2pix(cth,pnt.phi));
-     385           0 :         xa.push_back(1./sqrt((1-cth)*(1+cth)));
-     386           0 :         ptg.push_back(pnt);
-     387             : 
-     388           0 :         double rlat1 = pnt.theta - rsmall;
-     389           0 :         double zmax = cos(rlat1);
-     390           0 :         I irmin_t = (rlat1<=0) ? 1 : ring_above (zmax)+1;
-     391             : 
-     392           0 :         if ((fct>1) && (rlat1>0)) irmin_t=max(I(1),irmin_t-1);
-     393             : 
-     394           0 :         double rlat2 = pnt.theta + rsmall;
-     395           0 :         double zmin = cos(rlat2);
-     396           0 :         I irmax_t = (rlat2>=pi) ? 4*nside_-1 : ring_above (zmin);
-     397             : 
-     398           0 :         if ((fct>1) && (rlat2<pi)) irmax_t=min(4*nside_-1,irmax_t+1);
-     399             : 
-     400             :         if (irmax_t < irmax) irmax=irmax_t;
-     401             :         if (irmin_t > irmin) irmin=irmin_t;
-     402             :         }
-     403             :       }
-     404             : 
-     405           0 :     for (I iz=irmin; iz<=irmax; ++iz)
-     406             :       {
-     407           0 :       double z=ring2z(iz);
-     408             :       I ipix1,nr;
-     409             :       bool shifted;
-     410           0 :       get_ring_info_small(iz,ipix1,nr,shifted);
-     411           0 :       double shift = shifted ? 0.5 : 0.;
-     412             :       rangeset<I2> tr;
-     413           0 :       tr.append(ipix1,ipix1+nr);
-     414           0 :       for (tsize j=0; j<z0.size(); ++j)
-     415             :         {
-     416           0 :         double x = (cosrbig[j]-z*z0[j])*xa[j];
-     417           0 :         double ysq = 1.-z*z-x*x;
-     418           0 :         double dphi = (ysq<=0) ? pi-1e-15 : atan2(sqrt(ysq),x);
-     419           0 :         I ip_lo = ifloor<I>(nr*inv_twopi*(ptg[j].phi-dphi) - shift)+1;
-     420           0 :         I ip_hi = ifloor<I>(nr*inv_twopi*(ptg[j].phi+dphi) - shift);
-     421           0 :         if (fct>1)
-     422             :           {
-     423           0 :           while ((ip_lo<=ip_hi) && check_pixel_ring
-     424           0 :             (*this,b2,ip_lo,nr,ipix1,fct,z0[j],ptg[j].phi,cosrsmall[j],cpix[j]))
-     425           0 :             ++ip_lo;
-     426           0 :           while ((ip_hi>ip_lo) && check_pixel_ring
-     427           0 :             (*this,b2,ip_hi,nr,ipix1,fct,z0[j],ptg[j].phi,cosrsmall[j],cpix[j]))
-     428           0 :             --ip_hi;
-     429             :           }
-     430           0 :         if (ip_hi>=nr)
-     431           0 :           { ip_lo-=nr; ip_hi-=nr;}
-     432           0 :         if (ip_lo<0)
-     433           0 :           tr.remove(ipix1+ip_hi+1,ipix1+ip_lo+nr);
-     434             :         else
-     435           0 :           tr.intersect(ipix1+ip_lo,ipix1+ip_hi+1);
-     436             :         }
-     437           0 :       pixset.append(tr);
-     438             :       }
-     439             :     }
-     440             :   else // scheme_ == NEST
-     441             :     {
-     442             :     int oplus = 0;
-     443           0 :     if (inclusive)
-     444             :       {
-     445           0 :       planck_assert ((I(1)<<(order_max-order_))>=fact,
-     446             :         "invalid oversampling factor");
-     447           0 :       planck_assert ((fact&(fact-1))==0,
-     448             :         "oversampling factor must be a power of 2");
-     449           0 :       oplus=ilog2(fact);
-     450             :       }
-     451           0 :     int omax=order_+oplus; // the order up to which we test
-     452             : 
-     453             :     // TODO: ignore all disks with radius>=pi
-     454             : 
-     455           0 :     arr<T_Healpix_Base<I> > base(omax+1);
-     456             :     arr3<double> crlimit(omax+1,nv,3);
-     457           0 :     for (int o=0; o<=omax; ++o) // prepare data at the required orders
-     458             :       {
-     459           0 :       base[o].Set(o,NEST);
-     460           0 :       double dr=base[o].max_pixrad(); // safety distance
-     461           0 :       for (tsize i=0; i<nv; ++i)
-     462             :         {
-     463           0 :         crlimit(o,i,0) = (rad[i]+dr>pi) ? -1. : cos(rad[i]+dr);
-     464           0 :         crlimit(o,i,1) = (o==0) ? cos(rad[i]) : crlimit(0,i,1);
-     465           0 :         crlimit(o,i,2) = (rad[i]-dr<0.) ?  1. : cos(rad[i]-dr);
-     466             :         }
-     467             :       }
-     468             : 
-     469             :     vector<pair<I,int> > stk; // stack for pixel numbers and their orders
-     470           0 :     stk.reserve(12+3*omax); // reserve maximum size to avoid reallocation
-     471           0 :     for (int i=0; i<12; ++i) // insert the 12 base pixels in reverse order
-     472           0 :       stk.push_back(make_pair(I(11-i),0));
-     473             : 
-     474           0 :     int stacktop=0; // a place to save a stack position
-     475             : 
-     476           0 :     while (!stk.empty()) // as long as there are pixels on the stack
-     477             :       {
-     478             :       // pop current pixel number and order from the stack
-     479           0 :       I pix=stk.back().first;
-     480           0 :       int o=stk.back().second;
-     481             :       stk.pop_back();
-     482             : 
-     483           0 :       vec3 pv(base[o].pix2vec(pix));
-     484             : 
-     485             :       tsize zone=3;
-     486           0 :       for (tsize i=0; i<nv; ++i)
-     487             :         {
-     488             :         double crad=dotprod(pv,norm[i]);
-     489           0 :         for (tsize iz=0; iz<zone; ++iz)
-     490           0 :           if (crad<crlimit(o,i,iz))
-     491           0 :             if ((zone=iz)==0) goto bailout;
-     492             :         }
-     493             : 
-     494           0 :       check_pixel (o, order_, omax, zone, pixset, pix, stk, inclusive,
-     495             :         stacktop);
-     496           0 :       bailout:;
-     497             :       }
-     498             :     }
-     499           0 :   }
-     500             : 
-     501           0 : template<typename I> void T_Healpix_Base<I>::query_multidisc_general
-     502             :   (const arr<vec3> &norm, const arr<double> &rad, bool inclusive,
-     503             :   const vector<int> &cmds, rangeset<I> &pixset) const
-     504             :   {
-     505             :   tsize nv=norm.size();
-     506           0 :   planck_assert(nv==rad.size(),"inconsistent input arrays");
-     507             :   pixset.clear();
-     508             : 
-     509           0 :   if (scheme_==RING)
-     510             :     {
-     511           0 :     planck_fail ("not yet implemented");
-     512             :     }
-     513             :   else // scheme_ == NEST
-     514             :     {
-     515           0 :     int oplus=inclusive ? 2 : 0;
-     516           0 :     int omax=min(order_max,order_+oplus); // the order up to which we test
-     517             : 
-     518             :     // TODO: ignore all disks with radius>=pi
-     519             : 
-     520           0 :     arr<T_Healpix_Base<I> > base(omax+1);
-     521             :     arr3<double> crlimit(omax+1,nv,3);
-     522           0 :     for (int o=0; o<=omax; ++o) // prepare data at the required orders
-     523             :       {
-     524           0 :       base[o].Set(o,NEST);
-     525           0 :       double dr=base[o].max_pixrad(); // safety distance
-     526           0 :       for (tsize i=0; i<nv; ++i)
-     527             :         {
-     528           0 :         crlimit(o,i,0) = (rad[i]+dr>pi) ? -1. : cos(rad[i]+dr);
-     529           0 :         crlimit(o,i,1) = (o==0) ? cos(rad[i]) : crlimit(0,i,1);
-     530           0 :         crlimit(o,i,2) = (rad[i]-dr<0.) ?  1. : cos(rad[i]-dr);
-     531             :         }
-     532             :       }
-     533             : 
-     534             :     vector<pair<I,int> > stk; // stack for pixel numbers and their orders
-     535           0 :     stk.reserve(12+3*omax); // reserve maximum size to avoid reallocation
-     536           0 :     for (int i=0; i<12; ++i) // insert the 12 base pixels in reverse order
-     537           0 :       stk.push_back(make_pair(I(11-i),0));
-     538             : 
-     539           0 :     int stacktop=0; // a place to save a stack position
-     540             :     arr<tsize> zone(nv);
-     541             : 
-     542           0 :     vector<tsize> zstk; zstk.reserve(cmds.size());
-     543             : 
-     544           0 :     while (!stk.empty()) // as long as there are pixels on the stack
-     545             :       {
-     546             :       // pop current pixel number and order from the stack
-     547           0 :       I pix=stk.back().first;
-     548           0 :       int o=stk.back().second;
-     549             :       stk.pop_back();
-     550             : 
-     551           0 :       vec3 pv(base[o].pix2vec(pix));
-     552             : 
-     553           0 :       for (tsize i=0; i<nv; ++i)
-     554             :         {
-     555           0 :         zone[i]=3;
-     556             :         double crad=dotprod(pv,norm[i]);
-     557           0 :         for (tsize iz=0; iz<zone[i]; ++iz)
-     558           0 :           if (crad<crlimit(o,i,iz))
-     559           0 :             zone[i]=iz;
-     560             :         }
-     561             : 
-     562           0 :       for (tsize i=0; i<cmds.size(); ++i)
-     563             :         {
-     564             :         tsize tmp;
-     565           0 :         switch (cmds[i])
-     566             :           {
-     567             :           case -1: // union
-     568           0 :             tmp=zstk.back(); zstk.pop_back();
-     569           0 :             zstk.back() = max(zstk.back(),tmp);
-     570           0 :             break;
-     571             :           case -2: // intersection
-     572           0 :             tmp=zstk.back(); zstk.pop_back();
-     573           0 :             zstk.back() = min(zstk.back(),tmp);
-     574           0 :             break;
-     575             :           default: // add value
-     576           0 :             zstk.push_back(zone[cmds[i]]);
-     577             :           }
-     578             :         }
-     579           0 :       planck_assert(zstk.size()==1,"inconsistent commands");
-     580           0 :       tsize zn=zstk[0]; zstk.pop_back();
-     581             : 
-     582           0 :       check_pixel (o, order_, omax, zn, pixset, pix, stk, inclusive,
-     583             :         stacktop);
-     584             :       }
-     585             :     }
-     586           0 :   }
-     587             : 
-     588             : template<> inline int T_Healpix_Base<int>::spread_bits (int v) const
-     589         421 :   { return utab[v&0xff] | (utab[(v>>8)&0xff]<<16); }
-     590           0 : template<> inline int64 T_Healpix_Base<int64>::spread_bits (int v) const
-     591             :   {
-     592           0 :   return  int64(utab[ v     &0xff])      | (int64(utab[(v>> 8)&0xff])<<16)
-     593           0 :        | (int64(utab[(v>>16)&0xff])<<32) | (int64(utab[(v>>24)&0xff])<<48);
-     594             :   }
-     595             : 
-     596             : template<> inline int T_Healpix_Base<int>::compress_bits (int v) const
-     597             :   {
-     598           0 :   int raw = (v&0x5555) | ((v&0x55550000)>>15);
-     599           0 :   return ctab[raw&0xff] | (ctab[raw>>8]<<4);
-     600             :   }
-     601         842 : template<> inline int T_Healpix_Base<int64>::compress_bits (int64 v) const
-     602             :   {
-     603         842 :   int64 raw = v&0x5555555555555555ull;
-     604         842 :   raw|=raw>>15;
-     605         842 :   return ctab[ raw     &0xff]      | (ctab[(raw>> 8)&0xff]<< 4)
-     606         842 :       | (ctab[(raw>>32)&0xff]<<16) | (ctab[(raw>>40)&0xff]<<20);
-     607             :   }
-     608             : 
-     609         421 : template<typename I> inline void T_Healpix_Base<I>::nest2xyf (I pix, int &ix,
-     610             :   int &iy, int &face_num) const
-     611             :   {
-     612         421 :   face_num = pix>>(2*order_);
-     613         421 :   pix &= (npface_-1);
-     614         421 :   ix = compress_bits(pix);
-     615         421 :   iy = compress_bits(pix>>1);
-     616         421 :   }
-     617             : 
-     618         421 : template<typename I> inline I T_Healpix_Base<I>::xyf2nest (int ix, int iy,
-     619             :   int face_num) const
-     620         421 :   { return (I(face_num)<<(2*order_)) + spread_bits(ix) + (spread_bits(iy)<<1); }
-     621             : 
-     622         421 : template<typename I> void T_Healpix_Base<I>::ring2xyf (I pix, int &ix, int &iy,
-     623             :   int &face_num) const
-     624             :   {
-     625             :   I iring, iphi, kshift, nr;
-     626         421 :   I nl2 = 2*nside_;
-     627             : 
-     628         421 :   if (pix<ncap_) // North Polar cap
-     629             :     {
-     630           0 :     iring = (1+isqrt(1+2*pix))>>1; //counted from North pole
-     631           0 :     iphi  = (pix+1) - 2*iring*(iring-1);
-     632             :     kshift = 0;
-     633             :     nr = iring;
-     634           0 :     face_num=(iphi-1)/nr;
-     635             :     }
-     636         421 :   else if (pix<(npix_-ncap_)) // Equatorial region
-     637             :     {
-     638         421 :     I ip = pix - ncap_;
-     639         421 :     I tmp = (order_>=0) ? ip>>(order_+2) : ip/(4*nside_);
-     640         421 :     iring = tmp+nside_;
-     641         421 :     iphi = ip-tmp*4*nside_ + 1;
-     642         421 :     kshift = (iring+nside_)&1;
-     643             :     nr = nside_;
-     644         421 :     I ire = iring-nside_+1,
-     645         421 :       irm = nl2+2-ire;
-     646         421 :     I ifm = iphi - ire/2 + nside_ -1,
-     647         421 :       ifp = iphi - irm/2 + nside_ -1;
-     648         421 :     if (order_>=0)
-     649         421 :       { ifm >>= order_; ifp >>= order_; }
-     650             :     else
-     651           0 :       { ifm /= nside_; ifp /= nside_; }
-     652         421 :     face_num = (ifp==ifm) ? (ifp|4) : ((ifp<ifm) ? ifp : (ifm+8));
-     653             :     }
-     654             :   else // South Polar cap
-     655             :     {
-     656           0 :     I ip = npix_ - pix;
-     657           0 :     iring = (1+isqrt(2*ip-1))>>1; //counted from South pole
-     658           0 :     iphi  = 4*iring + 1 - (ip - 2*iring*(iring-1));
-     659             :     kshift = 0;
-     660             :     nr = iring;
-     661           0 :     iring = 2*nl2-iring;
-     662           0 :     face_num = 8 + (iphi-1)/nr;
-     663             :     }
-     664             : 
-     665         421 :   I irt = iring - (jrll[face_num]*nside_) + 1;
-     666         421 :   I ipt = 2*iphi- jpll[face_num]*nr - kshift -1;
-     667         421 :   if (ipt>=nl2) ipt-=8*nside_;
-     668             : 
-     669         421 :   ix =  (ipt-irt) >>1;
-     670         421 :   iy = (-ipt-irt) >>1;
-     671         421 :   }
-     672             : 
-     673           0 : template<typename I> I T_Healpix_Base<I>::xyf2ring (int ix, int iy,
-     674             :   int face_num) const
-     675             :   {
-     676           0 :   I nl4 = 4*nside_;
-     677           0 :   I jr = (jrll[face_num]*nside_) - ix - iy  - 1;
-     678             : 
-     679             :   I nr, kshift, n_before;
-     680             : 
-     681             :   bool shifted;
-     682           0 :   get_ring_info_small(jr,n_before,nr,shifted);
-     683           0 :   nr>>=2;
-     684           0 :   kshift=1-shifted;
-     685           0 :   I jp = (jpll[face_num]*nr + ix - iy + 1 + kshift) / 2;
-     686           0 :   planck_assert(jp<=4*nr,"must not happen");
-     687           0 :   if (jp<1) jp+=nl4; // assumption: if this triggers, then nl4==4*nr
-     688             : 
-     689           0 :   return n_before + jp - 1;
-     690             :   }
-     691             : 
-     692           0 : template<typename I> T_Healpix_Base<I>::T_Healpix_Base ()
-     693           0 :   : order_(-1), nside_(0), npface_(0), ncap_(0), npix_(0),
-     694           0 :     fact1_(0), fact2_(0), scheme_(RING) {}
-     695             : 
-     696          29 : template<typename I> void T_Healpix_Base<I>::Set (int order,
-     697             :   Healpix_Ordering_Scheme scheme)
-     698             :   {
-     699          29 :   planck_assert ((order>=0)&&(order<=order_max), "bad order");
-     700          29 :   order_  = order;
-     701          29 :   nside_  = I(1)<<order;
-     702          29 :   npface_ = nside_<<order_;
-     703          29 :   ncap_   = (npface_-nside_)<<1;
-     704          29 :   npix_   = 12*npface_;
-     705          29 :   fact2_  = 4./npix_;
-     706          29 :   fact1_  = (nside_<<1)*fact2_;
-     707          29 :   scheme_ = scheme;
-     708          29 :   }
-     709           0 : template<typename I> void T_Healpix_Base<I>::SetNside (I nside,
-     710             :   Healpix_Ordering_Scheme scheme)
-     711             :   {
-     712           0 :   order_  = nside2order(nside);
-     713           0 :   planck_assert ((scheme!=NEST) || (order_>=0),
-     714             :     "SetNside: nside must be power of 2 for nested maps");
-     715           0 :   nside_  = nside;
-     716           0 :   npface_ = nside_*nside_;
-     717           0 :   ncap_   = (npface_-nside_)<<1;
-     718           0 :   npix_   = 12*npface_;
-     719           0 :   fact2_  = 4./npix_;
-     720           0 :   fact1_  = (nside_<<1)*fact2_;
-     721           0 :   scheme_ = scheme;
-     722           0 :   }
-     723             : 
-     724           0 : template<typename I> double T_Healpix_Base<I>::ring2z (I ring) const
-     725             :   {
-     726           0 :   if (ring<nside_)
-     727           0 :     return 1 - ring*ring*fact2_;
-     728           0 :   if (ring <=3*nside_)
-     729           0 :     return (2*nside_-ring)*fact1_;
-     730           0 :   ring=4*nside_ - ring;
-     731           0 :   return ring*ring*fact2_ - 1;
-     732             :   }
-     733             : 
-     734           0 : template<typename I> I T_Healpix_Base<I>::pix2ring (I pix) const
-     735             :   {
-     736           0 :   if (scheme_==RING)
-     737             :     {
-     738           0 :     if (pix<ncap_) // North Polar cap
-     739           0 :       return (1+I(isqrt(1+2*pix)))>>1; // counted from North pole
-     740           0 :     else if (pix<(npix_-ncap_)) // Equatorial region
-     741           0 :       return (pix-ncap_)/(4*nside_) + nside_; // counted from North pole
-     742             :     else // South Polar cap
-     743           0 :       return 4*nside_-((1+I(isqrt(2*(npix_-pix)-1)))>>1);
-     744             :     }
-     745             :   else
-     746             :     {
-     747             :     int face_num, ix, iy;
-     748           0 :     nest2xyf(pix,ix,iy,face_num);
-     749           0 :     return (I(jrll[face_num])<<order_) - ix - iy - 1;
-     750             :     }
-     751             :   }
-     752             : 
-     753           0 : template<typename I> I T_Healpix_Base<I>::nest2ring (I pix) const
-     754             :   {
-     755           0 :   planck_assert(order_>=0, "hierarchical map required");
-     756             :   int ix, iy, face_num;
-     757           0 :   nest2xyf (pix, ix, iy, face_num);
-     758           0 :   return xyf2ring (ix, iy, face_num);
-     759             :   }
-     760             : 
-     761         421 : template<typename I> I T_Healpix_Base<I>::ring2nest (I pix) const
-     762             :   {
-     763         421 :   planck_assert(order_>=0, "hierarchical map required");
-     764             :   int ix, iy, face_num;
-     765         421 :   ring2xyf (pix, ix, iy, face_num);
-     766         421 :   return xyf2nest (ix, iy, face_num);
-     767             :   }
-     768             : 
-     769           0 : template<typename I> inline I T_Healpix_Base<I>::nest_peano_helper
-     770             :   (I pix, int dir) const
-     771             :   {
-     772           0 :   int face = pix>>(2*order_);
-     773             :   I result = 0;
-     774           0 :   uint8 path = peano_face2path[dir][face];
-     775             : 
-     776           0 :   for (int shift=2*order_-2; shift>=0; shift-=2)
-     777             :     {
-     778           0 :     uint8 spix = uint8((pix>>shift) & 0x3);
-     779           0 :     result <<= 2;
-     780           0 :     result |= peano_subpix[dir][path][spix];
-     781           0 :     path=peano_subpath[dir][path][spix];
-     782             :     }
-     783             : 
-     784           0 :   return result + (I(peano_face2face[dir][face])<<(2*order_));
-     785             :   }
-     786             : 
-     787           0 : template<typename I> I T_Healpix_Base<I>::nest2peano (I pix) const
-     788           0 :   { return nest_peano_helper(pix,0); }
-     789             : 
-     790           0 : template<typename I> I T_Healpix_Base<I>::peano2nest (I pix) const
-     791           0 :   { return nest_peano_helper(pix,1); }
-     792             : 
-     793       24585 : template<typename I> I T_Healpix_Base<I>::loc2pix (double z, double phi,
-     794             :   double sth, bool have_sth) const
-     795             :   {
-     796             :   double za = abs(z);
-     797       24585 :   double tt = fmodulo(phi*inv_halfpi,4.0); // in [0,4)
-     798             : 
-     799       24585 :   if (scheme_==RING)
-     800             :     {
-     801       24585 :     if (za<=twothird) // Equatorial region
-     802             :       {
-     803       16535 :       I nl4 = 4*nside_;
-     804       16535 :       double temp1 = nside_*(0.5+tt);
-     805       16535 :       double temp2 = nside_*z*0.75;
-     806       16535 :       I jp = I(temp1-temp2); // index of  ascending edge line
-     807       16535 :       I jm = I(temp1+temp2); // index of descending edge line
-     808             : 
-     809             :       // ring number counted from z=2/3
-     810       16535 :       I ir = nside_ + 1 + jp - jm; // in {1,2n+1}
-     811       16535 :       I kshift = 1-(ir&1); // kshift=1 if ir even, 0 otherwise
-     812             : 
-     813       16535 :       I t1 = jp+jm-nside_+kshift+1+nl4+nl4;
-     814       16535 :       I ip = (order_>0) ?
-     815       16535 :         (t1>>1)&(nl4-1) : ((t1>>1)%nl4); // in {0,4n-1}
-     816             : 
-     817       16535 :       return ncap_ + (ir-1)*nl4 + ip;
-     818             :       }
-     819             :     else  // North & South polar caps
-     820             :       {
-     821        8050 :       double tp = tt-I(tt);
-     822        8050 :       double tmp = ((za<0.99)||(!have_sth)) ?
-     823        7809 :                    nside_*sqrt(3*(1-za)) :
-     824         241 :                    nside_*sth/sqrt((1.+za)/3.);
-     825             : 
-     826        8050 :       I jp = I(tp*tmp); // increasing edge line index
-     827        8050 :       I jm = I((1.0-tp)*tmp); // decreasing edge line index
-     828             : 
-     829        8050 :       I ir = jp+jm+1; // ring number counted from the closest pole
-     830        8050 :       I ip = I(tt*ir); // in {0,4*ir-1}
-     831        8050 :       planck_assert((ip>=0)&&(ip<4*ir),"must not happen");
-     832             :       //ip %= 4*ir;
-     833             : 
-     834        8050 :       return (z>0)  ?  2*ir*(ir-1) + ip  :  npix_ - 2*ir*(ir+1) + ip;
-     835             :       }
-     836             :     }
-     837             :   else // scheme_ == NEST
-     838             :     {
-     839           0 :     if (za<=twothird) // Equatorial region
-     840             :       {
-     841           0 :       double temp1 = nside_*(0.5+tt);
-     842           0 :       double temp2 = nside_*(z*0.75);
-     843           0 :       I jp = I(temp1-temp2); // index of  ascending edge line
-     844           0 :       I jm = I(temp1+temp2); // index of descending edge line
-     845           0 :       I ifp = jp >> order_;  // in {0,4}
-     846           0 :       I ifm = jm >> order_;
-     847           0 :       int face_num = (ifp==ifm) ? (ifp|4) : ((ifp<ifm) ? ifp : (ifm+8));
-     848             : 
-     849           0 :       int ix = jm & (nside_-1),
-     850           0 :           iy = nside_ - (jp & (nside_-1)) - 1;
-     851           0 :       return xyf2nest(ix,iy,face_num);
-     852             :       }
-     853             :     else // polar region, za > 2/3
-     854             :       {
-     855           0 :       int ntt = min(3,int(tt));
-     856           0 :       double tp = tt-ntt;
-     857           0 :       double tmp = ((za<0.99)||(!have_sth)) ?
-     858           0 :                    nside_*sqrt(3*(1-za)) :
-     859           0 :                    nside_*sth/sqrt((1.+za)/3.);
-     860             : 
-     861           0 :       I jp = I(tp*tmp); // increasing edge line index
-     862           0 :       I jm = I((1.0-tp)*tmp); // decreasing edge line index
-     863           0 :       jp=min(jp,nside_-1); // for points too close to the boundary
-     864           0 :       jm=min(jm,nside_-1);
-     865           0 :       return (z>=0) ?
-     866           0 :         xyf2nest(nside_-jm -1,nside_-jp-1,ntt) : xyf2nest(jp,jm,ntt+8);
-     867             :       }
-     868             :     }
-     869             :   }
-     870             : 
-     871      135593 : template<typename I> void T_Healpix_Base<I>::pix2loc (I pix, double &z,
-     872             :   double &phi, double &sth, bool &have_sth) const
-     873             :   {
-     874      135593 :   have_sth=false;
-     875      135593 :   if (scheme_==RING)
-     876             :     {
-     877      135172 :     if (pix<ncap_) // North Polar cap
-     878             :       {
-     879       22080 :       I iring = (1+I(isqrt(1+2*pix)))>>1; // counted from North pole
-     880       22080 :       I iphi  = (pix+1) - 2*iring*(iring-1);
-     881             : 
-     882       22080 :       double tmp=(iring*iring)*fact2_;
-     883       22080 :       z = 1.0 - tmp;
-     884       22080 :       if (z>0.99) { sth=sqrt(tmp*(2.-tmp)); have_sth=true; }
-     885       22080 :       phi = (iphi-0.5) * halfpi/iring;
-     886             :       }
-     887      113092 :     else if (pix<(npix_-ncap_)) // Equatorial region
-     888             :       {
-     889       91010 :       I nl4 = 4*nside_;
-     890       91010 :       I ip  = pix - ncap_;
-     891       91010 :       I tmp = (order_>=0) ? ip>>(order_+2) : ip/nl4;
-     892       91010 :       I iring = tmp + nside_,
-     893       91010 :         iphi = ip-nl4*tmp+1;
-     894             :       // 1 if iring+nside is odd, 1/2 otherwise
-     895       91010 :       double fodd = ((iring+nside_)&1) ? 1 : 0.5;
-     896             : 
-     897       91010 :       z = (2*nside_-iring)*fact1_;
-     898       91010 :       phi = (iphi-fodd) * pi*0.75*fact1_;
-     899             :       }
-     900             :     else // South Polar cap
-     901             :       {
-     902       22082 :       I ip = npix_ - pix;
-     903       22082 :       I iring = (1+I(isqrt(2*ip-1)))>>1; // counted from South pole
-     904       22082 :       I iphi  = 4*iring + 1 - (ip - 2*iring*(iring-1));
-     905             : 
-     906       22082 :       double tmp=(iring*iring)*fact2_;
-     907       22082 :       z = tmp - 1.0;
-     908       22082 :       if (z<-0.99) { sth=sqrt(tmp*(2.-tmp)); have_sth=true; }
-     909       22082 :       phi = (iphi-0.5) * halfpi/iring;
-     910             :       }
-     911             :     }
-     912             :   else
-     913             :     {
-     914             :     int face_num, ix, iy;
-     915         421 :     nest2xyf(pix,ix,iy,face_num);
-     916             : 
-     917         421 :     I jr = (I(jrll[face_num])<<order_) - ix - iy - 1;
-     918             : 
-     919             :     I nr;
-     920         421 :     if (jr<nside_)
-     921             :       {
-     922             :       nr = jr;
-     923           0 :       double tmp=(nr*nr)*fact2_;
-     924           0 :       z = 1 - tmp;
-     925           0 :       if (z>0.99) { sth=sqrt(tmp*(2.-tmp)); have_sth=true; }
-     926             :       }
-     927         421 :     else if (jr > 3*nside_)
-     928             :       {
-     929           0 :       nr = nside_*4-jr;
-     930           0 :       double tmp=(nr*nr)*fact2_;
-     931           0 :       z = tmp - 1;
-     932           0 :       if (z<-0.99) { sth=sqrt(tmp*(2.-tmp)); have_sth=true; }
-     933             :       }
-     934             :     else
-     935             :       {
-     936             :       nr = nside_;
-     937         421 :       z = (2*nside_-jr)*fact1_;
-     938             :       }
-     939             : 
-     940         421 :     I tmp=I(jpll[face_num])*nr+ix-iy;
-     941         421 :     planck_assert(tmp<8*nr,"must not happen");
-     942         421 :     if (tmp<0) tmp+=8*nr;
-     943         421 :     phi = (nr==nside_) ? 0.75*halfpi*tmp*fact1_ :
-     944           0 :                          (0.5*halfpi*tmp)/nr;
-     945             :     }
-     946      135593 :   }
-     947             : 
-     948             : template<typename I> template<typename I2>
-     949           0 :   void T_Healpix_Base<I>::query_polygon_internal
-     950             :   (const vector<pointing> &vertex, int fact, rangeset<I2> &pixset) const
-     951             :   {
-     952             :   bool inclusive = (fact!=0);
-     953             :   tsize nv=vertex.size();
-     954           0 :   tsize ncirc = inclusive ? nv+1 : nv;
-     955           0 :   planck_assert(nv>=3,"not enough vertices in polygon");
-     956             :   arr<vec3> vv(nv);
-     957           0 :   for (tsize i=0; i<nv; ++i)
-     958           0 :     vv[i]=vertex[i].to_vec3();
-     959             :   arr<vec3> normal(ncirc);
-     960             :   int flip=0;
-     961           0 :   for (tsize i=0; i<nv; ++i)
-     962             :     {
-     963           0 :     normal[i]=crossprod(vv[i],vv[(i+1)%nv]);
-     964           0 :     double hnd=dotprod(normal[i],vv[(i+2)%nv]);
-     965           0 :     planck_assert(abs(hnd)>1e-10,"degenerate corner");
-     966           0 :     if (i==0)
-     967           0 :       flip = (hnd<0.) ? -1 : 1;
-     968             :     else
-     969           0 :       planck_assert(flip*hnd>0,"polygon is not convex");
-     970           0 :     normal[i]*=flip/normal[i].Length();
-     971             :     }
-     972             :   arr<double> rad(ncirc,halfpi);
-     973           0 :   if (inclusive)
-     974             :     {
-     975             :     double cosrad;
-     976           0 :     find_enclosing_circle (vv, normal[nv], cosrad);
-     977           0 :     rad[nv]=acos(cosrad);
-     978             :     }
-     979           0 :   query_multidisc(normal,rad,fact,pixset);
-     980           0 :   }
-     981             : 
-     982           0 : template<typename I> void T_Healpix_Base<I>::query_polygon
-     983             :   (const vector<pointing> &vertex, rangeset<I> &pixset) const
-     984             :   {
-     985           0 :   query_polygon_internal(vertex, 0, pixset);
-     986           0 :   }
-     987             : 
-     988           0 : template<typename I> void T_Healpix_Base<I>::query_polygon_inclusive
-     989             :   (const vector<pointing> &vertex, rangeset<I> &pixset, int fact) const
-     990             :   {
-     991           0 :   planck_assert(fact>0,"fact must be a positive integer");
-     992           0 :   if ((sizeof(I)<8) && (((I(1)<<order_max)/nside_)<fact))
-     993             :     {
-     994           0 :     T_Healpix_Base<int64> base2(nside_,scheme_,SET_NSIDE);
-     995           0 :     base2.query_polygon_internal(vertex,fact,pixset);
-     996             :     return;
-     997             :     }
-     998           0 :   query_polygon_internal(vertex, fact, pixset);
-     999             :   }
-    1000             : 
-    1001           0 : template<typename I> void T_Healpix_Base<I>::query_strip_internal
-    1002             :   (double theta1, double theta2, bool inclusive, rangeset<I> &pixset) const
-    1003             :   {
-    1004           0 :   if (scheme_==RING)
-    1005             :     {
-    1006           0 :     I ring1 = max(I(1),1+ring_above(cos(theta1))),
-    1007           0 :       ring2 = min(4*nside_-1,ring_above(cos(theta2)));
-    1008           0 :     if (inclusive)
-    1009             :       {
-    1010           0 :       ring1 = max(I(1),ring1-1);
-    1011           0 :       ring2 = min(4*nside_-1,ring2+1);
-    1012             :       }
-    1013             : 
-    1014             :     I sp1,rp1,sp2,rp2;
-    1015             :     bool dummy;
-    1016           0 :     get_ring_info_small(ring1,sp1,rp1,dummy);
-    1017           0 :     get_ring_info_small(ring2,sp2,rp2,dummy);
-    1018           0 :     I pix1 = sp1,
-    1019           0 :       pix2 = sp2+rp2;
-    1020           0 :     if (pix1<=pix2) pixset.append(pix1,pix2);
-    1021             :     }
-    1022             :   else
-    1023           0 :     planck_fail("query_strip not yet implemented for NESTED");
-    1024           0 :   }
-    1025             : 
-    1026           0 : template<typename I> void T_Healpix_Base<I>::query_strip (double theta1,
-    1027             :   double theta2, bool inclusive, rangeset<I> &pixset) const
-    1028             :   {
-    1029             :   pixset.clear();
-    1030             : 
-    1031           0 :   if (theta1<theta2)
-    1032           0 :     query_strip_internal(theta1,theta2,inclusive,pixset);
-    1033             :   else
-    1034             :     {
-    1035           0 :     query_strip_internal(0.,theta2,inclusive,pixset);
-    1036             :     rangeset<I> ps2;
-    1037           0 :     query_strip_internal(theta1,pi,inclusive,ps2);
-    1038           0 :     pixset.append(ps2);
-    1039             :     }
-    1040           0 :   }
-    1041             : 
-    1042           0 : template<typename I> inline void T_Healpix_Base<I>::get_ring_info_small
-    1043             :   (I ring, I &startpix, I &ringpix, bool &shifted) const
-    1044             :   {
-    1045           0 :   if (ring < nside_)
-    1046             :     {
-    1047           0 :     shifted = true;
-    1048           0 :     ringpix = 4*ring;
-    1049           0 :     startpix = 2*ring*(ring-1);
-    1050             :     }
-    1051           0 :   else if (ring < 3*nside_)
-    1052             :     {
-    1053           0 :     shifted = ((ring-nside_) & 1) == 0;
-    1054           0 :     ringpix = 4*nside_;
-    1055           0 :     startpix = ncap_ + (ring-nside_)*ringpix;
-    1056             :     }
-    1057             :   else
-    1058             :     {
-    1059           0 :     shifted = true;
-    1060           0 :     I nr= 4*nside_-ring;
-    1061           0 :     ringpix = 4*nr;
-    1062           0 :     startpix = npix_-2*nr*(nr+1);
-    1063             :     }
-    1064           0 :   }
-    1065             : 
-    1066           0 : template<typename I> void T_Healpix_Base<I>::get_ring_info (I ring, I &startpix,
-    1067             :   I &ringpix, double &costheta, double &sintheta, bool &shifted) const
-    1068             :   {
-    1069           0 :   I northring = (ring>2*nside_) ? 4*nside_-ring : ring;
-    1070           0 :   if (northring < nside_)
-    1071             :     {
-    1072           0 :     double tmp = northring*northring*fact2_;
-    1073           0 :     costheta = 1 - tmp;
-    1074           0 :     sintheta = sqrt(tmp*(2-tmp));
-    1075           0 :     ringpix = 4*northring;
-    1076           0 :     shifted = true;
-    1077           0 :     startpix = 2*northring*(northring-1);
-    1078             :     }
-    1079             :   else
-    1080             :     {
-    1081           0 :     costheta = (2*nside_-northring)*fact1_;
-    1082           0 :     sintheta = sqrt((1+costheta)*(1-costheta));
-    1083           0 :     ringpix = 4*nside_;
-    1084           0 :     shifted = ((northring-nside_) & 1) == 0;
-    1085           0 :     startpix = ncap_ + (northring-nside_)*ringpix;
-    1086             :     }
-    1087           0 :   if (northring != ring) // southern hemisphere
-    1088             :     {
-    1089           0 :     costheta = -costheta;
-    1090           0 :     startpix = npix_ - startpix - ringpix;
-    1091             :     }
-    1092           0 :   }
-    1093           0 : template<typename I> void T_Healpix_Base<I>::get_ring_info2 (I ring,
-    1094             :   I &startpix, I &ringpix, double &theta, bool &shifted) const
-    1095             :   {
-    1096           0 :   I northring = (ring>2*nside_) ? 4*nside_-ring : ring;
-    1097           0 :   if (northring < nside_)
-    1098             :     {
-    1099           0 :     double tmp = northring*northring*fact2_;
-    1100           0 :     double costheta = 1 - tmp;
-    1101           0 :     double sintheta = sqrt(tmp*(2-tmp));
-    1102           0 :     theta = atan2(sintheta,costheta);
-    1103           0 :     ringpix = 4*northring;
-    1104           0 :     shifted = true;
-    1105           0 :     startpix = 2*northring*(northring-1);
-    1106             :     }
-    1107             :   else
-    1108             :     {
-    1109           0 :     theta = acos((2*nside_-northring)*fact1_);
-    1110           0 :     ringpix = 4*nside_;
-    1111           0 :     shifted = ((northring-nside_) & 1) == 0;
-    1112           0 :     startpix = ncap_ + (northring-nside_)*ringpix;
-    1113             :     }
-    1114           0 :   if (northring != ring) // southern hemisphere
-    1115             :     {
-    1116           0 :     theta = pi-theta;
-    1117           0 :     startpix = npix_ - startpix - ringpix;
-    1118             :     }
-    1119           0 :   }
-    1120             : 
-    1121           0 : template<typename I> void T_Healpix_Base<I>::neighbors (I pix,
-    1122             :   fix_arr<I,8> &result) const
-    1123             :   {
-    1124             :   int ix, iy, face_num;
-    1125           0 :   (scheme_==RING) ?
-    1126           0 :     ring2xyf(pix,ix,iy,face_num) : nest2xyf(pix,ix,iy,face_num);
-    1127             : 
-    1128           0 :   const I nsm1 = nside_-1;
-    1129           0 :   if ((ix>0)&&(ix<nsm1)&&(iy>0)&&(iy<nsm1))
-    1130             :     {
-    1131           0 :     if (scheme_==RING)
-    1132           0 :       for (int m=0; m<8; ++m)
-    1133           0 :         result[m] = xyf2ring(ix+nb_xoffset[m],iy+nb_yoffset[m],face_num);
-    1134             :     else
-    1135             :       {
-    1136           0 :       I fpix = I(face_num)<<(2*order_),
-    1137           0 :         px0=spread_bits(ix  ), py0=spread_bits(iy  )<<1,
-    1138           0 :         pxp=spread_bits(ix+1), pyp=spread_bits(iy+1)<<1,
-    1139           0 :         pxm=spread_bits(ix-1), pym=spread_bits(iy-1)<<1;
-    1140             : 
-    1141           0 :       result[0] = fpix+pxm+py0; result[1] = fpix+pxm+pyp;
-    1142           0 :       result[2] = fpix+px0+pyp; result[3] = fpix+pxp+pyp;
-    1143           0 :       result[4] = fpix+pxp+py0; result[5] = fpix+pxp+pym;
-    1144           0 :       result[6] = fpix+px0+pym; result[7] = fpix+pxm+pym;
-    1145             :       }
-    1146             :     }
-    1147             :   else
-    1148             :     {
-    1149           0 :     for (int i=0; i<8; ++i)
-    1150             :       {
-    1151           0 :       int x=ix+nb_xoffset[i], y=iy+nb_yoffset[i];
-    1152             :       int nbnum=4;
-    1153           0 :       if (x<0)
-    1154           0 :         { x+=nside_; nbnum-=1; }
-    1155           0 :       else if (x>=nside_)
-    1156           0 :         { x-=nside_; nbnum+=1; }
-    1157           0 :       if (y<0)
-    1158           0 :         { y+=nside_; nbnum-=3; }
-    1159           0 :       else if (y>=nside_)
-    1160           0 :         { y-=nside_; nbnum+=3; }
-    1161             : 
-    1162           0 :       int f = nb_facearray[nbnum][face_num];
-    1163           0 :       if (f>=0)
-    1164             :         {
-    1165           0 :         int bits = nb_swaparray[nbnum][face_num>>2];
-    1166           0 :         if (bits&1) x=nside_-x-1;
-    1167           0 :         if (bits&2) y=nside_-y-1;
-    1168           0 :         if (bits&4) std::swap(x,y);
-    1169           0 :         result[i] = (scheme_==RING) ? xyf2ring(x,y,f) : xyf2nest(x,y,f);
-    1170             :         }
-    1171             :       else
-    1172           0 :         result[i] = -1;
-    1173             :       }
-    1174             :     }
-    1175           0 :   }
-    1176             : 
-    1177           0 : template<typename I> void T_Healpix_Base<I>::get_interpol (const pointing &ptg,
-    1178             :   fix_arr<I,4> &pix, fix_arr<double,4> &wgt) const
-    1179             :   {
-    1180           0 :   planck_assert((ptg.theta>=0)&&(ptg.theta<=pi),"invalid theta value");
-    1181           0 :   double z = cos (ptg.theta);
-    1182           0 :   I ir1 = ring_above(z);
-    1183           0 :   I ir2 = ir1+1;
-    1184             :   double theta1, theta2, w1, tmp, dphi;
-    1185             :   I sp,nr;
-    1186             :   bool shift;
-    1187             :   I i1,i2;
-    1188           0 :   if (ir1>0)
-    1189             :     {
-    1190           0 :     get_ring_info2 (ir1, sp, nr, theta1, shift);
-    1191           0 :     dphi = twopi/nr;
-    1192           0 :     tmp = (ptg.phi/dphi - .5*shift);
-    1193           0 :     i1 = (tmp<0) ? I(tmp)-1 : I(tmp);
-    1194           0 :     w1 = (ptg.phi-(i1+.5*shift)*dphi)/dphi;
-    1195           0 :     i2 = i1+1;
-    1196           0 :     if (i1<0) i1 +=nr;
-    1197           0 :     if (i2>=nr) i2 -=nr;
-    1198           0 :     pix[0] = sp+i1; pix[1] = sp+i2;
-    1199           0 :     wgt[0] = 1-w1; wgt[1] = w1;
-    1200             :     }
-    1201           0 :   if (ir2<(4*nside_))
-    1202             :     {
-    1203           0 :     get_ring_info2 (ir2, sp, nr, theta2, shift);
-    1204           0 :     dphi = twopi/nr;
-    1205           0 :     tmp = (ptg.phi/dphi - .5*shift);
-    1206           0 :     i1 = (tmp<0) ? I(tmp)-1 : I(tmp);
-    1207           0 :     w1 = (ptg.phi-(i1+.5*shift)*dphi)/dphi;
-    1208           0 :     i2 = i1+1;
-    1209           0 :     if (i1<0) i1 +=nr;
-    1210           0 :     if (i2>=nr) i2 -=nr;
-    1211           0 :     pix[2] = sp+i1; pix[3] = sp+i2;
-    1212           0 :     wgt[2] = 1-w1; wgt[3] = w1;
-    1213             :     }
-    1214             : 
-    1215           0 :   if (ir1==0)
-    1216             :     {
-    1217           0 :     double wtheta = ptg.theta/theta2;
-    1218           0 :     wgt[2] *= wtheta; wgt[3] *= wtheta;
-    1219           0 :     double fac = (1-wtheta)*0.25;
-    1220           0 :     wgt[0] = fac; wgt[1] = fac; wgt[2] += fac; wgt[3] +=fac;
-    1221           0 :     pix[0] = (pix[2]+2)&3;
-    1222           0 :     pix[1] = (pix[3]+2)&3;
-    1223             :     }
-    1224           0 :   else if (ir2==4*nside_)
-    1225             :     {
-    1226           0 :     double wtheta = (ptg.theta-theta1)/(pi-theta1);
-    1227           0 :     wgt[0] *= (1-wtheta); wgt[1] *= (1-wtheta);
-    1228           0 :     double fac = wtheta*0.25;
-    1229           0 :     wgt[0] += fac; wgt[1] += fac; wgt[2] = fac; wgt[3] =fac;
-    1230           0 :     pix[2] = ((pix[0]+2)&3)+npix_-4;
-    1231           0 :     pix[3] = ((pix[1]+2)&3)+npix_-4;
-    1232             :     }
-    1233             :   else
-    1234             :     {
-    1235           0 :     double wtheta = (ptg.theta-theta1)/(theta2-theta1);
-    1236           0 :     wgt[0] *= (1-wtheta); wgt[1] *= (1-wtheta);
-    1237           0 :     wgt[2] *= wtheta; wgt[3] *= wtheta;
-    1238             :     }
-    1239             : 
-    1240           0 :   if (scheme_==NEST)
-    1241           0 :     for (tsize m=0; m<pix.size(); ++m)
-    1242           0 :       pix[m] = ring2nest(pix[m]);
-    1243           0 :   }
-    1244             : 
-    1245           0 : template<typename I> void T_Healpix_Base<I>::swap (T_Healpix_Base &other)
-    1246             :   {
-    1247             :   std::swap(order_,other.order_);
-    1248             :   std::swap(nside_,other.nside_);
-    1249             :   std::swap(npface_,other.npface_);
-    1250             :   std::swap(ncap_,other.ncap_);
-    1251             :   std::swap(npix_,other.npix_);
-    1252             :   std::swap(fact1_,other.fact1_);
-    1253             :   std::swap(fact2_,other.fact2_);
-    1254             :   std::swap(scheme_,other.scheme_);
-    1255           0 :   }
-    1256             : 
-    1257           0 : template<typename I> double T_Healpix_Base<I>::max_pixrad() const
-    1258             :   {
-    1259             :   vec3 va,vb;
-    1260           0 :   va.set_z_phi (2./3., pi/(4*nside_));
-    1261           0 :   double t1 = 1.-1./nside_;
-    1262           0 :   t1*=t1;
-    1263           0 :   vb.set_z_phi (1-t1/3, 0);
-    1264           0 :   return v_angle(va,vb);
-    1265             :   }
-    1266             : 
-    1267           0 : template<typename I> double T_Healpix_Base<I>::max_pixrad(I ring) const
-    1268             :   {
-    1269           0 :   if (ring>=2*nside_) ring=4*nside_-ring;
-    1270           0 :   double z=ring2z(ring), z_up=(ring>1) ? ring2z(ring-1) : 1.;
-    1271             :   vec3 mypos, uppos;
-    1272           0 :   uppos.set_z_phi(z_up,0);
-    1273           0 :   if (ring<=nside_)
-    1274             :     {
-    1275           0 :     mypos.set_z_phi(z,pi/(4*ring));
-    1276           0 :     return v_angle(mypos,uppos);
-    1277             :     }
-    1278           0 :   mypos.set_z_phi(z,0);
-    1279           0 :   double vdist=v_angle(mypos,uppos);
-    1280           0 :   double hdist=sqrt(1.-z*z)*pi/(4*nside_);
-    1281           0 :   return max(hdist,vdist);
-    1282             :   }
-    1283             : 
-    1284           0 : template<typename I> void T_Healpix_Base<I>::xyf2loc (double x, double y,
-    1285             :   int face, double &z, double &phi, double &sth, bool &have_sth) const
-    1286             :   {
-    1287           0 :   have_sth = false;
-    1288           0 :   double jr = jrll[face] - x - y;
-    1289             :   double nr;
-    1290           0 :   if (jr<1)
-    1291             :     {
-    1292             :     nr = jr;
-    1293           0 :     double tmp = nr*nr/3.;
-    1294           0 :     z = 1 - tmp;
-    1295           0 :     if (z > 0.99)
-    1296             :       {
-    1297           0 :       sth = std::sqrt(tmp*(2.0-tmp));
-    1298           0 :       have_sth = true;
-    1299             :       }
-    1300             :     }
-    1301           0 :   else if (jr>3)
-    1302             :     {
-    1303           0 :     nr = 4-jr;
-    1304           0 :     double tmp = nr*nr/3.;
-    1305           0 :     z = tmp - 1;
-    1306           0 :     if (z<-0.99)
-    1307             :       {
-    1308           0 :       sth = std::sqrt(tmp*(2.-tmp));
-    1309           0 :       have_sth = true;
-    1310             :       }
-    1311             :     }
-    1312             :   else
-    1313             :     {
-    1314             :     nr = 1;
-    1315           0 :     z = (2-jr)*2./3.;
-    1316             :     }
-    1317             : 
-    1318           0 :   double tmp=jpll[face]*nr+x-y;
-    1319           0 :   if (tmp<0) tmp+=8;
-    1320           0 :   if (tmp>=8) tmp-=8;
-    1321           0 :   phi = (nr<1e-15) ? 0 : (0.5*halfpi*tmp)/nr;
-    1322           0 :   }
-    1323             : 
-    1324             : namespace {
-    1325             : 
-    1326           0 : vec3 locToVec3 (double z, double phi, double sth, bool have_sth)
-    1327             :   {
-    1328           0 :   if (have_sth)
-    1329           0 :     return vec3(sth*cos(phi),sth*sin(phi),z);
-    1330             :   else
-    1331             :     {
-    1332             :     vec3 res;
-    1333           0 :     res.set_z_phi (z, phi);
-    1334           0 :     return res;
-    1335             :     }
-    1336             :   }
-    1337             : 
-    1338             : } // unnamed namespace
-    1339             : 
-    1340           0 : template<typename I> void T_Healpix_Base<I>::boundaries(I pix, tsize step,
-    1341             :   vector<vec3> &out) const
-    1342             :   {
-    1343           0 :   out.resize(4*step);
-    1344             :   int ix, iy, face;
-    1345           0 :   pix2xyf(pix, ix, iy, face);
-    1346           0 :   double dc = 0.5 / nside_;
-    1347           0 :   double xc = (ix + 0.5)/nside_, yc = (iy + 0.5)/nside_;
-    1348           0 :   double d = 1.0/(step*nside_);
-    1349           0 :   for (tsize i=0; i<step; ++i)
-    1350             :     {
-    1351             :     double z, phi, sth;
-    1352             :     bool have_sth;
-    1353           0 :     xyf2loc(xc+dc-i*d, yc+dc, face, z, phi, sth, have_sth);
-    1354           0 :     out[i] = locToVec3(z, phi, sth, have_sth);
-    1355           0 :     xyf2loc(xc-dc, yc+dc-i*d, face, z, phi, sth, have_sth);
-    1356           0 :     out[i+step] = locToVec3(z, phi, sth, have_sth);
-    1357           0 :     xyf2loc(xc-dc+i*d, yc-dc, face, z, phi, sth, have_sth);
-    1358           0 :     out[i+2*step] = locToVec3(z, phi, sth, have_sth);
-    1359           0 :     xyf2loc(xc+dc, yc-dc+i*d, face, z, phi, sth, have_sth);
-    1360           0 :     out[i+3*step] = locToVec3(z, phi, sth, have_sth);
-    1361             :     }
-    1362           0 :   }
-    1363             : 
-    1364           0 : template<typename I> arr<int> T_Healpix_Base<I>::swap_cycles() const
-    1365             :   {
-    1366           0 :   planck_assert(order_>=0, "need hierarchical map");
-    1367           0 :   planck_assert(order_<=13, "map too large");
-    1368           0 :   arr<int> result(swap_clen[order_]);
-    1369             :   tsize ofs=0;
-    1370           0 :   for (int m=0; m<order_;++m) ofs+=swap_clen[m];
-    1371           0 :   for (tsize m=0; m<result.size();++m) result[m]=swap_cycle[m+ofs];
-    1372           0 :   return result;
-    1373             :   }
-    1374             : 
-    1375             : template class T_Healpix_Base<int>;
-    1376             : template class T_Healpix_Base<int64>;
-    1377             : } // namespace healpix
-    1378             : 
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/alloc_utils.h.func-sort-c.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/alloc_utils.h.func-sort-c.html deleted file mode 100644 index 7fadb1a05..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/alloc_utils.h.func-sort-c.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/alloc_utils.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - alloc_utils.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:020.0 %
Date:2024-04-08 14:58:22Functions:060.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZNK7healpix13normalAlloc__INS_14T_Healpix_BaseIiEEE5allocEm0
_ZNK7healpix13normalAlloc__INS_14T_Healpix_BaseIlEEE5allocEm0
_ZNK7healpix13normalAlloc__INS_6vec3_tIdEEE5allocEm0
_ZNK7healpix13normalAlloc__IdE5allocEm0
_ZNK7healpix13normalAlloc__IiE5allocEm0
_ZNK7healpix13normalAlloc__ImE5allocEm0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/alloc_utils.h.func.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/alloc_utils.h.func.html deleted file mode 100644 index 4e93cb259..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/alloc_utils.h.func.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/alloc_utils.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - alloc_utils.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:020.0 %
Date:2024-04-08 14:58:22Functions:060.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZNK7healpix13normalAlloc__INS_14T_Healpix_BaseIiEEE5allocEm0
_ZNK7healpix13normalAlloc__INS_14T_Healpix_BaseIlEEE5allocEm0
_ZNK7healpix13normalAlloc__INS_6vec3_tIdEEE5allocEm0
_ZNK7healpix13normalAlloc__IdE5allocEm0
_ZNK7healpix13normalAlloc__IiE5allocEm0
_ZNK7healpix13normalAlloc__ImE5allocEm0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/alloc_utils.h.gcov.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/alloc_utils.h.gcov.html deleted file mode 100644 index 6d1cc4bf4..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/alloc_utils.h.gcov.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/alloc_utils.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - alloc_utils.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:020.0 %
Date:2024-04-08 14:58:22Functions:060.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : 
-       2             : /*
-       3             :  *  This file is part of libcxxsupport.
-       4             :  *
-       5             :  *  libcxxsupport is free software; you can redistribute it and/or modify
-       6             :  *  it under the terms of the GNU General Public License as published by
-       7             :  *  the Free Software Foundation; either version 2 of the License, or
-       8             :  *  (at your option) any later version.
-       9             :  *
-      10             :  *  libcxxsupport is distributed in the hope that it will be useful,
-      11             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-      12             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-      13             :  *  GNU General Public License for more details.
-      14             :  *
-      15             :  *  You should have received a copy of the GNU General Public License
-      16             :  *  along with libcxxsupport; if not, write to the Free Software
-      17             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-      18             :  */
-      19             : 
-      20             : /*
-      21             :  *  libcxxsupport is being developed at the Max-Planck-Institut fuer Astrophysik
-      22             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
-      23             :  *  (DLR).
-      24             :  */
-      25             : 
-      26             : /*! \file alloc_utils.h
-      27             :  *  Classes providing raw memory allocation and deallocation support.
-      28             :  *
-      29             :  *  Copyright (C) 2011 Max-Planck-Society
-      30             :  *  \author Martin Reinecke
-      31             :  */
-      32             : 
-      33             : #ifndef PLANCK_ALLOC_UTILS_H
-      34             : #define PLANCK_ALLOC_UTILS_H
-      35             : 
-      36             : #include <cstdlib>
-      37             : #include "healpix_base/datatypes.h"
-      38             : 
-      39             : namespace healpix{
-      40             : template <typename T> class normalAlloc__
-      41             :   {
-      42             :   public:
-      43           0 :     T *alloc(tsize sz) const { return (sz>0) ? new T[sz] : 0; }
-      44           0 :     void dealloc (T *ptr) const { delete[] ptr; }
-      45             :   };
-      46             : 
-      47             : template <typename T, int align> class alignAlloc__
-      48             :   {
-      49             :   public:
-      50             :     T *alloc(tsize sz) const
-      51             :       {
-      52             :       using namespace std;
-      53             :       if (sz==0) return 0;
-      54             :       planck_assert((align&(align-1))==0,"alignment must be power of 2");
-      55             :       void *res;
-      56             : /* OSX up to version 10.5 does not define posix_memalign(), but fortunately
-      57             :    the normal malloc() returns 16 byte aligned storage */
-      58             : #ifdef __APPLE__
-      59             :       planck_assert(align<=16, "bad alignment requested");
-      60             :       res=malloc(sz*sizeof(T));
-      61             :       planck_assert(res!=0,"error in malloc()");
-      62             : #else
-      63             :       planck_assert(posix_memalign(&res,align,sz*sizeof(T))==0,
-      64             :         "error in posix_memalign()");
-      65             : #endif
-      66             :       return static_cast<T *>(res);
-      67             :       }
-      68             :     void dealloc(T *ptr) const
-      69             :       {
-      70             :       using namespace std;
-      71             :       free(ptr);
-      72             :       }
-      73             :   };
-      74             : 
-      75             : 
-      76             : } // namespace healpix
-      77             : 
-      78             : #endif
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/arr.h.func-sort-c.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/arr.h.func-sort-c.html deleted file mode 100644 index 9bd6e3a5a..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/arr.h.func-sort-c.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/arr.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - arr.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0150.0 %
Date:2024-04-08 14:58:22Functions:010.0 %
-
- -
- - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix4arrTIdNS_13normalAlloc__IdEEEC2EmRKd0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/arr.h.func.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/arr.h.func.html deleted file mode 100644 index 782efedc9..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/arr.h.func.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/arr.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - arr.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0150.0 %
Date:2024-04-08 14:58:22Functions:010.0 %
-
- -
- - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix4arrTIdNS_13normalAlloc__IdEEEC2EmRKd0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/arr.h.gcov.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/arr.h.gcov.html deleted file mode 100644 index b9803ade1..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/arr.h.gcov.html +++ /dev/null @@ -1,734 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/arr.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - arr.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0150.0 %
Date:2024-04-08 14:58:22Functions:010.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : /*
-       2             :  *  This file is part of libcxxsupport.
-       3             :  *
-       4             :  *  libcxxsupport is free software; you can redistribute it and/or modify
-       5             :  *  it under the terms of the GNU General Public License as published by
-       6             :  *  the Free Software Foundation; either version 2 of the License, or
-       7             :  *  (at your option) any later version.
-       8             :  *
-       9             :  *  libcxxsupport is distributed in the hope that it will be useful,
-      10             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-      11             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-      12             :  *  GNU General Public License for more details.
-      13             :  *
-      14             :  *  You should have received a copy of the GNU General Public License
-      15             :  *  along with libcxxsupport; if not, write to the Free Software
-      16             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-      17             :  */
-      18             : 
-      19             : /*
-      20             :  *  libcxxsupport is being developed at the Max-Planck-Institut fuer Astrophysik
-      21             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
-      22             :  *  (DLR).
-      23             :  */
-      24             : 
-      25             : /*! \file arr.h
-      26             :  *  Various high-performance array classes used by the Planck LevelS package.
-      27             :  *
-      28             :  *  Copyright (C) 2002-2012 Max-Planck-Society
-      29             :  *  \author Martin Reinecke
-      30             :  */
-      31             : 
-      32             : #ifndef PLANCK_ARR_H
-      33             : #define PLANCK_ARR_H
-      34             : 
-      35             : #include <algorithm>
-      36             : #include <vector>
-      37             : #include <cstdlib>
-      38             : #include "healpix_base/alloc_utils.h"
-      39             : #include "healpix_base/datatypes.h"
-      40             : #include "healpix_base/math_utils.h"
-      41             : 
-      42             : namespace healpix{
-      43             : 
-      44             : /*! \defgroup arraygroup Array classes */
-      45             : /*! \{ */
-      46             : 
-      47             : /*! View of a 1D array */
-      48             : template <typename T> class arr_ref
-      49             :   {
-      50             :   protected:
-      51             :     tsize s;
-      52             :     T *d;
-      53             : 
-      54             :   public:
-      55             :     /*! Constructs an \a arr_ref of size \a s_, starting at \a d_. */
-      56           0 :     arr_ref(T *d_, tsize s_) : s(s_),d(d_) {}
-      57             : 
-      58             :     /*! Returns the current array size. */
-      59           0 :     tsize size() const { return s; }
-      60             : 
-      61             :     /*! Writes \a val into every element of the array. */
-      62             :     void fill (const T &val)
-      63           0 :       { for (tsize m=0; m<s; ++m) d[m]=val; }
-      64             : 
-      65             :     /*! Returns a reference to element \a n */
-      66           0 :     template<typename T2> T &operator[] (T2 n) {return d[n];}
-      67             :     /*! Returns a constant reference to element \a n */
-      68           0 :     template<typename T2> const T &operator[] (T2 n) const {return d[n];}
-      69             : 
-      70             :     /*! Returns a pointer to the first array element, or NULL if the array
-      71             :         is zero-sized. */
-      72             :     T *begin() { return d; }
-      73             :     /*! Returns a pointer to the one-past-last array element, or NULL if the
-      74             :         array is zero-sized. */
-      75             :     T *end() { return d+s; }
-      76             :     /*! Returns a constant pointer to the first array element, or NULL if the
-      77             :         array is zero-sized. */
-      78             :     const T *begin() const { return d; }
-      79             :     /*! Returns a constant pointer to the one-past-last array element, or NULL
-      80             :         if the array is zero-sized. */
-      81             :     const T *end() const { return d+s; }
-      82             : 
-      83             :     /*! Copies all array elements to \a ptr. */
-      84             :     template<typename T2> void copyToPtr (T *ptr) const
-      85             :       { for (tsize m=0; m<s; ++m) ptr[m]=d[m]; }
-      86             : 
-      87             :     /*! Sorts the elements in the array, in ascending order. */
-      88             :     void sort()
-      89             :       { std::sort (d,d+s); }
-      90             : 
-      91             :     /*! Sorts the elements in the array, such that \a comp(d[i],d[j])==true
-      92             :         for \a i<j. */
-      93             :     template<typename Comp> void sort(Comp comp)
-      94             :       { std::sort (d,d+s,comp); }
-      95             : 
-      96             :     /*! Helper function for linear interpolation (or extrapolation).
-      97             :         \a idx and \a val are computed such that
-      98             :         \a val=d[idx]+frac*(d[idx+1]-d[idx]). If \a val<d[0], \a frac will be
-      99             :         negative, if \a val>d[s-1], frac will be larger than 1. In all other
-     100             :         cases \a 0<=frac<=1.
-     101             : 
-     102             :         The array must be ordered in ascending order; no two values may be
-     103             :         equal. */
-     104             :     void interpol_helper (const T &val, tsize &idx, double &frac) const
-     105             :       { healpix::interpol_helper (d, d+s, val, idx, frac); }
-     106             : 
-     107             :     /*! Helper function for linear interpolation (or extrapolation).
-     108             :         \a idx and \a val are computed such that
-     109             :         \a val=d[idx]+frac*(d[idx+1]-d[idx]). If \a comp(val,d[0])==true,
-     110             :         \a frac will be negative, if \a comp(val,d[s-1])==false, frac will be
-     111             :         larger than 1. In all other cases \a 0<=frac<=1.
-     112             : 
-     113             :         The array must be ordered such that \a comp(d[i],d[j])==true
-     114             :         for \a i<j; no two values may be equal. */
-     115             :     template<typename Comp> void interpol_helper (const T &val, Comp comp,
-     116             :       tsize &idx, double &frac) const
-     117             :       { healpix::interpol_helper (d, d+s, val, comp, idx, frac); }
-     118             : 
-     119             :     /*! Returns the minimum and maximum entry in \a minv and \a maxv,
-     120             :         respectively. Throws an exception if the array is zero-sized. */
-     121             :     void minmax (T &minv, T &maxv) const
-     122             :       {
-     123             :       planck_assert(s>0,"trying to find min and max of a zero-sized array");
-     124             :       minv=maxv=d[0];
-     125             :       for (tsize m=1; m<s; ++m)
-     126             :         {
-     127             :         if (d[m]<minv) minv=d[m];
-     128             :         else if (d[m]>maxv) maxv=d[m];
-     129             :         }
-     130             :       }
-     131             : 
-     132             :     /*! Returns \a true, if \a val is found in the array, else \a false. */
-     133             :     bool contains (const T &val) const
-     134             :       {
-     135             :       for (tsize m=0; m<s; ++m)
-     136             :         if (d[m]==val) return true;
-     137             :       return false;
-     138             :       }
-     139             : 
-     140             :     /*! Returns the index of the first occurrence of \a val in the array.
-     141             :         If it is not found, an exception is thrown. */
-     142             :     tsize find (const T &val) const
-     143             :       {
-     144             :       for (tsize m=0; m<s; ++m)
-     145             :         if (d[m]==val) return m;
-     146             :       planck_fail ("entry not found in array");
-     147             :       }
-     148             : 
-     149             :     /*! Returns \a true if the array has the same size as \a other and all
-     150             :         elements of both arrays are equal, else \a false. */
-     151             :     bool contentsEqual(const arr_ref &other) const
-     152             :       {
-     153             :       if (s!=other.s) return false;
-     154             :       for (tsize i=0; i<s; ++i)
-     155             :         if (d[i]!=other.d[i]) return false;
-     156             :       return true;
-     157             :       }
-     158             :   };
-     159             : 
-     160             : /*! An array whose size is known at compile time. Very useful for storing
-     161             :     small arrays on the stack, without need for \a new and \a delete(). */
-     162             : template <typename T, tsize sz> class fix_arr
-     163             :   {
-     164             :   private:
-     165             :     T d[sz];
-     166             : 
-     167             :   public:
-     168             :     /*! Returns the size of the array. */
-     169             :     tsize size() const { return sz; }
-     170             : 
-     171             :     /*! Returns a reference to element \a n */
-     172             :     template<typename T2> T &operator[] (T2 n) {return d[n];}
-     173             :     /*! Returns a constant reference to element \a n */
-     174             :     template<typename T2> const T &operator[] (T2 n) const {return d[n];}
-     175             :   };
-     176             : 
-     177             : 
-     178             : /*! One-dimensional array type, with selectable storage management. */
-     179             : template <typename T, typename storageManager> class arrT: public arr_ref<T>
-     180             :   {
-     181             :   private:
-     182             :     storageManager stm;
-     183             :     bool own;
-     184             : 
-     185             :     void reset()
-     186             :       { this->d=0; this->s=0; own=true; }
-     187             : 
-     188             :   public:
-     189             :     /*! Creates a zero-sized array. */
-     190             :     arrT() : arr_ref<T>(0,0), own(true) {}
-     191             :     /*! Creates an array with \a sz entries. */
-     192           0 :     arrT(tsize sz) : arr_ref<T>(stm.alloc(sz),sz), own(true) {}
-     193             :     /*! Creates an array with \a sz entries, and initializes them with
-     194             :         \a inival. */
-     195           0 :     arrT(tsize sz, const T &inival) : arr_ref<T>(stm.alloc(sz),sz), own(true)
-     196           0 :       { this->fill(inival); }
-     197             :     /*! Creates an array with \a sz entries, which uses the memory pointed
-     198             :         to by \a ptr.
-     199             :         \note \a ptr will <i>not</i> be deallocated by the destructor.
-     200             :         \warning Only use this if you REALLY know what you are doing.
-     201             :         In particular, this is only safely usable if
-     202             :           <ul>
-     203             :           <li>\a T is a POD type</li>
-     204             :           <li>\a ptr survives during the lifetime of the array object</li>
-     205             :           <li>\a ptr is not subject to garbage collection</li>
-     206             :           </ul>
-     207             :         Other restrictions may apply. You have been warned. */
-     208             :     arrT (T *ptr, tsize sz): arr_ref<T>(ptr,sz), own(false) {}
-     209             :     /*! Creates an array which is a copy of \a orig. The data in \a orig
-     210             :         is duplicated. */
-     211             :     arrT (const arrT &orig): arr_ref<T>(stm.alloc(orig.s),orig.s), own(true)
-     212             :       { for (tsize m=0; m<this->s; ++m) this->d[m] = orig.d[m]; }
-     213             :     /*! Frees the memory allocated by the object. */
-     214           0 :     ~arrT() { if (own) stm.dealloc(this->d); }
-     215             : 
-     216             :     /*! Allocates space for \a sz elements. The content of the array is
-     217             :         undefined on exit. \a sz can be 0. If \a sz is the
-     218             :         same as the current size, no reallocation is performed. */
-     219             :     void alloc (tsize sz)
-     220             :       {
-     221             :       if (sz==this->s) return;
-     222             :       if (own) stm.dealloc(this->d);
-     223             :       this->s = sz;
-     224             :       this->d = stm.alloc(sz);
-     225             :       own = true;
-     226             :       }
-     227             :     /*! Allocates space for \a sz elements. If \a sz is the
-     228             :         same as the current size, no reallocation is performed.
-     229             :         All elements are set to \a inival. */
-     230             :     void allocAndFill (tsize sz, const T &inival)
-     231             :       { alloc(sz); this->fill(inival); }
-     232             :     /*! Deallocates the memory held by the array, and sets the array size
-     233             :         to 0. */
-     234             :     void dealloc() {if (own) stm.dealloc(this->d); reset();}
-     235             :     /*! Resizes the array to hold \a sz elements. The existing content of the
-     236             :         array is copied over to the new array to the extent possible.
-     237             :         \a sz can be 0. If \a sz is the same as the current size, no
-     238             :         reallocation is performed. */
-     239             :     void resize (tsize sz)
-     240             :       {
-     241             :       using namespace std;
-     242             :       if (sz==this->s) return;
-     243             :       T *tmp = stm.alloc(sz);
-     244             :       for (tsize m=0; m<min(sz,this->s); ++m)
-     245             :         tmp[m]=this->d[m];
-     246             :       if (own) stm.dealloc(this->d);
-     247             :       this->s = sz;
-     248             :       this->d = tmp;
-     249             :       own = true;
-     250             :       }
-     251             : 
-     252             :     /*! Changes the array to be a copy of \a orig. */
-     253             :     arrT &operator= (const arrT &orig)
-     254             :       {
-     255             :       if (this==&orig) return *this;
-     256             :       alloc (orig.s);
-     257             :       for (tsize m=0; m<this->s; ++m) this->d[m] = orig.d[m];
-     258             :       return *this;
-     259             :       }
-     260             : 
-     261             :     /*! Changes the array to be a copy of the std::vector \a orig. */
-     262             :     template<typename T2> void copyFrom (const std::vector<T2> &orig)
-     263             :       {
-     264             :       alloc (orig.size());
-     265             :       for (tsize m=0; m<this->s; ++m) this->d[m] = orig[m];
-     266             :       }
-     267             :     /*! Changes the std::vector \a vec to be a copy of the object. */
-     268             :     template<typename T2> void copyTo (std::vector<T2> &vec) const
-     269             :       {
-     270             :       vec.clear(); vec.reserve(this->s);
-     271             :       for (tsize m=0; m<this->s; ++m) vec.push_back(this->d[m]);
-     272             :       }
-     273             : 
-     274             :     /*! Reserves space for \a sz elements, then copies \a sz elements
-     275             :         from \a ptr into the array. */
-     276             :     template<typename T2> void copyFromPtr (const T2 *ptr, tsize sz)
-     277             :       {
-     278             :       alloc(sz);
-     279             :       for (tsize m=0; m<this->s; ++m) this->d[m]=ptr[m];
-     280             :       }
-     281             : 
-     282             :     /*! Assigns the contents and size of \a other to the array.
-     283             :         \note On exit, \a other is zero-sized! */
-     284             :     void transfer (arrT &other)
-     285             :       {
-     286             :       if (own) stm.dealloc(this->d);
-     287             :       this->d=other.d;
-     288             :       this->s=other.s;
-     289             :       own=other.own;
-     290             :       other.reset();
-     291             :       }
-     292             :     /*! Swaps contents and size with \a other. */
-     293             :     void swap (arrT &other)
-     294             :       {
-     295             :       std::swap(this->d,other.d);
-     296             :       std::swap(this->s,other.s);
-     297             :       std::swap(own,other.own);
-     298             :       }
-     299             :   };
-     300             : 
-     301             : /*! One-dimensional array type. */
-     302             : template <typename T>
-     303           0 :   class arr: public arrT<T,normalAlloc__<T> >
-     304             :   {
-     305             :   public:
-     306             :     /*! Creates a zero-sized array. */
-     307             :     arr() : arrT<T,normalAlloc__<T> >() {}
-     308             :     /*! Creates an array with \a sz entries. */
-     309             :     arr(tsize sz) : arrT<T,normalAlloc__<T> >(sz) {}
-     310             :     /*! Creates an array with \a sz entries, and initializes them with
-     311             :         \a inival. */
-     312           0 :     arr(tsize sz, const T &inival) : arrT<T,normalAlloc__<T> >(sz,inival) {}
-     313             :     /*! Creates an array with \a sz entries, which uses the memory pointed
-     314             :         to by \a ptr.
-     315             :         \note \a ptr will <i>not</i> be deallocated by the destructor.
-     316             :         \warning Only use this if you REALLY know what you are doing.
-     317             :         In particular, this is only safely usable if
-     318             :           <ul>
-     319             :           <li>\a T is a POD type</li>
-     320             :           <li>\a ptr survives during the lifetime of the array object</li>
-     321             :           <li>\a ptr is not subject to garbage collection</li>
-     322             :           </ul>
-     323             :         Other restrictions may apply. You have been warned. */
-     324             :     arr (T *ptr, tsize sz): arrT<T,normalAlloc__<T> >(ptr,sz) {}
-     325             :     /*! Creates an array which is a copy of \a orig. The data in \a orig
-     326             :         is duplicated. */
-     327             :     arr (const arr &orig): arrT<T,normalAlloc__<T> >(orig) {}
-     328             :   };
-     329             : 
-     330             : /*! One-dimensional array type, with selectable storage alignment. */
-     331             : template <typename T, int align>
-     332             :   class arr_align: public arrT<T,alignAlloc__<T,align> >
-     333             :   {
-     334             :   public:
-     335             :     /*! Creates a zero-sized array. */
-     336             :     arr_align() : arrT<T,alignAlloc__<T,align> >() {}
-     337             :     /*! Creates an array with \a sz entries. */
-     338             :     arr_align(tsize sz) : arrT<T,alignAlloc__<T,align> >(sz) {}
-     339             :     /*! Creates an array with \a sz entries, and initializes them with
-     340             :         \a inival. */
-     341             :     arr_align(tsize sz, const T &inival)
-     342             :       : arrT<T,alignAlloc__<T,align> >(sz,inival) {}
-     343             :   };
-     344             : 
-     345             : 
-     346             : /*! Two-dimensional array type, with selectable storage management.
-     347             :     The storage ordering is the same as in C.
-     348             :     An entry is located by address arithmetic, not by double dereferencing.
-     349             :     The indices start at zero. */
-     350             : template <typename T, typename storageManager> class arr2T
-     351             :   {
-     352             :   private:
-     353             :     tsize s1, s2;
-     354             :     arrT<T, storageManager> d;
-     355             : 
-     356             :   public:
-     357             :     /*! Creates a zero-sized array. */
-     358             :     arr2T() : s1(0), s2(0) {}
-     359             :     /*! Creates an array with the dimensions \a sz1 and \a sz2. */
-     360             :     arr2T(tsize sz1, tsize sz2)
-     361             :       : s1(sz1), s2(sz2), d(s1*s2) {}
-     362             :     /*! Creates an array with the dimensions  \a sz1 and \a sz2
-     363             :         and initializes them with \a inival. */
-     364             :     arr2T(tsize sz1, tsize sz2, const T &inival)
-     365             :       : s1(sz1), s2(sz2), d (s1*s2)
-     366             :       { fill(inival); }
-     367             :     /*! Creates the array as a copy of \a orig. */
-     368             :     arr2T(const arr2T &orig)
-     369             :       : s1(orig.s1), s2(orig.s2), d(orig.d) {}
-     370             :     /*! Frees the memory associated with the array. */
-     371             :     ~arr2T() {}
-     372             : 
-     373             :     /*! Returns the first array dimension. */
-     374             :     tsize size1() const { return s1; }
-     375             :     /*! Returns the second array dimension. */
-     376             :     tsize size2() const { return s2; }
-     377             :     /*! Returns the total array size, i.e. the product of both dimensions. */
-     378             :     tsize size () const { return s1*s2; }
-     379             : 
-     380             :     /*! Allocates space for an array with \a sz1*sz2 elements.
-     381             :         The content of the array is undefined on exit.
-     382             :         \a sz1 or \a sz2 can be 0. If \a sz1*sz2 is the same as the
-     383             :         currently allocated space, no reallocation is performed. */
-     384             :     void alloc (tsize sz1, tsize sz2)
-     385             :       {
-     386             :       if (sz1*sz2 != d.size())
-     387             :         d.alloc(sz1*sz2);
-     388             :       s1=sz1; s2=sz2;
-     389             :       }
-     390             :     /*! Allocates space for an array with \a sz1*sz2 elements.
-     391             :         All elements are set to \a inival.
-     392             :         \a sz1 or \a sz2 can be 0. If \a sz1*sz2 is the same as the
-     393             :         currently allocated space, no reallocation is performed. */
-     394             :     void allocAndFill (tsize sz1, tsize sz2, const T &inival)
-     395             :       { alloc(sz1,sz2); fill(inival); }
-     396             :     /*! Allocates space for an array with \a sz1*sz2 elements.
-     397             :         The content of the array is undefined on exit.
-     398             :         \a sz1 or \a sz2 can be 0. If \a sz1*sz2 is smaller than the
-     399             :         currently allocated space, no reallocation is performed. */
-     400             :     void fast_alloc (tsize sz1, tsize sz2)
-     401             :       {
-     402             :       if (sz1*sz2<=d.size())
-     403             :         { s1=sz1; s2=sz2; }
-     404             :       else
-     405             :         alloc(sz1,sz2);
-     406             :       }
-     407             :     /*! Deallocates the space and makes the array zero-sized. */
-     408             :     void dealloc () {d.dealloc(); s1=0; s2=0;}
-     409             : 
-     410             :     /*! Sets all array elements to \a val. */
-     411             :     void fill (const T &val)
-     412             :       { for (tsize m=0; m<s1*s2; ++m) d[m]=val; }
-     413             : 
-     414             :     /*! Multiplies all array elements by \a val. */
-     415             :     void scale (const T &val)
-     416             :       { for (tsize m=0; m<s1*s2; ++m) d[m]*=val; }
-     417             : 
-     418             :     /*! Changes the array to be a copy of \a orig. */
-     419             :     arr2T &operator= (const arr2T &orig)
-     420             :       {
-     421             :       if (this==&orig) return *this;
-     422             :       alloc (orig.s1, orig.s2);
-     423             :       d = orig.d;
-     424             :       return *this;
-     425             :       }
-     426             : 
-     427             :     /*! Returns a pointer to the beginning of slice \a n. */
-     428             :     template<typename T2> T *operator[] (T2 n) {return &d[n*s2];}
-     429             :     /*! Returns a constant pointer to the beginning of slice \a n. */
-     430             :     template<typename T2> const T *operator[] (T2 n) const {return &d[n*s2];}
-     431             : 
-     432             :     /*! Returns a reference to the element with the indices \a n1 and \a n2. */
-     433             :     template<typename T2, typename T3> T &operator() (T2 n1, T3 n2)
-     434             :       {return d[n1*s2 + n2];}
-     435             :     /*! Returns a constant reference to the element with the indices
-     436             :         \a n1 and \a n2. */
-     437             :     template<typename T2, typename T3> const T &operator() (T2 n1, T3 n2) const
-     438             :       {return d[n1*s2 + n2];}
-     439             : 
-     440             :     /*! Returns the minimum and maximum entry in \a minv and \a maxv,
-     441             :         respectively. Throws an exception if the array is zero-sized. */
-     442             :     void minmax (T &minv, T &maxv) const
-     443             :       {
-     444             :       planck_assert(s1*s2>0,
-     445             :         "trying to find min and max of a zero-sized array");
-     446             :       minv=maxv=d[0];
-     447             :       for (tsize m=1; m<s1*s2; ++m)
-     448             :         {
-     449             :         if (d[m]<minv) minv=d[m];
-     450             :         if (d[m]>maxv) maxv=d[m];
-     451             :         }
-     452             :       }
-     453             : 
-     454             :     /*! Swaps contents and sizes with \a other. */
-     455             :     void swap (arr2T &other)
-     456             :       {
-     457             :       d.swap(other.d);
-     458             :       std::swap(s1,other.s1);
-     459             :       std::swap(s2,other.s2);
-     460             :       }
-     461             : 
-     462             :     /*! Returns \c true if the array and \a other have the same dimensions,
-     463             :         else \c false. */
-     464             :     template<typename T2, typename T3> bool conformable
-     465             :       (const arr2T<T2,T3> &other) const
-     466             :       { return (other.size1()==s1) && (other.size2()==s2); }
-     467             :   };
-     468             : 
-     469             : /*! Two-dimensional array type. The storage ordering is the same as in C.
-     470             :     An entry is located by address arithmetic, not by double dereferencing.
-     471             :     The indices start at zero. */
-     472             : template <typename T>
-     473             :   class arr2: public arr2T<T,normalAlloc__<T> >
-     474             :   {
-     475             :   public:
-     476             :     /*! Creates a zero-sized array. */
-     477             :     arr2() : arr2T<T,normalAlloc__<T> > () {}
-     478             :     /*! Creates an array with the dimensions \a sz1 and \a sz2. */
-     479             :     arr2(tsize sz1, tsize sz2) : arr2T<T,normalAlloc__<T> > (sz1,sz2) {}
-     480             :     /*! Creates an array with the dimensions  \a sz1 and \a sz2
-     481             :         and initializes them with \a inival. */
-     482             :     arr2(tsize sz1, tsize sz2, const T &inival)
-     483             :       : arr2T<T,normalAlloc__<T> > (sz1,sz2,inival) {}
-     484             :   };
-     485             : 
-     486             : /*! Two-dimensional array type, with selectable storage alignment.
-     487             :     The storage ordering is the same as in C.
-     488             :     An entry is located by address arithmetic, not by double dereferencing.
-     489             :     The indices start at zero. */
-     490             : template <typename T, int align>
-     491             :   class arr2_align: public arr2T<T,alignAlloc__<T,align> >
-     492             :   {
-     493             :   public:
-     494             :     /*! Creates a zero-sized array. */
-     495             :     arr2_align() : arr2T<T,alignAlloc__<T,align> > () {}
-     496             :     /*! Creates an array with the dimensions \a sz1 and \a sz2. */
-     497             :     arr2_align(tsize sz1, tsize sz2)
-     498             :       : arr2T<T,alignAlloc__<T,align> > (sz1,sz2) {}
-     499             :     /*! Creates an array with the dimensions  \a sz1 and \a sz2
-     500             :         and initializes them with \a inival. */
-     501             :     arr2_align(tsize sz1, tsize sz2, const T &inival)
-     502             :       : arr2T<T,alignAlloc__<T,align> > (sz1,sz2,inival) {}
-     503             :   };
-     504             : 
-     505             : /*! Two-dimensional array type. An entry is located by double dereferencing,
-     506             :     i.e. via an array of pointers. The indices start at zero. */
-     507             : template <typename T> class arr2b
-     508             :   {
-     509             :   private:
-     510             :     tsize s1, s2;
-     511             :     arr<T> d;
-     512             :     arr<T *> d1;
-     513             : 
-     514             :     void fill_d1()
-     515             :       { for (tsize m=0; m<s1; ++m) d1[m] = &d[m*s2]; }
-     516             : 
-     517             :   public:
-     518             :     /*! Creates a zero-sized array. */
-     519             :     arr2b() : s1(0), s2(0), d(0), d1(0) {}
-     520             :     /*! Creates an array with the dimensions \a sz1 and \a sz2. */
-     521             :     arr2b(tsize sz1, tsize sz2)
-     522             :       : s1(sz1), s2(sz2), d(s1*s2), d1(s1)
-     523             :       { fill_d1(); }
-     524             :     /*! Creates the array as a copy of \a orig. */
-     525             :     arr2b(const arr2b &orig)
-     526             :       : s1(orig.s1), s2(orig.s2), d(orig.d), d1(s1)
-     527             :       { fill_d1(); }
-     528             :     /*! Frees the memory associated with the array. */
-     529             :     ~arr2b() {}
-     530             : 
-     531             :     /*! Returns the first array dimension. */
-     532             :     tsize size1() const { return s1; }
-     533             :     /*! Returns the second array dimension. */
-     534             :     tsize size2() const { return s2; }
-     535             :     /*! Returns the total array size, i.e. the product of both dimensions. */
-     536             :     tsize size () const { return s1*s2; }
-     537             : 
-     538             :     /*! Allocates space for an array with \a sz1*sz2 elements.
-     539             :         The content of the array is undefined on exit. */
-     540             :     void alloc (tsize sz1, tsize sz2)
-     541             :       {
-     542             :       if ((s1==sz1) && (s2==sz2)) return;
-     543             :       s1=sz1; s2=sz2;
-     544             :       d.alloc(s1*s2);
-     545             :       d1.alloc(s1);
-     546             :       fill_d1();
-     547             :       }
-     548             :     /*! Deallocates the space and makes the array zero-sized. */
-     549             :     void dealloc () {d.dealloc(); d1.dealloc(); s1=0; s2=0;}
-     550             : 
-     551             :     /*! Sets all array elements to \a val. */
-     552             :     void fill (const T &val)
-     553             :       { d.fill(val); }
-     554             : 
-     555             :     /*! Changes the array to be a copy of \a orig. */
-     556             :     arr2b &operator= (const arr2b &orig)
-     557             :       {
-     558             :       if (this==&orig) return *this;
-     559             :       alloc (orig.s1, orig.s2);
-     560             :       for (tsize m=0; m<s1*s2; ++m) d[m] = orig.d[m];
-     561             :       return *this;
-     562             :       }
-     563             : 
-     564             :     /*! Returns a pointer to the beginning of slice \a n. */
-     565             :     template<typename T2> T *operator[] (T2 n) {return d1[n];}
-     566             :     /*! Returns a constant pointer to the beginning of slice \a n. */
-     567             :     template<typename T2> const T *operator[] (T2 n) const {return d1[n];}
-     568             : 
-     569             :     /*! Returns a pointer to the beginning of the pointer array. */
-     570             :     T **p0() {return &d1[0];}
-     571             :   };
-     572             : 
-     573             : 
-     574             : /*! Three-dimensional array type. The storage ordering is the same as in C.
-     575             :     An entry is located by address arithmetic, not by multiple dereferencing.
-     576             :     The indices start at zero. */
-     577             : template <typename T> class arr3
-     578             :   {
-     579             :   private:
-     580             :     tsize s1, s2, s3, s2s3;
-     581             :     arr<T> d;
-     582             : 
-     583             :   public:
-     584             :     /*! Creates a zero-sized array. */
-     585             :     arr3() : s1(0), s2(0), s3(0), s2s3(0), d(0) {}
-     586             :     /*! Creates an array with the dimensions \a sz1, \a sz2 and \a sz3. */
-     587           0 :     arr3(tsize sz1, tsize sz2, tsize sz3)
-     588           0 :       : s1(sz1), s2(sz2), s3(sz3), s2s3(s2*s3), d(s1*s2*s3) {}
-     589             :     /*! Creates the array as a copy of \a orig. */
-     590             :     arr3(const arr3 &orig)
-     591             :       : s1(orig.s1), s2(orig.s2), s3(orig.s3), s2s3(orig.s2s3), d(orig.d) {}
-     592             :     /*! Frees the memory associated with the array. */
-     593           0 :     ~arr3() {}
-     594             : 
-     595             :     /*! Returns the first array dimension. */
-     596             :     tsize size1() const { return s1; }
-     597             :     /*! Returns the second array dimension. */
-     598             :     tsize size2() const { return s2; }
-     599             :     /*! Returns the third array dimension. */
-     600             :     tsize size3() const { return s3; }
-     601             :     /*! Returns the total array size, i.e. the product of all dimensions. */
-     602             :     tsize size () const { return s1*s2*s3; }
-     603             : 
-     604             :     /*! Allocates space for an array with \a sz1*sz2*sz3 elements.
-     605             :         The content of the array is undefined on exit. */
-     606             :     void alloc (tsize sz1, tsize sz2, tsize sz3)
-     607             :       {
-     608             :       d.alloc(sz1*sz2*sz3);
-     609             :       s1=sz1; s2=sz2; s3=sz3; s2s3=s2*s3;
-     610             :       }
-     611             :     /*! Deallocates the space and makes the array zero-sized. */
-     612             :     void dealloc () {d.dealloc(); s1=0; s2=0; s3=0; s2s3=0;}
-     613             : 
-     614             :     /*! Sets all array elements to \a val. */
-     615             :     void fill (const T &val)
-     616             :       { d.fill(val); }
-     617             : 
-     618             :     /*! Changes the array to be a copy of \a orig. */
-     619             :     arr3 &operator= (const arr3 &orig)
-     620             :       {
-     621             :       if (this==&orig) return *this;
-     622             :       alloc (orig.s1, orig.s2, orig.s3);
-     623             :       d = orig.d;
-     624             :       return *this;
-     625             :       }
-     626             : 
-     627             :     /*! Returns a reference to the element with the indices
-     628             :         \a n1, \a n2 and \a n3. */
-     629             :     template<typename T2, typename T3, typename T4> T &operator()
-     630             :       (T2 n1, T3 n2, T4 n3)
-     631           0 :       {return d[n1*s2s3 + n2*s3 + n3];}
-     632             :     /*! Returns a constant reference to the element with the indices
-     633             :         \a n1, \a n2 and \a n3. */
-     634             :     template<typename T2, typename T3, typename T4> const T &operator()
-     635             :       (T2 n1, T3 n2, T4 n3) const
-     636             :       {return d[n1*s2s3 + n2*s3 + n3];}
-     637             : 
-     638             :     /*! Swaps contents and sizes with \a other. */
-     639             :     void swap (arr3 &other)
-     640             :       {
-     641             :       d.swap(other.d);
-     642             :       std::swap(s1,other.s1);
-     643             :       std::swap(s2,other.s2);
-     644             :       std::swap(s3,other.s3);
-     645             :       std::swap(s2s3,other.s2s3);
-     646             :       }
-     647             : 
-     648             :     /*! Returns \c true if the array and \a other have the same dimensions,
-     649             :         else \c false. */
-     650             :     template<typename T2> bool conformable (const arr3<T2> &other) const
-     651             :       { return (other.size1()==s1)&&(other.size2()==s2)&&(other.size3()==s3); }
-     652             :   };
-     653             : 
-     654             : /*! \} */
-     655             : 
-     656             : } // namespace healpix
-     657             : #endif
-     658             : 
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/error_handling.h.func-sort-c.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/error_handling.h.func-sort-c.html deleted file mode 100644 index 3feba0c8f..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/error_handling.h.func-sort-c.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/error_handling.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - error_handling.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:020.0 %
Date:2024-04-08 14:58:22Functions:010.0 %
-
- -
- - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZNK7healpix11PlanckError4whatEv0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/error_handling.h.func.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/error_handling.h.func.html deleted file mode 100644 index 256c36ce3..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/error_handling.h.func.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/error_handling.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - error_handling.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:020.0 %
Date:2024-04-08 14:58:22Functions:010.0 %
-
- -
- - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZNK7healpix11PlanckError4whatEv0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/error_handling.h.gcov.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/error_handling.h.gcov.html deleted file mode 100644 index 5a90a3d3f..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/error_handling.h.gcov.html +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/error_handling.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - error_handling.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:020.0 %
Date:2024-04-08 14:58:22Functions:010.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : 
-       2             : /*
-       3             :  *  This file is part of libcxxsupport.
-       4             :  *
-       5             :  *  libcxxsupport is free software; you can redistribute it and/or modify
-       6             :  *  it under the terms of the GNU General Public License as published by
-       7             :  *  the Free Software Foundation; either version 2 of the License, or
-       8             :  *  (at your option) any later version.
-       9             :  *
-      10             :  *  libcxxsupport is distributed in the hope that it will be useful,
-      11             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-      12             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-      13             :  *  GNU General Public License for more details.
-      14             :  *
-      15             :  *  You should have received a copy of the GNU General Public License
-      16             :  *  along with libcxxsupport; if not, write to the Free Software
-      17             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-      18             :  */
-      19             : 
-      20             : /*
-      21             :  *  libcxxsupport is being developed at the Max-Planck-Institut fuer Astrophysik
-      22             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
-      23             :  *  (DLR).
-      24             :  */
-      25             : 
-      26             : /*! \file error_handling.h
-      27             :  *  Utilities for error reporting
-      28             :  *
-      29             :  *  Copyright (C) 2003-2011 Max-Planck-Society
-      30             :  *  Authors: Reinhard Hell, Martin Reinecke
-      31             :  */
-      32             : 
-      33             : #ifndef PLANCK_ERROR_HANDLING_H
-      34             : #define PLANCK_ERROR_HANDLING_H
-      35             : 
-      36             : #include <string>
-      37             : #include <iostream>
-      38             : 
-      39             : namespace healpix{
-      40             : #if defined (__GNUC__)
-      41             : #define PLANCK_FUNC_NAME__ __PRETTY_FUNCTION__
-      42             : #else
-      43             : #define PLANCK_FUNC_NAME__ 0
-      44             : #endif
-      45             : 
-      46             : void planck_failure__(const char *file, int line, const char *func,
-      47             :   const std::string &msg);
-      48             : void planck_failure__(const char *file, int line, const char *func,
-      49             :   const char *msg);
-      50             : void killjob__();
-      51             : 
-      52             : class PlanckError
-      53             :   {
-      54             :   private:
-      55             :     std::string msg;
-      56             : 
-      57             :   public:
-      58             :     explicit PlanckError(const std::string &message);
-      59             :     explicit PlanckError(const char *message);
-      60             : 
-      61           0 :     virtual const char* what() const
-      62           0 :       { return msg.c_str(); }
-      63             : 
-      64             :     virtual ~PlanckError();
-      65             :   };
-      66             : 
-      67             : /*! \defgroup errorgroup Error handling */
-      68             : /*! \{ */
-      69             : 
-      70             : /*! Writes diagnostic output and exits with an error status. */
-      71             : #define planck_fail(msg) \
-      72             : do { planck_failure__(__FILE__,__LINE__,PLANCK_FUNC_NAME__,msg); \
-      73             : throw PlanckError(msg); } while(0)
-      74             : 
-      75             : /*! Throws a PlanckError without diagnostic message. */
-      76             : #define planck_fail_quietly(msg) \
-      77             : do { throw PlanckError(msg); } while(0)
-      78             : 
-      79             : /*! Writes diagnostic output and exits with an error status if \a testval
-      80             :     is \a false. */
-      81             : #define planck_assert(testval,msg) \
-      82             : do { if (testval); else planck_fail(msg); } while(0)
-      83             : 
-      84             : /*! Macro for improving error diagnostics. Should be placed immediately
-      85             :     after the opening brace of \c main(). Must be used in conjunction with
-      86             :     \c PLANCK_DIAGNOSIS_END. */
-      87             : #define PLANCK_DIAGNOSIS_BEGIN try {
-      88             : /*! Macro for improving error diagnostics. Should be placed immediately
-      89             :     before the closing brace of \c main(). Must be used in conjunction with
-      90             :     \c PLANCK_DIAGNOSIS_BEGIN. */
-      91             : #define PLANCK_DIAGNOSIS_END \
-      92             : } \
-      93             : catch (PlanckError &) \
-      94             :   { killjob__(); /* no need for further diagnostics; they were shown already */ } \
-      95             : catch (std::exception &e) \
-      96             :   { std::cerr << "std::exception: " << e.what() << std::endl; killjob__(); } \
-      97             : catch (...) \
-      98             :   { std::cerr << "Unknown exception" << std::endl; killjob__(); }
-      99             : 
-     100             : /*! \} */
-     101             : 
-     102             : } // namespace healpix
-     103             : #endif
-     104             : 
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/geom_utils.h.func-sort-c.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/geom_utils.h.func-sort-c.html deleted file mode 100644 index 19feeba32..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/geom_utils.h.func-sort-c.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/geom_utils.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - geom_utils.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:040.0 %
Date:2024-04-08 14:58:22Functions:020.0 %
-
- -
- - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix12cosdist_zphiEdddd0
_ZN7healpix7v_angleERKNS_6vec3_tIdEES3_0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/geom_utils.h.func.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/geom_utils.h.func.html deleted file mode 100644 index be6031adf..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/geom_utils.h.func.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/geom_utils.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - geom_utils.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:040.0 %
Date:2024-04-08 14:58:22Functions:020.0 %
-
- -
- - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix12cosdist_zphiEdddd0
_ZN7healpix7v_angleERKNS_6vec3_tIdEES3_0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/geom_utils.h.gcov.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/geom_utils.h.gcov.html deleted file mode 100644 index 42f3ff33f..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/geom_utils.h.gcov.html +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/geom_utils.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - geom_utils.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:040.0 %
Date:2024-04-08 14:58:22Functions:020.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : /*
-       2             :  *  This file is part of libcxxsupport.
-       3             :  *
-       4             :  *  libcxxsupport is free software; you can redistribute it and/or modify
-       5             :  *  it under the terms of the GNU General Public License as published by
-       6             :  *  the Free Software Foundation; either version 2 of the License, or
-       7             :  *  (at your option) any later version.
-       8             :  *
-       9             :  *  libcxxsupport is distributed in the hope that it will be useful,
-      10             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-      11             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-      12             :  *  GNU General Public License for more details.
-      13             :  *
-      14             :  *  You should have received a copy of the GNU General Public License
-      15             :  *  along with libcxxsupport; if not, write to the Free Software
-      16             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-      17             :  */
-      18             : 
-      19             : /*
-      20             :  *  libcxxsupport is being developed at the Max-Planck-Institut fuer Astrophysik
-      21             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
-      22             :  *  (DLR).
-      23             :  */
-      24             : 
-      25             : /*! \file geom_utils.h
-      26             :  *  Geometric utility functions.
-      27             :  *
-      28             :  *  Copyright (C) 2003-2011 Max-Planck-Society
-      29             :  *  \author Martin Reinecke
-      30             :  *  \author Reinhard Hell
-      31             :  */
-      32             : 
-      33             : #ifndef PLANCK_GEOM_UTILS_H
-      34             : #define PLANCK_GEOM_UTILS_H
-      35             : 
-      36             : #include "healpix_base/math_utils.h"
-      37             : #include "healpix_base/vec3.h"
-      38             : 
-      39             : namespace healpix{
-      40             : 
-      41             : template<typename T> class arr;
-      42             : 
-      43             : /*! Returns the orientation when looking from point \a loc on the unit
-      44             :     sphere in the direction \a dir. \a loc must be normalized. The result
-      45             :     ranges from -pi to pi, is 0 for North and pi/2 for West, i.e. the angle
-      46             :     is given in mathematically positive sense.
-      47             : 
-      48             :     If \a loc is the North or South pole, the returned angle is
-      49             :     \a atan2(dir.y,dir.x). */
-      50             : inline double orientation (const vec3 &loc, const vec3 &dir)
-      51             :   {
-      52             : // FIXME: here is still optimization potential
-      53             :   if (loc.x==0 && loc.y==0)
-      54             :     return (loc.z>0) ? safe_atan2(dir.y,-dir.x) : safe_atan2(dir.y,dir.x);
-      55             :   vec3 east (-loc.y, loc.x, 0);
-      56             :   vec3 north = crossprod(loc,east);
-      57             :   return safe_atan2(-dotprod(dir,east),dotprod(dir,north));
-      58             :   }
-      59             : 
-      60             : /*! Returns the angle between \a v1 and \a v2 in radians. */
-      61           0 : inline double v_angle (const vec3 &v1, const vec3 &v2)
-      62             :   {
-      63             :   using namespace std;
-      64           0 :   return atan2 (crossprod(v1,v2).Length(), dotprod(v1,v2));
-      65             :   }
-      66             : 
-      67             : /*! Returns the cosine of the angle between the two points on the sphere defined
-      68             :     by (\a z1, \a phi1) and (\a z2, \a phi2), respectively. \a z is the cosine
-      69             :     of the colatitude, and \a phi is the longitude. */
-      70           0 : inline double cosdist_zphi (double z1, double phi1, double z2, double phi2)
-      71             :   {
-      72             :   using namespace std;
-      73           0 :   return z1*z2+cos(phi1-phi2)*sqrt((1.-z1*z1)*(1.-z2*z2));
-      74             :   }
-      75             : 
-      76             : /*! Finds the smallest enclosing cone for a point set on the sphere according to
-      77             :     Barequet & Elber: Information Processing Letters 93(2005), p.83.
-      78             :     All points are expected to be passed as unit vectors.
-      79             :     The enclosing cone must have an opening angle <pi/2. */
-      80             : void find_enclosing_circle (const arr<vec3> &point, vec3 &center,
-      81             :   double &cosrad);
-      82             : 
-      83             : } // namespace healpix
-      84             : #endif
-      85             : 
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/healpix_base.h.func-sort-c.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/healpix_base.h.func-sort-c.html deleted file mode 100644 index c2ac9dce4..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/healpix_base.h.func-sort-c.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/healpix_base.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - healpix_base.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:165032.0 %
Date:2024-04-08 14:58:22Functions:3348.8 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix14T_Healpix_BaseIiEC2EiNS_23Healpix_Ordering_SchemeE0
_ZN7healpix14T_Healpix_BaseIiEC2EiNS_23Healpix_Ordering_SchemeENS_11nside_dummyE0
_ZN7healpix14T_Healpix_BaseIlEC2EiNS_23Healpix_Ordering_SchemeE0
_ZN7healpix14T_Healpix_BaseIlEC2ElNS_23Healpix_Ordering_SchemeENS_11nside_dummyE0
_ZNK7healpix14T_Healpix_BaseIiE10query_discERKNS_8pointingEdRSt6vectorIiSaIiEE0
_ZNK7healpix14T_Healpix_BaseIiE11conformableERKS1_0
_ZNK7healpix14T_Healpix_BaseIiE20query_disc_inclusiveERKNS_8pointingEdRSt6vectorIiSaIiEEi0
_ZNK7healpix14T_Healpix_BaseIiE4NpixEv0
_ZNK7healpix14T_Healpix_BaseIiE5NsideEv0
_ZNK7healpix14T_Healpix_BaseIiE5OrderEv0
_ZNK7healpix14T_Healpix_BaseIiE6SchemeEv0
_ZNK7healpix14T_Healpix_BaseIiE7ang2pixERKNS_8pointingE0
_ZNK7healpix14T_Healpix_BaseIiE7pix2angEi0
_ZNK7healpix14T_Healpix_BaseIiE7pix2xyfEiRiS2_S2_0
_ZNK7healpix14T_Healpix_BaseIiE7xyf2pixEiii0
_ZNK7healpix14T_Healpix_BaseIiE8pix2zphiEiRdS2_0
_ZNK7healpix14T_Healpix_BaseIiE8zphi2pixEdd0
_ZNK7healpix14T_Healpix_BaseIlE10query_discERKNS_8pointingEdRSt6vectorIlSaIlEE0
_ZNK7healpix14T_Healpix_BaseIlE11conformableERKS1_0
_ZNK7healpix14T_Healpix_BaseIlE20query_disc_inclusiveERKNS_8pointingEdRSt6vectorIlSaIlEEi0
_ZNK7healpix14T_Healpix_BaseIlE4NpixEv0
_ZNK7healpix14T_Healpix_BaseIlE5NsideEv0
_ZNK7healpix14T_Healpix_BaseIlE5OrderEv0
_ZNK7healpix14T_Healpix_BaseIlE6SchemeEv0
_ZNK7healpix14T_Healpix_BaseIlE7ang2pixERKNS_8pointingE0
_ZNK7healpix14T_Healpix_BaseIlE7pix2angEl0
_ZNK7healpix14T_Healpix_BaseIlE7pix2xyfElRiS2_S2_0
_ZNK7healpix14T_Healpix_BaseIlE7vec2pixERKNS_6vec3_tIdEE0
_ZNK7healpix14T_Healpix_BaseIlE7xyf2pixEiii0
_ZNK7healpix14T_Healpix_BaseIlE8pix2zphiElRdS2_0
_ZNK7healpix14T_Healpix_BaseIlE8zphi2pixEdd0
_ZNK7healpix14T_Healpix_BaseIlE7pix2vecEl421
_ZNK7healpix14T_Healpix_BaseIiE7vec2pixERKNS_6vec3_tIdEE24585
_ZNK7healpix14T_Healpix_BaseIiE7pix2vecEi135172
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/healpix_base.h.func.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/healpix_base.h.func.html deleted file mode 100644 index b4d88f50c..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/healpix_base.h.func.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/healpix_base.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - healpix_base.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:165032.0 %
Date:2024-04-08 14:58:22Functions:3348.8 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix14T_Healpix_BaseIiEC2EiNS_23Healpix_Ordering_SchemeE0
_ZN7healpix14T_Healpix_BaseIiEC2EiNS_23Healpix_Ordering_SchemeENS_11nside_dummyE0
_ZN7healpix14T_Healpix_BaseIlEC2EiNS_23Healpix_Ordering_SchemeE0
_ZN7healpix14T_Healpix_BaseIlEC2ElNS_23Healpix_Ordering_SchemeENS_11nside_dummyE0
_ZNK7healpix14T_Healpix_BaseIiE10query_discERKNS_8pointingEdRSt6vectorIiSaIiEE0
_ZNK7healpix14T_Healpix_BaseIiE11conformableERKS1_0
_ZNK7healpix14T_Healpix_BaseIiE20query_disc_inclusiveERKNS_8pointingEdRSt6vectorIiSaIiEEi0
_ZNK7healpix14T_Healpix_BaseIiE4NpixEv0
_ZNK7healpix14T_Healpix_BaseIiE5NsideEv0
_ZNK7healpix14T_Healpix_BaseIiE5OrderEv0
_ZNK7healpix14T_Healpix_BaseIiE6SchemeEv0
_ZNK7healpix14T_Healpix_BaseIiE7ang2pixERKNS_8pointingE0
_ZNK7healpix14T_Healpix_BaseIiE7pix2angEi0
_ZNK7healpix14T_Healpix_BaseIiE7pix2vecEi135172
_ZNK7healpix14T_Healpix_BaseIiE7pix2xyfEiRiS2_S2_0
_ZNK7healpix14T_Healpix_BaseIiE7vec2pixERKNS_6vec3_tIdEE24585
_ZNK7healpix14T_Healpix_BaseIiE7xyf2pixEiii0
_ZNK7healpix14T_Healpix_BaseIiE8pix2zphiEiRdS2_0
_ZNK7healpix14T_Healpix_BaseIiE8zphi2pixEdd0
_ZNK7healpix14T_Healpix_BaseIlE10query_discERKNS_8pointingEdRSt6vectorIlSaIlEE0
_ZNK7healpix14T_Healpix_BaseIlE11conformableERKS1_0
_ZNK7healpix14T_Healpix_BaseIlE20query_disc_inclusiveERKNS_8pointingEdRSt6vectorIlSaIlEEi0
_ZNK7healpix14T_Healpix_BaseIlE4NpixEv0
_ZNK7healpix14T_Healpix_BaseIlE5NsideEv0
_ZNK7healpix14T_Healpix_BaseIlE5OrderEv0
_ZNK7healpix14T_Healpix_BaseIlE6SchemeEv0
_ZNK7healpix14T_Healpix_BaseIlE7ang2pixERKNS_8pointingE0
_ZNK7healpix14T_Healpix_BaseIlE7pix2angEl0
_ZNK7healpix14T_Healpix_BaseIlE7pix2vecEl421
_ZNK7healpix14T_Healpix_BaseIlE7pix2xyfElRiS2_S2_0
_ZNK7healpix14T_Healpix_BaseIlE7vec2pixERKNS_6vec3_tIdEE0
_ZNK7healpix14T_Healpix_BaseIlE7xyf2pixEiii0
_ZNK7healpix14T_Healpix_BaseIlE8pix2zphiElRdS2_0
_ZNK7healpix14T_Healpix_BaseIlE8zphi2pixEdd0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/healpix_base.h.gcov.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/healpix_base.h.gcov.html deleted file mode 100644 index c89cc2a4d..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/healpix_base.h.gcov.html +++ /dev/null @@ -1,457 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/healpix_base.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - healpix_base.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:165032.0 %
Date:2024-04-08 14:58:22Functions:3348.8 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : /*
-       2             :  *  This file is part of Healpix_cxx.
-       3             :  *
-       4             :  *  Healpix_cxx is free software; you can redistribute it and/or modify
-       5             :  *  it under the terms of the GNU General Public License as published by
-       6             :  *  the Free Software Foundation; either version 2 of the License, or
-       7             :  *  (at your option) any later version.
-       8             :  *
-       9             :  *  Healpix_cxx is distributed in the hope that it will be useful,
-      10             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-      11             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-      12             :  *  GNU General Public License for more details.
-      13             :  *
-      14             :  *  You should have received a copy of the GNU General Public License
-      15             :  *  along with Healpix_cxx; if not, write to the Free Software
-      16             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-      17             :  *
-      18             :  *  For more information about HEALPix, see http://healpix.sourceforge.net
-      19             :  */
-      20             : 
-      21             : /*
-      22             :  *  Healpix_cxx is being developed at the Max-Planck-Institut fuer Astrophysik
-      23             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
-      24             :  *  (DLR).
-      25             :  */
-      26             : 
-      27             : /*! \file healpix_base.h
-      28             :  *  Copyright (C) 2003-2012 Max-Planck-Society
-      29             :  *  \author Martin Reinecke
-      30             :  */
-      31             : 
-      32             : #ifndef HEALPIX_BASE_H
-      33             : #define HEALPIX_BASE_H
-      34             : 
-      35             : #include <vector>
-      36             : #include "healpix_base/healpix_tables.h"
-      37             : #include "healpix_base/pointing.h"
-      38             : #include "healpix_base/arr.h"
-      39             : #include "healpix_base/rangeset.h"
-      40             : 
-      41             : namespace healpix{
-      42             : 
-      43             : /*! Functionality related to the HEALPix pixelisation. */
-      44             : template<typename I> class T_Healpix_Base: public Healpix_Tables
-      45             :   {
-      46             :   protected:
-      47             :     /*! The order of the map; -1 for nonhierarchical map. */
-      48             :     int order_;
-      49             :     /*! The N_side parameter of the map; 0 if not allocated. */
-      50             :     I nside_;
-      51             :     I npface_, ncap_, npix_;
-      52             :     double fact1_, fact2_;
-      53             :     /*! The map's ordering scheme. */
-      54             :     Healpix_Ordering_Scheme scheme_;
-      55             : 
-      56             :     /*! Returns the number of the next ring to the north of \a z=cos(theta).
-      57             :         It may return 0; in this case \a z lies north of all rings. */
-      58             :     inline I ring_above (double z) const;
-      59             :     void in_ring (I iz, double phi0, double dphi, rangeset<I> &pixset) const;
-      60             : 
-      61             :     template<typename I2> void query_multidisc (const arr<vec3> &norm,
-      62             :       const arr<double> &rad, int fact, rangeset<I2> &pixset) const;
-      63             : 
-      64             :     void query_multidisc_general (const arr<vec3> &norm, const arr<double> &rad,
-      65             :       bool inclusive, const std::vector<int> &cmds, rangeset<I> &pixset) const;
-      66             : 
-      67             :     void query_strip_internal (double theta1, double theta2, bool inclusive,
-      68             :       rangeset<I> &pixset) const;
-      69             : 
-      70             :     inline I spread_bits (int v) const;
-      71             :     inline int compress_bits (I v) const;
-      72             : 
-      73             :     I xyf2nest(int ix, int iy, int face_num) const;
-      74             :     void nest2xyf(I pix, int &ix, int &iy, int &face_num) const;
-      75             :     I xyf2ring(int ix, int iy, int face_num) const;
-      76             :     void ring2xyf(I pix, int &ix, int &iy, int &face_num) const;
-      77             : 
-      78             :     I loc2pix (double z, double phi, double sth, bool have_sth) const;
-      79             :     void pix2loc (I pix, double &z, double &phi, double &sth, bool &have_sth)
-      80             :       const;
-      81             : 
-      82             :     void xyf2loc(double x, double y, int face, double &z, double &ph,
-      83             :       double &sth, bool &have_sth) const;
-      84             : 
-      85             :     I nest_peano_helper (I pix, int dir) const;
-      86             : 
-      87             :     typedef I (T_Healpix_Base::*swapfunc)(I pix) const;
-      88             : 
-      89             :   public:
-      90             :     static const int order_max;
-      91             : 
-      92             :     /*! Calculates the map order from its \a N_side parameter.
-      93             :         Returns -1 if \a nside is not a power of 2.
-      94             :         \param nside the \a N_side parameter */
-      95             :     static int nside2order (I nside);
-      96             :     /*! Calculates the \a N_side parameter from the number of pixels.
-      97             :         \param npix the number of pixels */
-      98             :     static I npix2nside (I npix);
-      99             :     /*! Constructs an unallocated object. */
-     100             :     T_Healpix_Base ();
-     101             :     /*! Constructs an object with a given \a order and the ordering
-     102             :         scheme \a scheme. */
-     103          10 :     T_Healpix_Base (int order, Healpix_Ordering_Scheme scheme)
-     104          10 :       { Set (order, scheme); }
-     105             :     /*! Constructs an object with a given \a nside and the ordering
-     106             :         scheme \a scheme. The \a nside_dummy parameter must be set to
-     107             :         SET_NSIDE. */
-     108           0 :     T_Healpix_Base (I nside, Healpix_Ordering_Scheme scheme, const nside_dummy)
-     109           0 :       { SetNside (nside, scheme); }
-     110             : 
-     111             :     /*! Adjusts the object to \a order and \a scheme. */
-     112             :     void Set (int order, Healpix_Ordering_Scheme scheme);
-     113             :     /*! Adjusts the object to \a nside and \a scheme. */
-     114             :     void SetNside (I nside, Healpix_Ordering_Scheme scheme);
-     115             : 
-     116             :     /*! Returns the z-coordinate of the ring \a ring. This also works
-     117             :         for the (not really existing) rings 0 and 4*nside. */
-     118             :     double ring2z (I ring) const;
-     119             :     /*! Returns the number of the ring in which \a pix lies. */
-     120             :     I pix2ring (I pix) const;
-     121             : 
-     122           0 :     I xyf2pix(int ix, int iy, int face_num) const
-     123             :       {
-     124           0 :       return (scheme_==RING) ?
-     125           0 :         xyf2ring(ix,iy,face_num) : xyf2nest(ix,iy,face_num);
-     126             :       }
-     127           0 :     void pix2xyf(I pix, int &ix, int &iy, int &face_num) const
-     128             :       {
-     129           0 :       (scheme_==RING) ?
-     130           0 :         ring2xyf(pix,ix,iy,face_num) : nest2xyf(pix,ix,iy,face_num);
-     131           0 :       }
-     132             : 
-     133             :     /*! Translates a pixel number from NEST to RING. */
-     134             :     I nest2ring (I pix) const;
-     135             :     /*! Translates a pixel number from RING to NEST. */
-     136             :     I ring2nest (I pix) const;
-     137             :     /*! Translates a pixel number from NEST to its Peano index. */
-     138             :     I nest2peano (I pix) const;
-     139             :     /*! Translates a pixel number from its Peano index to NEST. */
-     140             :     I peano2nest (I pix) const;
-     141             : 
-     142             :     /*! Returns the number of the pixel which contains the angular coordinates
-     143             :         (\a z:=cos(theta), \a phi).
-     144             :         \note This method is inaccurate near the poles at high resolutions. */
-     145           0 :     I zphi2pix (double z, double phi) const
-     146           0 :       { return loc2pix(z,phi,0.,false); }
-     147             : 
-     148             :     /*! Returns the number of the pixel which contains the angular coordinates
-     149             :         \a ang. */
-     150           0 :     I ang2pix (const pointing &ang) const
-     151             :       {
-     152             :       const double pi_=3.141592653589793238462643383279502884197;
-     153           0 :       planck_assert((ang.theta>=0)&&(ang.theta<=pi_),"invalid theta value");
-     154           0 :       return ((ang.theta<0.01) || (ang.theta > 3.14159-0.01)) ?
-     155           0 :         loc2pix(cos(ang.theta),ang.phi,sin(ang.theta),true) :
-     156           0 :         loc2pix(cos(ang.theta),ang.phi,0.,false);
-     157             :       }
-     158             :     /*! Returns the number of the pixel which contains the vector \a vec
-     159             :         (\a vec is normalized if necessary). */
-     160       24585 :     I vec2pix (const vec3 &vec) const
-     161             :       {
-     162       24585 :       double xl = 1./vec.Length();
-     163             :       double phi = safe_atan2(vec.y,vec.x);
-     164       24585 :       double nz = vec.z*xl;
-     165       24585 :       if (std::abs(nz)>0.99)
-     166         241 :         return loc2pix (nz,phi,sqrt(vec.x*vec.x+vec.y*vec.y)*xl,true);
-     167             :       else
-     168       24344 :         return loc2pix (nz,phi,0,false);
-     169             :       }
-     170             : 
-     171             :     /*! Returns the angular coordinates (\a z:=cos(theta), \a phi) of the center
-     172             :         of the pixel with number \a pix.
-     173             :         \note This method is inaccurate near the poles at high resolutions. */
-     174           0 :     void pix2zphi (I pix, double &z, double &phi) const
-     175             :       {
-     176             :       bool dum_b;
-     177             :       double dum_d;
-     178           0 :       pix2loc(pix,z,phi,dum_d,dum_b);
-     179           0 :       }
-     180             : 
-     181             :     /*! Returns the angular coordinates of the center of the pixel with
-     182             :         number \a pix. */
-     183           0 :     pointing pix2ang (I pix) const
-     184             :       {
-     185             :       double z, phi, sth;
-     186             :       bool have_sth;
-     187           0 :       pix2loc (pix,z,phi,sth,have_sth);
-     188           0 :       return have_sth ? pointing(atan2(sth,z),phi) : pointing(acos(z),phi);
-     189             :       }
-     190             :     /*! Returns the vector to the center of the pixel with number \a pix. */
-     191      135593 :     vec3 pix2vec (I pix) const
-     192             :       {
-     193             :       double z, phi, sth;
-     194             :       bool have_sth;
-     195      135593 :       pix2loc (pix,z,phi,sth,have_sth);
-     196      135593 :       if (have_sth)
-     197        1417 :         return vec3(sth*cos(phi),sth*sin(phi),z);
-     198             :       else
-     199             :         {
-     200             :         vec3 res;
-     201      134176 :         res.set_z_phi (z, phi);
-     202      134176 :         return res;
-     203             :         }
-     204             :       }
-     205             : 
-     206             :     template<typename I2> void query_disc_internal (pointing ptg, double radius,
-     207             :       int fact, rangeset<I2> &pixset) const;
-     208             : 
-     209             :     /*! Returns the range set of all pixels whose centers lie within the disk
-     210             :         defined by \a dir and \a radius.
-     211             :         \param dir the angular coordinates of the disk center
-     212             :         \param radius the radius (in radians) of the disk
-     213             :         \param pixset a \a rangeset object containing the indices of all pixels
-     214             :            whose centers lie inside the disk
-     215             :         \note This method is more efficient in the RING scheme. */
-     216             :     void query_disc (pointing ptg, double radius, rangeset<I> &pixset) const;
-     217             :     /*! Returns the range set of all pixels which overlap with the disk
-     218             :         defined by \a dir and \a radius.
-     219             :         \param dir the angular coordinates of the disk center
-     220             :         \param radius the radius (in radians) of the disk
-     221             :         \param pixset a \a rangeset object containing the indices of all pixels
-     222             :            overlapping with the disk.
-     223             :         \param fact The overlapping test will be done at the resolution
-     224             :            \a fact*nside. For NESTED ordering, \a fact must be a power of 2,
-     225             :            else it can be any positive integer. A typical choice would be 4.
-     226             :         \note This method may return some pixels which don't overlap with
-     227             :            the disk at all. The higher \a fact is chosen, the fewer false
-     228             :            positives are returned, at the cost of increased run time.
-     229             :         \note This method is more efficient in the RING scheme. */
-     230             :     void query_disc_inclusive (pointing ptg, double radius, rangeset<I> &pixset,
-     231             :       int fact=1) const;
-     232             : 
-     233             :     /*! \deprecated Please use the version based on \a rangeset */
-     234           0 :     void query_disc (const pointing &dir, double radius,
-     235             :       std::vector<I> &listpix) const
-     236             :       {
-     237             :       rangeset<I> pixset;
-     238           0 :       query_disc(dir,radius,pixset);
-     239           0 :       pixset.toVector(listpix);
-     240           0 :       }
-     241             :     /*! \deprecated Please use the version based on \a rangeset */
-     242           0 :     void query_disc_inclusive (const pointing &dir, double radius,
-     243             :       std::vector<I> &listpix, int fact=1) const
-     244             :       {
-     245             :       rangeset<I> pixset;
-     246           0 :       query_disc_inclusive(dir,radius,pixset,fact);
-     247           0 :       pixset.toVector(listpix);
-     248           0 :       }
-     249             : 
-     250             :     template<typename I2> void query_polygon_internal
-     251             :       (const std::vector<pointing> &vertex, int fact,
-     252             :       rangeset<I2> &pixset) const;
-     253             : 
-     254             :     /*! Returns a range set of pixels whose centers lie within the convex
-     255             :         polygon defined by the \a vertex array.
-     256             :         \param vertex array containing the vertices of the polygon.
-     257             :         \param pixset a \a rangeset object containing the indices of all pixels
-     258             :            whose centers lie inside the polygon
-     259             :         \note This method is more efficient in the RING scheme. */
-     260             :     void query_polygon (const std::vector<pointing> &vertex,
-     261             :       rangeset<I> &pixset) const;
-     262             : 
-     263             :     /*! Returns a range set of pixels which overlap with the convex
-     264             :         polygon defined by the \a vertex array.
-     265             :         \param vertex array containing the vertices of the polygon.
-     266             :         \param pixset a \a rangeset object containing the indices of all pixels
-     267             :            overlapping with the polygon.
-     268             :         \param fact The overlapping test will be done at the resolution
-     269             :            \a fact*nside. For NESTED ordering, \a fact must be a power of 2,
-     270             :            else it can be any positive integer. A typical choice would be 4.
-     271             :         \note This method may return some pixels which don't overlap with
-     272             :            the polygon at all. The higher \a fact is chosen, the fewer false
-     273             :            positives are returned, at the cost of increased run time.
-     274             :         \note This method is more efficient in the RING scheme. */
-     275             :     void query_polygon_inclusive (const std::vector<pointing> &vertex,
-     276             :       rangeset<I> &pixset, int fact=1) const;
-     277             : 
-     278             :     /*! Returns a range set of pixels whose centers lie within the colatitude
-     279             :         range defined by \a theta1 and \a theta2 (if \a inclusive==false), or
-     280             :         which overlap with this region (if \a inclusive==true). If
-     281             :         \a theta1<theta2, the region between both angles is considered,
-     282             :         otherwise the regions \a 0<theta<theta2 and \a theta1<theta<pi.
-     283             :         \param theta1 first colatitude
-     284             :         \param theta2 second colatitude
-     285             :         \param inclusive if \a false, return the exact set of pixels whose
-     286             :            pixels centers lie within the region; if \a true, return all pixels
-     287             :            that overlap with the region. */
-     288             :     void query_strip (double theta1, double theta2, bool inclusive,
-     289             :       rangeset<I> &pixset) const;
-     290             : 
-     291             :     /*! Returns useful information about a given ring of the map.
-     292             :         \param ring the ring number (the number of the first ring is 1)
-     293             :         \param startpix the number of the first pixel in the ring
-     294             :                (NOTE: this is always given in the RING numbering scheme!)
-     295             :         \param ringpix the number of pixels in the ring
-     296             :         \param costheta the cosine of the colatitude of the ring
-     297             :         \param sintheta the sine of the colatitude of the ring
-     298             :         \param shifted if \a true, the center of the first pixel is not at
-     299             :                \a phi=0 */
-     300             :     void get_ring_info (I ring, I &startpix, I &ringpix,
-     301             :       double &costheta, double &sintheta, bool &shifted) const;
-     302             :     /*! Returns useful information about a given ring of the map.
-     303             :         \param ring the ring number (the number of the first ring is 1)
-     304             :         \param startpix the number of the first pixel in the ring
-     305             :                (NOTE: this is always given in the RING numbering scheme!)
-     306             :         \param ringpix the number of pixels in the ring
-     307             :         \param theta the colatitude (in radians) of the ring
-     308             :         \param shifted if \a true, the center of the first pixel is not at
-     309             :                \a phi=0 */
-     310             :     void get_ring_info2 (I ring, I &startpix, I &ringpix,
-     311             :       double &theta, bool &shifted) const;
-     312             :     /*! Returns useful information about a given ring of the map.
-     313             :         \param ring the ring number (the number of the first ring is 1)
-     314             :         \param startpix the number of the first pixel in the ring
-     315             :                (NOTE: this is always given in the RING numbering scheme!)
-     316             :         \param ringpix the number of pixels in the ring
-     317             :         \param shifted if \a true, the center of the first pixel is not at
-     318             :                \a phi=0 */
-     319             :     void get_ring_info_small (I ring, I &startpix, I &ringpix,
-     320             :         bool &shifted) const;
-     321             :     /*! Returns the neighboring pixels of \a pix in \a result.
-     322             :         On exit, \a result contains (in this order)
-     323             :         the pixel numbers of the SW, W, NW, N, NE, E, SE and S neighbor
-     324             :         of \a pix. If a neighbor does not exist (this can only be the case
-     325             :         for the W, N, E and S neighbors), its entry is set to -1.
-     326             : 
-     327             :         \note This method works in both RING and NEST schemes, but is
-     328             :           considerably faster in the NEST scheme. */
-     329             :     void neighbors (I pix, fix_arr<I,8> &result) const;
-     330             :     /*! Returns interpolation information for the direction \a ptg.
-     331             :         The surrounding pixels are returned in \a pix, their corresponding
-     332             :         weights in \a wgt.
-     333             :         \note This method works in both RING and NEST schemes, but is
-     334             :           considerably faster in the RING scheme. */
-     335             :     void get_interpol (const pointing &ptg, fix_arr<I,4> &pix,
-     336             :                        fix_arr<double,4> &wgt) const;
-     337             : 
-     338             :     /*! Returns the order parameter of the object. */
-     339         421 :     int Order() const { return order_; }
-     340             :     /*! Returns the \a N_side parameter of the object. */
-     341           0 :     I Nside() const { return nside_; }
-     342             :     /*! Returns the number of pixels of the object. */
-     343    10403763 :     I Npix() const { return npix_; }
-     344             :     /*! Returns the ordering scheme of the object. */
-     345           0 :     Healpix_Ordering_Scheme Scheme() const { return scheme_; }
-     346             : 
-     347             :     /*! Returns \a true, if both objects have the same nside and scheme,
-     348             :         else \a false. */
-     349           0 :     bool conformable (const T_Healpix_Base &other) const
-     350           0 :       { return ((nside_==other.nside_) && (scheme_==other.scheme_)); }
-     351             : 
-     352             :     /*! Swaps the contents of two Healpix_Base objects. */
-     353             :     void swap (T_Healpix_Base &other);
-     354             : 
-     355             :     /*! Returns the maximum angular distance (in radian) between any pixel
-     356             :         center and its corners. */
-     357             :     double max_pixrad() const;
-     358             : 
-     359             :     /*! Returns the maximum angular distance (in radian) between any pixel
-     360             :         center and its corners in a given ring. */
-     361             :     double max_pixrad(I ring) const;
-     362             : 
-     363             :     /*! Returns a set of points along the boundary of the given pixel.
-     364             :         \a step=1 gives 4 points on the corners. The first point corresponds
-     365             :         to the northernmost corner, the subsequent points follow the pixel
-     366             :         boundary through west, south and east corners.
-     367             :         \param pix pixel index number
-     368             :         \param step the number of returned points is 4*step. */
-     369             :     void boundaries (I pix, tsize step, std::vector<vec3> &out) const;
-     370             : 
-     371             :     arr<int> swap_cycles() const;
-     372             :   };
-     373             : 
-     374             : /*! T_Healpix_Base for Nside up to 2^13. */
-     375             : typedef T_Healpix_Base<int> Healpix_Base;
-     376             : /*! T_Healpix_Base for Nside up to 2^29. */
-     377             : typedef T_Healpix_Base<int64> Healpix_Base2;
-     378             : 
-     379             : } // namespace healpix
-     380             : #endif
-     381             : 
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/index-sort-f.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/index-sort-f.html deleted file mode 100644 index 0195d8cd1..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/index-sort-f.html +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_baseHitTotalCoverage
Test:coverage.info.cleanedLines:3317319.1 %
Date:2024-04-08 14:58:22Functions:5628.1 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
error_handling.h -
0.0%
-
0.0 %0 / 20.0 %0 / 1
arr.h -
0.0%
-
0.0 %0 / 150.0 %0 / 1
geom_utils.h -
0.0%
-
0.0 %0 / 40.0 %0 / 2
alloc_utils.h -
0.0%
-
0.0 %0 / 20.0 %0 / 6
rangeset.h -
0.0%
-
0.0 %0 / 510.0 %0 / 12
healpix_base.h -
32.0%32.0%
-
32.0 %16 / 508.8 %3 / 34
math_utils.h -
30.4%30.4%
-
30.4 %7 / 2325.0 %1 / 4
vec3.h -
45.5%45.5%
-
45.5 %10 / 2250.0 %1 / 2
pointing.h -
0.0%
-
0.0 %0 / 4-0 / 0
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/index-sort-l.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/index-sort-l.html deleted file mode 100644 index 19da9ac89..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/index-sort-l.html +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_baseHitTotalCoverage
Test:coverage.info.cleanedLines:3317319.1 %
Date:2024-04-08 14:58:22Functions:5628.1 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
error_handling.h -
0.0%
-
0.0 %0 / 20.0 %0 / 1
alloc_utils.h -
0.0%
-
0.0 %0 / 20.0 %0 / 6
geom_utils.h -
0.0%
-
0.0 %0 / 40.0 %0 / 2
pointing.h -
0.0%
-
0.0 %0 / 4-0 / 0
arr.h -
0.0%
-
0.0 %0 / 150.0 %0 / 1
rangeset.h -
0.0%
-
0.0 %0 / 510.0 %0 / 12
math_utils.h -
30.4%30.4%
-
30.4 %7 / 2325.0 %1 / 4
healpix_base.h -
32.0%32.0%
-
32.0 %16 / 508.8 %3 / 34
vec3.h -
45.5%45.5%
-
45.5 %10 / 2250.0 %1 / 2
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/index.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/index.html deleted file mode 100644 index ce3223c46..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/index.html +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_baseHitTotalCoverage
Test:coverage.info.cleanedLines:3317319.1 %
Date:2024-04-08 14:58:22Functions:5628.1 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
alloc_utils.h -
0.0%
-
0.0 %0 / 20.0 %0 / 6
arr.h -
0.0%
-
0.0 %0 / 150.0 %0 / 1
error_handling.h -
0.0%
-
0.0 %0 / 20.0 %0 / 1
geom_utils.h -
0.0%
-
0.0 %0 / 40.0 %0 / 2
healpix_base.h -
32.0%32.0%
-
32.0 %16 / 508.8 %3 / 34
math_utils.h -
30.4%30.4%
-
30.4 %7 / 2325.0 %1 / 4
pointing.h -
0.0%
-
0.0 %0 / 4-0 / 0
rangeset.h -
0.0%
-
0.0 %0 / 510.0 %0 / 12
vec3.h -
45.5%45.5%
-
45.5 %10 / 2250.0 %1 / 2
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/math_utils.h.func-sort-c.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/math_utils.h.func-sort-c.html deleted file mode 100644 index 822b61bad..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/math_utils.h.func-sort-c.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/math_utils.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - math_utils.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:72330.4 %
Date:2024-04-08 14:58:22Functions:1425.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix14isqrt_helper__IlLb1EE5isqrtEl0
_ZN7healpix5ilog2IiEEiT_0
_ZN7healpix5ilog2IlEEiT_0
_ZN7healpix7fmoduloEdd24585
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/math_utils.h.func.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/math_utils.h.func.html deleted file mode 100644 index 0fdeff09e..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/math_utils.h.func.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/math_utils.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - math_utils.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:72330.4 %
Date:2024-04-08 14:58:22Functions:1425.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix14isqrt_helper__IlLb1EE5isqrtEl0
_ZN7healpix5ilog2IiEEiT_0
_ZN7healpix5ilog2IlEEiT_0
_ZN7healpix7fmoduloEdd24585
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/math_utils.h.gcov.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/math_utils.h.gcov.html deleted file mode 100644 index badf8789f..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/math_utils.h.gcov.html +++ /dev/null @@ -1,259 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/math_utils.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - math_utils.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:72330.4 %
Date:2024-04-08 14:58:22Functions:1425.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : /*
-       2             :  *  This file is part of libcxxsupport.
-       3             :  *
-       4             :  *  libcxxsupport is free software; you can redistribute it and/or modify
-       5             :  *  it under the terms of the GNU General Public License as published by
-       6             :  *  the Free Software Foundation; either version 2 of the License, or
-       7             :  *  (at your option) any later version.
-       8             :  *
-       9             :  *  libcxxsupport is distributed in the hope that it will be useful,
-      10             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-      11             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-      12             :  *  GNU General Public License for more details.
-      13             :  *
-      14             :  *  You should have received a copy of the GNU General Public License
-      15             :  *  along with libcxxsupport; if not, write to the Free Software
-      16             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-      17             :  */
-      18             : 
-      19             : /*
-      20             :  *  libcxxsupport is being developed at the Max-Planck-Institut fuer Astrophysik
-      21             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
-      22             :  *  (DLR).
-      23             :  */
-      24             : 
-      25             : /*! \file math_utils.h
-      26             :  *  Various convenience mathematical functions.
-      27             :  *
-      28             :  *  Copyright (C) 2002-2012 Max-Planck-Society
-      29             :  *  \author Martin Reinecke
-      30             :  */
-      31             : 
-      32             : #ifndef PLANCK_MATH_UTILS_H
-      33             : #define PLANCK_MATH_UTILS_H
-      34             : 
-      35             : #include <cmath>
-      36             : #include <algorithm>
-      37             : #include "healpix_base/datatypes.h"
-      38             : 
-      39             : namespace healpix{
-      40             : 
-      41             : /*! \defgroup mathutilsgroup Mathematical helper functions */
-      42             : /*! \{ */
-      43             : 
-      44             : /*! Returns \e true if | \a a-b | <= \a epsilon * | \a b |, else \e false. */
-      45             : template<typename F> inline bool approx (F a, F b, F epsilon=1e-5)
-      46             :   {
-      47             :   using namespace std;
-      48             :   return abs(a-b) <= (epsilon*abs(b));
-      49             :   }
-      50             : 
-      51             : /*! Returns \e true if | \a a-b | <= \a epsilon, else \e false. */
-      52             : template<typename F> inline bool abs_approx (F a, F b, F epsilon=1e-5)
-      53             :   {
-      54             :   using namespace std;
-      55             :   return abs(a-b) <= epsilon;
-      56             :   }
-      57             : 
-      58             : /*! Returns the largest integer which is smaller than (or equal to) \a arg. */
-      59             : template<typename I, typename F> inline I ifloor (F arg)
-      60             :   {
-      61             :   using namespace std;
-      62           0 :   return I(floor(arg));
-      63             :   }
-      64             : 
-      65             : /*! Returns the integer which is nearest to \a arg. */
-      66             : template<typename I, typename F> inline I nearest (F arg)
-      67             :   { return ifloor<I>(arg+0.5); }
-      68             : 
-      69             : /*! Returns the remainder of the division \a v1/v2.
-      70             :     The result is non-negative.
-      71             :     \a v1 can be positive or negative; \a v2 must be positive. */
-      72       24585 : inline double fmodulo (double v1, double v2)
-      73             :   {
-      74             :   using namespace std;
-      75       24585 :   if (v1>=0)
-      76       12356 :     return (v1<v2) ? v1 : fmod(v1,v2);
-      77       12229 :   double tmp=fmod(v1,v2)+v2;
-      78       12229 :   return (tmp==v2) ? 0. : tmp;
-      79             : //  return (v1>=0) ? ((v1<v2) ? v1 : fmod(v1,v2)) : (fmod(v1,v2)+v2);
-      80             :   }
-      81             : 
-      82             : /*! Returns the remainder of the division \a v1/v2.
-      83             :     The result is non-negative.
-      84             :     \a v1 can be positive or negative; \a v2 must be positive. */
-      85             : template<typename I> inline I imodulo (I v1, I v2)
-      86             :   { I v=v1%v2; return (v>=0) ? v : v+v2; }
-      87             : 
-      88             : /*! Returns -1 if \a signvalue is negative, else +1. */
-      89             : template<typename T> inline T sign (const T& signvalue)
-      90             :   { return (signvalue>=0) ? 1 : -1; }
-      91             : 
-      92             : /*! Returns \a val*pow(-1,m) */
-      93             : template<typename T, typename I> inline T xpow (I m, T val)
-      94             :   { return (m&1) ? -val : val; }
-      95             : 
-      96             : template<typename I, bool g4> struct isqrt_helper__
-      97             :   {};
-      98             : template<typename I> struct isqrt_helper__ <I, false>
-      99             :   {
-     100             :   static uint32 isqrt (I arg)
-     101             :     {
-     102             :     using namespace std;
-     103       44162 :     return uint32 (sqrt(arg+0.5));
-     104             :     }
-     105             :   };
-     106             : template<typename I> struct isqrt_helper__ <I, true>
-     107             :   {
-     108           0 :   static uint32 isqrt (I arg)
-     109             :     {
-     110             :     using namespace std;
-     111           0 :     I res = sqrt(double(arg)+0.5);
-     112           0 :     if (arg<(int64(1)<<50)) return uint32(res);
-     113           0 :     if (res*res>arg)
-     114           0 :       --res;
-     115           0 :     else if ((res+1)*(res+1)<=arg)
-     116             :       ++res;
-     117           0 :     return uint32(res);
-     118             :     }
-     119             :   };
-     120             : 
-     121             : /*! Returns the integer \a n, which fulfills \a n*n<=arg<(n+1)*(n+1). */
-     122             : template<typename I> inline uint32 isqrt (I arg)
-     123           0 :   { return isqrt_helper__<I,(sizeof(I)>4)>::isqrt(arg); }
-     124             : 
-     125             : /*! Returns the largest integer \a n that fulfills \a 2^n<=arg. */
-     126           0 : template<typename I> inline int ilog2 (I arg)
-     127             :   {
-     128             :   int res=0;
-     129           0 :   while (arg > 0x0000FFFF) { res+=16; arg>>=16; }
-     130           0 :   if (arg > 0x000000FF) { res|=8; arg>>=8; }
-     131           0 :   if (arg > 0x0000000F) { res|=4; arg>>=4; }
-     132           0 :   if (arg > 0x00000003) { res|=2; arg>>=2; }
-     133           0 :   if (arg > 0x00000001) { res|=1; }
-     134           0 :   return res;
-     135             :   }
-     136             : 
-     137             : /*! Returns \a atan2(y,x) if \a x!=0 or \a y!=0; else returns 0. */
-     138             : inline double safe_atan2 (double y, double x)
-     139             :   {
-     140             :   using namespace std;
-     141       61874 :   return ((x==0.) && (y==0.)) ? 0.0 : atan2(y,x);
-     142             :   }
-     143             : 
-     144             : /*! Helper function for linear interpolation (or extrapolation).
-     145             :     The array must be ordered in ascending order; no two values may be equal. */
-     146             : template<typename T, typename Iter, typename Comp> inline void interpol_helper
-     147             :   (const Iter &begin, const Iter &end, const T &val, Comp comp, tsize &idx,
-     148             :   T &frac)
-     149             :   {
-     150             :   using namespace std;
-     151             :   planck_assert((end-begin)>1,"sequence too small for interpolation");
-     152             :   idx = lower_bound(begin,end,val,comp)-begin;
-     153             :   if (idx>0) --idx;
-     154             :   idx = min(tsize(end-begin-2),idx);
-     155             :   frac = (val-begin[idx])/(begin[idx+1]-begin[idx]);
-     156             :   }
-     157             : 
-     158             : /*! Helper function for linear interpolation (or extrapolation).
-     159             :     The array must be ordered in ascending order; no two values may be equal. */
-     160             : template<typename T, typename Iter> inline void interpol_helper
-     161             :   (const Iter &begin, const Iter &end, const T &val, tsize &idx, T &frac)
-     162             :   { interpol_helper (begin,end,val,std::less<T>(),idx,frac); }
-     163             : 
-     164             : /*! \} */
-     165             : 
-     166             : template<typename T> inline bool multiequal (const T &a, const T &b, const T &c)
-     167             :   { return (a==b) && (a==c); }
-     168             : 
-     169             : template<typename T> inline bool multiequal (const T &a, const T &b, const T &c,
-     170             :   const T &d)
-     171             :   { return (a==b) && (a==c) && (a==d); }
-     172             : 
-     173             : template<typename T> inline bool multiequal (const T &a, const T &b, const T &c,
-     174             :   const T &d, const T &e)
-     175             :   { return (a==b) && (a==c) && (a==d) && (a==e); }
-     176             : 
-     177             : template<typename T> inline bool multiequal (const T &a, const T &b, const T &c,
-     178             :   const T &d, const T &e, const T &f)
-     179             :   { return (a==b) && (a==c) && (a==d) && (a==e) && (a==f); }
-     180             : 
-     181             : } // namespace healpix
-     182             : #endif
-     183             : 
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/pointing.h.func-sort-c.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/pointing.h.func-sort-c.html deleted file mode 100644 index bd57abfaa..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/pointing.h.func-sort-c.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/pointing.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - pointing.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:040.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/pointing.h.func.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/pointing.h.func.html deleted file mode 100644 index 1bde73dd1..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/pointing.h.func.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/pointing.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - pointing.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:040.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- -
- - - - - - -

Function Name Sort by function nameHit count Sort by hit count
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/pointing.h.gcov.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/pointing.h.gcov.html deleted file mode 100644 index 59e765ab6..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/pointing.h.gcov.html +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/pointing.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - pointing.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:040.0 %
Date:2024-04-08 14:58:22Functions:00-
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : /*
-       2             :  *  This file is part of libcxxsupport.
-       3             :  *
-       4             :  *  libcxxsupport is free software; you can redistribute it and/or modify
-       5             :  *  it under the terms of the GNU General Public License as published by
-       6             :  *  the Free Software Foundation; either version 2 of the License, or
-       7             :  *  (at your option) any later version.
-       8             :  *
-       9             :  *  libcxxsupport is distributed in the hope that it will be useful,
-      10             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-      11             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-      12             :  *  GNU General Public License for more details.
-      13             :  *
-      14             :  *  You should have received a copy of the GNU General Public License
-      15             :  *  along with libcxxsupport; if not, write to the Free Software
-      16             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-      17             :  */
-      18             : 
-      19             : /*
-      20             :  *  libcxxsupport is being developed at the Max-Planck-Institut fuer Astrophysik
-      21             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
-      22             :  *  (DLR).
-      23             :  */
-      24             : 
-      25             : /*! \file pointing.h
-      26             :  *  Class representing a direction in 3D space
-      27             :  *
-      28             :  *  Copyright (C) 2003-2012 Max-Planck-Society
-      29             :  *  \author Martin Reinecke
-      30             :  */
-      31             : 
-      32             : #ifndef PLANCK_POINTING_H
-      33             : #define PLANCK_POINTING_H
-      34             : 
-      35             : #include <cmath>
-      36             : #include "healpix_base/vec3.h"
-      37             : 
-      38             : namespace healpix{
-      39             : 
-      40             : /*! \defgroup pointinggroup Pointings */
-      41             : /*! \{ */
-      42             : 
-      43             : /*! Class representing a direction in 3D space or a location on the
-      44             :     unit sphere. All angles in radians. */
-      45             : class pointing
-      46             :   {
-      47             :   public:
-      48             :     /*! Colatitude of the pointing (i.e. the North pole is at \a theta=0). */
-      49             :     double theta;
-      50             :     /*! Longitude of the pointing. */
-      51             :     double phi;
-      52             : 
-      53             :     /*! Default constructor. \a theta and \a phi are not initialized. */
-      54           0 :     pointing() {}
-      55             :     /*! Creates a pointing with \a Theta and \a Phi. */
-      56           0 :     pointing (double Theta, double Phi) : theta(Theta), phi(Phi) {}
-      57             : 
-      58             : // FIXME: should become "explicit" some time
-      59             :     /*! Creates a pointing from the vector \a inp. \a inp need not be
-      60             :         normalized. */
-      61             :     pointing (const vec3 &inp)
-      62           0 :       { from_vec3(inp); }
-      63             : // FIXME: should be removed some time
-      64             :     /*! Returns a normalized vector pointing in the same direction. */
-      65             :     operator vec3() const
-      66           0 :       { return to_vec3(); }
-      67             :     /*! Returns a normalized vector pointing in the same direction. */
-      68             :     vec3 to_vec3() const;
-      69             :     /*! Converts \a inp to \a ptg. \a inp need not be normalized. */
-      70             :     void from_vec3 (const vec3 &inp);
-      71             :     /*! Changes the angles so that \a 0<=theta<=pi. */
-      72             :     void normalize_theta();
-      73             :     /*! Changes the angles so that \a 0<=theta<=pi and \a 0<=phi<2*pi. */
-      74             :     void normalize();
-      75             :   };
-      76             : 
-      77             : /*! Writes \a p to \a os.
-      78             :     \relates pointing */
-      79             : std::ostream &operator<< (std::ostream &os, const pointing &p);
-      80             : 
-      81             : /*! \} */
-      82             : 
-      83             : } // namespace healpix
-      84             : #endif
-      85             : 
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/rangeset.h.func-sort-c.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/rangeset.h.func-sort-c.html deleted file mode 100644 index 9daab7962..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/rangeset.h.func-sort-c.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/rangeset.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - rangeset.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0510.0 %
Date:2024-04-08 14:58:22Functions:0120.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix8rangesetIiE6appendERKS1_0
_ZN7healpix8rangesetIiE6appendERKiS3_0
_ZN7healpix8rangesetIiE9addRemoveEiil0
_ZN7healpix8rangesetIiE9intersectERKiS3_0
_ZN7healpix8rangesetIlE6appendERKS1_0
_ZN7healpix8rangesetIlE6appendERKlS3_0
_ZN7healpix8rangesetIlE9addRemoveElll0
_ZN7healpix8rangesetIlE9intersectERKlS3_0
_ZNK7healpix8rangesetIiE3iivERKi0
_ZNK7healpix8rangesetIiE8toVectorERSt6vectorIiSaIiEE0
_ZNK7healpix8rangesetIlE3iivERKl0
_ZNK7healpix8rangesetIlE8toVectorERSt6vectorIlSaIlEE0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/rangeset.h.func.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/rangeset.h.func.html deleted file mode 100644 index 8a90294c3..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/rangeset.h.func.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/rangeset.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - rangeset.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0510.0 %
Date:2024-04-08 14:58:22Functions:0120.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix8rangesetIiE6appendERKS1_0
_ZN7healpix8rangesetIiE6appendERKiS3_0
_ZN7healpix8rangesetIiE9addRemoveEiil0
_ZN7healpix8rangesetIiE9intersectERKiS3_0
_ZN7healpix8rangesetIlE6appendERKS1_0
_ZN7healpix8rangesetIlE6appendERKlS3_0
_ZN7healpix8rangesetIlE9addRemoveElll0
_ZN7healpix8rangesetIlE9intersectERKlS3_0
_ZNK7healpix8rangesetIiE3iivERKi0
_ZNK7healpix8rangesetIiE8toVectorERSt6vectorIiSaIiEE0
_ZNK7healpix8rangesetIlE3iivERKl0
_ZNK7healpix8rangesetIlE8toVectorERSt6vectorIlSaIlEE0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/rangeset.h.gcov.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/rangeset.h.gcov.html deleted file mode 100644 index 177519f90..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/rangeset.h.gcov.html +++ /dev/null @@ -1,363 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/rangeset.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - rangeset.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0510.0 %
Date:2024-04-08 14:58:22Functions:0120.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : /*
-       2             :  *  This file is part of libcxxsupport.
-       3             :  *
-       4             :  *  libcxxsupport is free software; you can redistribute it and/or modify
-       5             :  *  it under the terms of the GNU General Public License as published by
-       6             :  *  the Free Software Foundation; either version 2 of the License, or
-       7             :  *  (at your option) any later version.
-       8             :  *
-       9             :  *  libcxxsupport is distributed in the hope that it will be useful,
-      10             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-      11             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-      12             :  *  GNU General Public License for more details.
-      13             :  *
-      14             :  *  You should have received a copy of the GNU General Public License
-      15             :  *  along with libcxxsupport; if not, write to the Free Software
-      16             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-      17             :  */
-      18             : 
-      19             : /*
-      20             :  *  libcxxsupport is being developed at the Max-Planck-Institut fuer Astrophysik
-      21             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
-      22             :  *  (DLR).
-      23             :  */
-      24             : 
-      25             : /*! \file rangeset.h
-      26             :  *  Class for storing sets of ranges of integer numbers
-      27             :  *
-      28             :  *  Copyright (C) 2011, 2012 Max-Planck-Society
-      29             :  *  \author Martin Reinecke
-      30             :  */
-      31             : 
-      32             : #ifndef PLANCK_RANGESET_H
-      33             : #define PLANCK_RANGESET_H
-      34             : 
-      35             : #include <algorithm>
-      36             : #include <vector>
-      37             : #include <utility>
-      38             : #include <iostream>
-      39             : #include "healpix_base/datatypes.h"
-      40             : #include "healpix_base/error_handling.h"
-      41             : 
-      42             : namespace healpix{
-      43             : 
-      44             : /*! Class for storing sets of ranges of integer numbers */
-      45           0 : template<typename T> class rangeset
-      46             :   {
-      47             :   private:
-      48             :     typedef std::vector<T> rtype;
-      49             :     typedef typename rtype::iterator iterator;
-      50             :     typedef typename rtype::const_iterator c_iterator;
-      51             :     rtype r;
-      52             : 
-      53           0 :     tdiff iiv (const T &val) const
-      54           0 :       { return tdiff(std::upper_bound(r.begin(),r.end(),val)-r.begin())-1; }
-      55             : 
-      56           0 :     void addRemove (T a, T b, tdiff v)
-      57             :       {
-      58           0 :       tdiff pos1=iiv(a), pos2=iiv(b);
-      59           0 :       if ((pos1>=0) && (r[pos1]==a)) --pos1;
-      60             :       // first to delete is at pos1+1; last is at pos2
-      61           0 :       bool insert_a = (pos1&1)==v;
-      62           0 :       bool insert_b = (pos2&1)==v;
-      63           0 :       int rmstart=pos1+1+(insert_a ? 1 : 0);
-      64           0 :       int rmend  =pos2-(insert_b?1:0);
-      65             : 
-      66           0 :       planck_assert((rmend-rmstart)&1,"cannot happen");
-      67             : 
-      68           0 :       if (insert_a && insert_b && (pos1+1>pos2)) // insert
-      69             :         {
-      70           0 :         r.insert(r.begin()+pos1+1,2,a);
-      71           0 :         r[pos1+2]=b;
-      72             :         }
-      73             :       else
-      74             :         {
-      75           0 :         if (insert_a) r[pos1+1]=a;
-      76           0 :         if (insert_b) r[pos2]=b;
-      77           0 :         r.erase(r.begin()+rmstart,r.begin()+rmend+1);
-      78             :         }
-      79           0 :       }
-      80             : 
-      81             :     static void generalUnion (const rtype &a, const rtype &b,
-      82             :       bool flip_a, bool flip_b, rtype &c)
-      83             :       {
-      84             :       planck_assert((&c!=&a)&&(&c!=&b), "cannot overwrite the rangeset");
-      85             :       c.clear();
-      86             :       bool state_a=flip_a, state_b=flip_b, state_res=state_a||state_b;
-      87             :       tsize ia=0, ea=a.size(), ib=0, eb=b.size();
-      88             :       bool runa = ia!=ea, runb = ib!=eb;
-      89             :       while(runa||runb)
-      90             :         {
-      91             :         bool adv_a=false, adv_b=false;
-      92             :         T val,va=T(),vb=T();
-      93             :         if (runa) va = a[ia];
-      94             :         if (runb) vb = b[ib];
-      95             :         if (runa && (!runb || (va<=vb))) { adv_a=true; val=va; }
-      96             :         if (runb && (!runa || (vb<=va))) { adv_b=true; val=vb; }
-      97             :         if (adv_a) { state_a=!state_a; ++ia; runa = ia!=ea; }
-      98             :         if (adv_b) { state_b=!state_b; ++ib; runb = ib!=eb; }
-      99             :         if ((state_a||state_b)!=state_res)
-     100             :           { c.push_back(val); state_res = !state_res; }
-     101             :         }
-     102             :       }
-     103             : 
-     104             :   public:
-     105             :     /*! Removes all rangeset entries. */
-     106             :     void clear() { r.clear(); }
-     107             :     /*! Reserves space for \a n ranges. */
-     108             :     void reserve(tsize n) { r.reserve(2*n); }
-     109             :     /*! Returns the current number of ranges. */
-     110           0 :     tsize size() const { return r.size()>>1; }
-     111             :     /*! Returns the current vector of ranges. */
-     112             :     const rtype &data() const { return r; }
-     113             : 
-     114             :     /*! Returns the first value of range \a i. */
-     115           0 :     const T &ivbegin (tdiff i) const { return r[2*i]; }
-     116             :     /*! Returns the one-past-last value of range \a i. */
-     117           0 :     const T &ivend (tdiff i) const { return r[2*i+1]; }
-     118             :     /*! Returns the length of range \a i. */
-     119             :     T ivlen (tdiff i) const { return r[2*i+1]-r[2*i]; }
-     120             : 
-     121             :     /*! Appends \a [v1;v2[ to the rangeset. \a v1 must be larger
-     122             :         than the minimum of the last range in the rangeset. */
-     123           0 :     void append(const T &v1, const T &v2)
-     124             :       {
-     125           0 :       if (v2<=v1) return;
-     126           0 :       if ((!r.empty()) && (v1<=r.back()))
-     127             :         {
-     128           0 :         planck_assert (v1>=r[r.size()-2],"bad append operation");
-     129           0 :         if (v2>r.back()) r.back()=v2;
-     130             :         }
-     131             :       else
-     132           0 :         { r.push_back(v1); r.push_back(v2); }
-     133             :       }
-     134             :     /*! Appends \a [v;v+1[ to the rangeset. \a v must be larger
-     135             :         than the minimum of the last range in the rangeset. */
-     136             :     void append(const T &v)
-     137           0 :       { append(v,v+1); }
-     138             : 
-     139             :     /*! Appends \a other to the rangeset. All values in \a other must be larger
-     140             :         than the minimum of the last range in the rangeset. */
-     141           0 :     void append (const rangeset &other)
-     142             :       {
-     143           0 :       for (tsize j=0; j<other.size(); ++j)
-     144           0 :         append(other.ivbegin(j),other.ivend(j));
-     145           0 :       }
-     146             : 
-     147             :     /*! After this operation, the rangeset contains the union of itself
-     148             :         with \a [v1;v2[. */
-     149             :     void add(const T &v1, const T &v2) { addRemove(v1,v2,1); }
-     150             :     /*! After this operation, the rangeset contains the union of itself
-     151             :         with \a [v;v+1[. */
-     152             :     void add(const T &v) { addRemove(v,v+1,1); }
-     153             : 
-     154             :     /*! Removes all values within \a [v1;v2[ from the rangeset. */
-     155           0 :     void remove(const T &v1, const T &v2) { addRemove(v1,v2,0); }
-     156             :     /*! Removes the value \a v from the rangeset. */
-     157             :     void remove(const T &v) { addRemove(v,v+1,0); }
-     158             : 
-     159             :     /*! Removes all values not within \a [v1;v2[ from the rangeset. */
-     160           0 :     void intersect (const T &a, const T &b)
-     161             :       {
-     162           0 :       tdiff pos1=iiv(a), pos2=iiv(b);
-     163           0 :       if ((pos2>=0) && (r[pos2]==b)) --pos2;
-     164             :       // delete all up to pos1 (inclusive); and starting from pos2+1
-     165           0 :       bool insert_a = (pos1&1)==0;
-     166           0 :       bool insert_b = (pos2&1)==0;
-     167             : 
-     168             :       // cut off end
-     169           0 :       r.erase(r.begin()+pos2+1,r.end());
-     170           0 :       if (insert_b) r.push_back(b);
-     171             : 
-     172             :       // erase start
-     173           0 :       if (insert_a) r[pos1--]=a;
-     174           0 :       if (pos1>=0)
-     175             :         r.erase(r.begin(),r.begin()+pos1+1);
-     176           0 :       }
-     177             : 
-     178             :     /*! Returns the total number of elements in the rangeset. */
-     179             :     T nval() const
-     180             :       {
-     181             :       T result=T(0);
-     182           0 :       for (tsize i=0; i<r.size(); i+=2)
-     183           0 :         result+=r[i+1]-r[i];
-     184             :       return result;
-     185             :       }
-     186             : 
-     187             :     /*! After this opration, \a res contains all elements of the rangeset
-     188             :         in ascending order. */
-     189           0 :     void toVector (std::vector<T> &res) const
-     190             :       {
-     191             :       res.clear();
-     192           0 :       res.reserve(nval());
-     193           0 :       for (tsize i=0; i<r.size(); i+=2)
-     194           0 :         for (T m(r[i]); m<r[i+1]; ++m)
-     195           0 :           res.push_back(m);
-     196           0 :       }
-     197             : 
-     198             :     /*! After this operation, the rangeset contains the union of itself
-     199             :         and \a other. */
-     200             :     void unite (const rangeset &other)
-     201             :       {
-     202             :       rtype tmp;
-     203             :       generalUnion (r,other.r,false,false,tmp);
-     204             :       std::swap(r,tmp);
-     205             :       }
-     206             :     /*! After this operation, the rangeset contains the intersection of itself
-     207             :         and \a other. */
-     208             :     void intersect (const rangeset &other)
-     209             :       {
-     210             :       rtype tmp;
-     211             :       generalUnion (r,other.r,true,true,tmp);
-     212             :       std::swap(r,tmp);
-     213             :       }
-     214             :     /*! After this operation, the rangeset contains the union of itself
-     215             :         with the inverse of \a other. */
-     216             :     void subtract (const rangeset &other)
-     217             :       {
-     218             :       rtype tmp;
-     219             :       generalUnion (r,other.r,true,false,tmp);
-     220             :       std::swap(r,tmp);
-     221             :       }
-     222             :     /*! After this operation, the rangeset contains the union of \a a
-     223             :         and \a b. */
-     224             :     void setToUnion (const rangeset &a, const rangeset &b)
-     225             :       { generalUnion (a.r,b.r,false,false,r); }
-     226             :     /*! After this operation, the rangeset contains the intersection of \a a
-     227             :         and \a b. */
-     228             :     void setToIntersection (const rangeset &a, const rangeset &b)
-     229             :       { generalUnion (a.r,b.r,true,true,r); }
-     230             :     /*! After this operation, the rangeset contains the union of \a a
-     231             :         with the inverse of \a b. */
-     232             :     void setToDifference (const rangeset &a, const rangeset &b)
-     233             :       { generalUnion (a.r,b.r,true,false,r); }
-     234             : 
-     235             :     /*! Returns the index of the interval containing \a v; if no such interval
-     236             :         exists, -1 is returned. */
-     237             :     tdiff findInterval (const T &v) const
-     238             :       {
-     239             :       tdiff res = iiv(v);
-     240             :       return (res&1) ? -1 : res>>1;
-     241             :       }
-     242             : 
-     243             :     /*! Returns \a true if the rangeset is identical to \a other, else \a false.
-     244             :         */
-     245             :     bool equals (const rangeset &other) const
-     246             :       { return r==other.data(); }
-     247             : 
-     248             :     /*! Returns \a true if the rangeset contains all values in the range
-     249             :         \a [a;b[, else \a false. */
-     250             :     bool containsAll (T a,T b) const
-     251             :       {
-     252             :       tdiff res=iiv(a);
-     253             :       if (res&1) return false;
-     254             :       return (b<=r[res+1]);
-     255             :       }
-     256             :     /*! Returns \a true if the rangeset contains the value \a v,
-     257             :         else \a false. */
-     258             :     bool contains (T v) const
-     259             :       { return !(iiv(v)&1); }
-     260             :     /*! Returns \a true if the rangeset contains all values stored in \a other,
-     261             :         else \a false. */
-     262             :     bool contains (const rangeset &other) const
-     263             :       {
-     264             :       tsize im=0, em=r.size();
-     265             :       for (tsize i=0; i<other.r.size(); i+=2)
-     266             :         {
-     267             :         T a=other.r[i], b=other.r[i+1];
-     268             :         while ((im!=em) && (r[im+1] < a)) im+=2;
-     269             :         if (im==em) return false;
-     270             :         if ((r[im]>a) || (r[im+1]<b)) return false;
-     271             :         }
-     272             :       return true;
-     273             :       }
-     274             :   };
-     275             : 
-     276             : template<typename T> inline std::ostream &operator<< (std::ostream &os,
-     277             :   const rangeset<T> &rs)
-     278             :   {
-     279             :   os << "{ ";
-     280             :   for (tsize i=0; i<rs.size(); ++i)
-     281             :     os << "["<<rs.ivbegin(i)<<";"<<rs.ivend(i)<<"[ ";
-     282             :   return os << "}";
-     283             :   }
-     284             : 
-     285             : } // namespace healpix
-     286             : #endif
-     287             : 
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/vec3.h.func-sort-c.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/vec3.h.func-sort-c.html deleted file mode 100644 index 50398e10d..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/vec3.h.func-sort-c.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/vec3.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - vec3.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:102245.5 %
Date:2024-04-08 14:58:22Functions:1250.0 %
-
- -
- - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix6vec3_tIdE9NormalizeEv0
_ZN7healpix6vec3_tIdE9set_z_phiEdd134176
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/vec3.h.func.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/vec3.h.func.html deleted file mode 100644 index 633dc74e4..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/vec3.h.func.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/vec3.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - vec3.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:102245.5 %
Date:2024-04-08 14:58:22Functions:1250.0 %
-
- -
- - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix6vec3_tIdE9NormalizeEv0
_ZN7healpix6vec3_tIdE9set_z_phiEdd134176
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/include/healpix_base/vec3.h.gcov.html b/doc/coverageReport/libs/healpix_base/include/healpix_base/vec3.h.gcov.html deleted file mode 100644 index 78b942fb1..000000000 --- a/doc/coverageReport/libs/healpix_base/include/healpix_base/vec3.h.gcov.html +++ /dev/null @@ -1,229 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/include/healpix_base/vec3.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base/include/healpix_base - vec3.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:102245.5 %
Date:2024-04-08 14:58:22Functions:1250.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : /*
-       2             :  *  This file is part of libcxxsupport.
-       3             :  *
-       4             :  *  libcxxsupport is free software; you can redistribute it and/or modify
-       5             :  *  it under the terms of the GNU General Public License as published by
-       6             :  *  the Free Software Foundation; either version 2 of the License, or
-       7             :  *  (at your option) any later version.
-       8             :  *
-       9             :  *  libcxxsupport is distributed in the hope that it will be useful,
-      10             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-      11             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-      12             :  *  GNU General Public License for more details.
-      13             :  *
-      14             :  *  You should have received a copy of the GNU General Public License
-      15             :  *  along with libcxxsupport; if not, write to the Free Software
-      16             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-      17             :  */
-      18             : 
-      19             : /*
-      20             :  *  libcxxsupport is being developed at the Max-Planck-Institut fuer Astrophysik
-      21             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
-      22             :  *  (DLR).
-      23             :  */
-      24             : 
-      25             : /*! \file vec3.h
-      26             :  *  Class representing 3D cartesian vectors
-      27             :  *
-      28             :  *  Copyright (C) 2003, 2006 Max-Planck-Society
-      29             :  *  \author Martin Reinecke
-      30             :  */
-      31             : 
-      32             : #ifndef PLANCK_VEC3_H
-      33             : #define PLANCK_VEC3_H
-      34             : 
-      35             : #include <cmath>
-      36             : #include <iostream>
-      37             : #include "healpix_base/datatypes.h"
-      38             : 
-      39             : namespace healpix{
-      40             : 
-      41             : /*! \defgroup vec3group 3D vectors */
-      42             : /*! \{ */
-      43             : 
-      44             : /*! Class representing a 3D cartesian vector. */
-      45             : template<typename T>class vec3_t
-      46             :   {
-      47             :   public:
-      48             :     T x, /*!< x-coordinate */
-      49             :       y, /*!< y-coordinate */
-      50             :       z; /*!< z-coordinate */
-      51             : 
-      52             :     /*! Default constructor. Does not initialize \a x, \a y, and \a z. */
-      53      244781 :     vec3_t () {}
-      54             :     /*! Creates a vector with the coordinates \a xc, \a yc, and \a zc. */
-      55        1417 :     vec3_t (T xc, T yc, T zc)
-      56        1417 :       : x(xc), y(yc), z(zc) {}
-      57             :     template<typename T2> explicit vec3_t (const vec3_t<T2> &orig)
-      58             :       : x(orig.x), y(orig.y), z(orig.z) {}
-      59             : 
-      60             :     /*! Sets the vector components to \a xc, \a yc, and \a zc. */
-      61             :     void Set (T xc, T yc, T zc)
-      62             :       { x=xc; y=yc; z=zc; }
-      63             :     /*! Creates a unit vector from a z coordinate and an azimuthal angle. */
-      64      134176 :     void set_z_phi (T z_, T phi)
-      65             :       {
-      66             :       using namespace std;
-      67      134176 :       T sintheta = sqrt((T(1)-z_)*(T(1)+z_));
-      68      134176 :       x = sintheta*cos(phi);
-      69      134176 :       y = sintheta*sin(phi);
-      70      134176 :       z = z_;
-      71      134176 :       }
-      72             : 
-      73             :     /*! Normalizes the vector to length 1. */
-      74           0 :     void Normalize ()
-      75             :       {
-      76             :       using namespace std;
-      77           0 :       T l = T(1)/sqrt (x*x + y*y + z*z);
-      78           0 :       x*=l; y*=l; z*=l;
-      79           0 :       }
-      80             : 
-      81             :     vec3_t Norm() const
-      82             :       {
-      83           0 :       vec3_t res(*this);
-      84           0 :       res.Normalize();
-      85             :       return res;
-      86             :       }
-      87             : 
-      88             :     /*! Returns the length of the vector. */
-      89             :     T Length () const
-      90       24585 :       { return sqrt (x*x + y*y + z*z); }
-      91             : 
-      92             :     /*! Returns the squared length of the vector. */
-      93             :     T SquaredLength () const
-      94             :       { return (x*x + y*y + z*z); }
-      95             :     /*! Returns the vector with the signs of all coordinates flipped. */
-      96             :     const vec3_t operator- () const
-      97             :       { return vec3_t (-x, -y, -z); }
-      98             :     /*! Flips the signs of all coordinates. */
-      99             :     void Flip ()
-     100           0 :       { x=-x; y=-y; z=-z; }
-     101             :     /*! Returns (\a *this + \a vec). */
-     102             :     const vec3_t operator+ (const vec3_t &vec) const
-     103           0 :       { return vec3_t (x+vec.x, y+vec.y, z+vec.z); }
-     104             :     /*! Adds \a vec to \a *this. */
-     105             :     vec3_t &operator+= (const vec3_t &vec)
-     106             :       { x+=vec.x; y+=vec.y; z+=vec.z; return *this; }
-     107             :     /*! Returns (\a *this - \a vec). */
-     108             :     const vec3_t operator- (const vec3_t &vec) const
-     109           0 :       { return vec3_t (x-vec.x, y-vec.y, z-vec.z); }
-     110             :     /*! Subtracts \a vec from \a *this. */
-     111             :     vec3_t &operator-= (const vec3_t &vec)
-     112             :       { x-=vec.x; y-=vec.y; z-=vec.z; return *this; }
-     113             :     /*! Returns the vector scaled by \a fact. */
-     114             :     const vec3_t operator* (T fact) const
-     115             :       { return vec3_t (x*fact, y*fact, z*fact); }
-     116             :     /*! Returns the vector scaled by \a 1/fact. */
-     117             :     const vec3_t operator/ (T fact) const
-     118             :       { T xfact = T(1)/fact; return vec3_t (x*xfact, y*xfact, z*xfact); }
-     119             :     /*! Scales the vector by \a fact. */
-     120             :     vec3_t &operator*= (T fact)
-     121           0 :       { x*=fact; y*=fact; z*=fact; return *this; }
-     122             :   };
-     123             : 
-     124             : /*! Returns the dot product of \a v1 and \a v2.
-     125             :     \relates vec3_t */
-     126             : template<typename T> inline T dotprod(const vec3_t<T> &v1, const vec3_t<T> &v2)
-     127           0 :   { return v1.x*v2.x + v1.y*v2.y + v1.z*v2.z; }
-     128             : 
-     129             : /*! Returns the cross product of \a a and \a b.
-     130             :     \relates vec3_t */
-     131             : template<typename T> inline vec3_t<T> crossprod
-     132             :   (const vec3_t<T> &a, const vec3_t<T> &b)
-     133           0 :   { return vec3_t<T>(a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x); }
-     134             : 
-     135             : /*! Writes \a v to \a os.
-     136             :     \relates vec3_t */
-     137             : template<typename T> inline std::ostream &operator<<
-     138             :   (std::ostream &os, const vec3_t<T> &v)
-     139             :   {
-     140             :   os << v.x << ", " << v.y << ", " << v.z << std::endl;
-     141             :   return os;
-     142             :   }
-     143             : 
-     144             : /*! Specialisation of vec3_t for 64-bit floating point components */
-     145             : typedef vec3_t<float64> vec3;
-     146             : /*! Specialisation of vec3_t for 32-bit floating point components */
-     147             : typedef vec3_t<float32> vec3f;
-     148             : 
-     149             : /*! \} */
-     150             : 
-     151             : } // namespace healpix
-     152             : #endif
-     153             : 
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/index-sort-f.html b/doc/coverageReport/libs/healpix_base/index-sort-f.html deleted file mode 100644 index 90582d17c..000000000 --- a/doc/coverageReport/libs/healpix_base/index-sort-f.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_baseHitTotalCoverage
Test:coverage.info.cleanedLines:11279214.1 %
Date:2024-04-08 14:58:22Functions:101069.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
geom_utils.cc -
0.0%
-
0.0 %0 / 250.0 %0 / 3
pointing.cc -
0.0%
-
0.0 %0 / 210.0 %0 / 5
error_handling.cc -
0.0%
-
0.0 %0 / 120.0 %0 / 7
healpix_base.cc -
15.3%15.3%
-
15.3 %112 / 73411.0 %10 / 91
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/index-sort-l.html b/doc/coverageReport/libs/healpix_base/index-sort-l.html deleted file mode 100644 index 51b835471..000000000 --- a/doc/coverageReport/libs/healpix_base/index-sort-l.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_baseHitTotalCoverage
Test:coverage.info.cleanedLines:11279214.1 %
Date:2024-04-08 14:58:22Functions:101069.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
error_handling.cc -
0.0%
-
0.0 %0 / 120.0 %0 / 7
pointing.cc -
0.0%
-
0.0 %0 / 210.0 %0 / 5
geom_utils.cc -
0.0%
-
0.0 %0 / 250.0 %0 / 3
healpix_base.cc -
15.3%15.3%
-
15.3 %112 / 73411.0 %10 / 91
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/index.html b/doc/coverageReport/libs/healpix_base/index.html deleted file mode 100644 index 5078da2bf..000000000 --- a/doc/coverageReport/libs/healpix_base/index.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_baseHitTotalCoverage
Test:coverage.info.cleanedLines:11279214.1 %
Date:2024-04-08 14:58:22Functions:101069.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
error_handling.cc -
0.0%
-
0.0 %0 / 120.0 %0 / 7
geom_utils.cc -
0.0%
-
0.0 %0 / 250.0 %0 / 3
healpix_base.cc -
15.3%15.3%
-
15.3 %112 / 73411.0 %10 / 91
pointing.cc -
0.0%
-
0.0 %0 / 210.0 %0 / 5
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/pointing.cc.func-sort-c.html b/doc/coverageReport/libs/healpix_base/pointing.cc.func-sort-c.html deleted file mode 100644 index 4499d9636..000000000 --- a/doc/coverageReport/libs/healpix_base/pointing.cc.func-sort-c.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/pointing.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base - pointing.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0210.0 %
Date:2024-04-08 14:58:22Functions:050.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix8pointing15normalize_thetaEv0
_ZN7healpix8pointing9from_vec3ERKNS_6vec3_tIdEE0
_ZN7healpix8pointing9normalizeEv0
_ZN7healpixlsERSoRKNS_8pointingE0
_ZNK7healpix8pointing7to_vec3Ev0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/pointing.cc.func.html b/doc/coverageReport/libs/healpix_base/pointing.cc.func.html deleted file mode 100644 index 473f90349..000000000 --- a/doc/coverageReport/libs/healpix_base/pointing.cc.func.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/pointing.cc - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base - pointing.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0210.0 %
Date:2024-04-08 14:58:22Functions:050.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7healpix8pointing15normalize_thetaEv0
_ZN7healpix8pointing9from_vec3ERKNS_6vec3_tIdEE0
_ZN7healpix8pointing9normalizeEv0
_ZN7healpixlsERSoRKNS_8pointingE0
_ZNK7healpix8pointing7to_vec3Ev0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/healpix_base/pointing.cc.gcov.html b/doc/coverageReport/libs/healpix_base/pointing.cc.gcov.html deleted file mode 100644 index 678a7db26..000000000 --- a/doc/coverageReport/libs/healpix_base/pointing.cc.gcov.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/healpix_base/pointing.cc - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/healpix_base - pointing.cc (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0210.0 %
Date:2024-04-08 14:58:22Functions:050.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : /*
-       2             :  *  This file is part of libcxxsupport.
-       3             :  *
-       4             :  *  libcxxsupport is free software; you can redistribute it and/or modify
-       5             :  *  it under the terms of the GNU General Public License as published by
-       6             :  *  the Free Software Foundation; either version 2 of the License, or
-       7             :  *  (at your option) any later version.
-       8             :  *
-       9             :  *  libcxxsupport is distributed in the hope that it will be useful,
-      10             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-      11             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-      12             :  *  GNU General Public License for more details.
-      13             :  *
-      14             :  *  You should have received a copy of the GNU General Public License
-      15             :  *  along with libcxxsupport; if not, write to the Free Software
-      16             :  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-      17             :  */
-      18             : 
-      19             : /*
-      20             :  *  libcxxsupport is being developed at the Max-Planck-Institut fuer Astrophysik
-      21             :  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
-      22             :  *  (DLR).
-      23             :  */
-      24             : 
-      25             : /*! \file pointing.cc
-      26             :  *  Class representing a direction in 3D space
-      27             :  *
-      28             :  *  Copyright (C) 2003-2012 Max-Planck-Society
-      29             :  *  \author Martin Reinecke
-      30             :  */
-      31             : 
-      32             : #include "healpix_base/pointing.h"
-      33             : #include "healpix_base/lsconstants.h"
-      34             : #include "healpix_base/math_utils.h"
-      35             : 
-      36             : namespace healpix{
-      37             : 
-      38             : using namespace std;
-      39             : 
-      40           0 : vec3 pointing::to_vec3() const
-      41             :   {
-      42           0 :   double st=sin(theta);
-      43           0 :   return vec3 (st*cos(phi), st*sin(phi), cos(theta));
-      44             :   }
-      45           0 : void pointing::from_vec3 (const vec3 &inp)
-      46             :   {
-      47           0 :   theta = atan2(sqrt(inp.x*inp.x+inp.y*inp.y),inp.z);
-      48           0 :   phi = safe_atan2 (inp.y,inp.x);
-      49           0 :   if (phi<0.) phi += twopi;
-      50           0 :   }
-      51           0 : void pointing::normalize_theta()
-      52             :   {
-      53           0 :   theta=fmodulo(theta,twopi);
-      54           0 :   if (theta>pi)
-      55             :     {
-      56           0 :     phi+=pi;
-      57           0 :     theta=twopi-theta;
-      58             :     }
-      59           0 :   }
-      60           0 : void pointing::normalize()
-      61             :   {
-      62           0 :   normalize_theta();
-      63           0 :   phi=fmodulo(phi,twopi);
-      64           0 :   }
-      65             : 
-      66           0 : ostream &operator<< (ostream &os, const pointing &p)
-      67             :   {
-      68           0 :   os << p.theta << ", " << p.phi << std::endl;
-      69           0 :   return os;
-      70             :   }
-      71             : } // namespace healpix
-      72             : 
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/kiss/include/kiss/convert.h.func-sort-c.html b/doc/coverageReport/libs/kiss/include/kiss/convert.h.func-sort-c.html deleted file mode 100644 index 3091b54e8..000000000 --- a/doc/coverageReport/libs/kiss/include/kiss/convert.h.func-sort-c.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/kiss/include/kiss/convert.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/kiss/include/kiss - convert.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:71070.0 %
Date:2024-04-08 14:58:22Functions:11100.0 %
-
- -
- - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN4kiss3strIiEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_2
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/kiss/include/kiss/convert.h.func.html b/doc/coverageReport/libs/kiss/include/kiss/convert.h.func.html deleted file mode 100644 index df4061a5f..000000000 --- a/doc/coverageReport/libs/kiss/include/kiss/convert.h.func.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/kiss/include/kiss/convert.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/kiss/include/kiss - convert.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:71070.0 %
Date:2024-04-08 14:58:22Functions:11100.0 %
-
- -
- - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN4kiss3strIiEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_2
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/kiss/include/kiss/convert.h.gcov.html b/doc/coverageReport/libs/kiss/include/kiss/convert.h.gcov.html deleted file mode 100644 index 6a912c12a..000000000 --- a/doc/coverageReport/libs/kiss/include/kiss/convert.h.gcov.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/kiss/include/kiss/convert.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/kiss/include/kiss - convert.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:71070.0 %
Date:2024-04-08 14:58:22Functions:11100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef KISS_CONVERT_H
-       2             : #define KISS_CONVERT_H
-       3             : 
-       4             : #include <iostream>
-       5             : #include <sstream>
-       6             : #include <string>
-       7             : #include <typeinfo>
-       8             : #include <stdexcept>
-       9             : 
-      10             : namespace kiss {
-      11             : 
-      12             : class bad_conversion: public std::runtime_error {
-      13             : public:
-      14           0 :         bad_conversion(std::string const& s) :
-      15           0 :                         std::runtime_error(s) {
-      16             :         }
-      17             : };
-      18             : 
-      19             : template<typename T>
-      20           2 : inline std::string str(T const& x) {
-      21           2 :         std::ostringstream o;
-      22           2 :         o.imbue(std::locale("C"));
-      23           2 :         o << x;
-      24           2 :         if (!o) {
-      25             : #ifdef DEBUG
-      26             :                 std::cerr << "bad_conversion: str(" << typeid(x).name() << ")";
-      27             : #endif
-      28           0 :                 throw bad_conversion(std::string("str(") + typeid(x).name() + ")");
-      29             :         }
-      30           2 :         return o.str();
-      31           2 : }
-      32             : 
-      33             : template<typename T>
-      34             : inline void convert(const char *s, T& x) {
-      35             :         if (s == 0) {
-      36             : #ifdef DEBUG
-      37             :                 std::cerr << "bad_conversion: convert, null pointer";
-      38             : #endif
-      39             :                 throw bad_conversion("null pointer");
-      40             :         }
-      41             :         std::istringstream i(s);
-      42             :         i.imbue(std::locale("C"));
-      43             :         i >> x;
-      44             :         if (!i) {
-      45             : #ifdef DEBUG
-      46             :                 std::cerr << "bad_conversion: convert (" << s << ")";
-      47             : #endif
-      48             :                 throw bad_conversion(std::string(s) + " to " + typeid(x).name());
-      49             :         }
-      50             : }
-      51             : 
-      52             : template<typename T>
-      53             : inline void convert(std::string const& s, T& x) {
-      54             :         std::istringstream i(s);
-      55             :         i.imbue(std::locale("C"));
-      56             :         i >> x;
-      57             :         if (!i) {
-      58             : #ifdef DEBUG
-      59             :                 std::cerr << "bad_conversion: convert (" << s << ")";
-      60             : #endif
-      61             :                 throw bad_conversion(s + " to " + typeid(x).name());
-      62             :         }
-      63             : }
-      64             : 
-      65             : template<typename T>
-      66             : inline T convertTo(std::string const& s, bool failIfLeftoverChars = true) {
-      67             :         T x;
-      68             :         convert(s, x, failIfLeftoverChars);
-      69             :         return x;
-      70             : }
-      71             : 
-      72             : } // namespace kiss
-      73             : 
-      74             : #endif /* KISSCONVERT_H */
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/kiss/include/kiss/index-sort-f.html b/doc/coverageReport/libs/kiss/include/kiss/index-sort-f.html deleted file mode 100644 index bb06075e7..000000000 --- a/doc/coverageReport/libs/kiss/include/kiss/index-sort-f.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/kiss/include/kiss - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/kiss/include/kissHitTotalCoverage
Test:coverage.info.cleanedLines:111957.9 %
Date:2024-04-08 14:58:22Functions:146720.9 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
logger.h -
44.4%44.4%
-
44.4 %4 / 919.7 %13 / 66
convert.h -
70.0%70.0%
-
70.0 %7 / 10100.0 %1 / 1
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/kiss/include/kiss/index-sort-l.html b/doc/coverageReport/libs/kiss/include/kiss/index-sort-l.html deleted file mode 100644 index b047c279f..000000000 --- a/doc/coverageReport/libs/kiss/include/kiss/index-sort-l.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/kiss/include/kiss - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/kiss/include/kissHitTotalCoverage
Test:coverage.info.cleanedLines:111957.9 %
Date:2024-04-08 14:58:22Functions:146720.9 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
logger.h -
44.4%44.4%
-
44.4 %4 / 919.7 %13 / 66
convert.h -
70.0%70.0%
-
70.0 %7 / 10100.0 %1 / 1
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/kiss/include/kiss/index.html b/doc/coverageReport/libs/kiss/include/kiss/index.html deleted file mode 100644 index c4b160333..000000000 --- a/doc/coverageReport/libs/kiss/include/kiss/index.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/kiss/include/kiss - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/kiss/include/kissHitTotalCoverage
Test:coverage.info.cleanedLines:111957.9 %
Date:2024-04-08 14:58:22Functions:146720.9 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
convert.h -
70.0%70.0%
-
70.0 %7 / 10100.0 %1 / 1
logger.h -
44.4%44.4%
-
44.4 %4 / 919.7 %13 / 66
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/kiss/include/kiss/logger.h.func-sort-c.html b/doc/coverageReport/libs/kiss/include/kiss/logger.h.func-sort-c.html deleted file mode 100644 index 35772c48a..000000000 --- a/doc/coverageReport/libs/kiss/include/kiss/logger.h.func-sort-c.html +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/kiss/include/kiss/logger.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/kiss/include/kiss - logger.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:4944.4 %
Date:2024-04-08 14:58:22Functions:136619.7 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN4kiss6LoggerlsEPFRSoS1_E0
_ZN4kiss6LoggerlsIA11_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA12_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA135_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA14_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA156_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA15_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA16_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA18_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA197_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA231_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA23_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA256_cEERS0_RT_0
_ZN4kiss6LoggerlsIA25_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA26_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA27_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA33_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA34_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA35_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA39_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA40_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA41_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA42_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA46_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA47_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA49_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA53_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA54_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA55_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA69_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA6_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA70_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA71_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA72_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA73_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA74_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA75_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA81_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA82_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA83_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA8_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA93_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA9_KcEERS0_RT_0
_ZN4kiss6LoggerlsIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEERS0_RT_0
_ZN4kiss6LoggerlsIKbEERS0_RT_0
_ZN4kiss6LoggerlsIKiEERS0_RT_0
_ZN4kiss6LoggerlsIKmEERS0_RT_0
_ZN4kiss6LoggerlsIN7crpropa7Vector3IdEEEERS0_RT_0
_ZN4kiss6LoggerlsINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEERS0_RT_0
_ZN4kiss6LoggerlsIbEERS0_RT_0
_ZN4kiss6LoggerlsIdEERS0_RT_0
_ZN4kiss6LoggerlsImEERS0_RT_0
_ZN4kiss6LoggerlsIyEERS0_RT_0
_ZN4kiss6LoggerlsIA166_KcEERS0_RT_1
_ZN4kiss6LoggerlsIA3_KcEERS0_RT_1
_ZN4kiss6LoggerlsIA59_KcEERS0_RT_1
_ZN4kiss6LoggerlsIA5_KcEERS0_RT_1
_ZN4kiss6LoggerlsIA7_KcEERS0_RT_1
_ZN4kiss6LoggerlsIA2_KcEERS0_RT_2
_ZN4kiss6LoggerlsIA58_KcEERS0_RT_2
_ZN4kiss6LoggerlsIA64_KcEERS0_RT_2
_ZN4kiss6LoggerlsIA67_KcEERS0_RT_2
_ZN4kiss6LoggerlsIiEERS0_RT_2
_ZN4kiss6LoggerlsIA51_KcEERS0_RT_3
_ZN4kiss6LoggerlsIA131_KcEERS0_RT_4
_ZN4kiss6LoggerlsIA50_KcEERS0_RT_4
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/kiss/include/kiss/logger.h.func.html b/doc/coverageReport/libs/kiss/include/kiss/logger.h.func.html deleted file mode 100644 index 1f4061bc2..000000000 --- a/doc/coverageReport/libs/kiss/include/kiss/logger.h.func.html +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/kiss/include/kiss/logger.h - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/kiss/include/kiss - logger.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:4944.4 %
Date:2024-04-08 14:58:22Functions:136619.7 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN4kiss6LoggerlsEPFRSoS1_E0
_ZN4kiss6LoggerlsIA11_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA12_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA131_KcEERS0_RT_4
_ZN4kiss6LoggerlsIA135_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA14_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA156_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA15_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA166_KcEERS0_RT_1
_ZN4kiss6LoggerlsIA16_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA18_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA197_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA231_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA23_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA256_cEERS0_RT_0
_ZN4kiss6LoggerlsIA25_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA26_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA27_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA2_KcEERS0_RT_2
_ZN4kiss6LoggerlsIA33_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA34_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA35_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA39_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA3_KcEERS0_RT_1
_ZN4kiss6LoggerlsIA40_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA41_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA42_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA46_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA47_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA49_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA50_KcEERS0_RT_4
_ZN4kiss6LoggerlsIA51_KcEERS0_RT_3
_ZN4kiss6LoggerlsIA53_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA54_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA55_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA58_KcEERS0_RT_2
_ZN4kiss6LoggerlsIA59_KcEERS0_RT_1
_ZN4kiss6LoggerlsIA5_KcEERS0_RT_1
_ZN4kiss6LoggerlsIA64_KcEERS0_RT_2
_ZN4kiss6LoggerlsIA67_KcEERS0_RT_2
_ZN4kiss6LoggerlsIA69_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA6_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA70_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA71_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA72_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA73_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA74_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA75_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA7_KcEERS0_RT_1
_ZN4kiss6LoggerlsIA81_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA82_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA83_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA8_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA93_KcEERS0_RT_0
_ZN4kiss6LoggerlsIA9_KcEERS0_RT_0
_ZN4kiss6LoggerlsIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEERS0_RT_0
_ZN4kiss6LoggerlsIKbEERS0_RT_0
_ZN4kiss6LoggerlsIKiEERS0_RT_0
_ZN4kiss6LoggerlsIKmEERS0_RT_0
_ZN4kiss6LoggerlsIN7crpropa7Vector3IdEEEERS0_RT_0
_ZN4kiss6LoggerlsINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEERS0_RT_0
_ZN4kiss6LoggerlsIbEERS0_RT_0
_ZN4kiss6LoggerlsIdEERS0_RT_0
_ZN4kiss6LoggerlsIiEERS0_RT_2
_ZN4kiss6LoggerlsImEERS0_RT_0
_ZN4kiss6LoggerlsIyEERS0_RT_0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/kiss/include/kiss/logger.h.gcov.html b/doc/coverageReport/libs/kiss/include/kiss/logger.h.gcov.html deleted file mode 100644 index a7402eee3..000000000 --- a/doc/coverageReport/libs/kiss/include/kiss/logger.h.gcov.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/kiss/include/kiss/logger.h - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/kiss/include/kiss - logger.h (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:4944.4 %
Date:2024-04-08 14:58:22Functions:136619.7 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifndef KISS_LOG_H
-       2             : #define KISS_LOG_H
-       3             : 
-       4             : #include <iostream>
-       5             : 
-       6             : namespace kiss {
-       7             : 
-       8             : enum eLogLevel {
-       9             :         LOG_LEVEL_ERROR, LOG_LEVEL_WARNING, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG
-      10             : };
-      11             : 
-      12             : class Logger {
-      13             :         static std::ostream *stream;
-      14             :         static eLogLevel level;
-      15             : public:
-      16             :         Logger(eLogLevel level);
-      17             :         ~Logger();
-      18             :         static std::ostream &getLogStream();
-      19             :         static void setLogStream(std::ostream *s);
-      20             :         static void setLogStream(std::ostream &s);
-      21             : 
-      22             :         static void setLogLevel(eLogLevel level);
-      23             :         static eLogLevel getLogLevel();
-      24             : 
-      25             :         static void loadEnvLogLevel();
-      26             : 
-      27             :         operator std::ostream &() {
-      28           0 :                 return getLogStream();
-      29             :         }
-      30             : 
-      31          26 :         template<typename T> inline Logger& operator<<(T& data) {
-      32          52 :                 #pragma omp critical (KISS_LOGGER)
-      33             :                 {
-      34          26 :                 getLogStream() << data;
-      35             :                 }
-      36          26 :                 return *this;
-      37             :         }
-      38             : 
-      39           0 :         inline Logger& operator<<(std::ostream& (*func)(std::ostream&)) {
-      40           0 :                 #pragma omp critical (KISS_LOGGER)
-      41             :                 {
-      42           0 :                 getLogStream() << func;
-      43             :                 }
-      44           0 :                 return *this;
-      45             :         }
-      46             : };
-      47             : 
-      48             : } // namespace kiss
-      49             : 
-      50             : #define KISS_LOG_ERROR if (kiss::Logger::getLogLevel() < kiss::LOG_LEVEL_ERROR) {} else kiss::Logger(kiss::LOG_LEVEL_ERROR)
-      51             : #define KISS_LOG_WARNING if (kiss::Logger::getLogLevel() < kiss::LOG_LEVEL_WARNING) {} else kiss::Logger(kiss::LOG_LEVEL_WARNING)
-      52             : #define KISS_LOG_INFO if (kiss::Logger::getLogLevel() < kiss::LOG_LEVEL_INFO) {} else kiss::Logger(kiss::LOG_LEVEL_INFO)
-      53             : #define KISS_LOG_DEBUG if (kiss::Logger::getLogLevel() < kiss::LOG_LEVEL_DEBUG) {} else kiss::Logger(kiss::LOG_LEVEL_DEBUG)
-      54             : 
-      55             : #endif /* KISSLOG_H */
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/kiss/src/index-sort-f.html b/doc/coverageReport/libs/kiss/src/index-sort-f.html deleted file mode 100644 index ec409f400..000000000 --- a/doc/coverageReport/libs/kiss/src/index-sort-f.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/kiss/src - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/kiss/srcHitTotalCoverage
Test:coverage.info.cleanedLines:3412128.1 %
Date:2024-04-08 14:58:22Functions:92339.1 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
string.cpp -
14.8%14.8%
-
14.8 %4 / 2714.3 %1 / 7
path.cpp -
24.5%24.5%
-
24.5 %13 / 5337.5 %3 / 8
logger.cpp -
41.5%41.5%
-
41.5 %17 / 4162.5 %5 / 8
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/kiss/src/index-sort-l.html b/doc/coverageReport/libs/kiss/src/index-sort-l.html deleted file mode 100644 index 4cac3f96c..000000000 --- a/doc/coverageReport/libs/kiss/src/index-sort-l.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/kiss/src - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/kiss/srcHitTotalCoverage
Test:coverage.info.cleanedLines:3412128.1 %
Date:2024-04-08 14:58:22Functions:92339.1 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
string.cpp -
14.8%14.8%
-
14.8 %4 / 2714.3 %1 / 7
path.cpp -
24.5%24.5%
-
24.5 %13 / 5337.5 %3 / 8
logger.cpp -
41.5%41.5%
-
41.5 %17 / 4162.5 %5 / 8
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/kiss/src/index.html b/doc/coverageReport/libs/kiss/src/index.html deleted file mode 100644 index d44e18167..000000000 --- a/doc/coverageReport/libs/kiss/src/index.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/kiss/src - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/kiss/srcHitTotalCoverage
Test:coverage.info.cleanedLines:3412128.1 %
Date:2024-04-08 14:58:22Functions:92339.1 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
logger.cpp -
41.5%41.5%
-
41.5 %17 / 4162.5 %5 / 8
path.cpp -
24.5%24.5%
-
24.5 %13 / 5337.5 %3 / 8
string.cpp -
14.8%14.8%
-
14.8 %4 / 2714.3 %1 / 7
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/kiss/src/logger.cpp.func-sort-c.html b/doc/coverageReport/libs/kiss/src/logger.cpp.func-sort-c.html deleted file mode 100644 index a72ea02f2..000000000 --- a/doc/coverageReport/libs/kiss/src/logger.cpp.func-sort-c.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/kiss/src/logger.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/kiss/src - logger.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:174141.5 %
Date:2024-04-08 14:58:22Functions:5862.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN4kiss6Logger11setLogLevelENS_9eLogLevelE0
_ZN4kiss6Logger12setLogStreamEPSo0
_ZN4kiss6Logger12setLogStreamERSo0
_ZN4kiss6LoggerC2ENS_9eLogLevelE12
_ZN4kiss6LoggerD2Ev12
_ZN4kiss6Logger15loadEnvLogLevelEv19
_ZN4kiss6Logger12getLogStreamEv26
_ZN4kiss6Logger11getLogLevelEv290
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/kiss/src/logger.cpp.func.html b/doc/coverageReport/libs/kiss/src/logger.cpp.func.html deleted file mode 100644 index c740d5ca4..000000000 --- a/doc/coverageReport/libs/kiss/src/logger.cpp.func.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/kiss/src/logger.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/kiss/src - logger.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:174141.5 %
Date:2024-04-08 14:58:22Functions:5862.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN4kiss6Logger11getLogLevelEv290
_ZN4kiss6Logger11setLogLevelENS_9eLogLevelE0
_ZN4kiss6Logger12getLogStreamEv26
_ZN4kiss6Logger12setLogStreamEPSo0
_ZN4kiss6Logger12setLogStreamERSo0
_ZN4kiss6Logger15loadEnvLogLevelEv19
_ZN4kiss6LoggerC2ENS_9eLogLevelE12
_ZN4kiss6LoggerD2Ev12
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/kiss/src/logger.cpp.gcov.html b/doc/coverageReport/libs/kiss/src/logger.cpp.gcov.html deleted file mode 100644 index 212278290..000000000 --- a/doc/coverageReport/libs/kiss/src/logger.cpp.gcov.html +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/kiss/src/logger.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/kiss/src - logger.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:174141.5 %
Date:2024-04-08 14:58:22Functions:5862.5 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "kiss/logger.h"
-       2             : 
-       3             : #include <stdlib.h>
-       4             : #include <iostream>
-       5             : 
-       6             : namespace kiss {
-       7             : 
-       8             : std::ostream *Logger::stream = &std::cerr;
-       9             : eLogLevel Logger::level = LOG_LEVEL_WARNING;
-      10             : const char* sLoggerLevel[] = { " ERROR ", "WARNING", " INFO  ", " DEBUG " };
-      11             : 
-      12             : class EnvLogger {
-      13             : public:
-      14             :         EnvLogger() {
-      15             :                 Logger::loadEnvLogLevel();
-      16             :         }
-      17             : };
-      18             : static EnvLogger _env_log_;
-      19             : 
-      20          12 : Logger::Logger(eLogLevel level) {
-      21             :         time_t rawtime;
-      22             :         struct tm * timeinfo;
-      23             :         char buffer[80];
-      24             : 
-      25          12 :         time(&rawtime);
-      26          12 :         timeinfo = localtime(&rawtime);
-      27             : 
-      28          12 :         strftime(buffer, 80, "%Y-%m-%d %H:%M:%S ", timeinfo);
-      29          12 :         *stream << buffer;
-      30          12 :         *stream << "[" << sLoggerLevel[level] << "] ";
-      31          12 : }
-      32             : 
-      33          12 : Logger::~Logger() {
-      34          12 :         *stream << std::endl;
-      35          12 : }
-      36             : 
-      37          26 : std::ostream &Logger::getLogStream() {
-      38          26 :         return (*stream);
-      39             : }
-      40             : 
-      41           0 : void Logger::setLogStream(std::ostream *s) {
-      42           0 :         stream = s;
-      43           0 : }
-      44             : 
-      45           0 : void Logger::setLogStream(std::ostream &s) {
-      46           0 :         stream = &s;
-      47           0 : }
-      48             : 
-      49           0 : void Logger::setLogLevel(eLogLevel l) {
-      50           0 :         level = l;
-      51           0 : }
-      52         290 : eLogLevel Logger::getLogLevel() {
-      53         290 :         return (level);
-      54             : }
-      55             : 
-      56             : 
-      57             : 
-      58             : 
-      59          19 : void Logger::loadEnvLogLevel() {
-      60          19 :         if (::getenv("KISS_LOG_LEVEL")) {
-      61             :                 
-      62           0 :                 int level = atoi(::getenv("KISS_LOG_LEVEL"));
-      63           0 :                 switch (level) {
-      64           0 :                 case LOG_LEVEL_ERROR:
-      65           0 :                         Logger::setLogLevel(LOG_LEVEL_ERROR);
-      66           0 :                         break;
-      67           0 :                 case LOG_LEVEL_WARNING:
-      68           0 :                         Logger::setLogLevel(LOG_LEVEL_WARNING);
-      69           0 :                         break;
-      70           0 :                 case LOG_LEVEL_INFO:
-      71           0 :                         Logger::setLogLevel(LOG_LEVEL_INFO);
-      72           0 :                         break;
-      73           0 :                 case LOG_LEVEL_DEBUG:
-      74           0 :                         Logger::setLogLevel(LOG_LEVEL_DEBUG);
-      75           0 :                         break;
-      76             :                 default:
-      77             :                         std::cerr << "kiss::Logger: unknown log level in KISS_LOG_LEVEL '"
-      78           0 :                                         << level << " values from 0-3 expected." << std::endl;
-      79             :                         break;
-      80             :                 }
-      81             :         }
-      82          19 : }
-      83             : 
-      84             : } // namespace kiss
-      85             : 
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/kiss/src/path.cpp.func-sort-c.html b/doc/coverageReport/libs/kiss/src/path.cpp.func-sort-c.html deleted file mode 100644 index 496484b29..000000000 --- a/doc/coverageReport/libs/kiss/src/path.cpp.func-sort-c.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/kiss/src/path.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/kiss/src - path.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:135324.5 %
Date:2024-04-08 14:58:22Functions:3837.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_Z11append_fileRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_b0
_Z11concat_pathRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_S6_0
_Z14list_directoryRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt6vectorIS4_SaIS4_EE0
_Z16create_directoryRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmmm0
_Z26create_directory_recursiveRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmmm0
_Z15executable_pathB5cxx11v13
_Z12is_directoryRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE26
_Z11concat_pathRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_547
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/kiss/src/path.cpp.func.html b/doc/coverageReport/libs/kiss/src/path.cpp.func.html deleted file mode 100644 index e354ac988..000000000 --- a/doc/coverageReport/libs/kiss/src/path.cpp.func.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/kiss/src/path.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/kiss/src - path.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:135324.5 %
Date:2024-04-08 14:58:22Functions:3837.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_Z11append_fileRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_b0
_Z11concat_pathRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_547
_Z11concat_pathRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_S6_0
_Z12is_directoryRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE26
_Z14list_directoryRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt6vectorIS4_SaIS4_EE0
_Z15executable_pathB5cxx11v13
_Z16create_directoryRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmmm0
_Z26create_directory_recursiveRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmmm0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/kiss/src/path.cpp.gcov.html b/doc/coverageReport/libs/kiss/src/path.cpp.gcov.html deleted file mode 100644 index 7cc7b933a..000000000 --- a/doc/coverageReport/libs/kiss/src/path.cpp.gcov.html +++ /dev/null @@ -1,245 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/kiss/src/path.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/kiss/src - path.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:135324.5 %
Date:2024-04-08 14:58:22Functions:3837.5 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "kiss/path.h"
-       2             : 
-       3             : #ifdef WIN32
-       4             : #  include "windows.h"
-       5             : #  ifndef S_ISREG
-       6             : #    define S_ISREG(x) (((x) & S_IFMT) == S_IFREG)
-       7             : #  endif
-       8             : #  ifndef S_ISDIR
-       9             : #    define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR)
-      10             : #  endif
-      11             : #  include "sys/stat.h"
-      12             : #else
-      13             : #include <sys/types.h>
-      14             : #include <fcntl.h>
-      15             : #include <unistd.h>
-      16             : #include <dirent.h>
-      17             : #include "sys/stat.h"
-      18             : #endif
-      19             : 
-      20             : #include <stdexcept>
-      21             : #include <cstdio>
-      22             : 
-      23           0 : bool create_directory(const std::string &path, size_t user_permission,
-      24             :                 size_t group_permission, size_t other_permission) {
-      25             : #ifdef WIN32
-      26             :         BOOL result = ::CreateDirectoryA(path.c_str(), 0);
-      27             :         return result == TRUE;
-      28             : #else
-      29             :         mode_t m = 0;
-      30           0 :         m |= (user_permission << 6);
-      31           0 :         m |= (group_permission << 3);
-      32           0 :         m |= (other_permission << 0);
-      33           0 :         int result = mkdir(path.c_str(), m);
-      34           0 :         return (result == 0);
-      35             : #endif
-      36             : }
-      37             : 
-      38          26 : bool is_directory(const std::string &path) {
-      39             : #ifdef WIN32
-      40             :         struct _stat buf;
-      41             :         int result = _stat(path.c_str(), &buf);
-      42             :         if (result == 0 && S_ISDIR(buf.st_mode))
-      43             :                 return true;
-      44             :         else
-      45             :                 return false;
-      46             : #else
-      47             :         struct stat buf;
-      48          26 :         int result = stat(path.c_str(), &buf);
-      49          26 :         if (result == 0 && S_ISDIR(buf.st_mode))
-      50             :         return true;
-      51             :         else
-      52          26 :         return false;
-      53             : #endif
-      54             : }
-      55             : 
-      56           0 : bool list_directory(const std::string &directory,
-      57             :                 std::vector<std::string> &elements) {
-      58             : #ifdef WIN32
-      59             :         WIN32_FIND_DATA findData;
-      60             :         HANDLE hFind = FindFirstFileA((directory + "\\*.*").c_str(), &findData);
-      61             :         if (hFind == INVALID_HANDLE_VALUE)
-      62             :                 throw std::runtime_error("Failed to get directory list");
-      63             :         for (;;) {
-      64             :                 if (findData.cFileName[0] != '.') {
-      65             :                         elements.push_back(findData.cFileName);
-      66             :                 }
-      67             :                 if (FindNextFileA(hFind, &findData) == 0)
-      68             :                         break;
-      69             :         }
-      70             :         FindClose(hFind);
-      71             : #else
-      72           0 :         DIR* dir = opendir(directory.c_str());
-      73           0 :         if (dir == NULL)
-      74             :         return false;
-      75             :         dirent* entry;
-      76           0 :         while ((entry = readdir(dir)) != NULL) {
-      77           0 :                 if (entry->d_name[0] != '.') {
-      78           0 :                         elements.push_back(entry->d_name);
-      79             :                 }
-      80             :         }
-      81           0 :         closedir(dir);
-      82             : #endif
-      83           0 :         return true;
-      84             : }
-      85             : 
-      86           0 : bool create_directory_recursive(const std::string &dir, size_t user_permission,
-      87             :                 size_t group_permission, size_t other_permission) {
-      88             :         // split path
-      89           0 :         const char seperators[] = "\\/";
-      90             :         std::vector<std::string> elements;
-      91             :         std::string::size_type a, b;
-      92             :         a = dir.find_first_not_of(seperators), b = dir.find_first_of(seperators, a);
-      93           0 :         while (a != std::string::npos) {
-      94           0 :                 elements.push_back(dir.substr(a, b - a));
-      95             :                 a = dir.find_first_not_of(seperators, b), b = dir.find_first_of(
-      96             :                                 seperators, a);
-      97             :         }
-      98             : 
-      99             :         // create all non existing parts
-     100             :         std::string path;
-     101           0 :         for (size_t i = 0; i < elements.size(); i++) {
-     102             :                 path += elements[i];
-     103             :                 path += path_seperator;
-     104           0 :                 if (is_directory(path) == false)
-     105           0 :                         create_directory(path);
-     106             :         }
-     107             : 
-     108           0 :         return is_directory(dir);
-     109           0 : }
-     110             : 
-     111         547 : std::string concat_path(const std::string &a, const std::string &b) {
-     112         547 :         char last = *a.rbegin();
-     113         547 :         if (last == '\\' || last == '/')
-     114           0 :                 return a + b;
-     115             :         else
-     116        1094 :                 return a + path_seperator + b;
-     117             : 
-     118             : }
-     119             : 
-     120           0 : std::string concat_path(const std::string &a, const std::string &b,
-     121             :                 const std::string &c) {
-     122             :         std::string p = a;
-     123           0 :         if (*p.rbegin() != '\\' && *p.rbegin() != '/')
-     124             :                 p += path_seperator;
-     125             :         p += b;
-     126           0 :         if (*p.rbegin() != '\\' && *p.rbegin() != '/')
-     127             :                 p += path_seperator;
-     128             :         p += c;
-     129           0 :         return p;
-     130             : }
-     131             : 
-     132           0 : void append_file(const std::string &target, const std::string &source,
-     133             :                 bool binary) {
-     134           0 :         FILE *t = fopen(target.c_str(), binary ? "wb+" : "w+");
-     135           0 :         if (t == NULL)
-     136           0 :                 return;
-     137             : 
-     138           0 :         FILE *s = fopen(source.c_str(), binary ? "rb" : "r");
-     139           0 :         if (s == NULL) {
-     140           0 :                 fclose(t);
-     141           0 :                 return;
-     142             :         }
-     143             : 
-     144             :         size_t size = 0;
-     145             :         char buffer[1 << 20];
-     146           0 :         while ((size = fread(buffer, 1, sizeof(buffer), s)) > 0) {
-     147           0 :                 fwrite(buffer, 1, size, t);
-     148             :         }
-     149             : 
-     150           0 :         fclose(t);
-     151           0 :         fclose(s);
-     152             : }
-     153             : 
-     154          13 : std::string executable_path() {
-     155             :         char buf[1024];
-     156             : 
-     157             : //#if linux
-     158          13 :         size_t len = readlink("/proc/self/exe", buf, sizeof(buf)-1);
-     159             : //#else
-     160             : //      size_t len = ::GetModuleFileName(NULL, buf, sizeof(buf)-1 );
-     161             : //#endif
-     162         192 :         for (size_t i = 1; i < len; i++) {
-     163         189 :                 if (buf[len - 1] == path_seperator)
-     164             :                         break;
-     165             :                 else
-     166             :                         len --;
-     167             :         }
-     168          13 :         return std::string(buf, len);
-     169             : }
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/kiss/src/string.cpp.func-sort-c.html b/doc/coverageReport/libs/kiss/src/string.cpp.func-sort-c.html deleted file mode 100644 index 43fcf0d21..000000000 --- a/doc/coverageReport/libs/kiss/src/string.cpp.func-sort-c.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/kiss/src/string.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/kiss/src - string.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:42714.8 %
Date:2024-04-08 14:58:22Functions:1714.3 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN4kiss10trim_rightERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_0
_ZN4kiss11starts_withERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_0
_ZN4kiss4trimERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_0
_ZN4kiss7explodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt6vectorIS5_SaIS5_EEbS7_0
_ZN4kiss7implodeERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS6_EERKS6_0
_ZN4kiss9trim_leftERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_0
_ZN4kiss9ends_withERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_3
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/kiss/src/string.cpp.func.html b/doc/coverageReport/libs/kiss/src/string.cpp.func.html deleted file mode 100644 index a35b5f6ae..000000000 --- a/doc/coverageReport/libs/kiss/src/string.cpp.func.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/kiss/src/string.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/kiss/src - string.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:42714.8 %
Date:2024-04-08 14:58:22Functions:1714.3 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN4kiss10trim_rightERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_0
_ZN4kiss11starts_withERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_0
_ZN4kiss4trimERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_0
_ZN4kiss7explodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt6vectorIS5_SaIS5_EEbS7_0
_ZN4kiss7implodeERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS6_EERKS6_0
_ZN4kiss9ends_withERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_3
_ZN4kiss9trim_leftERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/libs/kiss/src/string.cpp.gcov.html b/doc/coverageReport/libs/kiss/src/string.cpp.gcov.html deleted file mode 100644 index af1671ddc..000000000 --- a/doc/coverageReport/libs/kiss/src/string.cpp.gcov.html +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - libs/kiss/src/string.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - libs/kiss/src - string.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:42714.8 %
Date:2024-04-08 14:58:22Functions:1714.3 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "kiss/string.h"
-       2             : 
-       3             : #include <iostream>
-       4             : #include <string>
-       5             : #include <vector>
-       6             : 
-       7             : namespace kiss {
-       8             : 
-       9           0 : std::string trim_right(const std::string &s, const std::string &t) {
-      10             :         std::string::size_type i(s.find_last_not_of(t));
-      11             : 
-      12           0 :         if (i == std::string::npos)
-      13           0 :                 return "";
-      14             :         else
-      15           0 :                 return std::string(s, 0, i);
-      16             : }
-      17             : 
-      18           0 : std::string trim_left(const std::string &s, const std::string &t) {
-      19           0 :         return std::string(s, s.find_first_not_of(t));
-      20             : }
-      21             : 
-      22           0 : std::string trim(const std::string &s, const std::string &t) {
-      23             :         std::string::size_type a = s.find_first_not_of(t);
-      24             :         std::string::size_type b = s.find_last_not_of(t);
-      25             : 
-      26           0 :         if (a == std::string::npos || b == std::string::npos)
-      27           0 :                 return "";
-      28             : 
-      29           0 :         return std::string(s, a, b - a + 1);
-      30             : }
-      31             : 
-      32           0 : void explode(const std::string &s, std::vector<std::string> &v,
-      33             :                 const bool trim_spaces, const std::string &t) {
-      34             :         std::string::size_type a, b;
-      35             : 
-      36             :         a = s.find_first_not_of(t), b = s.find_first_of(t, a);
-      37             : 
-      38           0 :         while (a != std::string::npos) {
-      39           0 :                 if (trim_spaces)
-      40           0 :                         v.push_back(trim(s.substr(a, b - a)));
-      41             :                 else
-      42           0 :                         v.push_back(s.substr(a, b - a));
-      43             : 
-      44             :                 a = s.find_first_not_of(t, b), b = s.find_first_of(t, a);
-      45             :         }
-      46           0 : }
-      47             : 
-      48           0 : std::string implode(const std::vector<std::string> &v, const std::string &t) {
-      49             :         unsigned int i;
-      50             :         std::string s;
-      51             : 
-      52           0 :         for (i = 0; i < (v.size() - 1); i++) {
-      53             :                 s.append(v[i]);
-      54             :                 s.append(t);
-      55             :         }
-      56             : 
-      57           0 :         return s + v[i];
-      58             : }
-      59             : 
-      60           3 : bool ends_with(const std::string &s, const std::string &w) {
-      61           3 :         if (s.size() < w.size())
-      62             :                 return false;
-      63             :         std::string::const_reverse_iterator si = s.rbegin();
-      64             :         std::string::const_reverse_iterator wi = w.rbegin();
-      65           3 :         while (wi != w.rend()) {
-      66           3 :                 if (*wi != *si)
-      67             :                         return false;
-      68             :                 wi++;
-      69             :                 si++;
-      70             :         }
-      71             : 
-      72             :         return true;
-      73             : }
-      74             : 
-      75           0 : bool starts_with(const std::string &s, const std::string &w) {
-      76           0 :         if (s.size() < w.size())
-      77             :                 return false;
-      78             :         std::string::const_iterator si = s.begin();
-      79             :         std::string::const_iterator wi = w.begin();
-      80           0 :         while (wi != w.end()) {
-      81           0 :                 if (*wi != *si)
-      82             :                         return false;
-      83             :                 wi++;
-      84             :                 si++;
-      85             :         }
-      86             :         return true;
-      87             : }
-      88             : 
-      89             : } // namespace kiss
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/ruby.png b/doc/coverageReport/ruby.png deleted file mode 100644 index 991b6d4ec9e78be165e3ef757eed1aada287364d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 141 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga>?NMQuI!iC1^FceV#7`HfI^%F z9+AZi4BSE>%y{W;-5;PJOS+@4BLl<6e(pbstUx|nfKQ0)e^Y%R^MdiLxj>4`)5S5Q b;#P73kj=!v_*DHKNFRfztDnm{r-UW|iOwIS diff --git a/doc/coverageReport/snow.png b/doc/coverageReport/snow.png deleted file mode 100644 index 2cdae107fceec6e7f02ac7acb4a34a82a540caa5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 141 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga>?NMQuI!iC1^MM!lvI6;R0X`wF|Ns97GD8ntt^-nBo-U3d c6}OTTfNUlP#;5A{K>8RwUHx3vIVCg!071?oo&W#< diff --git a/doc/coverageReport/src/Candidate.cpp.func-sort-c.html b/doc/coverageReport/src/Candidate.cpp.func-sort-c.html deleted file mode 100644 index b34d8b8c1..000000000 --- a/doc/coverageReport/src/Candidate.cpp.func-sort-c.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Candidate.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Candidate.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:12914787.8 %
Date:2024-04-08 14:58:22Functions:333594.3 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa9Candidate16clearSecondariesEv0
_ZNK7crpropa9Candidate14getDescriptionB5cxx11Ev0
_ZN7crpropa9Candidate19setNextSerialNumberEm1
_ZN7crpropa9Candidate7restartEv1
_ZN7crpropa9Candidate12addSecondaryEiddNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE2
_ZN7crpropa9Candidate12addSecondaryEPS0_4
_ZN7crpropa9Candidate12updateWeightEd5
_ZN7crpropa9Candidate14removePropertyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE5
_ZN7crpropa9Candidate19getNextSerialNumberEv6
_ZN7crpropa9Candidate15setSerialNumberEm11
_ZNK7crpropa9Candidate11getPropertyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE11
_ZN7crpropa9CandidateC2ERKNS_13ParticleStateE20
_ZNK7crpropa9Candidate11hasPropertyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE30
_ZNK7crpropa9Candidate5cloneEb30
_ZNK7crpropa9Candidate22getCreatedSerialNumberEv48
_ZNK7crpropa9Candidate21getSourceSerialNumberEv49
_ZNK7crpropa9Candidate12getTagOriginB5cxx11Ev61
_ZNK7crpropa9Candidate15getSerialNumberEv84
_ZNK7crpropa9Candidate9getWeightEv1064
_ZN7crpropa9Candidate11setPropertyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_7VariantE1143
_ZN7crpropa9Candidate9setActiveEb1742
_ZNK7crpropa9Candidate8isActiveEv21336
_ZNK7crpropa9Candidate14getCurrentStepEv63001
_ZNK7crpropa9Candidate11getNextStepEv499385
_ZN7crpropa9Candidate11setNextStepEd499400
_ZN7crpropa9Candidate14setCurrentStepEd501076
_ZNK7crpropa9Candidate11getRedshiftEv529541
_ZN7crpropa9Candidate13limitNextStepEd530052
_ZNK7crpropa9Candidate19getTrajectoryLengthEv1011718
_ZN7crpropa9Candidate12addSecondaryEidNS_7Vector3IdEEdNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE3324908
_ZN7crpropa9Candidate12setTagOriginENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE3324912
_ZN7crpropa9Candidate19setTrajectoryLengthEd3324939
_ZN7crpropa9Candidate9setWeightEd3325923
_ZN7crpropa9Candidate11setRedshiftEd3332752
_ZN7crpropa9CandidateC2EidNS_7Vector3IdEES2_ddNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE3368851
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Candidate.cpp.func.html b/doc/coverageReport/src/Candidate.cpp.func.html deleted file mode 100644 index 4a0c5e726..000000000 --- a/doc/coverageReport/src/Candidate.cpp.func.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Candidate.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Candidate.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:12914787.8 %
Date:2024-04-08 14:58:22Functions:333594.3 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa9Candidate11setNextStepEd499400
_ZN7crpropa9Candidate11setPropertyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_7VariantE1143
_ZN7crpropa9Candidate11setRedshiftEd3332752
_ZN7crpropa9Candidate12addSecondaryEPS0_4
_ZN7crpropa9Candidate12addSecondaryEidNS_7Vector3IdEEdNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE3324908
_ZN7crpropa9Candidate12addSecondaryEiddNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE2
_ZN7crpropa9Candidate12setTagOriginENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE3324912
_ZN7crpropa9Candidate12updateWeightEd5
_ZN7crpropa9Candidate13limitNextStepEd530052
_ZN7crpropa9Candidate14removePropertyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE5
_ZN7crpropa9Candidate14setCurrentStepEd501076
_ZN7crpropa9Candidate15setSerialNumberEm11
_ZN7crpropa9Candidate16clearSecondariesEv0
_ZN7crpropa9Candidate19getNextSerialNumberEv6
_ZN7crpropa9Candidate19setNextSerialNumberEm1
_ZN7crpropa9Candidate19setTrajectoryLengthEd3324939
_ZN7crpropa9Candidate7restartEv1
_ZN7crpropa9Candidate9setActiveEb1742
_ZN7crpropa9Candidate9setWeightEd3325923
_ZN7crpropa9CandidateC2ERKNS_13ParticleStateE20
_ZN7crpropa9CandidateC2EidNS_7Vector3IdEES2_ddNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE3368851
_ZNK7crpropa9Candidate11getNextStepEv499385
_ZNK7crpropa9Candidate11getPropertyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE11
_ZNK7crpropa9Candidate11getRedshiftEv529541
_ZNK7crpropa9Candidate11hasPropertyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE30
_ZNK7crpropa9Candidate12getTagOriginB5cxx11Ev61
_ZNK7crpropa9Candidate14getCurrentStepEv63001
_ZNK7crpropa9Candidate14getDescriptionB5cxx11Ev0
_ZNK7crpropa9Candidate15getSerialNumberEv84
_ZNK7crpropa9Candidate19getTrajectoryLengthEv1011718
_ZNK7crpropa9Candidate21getSourceSerialNumberEv49
_ZNK7crpropa9Candidate22getCreatedSerialNumberEv48
_ZNK7crpropa9Candidate5cloneEb30
_ZNK7crpropa9Candidate8isActiveEv21336
_ZNK7crpropa9Candidate9getWeightEv1064
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Candidate.cpp.gcov.html b/doc/coverageReport/src/Candidate.cpp.gcov.html deleted file mode 100644 index 07a4b2a2a..000000000 --- a/doc/coverageReport/src/Candidate.cpp.gcov.html +++ /dev/null @@ -1,331 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Candidate.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Candidate.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:12914787.8 %
Date:2024-04-08 14:58:22Functions:333594.3 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/Candidate.h"
-       2             : #include "crpropa/ParticleID.h"
-       3             : #include "crpropa/Units.h"
-       4             : 
-       5             : #include <stdexcept>
-       6             : 
-       7             : namespace crpropa {
-       8             : 
-       9     3368851 : Candidate::Candidate(int id, double E, Vector3d pos, Vector3d dir, double z, double weight, std::string tagOrigin) :
-      10     3368851 :   redshift(z), trajectoryLength(0), weight(weight), currentStep(0), nextStep(0), active(true), parent(0), tagOrigin(tagOrigin) {
-      11     3368851 :         ParticleState state(id, E, pos, dir);
-      12             :         source = state;
-      13             :         created = state;
-      14             :         previous = state;
-      15             :         current = state;
-      16             : 
-      17             : #if defined(OPENMP_3_1)
-      18             :                 #pragma omp atomic capture
-      19             :                 {serialNumber = nextSerialNumber++;}
-      20             : #elif defined(__GNUC__)
-      21     3368851 :                 {serialNumber = __sync_add_and_fetch(&nextSerialNumber, 1);}
-      22             : #else
-      23             :                 #pragma omp critical
-      24             :                 {serialNumber = nextSerialNumber++;}
-      25             : #endif
-      26             : 
-      27     3368851 : }
-      28             : 
-      29          20 : Candidate::Candidate(const ParticleState &state) :
-      30          20 :                 source(state), created(state), current(state), previous(state), redshift(0), trajectoryLength(0), currentStep(0), nextStep(0), active(true), parent(0), tagOrigin ("PRIM") {
-      31             : 
-      32             : #if defined(OPENMP_3_1)
-      33             :                 #pragma omp atomic capture
-      34             :                 {serialNumber = nextSerialNumber++;}
-      35             : #elif defined(__GNUC__)
-      36          20 :                 {serialNumber = __sync_add_and_fetch(&nextSerialNumber, 1);}
-      37             : #else
-      38             :                 #pragma omp critical
-      39             :                 {serialNumber = nextSerialNumber++;}
-      40             : #endif
-      41             : 
-      42          20 : }
-      43             : 
-      44       21336 : bool Candidate::isActive() const {
-      45       21336 :         return active;
-      46             : }
-      47             : 
-      48        1742 : void Candidate::setActive(bool b) {
-      49        1742 :         active = b;
-      50        1742 : }
-      51             : 
-      52      529541 : double Candidate::getRedshift() const {
-      53      529541 :         return redshift;
-      54             : }
-      55             : 
-      56     1011718 : double Candidate::getTrajectoryLength() const {
-      57     1011718 :         return trajectoryLength;
-      58             : }
-      59             : 
-      60        1064 : double Candidate::getWeight() const {
-      61        1064 :         return weight;
-      62             : }
-      63             : 
-      64       63001 : double Candidate::getCurrentStep() const {
-      65       63001 :         return currentStep;
-      66             : }
-      67             : 
-      68      499385 : double Candidate::getNextStep() const {
-      69      499385 :         return nextStep;
-      70             : }
-      71             : 
-      72     3332752 : void Candidate::setRedshift(double z) {
-      73     3332752 :         redshift = z;
-      74     3332752 : }
-      75             : 
-      76     3324939 : void Candidate::setTrajectoryLength(double a) {
-      77     3324939 :         trajectoryLength = a;
-      78     3324939 : }
-      79             : 
-      80     3325923 : void Candidate::setWeight(double w) {
-      81     3325923 :         weight = w;
-      82     3325923 : }
-      83             : 
-      84           5 : void Candidate::updateWeight(double w) {
-      85           5 :   weight *= w;
-      86           5 : }
-      87             : 
-      88      501076 : void Candidate::setCurrentStep(double lstep) {
-      89      501076 :         currentStep = lstep;
-      90      501076 :         trajectoryLength += lstep;
-      91      501076 : }
-      92             : 
-      93      499400 : void Candidate::setNextStep(double step) {
-      94      499400 :         nextStep = step;
-      95      499400 : }
-      96             : 
-      97      530052 : void Candidate::limitNextStep(double step) {
-      98      530052 :         nextStep = std::min(nextStep, step);
-      99      530052 : }
-     100             : 
-     101        1143 : void Candidate::setProperty(const std::string &name, const Variant &value) {
-     102        1143 :         properties[name] = value;
-     103        1143 : }
-     104             : 
-     105     3324912 : void Candidate::setTagOrigin (std::string tagOrigin) {
-     106     3324912 :         this->tagOrigin = tagOrigin;
-     107     3324912 : }
-     108             : 
-     109          61 : std::string Candidate::getTagOrigin () const {
-     110          61 :         return tagOrigin;
-     111             : }
-     112             : 
-     113          11 : const Variant &Candidate::getProperty(const std::string &name) const {
-     114          11 :         PropertyMap::const_iterator i = properties.find(name);
-     115          11 :         if (i == properties.end())
-     116           0 :                 throw std::runtime_error("Unknown candidate property: " + name);
-     117          11 :         return i->second;
-     118             : }
-     119             : 
-     120           5 : bool Candidate::removeProperty(const std::string& name) {
-     121           5 :         PropertyMap::iterator i = properties.find(name);
-     122           5 :         if (i == properties.end())
-     123             :                 return false;
-     124             :         properties.erase(i);
-     125             :         return true;
-     126             : }
-     127             : 
-     128          30 : bool Candidate::hasProperty(const std::string &name) const {
-     129          30 :         PropertyMap::const_iterator i = properties.find(name);
-     130          30 :         if (i == properties.end())
-     131          10 :                 return false;
-     132             :         return true;
-     133             : }
-     134             : 
-     135           4 : void Candidate::addSecondary(Candidate *c) {
-     136           4 :         secondaries.push_back(c);
-     137           4 : }
-     138             : 
-     139           2 : void Candidate::addSecondary(int id, double energy, double w, std::string tagOrigin) {
-     140           4 :         ref_ptr<Candidate> secondary = new Candidate;
-     141           2 :         secondary->setRedshift(redshift);
-     142           2 :         secondary->setTrajectoryLength(trajectoryLength);
-     143           2 :         secondary->setWeight(weight * w);
-     144           4 :         secondary->setTagOrigin(tagOrigin);
-     145           2 :         for (PropertyMap::const_iterator it = properties.begin(); it != properties.end(); ++it) {
-     146           0 :                 secondary->setProperty(it->first, it->second);         
-     147             :         }
-     148             :         secondary->source = source;
-     149             :         secondary->previous = previous;
-     150             :         secondary->created = previous;
-     151           2 :         secondary->current = current;
-     152           2 :         secondary->current.setId(id);
-     153           2 :         secondary->current.setEnergy(energy);
-     154           2 :         secondary->parent = this;
-     155           2 :         secondaries.push_back(secondary);
-     156           2 : }
-     157             : 
-     158     3324908 : void Candidate::addSecondary(int id, double energy, Vector3d position, double w, std::string tagOrigin) {
-     159     6649816 :         ref_ptr<Candidate> secondary = new Candidate;
-     160     3324908 :         secondary->setRedshift(redshift);
-     161     3324908 :         secondary->setTrajectoryLength(trajectoryLength - (current.getPosition() - position).getR());
-     162     3324908 :         secondary->setWeight(weight * w);
-     163     6649816 :         secondary->setTagOrigin(tagOrigin);
-     164     3324908 :         for (PropertyMap::const_iterator it = properties.begin(); it != properties.end(); ++it) {
-     165           0 :                 secondary->setProperty(it->first, it->second);         
-     166             :         }
-     167             :         secondary->source = source;
-     168             :         secondary->previous = previous;
-     169     3324908 :         secondary->created = previous;
-     170     3324908 :         secondary->current = current;
-     171     3324908 :         secondary->current.setId(id);
-     172     3324908 :         secondary->current.setEnergy(energy);
-     173     3324908 :         secondary->current.setPosition(position);
-     174     3324908 :         secondary->created.setPosition(position);
-     175     3324908 :         secondary->parent = this;
-     176     3324908 :         secondaries.push_back(secondary);
-     177     3324908 : }
-     178             : 
-     179           0 : void Candidate::clearSecondaries() {
-     180           0 :         secondaries.clear();
-     181           0 : }
-     182             : 
-     183           0 : std::string Candidate::getDescription() const {
-     184           0 :         std::stringstream ss;
-     185           0 :         ss << "CosmicRay at z = " << getRedshift() << "\n";
-     186           0 :         ss << "  source:  " << source.getDescription() << "\n";
-     187           0 :         ss << "  current: " << current.getDescription();
-     188           0 :         return ss.str();
-     189           0 : }
-     190             : 
-     191          30 : ref_ptr<Candidate> Candidate::clone(bool recursive) const {
-     192          60 :         ref_ptr<Candidate> cloned = new Candidate;
-     193             :         cloned->source = source;
-     194             :         cloned->created = created;
-     195             :         cloned->current = current;
-     196             :         cloned->previous = previous;
-     197             : 
-     198          30 :         cloned->properties = properties;
-     199          30 :         cloned->active = active;
-     200          30 :         cloned->redshift = redshift;
-     201          30 :         cloned->weight = weight;
-     202          30 :         cloned->trajectoryLength = trajectoryLength;
-     203          30 :         cloned->currentStep = currentStep;
-     204          30 :         cloned->nextStep = nextStep;
-     205          30 :         if (recursive) {
-     206           0 :                 cloned->secondaries.reserve(secondaries.size());
-     207           0 :                 for (size_t i = 0; i < secondaries.size(); i++) {
-     208           0 :                         ref_ptr<Candidate> s = secondaries[i]->clone(recursive);
-     209           0 :                         s->parent = cloned;
-     210           0 :                         cloned->secondaries.push_back(s);
-     211             :                 }
-     212             :         }
-     213          30 :         return cloned;
-     214             : }
-     215             : 
-     216          84 : uint64_t Candidate::getSerialNumber() const {
-     217          84 :         return serialNumber;
-     218             : }
-     219             : 
-     220          11 : void Candidate::setSerialNumber(const uint64_t snr) {
-     221          11 :         serialNumber = snr;
-     222          11 : }
-     223             : 
-     224          49 : uint64_t Candidate::getSourceSerialNumber() const {
-     225          84 :         if (parent)
-     226             :                 return parent->getSourceSerialNumber();
-     227             :         else
-     228          49 :                 return serialNumber;
-     229             : }
-     230             : 
-     231          48 : uint64_t Candidate::getCreatedSerialNumber() const {
-     232          48 :         if (parent)
-     233          35 :                 return parent->getSerialNumber();
-     234             :         else
-     235          13 :                 return serialNumber;
-     236             : }
-     237             : 
-     238           1 : void Candidate::setNextSerialNumber(uint64_t snr) {
-     239           1 :         nextSerialNumber = snr;
-     240           1 : }
-     241             : 
-     242           6 : uint64_t Candidate::getNextSerialNumber() {
-     243           6 :         return nextSerialNumber;
-     244             : }
-     245             : 
-     246             : uint64_t Candidate::nextSerialNumber = 0;
-     247             : 
-     248           1 : void Candidate::restart() {
-     249           1 :         setActive(true);
-     250           1 :         setTrajectoryLength(0);
-     251             :         previous = source;
-     252             :         current = source;
-     253           1 : }
-     254             : 
-     255             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Clock.cpp.func-sort-c.html b/doc/coverageReport/src/Clock.cpp.func-sort-c.html deleted file mode 100644 index 3a192f2e6..000000000 --- a/doc/coverageReport/src/Clock.cpp.func-sort-c.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Clock.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Clock.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0270.0 %
Date:2024-04-08 14:58:22Functions:080.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa5Clock11getInstanceEv0
_ZN7crpropa5Clock14getMillisecondEv0
_ZN7crpropa5Clock4Impl7getTimeEv0
_ZN7crpropa5Clock5resetEv0
_ZN7crpropa5Clock9getSecondEv0
_ZN7crpropa5ClockC2Ev0
_ZN7crpropa5ClockD0Ev0
_ZN7crpropa5ClockD2Ev0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Clock.cpp.func.html b/doc/coverageReport/src/Clock.cpp.func.html deleted file mode 100644 index 5e2c004bd..000000000 --- a/doc/coverageReport/src/Clock.cpp.func.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Clock.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Clock.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0270.0 %
Date:2024-04-08 14:58:22Functions:080.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa5Clock11getInstanceEv0
_ZN7crpropa5Clock14getMillisecondEv0
_ZN7crpropa5Clock4Impl7getTimeEv0
_ZN7crpropa5Clock5resetEv0
_ZN7crpropa5Clock9getSecondEv0
_ZN7crpropa5ClockC2Ev0
_ZN7crpropa5ClockD0Ev0
_ZN7crpropa5ClockD2Ev0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Clock.cpp.gcov.html b/doc/coverageReport/src/Clock.cpp.gcov.html deleted file mode 100644 index 1175dfb35..000000000 --- a/doc/coverageReport/src/Clock.cpp.gcov.html +++ /dev/null @@ -1,231 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Clock.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Clock.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0270.0 %
Date:2024-04-08 14:58:22Functions:080.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/Clock.h"
-       2             : 
-       3             : #if defined(WIN32) || defined(_WIN32)
-       4             : 
-       5             : #define USE_WINDOWS_TIMERS
-       6             : #define WIN32_LEAN_AND_MEAN
-       7             : #define NOWINRES
-       8             : #define NOMCX
-       9             : #define NOIME
-      10             : #ifdef _XBOX
-      11             : #include <Xtl.h>
-      12             : #else
-      13             : #include <windows.h>
-      14             : #endif
-      15             : #include <ctime>
-      16             : 
-      17             : #else
-      18             : #include <sys/time.h>
-      19             : #endif
-      20             : 
-      21             : #include <algorithm>
-      22             : #ifdef _OPENMP
-      23             : #include <omp.h>
-      24             : #include <stdexcept>
-      25             : #endif
-      26             : 
-      27             : namespace crpropa {
-      28             : 
-      29             : #ifdef WIN32
-      30             : class Clock::Impl {
-      31             :         LARGE_INTEGER clockFrequency;
-      32             :         DWORD startTick;
-      33             :         LONGLONG prevElapsedTime;
-      34             :         LARGE_INTEGER startTime;
-      35             : public:
-      36             :         Impl() {
-      37             :                 QueryPerformanceFrequency(&clockFrequency);
-      38             :                 reset();
-      39             :         }
-      40             : 
-      41             :         void reset() {
-      42             :                 QueryPerformanceCounter(&startTime);
-      43             :                 startTick = GetTickCount();
-      44             :                 prevElapsedTime = 0;
-      45             :         }
-      46             : 
-      47             :         /// Returns the time in ms since the last call to reset or since
-      48             :         /// the btClock was created.
-      49             :         double getSecond() {
-      50             :                 LARGE_INTEGER currentTime;
-      51             :                 QueryPerformanceCounter(&currentTime);
-      52             :                 LONGLONG elapsedTime = currentTime.QuadPart - startTime.QuadPart;
-      53             : 
-      54             :                 // Compute the number of millisecond ticks elapsed.
-      55             :                 unsigned long msecTicks = (unsigned long) (1000 * elapsedTime
-      56             :                                 / clockFrequency.QuadPart);
-      57             : 
-      58             :                 // Check for unexpected leaps in the Win32 performance counter.
-      59             :                 // (This is caused by unexpected data across the PCI to ISA
-      60             :                 // bridge, aka south bridge.  See Microsoft KB274323.)
-      61             :                 unsigned long elapsedTicks = GetTickCount() - startTick;
-      62             :                 signed long msecOff = (signed long) (msecTicks - elapsedTicks);
-      63             :                 if (msecOff < -100 || msecOff > 100) {
-      64             :                         // Adjust the starting time forwards.
-      65             :                         LONGLONG msecAdjustment = std::min(
-      66             :                                         msecOff * clockFrequency.QuadPart / 1000,
-      67             :                                         elapsedTime - prevElapsedTime);
-      68             :                         startTime.QuadPart += msecAdjustment;
-      69             :                         elapsedTime -= msecAdjustment;
-      70             :                 }
-      71             : 
-      72             :                 // Store the current elapsed time for adjustments next time.
-      73             :                 prevElapsedTime = elapsedTime;
-      74             : 
-      75             :                 // Convert to microseconds.
-      76             :                 unsigned long usecTicks = (unsigned long) (1000000 * elapsedTime
-      77             :                                 / clockFrequency.QuadPart);
-      78             : 
-      79             :                 return double(usecTicks) / 1000000;
-      80             :         }
-      81             : };
-      82             : #else
-      83             : 
-      84             : class Clock::Impl {
-      85             :         struct timeval startTime;
-      86             : public:
-      87           0 :         Impl() {
-      88             :                 reset();
-      89             :         }
-      90             : 
-      91             :         void reset() {
-      92           0 :                 gettimeofday(&startTime, 0);
-      93             :         }
-      94             : 
-      95             :         /// Returns the time in since the last call to reset or since
-      96             :         /// the btClock was created.
-      97           0 :         double getTime() {
-      98             :                 struct timeval currentTime;
-      99           0 :                 gettimeofday(&currentTime, 0);
-     100           0 :                 double t = double(currentTime.tv_sec - startTime.tv_sec);
-     101           0 :                 t += double(currentTime.tv_usec - startTime.tv_usec) / 1000000.;
-     102           0 :                 return t;
-     103             :         }
-     104             : };
-     105             : #endif
-     106             : 
-     107           0 : Clock::Clock() {
-     108           0 :         impl = new Impl;
-     109           0 : }
-     110             : 
-     111           0 : Clock::~Clock() {
-     112           0 :         delete impl;
-     113           0 : }
-     114             : 
-     115           0 : void Clock::reset() {
-     116           0 :         impl->reset();
-     117           0 : }
-     118             : 
-     119           0 : double Clock::getSecond() {
-     120           0 :         return impl->getTime();
-     121             : }
-     122             : 
-     123           0 : double Clock::getMillisecond() {
-     124           0 :         return impl->getTime() * 1000;
-     125             : }
-     126             : 
-     127             : #ifdef _OPENMP
-     128             : 
-     129             : // see http://stackoverflow.com/questions/8051108/using-the-openmp-threadprivate-directive-on-static-instances-of-c-stl-types
-     130             : const static int MAX_THREAD = 256;
-     131             : 
-     132           0 : struct CLOCK_TLS_ITEM {
-     133             :         Clock r;
-     134             :         char padding[(sizeof(Clock) / 64 + 1) * 64 - sizeof(Clock)];
-     135             : };
-     136             : 
-     137           0 : Clock &Clock::getInstance() {
-     138             : #ifdef _MSC_VER
-     139             :         __declspec(align(64)) static CLOCK_TLS_ITEM tls[MAX_THREAD];
-     140             : #else
-     141           0 :         __attribute__ ((aligned(64))) static CLOCK_TLS_ITEM tls[MAX_THREAD];
-     142             : #endif
-     143           0 :         int i = omp_get_thread_num();
-     144           0 :         if (i >= MAX_THREAD)
-     145           0 :         throw std::runtime_error("crpropa::Clock: more than MAX_THREAD threads!");
-     146           0 :         return tls[i].r;
-     147             : }
-     148             : #else
-     149             : Clock &Clock::getInstance() {
-     150             :         static Clock r;
-     151             :         return r;
-     152             : }
-     153             : #endif
-     154             : 
-     155             : } /* namespace scs */
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Common.cpp.func-sort-c.html b/doc/coverageReport/src/Common.cpp.func-sort-c.html deleted file mode 100644 index 8b8e54c80..000000000 --- a/doc/coverageReport/src/Common.cpp.func-sort-c.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Common.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Common.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:486277.4 %
Date:2024-04-08 14:58:22Functions:5683.3 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16getInstallPrefixB5cxx11Ev0
_ZN7crpropa11getDataPathENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE547
_ZN7crpropa12closestIndexEdRKSt6vectorIdSaIdEE565
_ZN7crpropa22interpolateEquidistantEdddRKSt6vectorIdSaIdEE1528
_ZN7crpropa11interpolateEdRKSt6vectorIdSaIdEES4_158374
_ZN7crpropa13interpolate2dEddRKSt6vectorIdSaIdEES4_S4_9536930
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Common.cpp.func.html b/doc/coverageReport/src/Common.cpp.func.html deleted file mode 100644 index b7cf2d004..000000000 --- a/doc/coverageReport/src/Common.cpp.func.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Common.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Common.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:486277.4 %
Date:2024-04-08 14:58:22Functions:5683.3 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11getDataPathENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE547
_ZN7crpropa11interpolateEdRKSt6vectorIdSaIdEES4_158374
_ZN7crpropa12closestIndexEdRKSt6vectorIdSaIdEE565
_ZN7crpropa13interpolate2dEddRKSt6vectorIdSaIdEES4_S4_9536930
_ZN7crpropa16getInstallPrefixB5cxx11Ev0
_ZN7crpropa22interpolateEquidistantEdddRKSt6vectorIdSaIdEE1528
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Common.cpp.gcov.html b/doc/coverageReport/src/Common.cpp.gcov.html deleted file mode 100644 index 485f15540..000000000 --- a/doc/coverageReport/src/Common.cpp.gcov.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Common.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Common.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:486277.4 %
Date:2024-04-08 14:58:22Functions:5683.3 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/Common.h"
-       2             : 
-       3             : #include "kiss/path.h"
-       4             : #include "kiss/logger.h"
-       5             : 
-       6             : #include <cstdlib>
-       7             : #include <fstream>
-       8             : #include <string>
-       9             : #include <cmath>
-      10             : #include <algorithm>
-      11             : 
-      12             : #define index(i,j) ((j)+(i)*Y.size())
-      13             : 
-      14             : namespace crpropa {
-      15             : 
-      16         547 : std::string getDataPath(std::string filename) {
-      17         547 :         static std::string dataPath;
-      18         547 :         if (dataPath.size())
-      19         534 :                 return concat_path(dataPath, filename);
-      20             : 
-      21          13 :         const char *env_path = getenv("CRPROPA_DATA_PATH");
-      22          13 :         if (env_path) {
-      23           0 :                 if (is_directory(env_path)) {
-      24             :                         dataPath = env_path;
-      25           0 :                         KISS_LOG_INFO << "getDataPath: use environment variable, "
-      26           0 :                                         << dataPath << std::endl;
-      27           0 :                         return concat_path(dataPath, filename);
-      28             :                 }
-      29             :         }
-      30             : 
-      31             : #ifdef CRPROPA_INSTALL_PREFIX
-      32             :         {
-      33          13 :                 std::string _path = CRPROPA_INSTALL_PREFIX "/share/crpropa";
-      34          13 :                 if (is_directory(_path)) {
-      35             :                         dataPath = _path;
-      36           0 :                         KISS_LOG_INFO
-      37           0 :                         << "getDataPath: use install prefix, " << dataPath << std::endl;
-      38           0 :                         return concat_path(dataPath, filename);
-      39             :                 }
-      40             :         }
-      41             : #endif
-      42             : 
-      43             :         {
-      44          13 :                 std::string _path = executable_path() + "../data";
-      45          13 :                 if (is_directory(_path)) {
-      46             :                         dataPath = _path;
-      47           0 :                         KISS_LOG_INFO << "getDataPath: use executable path, " << dataPath
-      48           0 :                                         << std::endl;
-      49           0 :                         return concat_path(dataPath, filename);
-      50             :                 }
-      51             :         }
-      52             : 
-      53             :         dataPath = "data";
-      54          13 :         KISS_LOG_INFO << "getDataPath: use default, " << dataPath << std::endl;
-      55          13 :         return concat_path(dataPath, filename);
-      56             : }
-      57             : 
-      58             : 
-      59           0 : std::string getInstallPrefix()
-      60             : {
-      61           0 :   std::string _path = "";
-      62             :   #ifdef CRPROPA_INSTALL_PREFIX
-      63             :     _path += CRPROPA_INSTALL_PREFIX;
-      64             :   #endif
-      65           0 :   return _path;
-      66             : };
-      67             : 
-      68      158374 : double interpolate(double x, const std::vector<double> &X,
-      69             :                 const std::vector<double> &Y) {
-      70             :         std::vector<double>::const_iterator it = std::upper_bound(X.begin(),
-      71             :                         X.end(), x);
-      72      158374 :         if (it == X.begin())
-      73           1 :                 return Y.front();
-      74      158373 :         if (it == X.end())
-      75           1 :                 return Y.back();
-      76             : 
-      77             :         size_t i = it - X.begin() - 1;
-      78      158372 :         return Y[i] + (x - X[i]) * (Y[i + 1] - Y[i]) / (X[i + 1] - X[i]);
-      79             : }
-      80             : 
-      81     9536930 : double interpolate2d(double x, double y, const std::vector<double> &X,
-      82             :                 const std::vector<double> &Y, const std::vector<double> &Z) {
-      83             : 
-      84             :         std::vector<double>::const_iterator itx = std::upper_bound(X.begin(), X.end(), x);
-      85             :         std::vector<double>::const_iterator ity = std::upper_bound(Y.begin(), Y.end(), y);
-      86             : 
-      87     9536930 :         if (x > X.back() || x < X.front())
-      88             :                 return 0;
-      89     9536930 :         if (y > Y.back() || y < Y.front())
-      90             :                 return 0;
-      91             : 
-      92     9536930 :         if (itx == X.begin() && ity == Y.begin())
-      93           0 :                 return Z.front();
-      94     9536930 :         if (itx == X.end() && ity == Y.end())
-      95          73 :                 return Z.back();
-      96             : 
-      97     9536857 :         size_t i = itx - X.begin() - 1;
-      98     9536857 :         size_t j = ity - Y.begin() - 1;
-      99             : 
-     100     9536857 :         double Q11 = Z[index(i,j)];
-     101     9536857 :         double Q12 = Z[index(i,j+1)];
-     102     9536857 :         double Q21 = Z[index(i+1,j)];
-     103     9536857 :         double Q22 = Z[index(i+1,j+1)];
-     104             : 
-     105     9536857 :         double R1 = ((X[i+1]-x)/(X[i+1]-X[i]))*Q11+((x-X[i])/(X[i+1]-X[i]))*Q21;
-     106     9536857 :         double R2 = ((X[i+1]-x)/(X[i+1]-X[i]))*Q12+((x-X[i])/(X[i+1]-X[i]))*Q22;
-     107             : 
-     108     9536857 :         return ((Y[j+1]-y)/(Y[j+1]-Y[j]))*R1+((y-Y[j])/(Y[j+1]-Y[j]))*R2;
-     109             : }
-     110             : 
-     111        1528 : double interpolateEquidistant(double x, double lo, double hi,
-     112             :                 const std::vector<double> &Y) {
-     113        1528 :         if (x <= lo)
-     114           1 :                 return Y.front();
-     115        1527 :         if (x >= hi)
-     116           1 :                 return Y.back();
-     117             : 
-     118        1526 :         double dx = (hi - lo) / (Y.size() - 1);
-     119        1526 :         double p = (x - lo) / dx;
-     120        1526 :         size_t i = floor(p);
-     121        1526 :         return Y[i] + (p - i) * (Y[i + 1] - Y[i]);
-     122             : }
-     123             : 
-     124         565 : size_t closestIndex(double x, const std::vector<double> &X) {
-     125         565 :         size_t i1 = std::lower_bound(X.begin(), X.end(), x) - X.begin();
-     126         565 :         if (i1 == 0)
-     127             :                 return i1;
-     128         565 :         size_t i0 = i1 - 1;
-     129         565 :         if (std::fabs(X[i0] - x) < std::fabs(X[i1] - x))
-     130             :                 return i0;
-     131             :         else
-     132         308 :                 return i1;
-     133             : }
-     134             : 
-     135             : } // namespace crpropa
-     136             : 
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Cosmology.cpp.func-sort-c.html b/doc/coverageReport/src/Cosmology.cpp.func-sort-c.html deleted file mode 100644 index 5faf01e27..000000000 --- a/doc/coverageReport/src/Cosmology.cpp.func-sort-c.html +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Cosmology.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Cosmology.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:449247.8 %
Date:2024-04-08 14:58:22Functions:61540.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa22setCosmologyParametersEdd0
_ZN7crpropa25redshift2ComovingDistanceEd0
_ZN7crpropa27luminosityDistance2RedshiftEd0
_ZN7crpropa27redshift2LuminosityDistanceEd0
_ZN7crpropa28lightTravelDistance2RedshiftEd0
_ZN7crpropa28redshift2LightTravelDistanceEd0
_ZN7crpropa2H0Ev0
_ZN7crpropa6omegaLEv0
_ZN7crpropa6omegaMEv0
_ZN7crpropa25comovingDistance2RedshiftEd1
_ZN7crpropa28lightTravel2ComovingDistanceEd1
_ZN7crpropa28comoving2LightTravelDistanceEd2
_ZN7crpropa9Cosmology6updateEv19
_ZN7crpropa9CosmologyC2Ev19
_ZN7crpropa10hubbleRateEd7623
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Cosmology.cpp.func.html b/doc/coverageReport/src/Cosmology.cpp.func.html deleted file mode 100644 index ea101710d..000000000 --- a/doc/coverageReport/src/Cosmology.cpp.func.html +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Cosmology.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Cosmology.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:449247.8 %
Date:2024-04-08 14:58:22Functions:61540.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa10hubbleRateEd7623
_ZN7crpropa22setCosmologyParametersEdd0
_ZN7crpropa25comovingDistance2RedshiftEd1
_ZN7crpropa25redshift2ComovingDistanceEd0
_ZN7crpropa27luminosityDistance2RedshiftEd0
_ZN7crpropa27redshift2LuminosityDistanceEd0
_ZN7crpropa28comoving2LightTravelDistanceEd2
_ZN7crpropa28lightTravel2ComovingDistanceEd1
_ZN7crpropa28lightTravelDistance2RedshiftEd0
_ZN7crpropa28redshift2LightTravelDistanceEd0
_ZN7crpropa2H0Ev0
_ZN7crpropa6omegaLEv0
_ZN7crpropa6omegaMEv0
_ZN7crpropa9Cosmology6updateEv19
_ZN7crpropa9CosmologyC2Ev19
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Cosmology.cpp.gcov.html b/doc/coverageReport/src/Cosmology.cpp.gcov.html deleted file mode 100644 index f85d7609e..000000000 --- a/doc/coverageReport/src/Cosmology.cpp.gcov.html +++ /dev/null @@ -1,245 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Cosmology.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Cosmology.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:449247.8 %
Date:2024-04-08 14:58:22Functions:61540.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/Cosmology.h"
-       2             : #include "crpropa/Units.h"
-       3             : #include "crpropa/Common.h"
-       4             : 
-       5             : #include <vector>
-       6             : #include <cmath>
-       7             : #include <stdexcept>
-       8             : 
-       9             : namespace crpropa {
-      10             : 
-      11             : /**
-      12             :  @class Cosmology
-      13             :  @brief Cosmology calculations
-      14             :  */
-      15             : struct Cosmology {
-      16             :         double H0; // Hubble parameter at z=0
-      17             :         double omegaM; // matter density parameter
-      18             :         double omegaL; // vacuum energy parameter
-      19             : 
-      20             :         static const int n;
-      21             :         static const double zmin;
-      22             :         static const double zmax;
-      23             : 
-      24             :         std::vector<double> Z;  // redshift
-      25             :         std::vector<double> Dc; // comoving distance [m]
-      26             :         std::vector<double> Dl; // luminosity distance [m]
-      27             :         std::vector<double> Dt; // light travel distance [m]
-      28             : 
-      29          19 :         void update() {
-      30          19 :                 double dH = c_light / H0; // Hubble distance
-      31             : 
-      32          19 :                 std::vector<double> E(n);
-      33          19 :                 E[0] = 1;
-      34             : 
-      35             :                 // Relation between comoving distance r and redshift z (cf. J.A. Peacock, Cosmological physics, p. 89 eq. 3.76)
-      36             :                 // dr = c / H(z) dz, integration using midpoint rule
-      37             :                 double dlz = log10(zmax) - log10(zmin);
-      38       19000 :                 for (int i = 1; i < n; i++) {
-      39       18981 :                         Z[i] = zmin * pow(10, i * dlz / (n - 1)); // logarithmic even spacing
-      40       18981 :                         double dz = (Z[i] - Z[i - 1]); // redshift step
-      41       18981 :                         E[i] = sqrt(omegaL + omegaM * pow_integer<3>(1 + Z[i]));
-      42       18981 :                         Dc[i] = Dc[i - 1] + dH * dz * (1 / E[i] + 1 / E[i - 1]) / 2;
-      43       18981 :                         Dl[i] = (1 + Z[i]) * Dc[i];
-      44       18981 :                         Dt[i] = Dt[i - 1]
-      45       18981 :                                         + dH * dz
-      46       18981 :                                                         * (1 / ((1 + Z[i]) * E[i])
-      47       18981 :                                                                         + 1 / ((1 + Z[i - 1]) * E[i - 1])) / 2;
-      48             :                 }
-      49          19 :         }
-      50             : 
-      51          19 :         Cosmology() {
-      52             :         // Cosmological parameters (K.A. Olive et al. (Particle Data Group), Chin. Phys. C, 38, 090001 (2014))
-      53          19 :                 H0 = 67.3 * 1000 * meter / second / Mpc; // default values
-      54          19 :                 omegaM = 0.315;
-      55          19 :                 omegaL = 1 - omegaM;
-      56             : 
-      57          19 :                 Z.resize(n);
-      58          19 :                 Dc.resize(n);
-      59          19 :                 Dl.resize(n);
-      60          19 :                 Dt.resize(n);
-      61             : 
-      62          19 :                 Z[0] = 0;
-      63          19 :                 Dc[0] = 0;
-      64          19 :                 Dl[0] = 0;
-      65          19 :                 Dt[0] = 0;
-      66             : 
-      67          19 :                 update();
-      68          19 :         }
-      69             : 
-      70             :         void setParameters(double h, double oM) {
-      71           0 :                 H0 = h * 1e5 / Mpc;
-      72           0 :                 omegaM = oM;
-      73           0 :                 omegaL = 1 - oM;
-      74           0 :                 update();
-      75             :         }
-      76             : };
-      77             : 
-      78             : const int Cosmology::n = 1000;
-      79             : const double Cosmology::zmin = 0.0001;
-      80             : const double Cosmology::zmax = 100;
-      81             : 
-      82             : static Cosmology cosmology; // instance is created at runtime
-      83             : 
-      84           0 : void setCosmologyParameters(double h, double oM) {
-      85             :         cosmology.setParameters(h, oM);
-      86           0 : }
-      87             : 
-      88        7623 : double hubbleRate(double z) {
-      89        7623 :         return cosmology.H0
-      90        7623 :                         * sqrt(cosmology.omegaL + cosmology.omegaM * pow(1 + z, 3));
-      91             : }
-      92             : 
-      93           0 : double omegaL() {
-      94           0 :         return cosmology.omegaL;
-      95             : }
-      96             : 
-      97           0 : double omegaM() {
-      98           0 :         return cosmology.omegaM;
-      99             : }
-     100             : 
-     101           0 : double H0() {
-     102           0 :         return cosmology.H0;
-     103             : }
-     104             : 
-     105           1 : double comovingDistance2Redshift(double d) {
-     106           1 :         if (d < 0)
-     107           0 :                 throw std::runtime_error("Cosmology: d < 0");
-     108           1 :         if (d > cosmology.Dc.back())
-     109           0 :                 throw std::runtime_error("Cosmology: d > dmax");
-     110           1 :         return interpolate(d, cosmology.Dc, cosmology.Z);
-     111             : }
-     112             : 
-     113           0 : double redshift2ComovingDistance(double z) {
-     114           0 :         if (z < 0)
-     115           0 :                 throw std::runtime_error("Cosmology: z < 0");
-     116           0 :         if (z > cosmology.zmax)
-     117           0 :                 throw std::runtime_error("Cosmology: z > zmax");
-     118           0 :         return interpolate(z, cosmology.Z, cosmology.Dc);
-     119             : }
-     120             : 
-     121           0 : double luminosityDistance2Redshift(double d) {
-     122           0 :         if (d < 0)
-     123           0 :                 throw std::runtime_error("Cosmology: d < 0");
-     124           0 :         if (d > cosmology.Dl.back())
-     125           0 :                 throw std::runtime_error("Cosmology: d > dmax");
-     126           0 :         return interpolate(d, cosmology.Dl, cosmology.Z);
-     127             : }
-     128             : 
-     129           0 : double redshift2LuminosityDistance(double z) {
-     130           0 :         if (z < 0)
-     131           0 :                 throw std::runtime_error("Cosmology: z < 0");
-     132           0 :         if (z > cosmology.zmax)
-     133           0 :                 throw std::runtime_error("Cosmology: z > zmax");
-     134           0 :         return interpolate(z, cosmology.Z, cosmology.Dl);
-     135             : }
-     136             : 
-     137           0 : double lightTravelDistance2Redshift(double d) {
-     138           0 :         if (d < 0)
-     139           0 :                 throw std::runtime_error("Cosmology: d < 0");
-     140           0 :         if (d > cosmology.Dt.back())
-     141           0 :                 throw std::runtime_error("Cosmology: d > dmax");
-     142           0 :         return interpolate(d, cosmology.Dt, cosmology.Z);
-     143             : }
-     144             : 
-     145           0 : double redshift2LightTravelDistance(double z) {
-     146           0 :         if (z < 0)
-     147           0 :                 throw std::runtime_error("Cosmology: z < 0");
-     148           0 :         if (z > cosmology.zmax)
-     149           0 :                 throw std::runtime_error("Cosmology: z > zmax");
-     150           0 :         return interpolate(z, cosmology.Z, cosmology.Dt);
-     151             : }
-     152             : 
-     153           2 : double comoving2LightTravelDistance(double d) {
-     154           2 :         if (d < 0)
-     155           0 :                 throw std::runtime_error("Cosmology: d < 0");
-     156           2 :         if (d > cosmology.Dc.back())
-     157           0 :                 throw std::runtime_error("Cosmology: d > dmax");
-     158           2 :         return interpolate(d, cosmology.Dc, cosmology.Dt);
-     159             : }
-     160             : 
-     161           1 : double lightTravel2ComovingDistance(double d) {
-     162           1 :         if (d < 0)
-     163           0 :                 throw std::runtime_error("Cosmology: d < 0");
-     164           1 :         if (d > cosmology.Dt.back())
-     165           0 :                 throw std::runtime_error("Cosmology: d > dmax");
-     166           1 :         return interpolate(d, cosmology.Dt, cosmology.Dc);
-     167             : }
-     168             : 
-     169             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/EmissionMap.cpp.func-sort-c.html b/doc/coverageReport/src/EmissionMap.cpp.func-sort-c.html deleted file mode 100644 index 08e7db8aa..000000000 --- a/doc/coverageReport/src/EmissionMap.cpp.func-sort-c.html +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/EmissionMap.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - EmissionMap.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8315653.2 %
Date:2024-04-08 14:58:22Functions:183354.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11EmissionMap4loadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa11EmissionMap4saveERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa11EmissionMap5mergeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa11EmissionMap6hasMapEid0
_ZN7crpropa11EmissionMap7fillMapERKNS_13ParticleStateEd0
_ZN7crpropa11EmissionMapC2Emmm0
_ZN7crpropa24CylindricalProjectionMap7getNPhiEv0
_ZN7crpropa24CylindricalProjectionMap9getNThetaEv0
_ZN7crpropa24CylindricalProjectionMapC2Ev0
_ZNK7crpropa11EmissionMap13drawDirectionERKNS_13ParticleStateERNS_7Vector3IdEE0
_ZNK7crpropa11EmissionMap14checkDirectionERKNS_13ParticleStateE0
_ZNK7crpropa11EmissionMap14checkDirectionEidRKNS_7Vector3IdEE0
_ZNK7crpropa24CylindricalProjectionMap14checkDirectionERKNS_7Vector3IdEE0
_ZNK7crpropa24CylindricalProjectionMap6getCdfEv0
_ZNK7crpropa24CylindricalProjectionMap6getPdfEv0
_ZN7crpropa11EmissionMap5mergeEPKS0_1
_ZN7crpropa11EmissionMap7getMapsEv1
_ZN7crpropa11EmissionMapC2Emmmdd1
_ZNK7crpropa11EmissionMap13energyFromBinEm1
_ZNK7crpropa24CylindricalProjectionMap13drawDirectionEv1
_ZNK7crpropa24CylindricalProjectionMap9updateCdfEv1
_ZN7crpropa11EmissionMapC2Ev2
_ZNK7crpropa11EmissionMap7getMapsEv2
_ZNK7crpropa24CylindricalProjectionMap16directionFromBinEm2
_ZNK7crpropa11EmissionMap13drawDirectionEidRNS_7Vector3IdEE3
_ZN7crpropa11EmissionMap7fillMapEidRKNS_7Vector3IdEEd4
_ZN7crpropa24CylindricalProjectionMap7fillBinERKNS_7Vector3IdEEd4
_ZN7crpropa24CylindricalProjectionMap6getPdfEv5
_ZN7crpropa24CylindricalProjectionMapC2Emm6
_ZNK7crpropa24CylindricalProjectionMap16binFromDirectionERKNS_7Vector3IdEE6
_ZN7crpropa11EmissionMap6getMapEid7
_ZNK7crpropa11EmissionMap13binFromEnergyEd11
_ZN7crpropa24CylindricalProjectionMap7fillBinEmd129604
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/EmissionMap.cpp.func.html b/doc/coverageReport/src/EmissionMap.cpp.func.html deleted file mode 100644 index ca8986910..000000000 --- a/doc/coverageReport/src/EmissionMap.cpp.func.html +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/EmissionMap.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - EmissionMap.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8315653.2 %
Date:2024-04-08 14:58:22Functions:183354.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11EmissionMap4loadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa11EmissionMap4saveERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa11EmissionMap5mergeEPKS0_1
_ZN7crpropa11EmissionMap5mergeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa11EmissionMap6getMapEid7
_ZN7crpropa11EmissionMap6hasMapEid0
_ZN7crpropa11EmissionMap7fillMapERKNS_13ParticleStateEd0
_ZN7crpropa11EmissionMap7fillMapEidRKNS_7Vector3IdEEd4
_ZN7crpropa11EmissionMap7getMapsEv1
_ZN7crpropa11EmissionMapC2Emmm0
_ZN7crpropa11EmissionMapC2Emmmdd1
_ZN7crpropa11EmissionMapC2Ev2
_ZN7crpropa24CylindricalProjectionMap6getPdfEv5
_ZN7crpropa24CylindricalProjectionMap7fillBinERKNS_7Vector3IdEEd4
_ZN7crpropa24CylindricalProjectionMap7fillBinEmd129604
_ZN7crpropa24CylindricalProjectionMap7getNPhiEv0
_ZN7crpropa24CylindricalProjectionMap9getNThetaEv0
_ZN7crpropa24CylindricalProjectionMapC2Emm6
_ZN7crpropa24CylindricalProjectionMapC2Ev0
_ZNK7crpropa11EmissionMap13binFromEnergyEd11
_ZNK7crpropa11EmissionMap13drawDirectionERKNS_13ParticleStateERNS_7Vector3IdEE0
_ZNK7crpropa11EmissionMap13drawDirectionEidRNS_7Vector3IdEE3
_ZNK7crpropa11EmissionMap13energyFromBinEm1
_ZNK7crpropa11EmissionMap14checkDirectionERKNS_13ParticleStateE0
_ZNK7crpropa11EmissionMap14checkDirectionEidRKNS_7Vector3IdEE0
_ZNK7crpropa11EmissionMap7getMapsEv2
_ZNK7crpropa24CylindricalProjectionMap13drawDirectionEv1
_ZNK7crpropa24CylindricalProjectionMap14checkDirectionERKNS_7Vector3IdEE0
_ZNK7crpropa24CylindricalProjectionMap16binFromDirectionERKNS_7Vector3IdEE6
_ZNK7crpropa24CylindricalProjectionMap16directionFromBinEm2
_ZNK7crpropa24CylindricalProjectionMap6getCdfEv0
_ZNK7crpropa24CylindricalProjectionMap6getPdfEv0
_ZNK7crpropa24CylindricalProjectionMap9updateCdfEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/EmissionMap.cpp.gcov.html b/doc/coverageReport/src/EmissionMap.cpp.gcov.html deleted file mode 100644 index 59cbfc778..000000000 --- a/doc/coverageReport/src/EmissionMap.cpp.gcov.html +++ /dev/null @@ -1,370 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/EmissionMap.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - EmissionMap.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8315653.2 %
Date:2024-04-08 14:58:22Functions:183354.5 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/EmissionMap.h"
-       2             : #include "crpropa/Random.h"
-       3             : #include "crpropa/Units.h"
-       4             : 
-       5             : #include "kiss/logger.h"
-       6             : 
-       7             : #include <fstream>
-       8             : 
-       9             : namespace crpropa {
-      10             : 
-      11           0 : CylindricalProjectionMap::CylindricalProjectionMap() : nPhi(360), nTheta(180), dirty(false), pdf(nPhi* nTheta, 0), cdf(nPhi* nTheta, 0) {
-      12           0 :         sPhi = 2. * M_PI / nPhi;
-      13           0 :         sTheta = 2. / nTheta;
-      14           0 : }
-      15             : 
-      16           6 : CylindricalProjectionMap::CylindricalProjectionMap(size_t nPhi, size_t nTheta) : nPhi(nPhi), nTheta(nTheta), dirty(false), pdf(nPhi* nTheta, 0), cdf(nPhi* nTheta, 0) {
-      17           6 :         sPhi = 2 * M_PI / nPhi;
-      18           6 :         sTheta = 2. / nTheta;
-      19           6 : }
-      20             : 
-      21           4 : void CylindricalProjectionMap::fillBin(const Vector3d& direction, double weight) {
-      22           4 :         size_t bin = binFromDirection(direction);
-      23           4 :         fillBin(bin, weight);
-      24           4 : }
-      25             : 
-      26      129604 : void CylindricalProjectionMap::fillBin(size_t bin, double weight) {
-      27      129604 :         pdf[bin] += weight;
-      28      129604 :         dirty = true;
-      29      129604 : }
-      30             : 
-      31           1 : Vector3d CylindricalProjectionMap::drawDirection() const {
-      32           1 :         if (dirty)
-      33           1 :                 updateCdf();
-      34             : 
-      35           1 :         size_t bin = Random::instance().randBin(cdf);
-      36             : 
-      37           1 :         return directionFromBin(bin);
-      38             : }
-      39             : 
-      40           0 : bool CylindricalProjectionMap::checkDirection(const Vector3d &direction) const {
-      41           0 :         size_t bin = binFromDirection(direction);
-      42           0 :         return pdf[bin];
-      43             : }
-      44             : 
-      45             : 
-      46           0 : const std::vector<double>& CylindricalProjectionMap::getPdf() const {
-      47           0 :         return pdf;
-      48             : }
-      49             : 
-      50           5 : std::vector<double>& CylindricalProjectionMap::getPdf() {
-      51           5 :         return pdf;
-      52             : }
-      53             : 
-      54           0 : const std::vector<double>& CylindricalProjectionMap::getCdf() const {
-      55           0 :         return cdf;
-      56             : }
-      57             : 
-      58           0 : size_t CylindricalProjectionMap::getNPhi() {
-      59           0 :         return nPhi;
-      60             : }
-      61             : 
-      62           0 : size_t CylindricalProjectionMap::getNTheta() {
-      63           0 :         return nTheta;
-      64             : }
-      65             : 
-      66             : /*
-      67             :  * Cylindrical Coordinates
-      68             :  * iPhi -> [0, 2*pi]
-      69             :  * iTheta -> [0, 2]
-      70             :  *
-      71             :  * Spherical Coordinates
-      72             :  * phi -> [-pi, pi]
-      73             :  * theta -> [0, pi]
-      74             :  */
-      75           6 : size_t CylindricalProjectionMap::binFromDirection(const Vector3d& direction) const {
-      76             :         // convert to cylindrical
-      77           6 :         double phi = direction.getPhi() + M_PI;
-      78           6 :         double theta = sin(M_PI_2 - direction.getTheta()) + 1;
-      79             : 
-      80             :         // to indices
-      81           6 :         size_t iPhi = phi / sPhi;
-      82           6 :         size_t iTheta = theta / sTheta;
-      83             : 
-      84             :         // interleave
-      85           6 :         size_t bin =  iTheta * nPhi + iPhi;
-      86           6 :         return bin;
-      87             : }
-      88             : 
-      89           2 : Vector3d CylindricalProjectionMap::directionFromBin(size_t bin) const {
-      90             :         // deinterleave
-      91           2 :         double iPhi = bin % nPhi;
-      92           2 :         double iTheta = bin / nPhi;
-      93             : 
-      94             :         // any where in the bin
-      95           2 :         iPhi += Random::instance().rand();
-      96           2 :         iTheta += Random::instance().rand();
-      97             : 
-      98             :         // cylindrical Coordinates
-      99           2 :         double phi = iPhi * sPhi;
-     100           2 :         double theta = iTheta * sTheta;
-     101             : 
-     102             :         // sphericala Coordinates
-     103           2 :         phi = phi - M_PI;
-     104           2 :         theta = M_PI_2 - asin(theta - 1);
-     105             : 
-     106             :         Vector3d v;
-     107           2 :         v.setRThetaPhi(1.0, theta, phi);
-     108           2 :         return v;
-     109             : }
-     110             : 
-     111           1 : void CylindricalProjectionMap::updateCdf() const {
-     112           1 :         if (dirty) {
-     113           1 :                 cdf[0] = pdf[0];
-     114       64800 :                 for (size_t i = 1; i < pdf.size(); i++) {
-     115       64799 :                         cdf[i] = cdf[i-1] + pdf[i];
-     116             :                 }
-     117           1 :                 dirty = false;
-     118             :         }
-     119           1 : }
-     120             : 
-     121           2 : EmissionMap::EmissionMap() : minEnergy(0.0001 * EeV), maxEnergy(10000 * EeV),
-     122           2 :         nEnergy(8*2), nPhi(360), nTheta(180) {
-     123           2 :         logStep = log10(maxEnergy / minEnergy) / nEnergy;
-     124           2 : }
-     125             : 
-     126           0 : EmissionMap::EmissionMap(size_t nPhi, size_t nTheta, size_t nEnergy) : minEnergy(0.0001 * EeV), maxEnergy(10000 * EeV),
-     127           0 :         nEnergy(nEnergy), nPhi(nPhi), nTheta(nTheta) {
-     128           0 :         logStep = log10(maxEnergy / minEnergy) / nEnergy;
-     129           0 : }
-     130             : 
-     131           1 : EmissionMap::EmissionMap(size_t nPhi, size_t nTheta, size_t nEnergy, double minEnergy, double maxEnergy) : minEnergy(minEnergy), maxEnergy(maxEnergy), nEnergy(nEnergy), nPhi(nPhi), nTheta(nTheta) {
-     132           1 :         logStep = log10(maxEnergy / minEnergy) / nEnergy;
-     133           1 : }
-     134             : 
-     135           1 : double EmissionMap::energyFromBin(size_t bin) const {
-     136           1 :         return pow(10, log10(minEnergy) + logStep * bin);
-     137             : }
-     138             : 
-     139          11 : size_t EmissionMap::binFromEnergy(double energy) const {
-     140          11 :         return log10(energy / minEnergy) / logStep;
-     141             : }
-     142             : 
-     143           4 : void EmissionMap::fillMap(int pid, double energy, const Vector3d& direction, double weight) {
-     144           4 :         getMap(pid, energy)->fillBin(direction, weight);
-     145           4 : }
-     146             : 
-     147           0 : void EmissionMap::fillMap(const ParticleState& state, double weight) {
-     148           0 :         fillMap(state.getId(), state.getEnergy(), state.getDirection(), weight);
-     149           0 : }
-     150             : 
-     151           1 : EmissionMap::map_t &EmissionMap::getMaps() {
-     152           1 :         return maps;
-     153             : }
-     154             : 
-     155           2 : const EmissionMap::map_t &EmissionMap::getMaps() const {
-     156           2 :         return maps;
-     157             : }
-     158             : 
-     159           3 : bool EmissionMap::drawDirection(int pid, double energy, Vector3d& direction) const {
-     160           3 :         key_t key(pid, binFromEnergy(energy));
-     161             :         map_t::const_iterator i = maps.find(key);
-     162             : 
-     163           3 :         if (i == maps.end() || !i->second.valid()) {
-     164             :                 return false;
-     165             :         } else {
-     166           1 :                 direction = i->second->drawDirection();
-     167           1 :                 return true;
-     168             :         }
-     169             : }
-     170             : 
-     171           0 : bool EmissionMap::drawDirection(const ParticleState& state, Vector3d& direction) const {
-     172           0 :         return drawDirection(state.getId(), state.getEnergy(), direction);
-     173             : }
-     174             : 
-     175           0 : bool EmissionMap::checkDirection(int pid, double energy, const Vector3d& direction) const {
-     176           0 :         key_t key(pid, binFromEnergy(energy));
-     177             :         map_t::const_iterator i = maps.find(key);
-     178             : 
-     179           0 :         if (i == maps.end() || !i->second.valid()) {
-     180             :                 return false;
-     181             :         } else {
-     182           0 :                 return i->second->checkDirection(direction);
-     183             :         }
-     184             : }
-     185             : 
-     186           0 : bool EmissionMap::checkDirection(const ParticleState& state) const {
-     187           0 :         return checkDirection(state.getId(), state.getEnergy(), state.getDirection());
-     188             : }
-     189             : 
-     190           0 : bool EmissionMap::hasMap(int pid, double energy) {
-     191           0 :     key_t key(pid, binFromEnergy(energy));
-     192             :     map_t::iterator i = maps.find(key);
-     193           0 :     if (i == maps.end() || !i->second.valid())
-     194             :                 return false;
-     195             :         else
-     196           0 :                 return true;
-     197             : }
-     198             : 
-     199           7 : ref_ptr<CylindricalProjectionMap> EmissionMap::getMap(int pid, double energy) {
-     200           7 :         key_t key(pid, binFromEnergy(energy));
-     201             :         map_t::iterator i = maps.find(key);
-     202           7 :         if (i == maps.end() || !i->second.valid()) {
-     203           5 :                 ref_ptr<CylindricalProjectionMap> cpm = new CylindricalProjectionMap(nPhi, nTheta);
-     204           5 :                 maps[key] = cpm;
-     205             :                 return cpm;
-     206             :         } else {
-     207             :                 return i->second;
-     208             :         }
-     209             : }
-     210             : 
-     211           0 : void EmissionMap::save(const std::string &filename) {
-     212           0 :         std::ofstream out(filename.c_str());
-     213           0 :         out.imbue(std::locale("C"));
-     214             : 
-     215           0 :         for (map_t::iterator i = maps.begin(); i != maps.end(); i++) {
-     216           0 :                 if (!i->second.valid())
-     217           0 :                         continue;
-     218           0 :                 out << i->first.first << " " << i->first.second << " " << energyFromBin(i->first.second) << " ";
-     219           0 :                 out << i->second->getNPhi() << " " << i->second->getNTheta();
-     220           0 :                 const std::vector<double> &pdf = i->second->getPdf();
-     221           0 :                 for (size_t i = 0; i < pdf.size(); i++)
-     222           0 :                         out << " " << pdf[i];
-     223             :                 out << std::endl;
-     224             :         }
-     225           0 : }
-     226             : 
-     227           1 : void EmissionMap::merge(const EmissionMap *other) {
-     228           1 :         if (other == 0)
-     229             :                 return;
-     230           1 :         map_t::const_iterator i = other->getMaps().begin();
-     231           1 :         map_t::const_iterator end = other->getMaps().end();
-     232           3 :         for(;i != end; i++) {
-     233           2 :                 if (!i->second.valid())
-     234           0 :                         continue;
-     235             : 
-     236           2 :                 std::vector<double> &otherpdf = i->second->getPdf();
-     237           2 :                 ref_ptr<CylindricalProjectionMap> cpm = getMap(i->first.first, i->first.second);
-     238             : 
-     239           2 :                 if (otherpdf.size() != cpm->getPdf().size()) {
-     240           0 :                         throw std::runtime_error("PDF size mismatch!");
-     241             :                         break;
-     242             :                 }
-     243             : 
-     244      129602 :                 for (size_t k = 0; k < otherpdf.size(); k++) {
-     245      129600 :                         cpm->fillBin(k, otherpdf[k]);
-     246             :                 }
-     247             :         }
-     248             : }
-     249             : 
-     250           0 : void EmissionMap::merge(const std::string &filename) {
-     251           0 :         EmissionMap em;
-     252           0 :         em.load(filename);
-     253           0 :         merge(&em);
-     254           0 : }
-     255             : 
-     256           0 : void EmissionMap::load(const std::string &filename) {
-     257           0 :         std::ifstream in(filename.c_str());
-     258           0 :         in.imbue(std::locale("C"));
-     259             : 
-     260           0 :         while(in.good()) {
-     261           0 :                 key_t key;
-     262             :                 double tmp;
-     263             :                 size_t nPhi_, nTheta_;
-     264           0 :                 in >> key.first >> key.second >> tmp;
-     265             :                 in >> nPhi_ >> nTheta_;
-     266             : 
-     267           0 :                 if (!in.good()) {
-     268           0 :                         KISS_LOG_ERROR << "Invalid line: " << key.first << " " << key.second << " " << nPhi_ << " " << nTheta_;
-     269           0 :                         break;
-     270             :                 }
-     271             : 
-     272           0 :                 if (nPhi != nPhi_) {
-     273           0 :                         KISS_LOG_WARNING << "nPhi mismatch: " << nPhi << " " << nPhi_;
-     274             :                 }
-     275           0 :                 if (nTheta != nTheta_) {
-     276           0 :                         KISS_LOG_WARNING << "nTheta mismatch: " << nTheta << " " << nTheta_;
-     277             :                 }
-     278             : 
-     279           0 :                 ref_ptr<CylindricalProjectionMap> cpm = new CylindricalProjectionMap(nPhi_, nTheta_);
-     280           0 :                 std::vector<double> &pdf = cpm->getPdf();
-     281           0 :                 for (size_t i = 0; i < pdf.size(); i++)
-     282             :                         in >> pdf[i];
-     283             : 
-     284           0 :                 if (in.good()) {
-     285           0 :                         maps[key] = cpm;
-     286             :                         // std::cout << "added " << key.first << " " << key.second << std::endl;
-     287             :                 } else {
-     288           0 :                         KISS_LOG_WARNING << "Invalid data in line: " << key.first << " " << key.second << " " << nPhi_ << " " << nTheta_ << "\n";
-     289             :                 }
-     290             :         }
-     291             : 
-     292           0 : }
-     293             : 
-     294             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Geometry.cpp.func-sort-c.html b/doc/coverageReport/src/Geometry.cpp.func-sort-c.html deleted file mode 100644 index 14ddef6d4..000000000 --- a/doc/coverageReport/src/Geometry.cpp.func-sort-c.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Geometry.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Geometry.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:185036.0 %
Date:2024-04-08 14:58:22Functions:61346.2 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa5PlaneC2ERKNS_7Vector3IdEES4_S4_0
_ZNK7crpropa11ParaxialBox14getDescriptionB5cxx11Ev0
_ZNK7crpropa11ParaxialBox6normalERKNS_7Vector3IdEE0
_ZNK7crpropa5Plane14getDescriptionB5cxx11Ev0
_ZNK7crpropa5Plane6normalERKNS_7Vector3IdEE0
_ZNK7crpropa6Sphere14getDescriptionB5cxx11Ev0
_ZNK7crpropa6Sphere6normalERKNS_7Vector3IdEE0
_ZN7crpropa11ParaxialBoxC2ERKNS_7Vector3IdEES4_1
_ZN7crpropa5PlaneC2ERKNS_7Vector3IdEES4_1
_ZNK7crpropa5Plane8distanceERKNS_7Vector3IdEE2
_ZN7crpropa6SphereC2ERKNS_7Vector3IdEEd4
_ZNK7crpropa11ParaxialBox8distanceERKNS_7Vector3IdEE6
_ZNK7crpropa6Sphere8distanceERKNS_7Vector3IdEE12
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Geometry.cpp.func.html b/doc/coverageReport/src/Geometry.cpp.func.html deleted file mode 100644 index ced667ab2..000000000 --- a/doc/coverageReport/src/Geometry.cpp.func.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Geometry.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Geometry.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:185036.0 %
Date:2024-04-08 14:58:22Functions:61346.2 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11ParaxialBoxC2ERKNS_7Vector3IdEES4_1
_ZN7crpropa5PlaneC2ERKNS_7Vector3IdEES4_1
_ZN7crpropa5PlaneC2ERKNS_7Vector3IdEES4_S4_0
_ZN7crpropa6SphereC2ERKNS_7Vector3IdEEd4
_ZNK7crpropa11ParaxialBox14getDescriptionB5cxx11Ev0
_ZNK7crpropa11ParaxialBox6normalERKNS_7Vector3IdEE0
_ZNK7crpropa11ParaxialBox8distanceERKNS_7Vector3IdEE6
_ZNK7crpropa5Plane14getDescriptionB5cxx11Ev0
_ZNK7crpropa5Plane6normalERKNS_7Vector3IdEE0
_ZNK7crpropa5Plane8distanceERKNS_7Vector3IdEE2
_ZNK7crpropa6Sphere14getDescriptionB5cxx11Ev0
_ZNK7crpropa6Sphere6normalERKNS_7Vector3IdEE0
_ZNK7crpropa6Sphere8distanceERKNS_7Vector3IdEE12
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Geometry.cpp.gcov.html b/doc/coverageReport/src/Geometry.cpp.gcov.html deleted file mode 100644 index 23f52e359..000000000 --- a/doc/coverageReport/src/Geometry.cpp.gcov.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Geometry.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Geometry.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:185036.0 %
Date:2024-04-08 14:58:22Functions:61346.2 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include <limits>
-       2             : #include <cmath>
-       3             : #include "kiss/logger.h"
-       4             : #include "crpropa/Geometry.h"
-       5             : 
-       6             : #include <iostream>
-       7             : 
-       8             : namespace crpropa {
-       9             : 
-      10             : // Plane ------------------------------------------------------------------
-      11           1 : Plane::Plane(const Vector3d& _x0, const Vector3d& _n) : x0(_x0), n(_n) {
-      12           1 : };
-      13             : 
-      14           0 : Plane::Plane(const Vector3d& _x0, const Vector3d& v1,const Vector3d& v2) : x0(_x0), n(0,0,0) {
-      15             :         n = v1.cross(v2);
-      16             :         n /= n.getR();
-      17           0 : };
-      18             : 
-      19           2 : double Plane::distance(const Vector3d &x) const {
-      20             :         Vector3d dX = x - x0;
-      21           2 :         return n.dot(dX);
-      22             : };
-      23             : 
-      24           0 : std::string Plane::getDescription() const {
-      25           0 :         std::stringstream ss;
-      26             :         ss << "Plane: " << std::endl
-      27           0 :            << "   x0: " << x0 << std::endl
-      28           0 :            << "    n: " << n << std::endl;
-      29           0 :         return ss.str();
-      30           0 : };
-      31             : 
-      32           0 : Vector3d Plane::normal(const Vector3d& point) const {
-      33           0 :         return n;
-      34             : }
-      35             : 
-      36             : 
-      37             : // Sphere ------------------------------------------------------------------
-      38           4 : Sphere::Sphere(const Vector3d& _center, double _radius) : center(_center), radius(_radius) {
-      39           4 : };
-      40             : 
-      41          12 : double Sphere::distance(const Vector3d &point) const {
-      42             :         Vector3d dR = point - center;
-      43          12 :         return dR.getR() - radius;
-      44             : }
-      45             : 
-      46           0 : Vector3d Sphere::normal(const Vector3d& point) const {
-      47             :         Vector3d d = point - center;
-      48           0 :         return d.getUnitVector();
-      49             : }
-      50             : 
-      51           0 : std::string Sphere::getDescription() const {
-      52           0 :         std::stringstream ss;
-      53             :         ss << "Sphere: " << std::endl
-      54           0 :                         << "   Center: " << center << std::endl
-      55           0 :                         << "   Radius: " << radius << std::endl;
-      56           0 :         return ss.str();
-      57           0 : };
-      58             : 
-      59             : 
-      60             : // ParaxialBox -------------------------------------------------------------
-      61           1 : ParaxialBox::ParaxialBox(const Vector3d& _corner, const Vector3d& _size) : corner(_corner), size(_size) {
-      62           1 : };
-      63             : 
-      64           6 : double ParaxialBox::distance(const Vector3d &point) const {
-      65             :         Vector3d X = point - corner - size/2.;
-      66             : 
-      67             :         // inside the cube
-      68           6 :         if ((fabs(X.x) <= size.x/2.) and (fabs(X.y) <= size.y/2.) and (fabs(X.z) <= size.z/2.)) { 
-      69             :                 Vector3d Xp = size/2. - X.abs();
-      70           3 :                 double d = std::min(Xp.x, std::min(Xp.y, Xp.z));
-      71             : 
-      72           3 :                 return -1. * d;
-      73             :         }
-      74             : 
-      75           3 :         double a = std::max(0., fabs(X.x) - size.x/2.);
-      76           3 :         double b = std::max(0., fabs(X.y) - size.y/2.);
-      77           3 :         double c = std::max(0., fabs(X.z) - size.z/2.);
-      78             : 
-      79           3 :         return sqrt(a*a + b*b +c*c);
-      80             : }
-      81             : 
-      82           0 : Vector3d ParaxialBox::normal(const Vector3d& point) const {
-      83             :         Vector3d d = (point - corner).abs();
-      84             :         Vector3d d2 = d + size;
-      85             :         Vector3d n;
-      86             :         double dmin = std::numeric_limits<double>::infinity();
-      87           0 :         if (d.x < dmin) {
-      88             :                 dmin = d.x;
-      89             :                 n = Vector3d(-1, 0, 0);
-      90             :         }
-      91           0 :         if (d.y < dmin) {
-      92             :                 dmin = d.y;
-      93             :                 n = Vector3d(0, -1, 0);
-      94             :         }
-      95           0 :         if (d.z < dmin) {
-      96             :                 dmin = d.z;
-      97             :                 n = Vector3d(0, 0, -1);
-      98             :         }
-      99           0 :         if (d2.x < dmin) {
-     100             :                 dmin = d2.x;
-     101             :                 n = Vector3d(1, 0, 0);
-     102             :         }
-     103           0 :         if (d2.y < dmin) {
-     104             :                 dmin = d2.y;
-     105             :                 n = Vector3d(0, 1, 0);
-     106             :         }
-     107           0 :         if (d2.z < dmin) {
-     108             :                 // dmin = d2.z;
-     109             :                 n = Vector3d(0, 0, 1);
-     110             :         }
-     111             : 
-     112           0 :         return n;
-     113             : }
-     114             : 
-     115           0 : std::string ParaxialBox::getDescription() const {
-     116           0 :         std::stringstream ss;
-     117             :         ss << "ParaxialBox: " << std::endl
-     118           0 :                  << "   corner: " << corner << std::endl
-     119           0 :                  << "     size: " << size << std::endl;
-     120           0 :         return ss.str();
-     121           0 : };
-     122             : 
-     123             : 
-     124             : } // namespace
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/GridTools.cpp.func-sort-c.html b/doc/coverageReport/src/GridTools.cpp.func-sort-c.html deleted file mode 100644 index 14424d83d..000000000 --- a/doc/coverageReport/src/GridTools.cpp.func-sort-c.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/GridTools.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - GridTools.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:6724527.3 %
Date:2024-04-08 14:58:22Functions:71936.8 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa13dumpGridToTxtENS_7ref_ptrINS_4GridIfEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd0
_ZN7crpropa15loadGridFromTxtENS_7ref_ptrINS_4GridIfEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd0
_ZN7crpropa16rmsFieldStrengthENS_7ref_ptrINS_4GridIfEEEE0
_ZN7crpropa17fromMagneticFieldENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEENS0_INS_13MagneticFieldEEE0
_ZN7crpropa17gridPowerSpectrumENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa17meanFieldStrengthENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa17meanFieldStrengthENS_7ref_ptrINS_4GridIfEEEE0
_ZN7crpropa23rmsFieldStrengthPerAxisENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa25fromMagneticFieldStrengthENS_7ref_ptrINS_4GridIfEEEENS0_INS_13MagneticFieldEEE0
_ZN7crpropa8dumpGridENS_7ref_ptrINS_4GridIfEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd0
_ZN7crpropa8loadGridENS_7ref_ptrINS_4GridIfEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd0
_ZN7crpropa9scaleGridENS_7ref_ptrINS_4GridIfEEEEd0
_ZN7crpropa13dumpGridToTxtENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd1
_ZN7crpropa15loadGridFromTxtENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd1
_ZN7crpropa15meanFieldVectorENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE1
_ZN7crpropa8dumpGridENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd1
_ZN7crpropa8loadGridENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd1
_ZN7crpropa16rmsFieldStrengthENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE11
_ZN7crpropa9scaleGridENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEd11
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/GridTools.cpp.func.html b/doc/coverageReport/src/GridTools.cpp.func.html deleted file mode 100644 index 0781b93b7..000000000 --- a/doc/coverageReport/src/GridTools.cpp.func.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/GridTools.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - GridTools.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:6724527.3 %
Date:2024-04-08 14:58:22Functions:71936.8 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa13dumpGridToTxtENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd1
_ZN7crpropa13dumpGridToTxtENS_7ref_ptrINS_4GridIfEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd0
_ZN7crpropa15loadGridFromTxtENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd1
_ZN7crpropa15loadGridFromTxtENS_7ref_ptrINS_4GridIfEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd0
_ZN7crpropa15meanFieldVectorENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE1
_ZN7crpropa16rmsFieldStrengthENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE11
_ZN7crpropa16rmsFieldStrengthENS_7ref_ptrINS_4GridIfEEEE0
_ZN7crpropa17fromMagneticFieldENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEENS0_INS_13MagneticFieldEEE0
_ZN7crpropa17gridPowerSpectrumENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa17meanFieldStrengthENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa17meanFieldStrengthENS_7ref_ptrINS_4GridIfEEEE0
_ZN7crpropa23rmsFieldStrengthPerAxisENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa25fromMagneticFieldStrengthENS_7ref_ptrINS_4GridIfEEEENS0_INS_13MagneticFieldEEE0
_ZN7crpropa8dumpGridENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd1
_ZN7crpropa8dumpGridENS_7ref_ptrINS_4GridIfEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd0
_ZN7crpropa8loadGridENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd1
_ZN7crpropa8loadGridENS_7ref_ptrINS_4GridIfEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd0
_ZN7crpropa9scaleGridENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEd11
_ZN7crpropa9scaleGridENS_7ref_ptrINS_4GridIfEEEEd0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/GridTools.cpp.gcov.html b/doc/coverageReport/src/GridTools.cpp.gcov.html deleted file mode 100644 index 20f0163b7..000000000 --- a/doc/coverageReport/src/GridTools.cpp.gcov.html +++ /dev/null @@ -1,491 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/GridTools.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - GridTools.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:6724527.3 %
Date:2024-04-08 14:58:22Functions:71936.8 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/GridTools.h"
-       2             : #include "crpropa/magneticField/MagneticField.h"
-       3             : 
-       4             : #include <fstream>
-       5             : #include <sstream>
-       6             : 
-       7             : namespace crpropa {
-       8             : 
-       9           0 : void scaleGrid(ref_ptr<Grid1f> grid, double a) {
-      10           0 :         for (int ix = 0; ix < grid->getNx(); ix++)
-      11           0 :                 for (int iy = 0; iy < grid->getNy(); iy++)
-      12           0 :                         for (int iz = 0; iz < grid->getNz(); iz++)
-      13           0 :                                 grid->get(ix, iy, iz) *= a;
-      14           0 : }
-      15             : 
-      16          11 : void scaleGrid(ref_ptr<Grid3f> grid, double a) {
-      17         654 :         for (int ix = 0; ix < grid->getNx(); ix++)
-      18       41612 :                 for (int iy = 0; iy < grid->getNy(); iy++)
-      19     2662436 :                         for (int iz = 0; iz < grid->getNz(); iz++)
-      20     2621467 :                                 grid->get(ix, iy, iz) *= a;
-      21          11 : }
-      22             : 
-      23           1 : Vector3f meanFieldVector(ref_ptr<Grid3f> grid) {
-      24             :         size_t Nx = grid->getNx();
-      25             :         size_t Ny = grid->getNy();
-      26             :         size_t Nz = grid->getNz();
-      27             :         Vector3f mean(0.);
-      28          65 :         for (int ix = 0; ix < Nx; ix++)
-      29        4160 :                 for (int iy = 0; iy < Ny; iy++)
-      30      266240 :                         for (int iz = 0; iz < Nz; iz++)
-      31             :                                 mean += grid->get(ix, iy, iz);
-      32           1 :         return mean / Nx / Ny / Nz;
-      33             : }
-      34             : 
-      35           0 : double meanFieldStrength(ref_ptr<Grid3f> grid) {
-      36             :         size_t Nx = grid->getNx();
-      37             :         size_t Ny = grid->getNy();
-      38             :         size_t Nz = grid->getNz();
-      39             :         double mean = 0;
-      40           0 :         for (int ix = 0; ix < Nx; ix++)
-      41           0 :                 for (int iy = 0; iy < Ny; iy++)
-      42           0 :                         for (int iz = 0; iz < Nz; iz++)
-      43           0 :                                 mean += grid->get(ix, iy, iz).getR();
-      44           0 :         return mean / Nx / Ny / Nz;
-      45             : }
-      46             : 
-      47           0 : double meanFieldStrength(ref_ptr<Grid1f> grid) {
-      48             :         size_t Nx = grid->getNx();
-      49             :         size_t Ny = grid->getNy();
-      50             :         size_t Nz = grid->getNz();
-      51             :         double mean = 0;
-      52           0 :         for (int ix = 0; ix < Nx; ix++)
-      53           0 :                 for (int iy = 0; iy < Ny; iy++)
-      54           0 :                         for (int iz = 0; iz < Nz; iz++)
-      55           0 :                                 mean += grid->get(ix, iy, iz);
-      56           0 :         return mean / Nx / Ny / Nz;
-      57             : }
-      58             : 
-      59          11 : double rmsFieldStrength(ref_ptr<Grid3f> grid) {
-      60             :         size_t Nx = grid->getNx();
-      61             :         size_t Ny = grid->getNy();
-      62             :         size_t Nz = grid->getNz();
-      63             :         double sumV2 = 0;
-      64         715 :         for (int ix = 0; ix < Nx; ix++)
-      65       45760 :                 for (int iy = 0; iy < Ny; iy++)
-      66     2928640 :                         for (int iz = 0; iz < Nz; iz++)
-      67     2883584 :                                 sumV2 += grid->get(ix, iy, iz).getR2();
-      68          11 :         return std::sqrt(sumV2 / Nx / Ny / Nz);
-      69             : }
-      70             : 
-      71           0 : double rmsFieldStrength(ref_ptr<Grid1f> grid) {
-      72             :         size_t Nx = grid->getNx();
-      73             :         size_t Ny = grid->getNy();
-      74             :         size_t Nz = grid->getNz();
-      75             :         double sumV2 = 0;
-      76           0 :         for (int ix = 0; ix < Nx; ix++)
-      77           0 :                 for (int iy = 0; iy < Ny; iy++)
-      78           0 :                         for (int iz = 0; iz < Nz; iz++)
-      79           0 :                                 sumV2 += pow(grid->get(ix, iy, iz), 2);
-      80           0 :         return std::sqrt(sumV2 / Nx / Ny / Nz);
-      81             : }
-      82             : 
-      83           0 : std::array<float, 3> rmsFieldStrengthPerAxis(ref_ptr<Grid3f> grid) {
-      84             :     size_t Nx = grid->getNx();
-      85             :     size_t Ny = grid->getNy();
-      86             :     size_t Nz = grid->getNz();
-      87             :     float sumV2_x = 0;
-      88             :     float sumV2_y = 0;
-      89             :     float sumV2_z = 0;
-      90           0 :     for (int ix = 0; ix < Nx; ix++)
-      91           0 :         for (int iy = 0; iy < Ny; iy++)
-      92           0 :             for (int iz = 0; iz < Nz; iz++) {
-      93           0 :                 sumV2_x += pow(grid->get(ix, iy, iz).x, 2);
-      94           0 :                 sumV2_y += pow(grid->get(ix, iy, iz).y, 2);
-      95           0 :                 sumV2_z += pow(grid->get(ix, iy, iz).z, 2);
-      96             :             }
-      97             :     return {
-      98           0 :         std::sqrt(sumV2_x / Nx / Ny / Nz),
-      99           0 :         std::sqrt(sumV2_y / Nx / Ny / Nz),
-     100           0 :         std::sqrt(sumV2_z / Nx / Ny / Nz)
-     101           0 :     };
-     102             : }
-     103             : 
-     104           0 : void fromMagneticField(ref_ptr<Grid3f> grid, ref_ptr<MagneticField> field) {
-     105             :         Vector3d origin = grid->getOrigin();
-     106             :         Vector3d spacing = grid->getSpacing();
-     107             :         size_t Nx = grid->getNx();
-     108             :         size_t Ny = grid->getNy();
-     109             :         size_t Nz = grid->getNz();
-     110           0 :         for (size_t ix = 0; ix < Nx; ix++)
-     111           0 :                 for (size_t iy = 0; iy < Ny; iy++)
-     112           0 :                         for (size_t iz = 0; iz < Nz; iz++) {
-     113           0 :                                 Vector3d pos = Vector3d(double(ix) + 0.5, double(iy) + 0.5, double(iz) + 0.5) * spacing + origin;
-     114           0 :                                 Vector3d B = field->getField(pos);
-     115             :                                 grid->get(ix, iy, iz) = B;
-     116             :         }
-     117           0 : }
-     118             : 
-     119           0 : void fromMagneticFieldStrength(ref_ptr<Grid1f> grid, ref_ptr<MagneticField> field) {
-     120             :         Vector3d origin = grid->getOrigin();
-     121             :         Vector3d spacing = grid->getSpacing();
-     122             :         size_t Nx = grid->getNx();
-     123             :         size_t Ny = grid->getNy();
-     124             :         size_t Nz = grid->getNz();
-     125           0 :         for (size_t ix = 0; ix < Nx; ix++)
-     126           0 :                 for (size_t iy = 0; iy < Ny; iy++)
-     127           0 :                         for (size_t iz = 0; iz < Nz; iz++) {
-     128           0 :                                 Vector3d pos = Vector3d(double(ix) + 0.5, double(iy) + 0.5, double(iz) + 0.5) * spacing + origin;
-     129           0 :                                 double s = field->getField(pos).getR();
-     130           0 :                                 grid->get(ix, iy, iz) = s;
-     131             :         }
-     132           0 : }
-     133             : 
-     134           1 : void loadGrid(ref_ptr<Grid3f> grid, std::string filename, double c) {
-     135           1 :         std::ifstream fin(filename.c_str(), std::ios::binary);
-     136           1 :         if (!fin) {
-     137           0 :                 std::stringstream ss;
-     138           0 :                 ss << "load Grid3f: " << filename << " not found";
-     139           0 :                 throw std::runtime_error(ss.str());
-     140           0 :         }
-     141             : 
-     142             :         // get length of file and compare to size of grid
-     143           1 :         fin.seekg(0, fin.end);
-     144           1 :         size_t length = fin.tellg() / sizeof(float);
-     145           1 :         fin.seekg (0, fin.beg);
-     146             : 
-     147             :         size_t nx = grid->getNx();
-     148             :         size_t ny = grid->getNy();
-     149             :         size_t nz = grid->getNz();
-     150             : 
-     151           1 :         if (length != (3 * nx * ny * nz))
-     152           0 :                 throw std::runtime_error("loadGrid: file and grid size do not match");
-     153             : 
-     154           4 :         for (int ix = 0; ix < grid->getNx(); ix++) {
-     155          12 :                 for (int iy = 0; iy < grid->getNy(); iy++) {
-     156          36 :                         for (int iz = 0; iz < grid->getNz(); iz++) {
-     157             :                                 Vector3f &b = grid->get(ix, iy, iz);
-     158          27 :                                 fin.read((char*) &(b.x), sizeof(float));
-     159          27 :                                 fin.read((char*) &(b.y), sizeof(float));
-     160          27 :                                 fin.read((char*) &(b.z), sizeof(float));
-     161          27 :                                 b *= c;
-     162             :                         }
-     163             :                 }
-     164             :         }
-     165           1 :         fin.close();
-     166           1 : }
-     167             : 
-     168           0 : void loadGrid(ref_ptr<Grid1f> grid, std::string filename, double c) {
-     169           0 :         std::ifstream fin(filename.c_str(), std::ios::binary);
-     170           0 :         if (!fin) {
-     171           0 :                 std::stringstream ss;
-     172           0 :                 ss << "load Grid1f: " << filename << " not found";
-     173           0 :                 throw std::runtime_error(ss.str());
-     174           0 :         }
-     175             : 
-     176             :         // get length of file and compare to size of grid
-     177           0 :         fin.seekg(0, fin.end);
-     178           0 :         size_t length = fin.tellg() / sizeof(float);
-     179           0 :         fin.seekg (0, fin.beg);
-     180             : 
-     181             :         size_t nx = grid->getNx();
-     182             :         size_t ny = grid->getNy();
-     183             :         size_t nz = grid->getNz();
-     184             : 
-     185           0 :         if (length != (nx * ny * nz))
-     186           0 :                 throw std::runtime_error("loadGrid: file and grid size do not match");
-     187             : 
-     188           0 :         for (int ix = 0; ix < nx; ix++) {
-     189           0 :                 for (int iy = 0; iy < ny; iy++) {
-     190           0 :                         for (int iz = 0; iz < nz; iz++) {
-     191             :                                 float &b = grid->get(ix, iy, iz);
-     192           0 :                                 fin.read((char*) &b, sizeof(float));
-     193           0 :                                 b *= c;
-     194             :                         }
-     195             :                 }
-     196             :         }
-     197           0 :         fin.close();
-     198           0 : }
-     199             : 
-     200           1 : void dumpGrid(ref_ptr<Grid3f> grid, std::string filename, double c) {
-     201           1 :         std::ofstream fout(filename.c_str(), std::ios::binary);
-     202           1 :         if (!fout) {
-     203           0 :                 std::stringstream ss;
-     204           0 :                 ss << "dump Grid3f: " << filename << " not found";
-     205           0 :                 throw std::runtime_error(ss.str());
-     206           0 :         }
-     207           4 :         for (int ix = 0; ix < grid->getNx(); ix++) {
-     208          12 :                 for (int iy = 0; iy < grid->getNy(); iy++) {
-     209          36 :                         for (int iz = 0; iz < grid->getNz(); iz++) {
-     210          27 :                                 Vector3f b = grid->get(ix, iy, iz) * c;
-     211          27 :                                 fout.write((char*) &(b.x), sizeof(float));
-     212          27 :                                 fout.write((char*) &(b.y), sizeof(float));
-     213          27 :                                 fout.write((char*) &(b.z), sizeof(float));
-     214             :                         }
-     215             :                 }
-     216             :         }
-     217           1 :         fout.close();
-     218           1 : }
-     219             : 
-     220           0 : void dumpGrid(ref_ptr<Grid1f> grid, std::string filename, double c) {
-     221           0 :         std::ofstream fout(filename.c_str(), std::ios::binary);
-     222           0 :         if (!fout) {
-     223           0 :                 std::stringstream ss;
-     224           0 :                 ss << "dump Grid1f: " << filename << " not found";
-     225           0 :                 throw std::runtime_error(ss.str());
-     226           0 :         }
-     227           0 :         for (int ix = 0; ix < grid->getNx(); ix++) {
-     228           0 :                 for (int iy = 0; iy < grid->getNy(); iy++) {
-     229           0 :                         for (int iz = 0; iz < grid->getNz(); iz++) {
-     230           0 :                                 float b = grid->get(ix, iy, iz) * c;
-     231           0 :                                 fout.write((char*) &b, sizeof(float));
-     232             :                         }
-     233             :                 }
-     234             :         }
-     235           0 :         fout.close();
-     236           0 : }
-     237             : 
-     238           1 : void loadGridFromTxt(ref_ptr<Grid3f> grid, std::string filename, double c) {
-     239           1 :         std::ifstream fin(filename.c_str());
-     240           1 :         if (!fin) {
-     241           0 :                 std::stringstream ss;
-     242           0 :                 ss << "load Grid3f: " << filename << " not found";
-     243           0 :                 throw std::runtime_error(ss.str());
-     244           0 :         }
-     245             :         // skip header lines
-     246           1 :         while (fin.peek() == '#')
-     247           0 :                 fin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
-     248             : 
-     249           4 :         for (int ix = 0; ix < grid->getNx(); ix++) {
-     250          12 :                 for (int iy = 0; iy < grid->getNy(); iy++) {
-     251          36 :                         for (int iz = 0; iz < grid->getNz(); iz++) {
-     252             :                                 Vector3f &b = grid->get(ix, iy, iz);
-     253          27 :                                 fin >> b.x >> b.y >> b.z;
-     254          27 :                                 b *= c;
-     255          27 :                                 if (fin.eof())
-     256           0 :                                         throw std::runtime_error("load Grid3f: file too short");
-     257             :                         }
-     258             :                 }
-     259             :         }
-     260           1 :         fin.close();
-     261           1 : }
-     262             : 
-     263           0 : void loadGridFromTxt(ref_ptr<Grid1f> grid, std::string filename, double c) {
-     264           0 :         std::ifstream fin(filename.c_str());
-     265           0 :         if (!fin) {
-     266           0 :                 std::stringstream ss;
-     267           0 :                 ss << "load Grid1f: " << filename << " not found";
-     268           0 :                 throw std::runtime_error(ss.str());
-     269           0 :         }
-     270             :         // skip header lines
-     271           0 :         while (fin.peek() == '#')
-     272           0 :                 fin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
-     273             : 
-     274           0 :         for (int ix = 0; ix < grid->getNx(); ix++) {
-     275           0 :                 for (int iy = 0; iy < grid->getNy(); iy++) {
-     276           0 :                         for (int iz = 0; iz < grid->getNz(); iz++) {
-     277             :                                 float &b = grid->get(ix, iy, iz);
-     278             :                                 fin >> b;
-     279           0 :                                 b *= c;
-     280           0 :                                 if (fin.eof())
-     281           0 :                                         throw std::runtime_error("load Grid1f: file too short");
-     282             :                         }
-     283             :                 }
-     284             :         }
-     285           0 :         fin.close();
-     286           0 : }
-     287             : 
-     288           1 : void dumpGridToTxt(ref_ptr<Grid3f> grid, std::string filename, double c) {
-     289           1 :         std::ofstream fout(filename.c_str());
-     290           1 :         if (!fout) {
-     291           0 :                 std::stringstream ss;
-     292           0 :                 ss << "dump Grid3f: " << filename << " not found";
-     293           0 :                 throw std::runtime_error(ss.str());
-     294           0 :         }
-     295           4 :         for (int ix = 0; ix < grid->getNx(); ix++) {
-     296          12 :                 for (int iy = 0; iy < grid->getNy(); iy++) {
-     297          36 :                         for (int iz = 0; iz < grid->getNz(); iz++) {
-     298          27 :                                 Vector3f b = grid->get(ix, iy, iz) * c;
-     299          27 :                                 fout << b << "\n";
-     300             :                         }
-     301             :                 }
-     302             :         }
-     303           1 :         fout.close();
-     304           1 : }
-     305             : 
-     306           0 : void dumpGridToTxt(ref_ptr<Grid1f> grid, std::string filename, double c) {
-     307           0 :         std::ofstream fout(filename.c_str());
-     308           0 :         if (!fout) {
-     309           0 :                 std::stringstream ss;
-     310           0 :                 ss << "dump Grid1f: " << filename << " not found";
-     311           0 :                 throw std::runtime_error(ss.str());
-     312           0 :         }
-     313           0 :         for (int ix = 0; ix < grid->getNx(); ix++) {
-     314           0 :                 for (int iy = 0; iy < grid->getNy(); iy++) {
-     315           0 :                         for (int iz = 0; iz < grid->getNz(); iz++) {
-     316           0 :                                 float b = grid->get(ix, iy, iz) * c;
-     317           0 :                                 fout << b << "\n";
-     318             :                         }
-     319             :                 }
-     320             :         }
-     321           0 :         fout.close();
-     322           0 : }
-     323             : 
-     324             : #ifdef CRPROPA_HAVE_FFTW3F
-     325             : 
-     326           0 : std::vector<std::pair<int, float>> gridPowerSpectrum(ref_ptr<Grid3f> grid) {
-     327             : 
-     328           0 :   double rms = rmsFieldStrength(grid);
-     329             :   size_t n = grid->getNx(); // size of array
-     330             : 
-     331             :   // arrays to hold the complex vector components of the B(k)-field
-     332             :   fftwf_complex *Bkx, *Bky, *Bkz;
-     333           0 :   Bkx = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * n * n * n);
-     334           0 :   Bky = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * n * n * n);
-     335           0 :   Bkz = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * n * n * n);
-     336             : 
-     337             :   fftwf_complex *Bx = (fftwf_complex *)Bkx;
-     338             :   fftwf_complex *By = (fftwf_complex *)Bky;
-     339             :   fftwf_complex *Bz = (fftwf_complex *)Bkz;
-     340             : 
-     341             :   // save to temp
-     342             :   int i;
-     343           0 :   for (size_t ix = 0; ix < n; ix++) {
-     344           0 :     for (size_t iy = 0; iy < n; iy++) {
-     345           0 :       for (size_t iz = 0; iz < n; iz++) {
-     346           0 :         i = ix * n * n + iy * n + iz;
-     347             :         Vector3<float> &b = grid->get(ix, iy, iz);
-     348           0 :         Bx[i][0] = b.x / rms;
-     349           0 :         By[i][0] = b.y / rms;
-     350           0 :         Bz[i][0] = b.z / rms;
-     351             :       }
-     352             :     }
-     353             :   }
-     354             : 
-     355             :   // in-place, real to complex, inverse Fourier transformation on each component
-     356             :   // note that the last elements of B(x) are unused now
-     357             :   fftwf_plan plan_x =
-     358           0 :       fftwf_plan_dft_3d(n, n, n, Bx, Bkx, FFTW_FORWARD, FFTW_ESTIMATE);
-     359           0 :   fftwf_execute(plan_x);
-     360           0 :   fftwf_destroy_plan(plan_x);
-     361             : 
-     362             :   fftwf_plan plan_y =
-     363           0 :       fftwf_plan_dft_3d(n, n, n, By, Bky, FFTW_FORWARD, FFTW_ESTIMATE);
-     364           0 :   fftwf_execute(plan_y);
-     365           0 :   fftwf_destroy_plan(plan_y);
-     366             : 
-     367             :   fftwf_plan plan_z =
-     368           0 :       fftwf_plan_dft_3d(n, n, n, Bz, Bkz, FFTW_FORWARD, FFTW_ESTIMATE);
-     369           0 :   fftwf_execute(plan_z);
-     370           0 :   fftwf_destroy_plan(plan_z);
-     371             : 
-     372             :   float power;
-     373             :   std::map<size_t, std::pair<float, int>> spectrum;
-     374             :   int k;
-     375             : 
-     376           0 :   for (size_t ix = 0; ix < n; ix++) {
-     377           0 :     for (size_t iy = 0; iy < n; iy++) {
-     378           0 :       for (size_t iz = 0; iz < n; iz++) {
-     379           0 :         i = ix * n * n + iy * n + iz;
-     380           0 :         k = static_cast<int>(
-     381           0 :             std::floor(std::sqrt(ix * ix + iy * iy + iz * iz)));
-     382           0 :         if (k > n / 2. || k == 0)
-     383           0 :           continue;
-     384           0 :         power = ((Bkx[i][0] * Bkx[i][0] + Bkx[i][1] * Bkx[i][1]) +
-     385           0 :                  (Bky[i][0] * Bky[i][0] + Bky[i][1] * Bky[i][1]) +
-     386           0 :                  (Bkz[i][0] * Bkz[i][0] + Bkz[i][1] * Bkz[i][1]));
-     387           0 :         if (spectrum.find(k) == spectrum.end()) {
-     388           0 :           spectrum[k].first = power;
-     389           0 :           spectrum[k].second = 1;
-     390             :         } else {
-     391           0 :           spectrum[k].first += power;
-     392           0 :           spectrum[k].second += 1;
-     393             :         }
-     394             :       }
-     395             :     }
-     396             :   }
-     397             : 
-     398           0 :   fftwf_free(Bkx);
-     399           0 :   fftwf_free(Bky);
-     400           0 :   fftwf_free(Bkz);
-     401             : 
-     402             :   std::vector<std::pair<int, float>> points;
-     403           0 :   for (std::map<size_t, std::pair<float, int>>::iterator it = spectrum.begin();
-     404           0 :        it != spectrum.end(); ++it) {
-     405           0 :     points.push_back(
-     406           0 :         std::make_pair(it->first, (it->second).first / (it->second).second));
-     407             :   }
-     408             : 
-     409           0 :   return points;
-     410             : }
-     411             : 
-     412             : #endif // CRPROPA_HAVE_FFTW3F
-     413             : 
-     414             : 
-     415             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Module.cpp.func-sort-c.html b/doc/coverageReport/src/Module.cpp.func-sort-c.html deleted file mode 100644 index 16f3b25e6..000000000 --- a/doc/coverageReport/src/Module.cpp.func-sort-c.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Module.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Module.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:374877.1 %
Date:2024-04-08 14:58:22Functions:91275.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa17AbstractCondition13setAcceptFlagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_0
_ZN7crpropa17AbstractCondition23setMakeAcceptedInactiveEb0
_ZNK7crpropa6Module14getDescriptionB5cxx11Ev0
_ZN7crpropa17AbstractCondition13setRejectFlagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_1
_ZN7crpropa17AbstractCondition23setMakeRejectedInactiveEb1
_ZN7crpropa17AbstractCondition8onAcceptEPNS_6ModuleE1
_ZN7crpropa17AbstractCondition8onRejectEPNS_6ModuleE1
_ZNK7crpropa17AbstractCondition6acceptEPNS_9CandidateE2
_ZN7crpropa17AbstractConditionC2Ev33
_ZN7crpropa6ModuleC2Ev209
_ZN7crpropa6Module14setDescriptionERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE365
_ZNK7crpropa17AbstractCondition6rejectEPNS_9CandidateE1126
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Module.cpp.func.html b/doc/coverageReport/src/Module.cpp.func.html deleted file mode 100644 index b0c8fb43e..000000000 --- a/doc/coverageReport/src/Module.cpp.func.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Module.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Module.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:374877.1 %
Date:2024-04-08 14:58:22Functions:91275.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa17AbstractCondition13setAcceptFlagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_0
_ZN7crpropa17AbstractCondition13setRejectFlagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_1
_ZN7crpropa17AbstractCondition23setMakeAcceptedInactiveEb0
_ZN7crpropa17AbstractCondition23setMakeRejectedInactiveEb1
_ZN7crpropa17AbstractCondition8onAcceptEPNS_6ModuleE1
_ZN7crpropa17AbstractCondition8onRejectEPNS_6ModuleE1
_ZN7crpropa17AbstractConditionC2Ev33
_ZN7crpropa6Module14setDescriptionERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE365
_ZN7crpropa6ModuleC2Ev209
_ZNK7crpropa17AbstractCondition6acceptEPNS_9CandidateE2
_ZNK7crpropa17AbstractCondition6rejectEPNS_9CandidateE1126
_ZNK7crpropa6Module14getDescriptionB5cxx11Ev0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Module.cpp.gcov.html b/doc/coverageReport/src/Module.cpp.gcov.html deleted file mode 100644 index 3dc4592a3..000000000 --- a/doc/coverageReport/src/Module.cpp.gcov.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Module.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Module.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:374877.1 %
Date:2024-04-08 14:58:22Functions:91275.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/Module.h"
-       2             : 
-       3             : #include <typeinfo>
-       4             : 
-       5             : namespace crpropa {
-       6             : 
-       7         209 : Module::Module() {
-       8             :         const std::type_info &info = typeid(*this);
-       9         209 :         setDescription(info.name());
-      10         209 : }
-      11             : 
-      12           0 : std::string Module::getDescription() const {
-      13           0 :         return description;
-      14             : }
-      15             : 
-      16         365 : void Module::setDescription(const std::string &d) {
-      17         365 :         description = d;
-      18         365 : }
-      19             : 
-      20          33 : AbstractCondition::AbstractCondition() :
-      21          33 :                 makeRejectedInactive(true), makeAcceptedInactive(false), rejectFlagKey(
-      22          33 :                                 "Rejected") {
-      23             : 
-      24          33 : }
-      25             : 
-      26        1126 : void AbstractCondition::reject(Candidate *candidate) const {
-      27        1126 :         if (!candidate)
-      28             :                 return;
-      29             : 
-      30        1126 :         if (rejectAction.valid())
-      31           5 :                 rejectAction->process(candidate);
-      32             : 
-      33        1126 :         if (!rejectFlagKey.empty())
-      34        1126 :                 candidate->setProperty(rejectFlagKey, rejectFlagValue);
-      35             : 
-      36        1126 :         if (makeRejectedInactive)
-      37        1125 :                 candidate->setActive(false);
-      38             : }
-      39             : 
-      40           2 : void AbstractCondition::accept(Candidate *candidate) const {
-      41           2 :         if (!candidate)
-      42             :                 return;
-      43             : 
-      44           2 :         if (acceptAction.valid())
-      45           2 :                 acceptAction->process(candidate);
-      46             : 
-      47           2 :         if (!acceptFlagKey.empty())
-      48           0 :                 candidate->setProperty(acceptFlagKey, acceptFlagValue);
-      49             : 
-      50           2 :         if (makeAcceptedInactive)
-      51           0 :                 candidate->setActive(false);
-      52             : }
-      53             : 
-      54           1 : void AbstractCondition::setMakeRejectedInactive(bool deactivate) {
-      55           1 :         makeRejectedInactive = deactivate;
-      56           1 : }
-      57             : 
-      58           0 : void AbstractCondition::setMakeAcceptedInactive(bool deactivate) {
-      59           0 :         makeAcceptedInactive = deactivate;
-      60           0 : }
-      61             : 
-      62           1 : void AbstractCondition::onReject(Module *action) {
-      63           1 :         rejectAction = action;
-      64           1 : }
-      65             : 
-      66           1 : void AbstractCondition::onAccept(Module *action) {
-      67           1 :         acceptAction = action;
-      68           1 : }
-      69             : 
-      70           1 : void AbstractCondition::setRejectFlag(std::string key, std::string value) {
-      71           1 :         rejectFlagKey = key;
-      72           1 :         rejectFlagValue = value;
-      73           1 : }
-      74             : 
-      75           0 : void AbstractCondition::setAcceptFlag(std::string key, std::string value) {
-      76           0 :         acceptFlagKey = key;
-      77           0 :         acceptFlagValue = value;
-      78           0 : }
-      79             : 
-      80             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/ParticleID.cpp.func-sort-c.html b/doc/coverageReport/src/ParticleID.cpp.func-sort-c.html deleted file mode 100644 index 02a39f19f..000000000 --- a/doc/coverageReport/src/ParticleID.cpp.func-sort-c.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/ParticleID.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - ParticleID.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:163053.3 %
Date:2024-04-08 14:58:22Functions:4580.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa15convertIdToNameB5cxx11Ei0
_ZN7crpropa9nucleusIdEii45149
_ZN7crpropa10massNumberEi202819
_ZN7crpropa12chargeNumberEi364529
_ZN7crpropa9isNucleusEi20370056
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/ParticleID.cpp.func.html b/doc/coverageReport/src/ParticleID.cpp.func.html deleted file mode 100644 index 70f77a588..000000000 --- a/doc/coverageReport/src/ParticleID.cpp.func.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/ParticleID.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - ParticleID.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:163053.3 %
Date:2024-04-08 14:58:22Functions:4580.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa10massNumberEi202819
_ZN7crpropa12chargeNumberEi364529
_ZN7crpropa15convertIdToNameB5cxx11Ei0
_ZN7crpropa9isNucleusEi20370056
_ZN7crpropa9nucleusIdEii45149
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/ParticleID.cpp.gcov.html b/doc/coverageReport/src/ParticleID.cpp.gcov.html deleted file mode 100644 index 917e4a925..000000000 --- a/doc/coverageReport/src/ParticleID.cpp.gcov.html +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/ParticleID.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - ParticleID.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:163053.3 %
Date:2024-04-08 14:58:22Functions:4580.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/ParticleID.h"
-       2             : 
-       3             : #include "HepPID/ParticleIDMethods.hh"
-       4             : #include "HepPID/ParticleName.hh"
-       5             : #include "kiss/convert.h"
-       6             : 
-       7             : #include <string>
-       8             : 
-       9             : namespace crpropa {
-      10             : 
-      11       45149 : int nucleusId(int a, int z) {
-      12       45149 :         if (z < 0)
-      13           0 :                 throw std::runtime_error(
-      14           0 :                                 "crpropa::Nucleus: no nucleus with Z < 0, A=" + kiss::str(a) + " Z="
-      15           0 :                                                 + kiss::str(z));
-      16       45149 :         if (a < 1)
-      17           0 :                 throw std::runtime_error(
-      18           0 :                                 "crpropa::Nucleus: no nucleus with A < 1, A=" + kiss::str(a) + " Z="
-      19           0 :                                                 + kiss::str(z));
-      20       45149 :         if (a < z)
-      21           1 :                 throw std::runtime_error(
-      22           2 :                                 "crpropa::Nucleus: no nucleus with A < Z, A=" + kiss::str(a) + " Z="
-      23           4 :                                                 + kiss::str(z));
-      24       45148 :         return 1000000000 + z * 10000 + a * 10;
-      25             : }
-      26             : 
-      27      364529 : int chargeNumber(int id) {
-      28      364529 :         return HepPID::Z(id);
-      29             : }
-      30             : 
-      31      202819 : int massNumber(int id) {
-      32      202819 :         if (id == 2112)
-      33             :                 return 1;
-      34      202818 :         return HepPID::A(id);
-      35             : }
-      36             : 
-      37    20370056 : bool isNucleus(int id) {
-      38    20370056 :         if (id == 2112)
-      39             :                 return true; // consider neutron as nucleus
-      40    20370056 :         return HepPID::isNucleus(id);
-      41             : }
-      42             : 
-      43           0 : std::string convertIdToName(int id) {
-      44             :         // handle a few extra cases that HepPID doesn't like
-      45           0 :         if (id == 1000000010) // neutron
-      46           0 :                 id = 2112;
-      47           0 :         if (id == -1000000010) // anti-neutron
-      48           0 :                 id = -2112;
-      49           0 :         if (id == -1000010010) // anti-proton
-      50           0 :                 id = -2212;
-      51           0 :         return HepPID::particleName(id);
-      52             : }
-      53             : 
-      54             : }
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/ParticleMass.cpp.func-sort-c.html b/doc/coverageReport/src/ParticleMass.cpp.func-sort-c.html deleted file mode 100644 index 684f8b4f6..000000000 --- a/doc/coverageReport/src/ParticleMass.cpp.func-sort-c.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/ParticleMass.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - ParticleMass.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:303196.8 %
Date:2024-04-08 14:58:22Functions:44100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16NuclearMassTable4initEv12
_ZN7crpropa11nuclearMassEi161184
_ZN7crpropa16NuclearMassTable7getMassEm161208
_ZN7crpropa11nuclearMassEii161209
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/ParticleMass.cpp.func.html b/doc/coverageReport/src/ParticleMass.cpp.func.html deleted file mode 100644 index f0fe27c62..000000000 --- a/doc/coverageReport/src/ParticleMass.cpp.func.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/ParticleMass.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - ParticleMass.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:303196.8 %
Date:2024-04-08 14:58:22Functions:44100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11nuclearMassEi161184
_ZN7crpropa11nuclearMassEii161209
_ZN7crpropa16NuclearMassTable4initEv12
_ZN7crpropa16NuclearMassTable7getMassEm161208
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/ParticleMass.cpp.gcov.html b/doc/coverageReport/src/ParticleMass.cpp.gcov.html deleted file mode 100644 index 22315606f..000000000 --- a/doc/coverageReport/src/ParticleMass.cpp.gcov.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/ParticleMass.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - ParticleMass.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:303196.8 %
Date:2024-04-08 14:58:22Functions:44100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/ParticleMass.h"
-       2             : #include "crpropa/ParticleID.h"
-       3             : #include "crpropa/Common.h"
-       4             : #include "crpropa/Units.h"
-       5             : 
-       6             : #include "kiss/convert.h"
-       7             : #include "kiss/logger.h"
-       8             : 
-       9             : #include <vector>
-      10             : #include <fstream>
-      11             : #include <stdexcept>
-      12             : #include <limits>
-      13             : 
-      14             : namespace crpropa {
-      15             : 
-      16             : struct NuclearMassTable {
-      17             :         bool initialized;
-      18             :         std::vector<double> table;
-      19             : 
-      20             :         NuclearMassTable() {
-      21             :                 initialized = false;
-      22             :         }
-      23             : 
-      24          12 :         void init() {
-      25          24 :                 std::string filename = getDataPath("nuclear_mass.txt");
-      26          12 :                 std::ifstream infile(filename.c_str());
-      27             : 
-      28          12 :                 if (!infile.good())
-      29           0 :                         throw std::runtime_error("crpropa: could not open file " + filename);
-      30             : 
-      31             :                 int Z, N;
-      32             :                 double mass;
-      33       10092 :                 while (infile.good()) {
-      34       10080 :                         if (infile.peek() != '#') {
-      35       10056 :                                 infile >> Z >> N >> mass;
-      36       10056 :                                 table.push_back(mass);
-      37             :                         }
-      38       10080 :                         infile.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
-      39             :                 }
-      40             : 
-      41          12 :                 infile.close();
-      42          12 :                 initialized = true;
-      43          24 :         }
-      44             : 
-      45      161208 :         double getMass(std::size_t idx) {
-      46      161208 :                 if (!initialized) {
-      47          12 : #pragma omp critical(init)
-      48          12 :                         init();
-      49             :                 }
-      50      161208 :                 return table[idx];
-      51             :         }
-      52             : };
-      53             : 
-      54             : static NuclearMassTable nuclearMassTable;
-      55             : 
-      56      161184 : double nuclearMass(int id) {
-      57      161184 :         int A = massNumber(id);
-      58      161184 :         int Z = chargeNumber(id);
-      59      161184 :         return nuclearMass(A, Z);
-      60             : }
-      61             : 
-      62      161209 : double nuclearMass(int A, int Z) {
-      63      161209 :         if ((A < 1) or (A > 56) or (Z < 0) or (Z > 26) or (Z > A)) {
-      64           2 :                 KISS_LOG_WARNING <<
-      65           1 :                 "nuclearMass: nuclear mass not found in the mass table for " <<
-      66           1 :                 "A = " << A << ", Z = " << Z << ". " <<
-      67           1 :                 "Approximated value used A * amu - Z * m_e instead.";
-      68           1 :                 return A * amu - Z * mass_electron;
-      69             :         }
-      70      161208 :         int N = A - Z;
-      71      161208 :         return nuclearMassTable.getMass(Z * 31 + N);
-      72             : }
-      73             : 
-      74             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/ParticleState.cpp.func-sort-c.html b/doc/coverageReport/src/ParticleState.cpp.func-sort-c.html deleted file mode 100644 index c6897830a..000000000 --- a/doc/coverageReport/src/ParticleState.cpp.func-sort-c.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/ParticleState.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - ParticleState.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:485685.7 %
Date:2024-04-08 14:58:22Functions:161794.1 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa13ParticleState14getDescriptionB5cxx11Ev0
_ZNK7crpropa13ParticleState11getRigidityEv1
_ZNK7crpropa13ParticleState11getVelocityEv1
_ZNK7crpropa13ParticleState11getMomentumEv2
_ZNK7crpropa13ParticleState7getMassEv4
_ZN7crpropa13ParticleState16setLorentzFactorEd15420
_ZNK7crpropa13ParticleState16getLorentzFactorEv33182
_ZNK7crpropa13ParticleState5getIdEv290682
_ZNK7crpropa13ParticleState12getDirectionEv500446
_ZNK7crpropa13ParticleState9getEnergyEv603581
_ZNK7crpropa13ParticleState9getChargeEv960335
_ZNK7crpropa13ParticleState11getPositionEv12488919
_ZN7crpropa13ParticleStateC2EidNS_7Vector3IdEES2_16844401
_ZN7crpropa13ParticleState12setDirectionERKNS_7Vector3IdEE17329639
_ZN7crpropa13ParticleState5setIdEi20314515
_ZN7crpropa13ParticleState9setEnergyEd20322799
_ZN7crpropa13ParticleState11setPositionERKNS_7Vector3IdEE24114998
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/ParticleState.cpp.func.html b/doc/coverageReport/src/ParticleState.cpp.func.html deleted file mode 100644 index 2ad881fd0..000000000 --- a/doc/coverageReport/src/ParticleState.cpp.func.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/ParticleState.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - ParticleState.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:485685.7 %
Date:2024-04-08 14:58:22Functions:161794.1 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa13ParticleState11setPositionERKNS_7Vector3IdEE24114998
_ZN7crpropa13ParticleState12setDirectionERKNS_7Vector3IdEE17329639
_ZN7crpropa13ParticleState16setLorentzFactorEd15420
_ZN7crpropa13ParticleState5setIdEi20314515
_ZN7crpropa13ParticleState9setEnergyEd20322799
_ZN7crpropa13ParticleStateC2EidNS_7Vector3IdEES2_16844401
_ZNK7crpropa13ParticleState11getMomentumEv2
_ZNK7crpropa13ParticleState11getPositionEv12488919
_ZNK7crpropa13ParticleState11getRigidityEv1
_ZNK7crpropa13ParticleState11getVelocityEv1
_ZNK7crpropa13ParticleState12getDirectionEv500446
_ZNK7crpropa13ParticleState14getDescriptionB5cxx11Ev0
_ZNK7crpropa13ParticleState16getLorentzFactorEv33182
_ZNK7crpropa13ParticleState5getIdEv290682
_ZNK7crpropa13ParticleState7getMassEv4
_ZNK7crpropa13ParticleState9getChargeEv960335
_ZNK7crpropa13ParticleState9getEnergyEv603581
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/ParticleState.cpp.gcov.html b/doc/coverageReport/src/ParticleState.cpp.gcov.html deleted file mode 100644 index 34ba83680..000000000 --- a/doc/coverageReport/src/ParticleState.cpp.gcov.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/ParticleState.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - ParticleState.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:485685.7 %
Date:2024-04-08 14:58:22Functions:161794.1 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/ParticleState.h"
-       2             : #include "crpropa/Units.h"
-       3             : #include "crpropa/Common.h"
-       4             : #include "crpropa/ParticleID.h"
-       5             : #include "crpropa/ParticleMass.h"
-       6             : 
-       7             : #include "HepPID/ParticleIDMethods.hh"
-       8             : 
-       9             : #include <cstdlib>
-      10             : #include <sstream>
-      11             : 
-      12             : namespace crpropa {
-      13             : 
-      14    16844401 : ParticleState::ParticleState(int id, double E, Vector3d pos, Vector3d dir): id(0), energy(0.), position(0.), direction(0.), pmass(0.), charge(0.)
-      15             : {
-      16    16844401 :         setId(id);
-      17    16844401 :         setEnergy(E);
-      18    16844401 :         setPosition(pos);
-      19    16844401 :         setDirection(dir);
-      20    16844401 : }
-      21             : 
-      22    24114998 : void ParticleState::setPosition(const Vector3d &pos) {
-      23             :         position = pos;
-      24    24114998 : }
-      25             : 
-      26    12488919 : const Vector3d &ParticleState::getPosition() const {
-      27    12488919 :         return position;
-      28             : }
-      29             : 
-      30    17329639 : void ParticleState::setDirection(const Vector3d &dir) {
-      31             :         direction = dir / dir.getR();
-      32    17329639 : }
-      33             : 
-      34      500446 : const Vector3d &ParticleState::getDirection() const {
-      35      500446 :         return direction;
-      36             : }
-      37             : 
-      38    20322799 : void ParticleState::setEnergy(double newEnergy) {
-      39    20322799 :         energy = std::max(0., newEnergy); // prevent negative energies
-      40    20322799 : }
-      41             : 
-      42      603581 : double ParticleState::getEnergy() const {
-      43      603581 :         return energy;
-      44             : }
-      45             : 
-      46           1 : double ParticleState::getRigidity() const {
-      47           1 :         return fabs(energy / charge);
-      48             : }
-      49             : 
-      50    20314515 : void ParticleState::setId(int newId) {
-      51    20314515 :         id = newId;
-      52    20314515 :         if (isNucleus(id)) {
-      53      146261 :                 pmass = nuclearMass(id);
-      54      146261 :                 charge = chargeNumber(id) * eplus;
-      55      146261 :                 if (id < 0)
-      56           4 :                         charge *= -1; // anti-nucleus
-      57             :         } else {
-      58    20168254 :                 if (abs(id) == 11)
-      59       15064 :                         pmass = mass_electron;
-      60    20168254 :                 charge = HepPID::charge(id) * eplus;
-      61             :         }
-      62    20314515 : }
-      63             : 
-      64      290682 : int ParticleState::getId() const {
-      65      290682 :         return id;
-      66             : }
-      67             : 
-      68           4 : double ParticleState::getMass() const {
-      69           4 :         return pmass;
-      70             : }
-      71             : 
-      72      960335 : double ParticleState::getCharge() const {
-      73      960335 :         return charge;
-      74             : }
-      75             : 
-      76       33182 : double ParticleState::getLorentzFactor() const {
-      77       33182 :         return energy / (pmass * c_squared);
-      78             : }
-      79             : 
-      80       15420 : void ParticleState::setLorentzFactor(double lf) {
-      81       15420 :         lf = std::max(0., lf); // prevent negative Lorentz factors
-      82       15420 :         energy = lf * pmass * c_squared;
-      83       15420 : }
-      84             : 
-      85           1 : Vector3d ParticleState::getVelocity() const {
-      86           1 :         return direction * c_light;
-      87             : }
-      88             : 
-      89           2 : Vector3d ParticleState::getMomentum() const {
-      90           2 :         return direction * (energy / c_light);
-      91             : }
-      92             : 
-      93           0 : std::string ParticleState::getDescription() const {
-      94           0 :         std::stringstream ss;
-      95           0 :         ss << "Particle " << id << ", ";
-      96           0 :         ss << "E = " << energy / EeV << " EeV, ";
-      97           0 :         ss << "x = " << position / Mpc << " Mpc, ";
-      98           0 :         ss << "p = " << direction;
-      99           0 :         return ss.str();
-     100           0 : }
-     101             : 
-     102             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/PhotonBackground.cpp.func-sort-c.html b/doc/coverageReport/src/PhotonBackground.cpp.func-sort-c.html deleted file mode 100644 index eca58f129..000000000 --- a/doc/coverageReport/src/PhotonBackground.cpp.func-sort-c.html +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/PhotonBackground.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - PhotonBackground.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8812073.3 %
Date:2024-04-08 14:58:22Functions:121580.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa20BlackbodyPhotonField11setQuantileEd0
_ZNK7crpropa18TabularPhotonField22getMaximumPhotonEnergyEd0
_ZNK7crpropa18TabularPhotonField22getMinimumPhotonEnergyEd0
_ZNK7crpropa20BlackbodyPhotonField22getMaximumPhotonEnergyEd29
_ZNK7crpropa20BlackbodyPhotonField22getMinimumPhotonEnergyEd29
_ZN7crpropa20BlackbodyPhotonFieldC2ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd40
_ZN7crpropa18TabularPhotonField12readRedshiftENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE73
_ZN7crpropa18TabularPhotonField19initRedshiftScalingEv73
_ZN7crpropa18TabularPhotonField16readPhotonEnergyENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE94
_ZN7crpropa18TabularPhotonField17readPhotonDensityENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE94
_ZN7crpropa18TabularPhotonFieldC2ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb94
_ZNK7crpropa18TabularPhotonField14checkInputDataEv94
_ZNK7crpropa20BlackbodyPhotonField16getPhotonDensityEdd10689
_ZNK7crpropa18TabularPhotonField18getRedshiftScalingEd16757
_ZNK7crpropa18TabularPhotonField16getPhotonDensityEdd9536930
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/PhotonBackground.cpp.func.html b/doc/coverageReport/src/PhotonBackground.cpp.func.html deleted file mode 100644 index c0525218b..000000000 --- a/doc/coverageReport/src/PhotonBackground.cpp.func.html +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/PhotonBackground.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - PhotonBackground.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8812073.3 %
Date:2024-04-08 14:58:22Functions:121580.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa18TabularPhotonField12readRedshiftENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE73
_ZN7crpropa18TabularPhotonField16readPhotonEnergyENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE94
_ZN7crpropa18TabularPhotonField17readPhotonDensityENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE94
_ZN7crpropa18TabularPhotonField19initRedshiftScalingEv73
_ZN7crpropa18TabularPhotonFieldC2ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb94
_ZN7crpropa20BlackbodyPhotonField11setQuantileEd0
_ZN7crpropa20BlackbodyPhotonFieldC2ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd40
_ZNK7crpropa18TabularPhotonField14checkInputDataEv94
_ZNK7crpropa18TabularPhotonField16getPhotonDensityEdd9536930
_ZNK7crpropa18TabularPhotonField18getRedshiftScalingEd16757
_ZNK7crpropa18TabularPhotonField22getMaximumPhotonEnergyEd0
_ZNK7crpropa18TabularPhotonField22getMinimumPhotonEnergyEd0
_ZNK7crpropa20BlackbodyPhotonField16getPhotonDensityEdd10689
_ZNK7crpropa20BlackbodyPhotonField22getMaximumPhotonEnergyEd29
_ZNK7crpropa20BlackbodyPhotonField22getMinimumPhotonEnergyEd29
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/PhotonBackground.cpp.gcov.html b/doc/coverageReport/src/PhotonBackground.cpp.gcov.html deleted file mode 100644 index 7d90ae0f2..000000000 --- a/doc/coverageReport/src/PhotonBackground.cpp.gcov.html +++ /dev/null @@ -1,291 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/PhotonBackground.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - PhotonBackground.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8812073.3 %
Date:2024-04-08 14:58:22Functions:121580.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/PhotonBackground.h"
-       2             : #include "crpropa/Units.h"
-       3             : #include "crpropa/Random.h"
-       4             : 
-       5             : #include "kiss/logger.h"
-       6             : 
-       7             : #include <fstream>
-       8             : #include <stdexcept>
-       9             : #include <limits>
-      10             : #include <cmath>
-      11             : 
-      12             : namespace crpropa {
-      13             : 
-      14          94 : TabularPhotonField::TabularPhotonField(std::string fieldName, bool isRedshiftDependent) {
-      15          94 :         this->fieldName = fieldName;
-      16          94 :         this->isRedshiftDependent = isRedshiftDependent;
-      17             : 
-      18         188 :         readPhotonEnergy(getDataPath("") + "Scaling/" + this->fieldName + "_photonEnergy.txt");
-      19         188 :         readPhotonDensity(getDataPath("") + "Scaling/" + this->fieldName + "_photonDensity.txt");
-      20          94 :         if (this->isRedshiftDependent)
-      21         146 :                 readRedshift(getDataPath("") + "Scaling/" + this->fieldName + "_redshift.txt");
-      22             : 
-      23          94 :         checkInputData();
-      24             : 
-      25          94 :         if (this->isRedshiftDependent)
-      26          73 :                 initRedshiftScaling();
-      27          94 : }
-      28             : 
-      29             : 
-      30     9536930 : double TabularPhotonField::getPhotonDensity(double Ephoton, double z) const {   
-      31     9536930 :         if ((this->isRedshiftDependent)) {
-      32             :                 // fix behaviour for future redshift. See issue #414
-      33             :                 // with redshift < 0 the photon density is set to 0 in interpolate2d. 
-      34             :                 // Therefore it is assumed that the photon density does not change from values at z = 0. This is only valid for small changes in redshift.
-      35     9536930 :                 double zMin = this->redshifts[0];
-      36     9536930 :                 if(z < zMin){
-      37           0 :                         if(z < -1) {
-      38           0 :                                 KISS_LOG_WARNING << "Photon Field " << fieldName << " uses FutureRedshift with z < -1. The photon density is set to n(Ephoton, z=0). \n";
-      39             :                         }
-      40           0 :                         return getPhotonDensity(Ephoton, zMin);
-      41             :                 } else {
-      42     9536930 :                         return interpolate2d(Ephoton, z, this->photonEnergies, this->redshifts, this->photonDensity);
-      43             :                 }
-      44             :         } else {
-      45           0 :                 return interpolate(Ephoton, this->photonEnergies, this->photonDensity);
-      46             :         }
-      47             : }
-      48             : 
-      49             : 
-      50       16757 : double TabularPhotonField::getRedshiftScaling(double z) const {
-      51       16757 :         if (!this->isRedshiftDependent)
-      52             :                 return 1.;
-      53             :  
-      54       16573 :         if (z < this->redshifts.front())
-      55             :                 return 1.;
-      56             :  
-      57       16573 :         if (z > this->redshifts.back())
-      58             :                 return 0.;
-      59             :  
-      60       16573 :         return interpolate(z, this->redshifts, this->redshiftScalings);
-      61             : }
-      62             : 
-      63           0 : double TabularPhotonField::getMinimumPhotonEnergy(double z) const{
-      64           0 :         return photonEnergies[0];
-      65             : }
-      66             : 
-      67           0 : double TabularPhotonField::getMaximumPhotonEnergy(double z) const{
-      68           0 :         return photonEnergies[photonEnergies.size() -1];
-      69             : }
-      70             : 
-      71          94 : void TabularPhotonField::readPhotonEnergy(std::string filePath) {
-      72          94 :         std::ifstream infile(filePath.c_str());
-      73          94 :         if (!infile.good())
-      74           0 :                 throw std::runtime_error("TabularPhotonField::readPhotonEnergy: could not open " + filePath);
-      75             : 
-      76             :         std::string line;
-      77       15320 :         while (std::getline(infile, line)) {
-      78       15226 :                 if ((line.size() > 0) & (line[0] != '#') )
-      79       14944 :                         this->photonEnergies.push_back(std::stod(line));
-      80             :         }
-      81          94 :         infile.close();
-      82          94 : }
-      83             : 
-      84          94 : void TabularPhotonField::readPhotonDensity(std::string filePath) {
-      85          94 :         std::ifstream infile(filePath.c_str());
-      86          94 :         if (!infile.good())
-      87           0 :                 throw std::runtime_error("TabularPhotonField::readPhotonDensity: could not open " + filePath);
-      88             : 
-      89             :         std::string line;
-      90     4772519 :         while (std::getline(infile, line)) {
-      91     4772425 :                 if ((line.size() > 0) & (line[0] != '#') )
-      92     4772143 :                         this->photonDensity.push_back(std::stod(line));
-      93             :         }
-      94          94 :         infile.close();
-      95          94 : }
-      96             : 
-      97          73 : void TabularPhotonField::readRedshift(std::string filePath) {
-      98          73 :         std::ifstream infile(filePath.c_str());
-      99          73 :         if (!infile.good())
-     100           0 :                 throw std::runtime_error("TabularPhotonField::initRedshift: could not open " + filePath);
-     101             : 
-     102             :         std::string line;
-     103       14599 :         while (std::getline(infile, line)) {
-     104       14526 :                 if ((line.size() > 0) & (line[0] != '#') )
-     105       14307 :                         this->redshifts.push_back(std::stod(line));
-     106             :         }
-     107          73 :         infile.close();
-     108          73 : }
-     109             : 
-     110          73 : void TabularPhotonField::initRedshiftScaling() {
-     111             :         double n0 = 0.;
-     112       14380 :         for (int i = 0; i < this->redshifts.size(); ++i) {
-     113       14307 :                 double z = this->redshifts[i];
-     114             :                 double n = 0.;
-     115     4770022 :                 for (int j = 0; j < this->photonEnergies.size()-1; ++j) {
-     116     4755715 :                         double e_j = this->photonEnergies[j];
-     117     4755715 :                         double e_j1 = this->photonEnergies[j+1];
-     118     4755715 :                         double deltaLogE = std::log10(e_j1) - std::log10(e_j);
-     119     4755715 :                         if (z == 0.)
-     120       12750 :                                 n0 += (getPhotonDensity(e_j, 0) + getPhotonDensity(e_j1, 0)) / 2. * deltaLogE;
-     121     4755715 :                         n += (getPhotonDensity(e_j, z) + getPhotonDensity(e_j1, z)) / 2. * deltaLogE;
-     122             :                 }
-     123       14307 :                 this->redshiftScalings.push_back(n / n0);
-     124             :         }
-     125          73 : }
-     126             : 
-     127          94 : void TabularPhotonField::checkInputData() const {
-     128          94 :         if (this->isRedshiftDependent) {
-     129          73 :                 if (this->photonDensity.size() != this->photonEnergies.size() * this-> redshifts.size())
-     130           0 :                         throw std::runtime_error("TabularPhotonField::checkInputData: length of photon density input is unequal to length of photon energy input times length of redshift input");
-     131             :         } else {
-     132          21 :                 if (this->photonEnergies.size() != this->photonDensity.size())
-     133           0 :                         throw std::runtime_error("TabularPhotonField::checkInputData: length of photon energy input is unequal to length of photon density input");
-     134             :         }
-     135             : 
-     136       15038 :         for (int i = 0; i < this->photonEnergies.size(); ++i) {
-     137             :                 double ePrevious = 0.;
-     138       14944 :                 double e = this->photonEnergies[i];
-     139       14944 :                 if (e <= 0.)
-     140           0 :                         throw std::runtime_error("TabularPhotonField::checkInputData: a value in the photon energy input is not positive");
-     141             :                 if (e <= ePrevious)
-     142             :                         throw std::runtime_error("TabularPhotonField::checkInputData: photon energy values are not strictly increasing");
-     143             :                 ePrevious = e;
-     144             :         }
-     145             : 
-     146     4772237 :         for (int i = 0; i < this->photonDensity.size(); ++i) {
-     147     4772143 :                 if (this->photonDensity[i] < 0.)
-     148           0 :                         throw std::runtime_error("TabularPhotonField::checkInputData: a value in the photon density input is negative");
-     149             :         }
-     150             : 
-     151          94 :         if (this->isRedshiftDependent) {
-     152          73 :                 if (this->redshifts[0] != 0.)
-     153           0 :                         throw std::runtime_error("TabularPhotonField::checkInputData: redshift input must start with zero");
-     154             : 
-     155       14380 :                 for (int i = 0; i < this->redshifts.size(); ++i) {
-     156             :                         double zPrevious = -1.;
-     157       14307 :                         double z = this->redshifts[i];
-     158       14307 :                         if (z < 0.)
-     159           0 :                                 throw std::runtime_error("TabularPhotonField::checkInputData: a value in the redshift input is negative");
-     160       14307 :                         if (z <= zPrevious)
-     161           0 :                                 throw std::runtime_error("TabularPhotonField::checkInputData: redshift values are not strictly increasing");
-     162             :                         zPrevious = z;
-     163             :                 }
-     164             : 
-     165          73 :                 for (int i = 0; i < this->redshiftScalings.size(); ++i) {
-     166           0 :                         double scalingFactor = this->redshiftScalings[i];
-     167           0 :                         if (scalingFactor <= 0.)
-     168           0 :                                 throw std::runtime_error("TabularPhotonField::checkInputData: initRedshiftScaling has created a non-positive scaling factor");
-     169             :                 }
-     170             :         }
-     171          94 : }
-     172             : 
-     173          40 : BlackbodyPhotonField::BlackbodyPhotonField(std::string fieldName, double blackbodyTemperature) {
-     174          40 :         this->fieldName = fieldName;
-     175          40 :         this->blackbodyTemperature = blackbodyTemperature;
-     176          40 :         this->quantile = 0.0001; // tested to be sufficient, only used for extreme values of primary energy or temperature
-     177          40 : }
-     178             : 
-     179       10689 : double BlackbodyPhotonField::getPhotonDensity(double Ephoton, double z) const {
-     180       10689 :         return 8 * M_PI * pow_integer<3>(Ephoton / (h_planck * c_light)) / std::expm1(Ephoton / (k_boltzmann * this->blackbodyTemperature));
-     181             : }
-     182             : 
-     183          29 : double BlackbodyPhotonField::getMinimumPhotonEnergy(double z) const {
-     184             :         double A;
-     185          29 :         int quantile_int = 10000 * quantile;
-     186          29 :         switch (quantile_int)
-     187             :         {
-     188             :         case 1: // 0.01 % percentil
-     189             :                 A = 1.093586e-5 * eV / kelvin;
-     190             :                 break;
-     191           0 :         case 10:                // 0.1 % percentil
-     192             :                 A = 2.402189e-5 * eV / kelvin;
-     193           0 :                 break;
-     194           0 :         case 100:               // 1 % percentil
-     195             :                 A = 5.417942e-5 * eV / kelvin;
-     196           0 :                 break;
-     197           0 :         default:
-     198           0 :                 throw std::runtime_error("Quantile not understood. Please use 0.01 (1%), 0.001 (0.1%) or 0.0001 (0.01%) \n");
-     199             :                 break;
-     200             :         }
-     201          29 :         return A * this -> blackbodyTemperature;
-     202             : }
-     203             : 
-     204          29 : double BlackbodyPhotonField::getMaximumPhotonEnergy(double z) const {
-     205          29 :         double factor = std::max(1., blackbodyTemperature / 2.73);
-     206          29 :         return 0.1 * factor * eV; // T dependent scaling, starting at 0.1 eV as suitable for CMB
-     207             : }
-     208             : 
-     209           0 : void BlackbodyPhotonField::setQuantile(double q) {
-     210           0 :         if(not ((q == 0.0001) or (q == 0.001) or (q == 0.01)))
-     211           0 :                 throw std::runtime_error("Quantile not understood. Please use 0.01 (1%), 0.001 (0.1%) or 0.0001 (0.01%) \n");
-     212           0 :         this -> quantile = q;
-     213           0 : }
-     214             : 
-     215             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/ProgressBar.cpp.func-sort-c.html b/doc/coverageReport/src/ProgressBar.cpp.func-sort-c.html deleted file mode 100644 index 5818e83f3..000000000 --- a/doc/coverageReport/src/ProgressBar.cpp.func-sort-c.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/ProgressBar.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - ProgressBar.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:395078.0 %
Date:2024-04-08 14:58:22Functions:4580.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11ProgressBar8setErrorEv0
_ZN7crpropa11ProgressBar5startERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa11ProgressBarC2Emm5
_ZN7crpropa11ProgressBar11setPositionEm100
_ZN7crpropa11ProgressBar6updateEv100
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/ProgressBar.cpp.func.html b/doc/coverageReport/src/ProgressBar.cpp.func.html deleted file mode 100644 index eabab3799..000000000 --- a/doc/coverageReport/src/ProgressBar.cpp.func.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/ProgressBar.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - ProgressBar.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:395078.0 %
Date:2024-04-08 14:58:22Functions:4580.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11ProgressBar11setPositionEm100
_ZN7crpropa11ProgressBar5startERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa11ProgressBar6updateEv100
_ZN7crpropa11ProgressBar8setErrorEv0
_ZN7crpropa11ProgressBarC2Emm5
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/ProgressBar.cpp.gcov.html b/doc/coverageReport/src/ProgressBar.cpp.gcov.html deleted file mode 100644 index 4bcb4bfab..000000000 --- a/doc/coverageReport/src/ProgressBar.cpp.gcov.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/ProgressBar.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - ProgressBar.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:395078.0 %
Date:2024-04-08 14:58:22Functions:4580.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/ProgressBar.h"
-       2             : 
-       3             : #include <cstdio>
-       4             : #include <iostream>
-       5             : 
-       6             : namespace crpropa {
-       7             : 
-       8             : /// Initialize a ProgressBar with [steps] number of steps, updated at [updateSteps] intervalls
-       9           5 : ProgressBar::ProgressBar(unsigned long steps, unsigned long updateSteps) :
-      10           5 :                 _steps(steps), _currentCount(0), _maxbarLength(10), _updateSteps(
-      11           5 :                                 updateSteps), _nextStep(1), _startTime(0) {
-      12           5 :         if (_updateSteps > _steps)
-      13           3 :                 _updateSteps = _steps;
-      14           5 :         arrow.append(">");
-      15           5 : }
-      16             : 
-      17           1 : void ProgressBar::start(const std::string &title) {
-      18           1 :         _startTime = time(NULL);
-      19           1 :         std::string s = ctime(&_startTime);
-      20           1 :         s.erase(s.end() - 1, s.end());
-      21           1 :         stringTmpl = "  Started ";
-      22             :         stringTmpl.append(s);
-      23           1 :         stringTmpl.append(" : [%-10s] %3i%%    %s: %02i:%02i:%02i %s\r");
-      24             :         std::cout << title << std::endl;
-      25             : 
-      26           1 : }
-      27             : /// update the progressbar
-      28             : /// should be called steps times in a loop
-      29         100 : void ProgressBar::update() {
-      30         100 :         _currentCount++;
-      31         100 :         if (_currentCount == _nextStep || _currentCount == _steps
-      32           0 :                         || _currentCount == 1000) {
-      33         100 :                                 _nextStep += long(_steps / float(_updateSteps));
-      34         100 :                         setPosition(_currentCount);
-      35             :                         }
-      36         100 : }
-      37             : 
-      38         100 : void ProgressBar::setPosition(unsigned long position) {
-      39         100 :         int percentage = int(100 * (position / float(_steps)));
-      40         100 :         time_t currentTime = time(NULL);
-      41         100 :         if (position < _steps) {
-      42          99 :                 if (arrow.size() <= (_maxbarLength) * (position) / (_steps))
-      43           9 :                         arrow.insert(0, "=");
-      44          99 :                 float tElapsed = currentTime - _startTime;
-      45          99 :                 float tToGo = (_steps - position) * tElapsed / position;
-      46          99 :                 std::printf(stringTmpl.c_str(), arrow.c_str(), percentage, "Finish in",
-      47          99 :                                 int(tToGo / 3600), (int(tToGo) % 3600) / 60,
-      48          99 :                                 int(tToGo) % 60, "");
-      49          99 :                 fflush(stdout);
-      50             :         } else {
-      51           1 :                 float tElapsed = currentTime - _startTime;
-      52           1 :                 std::string s = " - Finished at ";
-      53           1 :                 s.append(ctime(&currentTime));
-      54             :                 char fs[255];
-      55             :                 std::sprintf(fs, "%c[%d;%dm Finished %c[%dm", 27, 1, 32, 27, 0);
-      56           1 :                 std::printf(stringTmpl.c_str(), fs, 100, "Needed",
-      57           1 :                                 int(tElapsed / 3600), (int(tElapsed) % 3600) / 60,
-      58           1 :                                 int(tElapsed) % 60, s.c_str());
-      59             :         }
-      60         100 : }
-      61             : 
-      62             : 
-      63             : /// Mark the progressbar with an error
-      64           0 : void ProgressBar::setError() {
-      65           0 :         time_t currentTime = time(NULL);
-      66           0 :         _currentCount++;
-      67           0 :         float tElapsed = currentTime - _startTime;
-      68           0 :         std::string s = " - Finished at ";
-      69           0 :         s.append(ctime(&currentTime));
-      70             :         char fs[255];
-      71             :         std::sprintf(fs, "%c[%d;%dm  ERROR   %c[%dm", 27, 1, 31, 27, 0);
-      72           0 :         std::printf(stringTmpl.c_str(), fs, _currentCount, "Needed",
-      73           0 :                         int(tElapsed / 3600), (int(tElapsed) % 3600) / 60,
-      74           0 :                         int(tElapsed) % 60, s.c_str());
-      75           0 : }
-      76             : 
-      77             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Random.cpp.func-sort-c.html b/doc/coverageReport/src/Random.cpp.func-sort-c.html deleted file mode 100644 index e9ea9e87a..000000000 --- a/doc/coverageReport/src/Random.cpp.func-sort-c.html +++ /dev/null @@ -1,256 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Random.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Random.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13924157.7 %
Date:2024-04-08 14:58:22Functions:264656.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa6Random10randDblExcERKd0
_ZN7crpropa6Random11seedThreadsEj0
_ZN7crpropa6Random12randRayleighEd0
_ZN7crpropa6Random14getSeedThreadsEv0
_ZN7crpropa6Random15randExponentialEv0
_ZN7crpropa6Random18randBrokenPowerLawEddddd0
_ZN7crpropa6Random18randVectorLambertsERKNS_7Vector3IdEE0
_ZN7crpropa6Random18randVectorLambertsEv0
_ZN7crpropa6Random4hashEll0
_ZN7crpropa6Random4loadEPj0
_ZN7crpropa6Random4randERKd0
_ZN7crpropa6Random6rand53Ev0
_ZN7crpropa6Random7randExcERKd0
_ZN7crpropa6Random7randIntERKj0
_ZN7crpropa6RandomC2EPjj0
_ZN7crpropa6RandomC2ERKj0
_ZN7crpropalsERSoRKNS_6RandomE0
_ZN7crproparsERSiRNS_6RandomE0
_ZNK7crpropa6Random14getSeed_base64B5cxx11Ev0
_ZNK7crpropa6Random4saveEPj0
_ZN7crpropa6Random4seedERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZNK7crpropa6Random7getSeedEv2
_ZN7crpropa6Random4seedEj13
_ZN7crpropa6Random9randInt64ERKm421
_ZN7crpropa6Random9randInt64Ev864
_ZN7crpropa6Random10randFisherEd1000
_ZN7crpropa6Random16randFisherVectorERKNS_7Vector3IdEEd1000
_ZN7crpropa6Random12randPowerLawEddd1104
_ZN7crpropa6Random4seedEv4881
_ZN7crpropa6RandomC2Ev4881
_ZN7crpropa6Random4seedEPjj4884
_ZN7crpropa6Random10initializeEj4897
_ZN7crpropa6Random7randBinERKSt6vectorIfSaIfEE10102
_ZN7crpropa6Random6reloadEv46321
_ZN7crpropa6Random14randConeVectorERKNS_7Vector3IdEEd480001
_ZN7crpropa6Random20randVectorAroundMeanERKNS_7Vector3IdEEd481001
_ZN7crpropa6Random10randVectorEv962203
_ZN7crpropa6Random10randDblExcEv1715954
_ZN7crpropa6Random7randExcEv1715954
_ZN7crpropa6Random8randNormERKdS2_1715954
_ZN7crpropa6Random11randUniformEdd2404687
_ZN7crpropa6Random8instanceEv2658589
_ZN7crpropa6Random26randomInterpolatedPositionERKNS_7Vector3IdEES4_3628723
_ZN7crpropa6Random7randBinERKSt6vectorIdSaIdEE3739276
_ZN7crpropa6Random4randEv22414108
_ZN7crpropa6Random7randIntEv25852694
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Random.cpp.func.html b/doc/coverageReport/src/Random.cpp.func.html deleted file mode 100644 index c6e8901c8..000000000 --- a/doc/coverageReport/src/Random.cpp.func.html +++ /dev/null @@ -1,256 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Random.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Random.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13924157.7 %
Date:2024-04-08 14:58:22Functions:264656.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa6Random10initializeEj4897
_ZN7crpropa6Random10randDblExcERKd0
_ZN7crpropa6Random10randDblExcEv1715954
_ZN7crpropa6Random10randFisherEd1000
_ZN7crpropa6Random10randVectorEv962203
_ZN7crpropa6Random11randUniformEdd2404687
_ZN7crpropa6Random11seedThreadsEj0
_ZN7crpropa6Random12randPowerLawEddd1104
_ZN7crpropa6Random12randRayleighEd0
_ZN7crpropa6Random14getSeedThreadsEv0
_ZN7crpropa6Random14randConeVectorERKNS_7Vector3IdEEd480001
_ZN7crpropa6Random15randExponentialEv0
_ZN7crpropa6Random16randFisherVectorERKNS_7Vector3IdEEd1000
_ZN7crpropa6Random18randBrokenPowerLawEddddd0
_ZN7crpropa6Random18randVectorLambertsERKNS_7Vector3IdEE0
_ZN7crpropa6Random18randVectorLambertsEv0
_ZN7crpropa6Random20randVectorAroundMeanERKNS_7Vector3IdEEd481001
_ZN7crpropa6Random26randomInterpolatedPositionERKNS_7Vector3IdEES4_3628723
_ZN7crpropa6Random4hashEll0
_ZN7crpropa6Random4loadEPj0
_ZN7crpropa6Random4randERKd0
_ZN7crpropa6Random4randEv22414108
_ZN7crpropa6Random4seedEPjj4884
_ZN7crpropa6Random4seedERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa6Random4seedEj13
_ZN7crpropa6Random4seedEv4881
_ZN7crpropa6Random6rand53Ev0
_ZN7crpropa6Random6reloadEv46321
_ZN7crpropa6Random7randBinERKSt6vectorIdSaIdEE3739276
_ZN7crpropa6Random7randBinERKSt6vectorIfSaIfEE10102
_ZN7crpropa6Random7randExcERKd0
_ZN7crpropa6Random7randExcEv1715954
_ZN7crpropa6Random7randIntERKj0
_ZN7crpropa6Random7randIntEv25852694
_ZN7crpropa6Random8instanceEv2658589
_ZN7crpropa6Random8randNormERKdS2_1715954
_ZN7crpropa6Random9randInt64ERKm421
_ZN7crpropa6Random9randInt64Ev864
_ZN7crpropa6RandomC2EPjj0
_ZN7crpropa6RandomC2ERKj0
_ZN7crpropa6RandomC2Ev4881
_ZN7crpropalsERSoRKNS_6RandomE0
_ZN7crproparsERSiRNS_6RandomE0
_ZNK7crpropa6Random14getSeed_base64B5cxx11Ev0
_ZNK7crpropa6Random4saveEPj0
_ZNK7crpropa6Random7getSeedEv2
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Random.cpp.gcov.html b/doc/coverageReport/src/Random.cpp.gcov.html deleted file mode 100644 index 4aaef80c6..000000000 --- a/doc/coverageReport/src/Random.cpp.gcov.html +++ /dev/null @@ -1,605 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Random.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Random.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13924157.7 %
Date:2024-04-08 14:58:22Functions:264656.5 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : // Random.cpp is based on Random.h
-       2             : // Mersenne Twister random number generator -- a C++ class Random
-       3             : // Based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus
-       4             : // Richard J. Wagner  v1.0  15 May 2003  rjwagner@writeme.com
-       5             : 
-       6             : // The Mersenne Twister is an algorithm for generating random numbers.  It
-       7             : // was designed with consideration of the flaws in various other generators.
-       8             : // The period, 2^19937-1, and the order of equidistribution, 623 dimensions,
-       9             : // are far greater.  The generator is also fast; it avoids multiplication and
-      10             : // division, and it benefits from caches and pipelines.  For more information
-      11             : // see the inventors' web page at http://www.math.keio.ac.jp/~matumoto/emt.html
-      12             : 
-      13             : // Reference
-      14             : // M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-Dimensionally
-      15             : // Equidistributed Uniform Pseudo-Random Number Generator", ACM Transactions on
-      16             : // Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3-30.
-      17             : 
-      18             : // Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
-      19             : // Copyright (C) 2000 - 2003, Richard J. Wagner
-      20             : // All rights reserved.                          
-      21             : //
-      22             : // Redistribution and use in source and binary forms, with or without
-      23             : // modification, are permitted provided that the following conditions
-      24             : // are met:
-      25             : //
-      26             : //   1. Redistributions of source code must retain the above copyright
-      27             : //      notice, this list of conditions and the following disclaimer.
-      28             : //
-      29             : //   2. Redistributions in binary form must reproduce the above copyright
-      30             : //      notice, this list of conditions and the following disclaimer in the
-      31             : //      documentation and/or other materials provided with the distribution.
-      32             : //
-      33             : //   3. The names of its contributors may not be used to endorse or promote 
-      34             : //      products derived from this software without specific prior written 
-      35             : //      permission.
-      36             : //
-      37             : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-      38             : // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-      39             : // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-      40             : // A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-      41             : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-      42             : // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-      43             : // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-      44             : // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-      45             : // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-      46             : // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-      47             : // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-      48             : 
-      49             : // The original code included the following notice:
-      50             : //
-      51             : //     When you use this, send an email to: matumoto@math.keio.ac.jp
-      52             : //     with an appropriate reference to your work.
-      53             : //
-      54             : // It would be nice to CC: rjwagner@writeme.com and Cokus@math.washington.edu
-      55             : // when you write.
-      56             : 
-      57             : // Parts of this file are modified beginning in 29.10.09 for adaption in PXL.
-      58             : // Parts of this file are modified beginning in 10.02.12 for adaption in CRPropa.
-      59             : 
-      60             : #include "crpropa/Random.h"
-      61             : 
-      62             : #include "crpropa/base64.h"
-      63             : 
-      64             : #include <cstdio>
-      65             : 
-      66             : namespace crpropa {
-      67             : 
-      68           0 : Random::Random(const uint32_t& oneSeed) {
-      69           0 :         seed(oneSeed);
-      70           0 : }
-      71             : 
-      72           0 : Random::Random(uint32_t * const bigSeed, const uint32_t seedLength) {
-      73           0 :         seed(bigSeed, seedLength);
-      74           0 : }
-      75             : 
-      76        4881 : Random::Random() {
-      77        4881 :         seed();
-      78        4881 : }
-      79             : 
-      80    22414108 : double Random::rand() {
-      81    22414108 :         return double(randInt()) * (1.0 / 4294967295.0);
-      82             : }
-      83             : 
-      84           0 : double Random::rand(const double& n) {
-      85           0 :         return rand() * n;
-      86             : }
-      87             : 
-      88     1715954 : double Random::randExc() {
-      89     1715954 :         return double(randInt()) * (1.0 / 4294967296.0);
-      90             : }
-      91             : 
-      92           0 : double Random::randExc(const double& n) {
-      93           0 :         return randExc() * n;
-      94             : }
-      95             : 
-      96     1715954 : double Random::randDblExc() {
-      97     1715954 :         return (double(randInt()) + 0.5) * (1.0 / 4294967296.0);
-      98             : }
-      99             : 
-     100           0 : double Random::randDblExc(const double& n) {
-     101           0 :         return randDblExc() * n;
-     102             : }
-     103             : 
-     104           0 : double Random::rand53() {
-     105           0 :         uint32_t a = randInt() >> 5, b = randInt() >> 6;
-     106           0 :         return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0); // by Isaku Wada
-     107             : }
-     108             : 
-     109             : // Return a real number from a normal (Gaussian) distribution with given
-     110             : // mean and variance by Box-Muller method
-     111     1715954 : double Random::randNorm(const double& mean, const double& variance) {
-     112     1715954 :         double r = sqrt(-2.0 * log(1.0 - randDblExc())) * variance;
-     113     1715954 :         double phi = 2.0 * 3.14159265358979323846264338328 * randExc();
-     114     1715954 :         return mean + r * cos(phi);
-     115             : }
-     116             : 
-     117     2404687 : double Random::randUniform(double min, double max) {
-     118     2404687 :         return min + (max - min) * rand();
-     119             : }
-     120             : 
-     121           0 : double Random::randRayleigh(double sigma) {
-     122           0 :         return sigma * sqrt(-2.0 * log(1 - rand()));
-     123             : }
-     124             : 
-     125        1000 : double Random::randFisher(double kappa) {
-     126        1000 :         return acos(1. + 1. / kappa * log(1 - rand() * (1 - exp(-2 * kappa))));
-     127             : }
-     128             : 
-     129       10102 : size_t Random::randBin(const std::vector<float> &cdf) {
-     130             :         std::vector<float>::const_iterator it = std::lower_bound(cdf.begin(),
-     131       10102 :                         cdf.end(), rand() * cdf.back());
-     132       10102 :         return it - cdf.begin();
-     133             : }
-     134             : 
-     135     3739276 : size_t Random::randBin(const std::vector<double> &cdf) {
-     136             :         std::vector<double>::const_iterator it = std::lower_bound(cdf.begin(),
-     137     3739276 :                         cdf.end(), rand() * cdf.back());
-     138     3739276 :         return it - cdf.begin();
-     139             : }
-     140             : 
-     141      962203 : Vector3d Random::randVector() {
-     142      962203 :         double z = randUniform(-1.0, 1.0);
-     143      962203 :         double t = randUniform(-1.0 * M_PI, M_PI);
-     144      962203 :         double r = sqrt(1 - z * z);
-     145      962203 :         return Vector3d(r * cos(t), r * sin(t), z);
-     146             : }
-     147             : 
-     148      481001 : Vector3d Random::randVectorAroundMean(const Vector3d &meanDirection,
-     149             :                 double angle) {
-     150      481001 :         Vector3d axis = meanDirection.cross(randVector());
-     151             :         Vector3d v = meanDirection;
-     152      481001 :         return v.getRotated(axis, angle);
-     153             : }
-     154             : 
-     155        1000 : Vector3d Random::randFisherVector(const Vector3d &meanDirection, double kappa) {
-     156        1000 :         return randVectorAroundMean(meanDirection, randFisher(kappa));
-     157             : }
-     158             : 
-     159      480001 : Vector3d Random::randConeVector(const Vector3d &meanDirection, double angularRadius) {
-     160      480001 :         const double theta = acos(randUniform(1, cos(angularRadius)));
-     161      480001 :         return randVectorAroundMean(meanDirection, theta);
-     162             : }
-     163             : 
-     164           0 : Vector3d Random::randVectorLamberts() {
-     165             :         // random vector following Lamberts cosine law (https://en.wikipedia.org/wiki/Lambert%27s_cosine_law)
-     166             :         // for a surface element with normal vector pointing in positive z-axis (0, 0, 1)
-     167           0 :         double phi = randUniform(-1.0 * M_PI, M_PI);
-     168           0 :         double theta = M_PI / 2.0 - acos(sqrt(randUniform(0, 1)));
-     169           0 :         return Vector3d(cos(phi) * cos(theta), sin(phi) * cos(theta), sin(theta));
-     170             : }
-     171             : 
-     172           0 : Vector3d Random::randVectorLamberts(const Vector3d &normalVector) {
-     173             :         // random vector following Lamberts cosine law for a surface element described by normalVector
-     174           0 :         Vector3d vLambertz = randVectorLamberts();
-     175             :         // find rotation axis that rotates the z-axis to the normalVector of the surface element
-     176             :         Vector3d axis = normalVector.cross(Vector3d(0, 0, 1));
-     177           0 :         if (axis.getR() < std::numeric_limits<double>::epsilon()) {
-     178             :                 axis = Vector3d(0, 0, 1);
-     179             :         }
-     180           0 :         double angle = normalVector.getAngleTo(Vector3d(0, 0, 1));
-     181             :         // rotate the random Lamberts vector from z-axis to respective surface element
-     182           0 :         return vLambertz.getRotated(axis / axis.getR(), -angle);
-     183             : }
-     184             : 
-     185     3628723 : Vector3d Random::randomInterpolatedPosition(const Vector3d &a, const Vector3d &b) {
-     186     3628723 :         return a + rand() * (b - a);
-     187             : }
-     188             : 
-     189        1104 : double Random::randPowerLaw(double index, double min, double max) {
-     190        1104 :         if ((min < 0) || (max < min)) {
-     191           0 :                 throw std::runtime_error(
-     192           0 :                                 "Power law distribution only possible for 0 <= min <= max");
-     193             :         }
-     194             :         //check for index -1!
-     195        1104 :         if ((std::abs(index + 1.0)) < std::numeric_limits<double>::epsilon()) {
-     196           2 :                 double part1 = log(max);
-     197           2 :                 double part2 = log(min);
-     198           2 :                 return exp((part1 - part2) * rand() + part2);
-     199             :         } else {
-     200        1102 :                 double part1 = pow(max, index + 1);
-     201        1102 :                 double part2 = pow(min, index + 1);
-     202        1102 :                 double ex = 1 / (index + 1);
-     203        1102 :                 return pow((part1 - part2) * rand() + part2, ex);
-     204             :         }
-     205             : }
-     206             : 
-     207           0 : double Random::randBrokenPowerLaw(double index1, double index2,
-     208             :                 double breakpoint, double min, double max) {
-     209           0 :         if ((min <= 0) || (max < min)) {
-     210           0 :                 throw std::runtime_error(
-     211           0 :                                 "Power law distribution only possible for 0 < min <= max");
-     212             :         }
-     213           0 :         if (min >= breakpoint) {
-     214           0 :                 return this->randPowerLaw(index2, min, max);
-     215           0 :         } else if (max <= breakpoint) {
-     216           0 :                 return this->randPowerLaw(index2, min, max);
-     217             :         } else {
-     218             :                 double intPL1;
-     219             :                 // check if index1 = -1
-     220           0 :                 if ((std::abs(index1 + 1.0)) < std::numeric_limits<double>::epsilon()) {
-     221           0 :                         intPL1 = log(breakpoint / min);
-     222             :                 } else {
-     223           0 :                         intPL1 = (pow(breakpoint, index1 + 1) - pow(min, index1 + 1))
-     224             :                                         / (index1 + 1);
-     225             :                 }
-     226             :                 double intPL2;
-     227             :                 // check if index2 = -1
-     228           0 :                 if ((std::abs(index2 + 1.0)) < std::numeric_limits<double>::epsilon()) {
-     229           0 :                         intPL2 = log(max / breakpoint) * pow(breakpoint, index1 - index2);
-     230             :                 } else {
-     231           0 :                         intPL2 = (pow(max, index2 + 1) - pow(breakpoint, index2 + 1))
-     232           0 :                                         * pow(breakpoint, index1 - index2) / (index2 + 1);
-     233             :                 }
-     234           0 :                 if (rand() > intPL1 / (intPL1 + intPL2))
-     235           0 :                         return randPowerLaw(index2, breakpoint, max);
-     236             :                 else
-     237           0 :                         return randPowerLaw(index1, min, breakpoint);
-     238             :         }
-     239             : }
-     240             : 
-     241           0 : double Random::randExponential() {
-     242             :         double dum;
-     243             :         do {
-     244           0 :                 dum = rand();
-     245           0 :         } while (dum < std::numeric_limits<double>::epsilon());
-     246           0 :         return -1.0 * log(dum);
-     247             : }
-     248             : 
-     249    25852694 : uint32_t Random::randInt() {
-     250    25852694 :         if (left == 0)
-     251       41424 :                 reload();
-     252    25852694 :         --left;
-     253             : 
-     254             :         uint32_t s1;
-     255    25852694 :         s1 = *pNext++;
-     256    25852694 :         s1 ^= (s1 >> 11);
-     257    25852694 :         s1 ^= (s1 << 7) & 0x9d2c5680UL;
-     258    25852694 :         s1 ^= (s1 << 15) & 0xefc60000UL;
-     259    25852694 :         return (s1 ^ (s1 >> 18));
-     260             : }
-     261             : 
-     262           0 : uint32_t Random::randInt(const uint32_t& n) {
-     263             : // Find which bits are used in n
-     264             : // Optimized by Magnus Jonsson (magnus@smartelectronix.com)
-     265           0 :         uint32_t used = n;
-     266           0 :         used |= used >> 1;
-     267           0 :         used |= used >> 2;
-     268           0 :         used |= used >> 4;
-     269           0 :         used |= used >> 8;
-     270           0 :         used |= used >> 16;
-     271             : 
-     272             : // Draw numbers until one is found in [0,n]
-     273             :         uint32_t i;
-     274             :         do
-     275           0 :                 i = randInt() & used; // toss unused bits to shorten search
-     276           0 :         while (i > n);
-     277           0 :         return i;
-     278             : }
-     279             : 
-     280             : 
-     281         864 : uint64_t Random::randInt64()
-     282             : {
-     283         864 :         int64_t a = randInt();
-     284         864 :         int64_t b = randInt();
-     285         864 :         return (b + a << 32);
-     286             : }
-     287             : 
-     288             : 
-     289         421 : uint64_t Random::randInt64(const uint64_t &n)
-     290             : {
-     291         421 :         uint64_t used = n;
-     292         421 :         used |= used >> 1;
-     293         421 :         used |= used >> 2;
-     294         421 :         used |= used >> 4;
-     295         421 :         used |= used >> 8;
-     296         421 :         used |= used >> 16;
-     297         421 :         used |= used >> 32;
-     298             : 
-     299             :         // Draw numbers until one is found in [0,n]
-     300             :         uint64_t i;
-     301             :         do
-     302         864 :                 i = randInt64() & used; // toss unused bits to shorten search
-     303         864 :         while (i > n);
-     304         421 :         return i;
-     305             : }
-     306             : 
-     307             : 
-     308             : 
-     309          13 : void Random::seed(const uint32_t oneSeed) {
-     310          13 :         initial_seed.resize(1);
-     311          13 :         initial_seed[0] = oneSeed;
-     312          13 :         initialize(oneSeed);
-     313          13 :         reload();
-     314          13 : }
-     315             : 
-     316        4884 : void Random::seed(uint32_t * const bigSeed, const uint32_t seedLength) {
-     317             : 
-     318        4884 :         initial_seed.resize(seedLength);
-     319     3051260 :         for (size_t i =0; i< seedLength; i++)
-     320             :         {
-     321     3046376 :                 initial_seed[i] = bigSeed[i];
-     322             :         }
-     323             : 
-     324        4884 :         initialize(19650218UL);
-     325             :         int i = 1;
-     326             :         uint32_t j = 0;
-     327        4884 :         int k = (N > seedLength ? N : seedLength);
-     328     3052500 :         for (; k; --k) {
-     329     3047616 :                 state[i] = state[i]
-     330     3047616 :                                 ^ ((state[i - 1] ^ (state[i - 1] >> 30)) * 1664525UL);
-     331     3047616 :                 state[i] += (bigSeed[j] & 0xffffffffUL) + j;
-     332             :                 state[i] &= 0xffffffffUL;
-     333     3047616 :                 ++i;
-     334     3047616 :                 ++j;
-     335     3047616 :                 if (i >= N) {
-     336        4884 :                         state[0] = state[N - 1];
-     337             :                         i = 1;
-     338             :                 }
-     339     3047616 :                 if (j >= seedLength)
-     340             :                         j = 0;
-     341             :         }
-     342     3047616 :         for (k = N - 1; k; --k) {
-     343     3042732 :                 state[i] = state[i]
-     344     3042732 :                                 ^ ((state[i - 1] ^ (state[i - 1] >> 30)) * 1566083941UL);
-     345     3042732 :                 state[i] -= i;
-     346             :                 state[i] &= 0xffffffffUL;
-     347     3042732 :                 ++i;
-     348     3042732 :                 if (i >= N) {
-     349        4884 :                         state[0] = state[N - 1];
-     350             :                         i = 1;
-     351             :                 }
-     352             :         }
-     353        4884 :         state[0] = 0x80000000UL; // MSB is 1, assuring non-zero initial array
-     354        4884 :         reload();
-     355        4884 : }
-     356             : 
-     357        4881 : void Random::seed() {
-     358             : // First try getting an array from /dev/urandom
-     359        4881 :         FILE* urandom = std::fopen("/dev/urandom", "rb");
-     360        4881 :         if (urandom) {
-     361             :                 uint32_t bigSeed[N];
-     362             :                 uint32_t *s = bigSeed;
-     363             :                 int i = N;
-     364             :                 bool success = true;
-     365     3050625 :                 while (success && i--)
-     366     6091488 :                         success = std::fread(s++, sizeof(uint32_t), 1, urandom) != 0;
-     367        4881 :                 std::fclose(urandom);
-     368        4881 :                 if (success) {
-     369        4881 :                         seed(bigSeed, N);
-     370        4881 :                         return;
-     371             :                 }
-     372             :         }
-     373             : 
-     374             : // Was not successful, so use time() and clock() instead
-     375           0 :         seed(hash(time(NULL), clock()));
-     376             : }
-     377             : 
-     378             : 
-     379        4897 : void Random::initialize(const uint32_t seed) {
-     380        4897 :         uint32_t *s = state;
-     381             :         uint32_t *r = state;
-     382             :         int i = 1;
-     383        4897 :         *s++ = seed & 0xffffffffUL;
-     384     3055728 :         for (; i < N; ++i) {
-     385     3050831 :                 *s++ = (1812433253UL * (*r ^ (*r >> 30)) + i) & 0xffffffffUL;
-     386     3050831 :                 r++;
-     387             :         }
-     388        4897 : }
-     389             : 
-     390       46321 : void Random::reload() {
-     391       46321 :         uint32_t *p = state;
-     392             :         int i;
-     393    10561188 :         for (i = N - M; i--; ++p)
-     394    10514867 :                 *p = twist(p[M], p[0], p[1]);
-     395    18389437 :         for (i = M; --i; ++p)
-     396    18343116 :                 *p = twist(p[M - N], p[0], p[1]);
-     397       46321 :         *p = twist(p[M - N], p[0], state[0]);
-     398             : 
-     399       46321 :         left = N, pNext = state;
-     400       46321 : }
-     401             : 
-     402           0 : uint32_t Random::hash(time_t t, clock_t c) {
-     403             :         static uint32_t differ = 0; // guarantee time-based seeds will change
-     404             : 
-     405             :         uint32_t h1 = 0;
-     406             :         unsigned char *p = (unsigned char *) &t;
-     407           0 :         for (size_t i = 0; i < sizeof(t); ++i) {
-     408           0 :                 h1 *= std::numeric_limits<unsigned char>::max() + 2U;
-     409           0 :                 h1 += p[i];
-     410             :         }
-     411             :         uint32_t h2 = 0;
-     412             :         p = (unsigned char *) &c;
-     413           0 :         for (size_t j = 0; j < sizeof(c); ++j) {
-     414           0 :                 h2 *= std::numeric_limits<unsigned char>::max() + 2U;
-     415           0 :                 h2 += p[j];
-     416             :         }
-     417           0 :         return (h1 + differ++) ^ h2;
-     418             : }
-     419             : 
-     420           0 : void Random::save(uint32_t* saveArray) const {
-     421             :         uint32_t *sa = saveArray;
-     422           0 :         const uint32_t *s = state;
-     423             :         int i = N;
-     424           0 :         for (; i--; *sa++ = *s++) {
-     425             :         }
-     426           0 :         *sa = left;
-     427           0 : }
-     428             : 
-     429           2 : const std::vector<uint32_t> &Random::getSeed() const
-     430             : {
-     431           2 :         return initial_seed;
-     432             : }
-     433             : 
-     434           0 : void Random::load(uint32_t * const loadArray) {
-     435           0 :         uint32_t *s = state;
-     436             :         uint32_t *la = loadArray;
-     437             :         int i = N;
-     438           0 :         for (; i--; *s++ = *la++) {
-     439             :         }
-     440           0 :         left = *la;
-     441           0 :         pNext = &state[N - left];
-     442           0 : }
-     443             : 
-     444           0 : std::ostream& operator<<(std::ostream& os, const Random& mtrand) {
-     445           0 :         const uint32_t *s = mtrand.state;
-     446             :         int i = mtrand.N;
-     447           0 :         for (; i--; os << *s++ << "\t") {
-     448             :         }
-     449           0 :         return os << mtrand.left;
-     450             : }
-     451             : 
-     452           0 : std::istream& operator>>(std::istream& is, Random& mtrand) {
-     453           0 :         uint32_t *s = mtrand.state;
-     454             :         int i = mtrand.N;
-     455           0 :         for (; i--; is >> *s++) {
-     456             :         }
-     457           0 :         is >> mtrand.left;
-     458           0 :         mtrand.pNext = &mtrand.state[mtrand.N - mtrand.left];
-     459           0 :         return is;
-     460             : }
-     461             : 
-     462             : #ifdef _OPENMP
-     463             : #include <omp.h>
-     464             : #include <stdexcept>
-     465             : 
-     466             : // see http://stackoverflow.com/questions/8051108/using-the-openmp-threadprivate-directive-on-static-instances-of-c-stl-types
-     467             : const static int MAX_THREAD = 256;
-     468             : 
-     469             : struct RANDOM_TLS_ITEM {
-     470             :         Random r;
-     471             :         char padding[(sizeof(Random) / 64 + 1) * 64 - sizeof(Random)];
-     472             : };
-     473             : 
-     474             : #ifdef _MSC_VER
-     475             : __declspec(align(64)) static RANDOM_TLS_ITEM _tls[MAX_THREAD];
-     476             : #else
-     477             : __attribute__ ((aligned(64))) static RANDOM_TLS_ITEM _tls[MAX_THREAD];
-     478             : #endif
-     479             : 
-     480     2658589 : Random &Random::instance() {
-     481     2658589 :         int i = omp_get_thread_num();
-     482     2658589 :         if (i >= MAX_THREAD)
-     483           0 :         throw std::runtime_error("crpropa::Random: more than MAX_THREAD threads!");
-     484     2658589 :         return _tls[i].r;
-     485             : }
-     486             : 
-     487           0 : void Random::seedThreads(const uint32_t oneSeed) {
-     488           0 :         for(size_t i = 0; i < MAX_THREAD; ++i)
-     489           0 :         _tls[i].r.seed(oneSeed + i);
-     490           0 : }
-     491             : 
-     492           0 : std::vector< std::vector<uint32_t> > Random::getSeedThreads()
-     493             : {
-     494             :         std::vector< std::vector<uint32_t> > seeds;
-     495           0 :         for(size_t i = 0; i < omp_get_num_threads(); ++i)
-     496           0 :                 seeds.push_back(_tls[i].r.getSeed() ); 
-     497           0 :         return seeds;
-     498           0 : }
-     499             : 
-     500             : #else
-     501             : static Random _random;
-     502             : Random &Random::instance() {
-     503             :         return _random;
-     504             : }
-     505             : void Random::seedThreads(const uint32_t oneSeed) {
-     506             :         _random.seed(oneSeed);
-     507             : }
-     508             : std::vector< std::vector<uint32_t> > Random::getSeedThreads()
-     509             : {
-     510             :         std::vector< std::vector<uint32_t> > seeds;
-     511             :                 seeds.push_back(_random.getSeed() ); 
-     512             :         return seeds;
-     513             : }
-     514             : #endif
-     515             : 
-     516           0 : const std::string Random::getSeed_base64() const
-     517             : {
-     518           0 :         return Base64::encode((unsigned char*) &initial_seed[0], sizeof(initial_seed[0]) * initial_seed.size() / sizeof(unsigned char));
-     519             : }
-     520             : 
-     521           1 : void Random::seed(const std::string &b64Seed)
-     522             : {
-     523           1 :         std::string decoded_data = Base64::decode(b64Seed);
-     524           1 :         size_t seedSize = decoded_data.size() * sizeof(decoded_data[0]) / sizeof(uint32_t);
-     525           1 :         seed((uint32_t*)decoded_data.c_str(), seedSize );
-     526           1 : }
-     527             : 
-     528             : } // namespace crpropa
-     529             : 
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Source.cpp.func-sort-c.html b/doc/coverageReport/src/Source.cpp.func-sort-c.html deleted file mode 100644 index 34e0bcd2a..000000000 --- a/doc/coverageReport/src/Source.cpp.func-sort-c.html +++ /dev/null @@ -1,656 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Source.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Source.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:45978458.5 %
Date:2024-04-08 14:58:22Functions:8114655.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa14SourcePositionC2Ed0
_ZN7crpropa15SourceDirection14setDescriptionEv0
_ZN7crpropa15SourceDirectionC2ENS_7Vector3IdEE0
_ZN7crpropa17SourceEmissionMap14setDescriptionEv0
_ZN7crpropa17SourceEmissionMap14setEmissionMapEPNS_11EmissionMapE0
_ZN7crpropa17SourceEmissionMapC2EPNS_11EmissionMapE0
_ZN7crpropa18SourceUniformShell14setDescriptionEv0
_ZN7crpropa18SourceUniformShellC2ENS_7Vector3IdEEd0
_ZN7crpropa21SourceSNRDistribution14setDescriptionEv0
_ZN7crpropa21SourceSNRDistribution7setBetaEd0
_ZN7crpropa21SourceSNRDistributionC2Ev0
_ZN7crpropa21SourceUniformCylinder14setDescriptionEv0
_ZN7crpropa21SourceUniformRedshift14setDescriptionEv0
_ZN7crpropa21SourceUniformRedshiftC2Edd0
_ZN7crpropa22SourceMassDistribution14getDescriptionB5cxx11Ev0
_ZN7crpropa22SourceMassDistribution15setMaximalTriesEi0
_ZN7crpropa22SourceMassDistribution17setMaximalDensityEd0
_ZN7crpropa22SourceMassDistribution9setXrangeEdd0
_ZN7crpropa22SourceMassDistribution9setYrangeEdd0
_ZN7crpropa22SourceMassDistribution9setZrangeEdd0
_ZN7crpropa22SourceMassDistributionC2ENS_7ref_ptrINS_7DensityEEEdddd0
_ZN7crpropa24SourceGenericComposition3addEiid0
_ZN7crpropa24SourcePulsarDistribution12getThetaBlurEv0
_ZN7crpropa24SourcePulsarDistribution12setThetaBlurEd0
_ZN7crpropa24SourcePulsarDistribution14setDescriptionEv0
_ZN7crpropa24SourcePulsarDistribution7getRMaxEv0
_ZN7crpropa24SourcePulsarDistribution7getZMaxEv0
_ZN7crpropa24SourcePulsarDistribution7setRMaxEd0
_ZN7crpropa24SourcePulsarDistribution7setZMaxEd0
_ZN7crpropa24SourcePulsarDistribution8getFrMaxEv0
_ZN7crpropa24SourcePulsarDistribution8getFzMaxEv0
_ZN7crpropa24SourcePulsarDistribution8getRBlurEv0
_ZN7crpropa24SourcePulsarDistribution8setFrMaxEdd0
_ZN7crpropa24SourcePulsarDistribution8setFzMaxEd0
_ZN7crpropa24SourcePulsarDistribution8setRBlurEd0
_ZN7crpropa24SourcePulsarDistributionC2Eddddd0
_ZN7crpropa24SourcePulsarDistributionC2Ev0
_ZN7crpropa27SourceMultipleParticleTypes14setDescriptionEv0
_ZN7crpropa27SourceMultipleParticleTypes3addEid0
_ZN7crpropa27SourceMultipleParticleTypesC2Ev0
_ZN7crpropa33SourceLambertDistributionOnSphere14setDescriptionEv0
_ZN7crpropa33SourceLambertDistributionOnSphereC2ERKNS_7Vector3IdEEdb0
_ZNK7crpropa10SourceList14getDescriptionB5cxx11Ev0
_ZNK7crpropa13SourceFeature14getDescriptionB5cxx11Ev0
_ZNK7crpropa15SourceDirection15prepareParticleERNS_13ParticleStateE0
_ZNK7crpropa17SourceEmissionMap16prepareCandidateERNS_9CandidateE0
_ZNK7crpropa18SourceUniformShell15prepareParticleERNS_13ParticleStateE0
_ZNK7crpropa21SourceSNRDistribution7getBetaEv0
_ZNK7crpropa21SourceSNRDistribution7getRMaxEv0
_ZNK7crpropa21SourceSNRDistribution7getZMaxEv0
_ZNK7crpropa21SourceSNRDistribution8getAlphaEv0
_ZNK7crpropa21SourceSNRDistribution8getFrMaxEv0
_ZNK7crpropa21SourceSNRDistribution8getFzMaxEv0
_ZNK7crpropa21SourceUniformRedshift16prepareCandidateERNS_9CandidateE0
_ZNK7crpropa22SourceMassDistribution14samplePositionEv0
_ZNK7crpropa22SourceMassDistribution15prepareParticleERNS_13ParticleStateE0
_ZNK7crpropa24SourcePulsarDistribution15prepareParticleERNS_13ParticleStateE0
_ZNK7crpropa24SourcePulsarDistribution2frEd0
_ZNK7crpropa24SourcePulsarDistribution2fzEd0
_ZNK7crpropa24SourcePulsarDistribution5blurREd0
_ZNK7crpropa24SourcePulsarDistribution6fthetaEid0
_ZNK7crpropa24SourcePulsarDistribution9blurThetaEdd0
_ZNK7crpropa27SourceMultipleParticleTypes15prepareParticleERNS_13ParticleStateE0
_ZNK7crpropa33SourceLambertDistributionOnSphere15prepareParticleERNS_13ParticleStateE0
_ZNK7crpropa6Source14getDescriptionB5cxx11Ev0
_ZN7crpropa14SourceRedshift14setDescriptionEv1
_ZN7crpropa14SourceRedshiftC2Ed1
_ZN7crpropa15SourceUniform1D14setDescriptionEv1
_ZN7crpropa15SourceUniform1DC2Eddb1
_ZN7crpropa16SourceRedshift1D14setDescriptionEv1
_ZN7crpropa16SourceRedshift1DC2Ev1
_ZN7crpropa16SourceUniformBox14setDescriptionEv1
_ZN7crpropa16SourceUniformBoxC2ENS_7Vector3IdEES2_1
_ZN7crpropa18SourceEmissionCone12setDirectionENS_7Vector3IdEE1
_ZN7crpropa18SourceEmissionCone14setDescriptionEv1
_ZN7crpropa18SourceEmissionConeC2ENS_7Vector3IdEEd1
_ZN7crpropa19SourceUniformSphere14setDescriptionEv1
_ZN7crpropa19SourceUniformSphereC2ENS_7Vector3IdEEd1
_ZN7crpropa21SourceSNRDistribution7setZMaxEd1
_ZN7crpropa21SourceSNRDistribution8setAlphaEd1
_ZN7crpropa21SourceSNRDistribution8setFzMaxEd1
_ZN7crpropa21SourceSNRDistributionC2Edddd1
_ZN7crpropa21SourceUniformCylinderC2ENS_7Vector3IdEEdd1
_ZN7crpropa22SourceDirectedEmission14setDescriptionEv1
_ZN7crpropa22SourceDirectedEmissionC2ENS_7Vector3IdEEd1
_ZN7crpropa23SourceMultiplePositions14setDescriptionEv1
_ZN7crpropa23SourceMultiplePositionsC2Ev1
_ZN7crpropa24SourceGenericComposition14setDescriptionEv1
_ZN7crpropa24SourceGenericCompositionC2EddNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm1
_ZN7crpropa25SourceUniformHollowSphere14setDescriptionEv1
_ZN7crpropa25SourceUniformHollowSphereC2ENS_7Vector3IdEEdd1
_ZN7crpropa9SourceTag14setDescriptionEv1
_ZN7crpropa9SourceTag6setTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa9SourceTagC2ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZNK7crpropa14SourceRedshift16prepareCandidateERNS_9CandidateE1
_ZNK7crpropa15SourceUniform1D15prepareParticleERNS_13ParticleStateE1
_ZNK7crpropa16SourceRedshift1D16prepareCandidateERNS_9CandidateE1
_ZNK7crpropa16SourceUniformBox15prepareParticleERNS_13ParticleStateE1
_ZNK7crpropa18SourceEmissionCone15prepareParticleERNS_13ParticleStateE1
_ZNK7crpropa19SourceUniformSphere15prepareParticleERNS_13ParticleStateE1
_ZNK7crpropa21SourceUniformCylinder15prepareParticleERNS_13ParticleStateE1
_ZNK7crpropa9SourceTag16prepareCandidateERNS_9CandidateE1
_ZN7crpropa12SourceEnergy14setDescriptionEv2
_ZN7crpropa12SourceEnergyC2Ed2
_ZN7crpropa17SourceDensityGrid14setDescriptionEv2
_ZN7crpropa17SourceDensityGridC2ENS_7ref_ptrINS_4GridIfEEEE2
_ZN7crpropa19SourceDensityGrid1D14setDescriptionEv2
_ZN7crpropa19SourceDensityGrid1DC2ENS_7ref_ptrINS_4GridIfEEEE2
_ZN7crpropa21SourceSNRDistribution7setRMaxEd2
_ZN7crpropa21SourceSNRDistribution8setFrMaxEv2
_ZN7crpropa23SourceMultiplePositions3addENS_7Vector3IdEEd2
_ZN7crpropa23SourceRedshiftEvolutionC2Eddd2
_ZN7crpropa24SourceGenericComposition3addEid2
_ZN7crpropa10SourceList3addEPNS_6SourceEd3
_ZN7crpropa17SourceCompositionC2Eddd3
_ZN7crpropa18SourceParticleType14setDescriptionEv3
_ZN7crpropa18SourceParticleTypeC2Ei3
_ZN7crpropa23SourceIsotropicEmission14setDescriptionEv3
_ZN7crpropa23SourceIsotropicEmissionC2Ev3
_ZNK7crpropa17SourceComposition15prepareParticleERNS_13ParticleStateE3
_ZN7crpropa17SourceComposition3addEiid4
_ZN7crpropa22SourcePowerLawSpectrum14setDescriptionEv4
_ZN7crpropa22SourcePowerLawSpectrumC2Eddd4
_ZN7crpropa14SourcePosition14setDescriptionEv5
_ZN7crpropa14SourcePositionC2ENS_7Vector3IdEE5
_ZN7crpropa17SourceComposition3addEid5
_ZN7crpropa17SourceComposition14setDescriptionEv8
_ZN7crpropa6Source3addEPNS_13SourceFeatureE19
_ZNK7crpropa25SourceUniformHollowSphere15prepareParticleERNS_13ParticleStateE100
_ZNK7crpropa19SourceDensityGrid1D15prepareParticleERNS_13ParticleStateE101
_ZNK7crpropa23SourceRedshiftEvolution16prepareCandidateERNS_9CandidateE200
_ZNK7crpropa12SourceEnergy15prepareParticleERNS_13ParticleStateE1000
_ZNK7crpropa22SourceDirectedEmission16prepareCandidateERNS_9CandidateE1000
_ZNK7crpropa10SourceList12getCandidateEv1002
_ZNK7crpropa18SourceParticleType15prepareParticleERNS_13ParticleStateE1101
_ZNK7crpropa23SourceIsotropicEmission15prepareParticleERNS_13ParticleStateE1101
_ZNK7crpropa22SourcePowerLawSpectrum15prepareParticleERNS_13ParticleStateE1102
_ZNK7crpropa14SourcePosition15prepareParticleERNS_13ParticleStateE1103
_ZNK7crpropa6Source12getCandidateEv2103
_ZNK7crpropa13SourceFeature16prepareCandidateERNS_9CandidateE5407
_ZNK7crpropa23SourceMultiplePositions15prepareParticleERNS_13ParticleStateE10000
_ZNK7crpropa17SourceDensityGrid15prepareParticleERNS_13ParticleStateE10001
_ZNK7crpropa24SourceGenericComposition15prepareParticleERNS_13ParticleStateE100000
_ZNK7crpropa21SourceSNRDistribution15prepareParticleERNS_13ParticleStateE100001
_ZNK7crpropa21SourceSNRDistribution2frEd193272
_ZNK7crpropa21SourceSNRDistribution2fzEd1663640
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Source.cpp.func.html b/doc/coverageReport/src/Source.cpp.func.html deleted file mode 100644 index cbdfefa59..000000000 --- a/doc/coverageReport/src/Source.cpp.func.html +++ /dev/null @@ -1,656 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Source.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Source.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:45978458.5 %
Date:2024-04-08 14:58:22Functions:8114655.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa10SourceList3addEPNS_6SourceEd3
_ZN7crpropa12SourceEnergy14setDescriptionEv2
_ZN7crpropa12SourceEnergyC2Ed2
_ZN7crpropa14SourcePosition14setDescriptionEv5
_ZN7crpropa14SourcePositionC2ENS_7Vector3IdEE5
_ZN7crpropa14SourcePositionC2Ed0
_ZN7crpropa14SourceRedshift14setDescriptionEv1
_ZN7crpropa14SourceRedshiftC2Ed1
_ZN7crpropa15SourceDirection14setDescriptionEv0
_ZN7crpropa15SourceDirectionC2ENS_7Vector3IdEE0
_ZN7crpropa15SourceUniform1D14setDescriptionEv1
_ZN7crpropa15SourceUniform1DC2Eddb1
_ZN7crpropa16SourceRedshift1D14setDescriptionEv1
_ZN7crpropa16SourceRedshift1DC2Ev1
_ZN7crpropa16SourceUniformBox14setDescriptionEv1
_ZN7crpropa16SourceUniformBoxC2ENS_7Vector3IdEES2_1
_ZN7crpropa17SourceComposition14setDescriptionEv8
_ZN7crpropa17SourceComposition3addEid5
_ZN7crpropa17SourceComposition3addEiid4
_ZN7crpropa17SourceCompositionC2Eddd3
_ZN7crpropa17SourceDensityGrid14setDescriptionEv2
_ZN7crpropa17SourceDensityGridC2ENS_7ref_ptrINS_4GridIfEEEE2
_ZN7crpropa17SourceEmissionMap14setDescriptionEv0
_ZN7crpropa17SourceEmissionMap14setEmissionMapEPNS_11EmissionMapE0
_ZN7crpropa17SourceEmissionMapC2EPNS_11EmissionMapE0
_ZN7crpropa18SourceEmissionCone12setDirectionENS_7Vector3IdEE1
_ZN7crpropa18SourceEmissionCone14setDescriptionEv1
_ZN7crpropa18SourceEmissionConeC2ENS_7Vector3IdEEd1
_ZN7crpropa18SourceParticleType14setDescriptionEv3
_ZN7crpropa18SourceParticleTypeC2Ei3
_ZN7crpropa18SourceUniformShell14setDescriptionEv0
_ZN7crpropa18SourceUniformShellC2ENS_7Vector3IdEEd0
_ZN7crpropa19SourceDensityGrid1D14setDescriptionEv2
_ZN7crpropa19SourceDensityGrid1DC2ENS_7ref_ptrINS_4GridIfEEEE2
_ZN7crpropa19SourceUniformSphere14setDescriptionEv1
_ZN7crpropa19SourceUniformSphereC2ENS_7Vector3IdEEd1
_ZN7crpropa21SourceSNRDistribution14setDescriptionEv0
_ZN7crpropa21SourceSNRDistribution7setBetaEd0
_ZN7crpropa21SourceSNRDistribution7setRMaxEd2
_ZN7crpropa21SourceSNRDistribution7setZMaxEd1
_ZN7crpropa21SourceSNRDistribution8setAlphaEd1
_ZN7crpropa21SourceSNRDistribution8setFrMaxEv2
_ZN7crpropa21SourceSNRDistribution8setFzMaxEd1
_ZN7crpropa21SourceSNRDistributionC2Edddd1
_ZN7crpropa21SourceSNRDistributionC2Ev0
_ZN7crpropa21SourceUniformCylinder14setDescriptionEv0
_ZN7crpropa21SourceUniformCylinderC2ENS_7Vector3IdEEdd1
_ZN7crpropa21SourceUniformRedshift14setDescriptionEv0
_ZN7crpropa21SourceUniformRedshiftC2Edd0
_ZN7crpropa22SourceDirectedEmission14setDescriptionEv1
_ZN7crpropa22SourceDirectedEmissionC2ENS_7Vector3IdEEd1
_ZN7crpropa22SourceMassDistribution14getDescriptionB5cxx11Ev0
_ZN7crpropa22SourceMassDistribution15setMaximalTriesEi0
_ZN7crpropa22SourceMassDistribution17setMaximalDensityEd0
_ZN7crpropa22SourceMassDistribution9setXrangeEdd0
_ZN7crpropa22SourceMassDistribution9setYrangeEdd0
_ZN7crpropa22SourceMassDistribution9setZrangeEdd0
_ZN7crpropa22SourceMassDistributionC2ENS_7ref_ptrINS_7DensityEEEdddd0
_ZN7crpropa22SourcePowerLawSpectrum14setDescriptionEv4
_ZN7crpropa22SourcePowerLawSpectrumC2Eddd4
_ZN7crpropa23SourceIsotropicEmission14setDescriptionEv3
_ZN7crpropa23SourceIsotropicEmissionC2Ev3
_ZN7crpropa23SourceMultiplePositions14setDescriptionEv1
_ZN7crpropa23SourceMultiplePositions3addENS_7Vector3IdEEd2
_ZN7crpropa23SourceMultiplePositionsC2Ev1
_ZN7crpropa23SourceRedshiftEvolutionC2Eddd2
_ZN7crpropa24SourceGenericComposition14setDescriptionEv1
_ZN7crpropa24SourceGenericComposition3addEid2
_ZN7crpropa24SourceGenericComposition3addEiid0
_ZN7crpropa24SourceGenericCompositionC2EddNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm1
_ZN7crpropa24SourcePulsarDistribution12getThetaBlurEv0
_ZN7crpropa24SourcePulsarDistribution12setThetaBlurEd0
_ZN7crpropa24SourcePulsarDistribution14setDescriptionEv0
_ZN7crpropa24SourcePulsarDistribution7getRMaxEv0
_ZN7crpropa24SourcePulsarDistribution7getZMaxEv0
_ZN7crpropa24SourcePulsarDistribution7setRMaxEd0
_ZN7crpropa24SourcePulsarDistribution7setZMaxEd0
_ZN7crpropa24SourcePulsarDistribution8getFrMaxEv0
_ZN7crpropa24SourcePulsarDistribution8getFzMaxEv0
_ZN7crpropa24SourcePulsarDistribution8getRBlurEv0
_ZN7crpropa24SourcePulsarDistribution8setFrMaxEdd0
_ZN7crpropa24SourcePulsarDistribution8setFzMaxEd0
_ZN7crpropa24SourcePulsarDistribution8setRBlurEd0
_ZN7crpropa24SourcePulsarDistributionC2Eddddd0
_ZN7crpropa24SourcePulsarDistributionC2Ev0
_ZN7crpropa25SourceUniformHollowSphere14setDescriptionEv1
_ZN7crpropa25SourceUniformHollowSphereC2ENS_7Vector3IdEEdd1
_ZN7crpropa27SourceMultipleParticleTypes14setDescriptionEv0
_ZN7crpropa27SourceMultipleParticleTypes3addEid0
_ZN7crpropa27SourceMultipleParticleTypesC2Ev0
_ZN7crpropa33SourceLambertDistributionOnSphere14setDescriptionEv0
_ZN7crpropa33SourceLambertDistributionOnSphereC2ERKNS_7Vector3IdEEdb0
_ZN7crpropa6Source3addEPNS_13SourceFeatureE19
_ZN7crpropa9SourceTag14setDescriptionEv1
_ZN7crpropa9SourceTag6setTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa9SourceTagC2ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZNK7crpropa10SourceList12getCandidateEv1002
_ZNK7crpropa10SourceList14getDescriptionB5cxx11Ev0
_ZNK7crpropa12SourceEnergy15prepareParticleERNS_13ParticleStateE1000
_ZNK7crpropa13SourceFeature14getDescriptionB5cxx11Ev0
_ZNK7crpropa13SourceFeature16prepareCandidateERNS_9CandidateE5407
_ZNK7crpropa14SourcePosition15prepareParticleERNS_13ParticleStateE1103
_ZNK7crpropa14SourceRedshift16prepareCandidateERNS_9CandidateE1
_ZNK7crpropa15SourceDirection15prepareParticleERNS_13ParticleStateE0
_ZNK7crpropa15SourceUniform1D15prepareParticleERNS_13ParticleStateE1
_ZNK7crpropa16SourceRedshift1D16prepareCandidateERNS_9CandidateE1
_ZNK7crpropa16SourceUniformBox15prepareParticleERNS_13ParticleStateE1
_ZNK7crpropa17SourceComposition15prepareParticleERNS_13ParticleStateE3
_ZNK7crpropa17SourceDensityGrid15prepareParticleERNS_13ParticleStateE10001
_ZNK7crpropa17SourceEmissionMap16prepareCandidateERNS_9CandidateE0
_ZNK7crpropa18SourceEmissionCone15prepareParticleERNS_13ParticleStateE1
_ZNK7crpropa18SourceParticleType15prepareParticleERNS_13ParticleStateE1101
_ZNK7crpropa18SourceUniformShell15prepareParticleERNS_13ParticleStateE0
_ZNK7crpropa19SourceDensityGrid1D15prepareParticleERNS_13ParticleStateE101
_ZNK7crpropa19SourceUniformSphere15prepareParticleERNS_13ParticleStateE1
_ZNK7crpropa21SourceSNRDistribution15prepareParticleERNS_13ParticleStateE100001
_ZNK7crpropa21SourceSNRDistribution2frEd193272
_ZNK7crpropa21SourceSNRDistribution2fzEd1663640
_ZNK7crpropa21SourceSNRDistribution7getBetaEv0
_ZNK7crpropa21SourceSNRDistribution7getRMaxEv0
_ZNK7crpropa21SourceSNRDistribution7getZMaxEv0
_ZNK7crpropa21SourceSNRDistribution8getAlphaEv0
_ZNK7crpropa21SourceSNRDistribution8getFrMaxEv0
_ZNK7crpropa21SourceSNRDistribution8getFzMaxEv0
_ZNK7crpropa21SourceUniformCylinder15prepareParticleERNS_13ParticleStateE1
_ZNK7crpropa21SourceUniformRedshift16prepareCandidateERNS_9CandidateE0
_ZNK7crpropa22SourceDirectedEmission16prepareCandidateERNS_9CandidateE1000
_ZNK7crpropa22SourceMassDistribution14samplePositionEv0
_ZNK7crpropa22SourceMassDistribution15prepareParticleERNS_13ParticleStateE0
_ZNK7crpropa22SourcePowerLawSpectrum15prepareParticleERNS_13ParticleStateE1102
_ZNK7crpropa23SourceIsotropicEmission15prepareParticleERNS_13ParticleStateE1101
_ZNK7crpropa23SourceMultiplePositions15prepareParticleERNS_13ParticleStateE10000
_ZNK7crpropa23SourceRedshiftEvolution16prepareCandidateERNS_9CandidateE200
_ZNK7crpropa24SourceGenericComposition15prepareParticleERNS_13ParticleStateE100000
_ZNK7crpropa24SourcePulsarDistribution15prepareParticleERNS_13ParticleStateE0
_ZNK7crpropa24SourcePulsarDistribution2frEd0
_ZNK7crpropa24SourcePulsarDistribution2fzEd0
_ZNK7crpropa24SourcePulsarDistribution5blurREd0
_ZNK7crpropa24SourcePulsarDistribution6fthetaEid0
_ZNK7crpropa24SourcePulsarDistribution9blurThetaEdd0
_ZNK7crpropa25SourceUniformHollowSphere15prepareParticleERNS_13ParticleStateE100
_ZNK7crpropa27SourceMultipleParticleTypes15prepareParticleERNS_13ParticleStateE0
_ZNK7crpropa33SourceLambertDistributionOnSphere15prepareParticleERNS_13ParticleStateE0
_ZNK7crpropa6Source12getCandidateEv2103
_ZNK7crpropa6Source14getDescriptionB5cxx11Ev0
_ZNK7crpropa9SourceTag16prepareCandidateERNS_9CandidateE1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Source.cpp.gcov.html b/doc/coverageReport/src/Source.cpp.gcov.html deleted file mode 100644 index 6cc5e6642..000000000 --- a/doc/coverageReport/src/Source.cpp.gcov.html +++ /dev/null @@ -1,1218 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Source.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Source.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:45978458.5 %
Date:2024-04-08 14:58:22Functions:8114655.5 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/Source.h"
-       2             : #include "crpropa/Random.h"
-       3             : #include "crpropa/Cosmology.h"
-       4             : #include "crpropa/Common.h"
-       5             : #include "crpropa/Units.h"
-       6             : #include "crpropa/ParticleID.h"
-       7             : 
-       8             : #ifdef CRPROPA_HAVE_MUPARSER
-       9             : #include "muParser.h"
-      10             : #endif
-      11             : 
-      12             : #include <sstream>
-      13             : #include <stdexcept>
-      14             : 
-      15             : namespace crpropa {
-      16             : 
-      17             : // Source ---------------------------------------------------------------------
-      18          19 : void Source::add(SourceFeature* property) {
-      19          19 :         features.push_back(property);
-      20          19 : }
-      21             : 
-      22        2103 : ref_ptr<Candidate> Source::getCandidate() const {
-      23        4206 :         ref_ptr<Candidate> candidate = new Candidate();
-      24        7512 :         for (int i = 0; i < features.size(); i++)
-      25        5409 :                 (*features[i]).prepareCandidate(*candidate);
-      26        2103 :         return candidate;
-      27             : }
-      28             : 
-      29           0 : std::string Source::getDescription() const {
-      30           0 :         std::stringstream ss;
-      31           0 :         ss << "Cosmic ray source\n";
-      32           0 :         for (int i = 0; i < features.size(); i++)
-      33           0 :                 ss << "    " << features[i]->getDescription();
-      34           0 :         return ss.str();
-      35           0 : }
-      36             : 
-      37             : // SourceList------------------------------------------------------------------
-      38           3 : void SourceList::add(Source* source, double weight) {
-      39           6 :         sources.push_back(source);
-      40           3 :         if (cdf.size() > 0)
-      41           1 :                 weight += cdf.back();
-      42           3 :         cdf.push_back(weight);
-      43           3 : }
-      44             : 
-      45        1002 : ref_ptr<Candidate> SourceList::getCandidate() const {
-      46        1002 :         if (sources.size() == 0)
-      47           1 :                 throw std::runtime_error("SourceList: no sources set");
-      48        1001 :         size_t i = Random::instance().randBin(cdf);
-      49        1001 :         return (sources[i])->getCandidate();
-      50             : }
-      51             : 
-      52           0 : std::string SourceList::getDescription() const {
-      53           0 :         std::stringstream ss;
-      54           0 :         ss << "List of cosmic ray sources\n";
-      55           0 :         for (int i = 0; i < sources.size(); i++)
-      56           0 :                 ss << "  " << sources[i]->getDescription();
-      57           0 :         return ss.str();
-      58           0 : }
-      59             : 
-      60             : // SourceFeature---------------------------------------------------------------
-      61        5407 : void SourceFeature::prepareCandidate(Candidate& candidate) const {
-      62        5407 :         ParticleState &source = candidate.source;
-      63        5407 :         prepareParticle(source);
-      64             :         candidate.created = source;
-      65             :         candidate.current = source;
-      66             :         candidate.previous = source;
-      67        5407 : }
-      68             : 
-      69           0 : std::string SourceFeature::getDescription() const {
-      70           0 :         return description;
-      71             : }
-      72             : 
-      73             : // ----------------------------------------------------------------------------
-      74           3 : SourceParticleType::SourceParticleType(int id) :
-      75           3 :                 id(id) {
-      76           3 :         setDescription();
-      77           3 : }
-      78             : 
-      79        1101 : void SourceParticleType::prepareParticle(ParticleState& particle) const {
-      80        1101 :         particle.setId(id);
-      81        1101 : }
-      82             : 
-      83           3 : void SourceParticleType::setDescription() {
-      84           3 :         std::stringstream ss;
-      85           3 :         ss << "SourceParticleType: " << id << "\n";
-      86           3 :         description = ss.str();
-      87           3 : }
-      88             : 
-      89             : // ----------------------------------------------------------------------------
-      90           0 : SourceMultipleParticleTypes::SourceMultipleParticleTypes() {
-      91           0 :         setDescription();
-      92           0 : }
-      93             : 
-      94           0 : void SourceMultipleParticleTypes::add(int id, double a) {
-      95           0 :         particleTypes.push_back(id);
-      96           0 :         if (cdf.size() > 0)
-      97           0 :                 a += cdf.back();
-      98           0 :         cdf.push_back(a);
-      99           0 :         setDescription();
-     100           0 : }
-     101             : 
-     102           0 : void SourceMultipleParticleTypes::prepareParticle(ParticleState& particle) const {
-     103           0 :         if (particleTypes.size() == 0)
-     104           0 :                 throw std::runtime_error("SourceMultipleParticleTypes: no nuclei set");
-     105           0 :         size_t i = Random::instance().randBin(cdf);
-     106           0 :         particle.setId(particleTypes[i]);
-     107           0 : }
-     108             : 
-     109           0 : void SourceMultipleParticleTypes::setDescription() {
-     110           0 :         std::stringstream ss;
-     111           0 :         ss << "SourceMultipleParticleTypes: Random particle type\n";
-     112           0 :         for (int i = 0; i < particleTypes.size(); i++)
-     113           0 :                 ss << "      ID = " << particleTypes[i] << "\n";
-     114           0 :         description = ss.str();
-     115           0 : }
-     116             : 
-     117             : // ----------------------------------------------------------------------------
-     118           2 : SourceEnergy::SourceEnergy(double energy) :
-     119           2 :                 E(energy) {
-     120           2 :         setDescription();
-     121           2 : }
-     122             : 
-     123        1000 : void SourceEnergy::prepareParticle(ParticleState& p) const {
-     124        1000 :         p.setEnergy(E);
-     125        1000 : }
-     126             : 
-     127           2 : void SourceEnergy::setDescription() {
-     128           2 :         std::stringstream ss;
-     129           2 :         ss << "SourceEnergy: " << E / EeV << " EeV\n";
-     130           2 :         description = ss.str();
-     131           2 : }
-     132             : 
-     133             : // ----------------------------------------------------------------------------
-     134           4 : SourcePowerLawSpectrum::SourcePowerLawSpectrum(double Emin, double Emax,
-     135           4 :                 double index) :
-     136           4 :                 Emin(Emin), Emax(Emax), index(index) {
-     137           4 :         setDescription();
-     138           4 : }
-     139             : 
-     140        1102 : void SourcePowerLawSpectrum::prepareParticle(ParticleState& particle) const {
-     141        1102 :         Random &random = Random::instance();
-     142        1102 :         double E = random.randPowerLaw(index, Emin, Emax);
-     143        1102 :         particle.setEnergy(E);
-     144        1102 : }
-     145             : 
-     146           4 : void SourcePowerLawSpectrum::setDescription() {
-     147           4 :         std::stringstream ss;
-     148           4 :         ss << "SourcePowerLawSpectrum: Random energy ";
-     149           8 :         ss << "E = " << Emin / EeV << " - " << Emax / EeV << " EeV, ";
-     150           4 :         ss << "dN/dE ~ E^" << index  << "\n";
-     151           4 :         description = ss.str();
-     152           4 : }
-     153             : 
-     154             : // ----------------------------------------------------------------------------
-     155           3 : SourceComposition::SourceComposition(double Emin, double Rmax, double index) :
-     156           3 :                 Emin(Emin), Rmax(Rmax), index(index) {
-     157           3 :         setDescription();
-     158           3 : }
-     159             : 
-     160           5 : void SourceComposition::add(int id, double weight) {
-     161           5 :         nuclei.push_back(id);
-     162           5 :         int A = massNumber(id);
-     163           5 :         int Z = chargeNumber(id);
-     164             : 
-     165           5 :         double a = 1 + index;
-     166           5 :         if (std::abs(a) < std::numeric_limits<double>::min())
-     167           5 :                 weight *= log(Z * Rmax / Emin);
-     168             :         else
-     169           0 :                 weight *= (pow(Z * Rmax, a) - pow(Emin, a)) / a;
-     170             : 
-     171           5 :         weight *= pow(A, -a);
-     172             : 
-     173           5 :         if (cdf.size() > 0)
-     174           3 :                 weight += cdf.back();
-     175           5 :         cdf.push_back(weight);
-     176           5 :         setDescription();
-     177           5 : }
-     178             : 
-     179           4 : void SourceComposition::add(int A, int Z, double a) {
-     180           4 :         add(nucleusId(A, Z), a);
-     181           4 : }
-     182             : 
-     183           3 : void SourceComposition::prepareParticle(ParticleState& particle) const {
-     184           3 :         if (nuclei.size() == 0)
-     185           1 :                 throw std::runtime_error("SourceComposition: No source isotope set");
-     186             : 
-     187           2 :         Random &random = Random::instance();
-     188             : 
-     189             :         // draw random particle type
-     190           2 :         size_t i = random.randBin(cdf);
-     191           2 :         int id = nuclei[i];
-     192           2 :         particle.setId(id);
-     193             : 
-     194             :         // random energy from power law
-     195           2 :         int Z = chargeNumber(id);
-     196           2 :         particle.setEnergy(random.randPowerLaw(index, Emin, Z * Rmax));
-     197           2 : }
-     198             : 
-     199           8 : void SourceComposition::setDescription() {
-     200           8 :         std::stringstream ss;
-     201           8 :         ss << "SourceComposition: Random element and energy ";
-     202          16 :         ss << "E = " << Emin / EeV << " - Z*" << Rmax / EeV << " EeV, ";
-     203           8 :         ss << "dN/dE ~ E^" << index << "\n";
-     204          19 :         for (int i = 0; i < nuclei.size(); i++)
-     205          11 :                 ss << "      ID = " << nuclei[i] << "\n";
-     206           8 :         description = ss.str();
-     207           8 : }
-     208             : 
-     209             : // ----------------------------------------------------------------------------
-     210           5 : SourcePosition::SourcePosition(Vector3d position) :
-     211           5 :                 position(position) {
-     212           5 :         setDescription();
-     213           5 : }
-     214             : 
-     215           0 : SourcePosition::SourcePosition(double d) :
-     216           0 :                 position(Vector3d(d, 0, 0)) {
-     217           0 :         setDescription();
-     218           0 : }
-     219             : 
-     220        1103 : void SourcePosition::prepareParticle(ParticleState& particle) const {
-     221        1103 :         particle.setPosition(position);
-     222        1103 : }
-     223             : 
-     224           5 : void SourcePosition::setDescription() {
-     225           5 :         std::stringstream ss;
-     226           5 :         ss << "SourcePosition: " << position / Mpc << " Mpc\n";
-     227           5 :         description = ss.str();
-     228           5 : }
-     229             : 
-     230             : // ----------------------------------------------------------------------------
-     231           1 : SourceMultiplePositions::SourceMultiplePositions() {
-     232           1 :         setDescription();
-     233           1 : }
-     234             : 
-     235           2 : void SourceMultiplePositions::add(Vector3d pos, double weight) {
-     236           2 :         positions.push_back(pos);
-     237           2 :         if (cdf.size() > 0)
-     238           1 :                 weight += cdf.back();
-     239           2 :         cdf.push_back(weight);
-     240           2 : }
-     241             : 
-     242       10000 : void SourceMultiplePositions::prepareParticle(ParticleState& particle) const {
-     243       10000 :         if (positions.size() == 0)
-     244           0 :                 throw std::runtime_error("SourceMultiplePositions: no position set");
-     245       10000 :         size_t i = Random::instance().randBin(cdf);
-     246       10000 :         particle.setPosition(positions[i]);
-     247       10000 : }
-     248             : 
-     249           1 : void SourceMultiplePositions::setDescription() {
-     250           1 :         std::stringstream ss;
-     251           1 :         ss << "SourceMultiplePositions: Random position from list\n";
-     252           1 :         for (int i = 0; i < positions.size(); i++)
-     253           0 :                 ss << "  " << positions[i] / Mpc << " Mpc\n";
-     254           1 :         description = ss.str();
-     255           1 : }
-     256             : 
-     257             : // ----------------------------------------------------------------------------
-     258           1 : SourceUniformSphere::SourceUniformSphere(Vector3d center, double radius) :
-     259           1 :                 center(center), radius(radius) {
-     260           1 :         setDescription();
-     261           1 : }
-     262             : 
-     263           1 : void SourceUniformSphere::prepareParticle(ParticleState& particle) const {
-     264           1 :         Random &random = Random::instance();
-     265           1 :         double r = pow(random.rand(), 1. / 3.) * radius;
-     266           1 :         particle.setPosition(center + random.randVector() * r);
-     267           1 : }
-     268             : 
-     269           1 : void SourceUniformSphere::setDescription() {
-     270           1 :         std::stringstream ss;
-     271           1 :         ss << "SourceUniformSphere: Random position within a sphere at ";
-     272           1 :         ss << center / Mpc << " Mpc with";
-     273           1 :         ss  << radius / Mpc << " Mpc radius\n";
-     274           1 :         description = ss.str();
-     275           1 : }
-     276             : 
-     277             : // ----------------------------------------------------------------------------
-     278           1 : SourceUniformHollowSphere::SourceUniformHollowSphere(
-     279             :                 Vector3d center,
-     280             :                 double radius_inner,
-     281           1 :                 double radius_outer) :
-     282           1 :                 center(center), radius_inner(radius_inner),
-     283           1 :                 radius_outer(radius_outer) {
-     284           1 :         setDescription();
-     285           1 : }
-     286             : 
-     287         100 : void SourceUniformHollowSphere::prepareParticle(ParticleState& particle) const {
-     288         100 :         Random &random = Random::instance();
-     289         100 :         double r = radius_inner + pow(random.rand(), 1. / 3.) * (radius_outer - radius_inner);
-     290         100 :         particle.setPosition(center + random.randVector() * r);
-     291         100 : }
-     292             : 
-     293           1 : void SourceUniformHollowSphere::setDescription() {
-     294           1 :         std::stringstream ss;
-     295           1 :         ss << "SourceUniformHollowSphere: Random position within a sphere at ";
-     296           1 :         ss << center / Mpc << " Mpc with";
-     297           1 :         ss << radius_inner / Mpc << " Mpc inner radius\n";
-     298           1 :         ss << radius_outer / Mpc << " Mpc outer radius\n";
-     299           1 :         description = ss.str();
-     300           1 : }
-     301             : 
-     302             : // ----------------------------------------------------------------------------
-     303           0 : SourceUniformShell::SourceUniformShell(Vector3d center, double radius) :
-     304           0 :                 center(center), radius(radius) {
-     305           0 :         setDescription();
-     306           0 : }
-     307             : 
-     308           0 : void SourceUniformShell::prepareParticle(ParticleState& particle) const {
-     309           0 :         Random &random = Random::instance();
-     310           0 :         particle.setPosition(center + random.randVector() * radius);
-     311           0 : }
-     312             : 
-     313           0 : void SourceUniformShell::setDescription() {
-     314           0 :         std::stringstream ss;
-     315           0 :         ss << "SourceUniformShell: Random position on a spherical shell at ";
-     316           0 :         ss << center / Mpc << " Mpc with ";
-     317           0 :         ss << radius / Mpc << " Mpc radius\n";
-     318           0 :         description = ss.str();
-     319           0 : }
-     320             : 
-     321             : // ----------------------------------------------------------------------------
-     322           1 : SourceUniformBox::SourceUniformBox(Vector3d origin, Vector3d size) :
-     323           1 :                 origin(origin), size(size) {
-     324           1 :         setDescription();
-     325           1 : }
-     326             : 
-     327           1 : void SourceUniformBox::prepareParticle(ParticleState& particle) const {
-     328           1 :         Random &random = Random::instance();
-     329           1 :         Vector3d pos(random.rand(), random.rand(), random.rand());
-     330           1 :         particle.setPosition(pos * size + origin);
-     331           1 : }
-     332             : 
-     333           1 : void SourceUniformBox::setDescription() {
-     334           1 :         std::stringstream ss;
-     335           1 :         ss << "SourceUniformBox: Random uniform position in box with ";
-     336           1 :         ss << "origin = " << origin / Mpc << " Mpc and ";
-     337           1 :         ss << "size = " << size / Mpc << " Mpc\n";
-     338           1 :         description = ss.str();
-     339           1 : }
-     340             : 
-     341             : // ---------------------------------------------------------------------------
-     342           1 : SourceUniformCylinder::SourceUniformCylinder(Vector3d origin, double height, double radius) :
-     343           1 :     origin(origin), height(height), radius(radius) {
-     344           1 : }
-     345             : 
-     346           1 : void SourceUniformCylinder::prepareParticle(ParticleState& particle) const {
-     347           1 :   Random &random = Random::instance();
-     348           1 :   double phi = 2*M_PI*random.rand();
-     349           1 :   double RandRadius = radius*pow(random.rand(), 1. / 2.);
-     350           1 :   Vector3d pos(cos(phi)*RandRadius, sin(phi)*RandRadius, (-0.5+random.rand())*height);
-     351           1 :   particle.setPosition(pos + origin);
-     352           1 :   }
-     353             : 
-     354           0 : void SourceUniformCylinder::setDescription() {
-     355           0 :         std::stringstream ss;
-     356           0 :         ss << "SourceUniformCylinder: Random uniform position in cylinder with ";
-     357           0 :         ss << "origin = " << origin / Mpc << " Mpc and ";
-     358           0 :         ss << "radius = " << radius / Mpc << " Mpc and";
-     359           0 :         ss << "height = " << height / Mpc << " Mpc\n";
-     360           0 :         description = ss.str();
-     361           0 : }
-     362             : 
-     363             : // ---------------------------------------------------------------------------
-     364           0 : SourceSNRDistribution::SourceSNRDistribution() :
-     365           0 :     rEarth(8.5 * kpc), beta(3.53), zg(0.3 * kpc) {
-     366           0 :         setAlpha(2.);
-     367           0 :         setFrMax();
-     368           0 :         setFzMax(0.3 * kpc);
-     369           0 :         setRMax(20 * kpc);
-     370           0 :         setZMax(5 * kpc);
-     371           0 : }
-     372             : 
-     373           1 : SourceSNRDistribution::SourceSNRDistribution(double rEarth, double alpha, double beta, double zg) :
-     374           1 :     rEarth(rEarth), beta(beta), zg(zg) {
-     375           1 :         setAlpha(alpha);
-     376           1 :         setFrMax();
-     377           1 :         setFzMax(zg);
-     378           1 :         setRMax(20 * kpc);
-     379           1 :         setZMax(5 * kpc);
-     380           1 : }
-     381             : 
-     382      100001 : void SourceSNRDistribution::prepareParticle(ParticleState& particle) const {
-     383      100001 :         Random &random = Random::instance();
-     384             :         double RPos;
-     385             :         while (true) {
-     386      193272 :                 RPos = random.rand() * rMax;
-     387      193272 :                 double fTest = random.rand() * frMax;
-     388      193272 :                 double fR = fr(RPos);
-     389      193272 :                 if (fTest <= fR) {
-     390             :                         break;
-     391             :                 }
-     392             :         }
-     393             :         double ZPos;
-     394             :         while (true) {
-     395     1663640 :                 ZPos = (random.rand() - 0.5) * 2 * zMax;
-     396     1663640 :                 double fTest = random.rand() * fzMax;
-     397     1663640 :                 double fZ=fz(ZPos);
-     398     1663640 :                 if (fTest<=fZ) {
-     399             :                         break;
-     400             :                 }
-     401             :         }
-     402      100001 :         double phi = random.rand() * 2 * M_PI;
-     403      100001 :         Vector3d pos(cos(phi) * RPos, sin(phi) * RPos, ZPos);
-     404      100001 :         particle.setPosition(pos);
-     405      100001 : }
-     406             : 
-     407      193272 : double SourceSNRDistribution::fr(double r) const {
-     408      193272 :         return pow(r / rEarth, alpha) * exp(- beta * (r - rEarth) / rEarth);
-     409             : }
-     410             : 
-     411     1663640 : double SourceSNRDistribution::fz(double z) const{
-     412             :         double Az = 1.;
-     413     1663640 :         double f = 1. / zg * exp(- fabs(z) / zg);
-     414             :         double fz = Az * f;
-     415     1663640 :         return fz;
-     416             : }
-     417             : 
-     418           0 : double SourceSNRDistribution::getAlpha() const {
-     419           0 :         return alpha - 1;  // -1 to account for the R-term in the volume element dV = R * dR * dphi * dz
-     420             : }
-     421             : 
-     422           0 : double SourceSNRDistribution::getBeta() const {
-     423           0 :         return beta;
-     424             : }
-     425             : 
-     426           2 : void SourceSNRDistribution::setFrMax() {
-     427           2 :         frMax = pow(alpha / beta, alpha) * exp(beta - alpha);
-     428           2 :         return;
-     429             : }
-     430             : 
-     431           1 : void SourceSNRDistribution::setFzMax(double zg) {
-     432           1 :         fzMax = 1. / zg;
-     433           1 :         return;
-     434             : }
-     435             : 
-     436           2 : void SourceSNRDistribution::setRMax(double r) {
-     437           2 :         rMax = r;
-     438           2 :         return;
-     439             : }
-     440             : 
-     441           1 : void SourceSNRDistribution::setZMax(double z) {
-     442           1 :         zMax = z;
-     443           1 :         return;
-     444             : }
-     445             : 
-     446           0 : double SourceSNRDistribution::getFrMax() const {
-     447           0 :         return frMax;
-     448             : }
-     449             : 
-     450           0 : double SourceSNRDistribution::getFzMax() const {
-     451           0 :         return fzMax;
-     452             : }
-     453             : 
-     454           0 : double SourceSNRDistribution::getRMax() const {
-     455           0 :         return rMax;
-     456             : }
-     457             : 
-     458           0 : double SourceSNRDistribution::getZMax() const {
-     459           0 :         return zMax;
-     460             : }
-     461             : 
-     462           1 : void SourceSNRDistribution::setAlpha(double a) {
-     463           1 :         alpha = a + 1.; // add 1 for dV = r * dR * dphi * dz
-     464           1 :         setRMax(rMax);
-     465           1 :         setFrMax();
-     466           1 : }
-     467             : 
-     468           0 : void SourceSNRDistribution::setBeta(double b) {
-     469           0 :         beta = b;
-     470           0 :         setRMax(rMax);
-     471           0 :         setFrMax();
-     472           0 : }
-     473             : 
-     474           0 : void SourceSNRDistribution::setDescription() {
-     475           0 :         std::stringstream ss;
-     476           0 :         ss << "SourceSNRDistribution: Random position according to SNR distribution";
-     477           0 :         ss << "rEarth = " << rEarth / kpc << " kpc and ";
-     478           0 :         ss << "zg = " << zg / kpc << " kpc and";
-     479           0 :         ss << "beta = " << beta << " \n";
-     480           0 :         description = ss.str();
-     481           0 : }
-     482             : 
-     483             : // ---------------------------------------------------------------------------
-     484           0 : SourcePulsarDistribution::SourcePulsarDistribution() :
-     485           0 :     rEarth(8.5*kpc), beta(3.53), zg(0.3*kpc) {
-     486           0 :         setFrMax(8.5*kpc, 3.53);
-     487           0 :         setFzMax(0.3*kpc);
-     488           0 :         setRMax(22*kpc);
-     489           0 :         setZMax(5*kpc);
-     490           0 :         setRBlur(0.07);
-     491           0 :         setThetaBlur(0.35/kpc);
-     492           0 : }
-     493             : 
-     494           0 : SourcePulsarDistribution::SourcePulsarDistribution(double rEarth, double beta, double zg, double rB, double tB) :
-     495           0 :     rEarth(rEarth), beta(beta), zg(zg) {
-     496           0 :         setFrMax(rEarth, beta);
-     497           0 :         setFzMax(zg);
-     498           0 :         setRBlur(rB);
-     499           0 :         setThetaBlur(tB);
-     500           0 :         setRMax(22 * kpc);
-     501           0 :         setZMax(5 * kpc);
-     502           0 : }
-     503             : 
-     504           0 : void SourcePulsarDistribution::prepareParticle(ParticleState& particle) const {
-     505           0 :         Random &random = Random::instance();
-     506             :         double Rtilde;
-     507             :         while (true) {
-     508           0 :                 Rtilde = random.rand() * rMax;
-     509           0 :                 double fTest = random.rand() * frMax * 1.1;
-     510           0 :                 double fR = fr(Rtilde);
-     511           0 :                 if (fTest <= fR) {
-     512             :                         break;
-     513             :                 }
-     514             :         }
-     515             :         double ZPos;
-     516             :         while (true) {
-     517           0 :                 ZPos = (random.rand() - 0.5) * 2 * zMax;
-     518           0 :                 double fTest = random.rand() * fzMax;
-     519           0 :                 double fZ = fz(ZPos);
-     520           0 :                 if (fTest <= fZ) {
-     521             :                         break;
-     522             :                 }
-     523             :         }
-     524             : 
-     525           0 :         int i = random.randInt(3);
-     526           0 :         double thetaTilde = ftheta(i, Rtilde);
-     527           0 :         double RPos = blurR(Rtilde);
-     528           0 :         double phi = blurTheta(thetaTilde, Rtilde);
-     529           0 :         Vector3d pos(cos(phi) * RPos, sin(phi) * RPos, ZPos);
-     530             : 
-     531           0 :         particle.setPosition(pos);
-     532           0 :   }
-     533             : 
-     534           0 : double SourcePulsarDistribution::fr(double r) const {
-     535           0 :         double f = r * pow(r / rEarth, 2.) * exp(-beta * (r - rEarth) / rEarth);
-     536           0 :         return f;
-     537             : }
-     538             : 
-     539           0 : double SourcePulsarDistribution::fz(double z) const{
-     540             :         double Az = 1.;
-     541           0 :         double f = 1. / zg * exp(- fabs(z) / zg);
-     542             :         double fz = Az * f;
-     543           0 :         return fz;
-     544             : }
-     545             : 
-     546           0 : double SourcePulsarDistribution::ftheta(int i, double r) const {
-     547           0 :         const double k_0[] = {4.25, 4.25, 4.89, 4.89};
-     548           0 :         const double r_0[] = {3.48 * kpc, 3.48 * kpc, 4.9 * kpc, 4.9 * kpc};
-     549           0 :         const double theta_0[] = {0., 3.14, 2.52, -0.62};
-     550           0 :         double K = k_0[i];
-     551           0 :         double R = r_0[i];
-     552           0 :         double Theta = theta_0[i];
-     553             : 
-     554           0 :         double theta = K * log(r / R) + Theta;
-     555             : 
-     556           0 :         return theta;
-     557             : }
-     558             : 
-     559           0 : double SourcePulsarDistribution::blurR(double rTilde) const {
-     560           0 :         Random &random = Random::instance();
-     561           0 :         return random.randNorm(rTilde, rBlur * rTilde);
-     562             : }
-     563             : 
-     564           0 : double SourcePulsarDistribution::blurTheta(double thetaTilde, double rTilde) const {
-     565           0 :         Random &random = Random::instance();
-     566           0 :         double thetaCorr = (random.rand() - 0.5) * 2 * M_PI;
-     567           0 :         double tau = thetaCorr * exp(- thetaBlur * rTilde);
-     568           0 :         return thetaTilde + tau;
-     569             : }
-     570             : 
-     571           0 : void SourcePulsarDistribution::setFrMax(double R, double b) {
-     572           0 :         double r = 3 * R / b;
-     573           0 :         frMax = fr(r);
-     574           0 : }
-     575             : 
-     576           0 : void SourcePulsarDistribution::setFzMax(double zg) {
-     577           0 :         fzMax = 1. / zg;
-     578           0 :         return;
-     579             : }
-     580             : 
-     581           0 : void SourcePulsarDistribution::setRMax(double r) {
-     582           0 :         rMax = r;
-     583           0 :         return;
-     584             : }
-     585             : 
-     586           0 : void SourcePulsarDistribution::setZMax(double z) {
-     587           0 :         zMax = z;
-     588           0 :         return;
-     589             : }
-     590             : 
-     591           0 : void SourcePulsarDistribution::setRBlur(double r) {
-     592           0 :         rBlur = r;
-     593           0 :         return;
-     594             : }
-     595             : 
-     596           0 : void SourcePulsarDistribution::setThetaBlur(double theta) {
-     597           0 :         thetaBlur = theta;
-     598           0 :         return;
-     599             : }
-     600             : 
-     601           0 : double SourcePulsarDistribution::getFrMax() {
-     602           0 :         return frMax;
-     603             : }
-     604             : 
-     605           0 : double SourcePulsarDistribution::getFzMax() {
-     606           0 :         return fzMax;
-     607             : }
-     608             : 
-     609           0 : double SourcePulsarDistribution::getRMax() {
-     610           0 :         return rMax;
-     611             : }
-     612             : 
-     613           0 : double SourcePulsarDistribution::getZMax() {
-     614           0 :         return zMax;
-     615             : }
-     616             : 
-     617           0 : double SourcePulsarDistribution::getRBlur() {
-     618           0 :         return rBlur;
-     619             : }
-     620             : 
-     621           0 : double SourcePulsarDistribution::getThetaBlur() {
-     622           0 :         return thetaBlur;
-     623             : }
-     624             : 
-     625             : 
-     626           0 : void SourcePulsarDistribution::setDescription() {
-     627           0 :         std::stringstream ss;
-     628           0 :         ss << "SourcePulsarDistribution: Random position according to pulsar distribution";
-     629           0 :         ss << "rEarth = " << rEarth / kpc << " kpc and ";
-     630           0 :         ss << "zg = " << zg / kpc << " kpc and ";
-     631           0 :         ss << "beta = " << beta << " and ";
-     632           0 :         ss << "r_blur = " << rBlur << " and ";
-     633           0 :         ss << "theta blur = " << thetaBlur << "\n";
-     634           0 :         description = ss.str();
-     635           0 : }
-     636             : 
-     637             : // ----------------------------------------------------------------------------
-     638           1 : SourceUniform1D::SourceUniform1D(double minD, double maxD, bool withCosmology) {
-     639           1 :         this->withCosmology = withCosmology;
-     640           1 :         if (withCosmology) {
-     641           1 :                 this->minD = comoving2LightTravelDistance(minD);
-     642           1 :                 this->maxD = comoving2LightTravelDistance(maxD);
-     643             :         } else {
-     644           0 :                 this->minD = minD;
-     645           0 :                 this->maxD = maxD;
-     646             :         }
-     647           1 :         setDescription();
-     648           1 : }
-     649             : 
-     650           1 : void SourceUniform1D::prepareParticle(ParticleState& particle) const {
-     651           1 :         Random& random = Random::instance();
-     652           1 :         double d = random.rand() * (maxD - minD) + minD;
-     653           1 :         if (withCosmology)
-     654           1 :                 d = lightTravel2ComovingDistance(d);
-     655           1 :         particle.setPosition(Vector3d(d, 0, 0));
-     656           1 : }
-     657             : 
-     658           1 : void SourceUniform1D::setDescription() {
-     659           1 :         std::stringstream ss;
-     660           1 :         ss << "SourceUniform1D: Random uniform position in D = ";
-     661           2 :         ss << minD / Mpc << " - " << maxD / Mpc << " Mpc";
-     662           1 :         if (withCosmology)
-     663           1 :                 ss << " (including cosmology)";
-     664           1 :         ss << "\n";
-     665           1 :         description = ss.str();
-     666           1 : }
-     667             : 
-     668             : // ----------------------------------------------------------------------------
-     669           2 : SourceDensityGrid::SourceDensityGrid(ref_ptr<Grid1f> grid) :
-     670           2 :                 grid(grid) {
-     671             :         float sum = 0;
-     672          14 :         for (int ix = 0; ix < grid->getNx(); ix++) {
-     673         116 :                 for (int iy = 0; iy < grid->getNy(); iy++) {
-     674        1112 :                         for (int iz = 0; iz < grid->getNz(); iz++) {
-     675        1008 :                                 sum += grid->get(ix, iy, iz);
-     676        1008 :                                 grid->get(ix, iy, iz) = sum;
-     677             :                         }
-     678             :                 }
-     679             :         }
-     680           2 :         setDescription();
-     681           2 : }
-     682             : 
-     683       10001 : void SourceDensityGrid::prepareParticle(ParticleState& particle) const {
-     684       10001 :         Random &random = Random::instance();
-     685             : 
-     686             :         // draw random bin
-     687       10001 :         size_t i = random.randBin(grid->getGrid());
-     688       10001 :         Vector3d pos = grid->positionFromIndex(i);
-     689             : 
-     690             :         // draw uniform position within bin
-     691       10001 :         double dx = random.rand() - 0.5;
-     692       10001 :         double dy = random.rand() - 0.5;
-     693       10001 :         double dz = random.rand() - 0.5;
-     694             :         pos += Vector3d(dx, dy, dz) * grid->getSpacing();
-     695             : 
-     696       10001 :         particle.setPosition(pos);
-     697       10001 : }
-     698             : 
-     699           2 : void SourceDensityGrid::setDescription() {
-     700           2 :         description = "SourceDensityGrid: 3D source distribution according to density grid\n";
-     701           2 : }
-     702             : 
-     703             : // ----------------------------------------------------------------------------
-     704           2 : SourceDensityGrid1D::SourceDensityGrid1D(ref_ptr<Grid1f> grid) :
-     705           2 :                 grid(grid) {
-     706           2 :         if (grid->getNy() != 1)
-     707           0 :                 throw std::runtime_error("SourceDensityGrid1D: Ny != 1");
-     708           2 :         if (grid->getNz() != 1)
-     709           0 :                 throw std::runtime_error("SourceDensityGrid1D: Nz != 1");
-     710             : 
-     711             :         float sum = 0;
-     712          22 :         for (int ix = 0; ix < grid->getNx(); ix++) {
-     713          20 :                 sum += grid->get(ix, 0, 0);
-     714          20 :                 grid->get(ix, 0, 0) = sum;
-     715             :         }
-     716           2 :         setDescription();
-     717           2 : }
-     718             : 
-     719         101 : void SourceDensityGrid1D::prepareParticle(ParticleState& particle) const {
-     720         101 :         Random &random = Random::instance();
-     721             : 
-     722             :         // draw random bin
-     723         101 :         size_t i = random.randBin(grid->getGrid());
-     724         101 :         Vector3d pos = grid->positionFromIndex(i);
-     725             : 
-     726             :         // draw uniform position within bin
-     727         101 :         double dx = random.rand() - 0.5;
-     728         101 :         pos.x += dx * grid->getSpacing().x;
-     729             : 
-     730         101 :         particle.setPosition(pos);
-     731         101 : }
-     732             : 
-     733           2 : void SourceDensityGrid1D::setDescription() {
-     734           2 :         description = "SourceDensityGrid1D: 1D source distribution according to density grid\n";
-     735           2 : }
-     736             : 
-     737             : // ----------------------------------------------------------------------------
-     738           3 : SourceIsotropicEmission::SourceIsotropicEmission() {
-     739           3 :         setDescription();
-     740           3 : }
-     741             : 
-     742        1101 : void SourceIsotropicEmission::prepareParticle(ParticleState& particle) const {
-     743        1101 :         Random &random = Random::instance();
-     744        1101 :         particle.setDirection(random.randVector());
-     745        1101 : }
-     746             : 
-     747           3 : void SourceIsotropicEmission::setDescription() {
-     748           3 :         description = "SourceIsotropicEmission: Random isotropic direction\n";
-     749           3 : }
-     750             : 
-     751             : // ----------------------------------------------------------------------------
-     752           1 : SourceDirectedEmission::SourceDirectedEmission(Vector3d mu, double kappa): mu(mu), kappa(kappa) {
-     753           1 :         if (kappa <= 0)
-     754           0 :                 throw std::runtime_error("The concentration parameter kappa should be larger than 0.");
-     755           1 :         setDescription();
-     756           1 : }
-     757             : 
-     758        1000 : void SourceDirectedEmission::prepareCandidate(Candidate &candidate) const {
-     759        1000 :         Random &random = Random::instance();
-     760             : 
-     761             :         Vector3d muvec = mu / mu.getR();
-     762        1000 :         Vector3d v = random.randFisherVector(muvec, kappa);
-     763             : 
-     764        1000 :         v = v.getUnitVector();
-     765        1000 :         candidate.source.setDirection(v);
-     766        1000 :         candidate.created.setDirection(v);
-     767        1000 :         candidate.previous.setDirection(v);
-     768        1000 :         candidate.current.setDirection(v);
-     769             : 
-     770             :         //set the weight of the particle, see eq. 3.1 of PoS(ICRC2019)447
-     771        1000 :         double pdfVonMises = kappa / (2. * M_PI * (1. - exp(-2. * kappa))) * exp(-kappa * (1. - v.dot(mu)));
-     772        1000 :         double weight = 1. / (4. * M_PI * pdfVonMises);
-     773        1000 :         candidate.setWeight(weight);
-     774        1000 : }
-     775             : 
-     776           1 : void SourceDirectedEmission::setDescription() {
-     777           1 :         std::stringstream ss;
-     778           1 :         ss << "SourceDirectedEmission: Random directed emission following the von-Mises-Fisher distribution with mean direction ";
-     779           1 :         ss << mu << " and concentration parameter kappa = ";
-     780           1 :         ss << kappa << "\n";
-     781           1 :         description = ss.str();
-     782           1 : }
-     783             : 
-     784             : // ----------------------------------------------------------------------------
-     785           0 : SourceLambertDistributionOnSphere::SourceLambertDistributionOnSphere(const Vector3d &center, double radius, bool inward) :
-     786           0 :                 center(center), radius(radius) {
-     787           0 :         this->inward = inward;
-     788           0 :         setDescription();
-     789           0 : }
-     790             : 
-     791           0 : void SourceLambertDistributionOnSphere::prepareParticle(ParticleState& particle) const {
-     792           0 :         Random &random = Random::instance();
-     793           0 :         Vector3d normalVector = random.randVector();
-     794           0 :         particle.setPosition(center + normalVector * radius);
-     795           0 :         double sign = inward ? -1 : 1; // negative (positive) Lamberts vector for inward (outward) directed emission
-     796           0 :         particle.setDirection(Vector3d(0, 0, 0) + sign * random.randVectorLamberts(normalVector));
-     797           0 : }
-     798             : 
-     799           0 : void SourceLambertDistributionOnSphere::setDescription() {
-     800           0 :         std::stringstream ss;
-     801           0 :         ss << "SourceLambertDistributionOnSphere: Random position and direction on a Sphere with center ";
-     802           0 :         ss << center / kpc << " kpc and ";
-     803           0 :         ss << radius / kpc << " kpc radius\n";
-     804           0 :         description = ss.str();
-     805           0 : }
-     806             : 
-     807             : // ----------------------------------------------------------------------------
-     808           0 : SourceDirection::SourceDirection(Vector3d direction) :
-     809           0 :                 direction(direction) {
-     810           0 :         setDescription();
-     811           0 : }
-     812             : 
-     813           0 : void SourceDirection::prepareParticle(ParticleState& particle) const {
-     814           0 :         particle.setDirection(direction);
-     815           0 : }
-     816             : 
-     817           0 : void SourceDirection::setDescription() {
-     818           0 :         std::stringstream ss;
-     819           0 :         ss <<  "SourceDirection: Emission direction = " << direction << "\n";
-     820           0 :         description = ss.str();
-     821           0 : }
-     822             : 
-     823             : // ----------------------------------------------------------------------------
-     824           0 : SourceEmissionMap::SourceEmissionMap(EmissionMap *emissionMap) : emissionMap(emissionMap) {
-     825           0 :         setDescription();
-     826           0 : }
-     827             : 
-     828           0 : void SourceEmissionMap::prepareCandidate(Candidate &candidate) const {
-     829           0 :         if (emissionMap) {
-     830           0 :                 bool accept = emissionMap->checkDirection(candidate.source);
-     831           0 :                 candidate.setActive(accept);
-     832             :         }
-     833           0 : }
-     834             : 
-     835           0 : void SourceEmissionMap::setDescription() {
-     836           0 :         description = "SourceEmissionMap: accept only directions from emission map\n";
-     837           0 : }
-     838             : 
-     839           0 : void SourceEmissionMap::setEmissionMap(EmissionMap *emissionMap) {
-     840           0 :         this->emissionMap = emissionMap;
-     841           0 : }
-     842             : 
-     843             : // ----------------------------------------------------------------------------
-     844           1 : SourceEmissionCone::SourceEmissionCone(Vector3d direction, double aperture) :
-     845           1 :         aperture(aperture) {
-     846           1 :         setDirection(direction);
-     847           1 :         setDescription();
-     848             :         
-     849           1 : }
-     850             : 
-     851           1 : void SourceEmissionCone::prepareParticle(ParticleState& particle) const {
-     852           1 :         Random &random = Random::instance();
-     853           1 :         particle.setDirection(random.randConeVector(direction, aperture));
-     854           1 : }
-     855             : 
-     856           1 : void SourceEmissionCone::setDirection(Vector3d dir) {
-     857           1 :         if (dir.getR() == 0) {
-     858           0 :                 throw std::runtime_error("SourceEmissionCone: The direction vector was a null vector.");
-     859             :         } else {
-     860           1 :                 direction = dir.getUnitVector();
-     861             :         }
-     862           1 : }
-     863             : 
-     864           1 : void SourceEmissionCone::setDescription() {
-     865           1 :         std::stringstream ss;
-     866           1 :         ss << "SourceEmissionCone: Jetted emission in ";
-     867           1 :         ss << "direction = " << direction << " with ";
-     868           1 :         ss << "half-opening angle = " << aperture << " rad\n";
-     869           1 :         description = ss.str();
-     870           1 : }
-     871             : 
-     872             : // ----------------------------------------------------------------------------
-     873           1 : SourceRedshift::SourceRedshift(double z) :
-     874           1 :                 z(z) {
-     875           1 :         setDescription();
-     876           1 : }
-     877             : 
-     878           1 : void SourceRedshift::prepareCandidate(Candidate& candidate) const {
-     879           1 :         candidate.setRedshift(z);
-     880           1 : }
-     881             : 
-     882           1 : void SourceRedshift::setDescription() {
-     883           1 :         std::stringstream ss;
-     884           1 :         ss << "SourceRedshift: Redshift z = " << z << "\n";
-     885           1 :         description = ss.str();
-     886           1 : }
-     887             : 
-     888             : // ----------------------------------------------------------------------------
-     889           0 : SourceUniformRedshift::SourceUniformRedshift(double zmin, double zmax) :
-     890           0 :                 zmin(zmin), zmax(zmax) {
-     891           0 :         setDescription();
-     892           0 : }
-     893             : 
-     894           0 : void SourceUniformRedshift::prepareCandidate(Candidate& candidate) const {
-     895           0 :         double z = Random::instance().randUniform(zmin, zmax);
-     896           0 :         candidate.setRedshift(z);
-     897           0 : }
-     898             : 
-     899           0 : void SourceUniformRedshift::setDescription() {
-     900           0 :         std::stringstream ss;
-     901           0 :         ss << "SourceUniformRedshift: Uniform redshift in z = ";
-     902           0 :         ss << zmin << " - " << zmax << "\n";
-     903           0 :         description = ss.str();
-     904           0 : }
-     905             : 
-     906             : // ----------------------------------------------------------------------------
-     907           2 : SourceRedshiftEvolution::SourceRedshiftEvolution(double m, double zmin, double zmax) : m(m), zmin(zmin), zmax(zmax) {
-     908           2 :         std::stringstream ss;
-     909             :         ss << "SourceRedshiftEvolution: (1+z)^m, m = " << m;
-     910           2 :         ss << ", z = " << zmin << " - " << zmax << "\n";
-     911           2 :         description = ss.str();
-     912           2 : }
-     913             : 
-     914         200 : void SourceRedshiftEvolution::prepareCandidate(Candidate& candidate) const {
-     915         200 :         double x = Random::instance().randUniform(0, 1);
-     916             :         double norm, z;
-     917             : 
-     918             :         // special case: m=-1
-     919         200 :         if ((std::abs(m+1)) < std::numeric_limits<double>::epsilon()) {
-     920         100 :                 norm = log1p(zmax) - log1p(zmin);
-     921         100 :                 z = exp(norm*x) * (1+zmin) - 1;
-     922             :         } else {
-     923         100 :                 norm = ( pow(1+zmax, m+1) - pow(1+zmin, m+1) ) / (m+1);
-     924         100 :                 z = pow( norm*(m+1)*x + pow(1+zmin, m+1), 1./(m+1)) - 1;
-     925             :         }
-     926         200 :         candidate.setRedshift(z);
-     927         200 : }
-     928             : 
-     929             : // ----------------------------------------------------------------------------
-     930           1 : SourceRedshift1D::SourceRedshift1D() {
-     931           1 :         setDescription();
-     932           1 : }
-     933             : 
-     934           1 : void SourceRedshift1D::prepareCandidate(Candidate& candidate) const {
-     935           1 :         double d = candidate.source.getPosition().getR();
-     936           1 :         double z = comovingDistance2Redshift(d);
-     937           1 :         candidate.setRedshift(z);
-     938           1 : }
-     939             : 
-     940           1 : void SourceRedshift1D::setDescription() {
-     941           1 :         description = "SourceRedshift1D: Redshift according to source distance\n";
-     942           1 : }
-     943             : 
-     944             : // ----------------------------------------------------------------------------
-     945             : #ifdef CRPROPA_HAVE_MUPARSER
-     946           1 : SourceGenericComposition::SourceGenericComposition(double Emin, double Emax, std::string expression, size_t bins) :
-     947           2 :         Emin(Emin), Emax(Emax), expression(expression), bins(bins) {
-     948             : 
-     949             :         // precalculate energy bins
-     950           1 :         double logEmin = ::log10(Emin);
-     951           1 :         double logEmax = ::log10(Emax);
-     952           1 :         double logStep = (logEmax - logEmin) / bins;
-     953           1 :         energy.resize(bins + 1);
-     954        1026 :         for (size_t i = 0; i <= bins; i++) {
-     955        1025 :                 energy[i] = ::pow(10, logEmin + i * logStep);
-     956             :         }
-     957           1 :         setDescription();
-     958           1 : }
-     959             : 
-     960           2 : void SourceGenericComposition::add(int id, double weight) {
-     961           2 :         int A = massNumber(id);
-     962           2 :         int Z = chargeNumber(id);
-     963             : 
-     964             :         Nucleus n;
-     965           2 :         n.id = id;
-     966             : 
-     967             :         // calculate nuclei cdf
-     968           2 :         mu::Parser p;
-     969             :         double E;
-     970           2 :         p.DefineVar("E", &E);
-     971           2 :         p.DefineConst("Emin", Emin);
-     972           2 :         p.DefineConst("Emax", Emax);
-     973           2 :         p.DefineConst("bins", bins);
-     974           2 :         p.DefineConst("A", (double)A);
-     975           2 :         p.DefineConst("Z", (double)Z);
-     976             : 
-     977           2 :         p.DefineConst("MeV", MeV);
-     978           2 :         p.DefineConst("GeV", GeV);
-     979           2 :         p.DefineConst("TeV", TeV);
-     980           2 :         p.DefineConst("PeV", PeV);
-     981           2 :         p.DefineConst("EeV", EeV);
-     982             : 
-     983           2 :         p.SetExpr(expression);
-     984             : 
-     985             :         // calculate pdf
-     986           2 :         n.cdf.resize(bins + 1);
-     987             : 
-     988        2052 :         for (std::size_t i=0; i<=bins; ++i) {
-     989        2050 :                 E = energy[i];
-     990        2050 :                 n.cdf[i] = p.Eval();
-     991             :         }
-     992             : 
-     993             :         // integrate
-     994        2050 :         for (std::size_t i=bins; i>0; --i) {
-     995        2048 :                 n.cdf[i] = (n.cdf[i-1] + n.cdf[i]) * (energy[i] - energy[i-1]) / 2;
-     996             :         }
-     997           2 :         n.cdf[0] = 0;
-     998             : 
-     999             :         // cumulate
-    1000        2050 :         for (std::size_t i=1; i<=bins; ++i) {
-    1001        2048 :                 n.cdf[i] += n.cdf[i-1];
-    1002             :         }
-    1003             : 
-    1004           2 :         nuclei.push_back(n);
-    1005             : 
-    1006             :         // update composition cdf
-    1007           2 :         if (cdf.size() == 0)
-    1008           1 :                 cdf.push_back(weight * n.cdf.back());
-    1009             :         else
-    1010           1 :                 cdf.push_back(cdf.back() + weight * n.cdf.back());
-    1011           2 : }
-    1012             : 
-    1013           0 : void SourceGenericComposition::add(int A, int Z, double a) {
-    1014           0 :         add(nucleusId(A, Z), a);
-    1015           0 : }
-    1016             : 
-    1017      100000 : void SourceGenericComposition::prepareParticle(ParticleState& particle) const {
-    1018      100000 :         if (nuclei.size() == 0)
-    1019           0 :                 throw std::runtime_error("SourceComposition: No source isotope set");
-    1020             : 
-    1021      100000 :         Random &random = Random::instance();
-    1022             : 
-    1023             : 
-    1024             :         // draw random particle type
-    1025      100000 :         size_t iN = random.randBin(cdf);
-    1026             :         const Nucleus &n = nuclei.at(iN);
-    1027      100000 :         particle.setId(n.id);
-    1028             : 
-    1029             :         // random energy
-    1030      100000 :         double E = interpolate(random.rand() * n.cdf.back(), n.cdf, energy);
-    1031      100000 :         particle.setEnergy(E);
-    1032      100000 : }
-    1033             : 
-    1034           1 : void SourceGenericComposition::setDescription() {
-    1035           1 :         description = "Generice source composition" + expression;
-    1036           1 : }
-    1037             : 
-    1038             : #endif
-    1039             : 
-    1040             : // ----------------------------------------------------------------------------
-    1041             : 
-    1042           1 : SourceTag::SourceTag(std::string tag) {
-    1043           1 :         setTag(tag);
-    1044           1 : }
-    1045             : 
-    1046           1 : void SourceTag::prepareCandidate(Candidate &cand) const {
-    1047           1 :         cand.setTagOrigin(sourceTag);
-    1048           1 : }
-    1049             : 
-    1050           1 : void SourceTag::setDescription() {
-    1051           1 :         description = "SourceTag: " + sourceTag;
-    1052           1 : }
-    1053             : 
-    1054           1 : void SourceTag::setTag(std::string tag) {
-    1055           1 :         sourceTag = tag;
-    1056           1 :         setDescription();
-    1057           1 : }
-    1058             : 
-    1059             : // ----------------------------------------------------------------------------
-    1060             : 
-    1061           0 : SourceMassDistribution::SourceMassDistribution(ref_ptr<Density> density, double max, double x, double y, double z) : 
-    1062           0 :         density(density), maxDensity(max), xMin(-x), xMax(x), yMin(-y), yMax(y), zMin(-z), zMax(z) {}
-    1063             : 
-    1064           0 : void SourceMassDistribution::setMaximalDensity(double maxDensity) {
-    1065           0 :         if (maxDensity <= 0) {
-    1066           0 :                 KISS_LOG_WARNING << "SourceMassDistribution: maximal density must be larger than 0. Nothing changed.\n";
-    1067           0 :                 return;
-    1068             :         }
-    1069           0 :         this->maxDensity = maxDensity;
-    1070             : }
-    1071             : 
-    1072           0 : void SourceMassDistribution::setXrange(double xMin, double xMax) {
-    1073           0 :         if (xMin > xMax) {
-    1074           0 :                 KISS_LOG_WARNING << "SourceMassDistribution: minimal x-value must not exceed the maximal one\n";
-    1075           0 :                 return;
-    1076             :         }
-    1077           0 :         this -> xMin = xMin;
-    1078           0 :         this -> xMax = xMax;
-    1079             : }
-    1080             : 
-    1081           0 : void SourceMassDistribution::setYrange(double yMin, double yMax) {
-    1082           0 :         if (yMin > yMax) {
-    1083           0 :                 KISS_LOG_WARNING << "SourceMassDistribution: minimal y-value must not exceed the maximal one\n";
-    1084           0 :                 return;
-    1085             :         }
-    1086           0 :         this -> yMin = yMin;
-    1087           0 :         this -> yMax = yMax;
-    1088             : }
-    1089             : 
-    1090           0 : void SourceMassDistribution::setZrange(double zMin, double zMax) {
-    1091           0 :         if (zMin > zMax) {
-    1092           0 :                 KISS_LOG_WARNING << "SourceMassDistribution: minimal z-value must not exceed the maximal one\n";
-    1093           0 :                 return;
-    1094             :         }
-    1095           0 :         this -> zMin = zMin;
-    1096           0 :         this -> zMax = zMax;
-    1097             : }
-    1098             : 
-    1099           0 : Vector3d SourceMassDistribution::samplePosition() const {
-    1100             :         Vector3d pos; 
-    1101           0 :         Random &rand = Random::instance();
-    1102             : 
-    1103           0 :         for (int i = 0; i < maxTries; i++) {
-    1104           0 :                 pos.x = rand.randUniform(xMin, xMax);
-    1105           0 :                 pos.y = rand.randUniform(yMin, yMax);
-    1106           0 :                 pos.z = rand.randUniform(zMin, zMax);
-    1107             : 
-    1108           0 :                 double n_density = density->getDensity(pos) / maxDensity;
-    1109           0 :                 double n_test = rand.rand();
-    1110           0 :                 if (n_test < n_density) {
-    1111             :                         return pos;
-    1112             :                 }
-    1113             :         }
-    1114           0 :         KISS_LOG_WARNING << "SourceMassDistribution: sampling a position was not possible within " 
-    1115           0 :                 << maxTries << " tries. Please check the maximum density or increse the number of maximal tries. \n";
-    1116             :         return Vector3d(0.);
-    1117             : }       
-    1118             : 
-    1119           0 : void SourceMassDistribution::prepareParticle(ParticleState &state) const {
-    1120           0 :         Vector3d pos = samplePosition();
-    1121           0 :         state.setPosition(pos);
-    1122           0 : }
-    1123             : 
-    1124           0 : void SourceMassDistribution::setMaximalTries(int tries) {
-    1125           0 :         this -> maxTries = tries;
-    1126           0 : }
-    1127             : 
-    1128           0 : std::string SourceMassDistribution::getDescription() {
-    1129           0 :         std::stringstream ss;
-    1130           0 :         ss << "SourceMassDistribuion: following the density distribution :\n";
-    1131           0 :         ss << "\t" << density -> getDescription();
-    1132           0 :         ss << "with a maximal density of " << maxDensity << " / m^3 \n";
-    1133           0 :         ss << "using the sampling range: \n";
-    1134           0 :         ss << "\t x in [" << xMin / kpc << " ; " << xMax / kpc << "] kpc \n";
-    1135           0 :         ss << "\t y in [" << yMin / kpc << " ; " << yMax / kpc << "] kpc \n";
-    1136           0 :         ss << "\t z in [" << zMin / kpc << " ; " << zMax / kpc << "] kpc \n";
-    1137           0 :         ss << "with maximal number of tries for sampling of " << maxTries << "\n";
-    1138             : 
-    1139           0 :         return ss.str();
-    1140           0 : }
-    1141             : 
-    1142             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Variant.cpp.func-sort-c.html b/doc/coverageReport/src/Variant.cpp.func-sort-c.html deleted file mode 100644 index 3bcf5eae5..000000000 --- a/doc/coverageReport/src/Variant.cpp.func-sort-c.html +++ /dev/null @@ -1,264 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Variant.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Variant.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:7151913.7 %
Date:2024-04-08 14:58:22Functions:184837.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa7Variant11getTypeNameENS0_4TypeE0
_ZN7crpropa7Variant6resizeEm0
_ZN7crpropa7Variant6toTypeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa7VariantC2ENS0_4TypeE0
_ZN7crpropa7VariantcvRSt6vectorIS0_SaIS0_EEEv0
_ZN7crpropa7VariantixEm0
_ZN7crpropalsERSoRKNS_7VariantE0
_ZNK7crpropa7Variant10toVector3cEv0
_ZNK7crpropa7Variant10toVector3dEv0
_ZNK7crpropa7Variant10toVector3fEv0
_ZNK7crpropa7Variant11getTypeNameEv0
_ZNK7crpropa7Variant12toLongDoubleEv0
_ZNK7crpropa7Variant14toComplexFloatEv0
_ZNK7crpropa7Variant15toComplexDoubleEv0
_ZNK7crpropa7Variant4sizeEv0
_ZNK7crpropa7Variant6toCharEv0
_ZNK7crpropa7Variant7getSizeEv0
_ZNK7crpropa7Variant7toFloatEv0
_ZNK7crpropa7Variant7toInt16Ev0
_ZNK7crpropa7Variant7toInt32Ev0
_ZNK7crpropa7Variant7toUCharEv0
_ZNK7crpropa7Variant8toUInt16Ev0
_ZNK7crpropa7Variant8toUInt32Ev0
_ZNK7crpropa7Variant8toUInt64Ev0
_ZNK7crpropa7Variant8toVectorEv0
_ZNK7crpropa7Variant9getSizeOfEv0
_ZNK7crpropa7VariantcvRKSt6vectorIS0_SaIS0_EEEv0
_ZNK7crpropa7VariantixEm0
_ZNK7crpropa7VariantneEPKc0
_ZNK7crpropa7VariantneERKS0_0
_ZN7crpropa7Variant12copyToBufferEPv1
_ZN7crpropa7Variant10fromStringERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS0_4TypeE2
_ZNK7crpropa7Variant5checkENS0_4TypeE2
_ZNK7crpropa7Variant6toBoolEv2
_ZNK7crpropa7Variant7toInt64Ev2
_ZN7crpropa7VariantC2EPKc3
_ZNK7crpropa7VarianteqERKS0_4
_ZNK7crpropa7Variant8toDoubleEv6
_ZNK7crpropa7Variant8toStringERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE6
_ZNK7crpropa7Variant7isValidEv8
_ZNK7crpropa7Variant11getTypeInfoEv60
_ZN7crpropa7VariantC2Ev1147
_ZN7crpropa7VariantaSERKS0_1153
_ZN7crpropa7VariantC2ERKS0_2306
_ZN7crpropa7Variant4copyERKS0_3459
_ZN7crpropa7VariantD2Ev4610
_ZN7crpropa7Variant5clearENS0_4TypeE5785
_ZN7crpropa7Variant5checkENS0_4TypeE5793
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Variant.cpp.func.html b/doc/coverageReport/src/Variant.cpp.func.html deleted file mode 100644 index 878d842c0..000000000 --- a/doc/coverageReport/src/Variant.cpp.func.html +++ /dev/null @@ -1,264 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Variant.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Variant.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:7151913.7 %
Date:2024-04-08 14:58:22Functions:184837.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa7Variant10fromStringERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS0_4TypeE2
_ZN7crpropa7Variant11getTypeNameENS0_4TypeE0
_ZN7crpropa7Variant12copyToBufferEPv1
_ZN7crpropa7Variant4copyERKS0_3459
_ZN7crpropa7Variant5checkENS0_4TypeE5793
_ZN7crpropa7Variant5clearENS0_4TypeE5785
_ZN7crpropa7Variant6resizeEm0
_ZN7crpropa7Variant6toTypeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa7VariantC2ENS0_4TypeE0
_ZN7crpropa7VariantC2EPKc3
_ZN7crpropa7VariantC2ERKS0_2306
_ZN7crpropa7VariantC2Ev1147
_ZN7crpropa7VariantD2Ev4610
_ZN7crpropa7VariantaSERKS0_1153
_ZN7crpropa7VariantcvRSt6vectorIS0_SaIS0_EEEv0
_ZN7crpropa7VariantixEm0
_ZN7crpropalsERSoRKNS_7VariantE0
_ZNK7crpropa7Variant10toVector3cEv0
_ZNK7crpropa7Variant10toVector3dEv0
_ZNK7crpropa7Variant10toVector3fEv0
_ZNK7crpropa7Variant11getTypeInfoEv60
_ZNK7crpropa7Variant11getTypeNameEv0
_ZNK7crpropa7Variant12toLongDoubleEv0
_ZNK7crpropa7Variant14toComplexFloatEv0
_ZNK7crpropa7Variant15toComplexDoubleEv0
_ZNK7crpropa7Variant4sizeEv0
_ZNK7crpropa7Variant5checkENS0_4TypeE2
_ZNK7crpropa7Variant6toBoolEv2
_ZNK7crpropa7Variant6toCharEv0
_ZNK7crpropa7Variant7getSizeEv0
_ZNK7crpropa7Variant7isValidEv8
_ZNK7crpropa7Variant7toFloatEv0
_ZNK7crpropa7Variant7toInt16Ev0
_ZNK7crpropa7Variant7toInt32Ev0
_ZNK7crpropa7Variant7toInt64Ev2
_ZNK7crpropa7Variant7toUCharEv0
_ZNK7crpropa7Variant8toDoubleEv6
_ZNK7crpropa7Variant8toStringERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE6
_ZNK7crpropa7Variant8toUInt16Ev0
_ZNK7crpropa7Variant8toUInt32Ev0
_ZNK7crpropa7Variant8toUInt64Ev0
_ZNK7crpropa7Variant8toVectorEv0
_ZNK7crpropa7Variant9getSizeOfEv0
_ZNK7crpropa7VariantcvRKSt6vectorIS0_SaIS0_EEEv0
_ZNK7crpropa7VarianteqERKS0_4
_ZNK7crpropa7VariantixEm0
_ZNK7crpropa7VariantneEPKc0
_ZNK7crpropa7VariantneERKS0_0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/Variant.cpp.gcov.html b/doc/coverageReport/src/Variant.cpp.gcov.html deleted file mode 100644 index b1925926a..000000000 --- a/doc/coverageReport/src/Variant.cpp.gcov.html +++ /dev/null @@ -1,1200 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/Variant.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - Variant.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:7151913.7 %
Date:2024-04-08 14:58:22Functions:184837.5 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : //-------------------------------------------------------------
-       2             : // Based on Variant.cc in the Physics eXtension Library (PXL) -
-       3             : // http://vispa.physik.rwth-aachen.de/                        -
-       4             : // Licensed under a LGPL-2 or later license                   -
-       5             : //-------------------------------------------------------------
-       6             : 
-       7             : #include "crpropa/Variant.h"
-       8             : 
-       9             : 
-      10             : namespace crpropa {
-      11             : 
-      12             : 
-      13        1147 : Variant::Variant() : type(TYPE_NONE) {
-      14        1147 : }
-      15             : 
-      16           0 : Variant::Variant(Type t) : type(TYPE_NONE) {
-      17           0 :         check(t);
-      18           0 : }
-      19             : 
-      20        2306 : Variant::Variant(const Variant& v) : type(TYPE_NONE) {
-      21        2306 :         copy(v);
-      22        2306 : }
-      23             : 
-      24           3 : Variant::Variant(const char* s) {
-      25           3 :         data._t_string = new std::string(s);
-      26           3 :         type = TYPE_STRING;
-      27           3 : }
-      28             : 
-      29        4610 : Variant::~Variant() {
-      30        4610 :         clear();
-      31        4610 : }
-      32             : 
-      33           0 : const char* Variant::getTypeName() const {
-      34           0 :         return getTypeName(type);
-      35             : }
-      36             : 
-      37           0 : const char* Variant::getTypeName(Type t) {
-      38             :         if (t == TYPE_NONE)
-      39             :                 return "none";
-      40             :         else if (t == TYPE_BOOL)
-      41           0 :                 return "bool";
-      42             :         else if (t == TYPE_CHAR)
-      43           0 :                 return "char";
-      44             :         else if (t == TYPE_UCHAR)
-      45           0 :                 return "uchar";
-      46             :         else if (t == TYPE_INT16)
-      47           0 :                 return "int16";
-      48             :         else if (t == TYPE_UINT16)
-      49           0 :                 return "uint16";
-      50             :         else if (t == TYPE_INT32)
-      51           0 :                 return "int32";
-      52             :         else if (t == TYPE_UINT32)
-      53           0 :                 return "uint32";
-      54             :         else if (t == TYPE_INT64)
-      55           0 :                 return "int64";
-      56             :         else if (t == TYPE_UINT64)
-      57           0 :                 return "uint64";
-      58             :         else if (t == TYPE_FLOAT)
-      59           0 :                 return "float";
-      60             :         else if (t == TYPE_DOUBLE)
-      61           0 :                 return "double";
-      62             :         else if (t == TYPE_LONGDOUBLE)
-      63           0 :                 return "ldouble";
-      64             :         else if (t == TYPE_COMPLEXF)
-      65           0 :                 return "complex_f";
-      66             :         else if (t == TYPE_COMPLEXD)
-      67           0 :                 return "complex_d";
-      68             :         else if (t == TYPE_STRING)
-      69           0 :                 return "string";
-      70             :         else if (t == TYPE_VECTOR3F)
-      71           0 :                 return "Vector3f";
-      72             :         else if (t == TYPE_VECTOR3D)
-      73           0 :                 return "Vector3d";
-      74             :         else if (t == TYPE_VECTOR3C)
-      75           0 :                 return "Vector3c";
-      76             :         else if (t == TYPE_VECTOR)
-      77           0 :                 return "vector";
-      78             :         else
-      79           0 :                 return "unknown";
-      80             : }
-      81             : 
-      82          60 : const std::type_info& Variant::getTypeInfo() const {
-      83          60 :         if (type == TYPE_BOOL) {
-      84             :                 const std::type_info& ti = typeid(data._t_bool);
-      85             :                 return ti;
-      86             :         } else if (type == TYPE_CHAR) {
-      87             :                 const std::type_info& ti = typeid(data._t_char);
-      88             :                 return ti;
-      89             :         } else if (type == TYPE_UCHAR) {
-      90             :                 const std::type_info& ti = typeid(data._t_uchar);
-      91           0 :                 return ti;
-      92             :         } else if (type == TYPE_INT16) {
-      93             :                 const std::type_info& ti = typeid(data._t_int16);
-      94           0 :                 return ti;
-      95             :         } else if (type == TYPE_UINT16) {
-      96             :                 const std::type_info& ti = typeid(data._t_uint16);
-      97           0 :                 return ti;
-      98             :         } else if (type == TYPE_INT32) {
-      99             :                 const std::type_info& ti = typeid(data._t_int32);
-     100          12 :                 return ti;
-     101             :         } else if (type == TYPE_UINT32) {
-     102             :                 const std::type_info& ti = typeid(data._t_uint32);
-     103           0 :                 return ti;
-     104             :         } else if (type == TYPE_INT64) {
-     105             :                 const std::type_info& ti = typeid(data._t_int64);
-     106           0 :                 return ti;
-     107             :         } else if (type == TYPE_UINT64) {
-     108             :                 const std::type_info& ti = typeid(data._t_uint64);
-     109           0 :                 return ti;
-     110             :         } else if (type == TYPE_FLOAT) {
-     111             :                 const std::type_info& ti = typeid(data._t_float);
-     112           0 :                 return ti;
-     113             :         } else if (type == TYPE_DOUBLE) {
-     114             :                 const std::type_info& ti = typeid(data._t_double);
-     115          22 :                 return ti;
-     116             :         } else if (type == TYPE_LONGDOUBLE)     {
-     117             :                 const std::type_info& ti = typeid(data._t_ldouble);
-     118           0 :                 return ti;
-     119             :         } else if (type == TYPE_STRING) {
-     120             :                 const std::type_info& ti = typeid(*data._t_string);
-     121          24 :                 return ti;
-     122             :         } else if (type == TYPE_COMPLEXF) { // pointer needed?
-     123             :                 const std::type_info& ti = typeid(*data._t_complex_f);
-     124           0 :                 return ti;
-     125             :         } else if (type == TYPE_COMPLEXD) {
-     126             :                 const std::type_info& ti = typeid(*data._t_complex_d);
-     127           0 :                 return ti;
-     128             :         } else if (type == TYPE_VECTOR3D) {
-     129             :                 const std::type_info& ti = typeid(data._t_vector3d);
-     130           0 :                 return ti;
-     131             :         } else if (type == TYPE_VECTOR3F) {
-     132             :                 const std::type_info& ti = typeid(data._t_vector3f);
-     133           0 :                 return ti;
-     134             :         } else if (type == TYPE_VECTOR) {
-     135             :                 const std::type_info& ti = typeid(*data._t_vector);
-     136           0 :                 return ti;
-     137             :         } else {
-     138             :                 const std::type_info& ti = typeid(0);
-     139           0 :                 return ti;
-     140             :         }
-     141             : }
-     142             : 
-     143           0 : Variant::Type Variant::toType(const std::string& name) {
-     144           0 :         if (name == "none")
-     145             :                 return TYPE_NONE;
-     146           0 :         else if (name == "bool")
-     147             :                 return TYPE_BOOL;
-     148           0 :         else if (name == "char") 
-     149             :                 return TYPE_CHAR;
-     150           0 :         else if (name == "uchar")
-     151             :                 return TYPE_UCHAR;
-     152           0 :         else if (name == "int16")
-     153             :                 return TYPE_INT16;
-     154           0 :         else if (name == "uint16")
-     155             :                 return TYPE_UINT16;
-     156           0 :         else if (name == "int32")
-     157             :                 return TYPE_INT32;
-     158           0 :         else if (name == "uint32")
-     159             :                 return TYPE_UINT32;
-     160           0 :         else if (name == "int64")
-     161             :                 return TYPE_INT64;
-     162           0 :         else if (name == "uint64")
-     163             :                 return TYPE_UINT64;
-     164           0 :         else if (name == "float")
-     165             :                 return TYPE_FLOAT;
-     166           0 :         else if (name == "double")
-     167             :                 return TYPE_DOUBLE;
-     168           0 :         else if (name == "long double")
-     169             :                 return TYPE_LONGDOUBLE;
-     170           0 :         else if (name == "complex_f")
-     171             :                 return TYPE_COMPLEXF;
-     172           0 :         else if (name == "complex_d")
-     173             :                 return TYPE_COMPLEXD;
-     174           0 :          else if (name == "string")
-     175             :                 return TYPE_STRING;
-     176           0 :         else if (name == "Vector3f")
-     177             :                 return TYPE_VECTOR3F;
-     178           0 :         else if (name == "Vector3d")
-     179             :                 return TYPE_VECTOR3D;
-     180           0 :         else if (name == "Vector3c")
-     181             :                 return TYPE_VECTOR3C;
-     182           0 :         else if (name == "vector")
-     183             :                 return TYPE_VECTOR;
-     184             :         else
-     185           0 :                 return TYPE_NONE;
-     186             : }
-     187             : 
-     188           2 : bool Variant::toBool() const {
-     189           2 :         switch (type) {
-     190           2 :                 case TYPE_BOOL:
-     191           2 :                         return data._t_bool;
-     192             :                         break;
-     193           0 :                 case TYPE_CHAR:
-     194           0 :                         return data._t_char != 0;
-     195             :                         break;
-     196           0 :                 case TYPE_UCHAR:
-     197           0 :                         return data._t_uchar != 0;
-     198             :                         break;
-     199           0 :                 case TYPE_INT16:
-     200           0 :                         return data._t_int16 != 0;
-     201             :                         break;
-     202           0 :                 case TYPE_UINT16:
-     203           0 :                         return data._t_uint16 != 0;
-     204             :                         break;
-     205           0 :                 case TYPE_INT32:
-     206           0 :                         return data._t_int32 != 0;
-     207             :                         break;
-     208           0 :                 case TYPE_UINT32:
-     209           0 :                         return data._t_uint32 != 0;
-     210             :                         break;
-     211           0 :                 case TYPE_INT64:
-     212           0 :                         return data._t_int64 != 0;
-     213             :                         break;
-     214           0 :                 case TYPE_UINT64:
-     215           0 :                         return data._t_uint64 != 0;
-     216             :                         break;
-     217           0 :                 case TYPE_STRING: {
-     218           0 :                                 std::string upperstr(*data._t_string);
-     219             :                                 std::transform(upperstr.begin(), upperstr.end(), upperstr.begin(), (int(*) (int)) toupper);
-     220           0 :                                 if (upperstr == "YES" || upperstr == "TRUE" || upperstr == "1")
-     221           0 :                                         return true;
-     222           0 :                                 else if (upperstr == "NO" || upperstr == "FALSE" || upperstr == "0")
-     223           0 :                                         return false;
-     224             :                                 else
-     225           0 :                                         throw bad_conversion(type, TYPE_BOOL);
-     226             :                         }
-     227             :                         break;
-     228           0 :                 case TYPE_COMPLEXF: {
-     229           0 :                                 if (data._t_complex_f->real() == 0 && data._t_complex_f->imag() == 0)
-     230           0 :                                         return true;
-     231             :                                 else
-     232             :                                         return false;
-     233             :                         }
-     234             :                         break;
-     235           0 :                 case TYPE_COMPLEXD: {
-     236           0 :                                 if (data._t_complex_d->real() == 0 && data._t_complex_d->imag() == 0)
-     237           0 :                                         return true;
-     238             :                                 else
-     239             :                                         return false;
-     240             :                         }
-     241             :                         break;
-     242           0 :                 case TYPE_VECTOR:
-     243           0 :                         return data._t_vector->size() != 0;
-     244             :                         break;
-     245           0 :                 case TYPE_FLOAT:
-     246             :                 case TYPE_DOUBLE:
-     247             :                 case TYPE_LONGDOUBLE:
-     248             :                 default:
-     249           0 :                         throw bad_conversion(type, TYPE_BOOL);
-     250             :                         break;
-     251             :         }
-     252             : 
-     253             :         return false;
-     254             : }
-     255             : 
-     256           0 : float Variant::toFloat() const {
-     257           0 :         switch (type) {
-     258           0 :                 case TYPE_BOOL:
-     259           0 :                         return data._t_bool ? (float) 1.0 : (float) 0.0; 
-     260             :                         break;
-     261           0 :                 case TYPE_CHAR:
-     262           0 :                         return static_cast<float>(data._t_char);
-     263             :                         break;
-     264           0 :                 case TYPE_UCHAR:
-     265           0 :                         return static_cast<float>(data._t_uchar);
-     266             :                         break;
-     267           0 :                 case TYPE_INT16:
-     268           0 :                         return static_cast<float>(data._t_int16);
-     269             :                         break;
-     270           0 :                 case TYPE_INT32:
-     271           0 :                         return static_cast<float>(data._t_int32);
-     272             :                         break;
-     273           0 :                 case TYPE_INT64:
-     274           0 :                         return static_cast<float>(data._t_int64);
-     275             :                         break;
-     276           0 :                 case TYPE_UINT16:
-     277           0 :                         return static_cast<float>(data._t_uint16);
-     278             :                         break;
-     279           0 :                 case TYPE_UINT32:
-     280           0 :                         return static_cast<float>(data._t_uint32);
-     281             :                         break;
-     282           0 :                 case TYPE_UINT64:
-     283           0 :                         return static_cast<float>(data._t_uint64);
-     284             :                         break;
-     285           0 :                 case TYPE_FLOAT:
-     286           0 :                         return static_cast<float>(data._t_float);
-     287             :                         break;
-     288           0 :                 case TYPE_DOUBLE:
-     289           0 :                         return static_cast<float>(data._t_double);
-     290             :                         break;
-     291           0 :                 case TYPE_LONGDOUBLE:
-     292           0 :                         return static_cast<float>(data._t_ldouble);
-     293             :                         break;
-     294           0 :                 case TYPE_STRING:
-     295           0 :                         return static_cast<float>(std::atof(data._t_string->c_str()));
-     296             :                         break;
-     297           0 :                 case TYPE_COMPLEXF: {
-     298           0 :                                 if (data._t_complex_f->imag() == 0)
-     299           0 :                                         return static_cast<float>(data._t_complex_f->real());
-     300             :                                 else
-     301           0 :                                         throw bad_conversion(type, TYPE_COMPLEXF);
-     302             :                         }
-     303             :                         break;
-     304           0 :                 case TYPE_COMPLEXD: {
-     305           0 :                                 if (data._t_complex_d->imag() == 0)
-     306           0 :                                         return static_cast<float>(data._t_complex_d->real());
-     307             :                                 else
-     308           0 :                                         throw bad_conversion(type, TYPE_COMPLEXD);
-     309             :                         }
-     310             :                         break;
-     311           0 :                 default:
-     312           0 :                         throw bad_conversion(type, TYPE_FLOAT);
-     313             :                         break;
-     314             :         }
-     315             : 
-     316             :         return 0.;
-     317             : }
-     318             : 
-     319           6 : double Variant::toDouble() const {
-     320           6 :         switch (type) {
-     321           0 :                 case TYPE_BOOL:
-     322           0 :                         return data._t_bool ? (double) 1.0 : (double) 0.0; 
-     323             :                         break;
-     324           0 :                 case TYPE_CHAR:
-     325           0 :                         return static_cast<double>(data._t_char);
-     326             :                         break;
-     327           0 :                 case TYPE_UCHAR:
-     328           0 :                         return static_cast<double>(data._t_uchar);
-     329             :                         break;
-     330           0 :                 case TYPE_INT16:
-     331           0 :                         return static_cast<double>(data._t_int16);
-     332             :                         break;
-     333           0 :                 case TYPE_INT32:
-     334           0 :                         return static_cast<double>(data._t_int32);
-     335             :                         break;
-     336           0 :                 case TYPE_INT64:
-     337           0 :                         return static_cast<double>(data._t_int64);
-     338             :                         break;
-     339           0 :                 case TYPE_UINT16:
-     340           0 :                         return static_cast<double>(data._t_uint16);
-     341             :                         break;
-     342           0 :                 case TYPE_UINT32:
-     343           0 :                         return static_cast<double>(data._t_uint32);
-     344             :                         break;
-     345           0 :                 case TYPE_UINT64:
-     346           0 :                         return static_cast<double>(data._t_uint64);
-     347             :                         break;
-     348           0 :                 case TYPE_FLOAT:
-     349           0 :                         return static_cast<double>(data._t_float);
-     350             :                         break;
-     351           6 :                 case TYPE_DOUBLE:
-     352           6 :                         return static_cast<double>(data._t_double);
-     353             :                         break;
-     354           0 :                 case TYPE_LONGDOUBLE:
-     355           0 :                         return static_cast<double>(data._t_ldouble);
-     356             :                         break;
-     357           0 :                 case TYPE_COMPLEXF: {
-     358           0 :                                 if (data._t_complex_f->imag() == 0)
-     359           0 :                                         return static_cast<double>(data._t_complex_f->real());
-     360             :                                 else
-     361           0 :                                         throw bad_conversion(type, TYPE_COMPLEXF);
-     362             :                         }
-     363             :                         break;
-     364           0 :                 case TYPE_COMPLEXD: {
-     365           0 :                                 if (data._t_complex_d->imag() == 0)
-     366           0 :                                         return static_cast<double>(data._t_complex_d->real());
-     367             :                                 else
-     368           0 :                                         throw bad_conversion(type, TYPE_COMPLEXD);
-     369             :                         }
-     370             :                         break;
-     371           0 :                 case TYPE_STRING:
-     372           0 :                         return static_cast<double>(std::atof(data._t_string->c_str()));
-     373             :                         break;
-     374           0 :                 default:
-     375           0 :                         throw bad_conversion(type, TYPE_DOUBLE);
-     376             :                         break;
-     377             :         }
-     378             : 
-     379             :         return 0.;
-     380             : }
-     381             : 
-     382           0 : long double Variant::toLongDouble() const {
-     383           0 :         switch (type) {
-     384           0 :                 case TYPE_BOOL:
-     385           0 :                         return data._t_bool ? (long double) 1.0 : (long double) 0.0; 
-     386             :                         break;
-     387           0 :                 case TYPE_CHAR:
-     388           0 :                         return static_cast<long double>(data._t_char);
-     389             :                         break;
-     390           0 :                 case TYPE_UCHAR:
-     391           0 :                         return static_cast<long double>(data._t_uchar);
-     392             :                         break;
-     393           0 :                 case TYPE_INT16:
-     394           0 :                         return static_cast<long double>(data._t_int16);
-     395             :                         break;
-     396           0 :                 case TYPE_INT32:
-     397           0 :                         return static_cast<long double>(data._t_int32);
-     398             :                         break;
-     399           0 :                 case TYPE_INT64:
-     400           0 :                         return static_cast<long double>(data._t_int64);
-     401             :                         break;
-     402           0 :                 case TYPE_UINT16:
-     403           0 :                         return static_cast<long double>(data._t_uint16);
-     404             :                         break;
-     405           0 :                 case TYPE_UINT32:
-     406           0 :                         return static_cast<long double>(data._t_uint32);
-     407             :                         break;
-     408           0 :                 case TYPE_UINT64:
-     409           0 :                         return static_cast<long double>(data._t_uint64);
-     410             :                         break;
-     411           0 :                 case TYPE_FLOAT:
-     412           0 :                         return static_cast<long double>(data._t_float);
-     413             :                         break;
-     414           0 :                 case TYPE_DOUBLE:
-     415           0 :                         return static_cast<long double>(data._t_double);
-     416             :                         break;
-     417           0 :                 case TYPE_LONGDOUBLE:
-     418           0 :                         return static_cast<long double>(data._t_ldouble);
-     419             :                         break;
-     420           0 :                 case TYPE_COMPLEXF: {
-     421           0 :                                 if (data._t_complex_f->imag() == 0)
-     422           0 :                                         return static_cast<long double>(data._t_complex_f->real());
-     423             :                                 else
-     424           0 :                                         throw bad_conversion(type, TYPE_COMPLEXF);
-     425             :                         }
-     426             :                         break;
-     427           0 :                 case TYPE_COMPLEXD: {
-     428           0 :                                 if (data._t_complex_d->imag() == 0)
-     429           0 :                                         return static_cast<long double>(data._t_complex_d->real());
-     430             :                                 else
-     431           0 :                                         throw bad_conversion(type, TYPE_COMPLEXD);
-     432             :                         }
-     433             :                         break;
-     434           0 :                 case TYPE_STRING:
-     435           0 :                         return static_cast<double>(std::atof(data._t_string->c_str()));
-     436             :                         break;
-     437           0 :                 default:
-     438           0 :                         throw bad_conversion(type, TYPE_LONGDOUBLE);
-     439             :                         break;
-     440             :         }
-     441             : 
-     442             :         return 0.;
-     443             : }
-     444             : 
-     445           0 : std::complex<float> Variant::toComplexFloat() const {
-     446           0 :         switch (type) {
-     447           0 :                 case TYPE_COMPLEXF:
-     448           0 :                         return static_cast<std::complex<float>>(*data._t_complex_f);
-     449             :                         break;
-     450           0 :                 case TYPE_COMPLEXD:
-     451           0 :                         return static_cast<std::complex<float>>(*data._t_complex_d);
-     452             :                         break;
-     453           0 :                 default:
-     454           0 :                         throw bad_conversion(type, TYPE_COMPLEXF);
-     455             :                         break;
-     456             :         }
-     457             : }  
-     458             : 
-     459           0 : std::complex<double> Variant::toComplexDouble() const {
-     460           0 :         switch (type) {
-     461           0 :                 case TYPE_COMPLEXF:
-     462           0 :                         return static_cast<std::complex<double>>(*data._t_complex_f);
-     463             :                         break;
-     464           0 :                 case TYPE_COMPLEXD:
-     465           0 :                         return static_cast<std::complex<double>>(*data._t_complex_d);
-     466             :                         break;
-     467           0 :                 default:
-     468           0 :                         throw bad_conversion(type, TYPE_COMPLEXD);
-     469             :                         break;
-     470             :         }
-     471             : }  
-     472             : 
-     473           0 : Vector3f Variant::toVector3f() const {
-     474           0 :         switch (type) {
-     475           0 :                 case TYPE_VECTOR3F:
-     476           0 :                         return static_cast<Vector3f>(*data._t_vector3f);
-     477             :                         break;
-     478           0 :                 case TYPE_VECTOR3D:
-     479           0 :                         return static_cast<Vector3f>(*data._t_vector3d);
-     480             :                         break;
-     481           0 :                 default:
-     482           0 :                         throw bad_conversion(type, TYPE_VECTOR3F);
-     483             :                         break;
-     484             :         }
-     485             : }
-     486             : 
-     487           0 : Vector3d Variant::toVector3d() const {
-     488           0 :         switch (type) {
-     489           0 :                 case TYPE_VECTOR3F:
-     490           0 :                         return static_cast<Vector3d>(*data._t_vector3f);
-     491             :                         break;
-     492           0 :                 case TYPE_VECTOR3D:
-     493           0 :                         return static_cast<Vector3d>(*data._t_vector3d);
-     494             :                         break;
-     495           0 :                 default:
-     496           0 :                         throw bad_conversion(type, TYPE_VECTOR3D);
-     497             :                         break;
-     498             :         }
-     499             : }
-     500             : 
-     501           0 : Vector3<std::complex<double>> Variant::toVector3c() const {
-     502           0 :         switch (type) {
-     503           0 :                 case TYPE_VECTOR3C:
-     504           0 :                         return static_cast<Vector3c>(*data._t_vector3c);
-     505             :                         break;
-     506           0 :                 default:
-     507           0 :                         throw bad_conversion(type, TYPE_VECTOR3C);
-     508             :                         break;
-     509             :         }
-     510             : }
-     511             : 
-     512           6 : std::string Variant::toString(const std::string& delimiter) const {
-     513           6 :         if (type == TYPE_STRING)
-     514           3 :                 return *data._t_string;
-     515             : 
-     516           3 :         std::stringstream ss;
-     517             : 
-     518           3 :         if (type == TYPE_BOOL) {
-     519           0 :                 ss << data._t_bool;
-     520             :         } else if (type == TYPE_CHAR) {
-     521           0 :                 ss << data._t_char;
-     522             :         } else if (type == TYPE_UCHAR) {
-     523           0 :                 ss << data._t_uchar;
-     524             :         } else if (type == TYPE_INT16) {
-     525           0 :                 ss << data._t_int16;
-     526             :         } else if (type == TYPE_UINT16) {
-     527           0 :                 ss << data._t_uint16;
-     528             :         } else if (type == TYPE_INT32) {
-     529           1 :                 ss << data._t_int32;
-     530             :         } else if (type == TYPE_UINT32) {
-     531           0 :                 ss << data._t_uint32;
-     532             :         } else if (type == TYPE_INT64) {
-     533           1 :                 ss << data._t_int64;
-     534             :         } else if (type == TYPE_UINT64) {
-     535           0 :                 ss << data._t_uint64;
-     536             :         } else if (type == TYPE_FLOAT) {
-     537           0 :                 ss << std::scientific << data._t_float;
-     538             :         } else if (type == TYPE_DOUBLE) {
-     539           1 :                 ss << std::scientific << data._t_double;
-     540             :         } else if (type == TYPE_LONGDOUBLE) {
-     541           0 :                 ss << std::scientific << data._t_ldouble;
-     542             :         } else if (type == TYPE_COMPLEXF) {
-     543           0 :                 ss << std::scientific << data._t_complex_f->real() << delimiter; 
-     544           0 :                 ss << std::scientific << data._t_complex_f->imag();
-     545             :         } else if (type == TYPE_COMPLEXD) {
-     546           0 :                 ss << std::scientific << data._t_complex_d->real() << delimiter; 
-     547           0 :                 ss << std::scientific << data._t_complex_d->imag();
-     548             :         } else if (type == TYPE_VECTOR3F) {
-     549           0 :                 ss << *data._t_vector3f;
-     550             :         } else if (type == TYPE_VECTOR3D) {
-     551           0 :                 ss << *data._t_vector3d;
-     552             :         } else if (type == TYPE_VECTOR) {
-     553           0 :                 ss << *data._t_vector;
-     554             :         }
-     555             : 
-     556             :         return ss.str();
-     557           3 : }
-     558             : 
-     559           0 : Variant::vector_t Variant::toVector() const {
-     560           0 :         if (type == TYPE_VECTOR)
-     561           0 :                 return *data._t_vector;
-     562             :         else
-     563           0 :                 throw bad_conversion(type, TYPE_VECTOR);
-     564             : }
-     565             : 
-     566           2 : Variant Variant::fromString(const std::string& s, Type t) {
-     567           2 :         std::stringstream ss(s);
-     568             : 
-     569             :         if (t == TYPE_BOOL) {
-     570             :                 std::string upperstr(s);
-     571             :                 std::transform(upperstr.begin(), upperstr.end(), upperstr.begin(), (int (*)(int)) toupper);
-     572           0 :                 if (upperstr == "YES" || upperstr == "TRUE" || upperstr == "1") 
-     573             :                         return Variant(true);
-     574           0 :                 else if (upperstr == "NO" || upperstr == "FALSE" || upperstr == "0")
-     575             :                         return Variant(false);
-     576           0 :                 throw bad_conversion(t, TYPE_BOOL);
-     577             :         } else if (t == TYPE_CHAR) {
-     578             :                 char c;
-     579           0 :                 ss >> c;
-     580             :                 return Variant(c);
-     581             :         } else if (t == TYPE_UCHAR) {
-     582             :                 unsigned char c;
-     583             :                 ss >> c;
-     584             :                 return Variant(c);
-     585             :         } else if (t == TYPE_INT16) {
-     586             :                 int16_t c;
-     587           0 :                 ss >> c;
-     588             :                 return Variant(c);
-     589             :         } else if (t == TYPE_INT32) {
-     590             :                 int32_t c;
-     591           1 :                 ss >> c;
-     592             :                 return Variant(c);
-     593             :         } else if (t == TYPE_INT64) {
-     594             :                 int64_t c;
-     595             :                 ss >> c;
-     596             :                 return Variant(c);
-     597             :         } else if (t == TYPE_UINT16) {
-     598             :                 uint16_t c;
-     599             :                 ss >> c;
-     600             :                 return Variant(c);
-     601             :         } else if (t == TYPE_UINT32) {
-     602             :                 uint32_t c;
-     603             :                 ss >> c;
-     604             :                 return Variant(c);
-     605             :         } else if (t == TYPE_UINT64) {
-     606             :                 uint64_t c;
-     607             :                 ss >> c;
-     608             :                 return Variant(c);
-     609             :         } else if (t == TYPE_FLOAT) {
-     610             :                 float c;
-     611             :                 ss >> c;
-     612             :                 return Variant(c);
-     613             :         } else if (t == TYPE_DOUBLE) {
-     614             :                 double c;
-     615             :                 ss >> c;
-     616             :                 return Variant(c);
-     617             :         } else if (t == TYPE_LONGDOUBLE) {
-     618             :                 long double c;
-     619             :                 ss >> c;
-     620             :                 return Variant(c);
-     621             :         } else if (t == TYPE_STRING) {
-     622           0 :                 return Variant(s);
-     623             :         } else if (t == TYPE_COMPLEXF) {
-     624             :                 float _vr, _vi;
-     625             :                 ss >> _vr >> _vi;
-     626           0 :                 complex_f v(_vr, _vi);
-     627             :                 return Variant(v);
-     628             :         } else if (t == TYPE_COMPLEXD) {
-     629             :                 double _vr, _vi;
-     630             :                 ss >> _vr >> _vi;
-     631           0 :                 complex_d v(_vr, _vi);
-     632             :                 return Variant(v);
-     633             :         } else if (t == TYPE_VECTOR3F) {
-     634             :                 Vector3f v;
-     635             :                 float _val;
-     636             :                 ss >> _val;
-     637           0 :                 v.setX(_val);
-     638             :                 ss >> _val;
-     639           0 :                 v.setY(_val);
-     640             :                 ss >> _val;
-     641           0 :                 v.setZ(_val);
-     642             :                 return Variant(v);
-     643             :         } else if (t == TYPE_VECTOR3D) {
-     644             :                 Vector3d v;
-     645             :                 double _val;
-     646             :                 ss >> _val;
-     647           0 :                 v.setX(_val);
-     648             :                 ss >> _val;
-     649           0 :                 v.setY(_val);
-     650             :                 ss >> _val;
-     651           0 :                 v.setZ(_val);
-     652             :                 return Variant(v);
-     653             :         } else if (t == TYPE_VECTOR3C) {
-     654             :                 Vector3c v;
-     655           0 :                 std::complex<double> _val;
-     656           0 :                 ss >> _val;
-     657             :                 v.setX(_val);
-     658           0 :                 ss >> _val;
-     659             :                 v.setY(_val);
-     660           0 :                 ss >> _val;
-     661             :                 v.setZ(_val);
-     662             :                 return Variant(v);
-     663             :         } else if (t == TYPE_VECTOR) {
-     664             :                 // std::regex useless("(|)|[|]| ");
-     665             :                 vector_t v;
-     666           0 :                 while (ss.good()) {
-     667             :                         std::string s;
-     668           0 :                         v.push_back(s);
-     669             :                 }
-     670           0 :         } else {
-     671             :                 std::string msg; 
-     672             :                 msg += "fromString not implemented for type ";
-     673           0 :         msg += getTypeName(t);
-     674           0 :         throw std::runtime_error("Variant: " + msg);
-     675             :         }
-     676           2 : }
-     677             : 
-     678        5785 : void Variant::clear(Type t) {
-     679             :         if (t == TYPE_STRING)
-     680           0 :                 safeDelete(data._t_string);
-     681             :         else if (t == TYPE_VECTOR3F)
-     682             :                 safeDelete(data._t_vector3f);
-     683             :         else if (t == TYPE_VECTOR3D)
-     684             :                 safeDelete(data._t_vector3d);
-     685             :         else if (t == TYPE_VECTOR3C)
-     686             :                 safeDelete(data._t_vector3c);
-     687             :         else if (t == TYPE_COMPLEXF)
-     688             :                 safeDelete(data._t_complex_f);
-     689             :         else if (t == TYPE_COMPLEXD)
-     690             :                 safeDelete(data._t_complex_d);
-     691             :         else if (t == TYPE_VECTOR)
-     692           0 :                 safeDelete(data._t_vector);
-     693             : 
-     694             :         // set the type to TYPE_NONE which will be used for checks
-     695        5785 :     type = TYPE_NONE;
-     696        5785 :     check(t);
-     697        5785 : }
-     698             : 
-     699        3459 : void Variant::copy(const Variant& v) {
-     700        3459 :         Type t = v.type;
-     701             : 
-     702        3459 :         if (t == TYPE_BOOL) 
-     703             :                 operator = (v.data._t_bool);
-     704             :         else if (t == TYPE_CHAR)
-     705             :                 operator = (v.data._t_char);
-     706             :         else if (t == TYPE_UCHAR)
-     707             :                 operator = (v.data._t_uchar);
-     708             :         else if (t == TYPE_INT16)
-     709             :                 operator = (v.data._t_int16);
-     710             :         else if (t == TYPE_UINT16)
-     711             :                 operator = (v.data._t_uint16);
-     712             :         else if (t == TYPE_INT32)
-     713             :                 operator = (v.data._t_int32);
-     714             :         else if (t == TYPE_UINT32)
-     715             :                 operator = (v.data._t_uint32);
-     716             :         else if (t == TYPE_INT64)
-     717             :                 operator = (v.data._t_int64);
-     718             :         else if (t == TYPE_UINT64)
-     719             :                 operator = (v.data._t_uint64);
-     720             :         else if (t == TYPE_FLOAT)
-     721             :                 operator = (v.data._t_float);
-     722             :         else if (t == TYPE_DOUBLE)
-     723             :                 operator = (v.data._t_double);
-     724             :         else if (t == TYPE_LONGDOUBLE)
-     725             :                 operator = (v.data._t_ldouble);
-     726             :         else if (t == TYPE_STRING)
-     727        1136 :                 operator = (*v.data._t_string);
-     728             :         else if (t == TYPE_COMPLEXF)
-     729           0 :                 operator = (*v.data._t_complex_f);
-     730             :         else if (t == TYPE_COMPLEXD)
-     731           0 :                 operator = (*v.data._t_complex_d);
-     732             :         else if (t == TYPE_VECTOR3F)
-     733           0 :                 operator = (*v.data._t_vector3f);
-     734             :         else if (t == TYPE_VECTOR3D)
-     735           0 :                 operator = (*v.data._t_vector3d);
-     736             :         else if (t == TYPE_VECTOR3C)
-     737           0 :                 operator = (*v.data._t_vector3c);
-     738             :         else if (t == TYPE_VECTOR)
-     739           0 :                 operator = (*v.data._t_vector);
-     740             :         else
-     741        2279 :                 type = TYPE_NONE;
-     742        3459 : }
-     743             : 
-     744           2 : void Variant::check(const Type t) const {
-     745           2 :         if (type != t) {
-     746           0 :                 throw bad_conversion(type, t);
-     747             :         }
-     748           2 : }
-     749             : 
-     750        5793 : void Variant::check(const Type t) {
-     751        5793 :         if (type == TYPE_NONE) {
-     752        5785 :                 memset(&data, 0, sizeof(data));
-     753        5785 :                 if (t == TYPE_VECTOR3F)
-     754           0 :                         data._t_vector3f = new Vector3f(); 
-     755             :                 else if (t == TYPE_VECTOR3D)
-     756           0 :                         data._t_vector3d = new Vector3d(); 
-     757             :                 else if (t == TYPE_VECTOR3C)
-     758           0 :                         data._t_vector3c = new Vector3c(); 
-     759             :                 else if (t == TYPE_COMPLEXF)
-     760           0 :                         data._t_complex_f = new complex_f(); 
-     761             :                 else if (t == TYPE_COMPLEXD)
-     762           0 :                         data._t_complex_d = new complex_d(); 
-     763             :                 else if (t == TYPE_STRING)
-     764           0 :                         data._t_string = new std::string();
-     765             :                 else if (t == TYPE_VECTOR)
-     766           0 :                         data._t_vector = new vector_t();
-     767             :                 else
-     768        5785 :                         type = t;
-     769           8 :         } else if (type != t)  {
-     770           0 :         throw bad_conversion(type, t);
-     771             :         }
-     772        5793 : }
-     773             : 
-     774           8 : bool Variant::isValid() const {
-     775           8 :         return (type != TYPE_NONE);
-     776             : }
-     777             : 
-     778           0 : size_t Variant::size() const {
-     779           0 :         if (type == TYPE_VECTOR) {
-     780           0 :                 return data._t_vector->size();
-     781             :         } else {
-     782             :                 std::string msg; 
-     783             :                 msg += "size() not implemented for type ";
-     784           0 :                 msg += getTypeName(type);
-     785           0 :                 throw std::runtime_error("Variant: " + msg);
-     786             :         }
-     787             : }
-     788             : 
-     789           0 : size_t Variant::getSizeOf() const {
-     790           0 :         switch (type) {
-     791             :                 case TYPE_BOOL:
-     792             :                         return sizeof(data._t_bool);
-     793             :                         break;
-     794             :                 case TYPE_CHAR:
-     795             :                         return sizeof(data._t_char);
-     796             :                         break;
-     797             :                 case TYPE_UCHAR:
-     798             :                         return sizeof(data._t_uchar);
-     799             :                         break;
-     800           0 :                 case TYPE_INT16:
-     801           0 :                         return sizeof(data._t_int16);
-     802             :                         break;
-     803           0 :                 case TYPE_UINT16:
-     804           0 :                         return sizeof(data._t_uint16);
-     805             :                         break;
-     806           0 :                 case TYPE_INT32:
-     807           0 :                         return sizeof(data._t_int32);
-     808             :                         break;
-     809           0 :                 case TYPE_UINT32:
-     810           0 :                         return sizeof(data._t_uint32);
-     811             :                         break;
-     812           0 :                 case TYPE_INT64:
-     813           0 :                         return sizeof(data._t_int64);
-     814             :                         break;
-     815           0 :                 case TYPE_UINT64:
-     816           0 :                         return sizeof(data._t_uint64);
-     817             :                         break;
-     818           0 :                 case TYPE_FLOAT:
-     819           0 :                         return sizeof(data._t_float);
-     820             :                         break;
-     821           0 :                 case TYPE_DOUBLE:
-     822           0 :                         return sizeof(data._t_double);
-     823             :                         break;
-     824           0 :                 case TYPE_LONGDOUBLE:
-     825           0 :                         return sizeof(data._t_ldouble);
-     826             :                         break;
-     827           0 :                 case TYPE_COMPLEXF:
-     828           0 :                         return sizeof(data._t_complex_f);
-     829             :                         break;
-     830           0 :                 case TYPE_COMPLEXD:
-     831           0 :                         return sizeof(data._t_complex_d);
-     832             :                         break;
-     833           0 :                 case TYPE_VECTOR3F:
-     834           0 :                         return sizeof(data._t_vector3f);
-     835             :                         break;
-     836           0 :                 case TYPE_VECTOR3D:
-     837           0 :                         return sizeof(data._t_vector3d);
-     838             :                         break;
-     839           0 :                 case TYPE_VECTOR3C:
-     840           0 :                         return sizeof(data._t_vector3c);
-     841             :                         break;
-     842           0 :                 case TYPE_STRING: {
-     843           0 :                                 size_t len = strlen(data._t_string->c_str() + 1);
-     844           0 :                                 return len;
-     845             :                         }
-     846             :                         break;
-     847           0 :                 case TYPE_NONE:
-     848           0 :                         return 0;
-     849             :                         break;
-     850           0 :                 default:
-     851           0 :                         throw std::runtime_error("Function getSize() cannot handle this type.");
-     852             :         }
-     853             : }
-     854             : 
-     855           0 : size_t Variant::getSize() const {
-     856           0 :         return getSizeOf();
-     857             : }
-     858             : 
-     859           0 : void Variant::resize(size_t i) {
-     860           0 :         check(TYPE_VECTOR);
-     861           0 :         return data._t_vector->resize(i);
-     862             : }
-     863             : 
-     864           1 : size_t Variant::copyToBuffer(void* buffer) {
-     865           1 :         if (type == TYPE_BOOL) {
-     866           0 :                 memcpy(buffer, &data._t_bool, sizeof(bool));
-     867           0 :                 return sizeof(data._t_bool);
-     868             :         } else if (type == TYPE_CHAR) {
-     869           0 :                 memcpy(buffer, &data._t_char, sizeof(char));
-     870           0 :                 return sizeof(data._t_char);
-     871             :         }  else if (type == TYPE_UCHAR) {
-     872           0 :                 memcpy(buffer, &data._t_uchar, sizeof(unsigned char));
-     873           0 :                 return sizeof(data._t_uchar);
-     874             :         } else if (type == TYPE_INT16) {
-     875           0 :                 memcpy(buffer, &data._t_int16, sizeof(int16_t));
-     876           0 :                 return sizeof(data._t_int16);
-     877             :         } else if (type == TYPE_UINT16) {
-     878           0 :                 memcpy(buffer, &data._t_uint16, sizeof(uint16_t));
-     879           0 :                 return sizeof(data._t_uint16);
-     880             :         } else if (type == TYPE_INT32) {
-     881           0 :                 memcpy(buffer, &data._t_int32, sizeof(int32_t));
-     882           0 :                 return sizeof(data._t_int32);
-     883             :         } else if (type == TYPE_UINT32) {
-     884           0 :                 memcpy(buffer, &data._t_uint32, sizeof(uint32_t));
-     885           0 :                 return sizeof(data._t_uint32);
-     886             :         } else if (type == TYPE_INT64) {
-     887           0 :                 memcpy(buffer, &data._t_int64, sizeof(int64_t));
-     888           0 :                 return sizeof(data._t_int64);
-     889             :         } else if (type == TYPE_UINT64) {
-     890           0 :                 memcpy(buffer, &data._t_uint64, sizeof(uint64_t));
-     891           0 :                 return sizeof(data._t_uint64);
-     892             :         } else if (type == TYPE_FLOAT) {
-     893           0 :                 memcpy(buffer, &data._t_float, sizeof(float));
-     894           0 :                 return sizeof(data._t_float);
-     895             :         } else if (type == TYPE_DOUBLE) {
-     896           1 :                 memcpy(buffer, &data._t_double, sizeof(double));
-     897           1 :                 return sizeof(data._t_double);
-     898             :         } else if (type == TYPE_LONGDOUBLE) {
-     899           0 :                 memcpy(buffer, &data._t_ldouble, sizeof(long double));
-     900           0 :                 return sizeof(data._t_ldouble);
-     901             :         }  else if (type == TYPE_STRING) {
-     902           0 :                 size_t len = data._t_string->size();
-     903             :                 memcpy(buffer, data._t_string->c_str(), len);
-     904           0 :                 return len;
-     905             :         } else if (type == TYPE_NONE) {
-     906             :                 return 0;
-     907             :         } else {
-     908           0 :                 throw std::runtime_error("This type cannot be handled by copyToBuffer().");
-     909             :         }
-     910             : }
-     911             : 
-     912        1153 : Variant& Variant::operator=(const Variant &v) {
-     913        1153 :         copy(v);
-     914        1153 :         return *this;
-     915             : }
-     916             : 
-     917           4 : bool Variant::operator==(const Variant& v) const {
-     918           4 :         if (type != v.type)
-     919             :                 return false;
-     920             : 
-     921             :         if (type == TYPE_BOOL) {
-     922           0 :                 return (data._t_bool == v.data._t_bool);
-     923             :         } else if (type == TYPE_CHAR) {
-     924           0 :                 return (data._t_char == v.data._t_char);
-     925             :         } else if (type == TYPE_UCHAR) {
-     926           0 :                 return (data._t_uchar == v.data._t_uchar);
-     927             :         } else if (type == TYPE_INT16) {
-     928           0 :                 return (data._t_int16 == v.data._t_int16);
-     929             :         } else if (type == TYPE_UINT16) {
-     930           0 :                 return (data._t_uint16 == v.data._t_uint16);
-     931             :         } else if (type == TYPE_INT32) {
-     932           0 :                 return (data._t_int32 == v.data._t_int32);
-     933             :         } else if (type == TYPE_UINT32) {
-     934           0 :                 return (data._t_uint32 == v.data._t_uint32);
-     935             :         } else if (type == TYPE_INT64) {
-     936           0 :                 return (data._t_int64 == v.data._t_int64);
-     937             :         } else if (type == TYPE_UINT64) {
-     938           0 :                 return (data._t_uint64 == v.data._t_uint64);
-     939             :         } else if (type == TYPE_FLOAT) {
-     940           0 :                 return (data._t_float == v.data._t_float);
-     941             :         } else if (type == TYPE_DOUBLE) {
-     942           4 :                 return (data._t_double == v.data._t_double);
-     943             :         } else if (type == TYPE_LONGDOUBLE) {
-     944           0 :                 return (data._t_ldouble == v.data._t_ldouble);
-     945             :         } else if (type == TYPE_STRING) {
-     946           0 :                 return (*data._t_string == *v.data._t_string);
-     947             :         } else if (type == TYPE_COMPLEXF) {
-     948           0 :                 return (*data._t_complex_f == *v.data._t_complex_f);
-     949             :         } else if (type == TYPE_COMPLEXD) {
-     950           0 :                 return (*data._t_complex_d == *v.data._t_complex_d);
-     951             :         } else if (type == TYPE_VECTOR3F) {
-     952           0 :                 return (*data._t_vector3f == *v.data._t_vector3f);
-     953             :         } else if (type == TYPE_VECTOR3D) {
-     954           0 :                 return (*data._t_vector3d == *v.data._t_vector3d);
-     955             :         } else if (type == TYPE_VECTOR3C) {
-     956           0 :                 return (*data._t_vector3c == *v.data._t_vector3c);
-     957             :         } else if (type == TYPE_VECTOR) {
-     958           0 :                 return (*data._t_vector == *v.data._t_vector);
-     959             :         } else {
-     960           0 :                 throw std::runtime_error("compare operator not implemented");
-     961             :         }
-     962             : }
-     963             : 
-     964           0 : bool Variant::operator!=(const Variant& v) const {
-     965           0 :         if (type != v.type)
-     966             :                 return true;
-     967             :         
-     968           0 :         if (*this == v)
-     969             :                 return false;
-     970             :         else
-     971           0 :                 return true;
-     972             : }
-     973             : 
-     974           0 : bool Variant::operator!=(const char* v) const {
-     975           0 :         check(TYPE_STRING);
-     976           0 :         return data._t_string->compare(v) != 0;
-     977             : }
-     978             : 
-     979           0 : Variant& Variant::operator[](size_t i) {
-     980           0 :         check(TYPE_VECTOR);
-     981           0 :         return (*data._t_vector)[i];
-     982             : }
-     983             : 
-     984           0 : const Variant& Variant::operator[](size_t i) const {
-     985           0 :         check(TYPE_VECTOR);
-     986           0 :         return (*data._t_vector)[i];
-     987             : }
-     988             : 
-     989           0 : Variant::operator std::vector<Variant>&() {
-     990           0 :         check(TYPE_VECTOR);
-     991           0 :         return *data._t_vector;
-     992             : }
-     993             : 
-     994           0 : Variant::operator const std::vector<Variant>&() const {
-     995           0 :         check(TYPE_VECTOR);
-     996           0 :         return *data._t_vector;
-     997             : }
-     998             : 
-     999             : 
-    1000             : 
-    1001             : #define INT_CASE(from_var, from_type, to_type, to)                                                                                                                         \
-    1002             :     case Variant::from_type: {                                                                                         \
-    1003             :                 if (data._t_##from_var <std::numeric_limits<to>::min() || data._t_##from_var> std::numeric_limits<to>::max())  \
-    1004             :                         throw bad_conversion(type, to_type);                                                                       \
-    1005             :                 else                                                                                                           \
-    1006             :                         return static_cast<to>(data._t_##from_var);                                                                \
-    1007             :                 }                                                                                                              \
-    1008             :         break;                                                                                                         \
-    1009             : 
-    1010             : #define INT_FUNCTION(to_type, fun, to)                                                                                 \
-    1011             :         to Variant::fun() const {                                                                                          \
-    1012             :                 switch (type) {                                                                                                \
-    1013             :                         case Variant::TYPE_BOOL:                                                                                   \
-    1014             :                                 return data._t_bool ? 1 : 0;                                                                           \
-    1015             :                                 break;                                                                                                 \
-    1016             :                                 INT_CASE(char, TYPE_CHAR, to_type, to)                                                                 \
-    1017             :                                 INT_CASE(uchar, TYPE_UCHAR, to_type, to)                                                               \
-    1018             :                                 INT_CASE(int16, TYPE_INT16, to_type, to)                                                               \
-    1019             :                                 INT_CASE(uint16, TYPE_UINT16, to_type, to)                                                             \
-    1020             :                                 INT_CASE(int32, TYPE_INT32, to_type, to)                                                               \
-    1021             :                                 INT_CASE(uint32, TYPE_UINT32, to_type, to)                                                             \
-    1022             :                                 INT_CASE(int64, TYPE_INT64, to_type, to)                                                               \
-    1023             :                                 INT_CASE(uint64, TYPE_UINT64, to_type, to)                                                             \
-    1024             :                                 INT_CASE(float, TYPE_FLOAT, to_type, to)                                                               \
-    1025             :                                 INT_CASE(double, TYPE_DOUBLE, to_type, to)                                                             \
-    1026             :                                 INT_CASE(ldouble, TYPE_LONGDOUBLE, to_type, to)                                                        \
-    1027             :                         case Variant::TYPE_STRING: {                                                                               \
-    1028             :                                 long l = atol(data._t_string->c_str());                                                                \
-    1029             :                                 if (l <std::numeric_limits<to>::min() || l > std::numeric_limits<to>::max())                           \
-    1030             :                                         throw bad_conversion(type, to_type);                                                               \
-    1031             :                                 else                                                                                                   \
-    1032             :                                         return l;                                                                                          \
-    1033             :                                 }                                                                                                      \
-    1034             :                                 break;                                                                                                 \
-    1035             :                         case Variant::TYPE_COMPLEXF:                                                                               \
-    1036             :                         case Variant::TYPE_COMPLEXD:                                                                               \
-    1037             :                         case Variant::TYPE_VECTOR3F:                                                                               \
-    1038             :                         case Variant::TYPE_VECTOR3D:                                                                               \
-    1039             :                         case Variant::TYPE_VECTOR3C:                                                                               \
-    1040             :                         case Variant::TYPE_VECTOR:                                                                                 \
-    1041             :                         case Variant::TYPE_NONE:                                                                                   \
-    1042             :                                 throw bad_conversion(type, to_type);                                                                   \
-    1043             :                                 break;                                                                                                 \
-    1044             :                 }                                                                                                              \
-    1045             :                 return 0;                                                                                                      \
-    1046             :         } 
-    1047             : 
-    1048           0 : INT_FUNCTION(TYPE_CHAR, toChar, char)
-    1049           0 : INT_FUNCTION(TYPE_UCHAR, toUChar, unsigned char)
-    1050           0 : INT_FUNCTION(TYPE_INT16, toInt16, int16_t)
-    1051           0 : INT_FUNCTION(TYPE_UINT16, toUInt16, uint16_t)
-    1052           0 : INT_FUNCTION(TYPE_INT32, toInt32, int32_t)
-    1053           0 : INT_FUNCTION(TYPE_UINT32, toUInt32, uint32_t)
-    1054           2 : INT_FUNCTION(TYPE_INT64, toInt64, int64_t)
-    1055           0 : INT_FUNCTION(TYPE_UINT64, toUInt64, uint64_t)
-    1056             : 
-    1057             : 
-    1058             : 
-    1059           0 : std::ostream& operator <<(std::ostream& os, const Variant& v) {
-    1060           0 :         switch (v.getType()) {
-    1061             :                 case Variant::TYPE_BOOL:
-    1062           0 :                         os << v.asBool();
-    1063             :                         break;
-    1064             :                 case Variant::TYPE_CHAR:
-    1065           0 :                         os << v.asChar();
-    1066           0 :                         break;
-    1067             :                 case Variant::TYPE_UCHAR:
-    1068           0 :                         os << v.asUChar();
-    1069             :                         break;
-    1070             :                 case Variant::TYPE_INT16:
-    1071           0 :                         os << v.asInt16();
-    1072           0 :                         break;
-    1073             :                 case Variant::TYPE_UINT16:
-    1074           0 :                         os << v.asUInt16();
-    1075             :                         break;
-    1076             :                 case Variant::TYPE_INT32:
-    1077           0 :                         os << v.asInt32();
-    1078           0 :                         break;
-    1079             :                 case Variant::TYPE_UINT32:
-    1080           0 :                         os << v.asUInt32();
-    1081             :                         break;
-    1082             :                 case Variant::TYPE_INT64:
-    1083           0 :                         os << v.asInt64();
-    1084             :                         break;
-    1085             :                 case Variant::TYPE_UINT64:
-    1086           0 :                         os << v.asUInt64();
-    1087             :                         break;
-    1088             :                 case Variant::TYPE_FLOAT:
-    1089           0 :                         os << v.asFloat();
-    1090             :                         break;
-    1091             :                 case Variant::TYPE_DOUBLE:
-    1092           0 :                         os << v.asDouble();
-    1093             :                         break;
-    1094             :                 case Variant::TYPE_LONGDOUBLE:
-    1095           0 :                         os << v.asLongDouble();
-    1096             :                         break;
-    1097             :                 case Variant::TYPE_COMPLEXF:
-    1098           0 :                         os << v.asComplexFloat();
-    1099           0 :                         break;
-    1100             :                 case Variant::TYPE_COMPLEXD:
-    1101           0 :                         os << v.asComplexDouble();
-    1102           0 :                         break;
-    1103             :                 case Variant::TYPE_STRING:
-    1104             :                         os << v.asString();
-    1105             :                         break;
-    1106             :                 case Variant::TYPE_VECTOR3F:
-    1107           0 :                         os << v.asVector3f();
-    1108           0 :                         break;
-    1109             :                 case Variant::TYPE_VECTOR3D:
-    1110           0 :                         os << v.asVector3d();
-    1111           0 :                         break;
-    1112             :                 case Variant::TYPE_VECTOR3C:
-    1113           0 :                         os << v.asVector3c();
-    1114           0 :                         break;
-    1115             :                 default:
-    1116             :                         break;
-    1117             :         }
-    1118             : 
-    1119           0 :         return os;
-    1120             : }
-    1121             : 
-    1122             : 
-    1123             : 
-    1124             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/advectionField/AdvectionField.cpp.func-sort-c.html b/doc/coverageReport/src/advectionField/AdvectionField.cpp.func-sort-c.html deleted file mode 100644 index 39a908092..000000000 --- a/doc/coverageReport/src/advectionField/AdvectionField.cpp.func-sort-c.html +++ /dev/null @@ -1,408 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/advectionField/AdvectionField.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/advectionField - AdvectionField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13130842.5 %
Date:2024-04-08 14:58:22Functions:448452.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa21ObliqueAdvectionShock13setShockwidthEd0
_ZN7crpropa21ObliqueAdvectionShock5setVyEd0
_ZN7crpropa21ObliqueAdvectionShock6setVupEd0
_ZN7crpropa21ObliqueAdvectionShock7setCompEd0
_ZN7crpropa21ObliqueAdvectionShockC2Edddd0
_ZN7crpropa28OneDimensionalCartesianShock13setShockwidthEd0
_ZN7crpropa28OneDimensionalCartesianShock6setVupEd0
_ZN7crpropa28OneDimensionalCartesianShock7setCompEd0
_ZN7crpropa28OneDimensionalCartesianShockC2Eddd0
_ZN7crpropa28OneDimensionalSphericalShock10setCoolingEb0
_ZN7crpropa28OneDimensionalSphericalShock13setShockwidthEd0
_ZN7crpropa28OneDimensionalSphericalShock14setShockRadiusEd0
_ZN7crpropa28OneDimensionalSphericalShock6setVupEd0
_ZN7crpropa28OneDimensionalSphericalShock7setCompEd0
_ZN7crpropa28OneDimensionalSphericalShockC2Eddddb0
_ZNK7crpropa21ObliqueAdvectionShock13getDivergenceERKNS_7Vector3IdEE0
_ZNK7crpropa21ObliqueAdvectionShock13getShockwidthEv0
_ZNK7crpropa21ObliqueAdvectionShock14getDescriptionB5cxx11Ev0
_ZNK7crpropa21ObliqueAdvectionShock5getVyEv0
_ZNK7crpropa21ObliqueAdvectionShock6getVupEv0
_ZNK7crpropa21ObliqueAdvectionShock7getCompEv0
_ZNK7crpropa21ObliqueAdvectionShock8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa21UniformAdvectionField14getDescriptionB5cxx11Ev0
_ZNK7crpropa23SphericalAdvectionField14getDescriptionB5cxx11Ev0
_ZNK7crpropa23SphericalAdvectionShock14getDescriptionB5cxx11Ev0
_ZNK7crpropa28OneDimensionalCartesianShock13getDivergenceERKNS_7Vector3IdEE0
_ZNK7crpropa28OneDimensionalCartesianShock13getShockwidthEv0
_ZNK7crpropa28OneDimensionalCartesianShock14getDescriptionB5cxx11Ev0
_ZNK7crpropa28OneDimensionalCartesianShock6getVupEv0
_ZNK7crpropa28OneDimensionalCartesianShock7getCompEv0
_ZNK7crpropa28OneDimensionalCartesianShock8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa28OneDimensionalSphericalShock10getCoolingEv0
_ZNK7crpropa28OneDimensionalSphericalShock13getDivergenceERKNS_7Vector3IdEE0
_ZNK7crpropa28OneDimensionalSphericalShock13getShockwidthEv0
_ZNK7crpropa28OneDimensionalSphericalShock14getDescriptionB5cxx11Ev0
_ZNK7crpropa28OneDimensionalSphericalShock14getShockRadiusEv0
_ZNK7crpropa28OneDimensionalSphericalShock6getVupEv0
_ZNK7crpropa28OneDimensionalSphericalShock7getCompEv0
_ZNK7crpropa28OneDimensionalSphericalShock8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa31ConstantSphericalAdvectionField14getDescriptionB5cxx11Ev0
_ZN7crpropa23SphericalAdvectionField6setTauEd1
_ZN7crpropa23SphericalAdvectionField7setVMaxEd1
_ZN7crpropa23SphericalAdvectionField8setAlphaEd1
_ZN7crpropa23SphericalAdvectionField9setOriginENS_7Vector3IdEE1
_ZN7crpropa23SphericalAdvectionField9setRadiusEd1
_ZN7crpropa23SphericalAdvectionFieldC2ENS_7Vector3IdEEdddd1
_ZN7crpropa23SphericalAdvectionShock5setR0Ed1
_ZN7crpropa23SphericalAdvectionShock5setV0Ed1
_ZN7crpropa23SphericalAdvectionShock9setLambdaEd1
_ZN7crpropa23SphericalAdvectionShock9setOriginENS_7Vector3IdEE1
_ZN7crpropa23SphericalAdvectionShockC2ENS_7Vector3IdEEddd1
_ZNK7crpropa18AdvectionFieldList13getDivergenceERKNS_7Vector3IdEE1
_ZNK7crpropa18AdvectionFieldList8getFieldERKNS_7Vector3IdEE1
_ZNK7crpropa23SphericalAdvectionField6getTauEv1
_ZNK7crpropa23SphericalAdvectionField7getVMaxEv1
_ZNK7crpropa23SphericalAdvectionField8getAlphaEv1
_ZNK7crpropa23SphericalAdvectionField9getRadiusEv1
_ZNK7crpropa23SphericalAdvectionShock5getR0Ev1
_ZNK7crpropa23SphericalAdvectionShock5getV0Ev1
_ZNK7crpropa23SphericalAdvectionShock9getLambdaEv1
_ZNK7crpropa31ConstantSphericalAdvectionField8getFieldERKNS_7Vector3IdEE1
_ZNK7crpropa31ConstantSphericalAdvectionField8getVWindEv1
_ZN7crpropa23SphericalAdvectionShock17setAzimuthalSpeedEd2
_ZN7crpropa23SphericalAdvectionShock7setRRotEd2
_ZN7crpropa31ConstantSphericalAdvectionField8setVWindEd2
_ZN7crpropa31ConstantSphericalAdvectionField9setOriginENS_7Vector3IdEE2
_ZN7crpropa31ConstantSphericalAdvectionFieldC2ENS_7Vector3IdEEd2
_ZNK7crpropa23SphericalAdvectionField4getVERKd2
_ZNK7crpropa23SphericalAdvectionShock13getDivergenceERKNS_7Vector3IdEE2
_ZNK7crpropa23SphericalAdvectionShock17getAzimuthalSpeedEv2
_ZNK7crpropa23SphericalAdvectionShock7g_primeEd2
_ZNK7crpropa23SphericalAdvectionShock7getRRotEv2
_ZNK7crpropa31ConstantSphericalAdvectionField13getDivergenceERKNS_7Vector3IdEE2
_ZN7crpropa18AdvectionFieldList8addFieldENS_7ref_ptrINS_14AdvectionFieldEEE3
_ZNK7crpropa23SphericalAdvectionField13getDivergenceERKNS_7Vector3IdEE3
_ZNK7crpropa23SphericalAdvectionField8getFieldERKNS_7Vector3IdEE3
_ZNK7crpropa23SphericalAdvectionField9getOriginEv3
_ZNK7crpropa23SphericalAdvectionShock8getFieldERKNS_7Vector3IdEE3
_ZNK7crpropa23SphericalAdvectionShock9getOriginEv3
_ZNK7crpropa31ConstantSphericalAdvectionField9getOriginEv3
_ZNK7crpropa21UniformAdvectionField13getDivergenceERKNS_7Vector3IdEE5
_ZNK7crpropa23SphericalAdvectionShock1gEd5
_ZN7crpropa21UniformAdvectionFieldC2ERKNS_7Vector3IdEE8
_ZNK7crpropa21UniformAdvectionField8getFieldERKNS_7Vector3IdEE120005
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/advectionField/AdvectionField.cpp.func.html b/doc/coverageReport/src/advectionField/AdvectionField.cpp.func.html deleted file mode 100644 index c7c1f546f..000000000 --- a/doc/coverageReport/src/advectionField/AdvectionField.cpp.func.html +++ /dev/null @@ -1,408 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/advectionField/AdvectionField.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/advectionField - AdvectionField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13130842.5 %
Date:2024-04-08 14:58:22Functions:448452.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa18AdvectionFieldList8addFieldENS_7ref_ptrINS_14AdvectionFieldEEE3
_ZN7crpropa21ObliqueAdvectionShock13setShockwidthEd0
_ZN7crpropa21ObliqueAdvectionShock5setVyEd0
_ZN7crpropa21ObliqueAdvectionShock6setVupEd0
_ZN7crpropa21ObliqueAdvectionShock7setCompEd0
_ZN7crpropa21ObliqueAdvectionShockC2Edddd0
_ZN7crpropa21UniformAdvectionFieldC2ERKNS_7Vector3IdEE8
_ZN7crpropa23SphericalAdvectionField6setTauEd1
_ZN7crpropa23SphericalAdvectionField7setVMaxEd1
_ZN7crpropa23SphericalAdvectionField8setAlphaEd1
_ZN7crpropa23SphericalAdvectionField9setOriginENS_7Vector3IdEE1
_ZN7crpropa23SphericalAdvectionField9setRadiusEd1
_ZN7crpropa23SphericalAdvectionFieldC2ENS_7Vector3IdEEdddd1
_ZN7crpropa23SphericalAdvectionShock17setAzimuthalSpeedEd2
_ZN7crpropa23SphericalAdvectionShock5setR0Ed1
_ZN7crpropa23SphericalAdvectionShock5setV0Ed1
_ZN7crpropa23SphericalAdvectionShock7setRRotEd2
_ZN7crpropa23SphericalAdvectionShock9setLambdaEd1
_ZN7crpropa23SphericalAdvectionShock9setOriginENS_7Vector3IdEE1
_ZN7crpropa23SphericalAdvectionShockC2ENS_7Vector3IdEEddd1
_ZN7crpropa28OneDimensionalCartesianShock13setShockwidthEd0
_ZN7crpropa28OneDimensionalCartesianShock6setVupEd0
_ZN7crpropa28OneDimensionalCartesianShock7setCompEd0
_ZN7crpropa28OneDimensionalCartesianShockC2Eddd0
_ZN7crpropa28OneDimensionalSphericalShock10setCoolingEb0
_ZN7crpropa28OneDimensionalSphericalShock13setShockwidthEd0
_ZN7crpropa28OneDimensionalSphericalShock14setShockRadiusEd0
_ZN7crpropa28OneDimensionalSphericalShock6setVupEd0
_ZN7crpropa28OneDimensionalSphericalShock7setCompEd0
_ZN7crpropa28OneDimensionalSphericalShockC2Eddddb0
_ZN7crpropa31ConstantSphericalAdvectionField8setVWindEd2
_ZN7crpropa31ConstantSphericalAdvectionField9setOriginENS_7Vector3IdEE2
_ZN7crpropa31ConstantSphericalAdvectionFieldC2ENS_7Vector3IdEEd2
_ZNK7crpropa18AdvectionFieldList13getDivergenceERKNS_7Vector3IdEE1
_ZNK7crpropa18AdvectionFieldList8getFieldERKNS_7Vector3IdEE1
_ZNK7crpropa21ObliqueAdvectionShock13getDivergenceERKNS_7Vector3IdEE0
_ZNK7crpropa21ObliqueAdvectionShock13getShockwidthEv0
_ZNK7crpropa21ObliqueAdvectionShock14getDescriptionB5cxx11Ev0
_ZNK7crpropa21ObliqueAdvectionShock5getVyEv0
_ZNK7crpropa21ObliqueAdvectionShock6getVupEv0
_ZNK7crpropa21ObliqueAdvectionShock7getCompEv0
_ZNK7crpropa21ObliqueAdvectionShock8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa21UniformAdvectionField13getDivergenceERKNS_7Vector3IdEE5
_ZNK7crpropa21UniformAdvectionField14getDescriptionB5cxx11Ev0
_ZNK7crpropa21UniformAdvectionField8getFieldERKNS_7Vector3IdEE120005
_ZNK7crpropa23SphericalAdvectionField13getDivergenceERKNS_7Vector3IdEE3
_ZNK7crpropa23SphericalAdvectionField14getDescriptionB5cxx11Ev0
_ZNK7crpropa23SphericalAdvectionField4getVERKd2
_ZNK7crpropa23SphericalAdvectionField6getTauEv1
_ZNK7crpropa23SphericalAdvectionField7getVMaxEv1
_ZNK7crpropa23SphericalAdvectionField8getAlphaEv1
_ZNK7crpropa23SphericalAdvectionField8getFieldERKNS_7Vector3IdEE3
_ZNK7crpropa23SphericalAdvectionField9getOriginEv3
_ZNK7crpropa23SphericalAdvectionField9getRadiusEv1
_ZNK7crpropa23SphericalAdvectionShock13getDivergenceERKNS_7Vector3IdEE2
_ZNK7crpropa23SphericalAdvectionShock14getDescriptionB5cxx11Ev0
_ZNK7crpropa23SphericalAdvectionShock17getAzimuthalSpeedEv2
_ZNK7crpropa23SphericalAdvectionShock1gEd5
_ZNK7crpropa23SphericalAdvectionShock5getR0Ev1
_ZNK7crpropa23SphericalAdvectionShock5getV0Ev1
_ZNK7crpropa23SphericalAdvectionShock7g_primeEd2
_ZNK7crpropa23SphericalAdvectionShock7getRRotEv2
_ZNK7crpropa23SphericalAdvectionShock8getFieldERKNS_7Vector3IdEE3
_ZNK7crpropa23SphericalAdvectionShock9getLambdaEv1
_ZNK7crpropa23SphericalAdvectionShock9getOriginEv3
_ZNK7crpropa28OneDimensionalCartesianShock13getDivergenceERKNS_7Vector3IdEE0
_ZNK7crpropa28OneDimensionalCartesianShock13getShockwidthEv0
_ZNK7crpropa28OneDimensionalCartesianShock14getDescriptionB5cxx11Ev0
_ZNK7crpropa28OneDimensionalCartesianShock6getVupEv0
_ZNK7crpropa28OneDimensionalCartesianShock7getCompEv0
_ZNK7crpropa28OneDimensionalCartesianShock8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa28OneDimensionalSphericalShock10getCoolingEv0
_ZNK7crpropa28OneDimensionalSphericalShock13getDivergenceERKNS_7Vector3IdEE0
_ZNK7crpropa28OneDimensionalSphericalShock13getShockwidthEv0
_ZNK7crpropa28OneDimensionalSphericalShock14getDescriptionB5cxx11Ev0
_ZNK7crpropa28OneDimensionalSphericalShock14getShockRadiusEv0
_ZNK7crpropa28OneDimensionalSphericalShock6getVupEv0
_ZNK7crpropa28OneDimensionalSphericalShock7getCompEv0
_ZNK7crpropa28OneDimensionalSphericalShock8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa31ConstantSphericalAdvectionField13getDivergenceERKNS_7Vector3IdEE2
_ZNK7crpropa31ConstantSphericalAdvectionField14getDescriptionB5cxx11Ev0
_ZNK7crpropa31ConstantSphericalAdvectionField8getFieldERKNS_7Vector3IdEE1
_ZNK7crpropa31ConstantSphericalAdvectionField8getVWindEv1
_ZNK7crpropa31ConstantSphericalAdvectionField9getOriginEv3
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/advectionField/AdvectionField.cpp.gcov.html b/doc/coverageReport/src/advectionField/AdvectionField.cpp.gcov.html deleted file mode 100644 index 69ab19d58..000000000 --- a/doc/coverageReport/src/advectionField/AdvectionField.cpp.gcov.html +++ /dev/null @@ -1,610 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/advectionField/AdvectionField.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/advectionField - AdvectionField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13130842.5 %
Date:2024-04-08 14:58:22Functions:448452.4 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/advectionField/AdvectionField.h"
-       2             : 
-       3             : 
-       4             : namespace crpropa {
-       5             : 
-       6             : 
-       7             : 
-       8           3 : void AdvectionFieldList::addField(ref_ptr<AdvectionField> field) {
-       9           3 :         fields.push_back(field);
-      10           3 : }
-      11             : 
-      12           1 : Vector3d AdvectionFieldList::getField(const Vector3d &position) const {
-      13             :         Vector3d b(0.);
-      14           4 :         for (int i = 0; i < fields.size(); i++)
-      15           3 :                 b += fields[i]->getField(position);
-      16           1 :         return b;
-      17             : }
-      18             : 
-      19           1 : double AdvectionFieldList::getDivergence(const Vector3d &position) const {
-      20             :         double D=0.;
-      21             :         // Work on default values for divergence or an error handling
-      22           4 :         for (int i = 0; i < fields.size(); i++)
-      23           3 :                 D += fields[i]->getDivergence(position);
-      24           1 :         return D;
-      25             : }
-      26             : 
-      27             : 
-      28             : //----------------------------------------------------------------
-      29           8 : UniformAdvectionField::UniformAdvectionField(const Vector3d &value) :
-      30           8 :                         value(value) {
-      31           8 :         }
-      32             : 
-      33      120005 : Vector3d UniformAdvectionField::getField(const Vector3d &position) const {
-      34      120005 :         return value;
-      35             :         }
-      36             : 
-      37           5 : double UniformAdvectionField::getDivergence(const Vector3d &position) const {
-      38           5 :         return 0.;
-      39             :         }
-      40             : 
-      41           0 : std::string UniformAdvectionField::getDescription() const {
-      42           0 :         std::stringstream s;
-      43           0 :         s << "v0: " << value / km * sec << " km/s, ";
-      44           0 :         return s.str();
-      45           0 : }
-      46             : 
-      47             : //----------------------------------------------------------------
-      48             : 
-      49           2 : ConstantSphericalAdvectionField::ConstantSphericalAdvectionField(const Vector3d origin, double vWind) {
-      50           2 :         setOrigin(origin);
-      51           2 :         setVWind(vWind);
-      52           2 : }
-      53             : 
-      54           1 : Vector3d ConstantSphericalAdvectionField::getField(const Vector3d &position) const {
-      55             :         Vector3d Pos = position-origin;
-      56           1 :         return vWind * Pos.getUnitVector();
-      57             : }
-      58             : 
-      59           2 : double ConstantSphericalAdvectionField::getDivergence(const Vector3d &position) const {
-      60             :         double R = (position-origin).getR();    
-      61           2 :         return 2*vWind/R;
-      62             : }
-      63             : 
-      64           2 : void ConstantSphericalAdvectionField::setOrigin(const Vector3d o) {
-      65             :         origin=o;
-      66           2 :         return;
-      67             : }
-      68             : 
-      69           2 : void ConstantSphericalAdvectionField::setVWind(double v) {
-      70           2 :         vWind = v;
-      71           2 :         return;
-      72             : }
-      73             : 
-      74           3 : Vector3d ConstantSphericalAdvectionField::getOrigin() const {
-      75           3 :         return origin;
-      76             : }
-      77             : 
-      78           1 : double ConstantSphericalAdvectionField::getVWind() const {
-      79           1 :         return vWind;
-      80             : }
-      81             : 
-      82           0 : std::string ConstantSphericalAdvectionField::getDescription() const {
-      83           0 :         std::stringstream s;
-      84           0 :         s << "Origin: " << origin / kpc  << " kpc, ";
-      85           0 :         s << "v0: " << vWind / km * sec << " km/s, ";
-      86           0 :         return s.str();
-      87           0 : }
-      88             : 
-      89             : 
-      90             : 
-      91             : //----------------------------------------------------------------
-      92             : 
-      93           1 : SphericalAdvectionField::SphericalAdvectionField(const Vector3d origin, double radius, double vMax, double tau, double alpha) {
-      94           1 :         setOrigin(origin);
-      95           1 :         setRadius(radius);
-      96           1 :         setVMax(vMax);
-      97           1 :         setTau(tau);
-      98           1 :         setAlpha(alpha);
-      99           1 : }
-     100             : 
-     101           3 : Vector3d SphericalAdvectionField::getField(const Vector3d &position) const {
-     102             :         Vector3d Pos = position-origin;
-     103           3 :         double R = Pos.getR();
-     104           3 :         if (R>radius) {
-     105             :                 return Vector3d(0.);
-     106             :         }
-     107           2 :         double v_R = getV(R);
-     108           2 :         return v_R * Pos.getUnitVector();
-     109             : }
-     110             : 
-     111           3 : double SphericalAdvectionField::getDivergence(const Vector3d &position) const {
-     112             :         double R = (position-origin).getR();
-     113           3 :         if (R>radius) {
-     114             :                 return 0.;
-     115             :         }
-     116           2 :         double D = 2*vMax/R * ( 1-( 1-alpha*(pow(R, alpha)/(2*tau)) )*exp(-( pow(R, alpha)/tau )) );
-     117           2 :         return D;
-     118             : }
-     119             : 
-     120           2 : double SphericalAdvectionField::getV(const double &r) const {
-     121           2 :         double f = vMax * (1-exp(-(pow(r, alpha)/tau)));
-     122           2 :         return f;
-     123             : }
-     124             : 
-     125           1 : void SphericalAdvectionField::setOrigin(const Vector3d o) {
-     126             :         origin = o;
-     127           1 :         return;
-     128             : }
-     129             : 
-     130           1 : void SphericalAdvectionField::setRadius(double r) {
-     131           1 :         radius = r;
-     132           1 :         return;
-     133             : }
-     134             : 
-     135           1 : void SphericalAdvectionField::setVMax(double v) {
-     136           1 :         vMax = v;
-     137           1 :         return;
-     138             : }
-     139             : 
-     140           1 : void SphericalAdvectionField::setTau(double t) {
-     141           1 :         tau = t;
-     142           1 :         return;
-     143             : }
-     144             : 
-     145           1 : void SphericalAdvectionField::setAlpha(double a) {
-     146           1 :         alpha = a;
-     147           1 :         return;
-     148             : }
-     149             : 
-     150           3 : Vector3d SphericalAdvectionField::getOrigin() const {
-     151           3 :         return origin;
-     152             : }
-     153             : 
-     154           1 : double SphericalAdvectionField::getRadius() const {
-     155           1 :         return radius;
-     156             : }
-     157             : 
-     158           1 : double SphericalAdvectionField::getVMax() const {
-     159           1 :         return vMax;
-     160             : }
-     161             : 
-     162           1 : double SphericalAdvectionField::getTau() const {
-     163           1 :         return tau;
-     164             : }
-     165             : 
-     166           1 : double SphericalAdvectionField::getAlpha() const {
-     167           1 :         return alpha;
-     168             : }
-     169             : 
-     170           0 : std::string SphericalAdvectionField::getDescription() const {
-     171           0 :         std::stringstream s;
-     172           0 :         s << "Origin: " << origin / kpc  << " kpc, ";
-     173           0 :         s << "Radius: " << radius / kpc  << " kpc, ";
-     174           0 :         s << "vMax: " << vMax / km * sec << " km/s, ";
-     175           0 :         s << "tau: " << tau << ", ";
-     176           0 :         s << "alpha: " << alpha << "\n";
-     177           0 :         return s.str();
-     178           0 : }
-     179             : 
-     180             : //----------------------------------------------------------------
-     181             : 
-     182           0 : OneDimensionalCartesianShock::OneDimensionalCartesianShock(double compressionRatio, double vUp, double lShock){
-     183           0 :         setComp(compressionRatio);
-     184           0 :         setVup(vUp);
-     185           0 :         setShockwidth(lShock);
-     186           0 :         }
-     187             : 
-     188           0 : Vector3d OneDimensionalCartesianShock::getField(const Vector3d &position) const {
-     189           0 :         double x = position.x;
-     190           0 :         double vDown = vUp / compressionRatio;
-     191             : 
-     192           0 :         double a = (vUp + vDown) * 0.5;
-     193           0 :         double b = (vUp - vDown) * 0.5;
-     194             : 
-     195             :         Vector3d v(0.);
-     196           0 :         v.x = a - b * tanh(x / lShock);
-     197           0 :         return v;
-     198             : 
-     199             : }
-     200             : 
-     201           0 : double OneDimensionalCartesianShock::getDivergence(const Vector3d &position) const {
-     202           0 :         double x = position.x;
-     203           0 :         double vDown = vUp / compressionRatio;
-     204             : 
-     205             :         double a = (vUp + vDown) * 0.5;
-     206           0 :         double b = (vUp - vDown) * 0.5;
-     207           0 :         return -b / lShock * (1 - tanh(x / lShock) * tanh(x / lShock));
-     208             : }
-     209             : 
-     210           0 : void OneDimensionalCartesianShock::setComp(double r) {
-     211           0 :         compressionRatio = r;
-     212           0 :         return;
-     213             : }
-     214             : 
-     215           0 : void OneDimensionalCartesianShock::setVup(double v) {
-     216           0 :         vUp = v;
-     217           0 :         return;
-     218             : }
-     219           0 : void OneDimensionalCartesianShock::setShockwidth(double w) {
-     220           0 :         lShock = w;
-     221           0 :         return;
-     222             : }
-     223             : 
-     224           0 : double OneDimensionalCartesianShock::getComp() const {
-     225           0 :         return compressionRatio;
-     226             : }
-     227             : 
-     228           0 : double OneDimensionalCartesianShock::getVup() const {
-     229           0 :         return vUp;
-     230             : }
-     231             : 
-     232           0 : double OneDimensionalCartesianShock::getShockwidth() const {
-     233           0 :         return lShock;
-     234             : }
-     235             : 
-     236           0 : std::string OneDimensionalCartesianShock::getDescription() const {
-     237           0 :         std::stringstream s;
-     238           0 :         s << "Shock width: " << lShock / km  << " km, ";
-     239           0 :         s << "Vup: " << vUp / km * sec << " km/s, ";
-     240           0 :         s << "Compression: " << compressionRatio;
-     241           0 :         return s.str();
-     242           0 : }
-     243             : 
-     244             : //----------------------------------------------------------------
-     245             : 
-     246           0 : OneDimensionalSphericalShock::OneDimensionalSphericalShock(double rShock, double vUp, double compressionRatio, double lShock, bool coolUpstream ){
-     247           0 :         setComp(compressionRatio);
-     248           0 :         setVup(vUp);
-     249           0 :         setShockwidth(lShock);
-     250           0 :         setShockRadius(rShock);
-     251           0 :         setCooling(coolUpstream);
-     252           0 :         }
-     253             : 
-     254           0 : Vector3d OneDimensionalSphericalShock::getField(const Vector3d &position) const {
-     255             :         double r = position.getR();
-     256           0 :         Vector3d e_r = position.getUnitVector();
-     257             : 
-     258           0 :         double vDown = vUp / compressionRatio;
-     259           0 :         double a = (vUp + vDown) * 0.5;
-     260           0 :         double b = (vUp - vDown) * 0.5;
-     261             : 
-     262             :         double v;
-     263           0 :         if (coolUpstream == true){
-     264             :         
-     265           0 :                 if (r <= rShock)
-     266           0 :                 v = a - b * tanh((r-rShock) / lShock);
-     267             :                 else
-     268           0 :                         v = (a - b * tanh((r-rShock) / lShock)) * (rShock / r) * (rShock / r);
-     269             : 
-     270             :         }
-     271             :         else
-     272           0 :                 v = (a - b * tanh((r-rShock) / lShock)) * (rShock / r) * (rShock / r);
-     273             : 
-     274           0 :         return v * e_r;
-     275             :         }
-     276             : 
-     277           0 : double OneDimensionalSphericalShock::getDivergence(const Vector3d &position) const {
-     278             :         double r = position.getR();
-     279             :         
-     280           0 :         double vDown = vUp / compressionRatio;
-     281           0 :         double a = (vUp + vDown) * 0.5;
-     282           0 :         double b = (vUp - vDown) * 0.5;
-     283             : 
-     284           0 :         double c = tanh((r-rShock) / lShock);
-     285             : 
-     286           0 :         if (coolUpstream == true){
-     287           0 :                 if (r <= rShock)
-     288           0 :                         return 2 * a / r - 2 * b / r * c - b / lShock * (1 - c * c);
-     289             :                 else
-     290           0 :                         return -(rShock / r) * (rShock / r) * b / lShock * (1 - c * c);
-     291             :         }
-     292             :         else 
-     293           0 :                 return -(rShock / r) * (rShock / r) *  b / lShock * (1 - c * c);
-     294             : 
-     295             : }
-     296             : 
-     297           0 : void OneDimensionalSphericalShock::setComp(double r) {
-     298           0 :         compressionRatio = r;
-     299           0 :         return;
-     300             : }
-     301             : 
-     302           0 : void OneDimensionalSphericalShock::setVup(double v) {
-     303           0 :         vUp = v;
-     304           0 :         return;
-     305             : }
-     306           0 : void OneDimensionalSphericalShock::setShockwidth(double w) {
-     307           0 :         lShock = w;
-     308           0 :         return;
-     309             : }
-     310             : 
-     311           0 : void OneDimensionalSphericalShock::setShockRadius(double r) {
-     312           0 :         rShock = r;
-     313           0 :         return;
-     314             : }
-     315             : 
-     316           0 : void OneDimensionalSphericalShock::setCooling(bool c) {
-     317           0 :         coolUpstream = c;
-     318           0 :         return;
-     319             : }
-     320             : 
-     321           0 : double OneDimensionalSphericalShock::getComp() const {
-     322           0 :         return compressionRatio;
-     323             : }
-     324             : 
-     325           0 : double OneDimensionalSphericalShock::getVup() const {
-     326           0 :         return vUp;
-     327             : }
-     328             : 
-     329           0 : double OneDimensionalSphericalShock::getShockwidth() const {
-     330           0 :         return lShock;
-     331             : }
-     332             : 
-     333           0 : double OneDimensionalSphericalShock::getShockRadius() const {
-     334           0 :         return rShock;
-     335             : }
-     336             : 
-     337           0 : bool OneDimensionalSphericalShock::getCooling() const {
-     338           0 :         return coolUpstream;
-     339             : }
-     340             : 
-     341           0 : std::string OneDimensionalSphericalShock::getDescription() const {
-     342           0 :         std::stringstream s;
-     343           0 :         s << "Shock width: " << lShock / km  << " km, ";
-     344           0 :         s << "Shock radius: " << rShock / km  << " km, ";
-     345           0 :         s << "Vup: " << vUp / km * sec << " km/s, ";
-     346           0 :         s << "Comp: " << compressionRatio;
-     347             : 
-     348           0 :         return s.str();
-     349           0 : }
-     350             : 
-     351             : //----------------------------------------------------------------
-     352             : 
-     353           0 : ObliqueAdvectionShock::ObliqueAdvectionShock(double compressionRatio, double vXUp, double vY, double lShock) {
-     354           0 :         setComp(compressionRatio);
-     355           0 :         setVup(vXUp);
-     356           0 :         setVy(vY);
-     357           0 :         setShockwidth(lShock);
-     358           0 :         }
-     359             : 
-     360           0 : Vector3d ObliqueAdvectionShock::getField(const Vector3d &position) const {
-     361           0 :         double x = position.x;
-     362           0 :         double vXDown = vXUp / compressionRatio;
-     363             : 
-     364           0 :         double a = (vXUp + vXDown) * 0.5;
-     365           0 :         double b = (vXUp - vXDown) * 0.5;
-     366             : 
-     367             :         Vector3d v(0.);
-     368           0 :         v.x = a - b * tanh(x / lShock);
-     369           0 :         v.y = vY;
-     370             : 
-     371           0 :         return v;
-     372             :         }
-     373             : 
-     374           0 : double ObliqueAdvectionShock::getDivergence(const Vector3d &position) const {
-     375           0 :         double x = position.x;
-     376           0 :         double vXDown = vXUp / compressionRatio;
-     377             :         // vy = const
-     378             : 
-     379             :         double a = (vXUp + vXDown) * 0.5;
-     380           0 :         double b = (vXUp - vXDown) * 0.5;
-     381             : 
-     382           0 :         return -b / lShock * (1 - tanh(x / lShock) * tanh(x / lShock));
-     383             :         }
-     384             : 
-     385           0 : void ObliqueAdvectionShock::setComp(double r) {
-     386           0 :         compressionRatio = r;
-     387           0 :         return;
-     388             : }
-     389             : 
-     390           0 : void ObliqueAdvectionShock::setVup(double v) {
-     391           0 :         vXUp = v;
-     392           0 :         return;
-     393             : } 
-     394             : 
-     395           0 : void ObliqueAdvectionShock::setVy(double v) {
-     396           0 :         vY = v;
-     397           0 :         return;
-     398             : } 
-     399           0 : void ObliqueAdvectionShock::setShockwidth(double w) {
-     400           0 :         lShock = w;
-     401           0 :         return;
-     402             : }
-     403             : 
-     404           0 : double ObliqueAdvectionShock::getComp() const {
-     405           0 :         return compressionRatio;
-     406             : }
-     407             : 
-     408           0 : double ObliqueAdvectionShock::getVup() const {
-     409           0 :         return vXUp;
-     410             : }
-     411             : 
-     412           0 : double ObliqueAdvectionShock::getVy() const {
-     413           0 :         return vY;
-     414             : }
-     415             : 
-     416           0 : double ObliqueAdvectionShock::getShockwidth() const {
-     417           0 :         return lShock;
-     418             : }
-     419             : 
-     420           0 : std::string ObliqueAdvectionShock::getDescription() const {
-     421           0 :         std::stringstream s;
-     422           0 :         s << "Shock width: " << lShock / km  << " km, ";
-     423           0 :         s << "Vx_up: " << vXUp / km * sec << " km/s, ";
-     424           0 :         s << "Vy: " << vY / km * sec << " km/s, ";
-     425           0 :         s << "Comp: " << compressionRatio;
-     426             :         
-     427           0 :         return s.str();
-     428           0 : }
-     429             : 
-     430             : //-----------------------------------------------------------------
-     431             : 
-     432           1 : SphericalAdvectionShock::SphericalAdvectionShock(const Vector3d origin, double r_0, double v_0, double l) {
-     433           1 :         setOrigin(origin);
-     434           1 :         setR0(r_0);
-     435           1 :         setV0(v_0);
-     436           1 :         setLambda(l);
-     437           1 :         setRRot(r_0);
-     438           1 :         setAzimuthalSpeed(0.);
-     439           1 : }
-     440             : 
-     441             : 
-     442           3 : Vector3d SphericalAdvectionShock::getField(const Vector3d &pos) const {
-     443             :         Vector3d R = pos-origin;
-     444           3 :         Vector3d e_r = R.getUnitVector();
-     445           3 :         Vector3d e_phi = R.getUnitVectorPhi();
-     446             :         double r = R.getR();
-     447             : 
-     448           3 :         double v_r = v_0 * ( 1 + (pow(r_0/(2*r), 2.) -1 ) * g(r));
-     449           3 :         double v_p = v_phi * (r_rot/r); 
-     450             : 
-     451           3 :         return v_r * e_r + v_p * e_phi;
-     452             : }
-     453             : 
-     454             : 
-     455           2 : double SphericalAdvectionShock::getDivergence(const Vector3d &pos) const {
-     456             :         double r = (pos-origin).getR();
-     457             : 
-     458           2 :         double d1 = 2./r*(1-g(r));
-     459           2 :         double d2 = (pow(r_0/(2*r), 2.)-1)*g_prime(r);
-     460             : 
-     461           2 :         return v_0 * (d1+d2);
-     462             : }
-     463             : 
-     464             : 
-     465           5 : double SphericalAdvectionShock::g(double r) const {
-     466           5 :         double a = (r-r_0)/lambda;
-     467           5 :         return 1. / (1+exp(-a));
-     468             : }
-     469             : 
-     470           2 : double SphericalAdvectionShock::g_prime(double r) const {
-     471           2 :         double a = (r-r_0)/lambda;
-     472           2 :         return 1. / (2*lambda*(1+cosh(-a)));
-     473             : }       
-     474             : 
-     475           1 : void SphericalAdvectionShock::setOrigin(const Vector3d o) {
-     476             :         origin = o;
-     477           1 : }
-     478             : 
-     479           1 : void SphericalAdvectionShock::setR0(double r) {
-     480           1 :         r_0 = r;
-     481           1 : }
-     482             : 
-     483           1 : void SphericalAdvectionShock::setV0(double v) {
-     484           1 :         v_0 = v;
-     485           1 : }
-     486             : 
-     487           1 : void SphericalAdvectionShock::setLambda(double l) {
-     488           1 :         lambda = l;
-     489           1 : }
-     490             : 
-     491           2 : void SphericalAdvectionShock::setRRot(double r) {
-     492           2 :         r_rot = r;
-     493           2 : }
-     494             : 
-     495           2 : void SphericalAdvectionShock::setAzimuthalSpeed(double v) {
-     496           2 :         v_phi = v;
-     497           2 : }
-     498             : 
-     499           3 : Vector3d SphericalAdvectionShock::getOrigin() const {
-     500           3 :         return origin;
-     501             : }
-     502             : 
-     503           1 : double SphericalAdvectionShock::getR0() const {
-     504           1 :         return r_0;
-     505             : }
-     506             : 
-     507           1 : double SphericalAdvectionShock::getV0() const {
-     508           1 :         return v_0;
-     509             : }
-     510             : 
-     511           1 : double SphericalAdvectionShock::getLambda() const {
-     512           1 :         return lambda;
-     513             : }
-     514             : 
-     515           2 : double SphericalAdvectionShock::getRRot() const {
-     516           2 :         return r_rot;
-     517             : }
-     518             : 
-     519           2 : double SphericalAdvectionShock::getAzimuthalSpeed() const {
-     520           2 :         return v_phi;
-     521             : }
-     522             : 
-     523           0 : std::string SphericalAdvectionShock::getDescription() const {
-     524           0 :         std::stringstream s;
-     525           0 :         s << "Origin: " << origin / kpc  << " kpc, ";
-     526           0 :         s << "r0 (shock radius): " << r_0 / kpc  << " kpc, ";
-     527           0 :         s << "r_rot (norm. azimuthal velocity): " << r_rot / kpc  << " kpc, ";
-     528           0 :         s << "v0 (maximum radial speed): " << v_0 / km * sec << " km/s, ";
-     529           0 :         s << "v_phi (azimuthal speed @ r_rot): " << v_phi / km * sec << " km/s, ";
-     530           0 :         s << "lambda: " << lambda / pc << " pc";
-     531           0 :         return s.str();
-     532           0 : }
-     533             : 
-     534             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/advectionField/index-sort-f.html b/doc/coverageReport/src/advectionField/index-sort-f.html deleted file mode 100644 index 54baddead..000000000 --- a/doc/coverageReport/src/advectionField/index-sort-f.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/advectionField - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/advectionFieldHitTotalCoverage
Test:coverage.info.cleanedLines:13130842.5 %
Date:2024-04-08 14:58:22Functions:448452.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
AdvectionField.cpp -
42.5%42.5%
-
42.5 %131 / 30852.4 %44 / 84
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/advectionField/index-sort-l.html b/doc/coverageReport/src/advectionField/index-sort-l.html deleted file mode 100644 index 5eed79af6..000000000 --- a/doc/coverageReport/src/advectionField/index-sort-l.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/advectionField - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/advectionFieldHitTotalCoverage
Test:coverage.info.cleanedLines:13130842.5 %
Date:2024-04-08 14:58:22Functions:448452.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
AdvectionField.cpp -
42.5%42.5%
-
42.5 %131 / 30852.4 %44 / 84
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/advectionField/index.html b/doc/coverageReport/src/advectionField/index.html deleted file mode 100644 index c4f7d0da9..000000000 --- a/doc/coverageReport/src/advectionField/index.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/advectionField - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/advectionFieldHitTotalCoverage
Test:coverage.info.cleanedLines:13130842.5 %
Date:2024-04-08 14:58:22Functions:448452.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
AdvectionField.cpp -
42.5%42.5%
-
42.5 %131 / 30852.4 %44 / 84
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/base64.cpp.func-sort-c.html b/doc/coverageReport/src/base64.cpp.func-sort-c.html deleted file mode 100644 index 6dfadfd29..000000000 --- a/doc/coverageReport/src/base64.cpp.func-sort-c.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/base64.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - base64.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:454991.8 %
Date:2024-04-08 14:58:22Functions:22100.0 %
-
- -
- - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa6Base646encodeB5cxx11EPKhm99
_ZN7crpropa6Base646decodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE100
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/base64.cpp.func.html b/doc/coverageReport/src/base64.cpp.func.html deleted file mode 100644 index d68b507b6..000000000 --- a/doc/coverageReport/src/base64.cpp.func.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/base64.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - base64.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:454991.8 %
Date:2024-04-08 14:58:22Functions:22100.0 %
-
- -
- - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa6Base646decodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE100
_ZN7crpropa6Base646encodeB5cxx11EPKhm99
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/base64.cpp.gcov.html b/doc/coverageReport/src/base64.cpp.gcov.html deleted file mode 100644 index 3e0cc494c..000000000 --- a/doc/coverageReport/src/base64.cpp.gcov.html +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/base64.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src - base64.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:454991.8 %
Date:2024-04-08 14:58:22Functions:22100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : // base64 encodig and decoding.
-       2             : //
-       3             : // Based on the implementations by
-       4             : // Jouni Malinen <j@w1.fi> and contributors from wpa_supplicant and hostapd in
-       5             : // http://web.mit.edu/freebsd/head/contrib/wpa/ and
-       6             : // http://web.mit.edu/freebsd/head/contrib/wpa/src/utils/base64.c and
-       7             : // http://web.mit.edu/freebsd/head/contrib/wpa/src/utils/base64.h
-       8             : //
-       9             : // Published under a 3-clause BSD license
-      10             : //
-      11             : 
-      12             : #include <string>
-      13             : #include <cstring>
-      14             : #include <stdexcept>
-      15             : 
-      16             : #include "crpropa/base64.h"
-      17             : 
-      18             : namespace crpropa
-      19             : {
-      20             : 
-      21             : //Alphabet used
-      22             : static const unsigned char encode_alphabet[65] =
-      23             : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-      24             : static int decode_alphabet[256] = {-1};
-      25             : 
-      26             : /// Encodes data
-      27          99 : std::string Base64::encode(const unsigned char *src, size_t len)
-      28             : {
-      29          99 :                 size_t olen = 4*((len + 2) / 3); /* 3-byte blocks to 4-byte */
-      30             : 
-      31          99 :                 if (olen < len)
-      32           0 :                         throw std::runtime_error("Integer overflow in Base64::encoding, data to large!");
-      33             : 
-      34             :                 std::string outStr;
-      35             :                 outStr.resize(olen);
-      36             : 
-      37             :                 unsigned char *out = (unsigned char*) outStr.c_str();
-      38             :                 unsigned char *pos = out;
-      39             :                 const unsigned char *end, *in;
-      40             : 
-      41          99 :                 end = src + len;
-      42             :                 in = src;
-      43        6666 :                 while (end - in >= 3) {
-      44        6567 :                                 *pos++ = encode_alphabet[in[0] >> 2];
-      45        6567 :                                 *pos++ = encode_alphabet[((in[0] & 0x03) << 4) | (in[1] >> 4)];
-      46        6567 :                                 *pos++ = encode_alphabet[((in[1] & 0x0f) << 2) | (in[2] >> 6)];
-      47        6567 :                                 *pos++ = encode_alphabet[in[2] & 0x3f];
-      48        6567 :                                 in += 3;
-      49             :                 }
-      50             : 
-      51          99 :                 if (end - in) {
-      52          66 :                                 *pos++ = encode_alphabet[in[0] >> 2];
-      53          66 :                                 if (end - in == 1) {
-      54          33 :                                                 *pos++ = encode_alphabet[(in[0] & 0x03) << 4];
-      55          33 :                                                 *pos++ = '=';
-      56             :                                 }
-      57             :                                 else {
-      58          33 :                                                 *pos++ = encode_alphabet[((in[0] & 0x03) << 4) |
-      59          33 :                                                                 (in[1] >> 4)];
-      60          33 :                                                 *pos++ = encode_alphabet[(in[1] & 0x0f) << 2];
-      61             :                                 }
-      62          66 :                                 *pos++ = '=';
-      63             :                 }
-      64             : 
-      65          99 :                 return outStr;
-      66             : }
-      67             : 
-      68             : 
-      69         100 : std::string Base64::decode(const std::string &data)
-      70             : {
-      71             : const unsigned char *src = (unsigned char*) data.c_str();
-      72             : size_t len = data.size();
-      73             : 
-      74         100 : if (decode_alphabet[0] == -1)
-      75             : { // build decode alphabet
-      76             :         std::memset(decode_alphabet, 0x80, 256);
-      77          65 :         for (size_t i = 0; i < sizeof(encode_alphabet) - 1; i++)
-      78          64 :                 decode_alphabet[encode_alphabet[i]] = (unsigned char) i;
-      79           1 :         decode_alphabet['='] = 0;
-      80             : }
-      81             : 
-      82             : size_t olen = 0;
-      83       26656 : for (size_t i = 0; i < len; i++) {
-      84       26556 :         if (decode_alphabet[src[i]] != 0x80)
-      85       26556 :                 olen++;
-      86             : }
-      87             : 
-      88         100 : if (olen == 0 || olen % 4)
-      89           0 :                         throw std::runtime_error("Base64 decode, invalid input size");
-      90             : 
-      91         100 : olen = olen / 4 * 3;
-      92             : std::string str;
-      93             : str.resize(olen);
-      94             : 
-      95             : unsigned char *out = (unsigned char*) str.c_str();
-      96             : unsigned char *pos = out;
-      97             : 
-      98             : size_t count = 0;
-      99             : int pad = 0;
-     100             : unsigned char block[4];
-     101       26589 : for (size_t i = 0; i < len; i++) {
-     102       26556 :         unsigned char tmp = decode_alphabet[src[i]];
-     103       26556 :         if (tmp == 0x80)
-     104           0 :                 continue;
-     105             : 
-     106       26556 :         if (src[i] == '=')
-     107         101 :                 pad++;
-     108       26556 :         block[count] = tmp;
-     109       26556 :         count++;
-     110       26556 :         if (count == 4) {
-     111        6639 :                 *pos++ = (block[0] << 2) | (block[1] >> 4);
-     112        6639 :                 *pos++ = (block[1] << 4) | (block[2] >> 2);
-     113        6639 :                 *pos++ = (block[2] << 6) | block[3];
-     114             :                 count = 0;
-     115        6639 :                 if (pad) {
-     116          67 :                         if (pad == 1)
-     117             :                                 pos--;
-     118          34 :                         else if (pad == 2)
-     119             :                                 pos -= 2;
-     120             :                         else {
-     121           0 :                                 throw std::runtime_error("Base64 decode, invalid padding");
-     122             :                         }
-     123             :                         break;
-     124             :                 }
-     125             :         }
-     126             : }
-     127         100 : return str;
-     128             : }
-     129             : };
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/index-sort-f.html b/doc/coverageReport/src/index-sort-f.html deleted file mode 100644 index b4c3a6afb..000000000 --- a/doc/coverageReport/src/index-sort-f.html +++ /dev/null @@ -1,253 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - srcHitTotalCoverage
Test:coverage.info.cleanedLines:1361270750.3 %
Date:2024-04-08 14:58:22Functions:25142958.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Clock.cpp -
0.0%
-
0.0 %0 / 270.0 %0 / 8
GridTools.cpp -
27.3%27.3%
-
27.3 %67 / 24536.8 %7 / 19
Variant.cpp -
13.7%13.7%
-
13.7 %71 / 51937.5 %18 / 48
Cosmology.cpp -
47.8%47.8%
-
47.8 %44 / 9240.0 %6 / 15
Geometry.cpp -
36.0%36.0%
-
36.0 %18 / 5046.2 %6 / 13
EmissionMap.cpp -
53.2%53.2%
-
53.2 %83 / 15654.5 %18 / 33
Source.cpp -
58.5%58.5%
-
58.5 %459 / 78455.5 %81 / 146
Random.cpp -
57.7%57.7%
-
57.7 %139 / 24156.5 %26 / 46
Module.cpp -
77.1%77.1%
-
77.1 %37 / 4875.0 %9 / 12
ParticleID.cpp -
53.3%53.3%
-
53.3 %16 / 3080.0 %4 / 5
ProgressBar.cpp -
78.0%78.0%
-
78.0 %39 / 5080.0 %4 / 5
PhotonBackground.cpp -
73.3%73.3%
-
73.3 %88 / 12080.0 %12 / 15
Common.cpp -
77.4%77.4%
-
77.4 %48 / 6283.3 %5 / 6
ParticleState.cpp -
85.7%85.7%
-
85.7 %48 / 5694.1 %16 / 17
Candidate.cpp -
87.8%87.8%
-
87.8 %129 / 14794.3 %33 / 35
base64.cpp -
91.8%91.8%
-
91.8 %45 / 49100.0 %2 / 2
ParticleMass.cpp -
96.8%96.8%
-
96.8 %30 / 31100.0 %4 / 4
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/index-sort-l.html b/doc/coverageReport/src/index-sort-l.html deleted file mode 100644 index f65520a55..000000000 --- a/doc/coverageReport/src/index-sort-l.html +++ /dev/null @@ -1,253 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - srcHitTotalCoverage
Test:coverage.info.cleanedLines:1361270750.3 %
Date:2024-04-08 14:58:22Functions:25142958.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Clock.cpp -
0.0%
-
0.0 %0 / 270.0 %0 / 8
Variant.cpp -
13.7%13.7%
-
13.7 %71 / 51937.5 %18 / 48
GridTools.cpp -
27.3%27.3%
-
27.3 %67 / 24536.8 %7 / 19
Geometry.cpp -
36.0%36.0%
-
36.0 %18 / 5046.2 %6 / 13
Cosmology.cpp -
47.8%47.8%
-
47.8 %44 / 9240.0 %6 / 15
EmissionMap.cpp -
53.2%53.2%
-
53.2 %83 / 15654.5 %18 / 33
ParticleID.cpp -
53.3%53.3%
-
53.3 %16 / 3080.0 %4 / 5
Random.cpp -
57.7%57.7%
-
57.7 %139 / 24156.5 %26 / 46
Source.cpp -
58.5%58.5%
-
58.5 %459 / 78455.5 %81 / 146
PhotonBackground.cpp -
73.3%73.3%
-
73.3 %88 / 12080.0 %12 / 15
Module.cpp -
77.1%77.1%
-
77.1 %37 / 4875.0 %9 / 12
Common.cpp -
77.4%77.4%
-
77.4 %48 / 6283.3 %5 / 6
ProgressBar.cpp -
78.0%78.0%
-
78.0 %39 / 5080.0 %4 / 5
ParticleState.cpp -
85.7%85.7%
-
85.7 %48 / 5694.1 %16 / 17
Candidate.cpp -
87.8%87.8%
-
87.8 %129 / 14794.3 %33 / 35
base64.cpp -
91.8%91.8%
-
91.8 %45 / 49100.0 %2 / 2
ParticleMass.cpp -
96.8%96.8%
-
96.8 %30 / 31100.0 %4 / 4
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/index.html b/doc/coverageReport/src/index.html deleted file mode 100644 index 6e1fed226..000000000 --- a/doc/coverageReport/src/index.html +++ /dev/null @@ -1,253 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - srcHitTotalCoverage
Test:coverage.info.cleanedLines:1361270750.3 %
Date:2024-04-08 14:58:22Functions:25142958.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Candidate.cpp -
87.8%87.8%
-
87.8 %129 / 14794.3 %33 / 35
Clock.cpp -
0.0%
-
0.0 %0 / 270.0 %0 / 8
Common.cpp -
77.4%77.4%
-
77.4 %48 / 6283.3 %5 / 6
Cosmology.cpp -
47.8%47.8%
-
47.8 %44 / 9240.0 %6 / 15
EmissionMap.cpp -
53.2%53.2%
-
53.2 %83 / 15654.5 %18 / 33
Geometry.cpp -
36.0%36.0%
-
36.0 %18 / 5046.2 %6 / 13
GridTools.cpp -
27.3%27.3%
-
27.3 %67 / 24536.8 %7 / 19
Module.cpp -
77.1%77.1%
-
77.1 %37 / 4875.0 %9 / 12
ParticleID.cpp -
53.3%53.3%
-
53.3 %16 / 3080.0 %4 / 5
ParticleMass.cpp -
96.8%96.8%
-
96.8 %30 / 31100.0 %4 / 4
ParticleState.cpp -
85.7%85.7%
-
85.7 %48 / 5694.1 %16 / 17
PhotonBackground.cpp -
73.3%73.3%
-
73.3 %88 / 12080.0 %12 / 15
ProgressBar.cpp -
78.0%78.0%
-
78.0 %39 / 5080.0 %4 / 5
Random.cpp -
57.7%57.7%
-
57.7 %139 / 24156.5 %26 / 46
Source.cpp -
58.5%58.5%
-
58.5 %459 / 78455.5 %81 / 146
Variant.cpp -
13.7%13.7%
-
13.7 %71 / 51937.5 %18 / 48
base64.cpp -
91.8%91.8%
-
91.8 %45 / 49100.0 %2 / 2
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/ArchimedeanSpiralField.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/ArchimedeanSpiralField.cpp.func-sort-c.html deleted file mode 100644 index a7bc79210..000000000 --- a/doc/coverageReport/src/magneticField/ArchimedeanSpiralField.cpp.func-sort-c.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/ArchimedeanSpiralField.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - ArchimedeanSpiralField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0420.0 %
Date:2024-04-08 14:58:22Functions:0100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa22ArchimedeanSpiralField5setB0Ed0
_ZN7crpropa22ArchimedeanSpiralField5setR0Ed0
_ZN7crpropa22ArchimedeanSpiralField5setVwEd0
_ZN7crpropa22ArchimedeanSpiralField8setOmegaEd0
_ZN7crpropa22ArchimedeanSpiralFieldC2Edddd0
_ZNK7crpropa22ArchimedeanSpiralField5getB0Ev0
_ZNK7crpropa22ArchimedeanSpiralField5getR0Ev0
_ZNK7crpropa22ArchimedeanSpiralField5getVwEv0
_ZNK7crpropa22ArchimedeanSpiralField8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa22ArchimedeanSpiralField8getOmegaEv0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/ArchimedeanSpiralField.cpp.func.html b/doc/coverageReport/src/magneticField/ArchimedeanSpiralField.cpp.func.html deleted file mode 100644 index 547d3e58d..000000000 --- a/doc/coverageReport/src/magneticField/ArchimedeanSpiralField.cpp.func.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/ArchimedeanSpiralField.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - ArchimedeanSpiralField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0420.0 %
Date:2024-04-08 14:58:22Functions:0100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa22ArchimedeanSpiralField5setB0Ed0
_ZN7crpropa22ArchimedeanSpiralField5setR0Ed0
_ZN7crpropa22ArchimedeanSpiralField5setVwEd0
_ZN7crpropa22ArchimedeanSpiralField8setOmegaEd0
_ZN7crpropa22ArchimedeanSpiralFieldC2Edddd0
_ZNK7crpropa22ArchimedeanSpiralField5getB0Ev0
_ZNK7crpropa22ArchimedeanSpiralField5getR0Ev0
_ZNK7crpropa22ArchimedeanSpiralField5getVwEv0
_ZNK7crpropa22ArchimedeanSpiralField8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa22ArchimedeanSpiralField8getOmegaEv0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/ArchimedeanSpiralField.cpp.gcov.html b/doc/coverageReport/src/magneticField/ArchimedeanSpiralField.cpp.gcov.html deleted file mode 100644 index 0b5c7b362..000000000 --- a/doc/coverageReport/src/magneticField/ArchimedeanSpiralField.cpp.gcov.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/ArchimedeanSpiralField.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - ArchimedeanSpiralField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0420.0 %
Date:2024-04-08 14:58:22Functions:0100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/magneticField/ArchimedeanSpiralField.h"
-       2             : 
-       3             : namespace crpropa {
-       4             : 
-       5           0 : ArchimedeanSpiralField::ArchimedeanSpiralField(double B_0, double R_0, double Omega, double V_w) {
-       6           0 :         setB0(B_0);
-       7           0 :         setR0(R_0);
-       8           0 :         setOmega(Omega);
-       9           0 :         setVw(V_w);
-      10           0 : }
-      11             : 
-      12           0 : Vector3d ArchimedeanSpiralField::getField(const Vector3d &pos) const {
-      13             :         
-      14             :         double r = pos.getR();
-      15           0 :         double theta = pos.getTheta();
-      16           0 :         double phi =pos.getPhi();
-      17             :         
-      18           0 :         double cos_phi = cos(phi);
-      19           0 :         double sin_phi = sin(phi);
-      20           0 :         double cos_theta = cos(theta);
-      21           0 :         double sin_theta = sin(theta);
-      22             : 
-      23             :         Vector3d B(0.);
-      24             : 
-      25             :         // radial direction
-      26           0 :         double C1 = R_0*R_0/r/r;
-      27           0 :         B.x += C1 * cos_phi * sin_theta;
-      28           0 :         B.y += C1 * sin_phi * sin_theta;
-      29           0 :         B.z += C1 * cos_theta;
-      30             :         
-      31             :         // azimuthal direction  
-      32           0 :         double C2 = - (Omega*R_0*R_0*sin_theta) / (r*V_w);
-      33           0 :         B.x += C2 * (-sin_phi);
-      34           0 :         B.y += C2 * cos_phi;
-      35             : 
-      36             :         // magnetic field switch at z = 0
-      37           0 :         if (pos.z<0.) {
-      38             :                 B *= -1;
-      39             :         }
-      40             : 
-      41             :         // overall scaling
-      42             :         B *= B_0;
-      43             :         
-      44             : 
-      45           0 :         return B;
-      46             : }
-      47             : 
-      48           0 : void ArchimedeanSpiralField::setR0(double R) {
-      49           0 :         R_0 = R;
-      50           0 :         return;
-      51             : }
-      52             : 
-      53           0 : void ArchimedeanSpiralField::setB0(double B) {
-      54           0 :         B_0 = B;
-      55           0 :         return;
-      56             : }
-      57             : 
-      58           0 : void ArchimedeanSpiralField::setOmega(double Om) {
-      59           0 :         Omega = Om;
-      60           0 :         return;
-      61             : }
-      62             : 
-      63           0 : void ArchimedeanSpiralField::setVw(double v) {
-      64           0 :         V_w = v;
-      65           0 :         return;
-      66             : }
-      67             : 
-      68             : 
-      69           0 : double ArchimedeanSpiralField::getR0() const {
-      70           0 :         return R_0;
-      71             : }
-      72             : 
-      73           0 : double ArchimedeanSpiralField::getB0() const{
-      74           0 :         return B_0;
-      75             : }
-      76             : 
-      77           0 : double ArchimedeanSpiralField::getOmega() const{
-      78           0 :         return Omega;
-      79             : }
-      80             : 
-      81           0 : double ArchimedeanSpiralField::getVw() const {
-      82           0 :         return V_w;
-      83             : }
-      84             : 
-      85             : 
-      86             : } //end namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/CMZField.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/CMZField.cpp.func-sort-c.html deleted file mode 100644 index 57aca7fcf..000000000 --- a/doc/coverageReport/src/magneticField/CMZField.cpp.func-sort-c.html +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/CMZField.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - CMZField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:10310796.3 %
Date:2024-04-08 14:58:22Functions:1818100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa8CMZField13setUseICFieldEb1
_ZN7crpropa8CMZField13setUseMCFieldEb1
_ZN7crpropa8CMZField14setUseNTFFieldEb1
_ZN7crpropa8CMZField14setUseRadioArcEb1
_ZNK7crpropa8CMZField10getICFieldERKNS_7Vector3IdEE1
_ZNK7crpropa8CMZField10getMCFieldERKNS_7Vector3IdEE1
_ZNK7crpropa8CMZField11getNTFFieldERKNS_7Vector3IdEE1
_ZNK7crpropa8CMZField16getRadioArcFieldERKNS_7Vector3IdEE1
_ZNK7crpropa8CMZField8getFieldERKNS_7Vector3IdEE1
_ZNK7crpropa8CMZField13getUseICFieldEv2
_ZNK7crpropa8CMZField13getUseMCFieldEv2
_ZNK7crpropa8CMZField14getUseNTFFieldEv2
_ZNK7crpropa8CMZField14getUseRadioArcEv2
_ZN7crpropa8CMZFieldC2Ev5
_ZNK7crpropa8CMZField4getAEd8
_ZNK7crpropa8CMZField4getLEd8
_ZNK7crpropa8CMZField4BPolERKNS_7Vector3IdEES4_ddd9
_ZNK7crpropa8CMZField3BAzERKNS_7Vector3IdEES4_ddd14
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/CMZField.cpp.func.html b/doc/coverageReport/src/magneticField/CMZField.cpp.func.html deleted file mode 100644 index d0edc51bc..000000000 --- a/doc/coverageReport/src/magneticField/CMZField.cpp.func.html +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/CMZField.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - CMZField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:10310796.3 %
Date:2024-04-08 14:58:22Functions:1818100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa8CMZField13setUseICFieldEb1
_ZN7crpropa8CMZField13setUseMCFieldEb1
_ZN7crpropa8CMZField14setUseNTFFieldEb1
_ZN7crpropa8CMZField14setUseRadioArcEb1
_ZN7crpropa8CMZFieldC2Ev5
_ZNK7crpropa8CMZField10getICFieldERKNS_7Vector3IdEE1
_ZNK7crpropa8CMZField10getMCFieldERKNS_7Vector3IdEE1
_ZNK7crpropa8CMZField11getNTFFieldERKNS_7Vector3IdEE1
_ZNK7crpropa8CMZField13getUseICFieldEv2
_ZNK7crpropa8CMZField13getUseMCFieldEv2
_ZNK7crpropa8CMZField14getUseNTFFieldEv2
_ZNK7crpropa8CMZField14getUseRadioArcEv2
_ZNK7crpropa8CMZField16getRadioArcFieldERKNS_7Vector3IdEE1
_ZNK7crpropa8CMZField3BAzERKNS_7Vector3IdEES4_ddd14
_ZNK7crpropa8CMZField4BPolERKNS_7Vector3IdEES4_ddd9
_ZNK7crpropa8CMZField4getAEd8
_ZNK7crpropa8CMZField4getLEd8
_ZNK7crpropa8CMZField8getFieldERKNS_7Vector3IdEE1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/CMZField.cpp.gcov.html b/doc/coverageReport/src/magneticField/CMZField.cpp.gcov.html deleted file mode 100644 index 20cf216cb..000000000 --- a/doc/coverageReport/src/magneticField/CMZField.cpp.gcov.html +++ /dev/null @@ -1,382 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/CMZField.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - CMZField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:10310796.3 %
Date:2024-04-08 14:58:22Functions:1818100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/magneticField/CMZField.h"
-       2             : #include "crpropa/Units.h"
-       3             : 
-       4             : namespace crpropa {
-       5             : 
-       6           5 : CMZField::CMZField() {
-       7           5 :     useMCField = false;
-       8           5 :     useICField = true;
-       9           5 :     useNTFField = false;
-      10           5 :     useRadioArc = false;
-      11           5 : }
-      12             : 
-      13           8 : double CMZField::getA(double a1) const {
-      14           8 :     return 4*log(2)/a1/a1;  
-      15             : }
-      16             : 
-      17           8 : double CMZField::getL(double a2) const {
-      18           8 :     return a2/2*log(2);
-      19             : }
-      20             : 
-      21           9 : Vector3d CMZField::BPol(const Vector3d& position,const Vector3d& mid, double B1, double a, double L) const{
-      22             :     // cylindircal coordinates
-      23             :     Vector3d pos = position - mid;
-      24           9 :     double r = sqrt(pos.x*pos.x + pos.y*pos.y);
-      25           9 :     double phi = std::atan2(pos.y, pos.x);
-      26             : 
-      27           9 :     double r1 = 1/(1+a*pos.z*pos.z);
-      28           9 :     double Bs = B1*exp(-r1*r/L);
-      29           9 :     double Br = 2*a*pow_integer<3>(r1)*r*pos.z*Bs;
-      30             :     
-      31             :     Vector3d b = Vector3d(0.);
-      32           9 :     b.z = r1*r1*Bs;
-      33             :     // transform to cartesian coordinates
-      34           9 :     b.x = Br*cos(phi);
-      35           9 :     b.y = Br*sin(phi);
-      36           9 :     return b;
-      37             : }
-      38             : 
-      39          14 : Vector3d CMZField::BAz(const Vector3d& position, const Vector3d& mid, double B1, double eta, double R) const {
-      40             :     // cylindrical coordinates
-      41             :     Vector3d pos = position - mid;
-      42          14 :     double r = sqrt(pos.x*pos.x + pos.y*pos.y);
-      43          14 :     double phi = std::atan2(pos.y,pos.x);
-      44             : 
-      45             :     Vector3d bVec(0.);
-      46          14 :     double Hc = R/sqrt(log(2));
-      47             :     double b = 1.;
-      48             :     double m = 1;
-      49          14 :     double r1 = R/10;
-      50          14 :     double v = m/eta*log((r+b)/(R+b));
-      51          14 :     double cosV = cos(v + m*phi);
-      52             : 
-      53             :     double Br=0;
-      54             :     double Bphi=0;
-      55             :     
-      56          14 :     if(r>r1){
-      57          13 :         double Pre = B1*cosV*exp(-pos.z*pos.z/Hc/Hc);
-      58          13 :         Br = Pre*R/r;
-      59          13 :         Bphi=-Pre/eta*R/(r+b);
-      60             :     }
-      61             :     else{
-      62           1 :         double Pre = B1*exp(-pos.z*pos.z/Hc/Hc)*R/r1*(3*r/r1 - 2*r*r/r1/r1)*cosV;
-      63             :         Br = Pre;
-      64           1 :         Bphi = 1 + 6*(r-r1)/(2*r-3*r1)*(sin(v+m*phi)-sin(v))/cosV;
-      65           1 :         Bphi *= -Pre*r/eta/(r+b);
-      66             :     }
-      67             : 
-      68          14 :     bVec.x = Br*cos(phi) - Bphi*sin(phi);
-      69          14 :     bVec.y = Br*sin(phi) + Bphi*cos(phi);
-      70             : 
-      71          14 :     return bVec;
-      72             : }
-      73             : 
-      74           2 : bool CMZField::getUseMCField() const {
-      75           2 :     return useMCField;
-      76             : }
-      77           2 : bool CMZField::getUseICField() const {
-      78           2 :     return useICField;
-      79             : }
-      80           2 : bool CMZField::getUseNTFField() const {
-      81           2 :     return useNTFField;
-      82             : }
-      83           2 : bool CMZField::getUseRadioArc() const {
-      84           2 :     return useRadioArc;
-      85             : }
-      86             : 
-      87           1 : void CMZField::setUseMCField(bool use) {
-      88           1 :     useMCField = use;
-      89           1 : }
-      90           1 : void CMZField::setUseICField(bool use) {
-      91           1 :     useICField = use;
-      92           1 : }
-      93           1 : void CMZField::setUseNTFField(bool use) {
-      94           1 :     useNTFField = use;
-      95           1 : }
-      96           1 : void CMZField::setUseRadioArc(bool use) {
-      97           1 :     useRadioArc = use;
-      98           1 : }
-      99             : 
-     100           1 : Vector3d CMZField::getMCField(const Vector3d& pos) const {//Field in molecular clouds
-     101             :     Vector3d b(0.);
-     102             :     double eta=0.01;
-     103             :     double N=59; // normalization factor, depends on eta
-     104             : 
-     105             :         // azimuthal component in dense clouds
-     106             :     //A=SgrC 
-     107             :     Vector3d mid(0,-81.59*pc, -16.32*pc);
-     108             :     double R = 1.7*pc; 
-     109             :     double B1=2.1e-3/N;
-     110           1 :     b += BAz(pos, mid, B1, eta, R);
-     111             : 
-     112             :     // A=G0.253+0.016 Dust Ridge A
-     113             :     mid = Vector3d(0, 37.53*pc, -2.37*pc);
-     114             :     R=2.4*pc; 
-     115             :     B1=2.5e-3/N;
-     116           1 :     b += BAz(pos, mid, B1, eta, R);
-     117             : 
-     118             :     //A=Dust Ridge B
-     119             :     mid = Vector3d(0, 50.44, 8.16)*pc;
-     120             :     R=1.9*pc; 
-     121             :     B1=0.9e-3/N;
-     122           1 :     b += BAz(pos, mid, B1, eta, R);
-     123             :     
-     124             :     //A=Dust Ridge C
-     125             :     mid = Vector3d(0,56.37,7.71)*pc;
-     126             :     R=1.9*pc; 
-     127             :     B1=1.2e-3/N;
-     128           1 :     b += BAz(pos, mid, B1, eta, R);
-     129             : 
-     130             :     //A=Dust Ridge D
-     131             :     mid = Vector3d(0, 60.82, 7.42)*pc;
-     132             :     R=3.3*pc; 
-     133             :     B1=1.7e-3/N;
-     134           1 :     b += BAz(pos, mid, B1, eta, R);
-     135             :     
-     136             :     //A=Dust Ridge E
-     137             :     mid = Vector3d(0, 70.91, 0.74)*pc;
-     138             :     R=3.5*pc; 
-     139             :     B1=4.1e-3/N;
-     140           1 :     b += BAz(pos, mid, B1, eta, R);
-     141             :         
-     142             :     //A=Dust Ridge F
-     143             :     mid = Vector3d(0, 73.58, 2.97)*pc;
-     144             :     R=2.4*pc; 
-     145             :     B1=3.9e-3/N;
-     146           1 :     b += BAz(pos, mid, B1, eta, R);
-     147             : 
-     148             :     //Sgr D
-     149             :     mid = Vector3d(0, 166.14, -10.38)*pc;
-     150             :     R=1.8*pc;
-     151             :     B1=0.8e-3/N;
-     152           1 :     b += BAz(pos, mid, B1, eta, R);
-     153             : 
-     154             :     //Sgr B2
-     155             :     mid = Vector3d(0, 97.01, -5.93)*pc;
-     156             :     R=14*pc; 
-     157             :     B1=1.0e-3/N;
-     158           1 :     b += BAz(pos, mid, B1, eta, R);
-     159             :         
-     160             :     //A=Inner R=5pc
-     161             :     mid = Vector3d(0, -8.3, -6.9)*pc;
-     162             :     R=5*pc; 
-     163             :     B1=3.0e-3/0.91;    
-     164           1 :     b += BAz(pos, mid, B1, 0.77, R); // different eta value!
-     165             : 
-     166             :     //20 km s^-1
-     167             :     mid = Vector3d(0, -19.29,-11.87)*pc;
-     168             :     R=9.4*pc; 
-     169             :     B1=2.7e-3/N;
-     170           1 :     b += BAz(pos, mid, B1, eta, R);    
-     171             :     
-     172             :     //50 km s^-1
-     173             :     mid = Vector3d(0, -2.97, -10.38)*pc;
-     174             :     R=9.4*pc; 
-     175             :     B1=3.7e-3/N;
-     176           1 :     b += BAz(pos, mid, B1, eta, R);    
-     177             :     
-     178             :     //SgrA* is different orrientated! 
-     179             :     //only phi component
-     180           1 :     double x = pos.x;
-     181           1 :     double y = pos.y + 8.3*pc;
-     182           1 :     double z = pos.z + 6.9*pc;
-     183             :     R=1.2e12; 
-     184             :     B1=65./3.07;
-     185             :     double Hc = R/sqrt(log(2));
-     186           1 :     double r = sqrt(x*x + y*y);
-     187             :     double r1 = R/10;
-     188           1 :     double phi= std::atan2(y,x);
-     189             :     double Bphi;
-     190             : 
-     191           1 :     if(r>r1){
-     192           1 :         Bphi = - B1*exp(-z*z/Hc/Hc)*R/r;
-     193             :     }
-     194             :     else{
-     195           0 :         - B1*exp(-z*z/Hc/Hc)*R/r1*(3*r/r1- 2*r*r/r1*r1);
-     196             :     }
-     197             : 
-     198           1 :     b.x -= Bphi*sin(phi);
-     199           1 :     b.y += Bphi*cos(phi);
-     200             : 
-     201           1 :     return b*gauss;
-     202             : } 
-     203             : 
-     204           1 : Vector3d CMZField::getICField(const Vector3d& pos) const {//Field in intercloud medium--> poloidal field
-     205             :     Vector3d mid(0.,-8.3*pc,-6.9*pc);
-     206             : 
-     207             :     double eta = 0.85;
-     208             :     double B1 = 1e-5*gauss;
-     209             :     double B2 = B1/eta;
-     210             :     double a = 4*log(2)/pow(70*pc, 2); 
-     211             :     double L = 158*pc/log(2);
-     212             : 
-     213           1 :     return BPol(pos, mid, B2, a, L);
-     214             : }                                                         
-     215             :   
-     216           1 : Vector3d CMZField::getNTFField(const Vector3d& pos) const {//Field in the non-thermal filaments--> predominantly poloidal field (except "pelical"-> azimuthal)
-     217             :     Vector3d b(0.); 
-     218             :     Vector3d mid(0.);
-     219             : 
-     220             :     //A=SgrC
-     221             :     mid = Vector3d(0., -81.59,-1.48)*pc;
-     222             :     double a1=27.44*pc;
-     223             :     double a2=1.73*pc;
-     224             :     double eta=0.48;
-     225             :     double B1=1.e-4;
-     226           1 :     b += BPol(pos, mid, B1/eta, getA(a1), getL(a2));
-     227             : 
-     228             :     //A=G359.15-0.2 The Snake
-     229             :     mid = Vector3d(0, -126.1,-25.22)*pc;
-     230             :     a1=12.86*pc;
-     231             :     a2=2.22*pc;
-     232             :     B1=88.e-6;
-     233           1 :     b += BPol(pos, mid, B1/eta, getA(a1), getL(a2));
-     234             : 
-     235             :     //A=G359.54+0.18 Nonthermal Filament
-     236             :     mid = Vector3d(0, -68.24,25.22)*pc;
-     237             :     a1=15.08*pc;
-     238             :     a2=2.72;
-     239             :     B1=1.e-3;
-     240           1 :     b += BPol(pos, mid, B1/eta, getA(a1), getL(a2));
-     241             : 
-     242             :     //A=G359.79 +17 Nonthermal Filament
-     243             :     mid = Vector3d(0,-31.15,23.74)*pc;
-     244             :     a1=16.07*pc;
-     245             :     a2=3.46*pc;
-     246             :     B1=1.e-3;
-     247           1 :     b += BPol(pos, mid, B1/eta, getA(a1), getL(a2));
-     248             : 
-     249             :     //A=G359.96 +0.09  Nonthermal Filament Southern Thread
-     250             :     mid = Vector3d(0, 5.93, 16.32)*pc;
-     251             :     a1=28.68*pc;
-     252             :     a2=1.73*pc;
-     253             :     B1=1.e-4;
-     254           1 :     b += BPol(pos, mid, B1/eta, getA(a1), getL(a2));
-     255             : 
-     256             :     //A=G0.09 +0.17  Nonthermal Filament Northern thread
-     257             :     mid = Vector3d(0, 13.35, 25.22)*pc;
-     258             :     a1=29.42*pc;
-     259             :     a2=2.23*pc;
-     260             :     B1=140.e-6;
-     261           1 :     b += BPol(pos, mid, B1/eta, getA(a1), getL(a2));
-     262             : 
-     263             :     //A=G359.85+0.47  Nonthermal Filament The Pelican  is not poloidal but azimuthal
-     264             :     mid = Vector3d(0, -22.25, 69.73)*pc;
-     265             :     a1=11.37*pc;
-     266             :     a2=2.23*pc;
-     267             :     B1=70.e-6 /eta;
-     268             :     // by and bz switched because pelican is differently oriented
-     269           1 :     Vector3d bPelican = BPol(pos, mid, B1/eta, getA(a1), getL(a2));
-     270           1 :     b.x += bPelican.x;
-     271           1 :     b.y += bPelican.z;
-     272           1 :     b.z += bPelican.y;
-     273             :     
-     274           1 :         return b*gauss;
-     275             : }
-     276             :   
-     277           1 : Vector3d CMZField::getRadioArcField(const Vector3d& pos) const {//Field in the non-thermal filaments--> predominantly poloidal field
-     278             :     //poloidal field in the non-thermal filament region A=RadioArc
-     279             :     double eta=0.48;
-     280             :     Vector3d mid(0,26.7*pc,10.38*pc);
-     281             :     double a1=70.47*pc;// arcmin-> deg->cm
-     282             :     double a2=9.89*pc;// arcmin-> deg-> cm
-     283             :     double B1=1.e-3;
-     284           1 :     return BPol(pos, mid, B1/eta, getA(a1), getL(a2))*gauss;
-     285             : }
-     286             : 
-     287           1 : Vector3d CMZField::getField(const Vector3d& pos) const{
-     288             :     Vector3d b(0.);
-     289             : 
-     290           1 :     if(useMCField){
-     291           0 :         b += getMCField(pos);
-     292             :     }
-     293           1 :     if(useICField){
-     294           1 :         b += getICField(pos);
-     295             :     }
-     296           1 :     if(useNTFField){
-     297           0 :         b += getNTFField(pos);
-     298             :     }
-     299           1 :     if(useRadioArc){
-     300           0 :         b += getRadioArcField(pos);
-     301             :     }
-     302             : 
-     303           1 :     return b;
-     304             : }
-     305             : 
-     306             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/JF12Field.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/JF12Field.cpp.func-sort-c.html deleted file mode 100644 index 4cfb03c01..000000000 --- a/doc/coverageReport/src/magneticField/JF12Field.cpp.func-sort-c.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/JF12Field.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - JF12Field.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:02310.0 %
Date:2024-04-08 14:58:22Functions:0290.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16PlanckJF12bFieldC2Ev0
_ZN7crpropa9JF12Field12setUseXFieldEb0
_ZN7crpropa9JF12Field13isUsingXFieldEv0
_ZN7crpropa9JF12Field14randomStriatedEi0
_ZN7crpropa9JF12Field15getStriatedGridEv0
_ZN7crpropa9JF12Field15randomTurbulentEi0
_ZN7crpropa9JF12Field15setStriatedGridENS_7ref_ptrINS_4GridIfEEEE0
_ZN7crpropa9JF12Field15setUseDiskFieldEb0
_ZN7crpropa9JF12Field16getTurbulentGridEv0
_ZN7crpropa9JF12Field16isUsingDiskFieldEv0
_ZN7crpropa9JF12Field16setTurbulentGridENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa9JF12Field18setUseRegularFieldEb0
_ZN7crpropa9JF12Field19isUsingRegularFieldEv0
_ZN7crpropa9JF12Field19setUseStriatedFieldEb0
_ZN7crpropa9JF12Field20isUsingStriatedFieldEv0
_ZN7crpropa9JF12Field20setUseTurbulentFieldEb0
_ZN7crpropa9JF12Field21isUsingTurbulentFieldEv0
_ZN7crpropa9JF12Field23setUseToroidalHaloFieldEb0
_ZN7crpropa9JF12Field24isUsingToroidalHaloFieldEv0
_ZN7crpropa9JF12FieldC2Ev0
_ZNK7crpropa9JF12Field12getDiskFieldERKdS2_S2_S2_S2_0
_ZNK7crpropa9JF12Field15getRegularFieldERKNS_7Vector3IdEE0
_ZNK7crpropa9JF12Field16getStriatedFieldERKNS_7Vector3IdEE0
_ZNK7crpropa9JF12Field16logisticFunctionERKdS2_S2_0
_ZNK7crpropa9JF12Field17getTurbulentFieldERKNS_7Vector3IdEE0
_ZNK7crpropa9JF12Field20getToroidalHaloFieldERKdS2_S2_S2_0
_ZNK7crpropa9JF12Field20getTurbulentStrengthERKNS_7Vector3IdEE0
_ZNK7crpropa9JF12Field8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa9JF12Field9getXFieldERKdS2_S2_S2_0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/JF12Field.cpp.func.html b/doc/coverageReport/src/magneticField/JF12Field.cpp.func.html deleted file mode 100644 index f4e99fdd5..000000000 --- a/doc/coverageReport/src/magneticField/JF12Field.cpp.func.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/JF12Field.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - JF12Field.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:02310.0 %
Date:2024-04-08 14:58:22Functions:0290.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16PlanckJF12bFieldC2Ev0
_ZN7crpropa9JF12Field12setUseXFieldEb0
_ZN7crpropa9JF12Field13isUsingXFieldEv0
_ZN7crpropa9JF12Field14randomStriatedEi0
_ZN7crpropa9JF12Field15getStriatedGridEv0
_ZN7crpropa9JF12Field15randomTurbulentEi0
_ZN7crpropa9JF12Field15setStriatedGridENS_7ref_ptrINS_4GridIfEEEE0
_ZN7crpropa9JF12Field15setUseDiskFieldEb0
_ZN7crpropa9JF12Field16getTurbulentGridEv0
_ZN7crpropa9JF12Field16isUsingDiskFieldEv0
_ZN7crpropa9JF12Field16setTurbulentGridENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa9JF12Field18setUseRegularFieldEb0
_ZN7crpropa9JF12Field19isUsingRegularFieldEv0
_ZN7crpropa9JF12Field19setUseStriatedFieldEb0
_ZN7crpropa9JF12Field20isUsingStriatedFieldEv0
_ZN7crpropa9JF12Field20setUseTurbulentFieldEb0
_ZN7crpropa9JF12Field21isUsingTurbulentFieldEv0
_ZN7crpropa9JF12Field23setUseToroidalHaloFieldEb0
_ZN7crpropa9JF12Field24isUsingToroidalHaloFieldEv0
_ZN7crpropa9JF12FieldC2Ev0
_ZNK7crpropa9JF12Field12getDiskFieldERKdS2_S2_S2_S2_0
_ZNK7crpropa9JF12Field15getRegularFieldERKNS_7Vector3IdEE0
_ZNK7crpropa9JF12Field16getStriatedFieldERKNS_7Vector3IdEE0
_ZNK7crpropa9JF12Field16logisticFunctionERKdS2_S2_0
_ZNK7crpropa9JF12Field17getTurbulentFieldERKNS_7Vector3IdEE0
_ZNK7crpropa9JF12Field20getToroidalHaloFieldERKdS2_S2_S2_0
_ZNK7crpropa9JF12Field20getTurbulentStrengthERKNS_7Vector3IdEE0
_ZNK7crpropa9JF12Field8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa9JF12Field9getXFieldERKdS2_S2_S2_0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/JF12Field.cpp.gcov.html b/doc/coverageReport/src/magneticField/JF12Field.cpp.gcov.html deleted file mode 100644 index 71e09d723..000000000 --- a/doc/coverageReport/src/magneticField/JF12Field.cpp.gcov.html +++ /dev/null @@ -1,452 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/JF12Field.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - JF12Field.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:02310.0 %
Date:2024-04-08 14:58:22Functions:0290.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/magneticField/JF12Field.h"
-       2             : #include "crpropa/Units.h"
-       3             : #include "crpropa/magneticField/turbulentField/SimpleGridTurbulence.h"
-       4             : #include "crpropa/Random.h"
-       5             : 
-       6             : namespace crpropa {
-       7             : 
-       8           0 : JF12Field::JF12Field() {
-       9           0 :         useRegularField = true;
-      10           0 :         useStriatedField = false;
-      11           0 :         useTurbulentField = false;
-      12           0 :         useDiskField = true;
-      13           0 :         useToroidalHaloField = true;
-      14           0 :         useXField = true;
-      15             : 
-      16             :         // spiral arm parameters
-      17           0 :         pitch = 11.5 * M_PI / 180;
-      18           0 :         sinPitch = sin(pitch);
-      19           0 :         cosPitch = cos(pitch);
-      20           0 :         tanPitch = tan(pitch);
-      21           0 :         cotPitch =  1. / tanPitch;
-      22           0 :         tan90MinusPitch = tan(M_PI / 2 - pitch);
-      23             : 
-      24           0 :         rArms[0] = 5.1 * kpc;
-      25           0 :         rArms[1] = 6.3 * kpc;
-      26           0 :         rArms[2] = 7.1 * kpc;
-      27           0 :         rArms[3] = 8.3 * kpc;
-      28           0 :         rArms[4] = 9.8 * kpc;
-      29           0 :         rArms[5] = 11.4 * kpc;
-      30           0 :         rArms[6] = 12.7 * kpc;
-      31           0 :         rArms[7] = 15.5 * kpc;
-      32             : 
-      33             :         // regular field parameters
-      34           0 :         bRing = 0.1 * muG;
-      35           0 :         hDisk = 0.40 * kpc;
-      36           0 :         wDisk = 0.27 * kpc;
-      37             : 
-      38           0 :         bDisk[0] = 0.1 * muG;
-      39           0 :         bDisk[1] = 3.0 * muG;
-      40           0 :         bDisk[2] = -0.9 * muG;
-      41           0 :         bDisk[3] = -0.8 * muG;
-      42           0 :         bDisk[4] = -2.0 * muG;
-      43           0 :         bDisk[5] = -4.2 * muG;
-      44           0 :         bDisk[6] = 0.0 * muG;
-      45           0 :         bDisk[7] = 2.7 * muG;
-      46             : 
-      47           0 :         bNorth = 1.4 * muG;
-      48           0 :         bSouth = -1.1 * muG;
-      49           0 :         rNorth = 9.22 * kpc;
-      50           0 :         rSouth = 17 * kpc;
-      51           0 :         wHalo = 0.20 * kpc;
-      52           0 :         z0 = 5.3 * kpc;
-      53             : 
-      54           0 :         bX = 4.6 * muG;
-      55           0 :         thetaX0 = 49.0 * M_PI / 180;
-      56           0 :         sinThetaX0 = sin(thetaX0);
-      57           0 :         cosThetaX0 = cos(thetaX0);
-      58           0 :         tanThetaX0 = tan(thetaX0);
-      59           0 :         cotThetaX0 = 1. / tanThetaX0;
-      60           0 :         rXc = 4.8 * kpc;
-      61           0 :         rX = 2.9 * kpc;
-      62             : 
-      63             :         // striated field parameter
-      64           0 :         sqrtbeta = sqrt(1.36);
-      65             : 
-      66             :         // turbulent field parameters
-      67           0 :         bDiskTurb[0] = 10.81 * muG;
-      68           0 :         bDiskTurb[1] = 6.96 * muG;
-      69           0 :         bDiskTurb[2] = 9.59 * muG;
-      70           0 :         bDiskTurb[3] = 6.96 * muG;
-      71           0 :         bDiskTurb[4] = 1.96 * muG;
-      72           0 :         bDiskTurb[5] = 16.34 * muG;
-      73           0 :         bDiskTurb[6] = 37.29 * muG;
-      74           0 :         bDiskTurb[7] = 10.35 * muG;
-      75             : 
-      76           0 :         bDiskTurb5 = 7.63 * muG;
-      77           0 :         zDiskTurb = 0.61 * kpc;
-      78             : 
-      79           0 :         bHaloTurb = 4.68 * muG;
-      80           0 :         rHaloTurb = 10.97 * kpc;
-      81           0 :         zHaloTurb = 2.84 * kpc;
-      82           0 : }
-      83             : 
-      84           0 : void JF12Field::randomStriated(int seed) {
-      85           0 :         useStriatedField = true;
-      86             :         int N = 100;
-      87           0 :         striatedGrid = new Grid1f(Vector3d(0.), N, 0.1 * kpc);
-      88             : 
-      89           0 :         Random random;
-      90           0 :         if (seed != 0)
-      91           0 :                 random.seed(seed);
-      92             : 
-      93           0 :         for (int ix = 0; ix < N; ix++)
-      94           0 :                 for (int iy = 0; iy < N; iy++)
-      95           0 :                         for (int iz = 0; iz < N; iz++) {
-      96           0 :                                 float &f = striatedGrid->get(ix, iy, iz);
-      97           0 :                                 f = round(random.rand()) * 2 - 1;
-      98             :                         }
-      99           0 : }
-     100             : 
-     101             : #ifdef CRPROPA_HAVE_FFTW3F
-     102           0 : void JF12Field::randomTurbulent(int seed) {
-     103           0 :         useTurbulentField = true;
-     104             :         // turbulent field with Kolmogorov spectrum, B_rms = 1 (will be scaled) and Lc = 60 parsec, and 256 grid points.
-     105             :         // Note that the inertial range of the turbulence is less than 2 orders of magnitude.
-     106             :     const double lMin = 8 * parsec;
-     107             :     const double lMax = 272 * parsec;
-     108             :     const double Brms = 1;
-     109             :     const double spacing = 4 * parsec;
-     110             :     const double grid_n = 256;
-     111             : 
-     112             :     auto spectrum = SimpleTurbulenceSpectrum(Brms, lMin, lMax);
-     113             :     auto gp = GridProperties(Vector3d(0.), grid_n, spacing);
-     114           0 :     auto tf = SimpleGridTurbulence(spectrum, gp, seed);
-     115           0 :     turbulentGrid = tf.getGrid();
-     116             : 
-     117           0 : }
-     118             : #endif
-     119             : 
-     120           0 : void JF12Field::setStriatedGrid(ref_ptr<Grid1f> grid) {
-     121           0 :         useStriatedField = true;
-     122           0 :         striatedGrid = grid;
-     123           0 : }
-     124             : 
-     125           0 : void JF12Field::setTurbulentGrid(ref_ptr<Grid3f> grid) {
-     126           0 :         useTurbulentField = true;
-     127           0 :         turbulentGrid = grid;
-     128           0 : }
-     129             : 
-     130           0 : ref_ptr<Grid1f> JF12Field::getStriatedGrid() {
-     131           0 :         return striatedGrid;
-     132             : }
-     133             : 
-     134           0 : ref_ptr<Grid3f> JF12Field::getTurbulentGrid() {
-     135           0 :         return turbulentGrid;
-     136             : }
-     137             : 
-     138           0 : void JF12Field::setUseRegularField(bool use) {
-     139           0 :         useRegularField = use;
-     140           0 : }
-     141             : 
-     142           0 : void JF12Field::setUseDiskField(bool use) {
-     143           0 :         useDiskField = use;
-     144           0 : }
-     145             : 
-     146           0 : void JF12Field::setUseToroidalHaloField(bool use) {
-     147           0 :         useToroidalHaloField = use;
-     148           0 : }
-     149             : 
-     150           0 : void JF12Field::setUseXField(bool use) {
-     151           0 :         useXField = use;
-     152           0 : }
-     153             : 
-     154           0 : void JF12Field::setUseStriatedField(bool use) {
-     155           0 :         if ((use) and !(striatedGrid)) {
-     156           0 :                 KISS_LOG_WARNING << "JF12Field: No striated field set: ignored. Run e.g. randomStriated().";
-     157           0 :                 return;
-     158             :         }
-     159           0 :         useStriatedField = use;
-     160             : }
-     161             : 
-     162           0 : void JF12Field::setUseTurbulentField(bool use) {
-     163           0 :         if ((use) and !(turbulentGrid)) {
-     164           0 :                 KISS_LOG_WARNING << "JF12Field: No turbulent field set: ignored. Run e.g. randomTurbulent().";
-     165           0 :                 return;
-     166             :         }
-     167           0 :         useTurbulentField = use;
-     168             : }
-     169             : 
-     170           0 : bool JF12Field::isUsingRegularField() {
-     171           0 :         return useRegularField;
-     172             : }
-     173             : 
-     174           0 : bool JF12Field::isUsingDiskField() {
-     175           0 :         return useDiskField;
-     176             : }
-     177             : 
-     178           0 : bool JF12Field::isUsingToroidalHaloField() {
-     179           0 :         return useToroidalHaloField;
-     180             : }
-     181             : 
-     182           0 : bool JF12Field::isUsingXField() {
-     183           0 :         return useXField;
-     184             : }
-     185             : 
-     186           0 : bool JF12Field::isUsingStriatedField() {
-     187           0 :         return useStriatedField;
-     188             : }
-     189             : 
-     190           0 : bool JF12Field::isUsingTurbulentField() {
-     191           0 :         return useTurbulentField;
-     192             : }
-     193             : 
-     194           0 : double JF12Field::logisticFunction(const double& x, const double& x0, const double& w) const {
-     195           0 :         return 1. / (1. + exp(-2. * (fabs(x) - x0) / w));
-     196             : }
-     197             : 
-     198           0 : Vector3d JF12Field::getRegularField(const Vector3d& pos) const {
-     199             :         Vector3d b(0.);
-     200             : 
-     201             :         double d = pos.getR(); // distance to galactic center
-     202             : 
-     203           0 :         if (d < 20 * kpc) {
-     204           0 :                 double r = sqrt(pos.x * pos.x + pos.y * pos.y); // in-plane radius
-     205           0 :                 double phi = pos.getPhi(); // azimuth
-     206           0 :                 double sinPhi = sin(phi);
-     207           0 :                 double cosPhi = cos(phi);
-     208             : 
-     209           0 :                 b += getDiskField(r, pos.z, phi, sinPhi, cosPhi);
-     210           0 :                 b += getToroidalHaloField(r, pos.z, sinPhi, cosPhi);
-     211           0 :                 b += getXField(r, pos.z, sinPhi, cosPhi);
-     212             :         }
-     213             : 
-     214           0 :         return b;
-     215             : }
-     216             : 
-     217           0 : Vector3d JF12Field::getDiskField(const double& r, const double& z, const double& phi, const double& sinPhi, const double& cosPhi) const {
-     218             :         Vector3d b(0.);
-     219           0 :         if (useDiskField) {
-     220           0 :                 double lfDisk = logisticFunction(z, hDisk, wDisk);
-     221           0 :                 if (r > 3 * kpc) {
-     222             :                         double bMag;
-     223           0 :                         if (r < 5 * kpc) {
-     224             :                                 // molecular ring
-     225           0 :                                 bMag = bRing * (5 * kpc / r) * (1 - lfDisk);
-     226           0 :                                 b.x += -bMag * sinPhi;
-     227           0 :                                 b.y += bMag * cosPhi;
-     228             :                         } else {
-     229             :                                 // spiral region
-     230           0 :                                 double r_negx = r * exp(-(phi - M_PI) / tan90MinusPitch);
-     231           0 :                                 if (r_negx > rArms[7])
-     232           0 :                                         r_negx = r * exp(-(phi + M_PI) / tan90MinusPitch);
-     233           0 :                                 if (r_negx > rArms[7])
-     234           0 :                                         r_negx = r * exp(-(phi + 3 * M_PI) / tan90MinusPitch);
-     235             : 
-     236           0 :                                 for (int i = 7; i >= 0; i--)
-     237           0 :                                         if (r_negx < rArms[i])
-     238           0 :                                                 bMag = bDisk[i];
-     239             : 
-     240           0 :                                 bMag *= (5 * kpc / r) * (1 - lfDisk);
-     241           0 :                                 b.x += bMag * (sinPitch * cosPhi - cosPitch * sinPhi);
-     242           0 :                                 b.y += bMag * (sinPitch * sinPhi + cosPitch * cosPhi);
-     243             :                         }
-     244             :                 }
-     245             :         }
-     246           0 :         return b;
-     247             : }
-     248             : 
-     249           0 : Vector3d JF12Field::getToroidalHaloField(const double& r, const double& z, const double& sinPhi, const double& cosPhi) const {
-     250             :         Vector3d b(0.);
-     251             : 
-     252           0 :         if (useToroidalHaloField && (r * r + z * z > 1 * kpc * kpc)){
-     253             : 
-     254           0 :                 double lfDisk = logisticFunction(z, hDisk, wDisk);
-     255           0 :                 double bMagH = exp(-fabs(z) / z0) * lfDisk;
-     256             : 
-     257           0 :                 if (z >= 0)
-     258           0 :                         bMagH *= bNorth * (1 - logisticFunction(r, rNorth, wHalo));
-     259             :                 else
-     260           0 :                         bMagH *= bSouth * (1 - logisticFunction(r, rSouth, wHalo));
-     261           0 :                 b.x += -bMagH * sinPhi;
-     262           0 :                 b.y += bMagH * cosPhi;
-     263             :         }
-     264           0 :         return b;
-     265             : }
-     266             : 
-     267           0 : Vector3d JF12Field::getXField(const double& r, const double& z, const double& sinPhi, const double& cosPhi) const {
-     268             :         Vector3d b(0.);
-     269             : 
-     270           0 :         if (useXField && (r * r + z * z > 1 * kpc * kpc)){
-     271             :                 double bMagX;
-     272             :                 double sinThetaX, cosThetaX;
-     273             :                 double rp;
-     274           0 :                 double rc = rXc + fabs(z) / tanThetaX0;
-     275           0 :                 if (r < rc) {
-     276             :                         // varying elevation region
-     277           0 :                         rp = r * rXc / rc;
-     278           0 :                         bMagX = bX * exp(-1 * rp / rX) * pow(rXc / rc, 2.);
-     279           0 :                         double thetaX = atan2(fabs(z), (r - rp));
-     280           0 :                         if (z == 0)
-     281             :                                 thetaX = M_PI / 2.;
-     282           0 :                         sinThetaX = sin(thetaX);
-     283           0 :                         cosThetaX = cos(thetaX);
-     284             :                 } else {
-     285             :                         // constant elevation region
-     286           0 :                         rp = r - fabs(z) / tanThetaX0;
-     287           0 :                         bMagX = bX * exp(-rp / rX) * (rp / r);
-     288           0 :                         sinThetaX = sinThetaX0;
-     289           0 :                         cosThetaX = cosThetaX0;
-     290             :                 }
-     291           0 :                 double zsign = z < 0 ? -1 : 1;
-     292           0 :                 b.x += zsign * bMagX * cosThetaX * cosPhi;
-     293           0 :                 b.y += zsign * bMagX * cosThetaX * sinPhi;
-     294           0 :                 b.z += bMagX * sinThetaX;
-     295             :         }
-     296           0 :         return b;
-     297             : }
-     298             : 
-     299           0 : Vector3d JF12Field::getStriatedField(const Vector3d& pos) const {
-     300           0 :         return (getRegularField(pos)
-     301           0 :                         * (1. + sqrtbeta * striatedGrid->closestValue(pos)));
-     302             : }
-     303             : 
-     304           0 : double JF12Field::getTurbulentStrength(const Vector3d& pos) const {
-     305           0 :         if (pos.getR() > 20 * kpc)
-     306             :                 return 0;
-     307             : 
-     308           0 :         double r = sqrt(pos.x * pos.x + pos.y * pos.y); // in-plane radius
-     309           0 :         double phi = pos.getPhi(); // azimuth
-     310             : 
-     311             :         // disk
-     312             :         double bDisk = 0;
-     313           0 :         if (r < 5 * kpc) {
-     314           0 :                 bDisk = bDiskTurb5;
-     315             :         } else {
-     316             :                 // spiral region
-     317           0 :                 double r_negx = r * exp(-(phi - M_PI) / tan90MinusPitch);
-     318           0 :                 if (r_negx > rArms[7])
-     319           0 :                         r_negx = r * exp(-(phi + M_PI) / tan90MinusPitch);
-     320           0 :                 if (r_negx > rArms[7])
-     321           0 :                         r_negx = r * exp(-(phi + 3 * M_PI) / tan90MinusPitch);
-     322             : 
-     323           0 :                 for (int i = 7; i >= 0; i--)
-     324           0 :                         if (r_negx < rArms[i])
-     325           0 :                                 bDisk = bDiskTurb[i];
-     326             : 
-     327           0 :                 bDisk *= (5 * kpc) / r;
-     328             :         }
-     329           0 :         bDisk *= exp(-0.5 * pow(pos.z / zDiskTurb, 2));
-     330             : 
-     331             :         // halo
-     332           0 :         double bHalo = bHaloTurb * exp(-r / rHaloTurb)
-     333           0 :                         * exp(-0.5 * pow(pos.z / zHaloTurb, 2));
-     334             : 
-     335             :         // modulate turbulent field
-     336           0 :         return sqrt(pow(bDisk, 2) + pow(bHalo, 2));
-     337             : }
-     338             : 
-     339           0 : Vector3d JF12Field::getTurbulentField(const Vector3d& pos) const {
-     340           0 :         return (turbulentGrid->interpolate(pos) * getTurbulentStrength(pos));
-     341             : }
-     342             : 
-     343           0 : Vector3d JF12Field::getField(const Vector3d& pos) const {
-     344             :         Vector3d b(0.);
-     345           0 :         if (useTurbulentField)
-     346           0 :                 b += getTurbulentField(pos);
-     347           0 :         if (useStriatedField)
-     348           0 :                 b += getStriatedField(pos);
-     349           0 :         else if (useRegularField)
-     350           0 :                 b += getRegularField(pos);
-     351           0 :         return b;
-     352             : }
-     353             : 
-     354             : 
-     355             : 
-     356           0 : PlanckJF12bField::PlanckJF12bField() : JF12Field::JF12Field(){
-     357             :         // regular field parameters
-     358           0 :         bDisk[5] = -3.5 * muG;
-     359           0 :         bX = 1.8 * muG;
-     360             : 
-     361             :         // turbulent field parameters;
-     362           0 :         bDiskTurb[0] = 3.12 * muG;
-     363           0 :         bDiskTurb[1] = 6.24 * muG;
-     364           0 :         bDiskTurb[2] = 3.12 * muG;
-     365           0 :         bDiskTurb[3] = 6.24 * muG;
-     366           0 :         bDiskTurb[4] = 3.12 * muG;
-     367           0 :         bDiskTurb[5] = 6.24 * muG;
-     368           0 :         bDiskTurb[6] = 3.12 * muG;
-     369           0 :         bDiskTurb[7] = 6.24 * muG;
-     370             : 
-     371           0 :         bDiskTurb5 = 3.90 * muG;
-     372             : 
-     373           0 :         bHaloTurb = 7.332 * muG;
-     374           0 : }
-     375             : 
-     376             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/JF12FieldSolenoidal.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/JF12FieldSolenoidal.cpp.func-sort-c.html deleted file mode 100644 index 5057574e8..000000000 --- a/doc/coverageReport/src/magneticField/JF12FieldSolenoidal.cpp.func-sort-c.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/JF12FieldSolenoidal.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - JF12FieldSolenoidal.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:01420.0 %
Date:2024-04-08 14:58:22Functions:0140.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa19JF12FieldSolenoidal15setXScaleHeightEd0
_ZN7crpropa19JF12FieldSolenoidal19setUseStriatedFieldEb0
_ZN7crpropa19JF12FieldSolenoidal20setUseTurbulentFieldEb0
_ZN7crpropa19JF12FieldSolenoidal22setDiskTransitionWidthEd0
_ZN7crpropa19JF12FieldSolenoidal25deactivateOuterTransitionEv0
_ZN7crpropa19JF12FieldSolenoidalC2Edd0
_ZNK7crpropa19JF12FieldSolenoidal12getDiskFieldERKdS2_S2_S2_S2_0
_ZNK7crpropa19JF12FieldSolenoidal15getHPhiIntegralERKdS2_0
_ZNK7crpropa19JF12FieldSolenoidal15getXScaleHeightEv0
_ZNK7crpropa19JF12FieldSolenoidal22getDiskTransitionWidthEv0
_ZNK7crpropa19JF12FieldSolenoidal27getDiskTransitionPolynomialERKd0
_ZNK7crpropa19JF12FieldSolenoidal30getSpiralFieldStrengthConstantERKdS2_0
_ZNK7crpropa19JF12FieldSolenoidal37getDiskTransitionPolynomialDerivativeERKd0
_ZNK7crpropa19JF12FieldSolenoidal9getXFieldERKdS2_S2_S2_0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/JF12FieldSolenoidal.cpp.func.html b/doc/coverageReport/src/magneticField/JF12FieldSolenoidal.cpp.func.html deleted file mode 100644 index 539e7551e..000000000 --- a/doc/coverageReport/src/magneticField/JF12FieldSolenoidal.cpp.func.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/JF12FieldSolenoidal.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - JF12FieldSolenoidal.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:01420.0 %
Date:2024-04-08 14:58:22Functions:0140.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa19JF12FieldSolenoidal15setXScaleHeightEd0
_ZN7crpropa19JF12FieldSolenoidal19setUseStriatedFieldEb0
_ZN7crpropa19JF12FieldSolenoidal20setUseTurbulentFieldEb0
_ZN7crpropa19JF12FieldSolenoidal22setDiskTransitionWidthEd0
_ZN7crpropa19JF12FieldSolenoidal25deactivateOuterTransitionEv0
_ZN7crpropa19JF12FieldSolenoidalC2Edd0
_ZNK7crpropa19JF12FieldSolenoidal12getDiskFieldERKdS2_S2_S2_S2_0
_ZNK7crpropa19JF12FieldSolenoidal15getHPhiIntegralERKdS2_0
_ZNK7crpropa19JF12FieldSolenoidal15getXScaleHeightEv0
_ZNK7crpropa19JF12FieldSolenoidal22getDiskTransitionWidthEv0
_ZNK7crpropa19JF12FieldSolenoidal27getDiskTransitionPolynomialERKd0
_ZNK7crpropa19JF12FieldSolenoidal30getSpiralFieldStrengthConstantERKdS2_0
_ZNK7crpropa19JF12FieldSolenoidal37getDiskTransitionPolynomialDerivativeERKd0
_ZNK7crpropa19JF12FieldSolenoidal9getXFieldERKdS2_S2_S2_0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/JF12FieldSolenoidal.cpp.gcov.html b/doc/coverageReport/src/magneticField/JF12FieldSolenoidal.cpp.gcov.html deleted file mode 100644 index ae5d894a4..000000000 --- a/doc/coverageReport/src/magneticField/JF12FieldSolenoidal.cpp.gcov.html +++ /dev/null @@ -1,378 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/JF12FieldSolenoidal.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - JF12FieldSolenoidal.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:01420.0 %
Date:2024-04-08 14:58:22Functions:0140.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/magneticField/JF12FieldSolenoidal.h"
-       2             : #include "crpropa/Units.h"
-       3             : #include "crpropa/GridTools.h"
-       4             : #include "crpropa/Random.h"
-       5             : 
-       6             : namespace crpropa {
-       7             : 
-       8           0 : JF12FieldSolenoidal::JF12FieldSolenoidal(double delta, double zs) {
-       9           0 :         zS = zs; // set scale heigth for the parabolic X field lines
-      10           0 :         r1 = 5 * kpc; // inner boundary of the disk field
-      11           0 :         r2 = 20 * kpc; // outer boudary of the disk field
-      12           0 :         r1s = r1 + delta; // the magnetic flux of the spirals is redirected for r in [r1,r1s]
-      13           0 :         r2s = r2 - delta; // same here at outer boundary between r2s and r2
-      14           0 :         phi0 = 0.; // somewhat arbitrary choice, has to be chosen in [-pi,pi]
-      15             : 
-      16           0 :         for (int i = 1;i < 9; i++){
-      17             :                 // fill the array with angles in [-pi,pi] where the 8 spiral arms intersect the r1 - ring
-      18             :                 // indexing starts at 1 to match the indexing in the papers on the JF12 field!
-      19           0 :                 phi0Arms[i] = M_PI - cotPitch * log(rArms[i-1] / r1);
-      20             :         }
-      21             : 
-      22             :         // cyclic closure of the array, with next values periodically continued
-      23             :         // outside [-pi,pi] to simplify looping and searching for correct spiral arms
-      24           0 :         phi0Arms[0] = phi0Arms[8] + 2 * M_PI;
-      25           0 :         phi0Arms[9] = phi0Arms[1] - 2 * M_PI;
-      26           0 :         phi0Arms[10] = phi0Arms[2] - 2 *M_PI;
-      27             : 
-      28             :         // determine the position of phi0 in the array, i.e. find the correct spiral arm.
-      29             :         int idx0 = 1; // corresponding index in phi0Arms such that phi0Arms[idx0] < phi0 < phi0Arms[idx0-1]
-      30           0 :         while (phi0 < phi0Arms[idx0]){
-      31           0 :                 idx0 += 1; // search clockwise, starting with the check if phi0Arms[1] < phi0 < phi0Arms[0]
-      32             :         }
-      33             : 
-      34             :         // fill the bDisk array with spiral field strengths at r = r1.
-      35             :         // note the indexing starting with 1 here to match the indexing in the JF12 papers!
-      36             :         // for a position (r1,phi), phi in [-pi,pi], the correct field strength is given by
-      37             :         // bDisk[i] if phi0Arms[i] < phi0 < phi0Arms[i-1].
-      38           0 :         bDisk[1] = 0.1 * muG;
-      39           0 :         bDisk[2] = 3.0 * muG;
-      40           0 :         bDisk[3] = -0.9 * muG;
-      41           0 :         bDisk[4] = -0.8 * muG;
-      42           0 :         bDisk[5] = -2.0 * muG;
-      43           0 :         bDisk[6] = -4.2 * muG;
-      44           0 :         bDisk[7] = 0.0 * muG;
-      45             : 
-      46             :         // re-compute b_8 for actual (net flux = 0)-correction of the spiral field with minimal round-off errors
-      47             :         double flux1to7 = 0.;
-      48           0 :         for (int i = 1; i < 8; i++){
-      49           0 :                 flux1to7 += (phi0Arms[i-1] - phi0Arms[i]) * bDisk[i];
-      50             :         }
-      51           0 :         bDisk[8] = -flux1to7 / (phi0Arms[7] - phi0Arms[8]);
-      52             : 
-      53           0 :         bDisk[0] = bDisk[8]; // again close the array periodically
-      54           0 :         bDisk[9] = bDisk[1];
-      55           0 :         bDisk[10] = bDisk[2];
-      56             : 
-      57             :         // set coefficients for the evaluation of the phi-integral over the piecewise constant field strengths at r=r1
-      58             :         // such that it may be evaluated as H(phi) = phiCoeff[j] + bDisk[j] * phi later on
-      59             :         // start integration at phi0Arms[0] first, shift to lower integration boundary phi0 later
-      60           0 :         phiCoeff[0] = 0;
-      61           0 :         for (int i = 1; i < 10; i++){
-      62           0 :                 phiCoeff[i] = phiCoeff[i-1] + (bDisk[i-1] - bDisk[i]) * phi0Arms[i-1];
-      63             :         }
-      64             : 
-      65             :         // correct for H(phi0) = 0
-      66           0 :         corr = phiCoeff[idx0] + bDisk[idx0] * phi0;
-      67           0 :         for (int i = 1; i < 10; i++){
-      68           0 :                 phiCoeff[i] = phiCoeff[i] - corr;
-      69             :         }
-      70           0 : }
-      71             : 
-      72           0 : void JF12FieldSolenoidal::setDiskTransitionWidth(double delta) {
-      73           0 :         r1s = r1 + delta;
-      74           0 :         r2s = r2 - delta;
-      75           0 : }
-      76             : 
-      77           0 : void JF12FieldSolenoidal::setXScaleHeight(double zs) {
-      78           0 :         zS = zs;
-      79           0 : }
-      80             : 
-      81           0 : double JF12FieldSolenoidal::getDiskTransitionWidth() const {
-      82           0 :         return (r1s - r1);
-      83             : }
-      84             : 
-      85           0 : double JF12FieldSolenoidal::getXScaleHeight() const {
-      86           0 :         return zS;
-      87             : }
-      88             : 
-      89           0 : void JF12FieldSolenoidal::deactivateOuterTransition() {
-      90           0 :         r2s = r2;
-      91           0 : }
-      92             : 
-      93           0 : void JF12FieldSolenoidal::setUseStriatedField(bool use) {
-      94           0 :         if ((use) and (striatedGrid)) {
-      95           0 :                 KISS_LOG_WARNING << "JF12FieldSolenoidal: No striated field set: ignored.";
-      96           0 :                 return;
-      97             :         }
-      98           0 :         useStriatedField = use;
-      99             : }
-     100             : 
-     101           0 : void JF12FieldSolenoidal::setUseTurbulentField(bool use) {
-     102           0 :         if ((use) and (turbulentGrid)) {
-     103           0 :                 KISS_LOG_WARNING << "JF12FieldSolenoidal: No turbulent field set: ignored.";
-     104           0 :                 return;
-     105             :         }
-     106           0 :         useTurbulentField = use;
-     107             : }
-     108             : 
-     109           0 : Vector3d JF12FieldSolenoidal::getDiskField(const double& r, const double& z, const double& phi, const double& sinPhi, const double& cosPhi) const {
-     110             :         Vector3d b(0.);
-     111             : 
-     112           0 :         if (useDiskField){
-     113           0 :                 double lfDisk = logisticFunction(z, hDisk, wDisk); // for vertical scaling as in initial JF12
-     114             : 
-     115           0 :                 double hint = getHPhiIntegral(r, phi); // phi integral to restore solenoidality in transition region, only enters if r is in [r1,r1s] or [r2s,r2]
-     116           0 :                 double mag1 = getSpiralFieldStrengthConstant(r, phi); // returns bDisk[j] for the current spiral arm
-     117             : 
-     118           0 :                 if ((r1 < r) && (r < r2)) {
-     119           0 :                         double pdelta = getDiskTransitionPolynomial(r);
-     120           0 :                         double qdelta = getDiskTransitionPolynomialDerivative(r);
-     121           0 :                         double br = pdelta * mag1 * sinPitch;
-     122           0 :                         double bphi = pdelta * mag1 * cosPitch - qdelta * hint * sinPitch;
-     123             : 
-     124           0 :                         b.x += br * cosPhi - bphi * sinPhi;
-     125           0 :                         b.y += br * sinPhi + bphi * cosPhi;
-     126             : 
-     127           0 :                         b *= (1 - lfDisk);
-     128             :                 }
-     129             :         }
-     130           0 :         return b;
-     131             : }
-     132             : 
-     133           0 : Vector3d JF12FieldSolenoidal::getXField(const double& r, const double& z, const double& sinPhi, const double& cosPhi) const {
-     134             :         Vector3d b(0.);
-     135             : 
-     136           0 :         if (useXField){
-     137             :                 double bMagX;
-     138             :                 double sinThetaX, cosThetaX;
-     139             :                 double rp; // radius where current intial field line passes z = 0
-     140           0 :                 double rc = rXc + fabs(z) / tanThetaX0;
-     141           0 :                 double r0c = rXc + zS / tanThetaX0; // radius where field line through rXc passes z = zS
-     142             :                 double f, r0, br0, bz0;
-     143             :                 bool inner = true; // distinguish between inner and outer region
-     144             : 
-     145             :                 // return intial field if z>=zS
-     146           0 :                 if (fabs(z) > zS){
-     147           0 :                         if ((r == 0.)){
-     148           0 :                                 b.z = bX / ((1. + fabs(z) * cotThetaX0 / rXc) * (1. + fabs(z) * cotThetaX0 / rXc));
-     149           0 :                                 return b;
-     150             :                         }
-     151             : 
-     152           0 :                         if (r < rc) {
-     153             :                         // inner varying elevation region
-     154           0 :                                 rp = r * rXc / rc;
-     155           0 :                                 bMagX = bX * exp(-1 * rp / rX) * (rXc / rc) * (rXc / rc);
-     156             : 
-     157           0 :                                 double thetaX = atan(fabs(z) / (r - rp));
-     158             : 
-     159           0 :                                 if (z == 0)
-     160             :                                         thetaX = M_PI / 2.;
-     161             : 
-     162           0 :                                 sinThetaX = sin(thetaX);
-     163           0 :                                 cosThetaX = cos(thetaX);
-     164             :                         }
-     165             :                         else {
-     166             :                         // outer constant elevation region
-     167           0 :                                 rp = r - fabs(z) / tanThetaX0;
-     168           0 :                                 bMagX = bX * exp(-rp / rX) * (rp / r);
-     169             : 
-     170           0 :                                 sinThetaX = sinThetaX0;
-     171           0 :                                 cosThetaX = cosThetaX0;
-     172             :                         }
-     173           0 :                         double zsign = z < 0 ? -1 : 1;
-     174           0 :                         b.x += zsign * bMagX * cosThetaX * cosPhi;
-     175           0 :                         b.y += zsign * bMagX * cosThetaX * sinPhi;
-     176           0 :                         b.z += bMagX * sinThetaX;
-     177             :                 }
-     178             :                 // parabolic field lines for z<zS
-     179             :                 else {
-     180             :                                 // determine r at which parabolic field line through (r,z) passes z = zS
-     181           0 :                                 r0 = r * 1. / (1.- 1./ (2. * (zS + rXc * tanThetaX0)) * (zS - z * z / zS));
-     182             : 
-     183             :                                 // determine correct region (inner/outer)
-     184             :                                 // and compute factor F for solenoidality
-     185           0 :                                 if (r0 >= r0c){
-     186           0 :                                         r0 = r + 1. / (2. * tanThetaX0) * (zS - z * z / zS);
-     187           0 :                                         f = 1. + 1/ (2 * r * tanThetaX0/ zS) * (1. - (z / zS) * (z / zS));
-     188             :                                 }
-     189             :                                 else
-     190             :                                 {
-     191           0 :                                          f = 1. / ((1. - 1./( 2. + 2. * (rXc * tanThetaX0/ zS)) * (1. - (z / zS) * (z / zS))) * (1. - 1./( 2. + 2. * (rXc * tanThetaX0/ zS)) * (1. - (z / zS) * (z / zS))));
-     192             :                                 }
-     193             : 
-     194             :                                 // field strength at that position
-     195           0 :                                 if (r0 < r0c){
-     196           0 :                                          rp = r0 * rXc / r0c;
-     197           0 :                                          double thetaX = atan(zS / (r0 - rp));
-     198             : 
-     199             :                                          // field strength at (r0,zS) for inner region
-     200           0 :                                          br0 = bX * exp(- rp / rX) * (rXc/ r0c) * (rXc/ r0c) * cos(thetaX);
-     201           0 :                                          bz0 = bX * exp(- rp / rX) * (rXc/ r0c) * (rXc/ r0c) * sin(thetaX);
-     202             :                                  }
-     203             :                                  else {
-     204             :                                          // field strength at (r0,zS) for outer region
-     205           0 :                                          rp = r0 - zS / tanThetaX0;
-     206           0 :                                          br0 =  bX * exp(- rp / rX) * (rp/r0) * cosThetaX0;
-     207           0 :                                          bz0 =  bX * exp(- rp / rX) * (rp/r0) * sinThetaX0;
-     208             :                                  }
-     209             : 
-     210           0 :                                  double br = z / zS * f * br0;
-     211           0 :                                  double bz = bz0 * f;
-     212             : 
-     213           0 :                                  b.x += br * cosPhi;
-     214           0 :                                  b.y += br * sinPhi;
-     215           0 :                                  b.z += bz;
-     216             :                 }
-     217             :         }
-     218             :         return b;
-     219             : }
-     220             : 
-     221           0 : double JF12FieldSolenoidal::getDiskTransitionPolynomial(const double& r) const {
-     222             :         // 0 disk field outside
-     223           0 :         if ((r < r1) || (r > r2)) {
-     224             :                 return 0.;
-     225             :         }
-     226             :         // unchanged field
-     227           0 :         if ((r > r1s) && (r < r2s)) {
-     228           0 :                 return r1/r;
-     229             :         }
-     230             :         // transitions region parameters
-     231             :         double r_a = r1;
-     232             :         double r_b = r1s;
-     233             : 
-     234           0 :         if (r >= r2s) {
-     235             :                 r_a = r2;
-     236             :                 r_b = r2s;
-     237             :         }
-     238             :         // differentiable transition at r_s, continous at r_a
-     239           0 :         double fakt = (r_a / r_b - 2.) / ((r_a - r_b) *  (r_a - r_b));
-     240           0 :         return (r1/r_b) * (2. - r / r_b + fakt * (r-r_b) * (r-r_b));
-     241             : }
-     242             : 
-     243           0 : double JF12FieldSolenoidal::getDiskTransitionPolynomialDerivative(const double& r) const {
-     244             :         // 0 disk field outside
-     245           0 :         if ((r < r1) || (r > r2)) {
-     246             :                 return 0.;
-     247             :         }
-     248             :         // unchanged field
-     249           0 :         if ((r > r1s) && (r < r2s)) {
-     250             :                 return 0.;
-     251             :         }
-     252             :         // transitions region parameters
-     253             :         double r_a = r1;
-     254             :         double r_b = r1s;
-     255             : 
-     256           0 :         if (r >= r2s) {
-     257             :                 r_a = r2;
-     258             :                 r_b = r2s;
-     259             :         }
-     260             :         // differentiable transition polynomial at r_s, continous at r_a
-     261           0 :         double fakt = (r_a / r_b - 2.) / ((r_a - r_b) * (r_a - r_b));
-     262           0 :         return (r1/r_b) * (2. - 2. * r/r_b + fakt * (3. * r * r - 4. * r * r_b + r_b * r_b));
-     263             : }
-     264             : 
-     265           0 : double JF12FieldSolenoidal::getHPhiIntegral(const double& r, const double& phi) const {
-     266             :         // Evaluates the H(phi1) integral for solenoidality for the position (r,phi) which is mapped back to (r1=5kpc,phi1)
-     267             :         // along the spiral field line.
-     268             :         double H_ret = 0.;
-     269             : 
-     270           0 :         if ((r1 < r) && (r < r2)){
-     271             :                 // find index of the correct spiral arm for (r1,phi1) just like in getSpiralFieldStrengthConstant
-     272             :                 int idx = 1;
-     273           0 :                 double phi1 = phi - log(r/r1) * cotPitch;
-     274           0 :                 phi1 = atan2(sin(phi1), cos(phi1));
-     275           0 :                 while (phi1 < phi0Arms[idx]){
-     276           0 :                         idx += 1;
-     277             :                 }
-     278           0 :                 H_ret = phi1 * bDisk[idx] + phiCoeff[idx];
-     279             :         }
-     280           0 :         return H_ret;
-     281             : }
-     282             : 
-     283           0 : double JF12FieldSolenoidal::getSpiralFieldStrengthConstant(const double& r, const double& phi) const {
-     284             :         // For a given position (r, phi) in polar coordinates, this method returns the field strength
-     285             :         // of the spiral field at r1 = 5 kpc for the magnetic spiral arm where (r, phi) is located.
-     286             :         // The method first computes the angle phi1 at which the spiral field line passing through (r, phi) intersects
-     287             :         // the circle with radius r1 = 5 kpc. Afterwards, the correct spiral arm is found by searching the index idx
-     288             :         // such that phi0Arms[idx] < phi1 < phi0Arms[idx-1]. The correct field strength of the respective spiral arm
-     289             :         // where (r, phi) is located is then given as bDisk[idx].
-     290             :         double b_ret = 0.;
-     291             :         int idx = 1;
-     292           0 :         if ((r1 < r) && (r < r2)){
-     293           0 :                 double phi1 = phi - log(r/r1) * cotPitch; // map the position (r, phi) to (5 kpc, phi1) along the logarithmic spiral field line
-     294           0 :                 phi1 = atan2(sin(phi1), cos(phi1)); // map this angle to [-pi,+pi]
-     295           0 :                 while (phi1 < phi0Arms[idx]){
-     296           0 :                         idx += 1; // run clockwise through the spiral arms; the cyclic closure of phi0Arms[9] = phi0Arms[1] - 2 pi is needed if -pi <= phi1 <= phi0Arms[8].
-     297             :                 }
-     298           0 :                 b_ret = bDisk[idx];
-     299             :         }
-     300           0 :         return b_ret;
-     301             : }
-     302             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/MagneticField.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/MagneticField.cpp.func-sort-c.html deleted file mode 100644 index b8384f639..000000000 --- a/doc/coverageReport/src/magneticField/MagneticField.cpp.func-sort-c.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/MagneticField.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - MagneticField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:486672.7 %
Date:2024-04-08 14:58:22Functions:91656.2 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa21PeriodicMagneticField10getExtendsEv0
_ZN7crpropa21PeriodicMagneticField10setExtendsERKNS_7Vector3IdEE0
_ZN7crpropa21PeriodicMagneticField12isReflectiveEv0
_ZN7crpropa21PeriodicMagneticField13setReflectiveEb0
_ZN7crpropa21PeriodicMagneticField9getOriginEv0
_ZN7crpropa21PeriodicMagneticField9setOriginERKNS_7Vector3IdEE0
_ZN7crpropa21PeriodicMagneticFieldC2ENS_7ref_ptrINS_13MagneticFieldEEERKNS_7Vector3IdEE0
_ZN7crpropa21PeriodicMagneticFieldC2ENS_7ref_ptrINS_13MagneticFieldEEERKNS_7Vector3IdEES7_b1
_ZN7crpropa22MagneticFieldEvolutionC2ENS_7ref_ptrINS_13MagneticFieldEEEd1
_ZN7crpropa24RenormalizeMagneticField8getFieldERKNS_7Vector3IdEE1
_ZN7crpropa24RenormalizeMagneticFieldC2ENS_7ref_ptrINS_13MagneticFieldEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZNK7crpropa17MagneticFieldList8getFieldERKNS_7Vector3IdEE1
_ZNK7crpropa19MagneticDipoleField8getFieldERKNS_7Vector3IdEE2
_ZNK7crpropa22MagneticFieldEvolution8getFieldERKNS_7Vector3IdEEd2
_ZN7crpropa17MagneticFieldList8addFieldENS_7ref_ptrINS_13MagneticFieldEEE3
_ZNK7crpropa21PeriodicMagneticField8getFieldERKNS_7Vector3IdEE3
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/MagneticField.cpp.func.html b/doc/coverageReport/src/magneticField/MagneticField.cpp.func.html deleted file mode 100644 index 2a5f1bfd3..000000000 --- a/doc/coverageReport/src/magneticField/MagneticField.cpp.func.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/MagneticField.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - MagneticField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:486672.7 %
Date:2024-04-08 14:58:22Functions:91656.2 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa17MagneticFieldList8addFieldENS_7ref_ptrINS_13MagneticFieldEEE3
_ZN7crpropa21PeriodicMagneticField10getExtendsEv0
_ZN7crpropa21PeriodicMagneticField10setExtendsERKNS_7Vector3IdEE0
_ZN7crpropa21PeriodicMagneticField12isReflectiveEv0
_ZN7crpropa21PeriodicMagneticField13setReflectiveEb0
_ZN7crpropa21PeriodicMagneticField9getOriginEv0
_ZN7crpropa21PeriodicMagneticField9setOriginERKNS_7Vector3IdEE0
_ZN7crpropa21PeriodicMagneticFieldC2ENS_7ref_ptrINS_13MagneticFieldEEERKNS_7Vector3IdEE0
_ZN7crpropa21PeriodicMagneticFieldC2ENS_7ref_ptrINS_13MagneticFieldEEERKNS_7Vector3IdEES7_b1
_ZN7crpropa22MagneticFieldEvolutionC2ENS_7ref_ptrINS_13MagneticFieldEEEd1
_ZN7crpropa24RenormalizeMagneticField8getFieldERKNS_7Vector3IdEE1
_ZN7crpropa24RenormalizeMagneticFieldC2ENS_7ref_ptrINS_13MagneticFieldEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZNK7crpropa17MagneticFieldList8getFieldERKNS_7Vector3IdEE1
_ZNK7crpropa19MagneticDipoleField8getFieldERKNS_7Vector3IdEE2
_ZNK7crpropa21PeriodicMagneticField8getFieldERKNS_7Vector3IdEE3
_ZNK7crpropa22MagneticFieldEvolution8getFieldERKNS_7Vector3IdEEd2
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/MagneticField.cpp.gcov.html b/doc/coverageReport/src/magneticField/MagneticField.cpp.gcov.html deleted file mode 100644 index 086759e57..000000000 --- a/doc/coverageReport/src/magneticField/MagneticField.cpp.gcov.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/MagneticField.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - MagneticField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:486672.7 %
Date:2024-04-08 14:58:22Functions:91656.2 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/magneticField/MagneticField.h"
-       2             : 
-       3             : namespace crpropa {
-       4             : 
-       5           0 : PeriodicMagneticField::PeriodicMagneticField(ref_ptr<MagneticField> field,
-       6           0 :                 const Vector3d &extends) :
-       7           0 :                 field(field), extends(extends), origin(0, 0, 0), reflective(false) {
-       8             : 
-       9           0 : }
-      10             : 
-      11           1 : PeriodicMagneticField::PeriodicMagneticField(ref_ptr<MagneticField> field,
-      12           1 :                 const Vector3d &extends, const Vector3d &origin, bool reflective) :
-      13           1 :                 field(field), extends(extends), origin(origin), reflective(reflective) {
-      14             : 
-      15           1 : }
-      16             : 
-      17           0 : Vector3d &PeriodicMagneticField::getOrigin() {
-      18           0 :         return origin;
-      19             : }
-      20             : 
-      21           0 : void PeriodicMagneticField::setOrigin(const Vector3d &origin) {
-      22             :         this->origin = origin;
-      23           0 : }
-      24             : 
-      25           0 : Vector3d &PeriodicMagneticField::getExtends() {
-      26           0 :         return extends;
-      27             : }
-      28             : 
-      29           0 : void PeriodicMagneticField::setExtends(const Vector3d &origin) {
-      30             :         this->extends = extends;
-      31           0 : }
-      32             : 
-      33           0 : bool PeriodicMagneticField::isReflective() {
-      34           0 :         return reflective;
-      35             : }
-      36             : 
-      37           0 : void PeriodicMagneticField::setReflective(bool reflective) {
-      38           0 :         this->reflective = reflective;
-      39           0 : }
-      40             : 
-      41           3 : Vector3d PeriodicMagneticField::getField(const Vector3d &position) const {
-      42           3 :         Vector3d n = ((position - origin) / extends).floor();
-      43             :         Vector3d p = position - origin - n * extends;
-      44             : 
-      45           3 :         if (reflective) {
-      46           3 :                 long mx = (long) ::fabs(n.x) % 2;
-      47           3 :                 if (mx == 1)
-      48           2 :                         p.x = extends.x - p.x;
-      49           3 :                 long my = (long) ::fabs(n.y) % 2;
-      50           3 :                 if (my == 1)
-      51           0 :                         p.y = extends.y - p.y;
-      52           3 :                 long mz = (long) ::fabs(n.z) % 2;
-      53           3 :                 if (mz == 1)
-      54           2 :                         p.z = extends.z - p.z;
-      55             :         }
-      56             : 
-      57           3 :         return field->getField(p);
-      58             : }
-      59             : 
-      60           3 : void MagneticFieldList::addField(ref_ptr<MagneticField> field) {
-      61           3 :         fields.push_back(field);
-      62           3 : }
-      63             : 
-      64           1 : Vector3d MagneticFieldList::getField(const Vector3d &position) const {
-      65             :         Vector3d b;
-      66           4 :         for (int i = 0; i < fields.size(); i++)
-      67           3 :                 b += fields[i]->getField(position);
-      68           1 :         return b;
-      69             : }
-      70             : 
-      71           1 : MagneticFieldEvolution::MagneticFieldEvolution(ref_ptr<MagneticField> field,
-      72           1 :         double m) :
-      73           1 :         field(field), m(m) {
-      74           1 : }
-      75             : 
-      76           2 : Vector3d MagneticFieldEvolution::getField(const Vector3d &position,
-      77             :         double z) const {
-      78           2 :         return field->getField(position) * pow(1+z, m);
-      79             : }
-      80             : 
-      81           2 : Vector3d MagneticDipoleField::getField(const Vector3d &position) const {
-      82             :                 Vector3d r = (position - origin);
-      83           2 :                 Vector3d unit_r = r.getUnitVector();
-      84             :                 
-      85           2 :                 if (r.getR() == 0) { // singularity
-      86             :                         return moment * 2 * mu0 / 3;
-      87             :                 }
-      88           2 :                 return (unit_r * (unit_r.dot(moment)) * 3 - moment) / pow(r.getR() / radius, 3) * mu0 / (4*M_PI);
-      89             : }
-      90             : 
-      91             : #ifdef CRPROPA_HAVE_MUPARSER
-      92           1 : RenormalizeMagneticField::RenormalizeMagneticField(ref_ptr<MagneticField> field,
-      93           1 :                 std::string expression) :
-      94           2 :                 field(field), expression(expression) {
-      95             : 
-      96           1 :         p =  new mu::Parser();
-      97           1 :         p->DefineVar("B", &Bmag);
-      98           1 :         p->DefineConst("tesla", tesla);
-      99           1 :         p->DefineConst("gauss", gauss);
-     100           1 :         p->DefineConst("muG", muG);
-     101           1 :         p->DefineConst("nG", nG);
-     102           1 :         p->SetExpr(expression);
-     103           1 : }
-     104             : 
-     105           1 : Vector3d RenormalizeMagneticField::getField(const Vector3d &position) {
-     106           1 :         Vector3d B = field->getField(position);
-     107           1 :         Bmag = B.getR();
-     108           1 :         return B * p->Eval();
-     109             : }
-     110             : #endif
-     111             : 
-     112             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/MagneticFieldGrid.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/MagneticFieldGrid.cpp.func-sort-c.html deleted file mode 100644 index 6c98862d1..000000000 --- a/doc/coverageReport/src/magneticField/MagneticFieldGrid.cpp.func-sort-c.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/MagneticFieldGrid.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - MagneticFieldGrid.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0310.0 %
Date:2024-04-08 14:58:22Functions:0110.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa17MagneticFieldGrid7getGridEv0
_ZN7crpropa17MagneticFieldGrid7setGridENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa17MagneticFieldGridC2ENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa26ModulatedMagneticFieldGrid13setReflectiveEbb0
_ZN7crpropa26ModulatedMagneticFieldGrid17getModulationGridEv0
_ZN7crpropa26ModulatedMagneticFieldGrid17setModulationGridENS_7ref_ptrINS_4GridIfEEEE0
_ZN7crpropa26ModulatedMagneticFieldGrid7getGridEv0
_ZN7crpropa26ModulatedMagneticFieldGrid7setGridENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa26ModulatedMagneticFieldGridC2ENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEENS1_INS2_IfEEEE0
_ZNK7crpropa17MagneticFieldGrid8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa26ModulatedMagneticFieldGrid8getFieldERKNS_7Vector3IdEE0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/MagneticFieldGrid.cpp.func.html b/doc/coverageReport/src/magneticField/MagneticFieldGrid.cpp.func.html deleted file mode 100644 index 10a3651e7..000000000 --- a/doc/coverageReport/src/magneticField/MagneticFieldGrid.cpp.func.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/MagneticFieldGrid.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - MagneticFieldGrid.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0310.0 %
Date:2024-04-08 14:58:22Functions:0110.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa17MagneticFieldGrid7getGridEv0
_ZN7crpropa17MagneticFieldGrid7setGridENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa17MagneticFieldGridC2ENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa26ModulatedMagneticFieldGrid13setReflectiveEbb0
_ZN7crpropa26ModulatedMagneticFieldGrid17getModulationGridEv0
_ZN7crpropa26ModulatedMagneticFieldGrid17setModulationGridENS_7ref_ptrINS_4GridIfEEEE0
_ZN7crpropa26ModulatedMagneticFieldGrid7getGridEv0
_ZN7crpropa26ModulatedMagneticFieldGrid7setGridENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEE0
_ZN7crpropa26ModulatedMagneticFieldGridC2ENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEENS1_INS2_IfEEEE0
_ZNK7crpropa17MagneticFieldGrid8getFieldERKNS_7Vector3IdEE0
_ZNK7crpropa26ModulatedMagneticFieldGrid8getFieldERKNS_7Vector3IdEE0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/MagneticFieldGrid.cpp.gcov.html b/doc/coverageReport/src/magneticField/MagneticFieldGrid.cpp.gcov.html deleted file mode 100644 index 9a3f969fb..000000000 --- a/doc/coverageReport/src/magneticField/MagneticFieldGrid.cpp.gcov.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/MagneticFieldGrid.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - MagneticFieldGrid.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0310.0 %
Date:2024-04-08 14:58:22Functions:0110.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/magneticField/MagneticFieldGrid.h"
-       2             : 
-       3             : namespace crpropa {
-       4             : 
-       5           0 : MagneticFieldGrid::MagneticFieldGrid(ref_ptr<Grid3f> grid) {
-       6           0 :         setGrid(grid);
-       7           0 : }
-       8             : 
-       9           0 : void MagneticFieldGrid::setGrid(ref_ptr<Grid3f> grid) {
-      10           0 :         this->grid = grid;
-      11           0 : }
-      12             : 
-      13           0 : ref_ptr<Grid3f> MagneticFieldGrid::getGrid() {
-      14           0 :         return grid;
-      15             : }
-      16             : 
-      17           0 : Vector3d MagneticFieldGrid::getField(const Vector3d &pos) const {
-      18           0 :         return grid->interpolate(pos);
-      19             : }
-      20             : 
-      21           0 : ModulatedMagneticFieldGrid::ModulatedMagneticFieldGrid(ref_ptr<Grid3f> grid,
-      22           0 :                 ref_ptr<Grid1f> modGrid) {
-      23             :         grid->setReflective(false);
-      24             :         modGrid->setReflective(true);
-      25           0 :         setGrid(grid);
-      26           0 :         setModulationGrid(modGrid);
-      27           0 : }
-      28             : 
-      29           0 : void ModulatedMagneticFieldGrid::setGrid(ref_ptr<Grid3f> g) {
-      30           0 :         grid = g;
-      31           0 : }
-      32             : 
-      33           0 : ref_ptr<Grid3f> ModulatedMagneticFieldGrid::getGrid() {
-      34           0 :         return grid;
-      35             : }
-      36             : 
-      37           0 : void ModulatedMagneticFieldGrid::setModulationGrid(ref_ptr<Grid1f> g) {
-      38           0 :         modGrid = g;
-      39           0 : }
-      40             : 
-      41           0 : ref_ptr<Grid1f> ModulatedMagneticFieldGrid::getModulationGrid() {
-      42           0 :         return modGrid;
-      43             : }
-      44             : 
-      45           0 : void ModulatedMagneticFieldGrid::setReflective(bool gridReflective,
-      46             :                 bool modGridReflective) {
-      47             :         grid->setReflective(gridReflective);
-      48             :         modGrid->setReflective(modGridReflective);
-      49           0 : }
-      50             : 
-      51           0 : Vector3d ModulatedMagneticFieldGrid::getField(const Vector3d &pos) const {
-      52           0 :         float m = modGrid->interpolate(pos);
-      53           0 :         Vector3d b = grid->interpolate(pos);
-      54           0 :         return b * m;
-      55             : }
-      56             : 
-      57             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/PT11Field.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/PT11Field.cpp.func-sort-c.html deleted file mode 100644 index 1594ee831..000000000 --- a/doc/coverageReport/src/magneticField/PT11Field.cpp.func-sort-c.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/PT11Field.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - PT11Field.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0630.0 %
Date:2024-04-08 14:58:22Functions:090.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa9PT11Field10isUsingASSEv0
_ZN7crpropa9PT11Field10isUsingBSSEv0
_ZN7crpropa9PT11Field10setUseHaloEb0
_ZN7crpropa9PT11Field11isUsingHaloEv0
_ZN7crpropa9PT11Field9SetParamsEv0
_ZN7crpropa9PT11Field9setUseASSEb0
_ZN7crpropa9PT11Field9setUseBSSEb0
_ZN7crpropa9PT11FieldC2Ev0
_ZNK7crpropa9PT11Field8getFieldERKNS_7Vector3IdEE0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/PT11Field.cpp.func.html b/doc/coverageReport/src/magneticField/PT11Field.cpp.func.html deleted file mode 100644 index 62ece690d..000000000 --- a/doc/coverageReport/src/magneticField/PT11Field.cpp.func.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/PT11Field.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - PT11Field.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0630.0 %
Date:2024-04-08 14:58:22Functions:090.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa9PT11Field10isUsingASSEv0
_ZN7crpropa9PT11Field10isUsingBSSEv0
_ZN7crpropa9PT11Field10setUseHaloEb0
_ZN7crpropa9PT11Field11isUsingHaloEv0
_ZN7crpropa9PT11Field9SetParamsEv0
_ZN7crpropa9PT11Field9setUseASSEb0
_ZN7crpropa9PT11Field9setUseBSSEb0
_ZN7crpropa9PT11FieldC2Ev0
_ZNK7crpropa9PT11Field8getFieldERKNS_7Vector3IdEE0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/PT11Field.cpp.gcov.html b/doc/coverageReport/src/magneticField/PT11Field.cpp.gcov.html deleted file mode 100644 index 36fdae7a3..000000000 --- a/doc/coverageReport/src/magneticField/PT11Field.cpp.gcov.html +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/PT11Field.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - PT11Field.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0630.0 %
Date:2024-04-08 14:58:22Functions:090.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/magneticField/PT11Field.h"
-       2             : #include "crpropa/Units.h"
-       3             : 
-       4             : #include <algorithm>
-       5             : 
-       6             : namespace crpropa {
-       7             : 
-       8           0 : PT11Field::PT11Field() : useASS(true), useBSS(false), useHalo(true) {
-       9             :         // disk parameters
-      10           0 :         d = - 0.6 * kpc;
-      11           0 :         R_sun = 8.5 * kpc;
-      12           0 :         R_c = 5.0 * kpc;
-      13           0 :         z0_D = 1.0 * kpc;
-      14           0 :         B0_D = 2.0 * muG;
-      15             : 
-      16             :         // halo parameters
-      17           0 :         z0_H = 1.3 * kpc;
-      18           0 :         R0_H = 8.0 * kpc;
-      19           0 :         B0_Hn = 4.0 * muG;
-      20           0 :         B0_Hs = 4.0 * muG;
-      21           0 :         z11_H = 0.25 * kpc;
-      22           0 :         z12_H = 0.4 * kpc;
-      23             : 
-      24             :         // set ASS specific parameters
-      25           0 :         setUseASS(true);
-      26           0 : }
-      27             : 
-      28           0 : void PT11Field::SetParams() {
-      29           0 :         cos_pitch = cos(pitch);
-      30           0 :         sin_pitch = sin(pitch);
-      31           0 :         PHI = cos_pitch / sin_pitch * log1p(d / R_sun) - M_PI / 2;
-      32           0 :         cos_PHI = cos(PHI);
-      33           0 : }
-      34             : 
-      35           0 : void PT11Field::setUseASS(bool use) {
-      36           0 :         useASS = use;
-      37           0 :         if (not(use))
-      38             :                 return;
-      39             : 
-      40           0 :         if (useBSS) {
-      41             :                 std::cout << "PT11Field: Disk field changed to ASS" << std::endl;
-      42           0 :                 useBSS = false;
-      43             :         }
-      44             : 
-      45           0 :         pitch = -5.0 * M_PI / 180;
-      46           0 :         B0_Hs = 2.0 * muG;
-      47           0 :         SetParams();
-      48             : }
-      49             : 
-      50           0 : void PT11Field::setUseBSS(bool use) {
-      51           0 :         useBSS = use;
-      52           0 :         if (not(use))
-      53             :                 return;
-      54             : 
-      55           0 :         if (useASS) {
-      56             :                 std::cout << "PT11Field: Disk field changed to BSS" << std::endl;
-      57           0 :                 useASS = false;
-      58             :         }
-      59             : 
-      60           0 :         pitch = -6.0 * M_PI / 180;
-      61           0 :         B0_Hs = 4.0 * muG;
-      62           0 :         SetParams();
-      63             : }
-      64             : 
-      65           0 : void PT11Field::setUseHalo(bool use) {
-      66           0 :         useHalo = use;
-      67           0 : }
-      68             : 
-      69           0 : bool PT11Field::isUsingASS() {
-      70           0 :         return useASS;
-      71             : }
-      72             : 
-      73           0 : bool PT11Field::isUsingBSS() {
-      74           0 :         return useBSS;
-      75             : }
-      76             : 
-      77           0 : bool PT11Field::isUsingHalo() {
-      78           0 :         return useHalo;
-      79             : }
-      80             : 
-      81           0 : Vector3d PT11Field::getField(const Vector3d& pos) const {
-      82           0 :         double r = sqrt(pos.x * pos.x + pos.y * pos.y);  // in-plane radius
-      83             : 
-      84             :         Vector3d b(0.);
-      85             : 
-      86             :         // disk field
-      87           0 :         if ((useASS) or (useBSS)) {
-      88             :                 // PT11 paper has B_theta = B * cos(p) but this seems because they define azimuth clockwise, while we have anticlockwise.
-      89             :                 // see Tinyakov 2002 APh 18,165: "local field points to l=90+p" so p=-5 deg gives l=85 and hence clockwise from above.
-      90             :                 // so to get local B clockwise in our system, need minus (like Sun etal).
-      91             :                 // Ps base their system on Han and Qiao 1994 A&A 288,759 which has a diagram with azimuth clockwise, hence confirmed.
-      92             : 
-      93             :                 // PT11 paper define Earth position at (+8.5, 0, 0) kpc; but usual convention is (-8.5, 0, 0)
-      94             :                 // thus we have to rotate our position by 180 degree in azimuth
-      95           0 :                 double theta = M_PI - pos.getPhi();  // azimuth angle theta: PT11 paper uses opposite convention for azimuth
-      96             :                 // the following is equivalent to sin(pi - phi) and cos(pi - phi) which is computationally slower
-      97           0 :                 double cos_theta = - pos.x / r;
-      98           0 :                 double sin_theta = pos.y / r;
-      99             : 
-     100             :                 // After some geometry calculations (on whiteboard) one finds:
-     101             :                 // Bx = +cos(theta) * B_r - sin(theta) * B_{theta}
-     102             :                 // By = -sin(theta) * B_r - cos(theta) * B_{theta}
-     103             :                 // Use from paper: B_theta = B * cos(pitch)     and B_r = B * sin(pitch)
-     104           0 :                 b.x = sin_pitch * cos_theta - cos_pitch * sin_theta;
-     105           0 :                 b.y = - sin_pitch * sin_theta - cos_pitch * cos_theta;
-     106             :                 b *= -1;        // flip magnetic field direction, as B_{theta} and B_{phi} refering to 180 degree rotated field
-     107             : 
-     108           0 :                 double bMag = cos(theta - cos_pitch / sin_pitch * log(r / R_sun) + PHI);
-     109           0 :                 if (useASS)
-     110           0 :                         bMag = fabs(bMag);
-     111           0 :                 bMag *= B0_D * R_sun / std::max(r, R_c) / cos_PHI * exp(-fabs(pos.z) / z0_D);
-     112             :                 b *= bMag;
-     113             :         }
-     114             : 
-     115             :         // halo field
-     116           0 :         if (useHalo) {
-     117           0 :                 double bMag = (pos.z > 0 ? B0_Hn : - B0_Hs);
-     118           0 :                 double z1 = (fabs(pos.z) < z0_H ? z11_H : z12_H);
-     119           0 :                 bMag *= r / R0_H * exp(1 - r / R0_H) / (1 + pow((fabs(pos.z) - z0_H) / z1, 2.));
-     120             :                 // equation (8) in paper: theta uses now the conventional azimuth definition in contrast to equation (3)
-     121             :                 // cos(phi) = pos.x / r (phi going counter-clockwise)
-     122             :                 // sin(phi) = pos.y / r
-     123             :                 // unitvector of phi in polar coordinates: (-sin(phi), cos(phi), 0)
-     124           0 :                 b += bMag * Vector3d(-pos.y / r, pos.x / r, 0);
-     125             :         }
-     126             : 
-     127           0 :         return b;
-     128             : }
-     129             : 
-     130             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/PolarizedSingleModeMagneticField.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/PolarizedSingleModeMagneticField.cpp.func-sort-c.html deleted file mode 100644 index aa48a3251..000000000 --- a/doc/coverageReport/src/magneticField/PolarizedSingleModeMagneticField.cpp.func-sort-c.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/PolarizedSingleModeMagneticField.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - PolarizedSingleModeMagneticField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:153246.9 %
Date:2024-04-08 14:58:22Functions:22100.0 %
-
- -
- - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa32PolarizedSingleModeMagneticFieldC2ERKdS2_S2_RKNS_7Vector3IdEES6_S6_NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESC_SC_1
_ZNK7crpropa32PolarizedSingleModeMagneticField8getFieldERKNS_7Vector3IdEE1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/PolarizedSingleModeMagneticField.cpp.func.html b/doc/coverageReport/src/magneticField/PolarizedSingleModeMagneticField.cpp.func.html deleted file mode 100644 index 85b986750..000000000 --- a/doc/coverageReport/src/magneticField/PolarizedSingleModeMagneticField.cpp.func.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/PolarizedSingleModeMagneticField.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - PolarizedSingleModeMagneticField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:153246.9 %
Date:2024-04-08 14:58:22Functions:22100.0 %
-
- -
- - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa32PolarizedSingleModeMagneticFieldC2ERKdS2_S2_RKNS_7Vector3IdEES6_S6_NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESC_SC_1
_ZNK7crpropa32PolarizedSingleModeMagneticField8getFieldERKNS_7Vector3IdEE1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/PolarizedSingleModeMagneticField.cpp.gcov.html b/doc/coverageReport/src/magneticField/PolarizedSingleModeMagneticField.cpp.gcov.html deleted file mode 100644 index 9ac25d10b..000000000 --- a/doc/coverageReport/src/magneticField/PolarizedSingleModeMagneticField.cpp.gcov.html +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/PolarizedSingleModeMagneticField.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - PolarizedSingleModeMagneticField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:153246.9 %
Date:2024-04-08 14:58:22Functions:22100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/magneticField/PolarizedSingleModeMagneticField.h"
-       2             : 
-       3             : namespace crpropa {
-       4             : 
-       5           1 : PolarizedSingleModeMagneticField::PolarizedSingleModeMagneticField( const double &B_0, const double &wavelength, const double &sigma, const Vector3d &r_0, const Vector3d &e_1, const Vector3d &e_2, std::string flagAmplitudeRms, std::string flagPolarizationHelicity, std::string flagMode ) {
-       6           1 :         if (flagMode == "elliptical") {
-       7           1 :                 if (abs(sigma) > 1)
-       8           0 :                         throw std::runtime_error("PolarizedSingleModeMagneticField: The value of the  polarization parameter has to lie in the range [-1;+1].");
-       9             :         }
-      10           0 :         else if (flagMode == "circular") {
-      11           0 :                 if (abs(sigma) != 1)
-      12           0 :                         throw std::runtime_error("PolarizedSingleModeMagneticField: For circular polarization the value of the polarization parameter has to be equal to -1 or +1.");
-      13             :         }
-      14           0 :         else if (flagMode == "linear") {
-      15           0 :                 if (abs(sigma) != 0)
-      16           0 :                         throw std::runtime_error("PolarizedSingleModeMagneticField: For linear polarization the value of the polarization parameter has to be equal to 0.");
-      17             :         }
-      18             :         else
-      19           0 :                 throw std::runtime_error("PolarizedSingleModeMagneticField: Wrong value for flagMode. Please choose \"elliptical\" or \"circular\" or \"linear\".");
-      20             : 
-      21           1 :         if (e_1.dot(e_2) != 0)
-      22           0 :                 throw std::runtime_error("PolarizedSingleModeMagneticField: e_1 and e_2 have to be orthogonal to each other.");
-      23             : 
-      24           1 :         if (e_1.getR() == 0)
-      25           0 :                 throw std::runtime_error("PolarizedSingleModeMagneticField: Vector e_1 cannot be zero.");
-      26             :         unitVector_1 = e_1 / e_1.getR();
-      27             : 
-      28           1 :         if (e_2.getR() == 0)
-      29           0 :                 throw std::runtime_error("PolarizedSingleModeMagneticField: Vector e_2 cannot be zero.");
-      30             :         unitVector_2 = e_2 / e_2.getR();
-      31             : 
-      32             :         wavevector = e_2.cross(e_1);
-      33             : 
-      34             :         //This check is necessary if a polarization with non-orthogonal spanning vectors is desired. This is not implemented in this version, so any corresponding modifications should be made with caution.
-      35             :         //if (wavevector.getR() == 0)
-      36             :         //        throw std::runtime_error("PolarizedSingleModeMagneticField: e_1 cannot be parallel to e_2.");
-      37             : 
-      38             :         wavevector = wavevector / wavevector.getR();
-      39             : 
-      40           1 :         if (wavelength == 0)
-      41           0 :                 throw std::runtime_error("PolarizedSingleModeMagneticField: The correlation length cannot be zero.");
-      42             :         wavevector = wavevector * 2 * M_PI / wavelength;
-      43             : 
-      44           2 :         if (!((flagPolarizationHelicity == "helicity") || (flagPolarizationHelicity == "polarization")))
-      45           0 :                 throw std::runtime_error("PolarizedSingleModeMagneticField: Wrong value for flagPolarizationHelicity. Please choose \"polarization\" or \"helicity\".");
-      46           1 :         if (flagPolarizationHelicity == "helicity" && abs(sigma) != 1)
-      47           0 :                 throw std::runtime_error("PolarizedSingleModeMagneticField: In helicity mode only the maximum helicity case (sigma = +1 or sigma = -1) may be chosen.");
-      48             : 
-      49           1 :         if (flagAmplitudeRms == "amplitude")
-      50           1 :                 B_max = B_0;
-      51           0 :         else if (flagAmplitudeRms == "rms")
-      52           0 :                 B_max = sqrt(2 / (1 + sigma * sigma)) * B_0;
-      53             :         else
-      54           0 :                 throw std::runtime_error("PolarizedSingleModeMagneticField: Wrong value for flagAmplitudeRms. Please choose \"amplitude\" or \"rms\".");
-      55             : 
-      56             :         this->r_0 = r_0;
-      57           1 :         this->sigma = sigma;
-      58           1 : }
-      59             : 
-      60           1 : Vector3d PolarizedSingleModeMagneticField::getField(const Vector3d &position) const {
-      61             :         Vector3d delta_r = position - r_0;
-      62             : 
-      63           1 :         return B_max * (unitVector_1 * cos(wavevector.dot(delta_r)) + unitVector_2 * sigma * sin(wavevector.dot(delta_r)));
-      64             : }
-      65             : 
-      66             : } //end namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/TF17Field.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/TF17Field.cpp.func-sort-c.html deleted file mode 100644 index dbd5a2431..000000000 --- a/doc/coverageReport/src/magneticField/TF17Field.cpp.func-sort-c.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/TF17Field.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - TF17Field.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:01960.0 %
Date:2024-04-08 14:58:22Functions:0290.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa9TF17Field10set_H_diskEd0
_ZN7crpropa9TF17Field10set_L_diskEd0
_ZN7crpropa9TF17Field10set_L_haloEd0
_ZN7crpropa9TF17Field10set_a_diskEd0
_ZN7crpropa9TF17Field10set_a_haloEd0
_ZN7crpropa9TF17Field11set_B1_diskEd0
_ZN7crpropa9TF17Field11set_B1_haloEd0
_ZN7crpropa9TF17Field11set_r1_diskEd0
_ZN7crpropa9TF17Field11set_z1_diskEd0
_ZN7crpropa9TF17Field11set_z1_haloEd0
_ZN7crpropa9TF17Field15setUseDiskFieldEb0
_ZN7crpropa9TF17Field15setUseHaloFieldEb0
_ZN7crpropa9TF17Field16isUsingDiskFieldEv0
_ZN7crpropa9TF17Field16isUsingHaloFieldEv0
_ZN7crpropa9TF17Field17set_phi_star_diskEd0
_ZN7crpropa9TF17Field17set_phi_star_haloEd0
_ZN7crpropa9TF17Field6set_HpEd0
_ZN7crpropa9TF17Field6set_LpEd0
_ZN7crpropa9TF17Field6set_p0Ed0
_ZN7crpropa9TF17FieldC2ENS_13TF17DiskModelENS_13TF17HaloModelE0
_ZNK7crpropa9TF17Field12getDiskFieldERKdS2_S2_S2_S2_0
_ZNK7crpropa9TF17Field12getDiskModelB5cxx11Ev0
_ZNK7crpropa9TF17Field12getHaloFieldERKdS2_S2_S2_S2_0
_ZNK7crpropa9TF17Field12getHaloModelB5cxx11Ev0
_ZNK7crpropa9TF17Field16radialFieldScaleERKdS2_S2_S2_S2_S2_0
_ZNK7crpropa9TF17Field22shiftedWindingFunctionERKdS2_0
_ZNK7crpropa9TF17Field23azimuthalFieldComponentERKdS2_S2_S2_0
_ZNK7crpropa9TF17Field6zscaleERKd0
_ZNK7crpropa9TF17Field8getFieldERKNS_7Vector3IdEE0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/TF17Field.cpp.func.html b/doc/coverageReport/src/magneticField/TF17Field.cpp.func.html deleted file mode 100644 index 4c39636c6..000000000 --- a/doc/coverageReport/src/magneticField/TF17Field.cpp.func.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/TF17Field.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - TF17Field.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:01960.0 %
Date:2024-04-08 14:58:22Functions:0290.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa9TF17Field10set_H_diskEd0
_ZN7crpropa9TF17Field10set_L_diskEd0
_ZN7crpropa9TF17Field10set_L_haloEd0
_ZN7crpropa9TF17Field10set_a_diskEd0
_ZN7crpropa9TF17Field10set_a_haloEd0
_ZN7crpropa9TF17Field11set_B1_diskEd0
_ZN7crpropa9TF17Field11set_B1_haloEd0
_ZN7crpropa9TF17Field11set_r1_diskEd0
_ZN7crpropa9TF17Field11set_z1_diskEd0
_ZN7crpropa9TF17Field11set_z1_haloEd0
_ZN7crpropa9TF17Field15setUseDiskFieldEb0
_ZN7crpropa9TF17Field15setUseHaloFieldEb0
_ZN7crpropa9TF17Field16isUsingDiskFieldEv0
_ZN7crpropa9TF17Field16isUsingHaloFieldEv0
_ZN7crpropa9TF17Field17set_phi_star_diskEd0
_ZN7crpropa9TF17Field17set_phi_star_haloEd0
_ZN7crpropa9TF17Field6set_HpEd0
_ZN7crpropa9TF17Field6set_LpEd0
_ZN7crpropa9TF17Field6set_p0Ed0
_ZN7crpropa9TF17FieldC2ENS_13TF17DiskModelENS_13TF17HaloModelE0
_ZNK7crpropa9TF17Field12getDiskFieldERKdS2_S2_S2_S2_0
_ZNK7crpropa9TF17Field12getDiskModelB5cxx11Ev0
_ZNK7crpropa9TF17Field12getHaloFieldERKdS2_S2_S2_S2_0
_ZNK7crpropa9TF17Field12getHaloModelB5cxx11Ev0
_ZNK7crpropa9TF17Field16radialFieldScaleERKdS2_S2_S2_S2_S2_0
_ZNK7crpropa9TF17Field22shiftedWindingFunctionERKdS2_0
_ZNK7crpropa9TF17Field23azimuthalFieldComponentERKdS2_S2_S2_0
_ZNK7crpropa9TF17Field6zscaleERKd0
_ZNK7crpropa9TF17Field8getFieldERKNS_7Vector3IdEE0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/TF17Field.cpp.gcov.html b/doc/coverageReport/src/magneticField/TF17Field.cpp.gcov.html deleted file mode 100644 index b277961c9..000000000 --- a/doc/coverageReport/src/magneticField/TF17Field.cpp.gcov.html +++ /dev/null @@ -1,383 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/TF17Field.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField - TF17Field.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:01960.0 %
Date:2024-04-08 14:58:22Functions:0290.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/magneticField/TF17Field.h"
-       2             : #include "crpropa/Units.h"
-       3             : 
-       4             : #include <algorithm>
-       5             : #include <string>
-       6             : 
-       7             : namespace crpropa {
-       8             : using namespace std;
-       9             : 
-      10           0 : TF17Field::TF17Field(TF17DiskModel disk_model_, TF17HaloModel halo_model_) {
-      11           0 :     disk_model = disk_model_; 
-      12           0 :     halo_model = halo_model_;
-      13             : 
-      14           0 :     useHaloField = true;
-      15           0 :     useDiskField = true;
-      16             : 
-      17           0 :     if ((halo_model == TF17HaloModel::C0) && (disk_model == TF17DiskModel::Ad1)) {
-      18             :         // disk parameters
-      19           0 :         set_r1_disk(3 * kpc);
-      20           0 :         set_B1_disk(19.0 * muG);
-      21           0 :         set_H_disk(0.055 * kpc);
-      22           0 :         set_phi_star_disk(-54 * M_PI / 180);
-      23           0 :         set_a_disk(0.9 / kpc / kpc);
-      24             :         // halo parameters
-      25           0 :         set_z1_halo(0);
-      26           0 :         set_B1_halo(0.36 * muG);
-      27           0 :         set_L_halo(3.0 * kpc);
-      28           0 :         set_a_halo(1.17 / kpc / kpc);
-      29             :         // shared parameters
-      30           0 :         set_p0(-7.9 * M_PI / 180);
-      31           0 :         set_Hp(5 * kpc);
-      32           0 :         set_Lp(50 * kpc); // > 18 kpc
-      33             :             
-      34           0 :     } else if ((halo_model == TF17HaloModel::C0) && (disk_model == TF17DiskModel::Bd1)) {
-      35             :         // disk parameters
-      36           0 :         set_r1_disk(3 * kpc);
-      37           0 :         set_B1_disk(2.0 * muG);
-      38           0 :         set_H_disk(0.32 * kpc);
-      39           0 :         set_phi_star_disk(153 * M_PI / 180);
-      40             :         // halo parameters
-      41           0 :         set_z1_halo(0);
-      42           0 :         set_B1_halo(0.29 * muG);
-      43           0 :         set_L_halo(3.4 * kpc);
-      44           0 :         set_a_halo(0.88 / kpc / kpc);
-      45             :         // shared parameters
-      46           0 :         set_p0(-7.2 * M_PI / 180);
-      47           0 :         set_Hp(9 * kpc);
-      48           0 :         set_Lp(50 * kpc); // > 16 kpc
-      49             : 
-      50           0 :     } else if ((halo_model == TF17HaloModel::C0) && (disk_model == TF17DiskModel::Dd1)) {
-      51             :         // disk parameters
-      52           0 :         set_z1_disk(1.5 * kpc);
-      53           0 :         set_B1_disk(0.065 * muG);
-      54           0 :         set_L_disk(9.8 * kpc);
-      55           0 :         set_phi_star_disk(14 * M_PI / 180);
-      56             :         // halo parameters
-      57           0 :         set_z1_halo(0);
-      58           0 :         set_B1_halo(0.18 * muG);
-      59           0 :         set_L_halo(4.8 * kpc);
-      60           0 :         set_a_halo(0.61 / kpc / kpc);
-      61             :         // shared parameters
-      62           0 :         set_p0(-7.4 * M_PI / 180);
-      63           0 :         set_Hp(4.2 * kpc);
-      64           0 :         set_Lp(50 * kpc); // > 22 kpc
-      65             : 
-      66           0 :     } else if ((halo_model == TF17HaloModel::C1) && (disk_model == TF17DiskModel::Ad1)) {
-      67             :         // disk parameters
-      68           0 :         set_r1_disk(3 * kpc);
-      69           0 :         set_B1_disk(32.0 * muG);
-      70           0 :         set_H_disk(0.054 * kpc);
-      71           0 :         set_phi_star_disk(-31 * M_PI / 180);
-      72           0 :         set_a_disk(0.031 / kpc / kpc);
-      73             :         // halo parameters
-      74           0 :         set_z1_halo(0);
-      75           0 :         set_B1_halo(9.0 * muG);
-      76           0 :         set_L_halo(2.1 * kpc);
-      77           0 :         set_phi_star_halo(198 * M_PI / 180);
-      78           0 :         set_a_halo(0.33 / kpc / kpc);
-      79             :         // shared parameters
-      80           0 :         set_p0(-9.1 * M_PI / 180);
-      81           0 :         set_Hp(1.2 * kpc);
-      82           0 :         set_Lp(50 * kpc); // > 38 kpc
-      83             : 
-      84           0 :     } else if ((halo_model == TF17HaloModel::C1) && (disk_model == TF17DiskModel::Bd1)) {
-      85             :         // disk parameters
-      86           0 :         set_r1_disk(3 * kpc);
-      87           0 :         set_B1_disk(24 * muG);
-      88           0 :         set_H_disk(0.090 * kpc);
-      89           0 :         set_phi_star_disk(-34 * M_PI / 180);
-      90             :         // halo parameters
-      91           0 :         set_z1_halo(0);
-      92           0 :         set_B1_halo(8.2 * muG);
-      93           0 :         set_L_halo(2.2 * kpc);
-      94           0 :         set_phi_star_halo(197 * M_PI / 180);
-      95           0 :         set_a_halo(0.38 / kpc / kpc);
-      96             :         // shared parameters
-      97           0 :         set_p0(-9.0 * M_PI / 180);
-      98           0 :         set_Hp(1.2 * kpc);
-      99           0 :         set_Lp(50 * kpc); // > 38 kpc
-     100             : 
-     101           0 :     } else if ((halo_model == TF17HaloModel::C1) && (disk_model == TF17DiskModel::Dd1)) {
-     102             :         // disk parameters
-     103           0 :         set_z1_disk(1.5 * kpc);
-     104           0 :         set_B1_disk(0.40 * muG);
-     105           0 :         set_L_disk(2.9 * kpc);
-     106           0 :         set_phi_star_disk(120 * M_PI / 180);
-     107             :         // halo parameters
-     108           0 :         set_z1_halo(0);
-     109           0 :         set_B1_halo(9.5 * muG);
-     110           0 :         set_L_halo(2.1 * kpc);
-     111           0 :         set_phi_star_halo(179 * M_PI / 180);
-     112           0 :         set_a_halo(0.45 / kpc / kpc);
-     113             :         // shared parameters
-     114           0 :         set_p0(-8.4 * M_PI / 180);
-     115           0 :         set_Hp(1.2 * kpc);
-     116           0 :         set_Lp(50 * kpc); // > 30 kpc
-     117             :     }
-     118             : 
-     119           0 :     epsilon = std::numeric_limits<double>::epsilon();
-     120           0 : }
-     121             : 
-     122           0 : void TF17Field::setUseDiskField(bool use) {     useDiskField = use; }
-     123           0 : void TF17Field::setUseHaloField(bool use) { useHaloField = use; }
-     124             : 
-     125           0 : bool TF17Field::isUsingDiskField() { return useDiskField; }
-     126           0 : bool TF17Field::isUsingHaloField() { return useHaloField; }
-     127             : 
-     128           0 : void TF17Field::set_B1_disk(const double B1){ B1_disk = B1; }
-     129           0 : void TF17Field::set_z1_disk(const double z1){ z1_disk = z1; }
-     130           0 : void TF17Field::set_r1_disk(const double r1){ r1_disk = r1; }
-     131           0 : void TF17Field::set_H_disk(const double H){ H_disk = H; }
-     132           0 : void TF17Field::set_L_disk(const double L){ L_disk = L; }
-     133           0 : void TF17Field::set_a_disk(const double a){ a_disk = a; }
-     134           0 : void TF17Field::set_phi_star_disk(const double phi){ phi_star_disk = phi; }
-     135             : 
-     136           0 : void TF17Field::set_B1_halo(const double B1){ B1_halo = B1; }
-     137           0 : void TF17Field::set_z1_halo(const double z1){ z1_halo = z1; }
-     138           0 : void TF17Field::set_L_halo(const double L){ L_halo = L; }
-     139           0 : void TF17Field::set_a_halo(const double a){ a_halo = a; }
-     140           0 : void TF17Field::set_phi_star_halo(const double phi){ phi_star_halo = phi; }
-     141             : 
-     142           0 : void TF17Field::set_Hp(const double H){ H_p = H; }
-     143           0 : void TF17Field::set_Lp(const double L){ L_p = L; }
-     144           0 : void TF17Field::set_p0(const double p0){ 
-     145           0 :     p_0 = p0; 
-     146           0 :     cot_p0 = cos(p_0) / sin(p_0);
-     147           0 : }
-     148             : 
-     149           0 : string TF17Field::getDiskModel() const {
-     150             :     string model_name;
-     151           0 :     switch (disk_model) {
-     152             :         case TF17DiskModel::Ad1 : model_name = "Ad1"; break;
-     153             :         case TF17DiskModel::Bd1 : model_name = "Bd1"; break;
-     154             :         case TF17DiskModel::Dd1 : model_name = "Dd1"; break;
-     155             :     }
-     156           0 :     return model_name;
-     157             : }
-     158           0 : string TF17Field::getHaloModel() const {
-     159             :     string model_name;
-     160           0 :     switch (halo_model) {
-     161             :         case TF17HaloModel::C0 : model_name = "C0"; break;
-     162             :         case TF17HaloModel::C1 : model_name = "C1"; break;
-     163             :     }
-     164           0 :     return model_name;
-     165             : }
-     166             : 
-     167             : 
-     168           0 : Vector3d TF17Field::getField(const Vector3d& pos) const {
-     169           0 :         double r = sqrt(pos.x * pos.x + pos.y * pos.y);  // in-plane radius
-     170           0 :         double phi = M_PI - pos.getPhi(); // azimuth in our convention
-     171             :         // double cosPhi = pos.x / r;
-     172           0 :         double cosPhi = cos(phi);
-     173             :         // double sinPhi = pos.y / r;
-     174           0 :         double sinPhi = sin(phi);
-     175             : 
-     176             :         Vector3d b(0.);
-     177           0 :         if (useDiskField)
-     178           0 :                 b += getDiskField(r, pos.z, phi, sinPhi, cosPhi);       // disk field
-     179           0 :         if (useHaloField)
-     180           0 :                 b += getHaloField(r, pos.z, phi, sinPhi, cosPhi);       // halo field
-     181           0 :         return b;
-     182             : }
-     183             : 
-     184           0 : Vector3d TF17Field::getDiskField(const double& r, const double& z, const double& phi, const double& sinPhi, const double& cosPhi) const {
-     185             :         Vector3d b(0.);
-     186           0 :     double B_r = 0;
-     187             :     double B_phi = 0;
-     188           0 :     double B_z = 0;
-     189             : 
-     190           0 :     if (disk_model == TF17DiskModel::Ad1) { // ==========================================================
-     191           0 :         if (r > r1_disk) {
-     192           0 :             double z1_disk_z = (1. + a_disk * r1_disk * r1_disk) / (1. + a_disk * r * r); // z1_disk / z
-     193             :             // B components in (r, phi, z)
-     194           0 :             double B_r0 = radialFieldScale(B1_disk, phi_star_disk, z1_disk_z*z, phi, r, z);
-     195           0 :             B_r = (r1_disk / r) * z1_disk_z * B_r0;
-     196           0 :             B_z = 2 * a_disk * r1_disk * z1_disk_z*z / (1+ a_disk * r * r) * B_r0;
-     197           0 :             B_phi = azimuthalFieldComponent(r, z, B_r, B_z);
-     198             :         } else {
-     199             :             // within r = r1_disk, the field lines are straight in direction g_phi + phi_star_disk
-     200             :             // and thus z = z1
-     201           0 :             double phi1_disk = shiftedWindingFunction(r1_disk, z) + phi_star_disk;
-     202           0 :             double B_amp = B1_disk * exp(-fabs(z) / H_disk);
-     203           0 :             B_r = cos(phi1_disk - phi) * B_amp;
-     204           0 :             B_phi = sin(phi1_disk - phi) * B_amp;
-     205             :         }
-     206             : 
-     207           0 :     } else if (disk_model == TF17DiskModel::Bd1) { // ===================================================
-     208             :         // for model Bd1, best fit for n = 2 
-     209           0 :         if ( r > epsilon ) {
-     210           0 :             double r1_disk_r = r1_disk / r;     
-     211           0 :             double z1_disk_z = 5. / (r1_disk_r*r1_disk_r + 4./sqrt(r1_disk_r)); // z1_disk / z -> remove z dependancy 
-     212           0 :             double B_r0 = radialFieldScale(B1_disk, phi_star_disk, z1_disk_z*z, phi, r, z);
-     213           0 :             B_r = r1_disk_r * z1_disk_z * B_r0;
-     214           0 :             B_z = -0.4 * r1_disk_r / r * z1_disk_z* z1_disk_z * z * (r1_disk_r*r1_disk_r - 1./sqrt(r1_disk_r)) * B_r0;
-     215             :         } else {
-     216           0 :             double z1_disk_z = 5. * r*r / (r1_disk*r1_disk); // z1_disk / z -> remove z dependancy 
-     217           0 :             double B_r0 = radialFieldScale(B1_disk, phi_star_disk, z1_disk_z*z, phi, r, z);
-     218           0 :             B_r = 5. * r / r1_disk * B_r0;
-     219           0 :             B_z = -10. * z / r1_disk * B_r0;
-     220             :         }
-     221           0 :         B_phi = azimuthalFieldComponent(r, z, B_r, B_z);
-     222             : 
-     223           0 :     } else if (disk_model == TF17DiskModel::Dd1) { // ===================================================
-     224             :         // for model Dd1, best fit for n = 0.5 
-     225           0 :         double z_sign = z >= 0 ? 1. : -1.; 
-     226           0 :         double z_abs = fabs(z); 
-     227           0 :         if ( z_abs > epsilon ) {
-     228           0 :             double z1_disk_z = z1_disk / z_abs; 
-     229           0 :             double r1_disk_r = 1.5 / (sqrt(z1_disk_z) + 0.5/z1_disk_z); // r1_disk / r
-     230           0 :             double F_r = r1_disk_r*r  <= L_disk ? 1. : exp(1. - r1_disk_r*r/L_disk);
-     231             :         // simplication of the equation in the cosinus
-     232           0 :             double B_z0 = z_sign * B1_disk * F_r * cos(phi - shiftedWindingFunction(r, z) - phi_star_disk);
-     233           0 :             B_r = -0.5/1.5 * r1_disk_r * r1_disk_r * r1_disk_r * r / z_abs * (sqrt(z1_disk_z) - 1/z1_disk_z) * B_z0;
-     234           0 :             B_z = z_sign * r1_disk_r * r1_disk_r * B_z0;
-     235             :         } else {
-     236           0 :             double z_z1_disk = z_abs / z1_disk; 
-     237           0 :             double r1_disk_r = 1.5 * sqrt(z_abs / z1_disk); // r1_disk / r
-     238           0 :             double F_r = r1_disk_r*r  <= L_disk ? 1. : exp(1. - r1_disk_r*r/L_disk);
-     239           0 :             double B_z0 = z_sign * B1_disk * F_r * cos(phi - shiftedWindingFunction(r, z) - phi_star_disk);
-     240           0 :             B_r = -1.125 * r / z1_disk * (1 - 2.5 * z_z1_disk * sqrt(z_z1_disk)) * B_z0;
-     241           0 :             B_z = z_sign * r1_disk_r * r1_disk_r * B_z0;
-     242             :         }
-     243           0 :         B_phi = azimuthalFieldComponent(r, z, B_r, B_z);
-     244             :     }
-     245             : 
-     246             :     // Convert to (x, y, z) components
-     247           0 :     b.x = - (B_r * cosPhi - B_phi * sinPhi); // flip x-component at the end
-     248           0 :     b.y = B_r * sinPhi + B_phi * cosPhi;
-     249           0 :     b.z = B_z;
-     250           0 :         return b;
-     251             : }
-     252             : 
-     253           0 : Vector3d TF17Field::getHaloField(const double& r, const double& z, const double& phi, const double& sinPhi, const double& cosPhi) const {
-     254             :     int m;
-     255             : 
-     256             :         Vector3d b(0.);
-     257           0 :         double r1_halo_r =  (1. + a_halo * z1_halo * z1_halo) / (1. + a_halo * z * z);
-     258             :         // B components in (r, phi, z)
-     259             :     double B_z0;
-     260             : 
-     261           0 :     if (halo_model == TF17HaloModel::C0) { // m = 0
-     262           0 :         B_z0 = B1_halo * exp(-r1_halo_r*r / L_halo); 
-     263           0 :     } else if (halo_model == TF17HaloModel::C1) { // m = 1
-     264             :         // simplication of the equation in the cosinus
-     265           0 :         double phi_prime = phi - shiftedWindingFunction(r, z) - phi_star_halo;
-     266           0 :         B_z0 = B1_halo * exp(-r1_halo_r*r / L_halo) * cos(phi_prime); 
-     267             :     }
-     268             : 
-     269             :     // Contrary to article, Br has been rewriten to a little bit by replacing
-     270             :     // (2 * a * r1**3 * z) / (r**2) by (2 * a * r1**2 * z) / (r * (1+a*z**2))
-     271             :     // but that is strictly equivalent except we can reintroduce the z1 in the expression via r1
-     272           0 :         double B_r = 2 * a_halo * r1_halo_r * r1_halo_r * r * z / (1. + a_halo * z * z) * B_z0;
-     273           0 :         double B_z = r1_halo_r * r1_halo_r * B_z0; 
-     274           0 :         double B_phi = azimuthalFieldComponent(r, z, B_r, B_z);
-     275             : 
-     276             :         // Convert to (x, y, z) components
-     277           0 :         b.x = - (B_r * cosPhi - B_phi * sinPhi);        // flip x-component at the end
-     278           0 :         b.y = B_r * sinPhi + B_phi * cosPhi;
-     279           0 :         b.z = B_z;
-     280             : 
-     281           0 :         return b;
-     282             : }
-     283             : 
-     284           0 : double TF17Field::azimuthalFieldComponent(const double& r, const double& z, const double& B_r, const double& B_z) const {
-     285           0 :         double r_ = r / L_p;
-     286           0 :     double rscale = r > epsilon ? r_ * exp(-r_) / (1 - exp(-r_)) : 1 - r_/2. - r_*r_/12. ;
-     287           0 :         double B_phi = cot_p0 / zscale(z) * rscale * B_r;
-     288           0 :     B_phi = B_phi - 2 * z * r / (H_p * H_p) / zscale(z) * shiftedWindingFunction(r, z) * B_z;
-     289           0 :         return B_phi;
-     290             : }
-     291             : 
-     292           0 : double TF17Field::radialFieldScale(const double& B1, const double& phi_star, const double& z1, const double& phi, const double& r, const double& z) const {
-     293             :     // simplication of the equation in the cosinus
-     294           0 :     double phi_prime = phi - shiftedWindingFunction(r, z) - phi_star;
-     295             :         // This term occures is parameterizations of models A and B always bisymmetric (m = 1)
-     296           0 :         return B1 * exp(-fabs(z1) / H_disk) * cos(phi_prime);
-     297             : }
-     298             : 
-     299           0 : double TF17Field::shiftedWindingFunction(const double& r, const double& z) const {
-     300           0 :     return cot_p0 * log(1 - exp(-r / L_p) + epsilon) / zscale(z);
-     301             : }
-     302             : 
-     303           0 : double TF17Field::zscale(const double& z) const {
-     304           0 :         return 1 + z * z / H_p / H_p;
-     305             : }
-     306             : 
-     307             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/index-sort-f.html b/doc/coverageReport/src/magneticField/index-sort-f.html deleted file mode 100644 index e6f4aee3b..000000000 --- a/doc/coverageReport/src/magneticField/index-sort-f.html +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticFieldHitTotalCoverage
Test:coverage.info.cleanedLines:16691018.2 %
Date:2024-04-08 14:58:22Functions:2913821.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
PT11Field.cpp -
0.0%
-
0.0 %0 / 630.0 %0 / 9
ArchimedeanSpiralField.cpp -
0.0%
-
0.0 %0 / 420.0 %0 / 10
MagneticFieldGrid.cpp -
0.0%
-
0.0 %0 / 310.0 %0 / 11
JF12FieldSolenoidal.cpp -
0.0%
-
0.0 %0 / 1420.0 %0 / 14
TF17Field.cpp -
0.0%
-
0.0 %0 / 1960.0 %0 / 29
JF12Field.cpp -
0.0%
-
0.0 %0 / 2310.0 %0 / 29
MagneticField.cpp -
72.7%72.7%
-
72.7 %48 / 6656.2 %9 / 16
PolarizedSingleModeMagneticField.cpp -
46.9%46.9%
-
46.9 %15 / 32100.0 %2 / 2
CMZField.cpp -
96.3%96.3%
-
96.3 %103 / 107100.0 %18 / 18
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/index-sort-l.html b/doc/coverageReport/src/magneticField/index-sort-l.html deleted file mode 100644 index 2650220e6..000000000 --- a/doc/coverageReport/src/magneticField/index-sort-l.html +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticFieldHitTotalCoverage
Test:coverage.info.cleanedLines:16691018.2 %
Date:2024-04-08 14:58:22Functions:2913821.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
MagneticFieldGrid.cpp -
0.0%
-
0.0 %0 / 310.0 %0 / 11
ArchimedeanSpiralField.cpp -
0.0%
-
0.0 %0 / 420.0 %0 / 10
PT11Field.cpp -
0.0%
-
0.0 %0 / 630.0 %0 / 9
JF12FieldSolenoidal.cpp -
0.0%
-
0.0 %0 / 1420.0 %0 / 14
TF17Field.cpp -
0.0%
-
0.0 %0 / 1960.0 %0 / 29
JF12Field.cpp -
0.0%
-
0.0 %0 / 2310.0 %0 / 29
PolarizedSingleModeMagneticField.cpp -
46.9%46.9%
-
46.9 %15 / 32100.0 %2 / 2
MagneticField.cpp -
72.7%72.7%
-
72.7 %48 / 6656.2 %9 / 16
CMZField.cpp -
96.3%96.3%
-
96.3 %103 / 107100.0 %18 / 18
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/index.html b/doc/coverageReport/src/magneticField/index.html deleted file mode 100644 index e4d6a01d2..000000000 --- a/doc/coverageReport/src/magneticField/index.html +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticFieldHitTotalCoverage
Test:coverage.info.cleanedLines:16691018.2 %
Date:2024-04-08 14:58:22Functions:2913821.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
ArchimedeanSpiralField.cpp -
0.0%
-
0.0 %0 / 420.0 %0 / 10
CMZField.cpp -
96.3%96.3%
-
96.3 %103 / 107100.0 %18 / 18
JF12Field.cpp -
0.0%
-
0.0 %0 / 2310.0 %0 / 29
JF12FieldSolenoidal.cpp -
0.0%
-
0.0 %0 / 1420.0 %0 / 14
MagneticField.cpp -
72.7%72.7%
-
72.7 %48 / 6656.2 %9 / 16
MagneticFieldGrid.cpp -
0.0%
-
0.0 %0 / 310.0 %0 / 11
PT11Field.cpp -
0.0%
-
0.0 %0 / 630.0 %0 / 9
PolarizedSingleModeMagneticField.cpp -
46.9%46.9%
-
46.9 %15 / 32100.0 %2 / 2
TF17Field.cpp -
0.0%
-
0.0 %0 / 1960.0 %0 / 29
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/turbulentField/GridTurbulence.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/turbulentField/GridTurbulence.cpp.func-sort-c.html deleted file mode 100644 index 166f69ed4..000000000 --- a/doc/coverageReport/src/magneticField/turbulentField/GridTurbulence.cpp.func-sort-c.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/turbulentField/GridTurbulence.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField/turbulentField - GridTurbulence.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8910485.6 %
Date:2024-04-08 14:58:22Functions:71353.8 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa14GridTurbulence10dumpToFileENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZNK7crpropa14GridTurbulence16getPowerSpectrumEv0
_ZNK7crpropa14GridTurbulence18getMeanFieldVectorEv0
_ZNK7crpropa14GridTurbulence19getRmsFieldStrengthEv0
_ZNK7crpropa14GridTurbulence20getMeanFieldStrengthEv0
_ZNK7crpropa14GridTurbulence26getRmsFieldStrengthPerAxisEv0
_ZNK7crpropa14GridTurbulence7getGridEv1
_ZNK7crpropa14GridTurbulence8getFieldERKNS_7Vector3IdEE4
_ZN7crpropa14GridTurbulence14initTurbulenceEv6
_ZN7crpropa14GridTurbulence8initGridERKNS_14GridPropertiesE6
_ZN7crpropa14GridTurbulenceC2ERKNS_18TurbulenceSpectrumERKNS_14GridPropertiesEj6
_ZN7crpropa14GridTurbulence24executeInverseFFTInplaceENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEPA2_fS8_S8_10
_ZN7crpropa14GridTurbulence21checkGridRequirementsENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEdd13
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/turbulentField/GridTurbulence.cpp.func.html b/doc/coverageReport/src/magneticField/turbulentField/GridTurbulence.cpp.func.html deleted file mode 100644 index 59602c105..000000000 --- a/doc/coverageReport/src/magneticField/turbulentField/GridTurbulence.cpp.func.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/turbulentField/GridTurbulence.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField/turbulentField - GridTurbulence.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8910485.6 %
Date:2024-04-08 14:58:22Functions:71353.8 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa14GridTurbulence14initTurbulenceEv6
_ZN7crpropa14GridTurbulence21checkGridRequirementsENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEdd13
_ZN7crpropa14GridTurbulence24executeInverseFFTInplaceENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEPA2_fS8_S8_10
_ZN7crpropa14GridTurbulence8initGridERKNS_14GridPropertiesE6
_ZN7crpropa14GridTurbulenceC2ERKNS_18TurbulenceSpectrumERKNS_14GridPropertiesEj6
_ZNK7crpropa14GridTurbulence10dumpToFileENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZNK7crpropa14GridTurbulence16getPowerSpectrumEv0
_ZNK7crpropa14GridTurbulence18getMeanFieldVectorEv0
_ZNK7crpropa14GridTurbulence19getRmsFieldStrengthEv0
_ZNK7crpropa14GridTurbulence20getMeanFieldStrengthEv0
_ZNK7crpropa14GridTurbulence26getRmsFieldStrengthPerAxisEv0
_ZNK7crpropa14GridTurbulence7getGridEv1
_ZNK7crpropa14GridTurbulence8getFieldERKNS_7Vector3IdEE4
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/turbulentField/GridTurbulence.cpp.gcov.html b/doc/coverageReport/src/magneticField/turbulentField/GridTurbulence.cpp.gcov.html deleted file mode 100644 index fb8a58ac8..000000000 --- a/doc/coverageReport/src/magneticField/turbulentField/GridTurbulence.cpp.gcov.html +++ /dev/null @@ -1,289 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/turbulentField/GridTurbulence.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField/turbulentField - GridTurbulence.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8910485.6 %
Date:2024-04-08 14:58:22Functions:71353.8 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/magneticField/turbulentField/GridTurbulence.h"
-       2             : #include "crpropa/GridTools.h"
-       3             : #include "crpropa/Random.h"
-       4             : 
-       5             : #ifdef CRPROPA_HAVE_FFTW3F
-       6             : 
-       7             : namespace crpropa {
-       8             : 
-       9             : 
-      10           6 : GridTurbulence::GridTurbulence(const TurbulenceSpectrum &spectrum,
-      11             :                                const GridProperties &gridProp,
-      12           6 :                                unsigned int seed)
-      13           6 :     : TurbulentField(spectrum), seed(seed) {
-      14           6 :         initGrid(gridProp);
-      15           6 :         checkGridRequirements(gridPtr, spectrum.getLmin(), spectrum.getLmax());
-      16           6 :         initTurbulence();
-      17           6 : }
-      18             : 
-      19           6 : void GridTurbulence::initGrid(const GridProperties &p) {
-      20           6 :         gridPtr = new Grid3f(p);
-      21           6 : }
-      22             : 
-      23           4 : Vector3d GridTurbulence::getField(const Vector3d &pos) const {
-      24           4 :         return gridPtr->interpolate(pos);
-      25             : }
-      26             : 
-      27           1 : const ref_ptr<Grid3f> &GridTurbulence::getGrid() const { return gridPtr; }
-      28             : 
-      29           6 : void GridTurbulence::initTurbulence() {
-      30             : 
-      31             :         Vector3d spacing = gridPtr->getSpacing();
-      32             :         size_t n = gridPtr->getNx(); // size of array
-      33           6 :         size_t n2 = (size_t)floor(n / 2) +
-      34             :                     1; // size array in z-direction in configuration space
-      35             : 
-      36             :         // arrays to hold the complex vector components of the B(k)-field
-      37             :         fftwf_complex *Bkx, *Bky, *Bkz;
-      38           6 :         Bkx = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * n * n * n2);
-      39           6 :         Bky = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * n * n * n2);
-      40           6 :         Bkz = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * n * n * n2);
-      41             : 
-      42           6 :         Random random;
-      43           6 :         if (seed != 0)
-      44           4 :                 random.seed(seed); // use given seed
-      45             : 
-      46             :         // calculate the n possible discrete wave numbers
-      47           6 :         double K[n];
-      48         390 :         for (size_t i = 0; i < n; i++)
-      49         384 :                 K[i] = ((double)i / n - i / (n / 2));
-      50             : 
-      51             :         // double kMin = 2*M_PI / lMax; // * 2 * spacing.x; // spacing.x / lMax;
-      52             :         // double kMax = 2*M_PI / lMin; // * 2 * spacing.x; // spacing.x / lMin;
-      53           6 :         double kMin = spacing.x / spectrum.getLmax();
-      54           6 :         double kMax = spacing.x / spectrum.getLmin();
-      55           6 :         auto lambda = 1 / spacing.x * 2 * M_PI;
-      56             : 
-      57             :         Vector3f n0(1, 1, 1); // arbitrary vector to construct orthogonal base
-      58             : 
-      59         390 :         for (size_t ix = 0; ix < n; ix++) {
-      60       24960 :                 for (size_t iy = 0; iy < n; iy++) {
-      61      835584 :                         for (size_t iz = 0; iz < n2; iz++) {
-      62             :         
-      63             :                                 Vector3f ek, e1, e2;  // orthogonal base
-      64             : 
-      65      811008 :                                 size_t i = ix * n * n2 + iy * n2 + iz;
-      66      811008 :                                 ek.setXYZ(K[ix], K[iy], K[iz]);
-      67      811008 :                                 double k = ek.getR();
-      68             : 
-      69             :                                 // wave outside of turbulent range -> B(k) = 0
-      70      811008 :                                 if ((k < kMin) || (k > kMax)) {
-      71      395939 :                                         Bkx[i][0] = 0;
-      72      395939 :                                         Bkx[i][1] = 0;
-      73      395939 :                                         Bky[i][0] = 0;
-      74      395939 :                                         Bky[i][1] = 0;
-      75      395939 :                                         Bkz[i][0] = 0;
-      76      395939 :                                         Bkz[i][1] = 0;
-      77             :                                         continue;
-      78             :                                 }
-      79             : 
-      80             :                                 // construct an orthogonal base ek, e1, e2
-      81      415069 :                                 if (ek.isParallelTo(n0, float(1e-3))) {
-      82             :                                         // ek parallel to (1,1,1)
-      83             :                                         e1.setXYZ(-1., 1., 0);
-      84             :                                         e2.setXYZ(1., 1., -2.);
-      85             :                                 } else {
-      86             :                                         // ek not parallel to (1,1,1)
-      87             :                                         e1 = n0.cross(ek);
-      88             :                                         e2 = ek.cross(e1);
-      89             :                                 }
-      90             :                                 e1 /= e1.getR();
-      91             :                                 e2 /= e2.getR();
-      92             : 
-      93             :                                 // random orientation perpendicular to k
-      94      415069 :                                 double theta = 2 * M_PI * random.rand();
-      95      415069 :                                 Vector3f b = e1 * std::cos(theta) + e2 * std::sin(theta); // real b-field vector
-      96             : 
-      97             :                                 // normal distributed amplitude with mean = 0
-      98      415069 :                                 b *= std::sqrt(spectrum.energySpectrum(k*lambda));
-      99             :                                 
-     100             :                                 // uniform random phase
-     101      415069 :                                 double phase = 2 * M_PI * random.rand();
-     102      415069 :                                 double cosPhase = std::cos(phase); // real part
-     103      415069 :                                 double sinPhase = std::sin(phase); // imaginary part
-     104             : 
-     105      415069 :                                 Bkx[i][0] = b.x * cosPhase;
-     106      415069 :                                 Bkx[i][1] = b.x * sinPhase;
-     107      415069 :                                 Bky[i][0] = b.y * cosPhase;
-     108      415069 :                                 Bky[i][1] = b.y * sinPhase;
-     109      415069 :                                 Bkz[i][0] = b.z * cosPhase;
-     110      415069 :                                 Bkz[i][1] = b.z * sinPhase;
-     111             :                         } // for iz
-     112             :                 }     // for iy
-     113             :         }         // for ix
-     114             : 
-     115           6 :         executeInverseFFTInplace(gridPtr, Bkx, Bky, Bkz);
-     116             : 
-     117           6 :         fftwf_free(Bkx);
-     118           6 :         fftwf_free(Bky);
-     119           6 :         fftwf_free(Bkz);
-     120             : 
-     121          24 :         scaleGrid(gridPtr, spectrum.getBrms() /
-     122          12 :                                rmsFieldStrength(gridPtr)); // normalize to Brms
-     123          12 : }
-     124             : 
-     125             : // Check the grid properties before the FFT procedure
-     126          13 : void GridTurbulence::checkGridRequirements(ref_ptr<Grid3f> grid, double lMin,
-     127             :                                            double lMax) {
-     128             :         size_t Nx = grid->getNx();
-     129             :         size_t Ny = grid->getNy();
-     130             :         size_t Nz = grid->getNz();
-     131             :         Vector3d spacing = grid->getSpacing();
-     132             : 
-     133          13 :         if ((Nx != Ny) or (Ny != Nz))
-     134           0 :                 throw std::runtime_error("turbulentField: only cubic grid supported");
-     135          13 :         if ((spacing.x != spacing.y) or (spacing.y != spacing.z))
-     136           0 :                 throw std::runtime_error("turbulentField: only equal spacing suported");
-     137          13 :         if (lMin < 2 * spacing.x)
-     138           1 :                 throw std::runtime_error("turbulentField: lMin < 2 * spacing");
-     139          12 :         if (lMax > Nx * spacing.x) // before was (lMax > Nx * spacing.x / 2), why?
-     140           1 :                 throw std::runtime_error("turbulentField: lMax > size");
-     141          11 :         if (lMax < lMin) 
-     142           1 :                 throw std::runtime_error("lMax < lMin");
-     143          10 : }
-     144             : 
-     145             : // Execute inverse discrete FFT in-place for a 3D grid, from complex to real
-     146             : // space
-     147          10 : void GridTurbulence::executeInverseFFTInplace(ref_ptr<Grid3f> grid,
-     148             :                                               fftwf_complex *Bkx,
-     149             :                                               fftwf_complex *Bky,
-     150             :                                               fftwf_complex *Bkz) {
-     151             : 
-     152             :         size_t n = grid->getNx(); // size of array
-     153          10 :         size_t n2 = (size_t)floor(n / 2) +
-     154             :                     1; // size array in z-direction in configuration space
-     155             : 
-     156             :         // in-place, complex to real, inverse Fourier transformation on each
-     157             :         // component note that the last elements of B(x) are unused now
-     158             :         float *Bx = (float *)Bkx;
-     159          10 :         fftwf_plan plan_x = fftwf_plan_dft_c2r_3d(n, n, n, Bkx, Bx, FFTW_ESTIMATE);
-     160          10 :         fftwf_execute(plan_x);
-     161          10 :         fftwf_destroy_plan(plan_x);
-     162             : 
-     163             :         float *By = (float *)Bky;
-     164          10 :         fftwf_plan plan_y = fftwf_plan_dft_c2r_3d(n, n, n, Bky, By, FFTW_ESTIMATE);
-     165          10 :         fftwf_execute(plan_y);
-     166          10 :         fftwf_destroy_plan(plan_y);
-     167             : 
-     168             :         float *Bz = (float *)Bkz;
-     169          10 :         fftwf_plan plan_z = fftwf_plan_dft_c2r_3d(n, n, n, Bkz, Bz, FFTW_ESTIMATE);
-     170          10 :         fftwf_execute(plan_z);
-     171          10 :         fftwf_destroy_plan(plan_z);
-     172             : 
-     173             :         // save to grid
-     174         650 :         for (size_t ix = 0; ix < n; ix++) {
-     175       41600 :                 for (size_t iy = 0; iy < n; iy++) {
-     176     2662400 :                         for (size_t iz = 0; iz < n; iz++) {
-     177     2621440 :                                 size_t i = ix * n * 2 * n2 + iy * 2 * n2 + iz;
-     178             :                                 Vector3f &b = grid->get(ix, iy, iz);
-     179     2621440 :                                 b.x = Bx[i];
-     180     2621440 :                                 b.y = By[i];
-     181     2621440 :                                 b.z = Bz[i];
-     182             :                         }
-     183             :                 }
-     184             :         }
-     185          10 : }
-     186             : 
-     187           0 : Vector3f GridTurbulence::getMeanFieldVector() const {
-     188           0 :         return meanFieldVector(gridPtr);
-     189             : }
-     190             : 
-     191           0 : double GridTurbulence::getMeanFieldStrength() const {
-     192           0 :         return meanFieldStrength(gridPtr);
-     193             : }
-     194             : 
-     195           0 : double GridTurbulence::getRmsFieldStrength() const {
-     196           0 :         return rmsFieldStrength(gridPtr);
-     197             : }
-     198             : 
-     199           0 : std::array<float, 3> GridTurbulence::getRmsFieldStrengthPerAxis() const {
-     200           0 :         return rmsFieldStrengthPerAxis(gridPtr);
-     201             : }
-     202             :         
-     203           0 : std::vector<std::pair<int, float>> GridTurbulence::getPowerSpectrum() const {
-     204           0 :         return gridPowerSpectrum(gridPtr);
-     205             : }
-     206             : 
-     207           0 : void GridTurbulence::dumpToFile(std::string filename) const {
-     208           0 :         dumpGrid(gridPtr, filename);
-     209           0 : }
-     210             : 
-     211             : } // namespace crpropa
-     212             : 
-     213             : #endif // CRPROPA_HAVE_FFTW3F
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/turbulentField/HelicalGridTurbulence.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/turbulentField/HelicalGridTurbulence.cpp.func-sort-c.html deleted file mode 100644 index ce798a6be..000000000 --- a/doc/coverageReport/src/magneticField/turbulentField/HelicalGridTurbulence.cpp.func-sort-c.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/turbulentField/HelicalGridTurbulence.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField/turbulentField - HelicalGridTurbulence.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0590.0 %
Date:2024-04-08 14:58:22Functions:020.0 %
-
- -
- - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa21HelicalGridTurbulence14initTurbulenceENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEddddid0
_ZN7crpropa21HelicalGridTurbulenceC2ERKNS_24SimpleTurbulenceSpectrumERKNS_14GridPropertiesEdj0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/turbulentField/HelicalGridTurbulence.cpp.func.html b/doc/coverageReport/src/magneticField/turbulentField/HelicalGridTurbulence.cpp.func.html deleted file mode 100644 index 3a300bc05..000000000 --- a/doc/coverageReport/src/magneticField/turbulentField/HelicalGridTurbulence.cpp.func.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/turbulentField/HelicalGridTurbulence.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField/turbulentField - HelicalGridTurbulence.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0590.0 %
Date:2024-04-08 14:58:22Functions:020.0 %
-
- -
- - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa21HelicalGridTurbulence14initTurbulenceENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEddddid0
_ZN7crpropa21HelicalGridTurbulenceC2ERKNS_24SimpleTurbulenceSpectrumERKNS_14GridPropertiesEdj0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/turbulentField/HelicalGridTurbulence.cpp.gcov.html b/doc/coverageReport/src/magneticField/turbulentField/HelicalGridTurbulence.cpp.gcov.html deleted file mode 100644 index 4a3415bc2..000000000 --- a/doc/coverageReport/src/magneticField/turbulentField/HelicalGridTurbulence.cpp.gcov.html +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/turbulentField/HelicalGridTurbulence.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField/turbulentField - HelicalGridTurbulence.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0590.0 %
Date:2024-04-08 14:58:22Functions:020.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/magneticField/turbulentField/HelicalGridTurbulence.h"
-       2             : #include "crpropa/GridTools.h"
-       3             : #include "crpropa/Random.h"
-       4             : 
-       5             : #ifdef CRPROPA_HAVE_FFTW3F
-       6             : #include "fftw3.h"
-       7             : 
-       8             : namespace crpropa {
-       9             : 
-      10           0 : HelicalGridTurbulence::HelicalGridTurbulence(const SimpleTurbulenceSpectrum &spectrum,
-      11             :                                              const GridProperties &gridProp,
-      12           0 :                                              double H, unsigned int seed)
-      13           0 :     : SimpleGridTurbulence(spectrum, gridProp, seed), H(H) {
-      14           0 :         initTurbulence(gridPtr, spectrum.getBrms(), spectrum.getLmin(),
-      15           0 :                        spectrum.getLmax(), -spectrum.getSindex() - 2, seed, H);
-      16           0 : }
-      17             : 
-      18           0 : void HelicalGridTurbulence::initTurbulence(ref_ptr<Grid3f> grid, double Brms,
-      19             :                                            double lMin, double lMax,
-      20             :                                            double alpha, int seed, double H) {
-      21             : 
-      22           0 :         checkGridRequirements(grid, lMin, lMax);
-      23             : 
-      24             :         Vector3d spacing = grid->getSpacing();
-      25             :         size_t n = grid->getNx(); // size of array
-      26           0 :         size_t n2 = (size_t)floor(n / 2) +
-      27             :                     1; // size array in z-direction in configuration space
-      28             : 
-      29             :         // arrays to hold the complex vector components of the B(k)-field
-      30             :         fftwf_complex *Bkx, *Bky, *Bkz;
-      31           0 :         Bkx = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * n * n * n2);
-      32           0 :         Bky = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * n * n * n2);
-      33           0 :         Bkz = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * n * n * n2);
-      34             : 
-      35           0 :         Random random;
-      36           0 :         if (seed != 0)
-      37           0 :                 random.seed(seed); // use given seed
-      38             : 
-      39             :         // calculate the n possible discrete wave numbers
-      40           0 :         double K[n];
-      41           0 :         for (size_t i = 0; i < n; i++)
-      42           0 :                 K[i] = (double)i / n - i / (n / 2);
-      43             : 
-      44             :         // only used if there is a helicity
-      45             :         double Bktot, Bkplus, Bkminus, thetaplus, thetaminus;
-      46             : 
-      47           0 :         double kMin = spacing.x / lMax;
-      48           0 :         double kMax = spacing.x / lMin;
-      49             :         Vector3f b;           // real b-field vector
-      50             :         Vector3f ek, e1, e2;  // orthogonal base
-      51             :         Vector3f n0(1, 1, 1); // arbitrary vector to construct orthogonal base
-      52             : 
-      53           0 :         for (size_t ix = 0; ix < n; ix++) {
-      54           0 :                 for (size_t iy = 0; iy < n; iy++) {
-      55           0 :                         for (size_t iz = 0; iz < n2; iz++) {
-      56             : 
-      57           0 :                                 size_t i = ix * n * n2 + iy * n2 + iz;
-      58           0 :                                 ek.setXYZ(K[ix], K[iy], K[iz]);
-      59           0 :                                 double k = ek.getR();
-      60             : 
-      61             :                                 // wave outside of turbulent range -> B(k) = 0
-      62           0 :                                 if ((k < kMin) || (k > kMax)) {
-      63           0 :                                         Bkx[i][0] = 0;
-      64           0 :                                         Bkx[i][1] = 0;
-      65           0 :                                         Bky[i][0] = 0;
-      66           0 :                                         Bky[i][1] = 0;
-      67           0 :                                         Bkz[i][0] = 0;
-      68           0 :                                         Bkz[i][1] = 0;
-      69             :                                         continue;
-      70             :                                 }
-      71             : 
-      72             :                                 // construct an orthogonal base ek, e1, e2
-      73             :                                 // (for helical fields together with the real transform the
-      74             :                                 // following convention must be used: e1(-k) = e1(k), e2(-k) = -
-      75             :                                 // e2(k)
-      76           0 :                                 if (ek.getAngleTo(n0) < 1e-3) { // ek parallel to (1,1,1)
-      77             :                                         e1.setXYZ(-1, 1, 0);
-      78             :                                         e2.setXYZ(1, 1, -2);
-      79             :                                 } else { // ek not parallel to (1,1,1)
-      80             :                                         e1 = n0.cross(ek);
-      81             :                                         e2 = ek.cross(e1);
-      82             :                                 }
-      83             :                                 e1 /= e1.getR();
-      84             :                                 e2 /= e2.getR();
-      85             : 
-      86             : 
-      87           0 :                                 double Bkprefactor = mu0 / (4 * M_PI * pow(k, 3));
-      88           0 :                                 Bktot = fabs(random.randNorm() * pow(k, alpha / 2));
-      89           0 :                                 Bkplus = Bkprefactor * sqrt((1 + H) / 2) * Bktot;
-      90           0 :                                 Bkminus = Bkprefactor * sqrt((1 - H) / 2) * Bktot;
-      91           0 :                                 thetaplus = 2 * M_PI * random.rand();
-      92           0 :                                 thetaminus = 2 * M_PI * random.rand();
-      93           0 :                                 double ctp = cos(thetaplus);
-      94           0 :                                 double stp = sin(thetaplus);
-      95           0 :                                 double ctm = cos(thetaminus);
-      96           0 :                                 double stm = sin(thetaminus);
-      97             : 
-      98           0 :                                 Bkx[i][0] = ((Bkplus * ctp + Bkminus * ctm) * e1.x +
-      99           0 :                                              (-Bkplus * stp + Bkminus * stm) * e2.x) /
-     100             :                                             sqrt(2);
-     101           0 :                                 Bkx[i][1] = ((Bkplus * stp + Bkminus * stm) * e1.x +
-     102           0 :                                              (Bkplus * ctp - Bkminus * ctm) * e2.x) /
-     103             :                                             sqrt(2);
-     104           0 :                                 Bky[i][0] = ((Bkplus * ctp + Bkminus * ctm) * e1.y +
-     105           0 :                                              (-Bkplus * stp + Bkminus * stm) * e2.y) /
-     106             :                                             sqrt(2);
-     107           0 :                                 Bky[i][1] = ((Bkplus * stp + Bkminus * stm) * e1.y +
-     108           0 :                                              (Bkplus * ctp - Bkminus * ctm) * e2.y) /
-     109             :                                             sqrt(2);
-     110           0 :                                 Bkz[i][0] = ((Bkplus * ctp + Bkminus * ctm) * e1.z +
-     111           0 :                                              (-Bkplus * stp + Bkminus * stm) * e2.z) /
-     112             :                                             sqrt(2);
-     113           0 :                                 Bkz[i][1] = ((Bkplus * stp + Bkminus * stm) * e1.z +
-     114           0 :                                              (Bkplus * ctp - Bkminus * ctm) * e2.z) /
-     115             :                                             sqrt(2);
-     116             : 
-     117             :                                 Vector3f BkRe(Bkx[i][0], Bky[i][0], Bkz[i][0]);
-     118             :                                 Vector3f BkIm(Bkx[i][1], Bky[i][1], Bkz[i][1]);
-     119             :                         } // for iz
-     120             :                 }     // for iy
-     121             :         }         // for ix
-     122             : 
-     123           0 :         executeInverseFFTInplace(grid, Bkx, Bky, Bkz);
-     124             : 
-     125           0 :         scaleGrid(grid, Brms / rmsFieldStrength(grid)); // normalize to Brms
-     126           0 : }
-     127             : 
-     128             : } // namespace crpropa
-     129             : 
-     130             : #endif // CRPROPA_HAVE_FFTW3F
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/turbulentField/PlaneWaveTurbulence.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/turbulentField/PlaneWaveTurbulence.cpp.func-sort-c.html deleted file mode 100644 index ecbe74169..000000000 --- a/doc/coverageReport/src/magneticField/turbulentField/PlaneWaveTurbulence.cpp.func-sort-c.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/turbulentField/PlaneWaveTurbulence.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField/turbulentField - PlaneWaveTurbulence.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:464895.8 %
Date:2024-04-08 14:58:22Functions:22100.0 %
-
- -
- - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa19PlaneWaveTurbulenceC2ERKNS_18TurbulenceSpectrumEii2
_ZNK7crpropa19PlaneWaveTurbulence8getFieldERKNS_7Vector3IdEE45
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/turbulentField/PlaneWaveTurbulence.cpp.func.html b/doc/coverageReport/src/magneticField/turbulentField/PlaneWaveTurbulence.cpp.func.html deleted file mode 100644 index 3a3efe0af..000000000 --- a/doc/coverageReport/src/magneticField/turbulentField/PlaneWaveTurbulence.cpp.func.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/turbulentField/PlaneWaveTurbulence.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField/turbulentField - PlaneWaveTurbulence.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:464895.8 %
Date:2024-04-08 14:58:22Functions:22100.0 %
-
- -
- - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa19PlaneWaveTurbulenceC2ERKNS_18TurbulenceSpectrumEii2
_ZNK7crpropa19PlaneWaveTurbulence8getFieldERKNS_7Vector3IdEE45
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/turbulentField/PlaneWaveTurbulence.cpp.gcov.html b/doc/coverageReport/src/magneticField/turbulentField/PlaneWaveTurbulence.cpp.gcov.html deleted file mode 100644 index 0344bde9e..000000000 --- a/doc/coverageReport/src/magneticField/turbulentField/PlaneWaveTurbulence.cpp.gcov.html +++ /dev/null @@ -1,517 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/turbulentField/PlaneWaveTurbulence.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField/turbulentField - PlaneWaveTurbulence.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:464895.8 %
Date:2024-04-08 14:58:22Functions:22100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : // This file contains an implementation of a vectorized cosine, which
-       2             : // is based in part on the implementations in the library "SLEEF" by
-       3             : // Naoki Shibata. SLEEF was used under the Boost Software License,
-       4             : // Version 1.0. The original source file contained the following
-       5             : // copyright notice:
-       6             : //
-       7             : //   //          Copyright Naoki Shibata 2010 - 2018.
-       8             : //   // Distributed under the Boost Software License, Version 1.0.
-       9             : //   //    (See accompanying file LICENSE.txt or copy at
-      10             : //   //          http://www.boost.org/LICENSE_1_0.txt)
-      11             : //
-      12             : // SLEEF was used under the following license, which is not necessarily the
-      13             : // license that applies to this file:
-      14             : //
-      15             : //         Boost Software License - Version 1.0 - August 17th, 2003
-      16             : //
-      17             : //         Permission is hereby granted, free of charge, to any person or
-      18             : //         organization obtaining a copy of the software and accompanying
-      19             : //         documentation covered by this license (the "Software") to use,
-      20             : //         reproduce, display, distribute, execute, and transmit the Software,
-      21             : //         and to prepare derivative works of the Software, and to permit
-      22             : //         third-parties to whom the Software is furnished to do so, all subject
-      23             : //         to the following:
-      24             : //
-      25             : //         The copyright notices in the Software and this entire statement,
-      26             : //         including the above license grant, this restriction and the following
-      27             : //         disclaimer, must be included in all copies of the Software, in whole
-      28             : //         or in part, and all derivative works of the Software, unless such
-      29             : //         copies or derivative works are solely in the form of
-      30             : //         machine-executable object code generated by a source language
-      31             : //         processor.
-      32             : //
-      33             : //         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-      34             : //         EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-      35             : //         MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
-      36             : //         NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE
-      37             : //         DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER
-      38             : //         LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
-      39             : //         OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-      40             : //         THE SOFTWARE.
-      41             : 
-      42             : #include "crpropa/magneticField/turbulentField/PlaneWaveTurbulence.h"
-      43             : #include "crpropa/GridTools.h"
-      44             : #include "crpropa/Random.h"
-      45             : #include "crpropa/Units.h"
-      46             : 
-      47             : #include "kiss/logger.h"
-      48             : 
-      49             : #include <iostream>
-      50             : 
-      51             : #if defined(FAST_WAVES)
-      52             : #if defined(__SSE__) && defined(__SSE2__) && defined(__SSE3__) && defined(__SSE4_1__) && defined(__SSE4_2__) && defined(__AVX__)
-      53             : #define ENABLE_FAST_WAVES
-      54             : #else
-      55             : #error "FAST_WAVES is enabled, but it appears that not all required SIMD extensions are enabled in the compiler. Without these extensions, the FAST_WAVES optimization cannot be used. Please make sure that the SIMD_EXTENSIONS option in cmake matches the capabilities of your target CPU, or (if your target CPU does not support the required extensions), disable the FAST_WAVES flag in cmake."
-      56             : #endif
-      57             : #endif
-      58             : 
-      59             : 
-      60             : #ifdef ENABLE_FAST_WAVES
-      61             : #include <immintrin.h>
-      62             : #endif
-      63             : 
-      64             : namespace crpropa {
-      65             : #ifdef ENABLE_FAST_WAVES
-      66             : // see
-      67             : // https://stackoverflow.com/questions/49941645/get-sum-of-values-stored-in-m256d-with-sse-avx
-      68             : double hsum_double_avx(__m256d v) {
-      69             :         __m128d vlow = _mm256_castpd256_pd128(v);
-      70             :         __m128d vhigh = _mm256_extractf128_pd(v, 1); // high 128
-      71             :         vlow = _mm_add_pd(vlow, vhigh);              // reduce down to 128
-      72             : 
-      73             :         __m128d high64 = _mm_unpackhi_pd(vlow, vlow);
-      74             :         return _mm_cvtsd_f64(_mm_add_sd(vlow, high64)); // reduce to scalar
-      75             : }
-      76             : #endif // defined(ENABLE_FAST_WAVES)
-      77             : 
-      78           2 : PlaneWaveTurbulence::PlaneWaveTurbulence(const TurbulenceSpectrum &spectrum,
-      79           2 :                                          int Nm, int seed)
-      80           2 :     : TurbulentField(spectrum), Nm(Nm) {
-      81             : 
-      82             : #ifdef ENABLE_FAST_WAVES
-      83             :         KISS_LOG_INFO << "PlaneWaveTurbulence: Using SIMD TD13 implementation"
-      84             :                       << std::endl;
-      85             : 
-      86             :         // There used to be a cpuid check here, to see if the cpu running
-      87             :         // this code would support SIMD (SSE + AVX). However, the library providing
-      88             :         // the relevant function is no longer being used, and doing this manually
-      89             :         // might be a bit too much work.
-      90             : #endif
-      91             : 
-      92           2 :         if (Nm <= 1) {
-      93           0 :                 throw std::runtime_error(
-      94             :                     "PlaneWaveTurbulence: Nm <= 1. Specify at least two wavemodes in "
-      95           0 :                     "order to generate the k distribution properly.");
-      96             :         }
-      97             : 
-      98           2 :         Random random;
-      99           2 :         if (seed != 0)
-     100           2 :                 random.seed(seed);
-     101             : 
-     102           2 :         double kmax = 2 * M_PI / spectrum.getLmin();
-     103           2 :         double kmin = 2 * M_PI / spectrum.getLmax();
-     104             : 
-     105           4 :         xi = std::vector<Vector3d>(Nm, Vector3d(0.));
-     106           4 :         kappa = std::vector<Vector3d>(Nm, Vector3d(0.));
-     107           2 :         phi = std::vector<double>(Nm, 0.);
-     108           2 :         costheta = std::vector<double>(Nm, 0.);
-     109           2 :         beta = std::vector<double>(Nm, 0.);
-     110           2 :         Ak = std::vector<double>(Nm, 0.);
-     111           2 :         k = std::vector<double>(Nm, 0.);
-     112             : 
-     113           2 :         double delta = log10(kmax / kmin);
-     114          22 :         for (int i = 0; i < Nm; i++) {
-     115          20 :                 k[i] = pow(10, log10(kmin) + ((double)i) / ((double)(Nm - 1)) * delta);
-     116             :         }
-     117             : 
-     118             :         // * compute Ak *
-     119             : 
-     120             :         double delta_k0 =
-     121           2 :             (k[1] - k[0]) / k[1]; // multiply this by k[i] to get delta_k[i]
-     122             :         // Note: this is probably unnecessary since it's just a factor
-     123             :         // and will get normalized out anyways. It's not like this is
-     124             :         // performance-sensitive code though, and I don't want to change
-     125             :         // anything numerical now.
-     126             : 
-     127             :         // For this loop, the Ak array actually contains Gk*delta_k (ie
-     128             :         // non-normalized Ak^2). Normalization happens in a second loop,
-     129             :         // once the total is known.
-     130             :         double Ak2_sum = 0; // sum of Ak^2 over all k
-     131          22 :         for (int i = 0; i < Nm; i++) {
-     132          20 :                 double k = this->k[i];
-     133          20 :                 double kHat = k * spectrum.getLbendover();
-     134          20 :                 double Gk = spectrum.energySpectrum(k) * (1 + kHat * kHat);     // correct different implementation in TD 13 (eq. 5, missing + 1 in the denuminators exponent)
-     135          20 :                 Ak[i] = Gk * delta_k0 * k;
-     136          20 :                 Ak2_sum += Ak[i];
-     137             : 
-     138             :                 // phi, costheta, and sintheta are for drawing vectors with
-     139             :                 // uniform distribution on the unit sphere.
-     140             :                 // This is similar to Random::randVector(): their t is our phi,
-     141             :                 // z is costheta, and r is sintheta. Our kappa is equivalent to
-     142             :                 // the return value of randVector(); however, TD13 then reuse
-     143             :                 // these values to generate a random vector perpendicular to kappa.
-     144          20 :                 double phi = random.randUniform(-M_PI, M_PI);
-     145          20 :                 double costheta = random.randUniform(-1., 1.);
-     146          20 :                 double sintheta = sqrt(1 - costheta * costheta);
-     147             : 
-     148          20 :                 double alpha = random.randUniform(0, 2 * M_PI);
-     149          20 :                 double beta = random.randUniform(0, 2 * M_PI);
-     150             : 
-     151             :                 Vector3d kappa =
-     152          20 :                     Vector3d(sintheta * cos(phi), sintheta * sin(phi), costheta);
-     153             : 
-     154             :                 // NOTE: all other variable names match the ones from the TD13 paper.
-     155             :                 // However, our xi is actually their psi, and their xi isn't used at
-     156             :                 // all. (Though both can be used for the polarization vector, according
-     157             :                 // to the paper.) The reason for this discrepancy is that this code
-     158             :                 // used to be based on the original GJ99 paper, which provided only a
-     159             :                 // xi vector, and this xi happens to be almost the same as TD13's psi.
-     160             :                 Vector3d xi =
-     161          20 :                     Vector3d(costheta * cos(phi) * cos(alpha) + sin(phi) * sin(alpha),
-     162          20 :                              costheta * sin(phi) * cos(alpha) - cos(phi) * sin(alpha),
-     163          20 :                              -sintheta * cos(alpha));
-     164             : 
-     165             :                 this->xi[i] = xi;
-     166             :                 this->kappa[i] = kappa;
-     167          20 :                 this->phi[i] = phi;
-     168          20 :                 this->costheta[i] = costheta;
-     169          20 :                 this->beta[i] = beta;
-     170             :         }
-     171             : 
-     172             :         // Only in this loop are the actual Ak computed and stored.
-     173             :         // This two-step process is necessary in order to normalize the values
-     174             :         // properly.
-     175          22 :         for (int i = 0; i < Nm; i++) {
-     176          20 :                 Ak[i] = sqrt(2 * Ak[i] / Ak2_sum) * spectrum.getBrms();
-     177             :         }
-     178             : 
-     179             : #ifdef ENABLE_FAST_WAVES
-     180             :         // * copy data into AVX-compatible arrays *
-     181             :         //
-     182             :         // AVX requires all data to be aligned to 256 bit, or 32 bytes, which is the
-     183             :         // same as 4 double precision floating point numbers. Since support for
-     184             :         // alignments this big seems to be somewhat tentative in C++ allocators,
-     185             :         // we're aligning them manually by allocating a normal double array, and
-     186             :         // then computing the offset to the first value with the correct alignment.
-     187             :         // This is a little bit of work, so instead of doing it separately for each
-     188             :         // of the individual data arrays, we're doing it once for one big array that
-     189             :         // all of the component arrays get packed into.
-     190             :         //
-     191             :         // The other thing to keep in mind is that AVX always reads in units of 256
-     192             :         // bits, or 4 doubles. This means that our number of wavemodes must be
-     193             :         // divisible by 4. If it isn't, we simply pad it out with zeros. Since the
-     194             :         // final step of the computation of each wavemode is multiplication by the
-     195             :         // amplitude, which will be set to 0, these padding wavemodes won't affect
-     196             :         // the result.
-     197             : 
-     198             :         avx_Nm = ((Nm + 4 - 1) / 4) * 4; // round up to next larger multiple of 4:
-     199             :                                          // align is 256 = 4 * sizeof(double) bit
-     200             :         avx_data = std::vector<double>(itotal * avx_Nm + 3, 0.);
-     201             : 
-     202             :         // get the first 256-bit aligned element
-     203             :         size_t size = avx_data.size() * sizeof(double);
-     204             :         void *pointer = avx_data.data();
-     205             :         align_offset =
-     206             :             (double *)std::align(32, 32, pointer, size) - avx_data.data();
-     207             : 
-     208             :         // copy into the AVX arrays
-     209             :         for (int i = 0; i < Nm; i++) {
-     210             :                 avx_data[i + align_offset + avx_Nm * iAxi0] = Ak[i] * xi[i].x;
-     211             :                 avx_data[i + align_offset + avx_Nm * iAxi1] = Ak[i] * xi[i].y;
-     212             :                 avx_data[i + align_offset + avx_Nm * iAxi2] = Ak[i] * xi[i].z;
-     213             : 
-     214             :                 // The cosine implementation computes cos(pi*x), so we'll divide out the
-     215             :                 // pi here.
-     216             :                 avx_data[i + align_offset + avx_Nm * ikkappa0] =
-     217             :                     k[i] / M_PI * kappa[i].x;
-     218             :                 avx_data[i + align_offset + avx_Nm * ikkappa1] =
-     219             :                     k[i] / M_PI * kappa[i].y;
-     220             :                 avx_data[i + align_offset + avx_Nm * ikkappa2] =
-     221             :                     k[i] / M_PI * kappa[i].z;
-     222             : 
-     223             :                 // We also need to divide beta by pi, since that goes into the argument
-     224             :                 // of the cosine as well.
-     225             :                 avx_data[i + align_offset + avx_Nm * ibeta] = beta[i] / M_PI;
-     226             :         }
-     227             : #endif // ENABLE_FAST_WAVES
-     228           2 : }
-     229             : 
-     230          45 : Vector3d PlaneWaveTurbulence::getField(const Vector3d &pos) const {
-     231             : 
-     232             : #ifndef ENABLE_FAST_WAVES
-     233             :         Vector3d B(0.);
-     234         495 :         for (int i = 0; i < Nm; i++) {
-     235         450 :                 double z_ = pos.dot(kappa[i]);
-     236         450 :                 B += xi[i] * Ak[i] * cos(k[i] * z_ + beta[i]);
-     237             :         }
-     238          45 :         return B;
-     239             : 
-     240             : #else  // ENABLE_FAST_WAVES
-     241             : 
-     242             :         // Initialize accumulators
-     243             :         //
-     244             :         // There is one accumulator per component of the result vector.
-     245             :         // Note that each accumulator contains four numbers. At the end of
-     246             :         // the loop, each of these numbers will contain the sum of every
-     247             :         // fourth wavemode, starting at a different offset. In the end, each
-     248             :         // of the accumulator's numbers are added together (using
-     249             :         // hsum_double_avx), resulting in the total sum for that component.
-     250             : 
-     251             :         __m256d acc0 = _mm256_setzero_pd();
-     252             :         __m256d acc1 = _mm256_setzero_pd();
-     253             :         __m256d acc2 = _mm256_setzero_pd();
-     254             : 
-     255             :         // broadcast position into AVX registers
-     256             :         __m256d pos0 = _mm256_set1_pd(pos.x);
-     257             :         __m256d pos1 = _mm256_set1_pd(pos.y);
-     258             :         __m256d pos2 = _mm256_set1_pd(pos.z);
-     259             : 
-     260             :         for (int i = 0; i < avx_Nm; i += 4) {
-     261             : 
-     262             :                 // Load data from memory into AVX registers:
-     263             :                 //  - the three components of the vector A * xi
-     264             :                 __m256d Axi0 =
-     265             :                     _mm256_load_pd(avx_data.data() + i + align_offset + avx_Nm * iAxi0);
-     266             :                 __m256d Axi1 =
-     267             :                     _mm256_load_pd(avx_data.data() + i + align_offset + avx_Nm * iAxi1);
-     268             :                 __m256d Axi2 =
-     269             :                     _mm256_load_pd(avx_data.data() + i + align_offset + avx_Nm * iAxi2);
-     270             : 
-     271             :                 //  - the three components of the vector k * kappa
-     272             :                 __m256d kkappa0 = _mm256_load_pd(avx_data.data() + i + align_offset +
-     273             :                                                  avx_Nm * ikkappa0);
-     274             :                 __m256d kkappa1 = _mm256_load_pd(avx_data.data() + i + align_offset +
-     275             :                                                  avx_Nm * ikkappa1);
-     276             :                 __m256d kkappa2 = _mm256_load_pd(avx_data.data() + i + align_offset +
-     277             :                                                  avx_Nm * ikkappa2);
-     278             : 
-     279             :                 //  - the phase beta.
-     280             :                 __m256d beta =
-     281             :                     _mm256_load_pd(avx_data.data() + i + align_offset + avx_Nm * ibeta);
-     282             : 
-     283             :                 // Then, do the computation.
-     284             : 
-     285             :                 // This is the scalar product between k*kappa and pos:
-     286             :                 __m256d z = _mm256_add_pd(_mm256_mul_pd(pos0, kkappa0),
-     287             :                                           _mm256_add_pd(_mm256_mul_pd(pos1, kkappa1),
-     288             :                                                         _mm256_mul_pd(pos2, kkappa2)));
-     289             : 
-     290             :                 // Here, the phase is added on. This is the argument of the cosine.
-     291             :                 __m256d cos_arg = _mm256_add_pd(z, beta);
-     292             : 
-     293             :                 // ********
-     294             :                 // * Computing the cosine
-     295             :                 // * Part 1: Argument reduction
-     296             :                 //
-     297             :                 //  To understand the computation of the cosine, first note that the
-     298             :                 //  cosine is periodic and we thus only need to model its behavior
-     299             :                 //  between 0 and 2*pi to be able compute the function anywhere. In
-     300             :                 //  fact, by mirroring the function along the x and y axes, even the
-     301             :                 //  range between 0 and pi/2 is sufficient for this purpose. In this
-     302             :                 //  range, the cosine can be efficiently evaluated with high precision
-     303             :                 //  by using a polynomial approximation. Thus, to compute the cosine,
-     304             :                 //  the input value is first reduced so that it lies within this range.
-     305             :                 //  Then, the polynomial approximation is evaluated. Finally, if
-     306             :                 //  necessary, the sign of the result is flipped (mirroring the function
-     307             :                 //  along the x axis).
-     308             :                 //
-     309             :                 //  The actual computation is slightly more involved. First, argument
-     310             :                 //  reduction can be simplified drastically by computing cos(pi*x),
-     311             :                 //  such that the values are reduced to the range [0, 0.5) instead of
-     312             :                 //  [0, pi/2). Since the cosine is even (independent of the sign), we
-     313             :                 //  can first reduce values to [-0.5, 0.5) – that is, a simple rounding
-     314             :                 //  operation – and then neutralize the sign. In fact, precisely because
-     315             :                 //  the cosine is even, all terms of the polynomial are powers of x^2,
-     316             :                 //  so the value of x^2 (computed as x*x) forms the basis for the
-     317             :                 //  polynomial approximation. If I understand things correctly, then (in
-     318             :                 //  IEEE-754 floating point) x*x and (-x)*(-x) will always result in the
-     319             :                 //  exact same value, which means that any error bound over [0, 0.5)
-     320             :                 //  automatically applies to (-0.5, 0] as well.
-     321             : 
-     322             :                 // First, compute round(x), and store it in q. If this value is odd,
-     323             :                 // we're looking at the negative half-wave of the cosine, and thus
-     324             :                 // will have to invert the sign of the result.
-     325             :                 __m256d q = _mm256_round_pd(
-     326             :                     cos_arg, (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC));
-     327             : 
-     328             :                 // Since we're computing cos(pi*x), round(x) always yields the center of
-     329             :                 // a half-wave (where cos(pi*x) achieves an extremum). This point
-     330             :                 // logically corresponds to x=0. Therefore, we subtract this center from
-     331             :                 // the actual input argument to find the corresponding point on the
-     332             :                 // half-wave that is centered around zero.
-     333             :                 __m256d s = _mm256_sub_pd(cos_arg, q);
-     334             : 
-     335             :                 // We now want to check whether q (the index of our half-wave) is even
-     336             :                 // or odd, since all of the odd-numbered half-waves are negative, so
-     337             :                 // we'll have to flip the final result. On an int, this is as simple as
-     338             :                 // checking the 0th bit. Idea: manipulate the double in such a way that
-     339             :                 // we can do this. So, we add 2^52, such that the last digit of the
-     340             :                 // mantissa is actually in the ones' position. Since q may be negative,
-     341             :                 // we'll also add 2^51 to make sure it's positive. Note that 2^51 is
-     342             :                 // even and thus leaves evenness invariant, which is the only thing we
-     343             :                 // care about here.
-     344             :                 //
-     345             :                 // This is based on the int extraction process described here:
-     346             :                 // https://stackoverflow.com/questions/41144668/how-to-efficiently-perform-double-int64-conversions-with-sse-avx/41223013
-     347             :                 //
-     348             :                 // We assume -2^51 <= q < 2^51 for this, which is unproblematic, as
-     349             :                 // double precision has decayed far enough at that point that the
-     350             :                 // usefulness of the cosine becomes limited.
-     351             :                 //
-     352             :                 // Explanation: The mantissa of a double-precision float has 52 bits
-     353             :                 // (excluding the implicit first bit, which is always one). If |q| >
-     354             :                 // 2^51, this implicit first bit has a place value of at least 2^51,
-     355             :                 // while the first stored bit of the mantissa has a place value of at
-     356             :                 // least 2^50. This means that the LSB of the mantissa has a place value
-     357             :                 // of at least 2^(-1), or 0.5. For a cos(pi*x), this corresponds to a
-     358             :                 // quarter of a cycle (pi/2), so at this point the precision of the
-     359             :                 // input argument is so low that going from one representable number to
-     360             :                 // the next causes the result to jump by +/-1.
-     361             : 
-     362             :                 q = _mm256_add_pd(q, _mm256_set1_pd(0x0018000000000000));
-     363             : 
-     364             :                 // Unfortunately, integer comparisons were only introduced in AVX2, so
-     365             :                 // we'll have to make do with a floating point comparison to check
-     366             :                 // whether the last bit is set. However, masking out all but the last
-     367             :                 // bit will result in a denormal float, which may either result in
-     368             :                 // performance problems or just be rounded down to zero, neither of
-     369             :                 // which is what we want here. To fix this, we'll mask in not only bit
-     370             :                 // 0, but also the exponent (and sign, but that doesn't matter) of q.
-     371             :                 // Luckily, the exponent of q is guaranteed to have the fixed value of
-     372             :                 // 1075 (corresponding to 2^52) after our addition.
-     373             : 
-     374             :                 __m256d invert = _mm256_and_pd(
-     375             :                     q, _mm256_castsi256_pd(_mm256_set1_epi64x(0xfff0000000000001)));
-     376             : 
-     377             :                 // If we did have a one in bit 0, our result will be equal to 2^52 + 1.
-     378             :                 invert = _mm256_cmp_pd(
-     379             :                     invert, _mm256_castsi256_pd(_mm256_set1_epi64x(0x4330000000000001)),
-     380             :                     _CMP_EQ_OQ);
-     381             : 
-     382             :                 // Now we know whether to flip the sign of the result. However, remember
-     383             :                 // that we're working on multiple values at a time, so an if statement
-     384             :                 // won't be of much use here (plus it might perform badly). Instead,
-     385             :                 // we'll make use of the fact that the result of the comparison is all
-     386             :                 // ones if the comparison was true (i.e. q is odd and we need to flip
-     387             :                 // the result), and all zeroes otherwise. If we now mask out all bits
-     388             :                 // except the sign bit, we get something that, when xor'ed into our
-     389             :                 // final result, will flip the sign exactly when q is odd.
-     390             :                 invert = _mm256_and_pd(invert, _mm256_set1_pd(-0.0));
-     391             :                 // (Note that the binary representation of -0.0 is all 0 bits, except
-     392             :                 // for the sign bit, which is set to 1.)
-     393             : 
-     394             :                 // TODO: clamp floats between 0 and 1? This would ensure that we never
-     395             :                 // see inf's, but maybe we want that, so that things dont just fail
-     396             :                 // silently...
-     397             : 
-     398             :                 // * end of argument reduction
-     399             :                 // *******
-     400             : 
-     401             :                 // ******
-     402             :                 // * Evaluate the cosine using a polynomial approximation for the zeroth
-     403             :                 // half-wave.
-     404             :                 // * The coefficients for this were generated using sleefs gencoef.c.
-     405             :                 // * These coefficients are probably far from optimal; however, they
-     406             :                 // should be sufficient for this case.
-     407             :                 s = _mm256_mul_pd(s, s);
-     408             : 
-     409             :                 __m256d u = _mm256_set1_pd(+0.2211852080653743946e+0);
-     410             : 
-     411             :                 u = _mm256_add_pd(_mm256_mul_pd(u, s),
-     412             :                                   _mm256_set1_pd(-0.1332560668688523853e+1));
-     413             :                 u = _mm256_add_pd(_mm256_mul_pd(u, s),
-     414             :                                   _mm256_set1_pd(+0.4058509506474178075e+1));
-     415             :                 u = _mm256_add_pd(_mm256_mul_pd(u, s),
-     416             :                                   _mm256_set1_pd(-0.4934797516664651162e+1));
-     417             :                 u = _mm256_add_pd(_mm256_mul_pd(u, s), _mm256_set1_pd(1.));
-     418             : 
-     419             :                 // Then, flip the sign of each double for which invert is not zero.
-     420             :                 // Since invert has only zero bits except for a possible one in bit 63,
-     421             :                 // we can xor it onto our result to selectively invert the 63rd (sign)
-     422             :                 // bit in each double where invert is set.
-     423             :                 u = _mm256_xor_pd(u, invert);
-     424             : 
-     425             :                 // * end computation of cosine
-     426             :                 // **********
-     427             : 
-     428             :                 // Finally, Ak*xi is multiplied on. Since this is a vector, the
-     429             :                 // multiplication needs to be done for each of the three
-     430             :                 // components, so it happens separately.
-     431             :                 acc0 = _mm256_add_pd(_mm256_mul_pd(u, Axi0), acc0);
-     432             :                 acc1 = _mm256_add_pd(_mm256_mul_pd(u, Axi1), acc1);
-     433             :                 acc2 = _mm256_add_pd(_mm256_mul_pd(u, Axi2), acc2);
-     434             :         }
-     435             : 
-     436             :         return Vector3d(hsum_double_avx(acc0), hsum_double_avx(acc1),
-     437             :                         hsum_double_avx(acc2));
-     438             : #endif // ENABLE_FAST_WAVES
-     439             : }
-     440             : 
-     441             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/turbulentField/SimpleGridTurbulence.cpp.func-sort-c.html b/doc/coverageReport/src/magneticField/turbulentField/SimpleGridTurbulence.cpp.func-sort-c.html deleted file mode 100644 index 02289b77c..000000000 --- a/doc/coverageReport/src/magneticField/turbulentField/SimpleGridTurbulence.cpp.func-sort-c.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/turbulentField/SimpleGridTurbulence.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField/turbulentField - SimpleGridTurbulence.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:5252100.0 %
Date:2024-04-08 14:58:22Functions:22100.0 %
-
- -
- - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa20SimpleGridTurbulenceC2ERKNS_24SimpleTurbulenceSpectrumERKNS_14GridPropertiesEj3
_ZN7crpropa20SimpleGridTurbulence14initTurbulenceENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEddddi7
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/turbulentField/SimpleGridTurbulence.cpp.func.html b/doc/coverageReport/src/magneticField/turbulentField/SimpleGridTurbulence.cpp.func.html deleted file mode 100644 index 55d106e43..000000000 --- a/doc/coverageReport/src/magneticField/turbulentField/SimpleGridTurbulence.cpp.func.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/turbulentField/SimpleGridTurbulence.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField/turbulentField - SimpleGridTurbulence.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:5252100.0 %
Date:2024-04-08 14:58:22Functions:22100.0 %
-
- -
- - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa20SimpleGridTurbulence14initTurbulenceENS_7ref_ptrINS_4GridINS_7Vector3IfEEEEEEddddi7
_ZN7crpropa20SimpleGridTurbulenceC2ERKNS_24SimpleTurbulenceSpectrumERKNS_14GridPropertiesEj3
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/turbulentField/SimpleGridTurbulence.cpp.gcov.html b/doc/coverageReport/src/magneticField/turbulentField/SimpleGridTurbulence.cpp.gcov.html deleted file mode 100644 index a0b831617..000000000 --- a/doc/coverageReport/src/magneticField/turbulentField/SimpleGridTurbulence.cpp.gcov.html +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/turbulentField/SimpleGridTurbulence.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField/turbulentField - SimpleGridTurbulence.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:5252100.0 %
Date:2024-04-08 14:58:22Functions:22100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/magneticField/turbulentField/SimpleGridTurbulence.h"
-       2             : #include "crpropa/GridTools.h"
-       3             : #include "crpropa/Random.h"
-       4             : 
-       5             : #ifdef CRPROPA_HAVE_FFTW3F
-       6             : #include "fftw3.h"
-       7             : 
-       8             : namespace crpropa {
-       9             : 
-      10           3 : SimpleGridTurbulence::SimpleGridTurbulence(const SimpleTurbulenceSpectrum &spectrum,
-      11             :                                            const GridProperties &gridProp,
-      12           3 :                                            unsigned int seed)
-      13           3 :     : GridTurbulence(spectrum, gridProp, seed) {
-      14           6 :         initTurbulence(gridPtr, spectrum.getBrms(), spectrum.getLmin(),
-      15           3 :                        spectrum.getLmax(), -spectrum.getSindex() - 2, seed);
-      16           3 : }
-      17             : 
-      18           7 : void SimpleGridTurbulence::initTurbulence(ref_ptr<Grid3f> grid, double Brms,
-      19             :                                           double lMin, double lMax,
-      20             :                                           double alpha, int seed) {
-      21             :         
-      22             :         Vector3d spacing = grid->getSpacing();
-      23             : 
-      24          11 :         checkGridRequirements(grid, lMin, lMax);
-      25             : 
-      26             :         size_t n = grid->getNx(); // size of array
-      27           4 :         size_t n2 = (size_t)floor(n / 2) +
-      28             :                     1; // size array in z-direction in configuration space
-      29             : 
-      30             :         // arrays to hold the complex vector components of the B(k)-field
-      31             :         fftwf_complex *Bkx, *Bky, *Bkz;
-      32           4 :         Bkx = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * n * n * n2);
-      33           4 :         Bky = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * n * n * n2);
-      34           4 :         Bkz = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * n * n * n2);
-      35             : 
-      36           4 :         Random random;
-      37           4 :         if (seed != 0)
-      38           2 :                 random.seed(seed); // use given seed
-      39             : 
-      40             :         // calculate the n possible discrete wave numbers
-      41           4 :         double K[n];
-      42         260 :         for (size_t i = 0; i < n; i++)
-      43         256 :                 K[i] = (double)i / n - i / (n / 2);
-      44             : 
-      45           4 :         double kMin = spacing.x / lMax;
-      46           4 :         double kMax = spacing.x / lMin;
-      47             :         Vector3f n0(1, 1, 1); // arbitrary vector to construct orthogonal base
-      48             : 
-      49         260 :         for (size_t ix = 0; ix < n; ix++) {
-      50       16640 :                 for (size_t iy = 0; iy < n; iy++) {
-      51      557056 :                         for (size_t iz = 0; iz < n2; iz++) {
-      52             :         
-      53             :                                 Vector3f ek, e1, e2;  // orthogonal base
-      54             : 
-      55      540672 :                                 size_t i = ix * n * n2 + iy * n2 + iz;
-      56      540672 :                                 ek.setXYZ(K[ix], K[iy], K[iz]);
-      57      540672 :                                 double k = ek.getR();
-      58             : 
-      59             :                                 // wave outside of turbulent range -> B(k) = 0
-      60      540672 :                                 if ((k < kMin) || (k > kMax)) {
-      61      264724 :                                         Bkx[i][0] = 0;
-      62      264724 :                                         Bkx[i][1] = 0;
-      63      264724 :                                         Bky[i][0] = 0;
-      64      264724 :                                         Bky[i][1] = 0;
-      65      264724 :                                         Bkz[i][0] = 0;
-      66      264724 :                                         Bkz[i][1] = 0;
-      67             :                                         continue;
-      68             :                                 }
-      69             : 
-      70             :                                 // construct an orthogonal base ek, e1, e2
-      71      275948 :                                 if (ek.isParallelTo(n0, float(1e-3))) {
-      72             :                                         // ek parallel to (1,1,1)
-      73             :                                         e1.setXYZ(-1., 1., 0);
-      74             :                                         e2.setXYZ(1., 1., -2.);
-      75             :                                 } else {
-      76             :                                         // ek not parallel to (1,1,1)
-      77             :                                         e1 = n0.cross(ek);
-      78             :                                         e2 = ek.cross(e1);
-      79             :                                 }
-      80             :                                 e1 /= e1.getR();
-      81             :                                 e2 /= e2.getR();
-      82             : 
-      83             :                                 // random orientation perpendicular to k
-      84      275948 :                                 double theta = 2 * M_PI * random.rand();
-      85      275948 :                                 Vector3f b = e1 * cos(theta) + e2 * sin(theta); // real b-field vector
-      86             : 
-      87             :                                 // normal distributed amplitude with mean = 0 and sigma =
-      88             :                                 // k^alpha/2
-      89      275948 :                                 b *= random.randNorm() * pow(k, alpha / 2);
-      90             : 
-      91             :                                 // uniform random phase
-      92      275948 :                                 double phase = 2 * M_PI * random.rand();
-      93      275948 :                                 double cosPhase = cos(phase); // real part
-      94      275948 :                                 double sinPhase = sin(phase); // imaginary part
-      95             : 
-      96      275948 :                                 Bkx[i][0] = b.x * cosPhase;
-      97      275948 :                                 Bkx[i][1] = b.x * sinPhase;
-      98      275948 :                                 Bky[i][0] = b.y * cosPhase;
-      99      275948 :                                 Bky[i][1] = b.y * sinPhase;
-     100      275948 :                                 Bkz[i][0] = b.z * cosPhase;
-     101      275948 :                                 Bkz[i][1] = b.z * sinPhase;
-     102             :                         } // for iz
-     103             :                 }     // for iy
-     104             :         }         // for ix
-     105             : 
-     106           4 :         executeInverseFFTInplace(grid, Bkx, Bky, Bkz);
-     107             : 
-     108           4 :         fftwf_free(Bkx);
-     109           4 :         fftwf_free(Bky);
-     110           4 :         fftwf_free(Bkz);
-     111             : 
-     112          16 :         scaleGrid(grid, Brms / rmsFieldStrength(grid)); // normalize to Brms
-     113          11 : }
-     114             : 
-     115             : } // namespace crpropa
-     116             : 
-     117             : #endif // CRPROPA_HAVE_FFTW3F
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/turbulentField/index-sort-f.html b/doc/coverageReport/src/magneticField/turbulentField/index-sort-f.html deleted file mode 100644 index 4bb56e51d..000000000 --- a/doc/coverageReport/src/magneticField/turbulentField/index-sort-f.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/turbulentField - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField/turbulentFieldHitTotalCoverage
Test:coverage.info.cleanedLines:18726371.1 %
Date:2024-04-08 14:58:22Functions:111957.9 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
HelicalGridTurbulence.cpp -
0.0%
-
0.0 %0 / 590.0 %0 / 2
GridTurbulence.cpp -
85.6%85.6%
-
85.6 %89 / 10453.8 %7 / 13
SimpleGridTurbulence.cpp -
100.0%
-
100.0 %52 / 52100.0 %2 / 2
PlaneWaveTurbulence.cpp -
95.8%95.8%
-
95.8 %46 / 48100.0 %2 / 2
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/turbulentField/index-sort-l.html b/doc/coverageReport/src/magneticField/turbulentField/index-sort-l.html deleted file mode 100644 index 1a7102ae5..000000000 --- a/doc/coverageReport/src/magneticField/turbulentField/index-sort-l.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/turbulentField - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField/turbulentFieldHitTotalCoverage
Test:coverage.info.cleanedLines:18726371.1 %
Date:2024-04-08 14:58:22Functions:111957.9 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
HelicalGridTurbulence.cpp -
0.0%
-
0.0 %0 / 590.0 %0 / 2
GridTurbulence.cpp -
85.6%85.6%
-
85.6 %89 / 10453.8 %7 / 13
PlaneWaveTurbulence.cpp -
95.8%95.8%
-
95.8 %46 / 48100.0 %2 / 2
SimpleGridTurbulence.cpp -
100.0%
-
100.0 %52 / 52100.0 %2 / 2
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticField/turbulentField/index.html b/doc/coverageReport/src/magneticField/turbulentField/index.html deleted file mode 100644 index 2bfdfdefa..000000000 --- a/doc/coverageReport/src/magneticField/turbulentField/index.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticField/turbulentField - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticField/turbulentFieldHitTotalCoverage
Test:coverage.info.cleanedLines:18726371.1 %
Date:2024-04-08 14:58:22Functions:111957.9 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
GridTurbulence.cpp -
85.6%85.6%
-
85.6 %89 / 10453.8 %7 / 13
HelicalGridTurbulence.cpp -
0.0%
-
0.0 %0 / 590.0 %0 / 2
PlaneWaveTurbulence.cpp -
95.8%95.8%
-
95.8 %46 / 48100.0 %2 / 2
SimpleGridTurbulence.cpp -
100.0%
-
100.0 %52 / 52100.0 %2 / 2
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticLens/MagneticLens.cpp.func-sort-c.html b/doc/coverageReport/src/magneticLens/MagneticLens.cpp.func-sort-c.html deleted file mode 100644 index 6962e0d0c..000000000 --- a/doc/coverageReport/src/magneticLens/MagneticLens.cpp.func-sort-c.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticLens/MagneticLens.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticLens - MagneticLens.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:4310441.3 %
Date:2024-04-08 14:58:22Functions:61346.2 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa12MagneticLens12loadLensPartERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEdd0
_ZN7crpropa12MagneticLens13normalizeLensEv0
_ZN7crpropa12MagneticLens18normalizeLenspartsEv0
_ZN7crpropa12MagneticLens22normalizeMatrixColumnsEv0
_ZN7crpropa12MagneticLens8loadLensERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZNK7crpropa12MagneticLens15rigidityCoveredEd0
_ZNK7crpropa12MagneticLens20transformModelVectorEPdd0
_ZN7crpropa12MagneticLens11setLensPartERKN5Eigen12SparseMatrixIdLi0EiEEdd3
_ZN7crpropa12MagneticLens12_checkMatrixERKN5Eigen12SparseMatrixIdLi0EiEE3
_ZN7crpropa12MagneticLens20updateRigidityBoundsEdd3
_ZN7crpropa12MagneticLens18transformCosmicRayEdRNS_7Vector3IdEE4
_ZN7crpropa12MagneticLens18transformCosmicRayEdRdS1_12293
_ZNK7crpropa12MagneticLens11getLensPartEd12293
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticLens/MagneticLens.cpp.func.html b/doc/coverageReport/src/magneticLens/MagneticLens.cpp.func.html deleted file mode 100644 index 291746429..000000000 --- a/doc/coverageReport/src/magneticLens/MagneticLens.cpp.func.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticLens/MagneticLens.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticLens - MagneticLens.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:4310441.3 %
Date:2024-04-08 14:58:22Functions:61346.2 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa12MagneticLens11setLensPartERKN5Eigen12SparseMatrixIdLi0EiEEdd3
_ZN7crpropa12MagneticLens12_checkMatrixERKN5Eigen12SparseMatrixIdLi0EiEE3
_ZN7crpropa12MagneticLens12loadLensPartERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEdd0
_ZN7crpropa12MagneticLens13normalizeLensEv0
_ZN7crpropa12MagneticLens18normalizeLenspartsEv0
_ZN7crpropa12MagneticLens18transformCosmicRayEdRNS_7Vector3IdEE4
_ZN7crpropa12MagneticLens18transformCosmicRayEdRdS1_12293
_ZN7crpropa12MagneticLens20updateRigidityBoundsEdd3
_ZN7crpropa12MagneticLens22normalizeMatrixColumnsEv0
_ZN7crpropa12MagneticLens8loadLensERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZNK7crpropa12MagneticLens11getLensPartEd12293
_ZNK7crpropa12MagneticLens15rigidityCoveredEd0
_ZNK7crpropa12MagneticLens20transformModelVectorEPdd0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticLens/MagneticLens.cpp.gcov.html b/doc/coverageReport/src/magneticLens/MagneticLens.cpp.gcov.html deleted file mode 100644 index 88d65754f..000000000 --- a/doc/coverageReport/src/magneticLens/MagneticLens.cpp.gcov.html +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticLens/MagneticLens.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticLens - MagneticLens.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:4310441.3 %
Date:2024-04-08 14:58:22Functions:61346.2 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : //----------------------------------------------------------------------
-       2             : // This file is part of PARSEC (http://physik.rwth-aachen.de/parsec)
-       3             : // a parametrized simulation engine for cosmic rays.
-       4             : //
-       5             : // Copyright (C) 2011  Martin Erdmann, Peter Schiffer, Tobias Winchen
-       6             : //                     RWTH Aachen University, Germany
-       7             : // Contact: winchen@physik.rwth-aachen.de
-       8             : //
-       9             : //  This program is free software: you can redistribute it and/or
-      10             : //  modify it under the terms of the GNU General Public License as
-      11             : //  published by the Free Software Foundation, either version 3 of
-      12             : //  the License, or (at your option) any later version.
-      13             : //
-      14             : //  This program is distributed in the hope that it will be useful,
-      15             : //  but WITHOUT ANY WARRANTY; without even the implied warranty of
-      16             : //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-      17             : //  GNU General Public License for more details.
-      18             : //
-      19             : //  You should have received a copy of the GNU General Public License
-      20             : //  along with this program. If not, see <http://www.gnu.org/licenses/>.
-      21             : //----------------------------------------------------------------------
-      22             : 
-      23             : #include "crpropa/magneticLens/MagneticLens.h"
-      24             : 
-      25             : #include "crpropa/Random.h"
-      26             : #include "crpropa/Units.h"
-      27             : 
-      28             : // needed for memcpy in gcc 4.3.2
-      29             : #include <cstring>
-      30             : 
-      31             : namespace crpropa 
-      32             : {
-      33             : 
-      34           0 : void MagneticLens::loadLens(const string &filename)
-      35             : {
-      36           0 :         ifstream infile(filename.c_str());
-      37           0 :         if (!infile)
-      38             :         {
-      39           0 :                 throw std::runtime_error("Can't read file: " + filename);
-      40             :         }
-      41             :         string line;
-      42             : 
-      43             :         string prefix;
-      44           0 :         int sp = filename.find_last_of("/");
-      45           0 :         if (sp >= 0)
-      46             :         {
-      47           0 :                 prefix = filename.substr(0, sp);
-      48           0 :                 prefix.append("/");
-      49             :         }
-      50             :         string mfdatfile;
-      51             :         double emin, emax;
-      52             : 
-      53             :         int lineCounter = 0;
-      54           0 :         while (!infile.eof())
-      55             :         {
-      56           0 :                 getline(infile, line);
-      57           0 :                 lineCounter++;
-      58           0 :                 if (line.find('#') == string::npos)
-      59             :                 {
-      60           0 :                         stringstream ss;
-      61             :                         ss << line;
-      62           0 :                         ss >> mfdatfile >> emin >> emax;
-      63           0 :                         if (ss.fail())
-      64             :                         {
-      65           0 :                                 cerr << "WARNING! Cannot read line " << lineCounter << " of file " << filename << " :\n [" << lineCounter << " ]: " << line << " \n";
-      66           0 :                                 cerr << " ... Skipping line and continue\n";
-      67             :                         }
-      68             :                         else
-      69             :                         {
-      70           0 :                                 this->loadLensPart(prefix + mfdatfile, pow(10, emin) * eV, pow(10, emax) * eV);
-      71             :                         }
-      72           0 :                 }
-      73             :         }
-      74           0 : }
-      75             : 
-      76       12293 : bool MagneticLens::transformCosmicRay(double rigidity, double& phi,
-      77             :                 double& theta) 
-      78             : {
-      79       12293 :         uint32_t c = _pixelization->direction2Pix(phi, theta);
-      80       12293 :         LensPart *lenspart = getLensPart(rigidity);
-      81       12293 :         if (!lenspart)
-      82             :         {
-      83           1 :                 std::cerr << "Warning. Trying to transform cosmic ray with rigidity " << rigidity / eV << " eV which is not covered by this lens!.\n";
-      84           2 :                 std::cerr << " This lens covers the range " << _minimumRigidity /eV << " eV - " << _maximumRigidity << " eV.\n";
-      85           1 :                 return false;
-      86             :         }
-      87             : 
-      88       12292 :         ModelVectorType v = lenspart->getMatrix().col(c);
-      89             : 
-      90             :         uint32_t r;
-      91             : 
-      92             :         // the random number to compare with
-      93       12292 :         double rn = Random::instance().rand();
-      94             : 
-      95             :         ModelVectorType::InnerIterator i(v);
-      96             :   double cpv = 0;
-      97       12292 :   while (i)
-      98             :   {
-      99       12292 :                 cpv += i.value();
-     100       12292 :                 if (rn < cpv)
-     101             :                 {
-     102       12292 :                         _pixelization->pix2Direction(i.index(), phi, theta);
-     103             :                         return true;
-     104             :     }
-     105             :     else
-     106             :     {
-     107             :                         ++i;
-     108             :     }
-     109             :    }
-     110             :   return false;
-     111             : }
-     112             : 
-     113           4 : bool MagneticLens::transformCosmicRay(double rigidity, Vector3d &p){
-     114             : 
-     115           4 :                         double galacticLongitude = atan2(-p.y, -p.x);
-     116           4 :                         double galacticLatitude =       M_PI / 2 - acos(-p.z/ sqrt(p.x*p.x + p.y*p.y + p.z*p.z));
-     117           4 :                         bool result = transformCosmicRay(rigidity, galacticLongitude, galacticLatitude);
-     118             :                         
-     119           4 :                         p.x = -1 * cos(galacticLongitude) * sin(M_PI / 2 - galacticLatitude);
-     120           4 :                         p.y = -1 * sin(galacticLongitude) * sin(M_PI / 2 - galacticLatitude);
-     121           4 :                         p.z = -1. * cos(M_PI / 2 - galacticLatitude);
-     122             : 
-     123           4 :                         return result;
-     124             : }
-     125             : 
-     126           0 : void MagneticLens::loadLensPart(const string &filename, double rigidityMin,
-     127             :                 double rigidityMax)
-     128             : {
-     129           0 :         updateRigidityBounds(rigidityMin, rigidityMax);
-     130             : 
-     131           0 :         LensPart *p = new LensPart(filename, rigidityMin, rigidityMax);
-     132             :         p->loadMatrixFromFile();
-     133           0 :         _checkMatrix(p->getMatrix());
-     134             : 
-     135           0 :         _lensParts.push_back(p);
-     136           0 : }
-     137             : 
-     138           3 : void MagneticLens::_checkMatrix(const ModelMatrixType &M)
-     139             : {
-     140           3 :         if (M.rows() != M.cols())
-     141             :         {
-     142           0 :                 throw std::runtime_error("Not a square Matrix!");
-     143             :         }
-     144             : 
-     145           3 :         if (_pixelization)
-     146             :         {
-     147           3 :                 if (_pixelization->nPix() != M.cols())
-     148             :                 {
-     149             :                         std::cerr << "*** ERROR ***" << endl;
-     150           0 :                         std::cerr << "  Pixelization: " << _pixelization->nPix() << endl;
-     151             :                         std::cerr << "  Matrix Size : " << M.cols() << endl;
-     152           0 :                         throw std::runtime_error("Matrix doesn't fit into Lense");
-     153             :                 }
-     154             :         }
-     155             :         else
-     156             :         {
-     157           0 :                 uint32_t morder = Pixelization::pix2Order(M.cols());
-     158           0 :                 if (morder == 0)
-     159             :                 {
-     160           0 :                         throw std::runtime_error(
-     161           0 :                                         "Matrix size doesn't match healpix scheme!");
-     162             :                 }
-     163           0 :                 _pixelization = new Pixelization(morder);
-     164             :         }
-     165           3 : }
-     166             : 
-     167           3 : void MagneticLens::updateRigidityBounds(double rigidityMin, double rigidityMax)
-     168             : {
-     169           3 :         if (rigidityMin >= rigidityMax)
-     170             :         {
-     171           0 :                 throw std::runtime_error("rigidityMin >= rigidityMax");
-     172             :         }
-     173           3 :         if (rigidityMin < _minimumRigidity)
-     174             :         {
-     175           3 :                 _minimumRigidity = rigidityMin;
-     176             :         }
-     177             : 
-     178           3 :         if (_maximumRigidity < rigidityMin)
-     179             :         {
-     180           3 :                 _maximumRigidity = rigidityMax;
-     181             :         }
-     182           3 : }
-     183             : 
-     184           3 : void MagneticLens::setLensPart(const ModelMatrixType &M, double rigidityMin,
-     185             :                 double rigidityMax)
-     186             : {
-     187           3 :         updateRigidityBounds(rigidityMin, rigidityMax);
-     188           3 :         LensPart *p = new LensPart("Direct Input", rigidityMin, rigidityMax);
-     189             : 
-     190             :         p->setMatrix(M);
-     191             : 
-     192           3 :         _checkMatrix(p->getMatrix());
-     193           3 :         _lensParts.push_back(p);
-     194           3 : }
-     195             : 
-     196       12293 : LensPart* MagneticLens::getLensPart(double rigidity) const
-     197             : {
-     198             :         const_LensPartIter i = _lensParts.begin();
-     199       12294 :         while (i != _lensParts.end())
-     200             :         {
-     201       12293 :                 if (((*i)->getMinimumRigidity() < rigidity / eV)
-     202       12293 :                                 && ((*i)->getMaximumRigidity() >= rigidity / eV))
-     203             :                 {
-     204             :                         return (*i);
-     205             :                 }
-     206             :                 ++i;
-     207             :         }
-     208             :         return NULL;
-     209             : }
-     210             : 
-     211           0 : bool MagneticLens::rigidityCovered(double rigidity) const
-     212             : {
-     213           0 :         if (getLensPart(rigidity))
-     214             :                 return true;
-     215             :         else
-     216           0 :                 return false;
-     217             : }
-     218             : 
-     219             : 
-     220           0 : void MagneticLens::normalizeMatrixColumns()
-     221             : {
-     222           0 :         for (LensPartIter iter = _lensParts.begin(); iter != _lensParts.end();
-     223             :                         ++iter)
-     224             :         {
-     225           0 :                 normalizeColumns((*iter)->getMatrix());
-     226             :         }
-     227           0 : }
-     228             : 
-     229             : 
-     230           0 : void MagneticLens::normalizeLens()
-     231             : {
-     232             :         // get maximum of sums of columns, and normalize each matrix to that
-     233             :         double norm = 0;
-     234           0 :         for (LensPartIter iter = _lensParts.begin(); iter != _lensParts.end();
-     235             :                         ++iter)
-     236             :         {
-     237           0 :                 if ((*iter)->getMaximumOfSumsOfColumns() > norm)
-     238             :                 {
-     239           0 :                         norm = (*iter)->getMaximumOfSumsOfColumns();
-     240             :                 }
-     241             :         }
-     242           0 :         for (LensPartIter iter = _lensParts.begin(); iter != _lensParts.end();
-     243             :                         ++iter)
-     244             :         {
-     245           0 :                 normalizeMatrix((*iter)->getMatrix(), norm);
-     246             :         }
-     247           0 :   _norm = norm;
-     248           0 : }
-     249             : 
-     250           0 : void MagneticLens::normalizeLensparts()
-     251             : {
-     252           0 :         for (LensPartIter iter = _lensParts.begin(); iter != _lensParts.end();
-     253             :                         ++iter)
-     254             :         {
-     255           0 :                 double norm = (*iter)->getMaximumOfSumsOfColumns();
-     256           0 :                 normalizeMatrix((*iter)->getMatrix(), norm);
-     257             :         }
-     258           0 : }
-     259             : 
-     260           0 : void MagneticLens::transformModelVector(double* model, double rigidity) const
-     261             : {
-     262           0 :         LensPart* lenspart = getLensPart(rigidity);
-     263             :         
-     264           0 :         if (!lenspart)
-     265             :         {
-     266           0 :                 std::cerr << "Warning. Trying to transform vector with rigidity " << rigidity / eV << "eV which is not covered by this lens!.\n" << std::endl;
-     267           0 :                 return;
-     268             :         }
-     269             : 
-     270           0 :         prod_up(lenspart->getMatrix(), model);
-     271             : 
-     272             : }
-     273             : 
-     274             : 
-     275             : 
-     276             : } // namespace parsec
-     277             : 
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticLens/ModelMatrix.cpp.func-sort-c.html b/doc/coverageReport/src/magneticLens/ModelMatrix.cpp.func-sort-c.html deleted file mode 100644 index 0b636302b..000000000 --- a/doc/coverageReport/src/magneticLens/ModelMatrix.cpp.func-sort-c.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticLens/ModelMatrix.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticLens - ModelMatrix.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0630.0 %
Date:2024-04-08 14:58:22Functions:070.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11deserializeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERN5Eigen12SparseMatrixIdLi0EiEE0
_ZN7crpropa15normalizeMatrixERN5Eigen12SparseMatrixIdLi0EiEEd0
_ZN7crpropa16normalizeColumnsERN5Eigen12SparseMatrixIdLi0EiEE0
_ZN7crpropa22maximumOfSumsOfColumnsERKN5Eigen12SparseMatrixIdLi0EiEE0
_ZN7crpropa6norm_1ERKN5Eigen12SparseVectorIdLi0EiEE0
_ZN7crpropa7prod_upERKN5Eigen12SparseMatrixIdLi0EiEEPd0
_ZN7crpropa9serializeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKN5Eigen12SparseMatrixIdLi0EiEE0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticLens/ModelMatrix.cpp.func.html b/doc/coverageReport/src/magneticLens/ModelMatrix.cpp.func.html deleted file mode 100644 index 9869c0266..000000000 --- a/doc/coverageReport/src/magneticLens/ModelMatrix.cpp.func.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticLens/ModelMatrix.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticLens - ModelMatrix.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0630.0 %
Date:2024-04-08 14:58:22Functions:070.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11deserializeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERN5Eigen12SparseMatrixIdLi0EiEE0
_ZN7crpropa15normalizeMatrixERN5Eigen12SparseMatrixIdLi0EiEEd0
_ZN7crpropa16normalizeColumnsERN5Eigen12SparseMatrixIdLi0EiEE0
_ZN7crpropa22maximumOfSumsOfColumnsERKN5Eigen12SparseMatrixIdLi0EiEE0
_ZN7crpropa6norm_1ERKN5Eigen12SparseVectorIdLi0EiEE0
_ZN7crpropa7prod_upERKN5Eigen12SparseMatrixIdLi0EiEEPd0
_ZN7crpropa9serializeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKN5Eigen12SparseMatrixIdLi0EiEE0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticLens/ModelMatrix.cpp.gcov.html b/doc/coverageReport/src/magneticLens/ModelMatrix.cpp.gcov.html deleted file mode 100644 index e0c22d95b..000000000 --- a/doc/coverageReport/src/magneticLens/ModelMatrix.cpp.gcov.html +++ /dev/null @@ -1,237 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticLens/ModelMatrix.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticLens - ModelMatrix.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0630.0 %
Date:2024-04-08 14:58:22Functions:070.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : //----------------------------------------------------------------------
-       2             : // This file is part of PARSEC (http://physik.rwth-aachen.de/parsec)
-       3             : // a parametrized simulation engine for cosmic rays.
-       4             : //
-       5             : // Copyright (C) 2011  Martin Erdmann, Peter Schiffer, Tobias Winchen
-       6             : //                     RWTH Aachen University, Germany
-       7             : // Contact: winchen@physik.rwth-aachen.de
-       8             : //
-       9             : //  This program is free software: you can redistribute it and/or
-      10             : //  modify it under the terms of the GNU General Public License as
-      11             : //  published by the Free Software Foundation, either version 3 of
-      12             : //  the License, or (at your option) any later version.
-      13             : //
-      14             : //  This program is distributed in the hope that it will be useful,
-      15             : //  but WITHOUT ANY WARRANTY; without even the implied warranty of
-      16             : //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-      17             : //  GNU General Public License for more details.
-      18             : //
-      19             : //  You should have received a copy of the GNU General Public License
-      20             : //  along with this program. If not, see <http://www.gnu.org/licenses/>.
-      21             : //----------------------------------------------------------------------
-      22             : 
-      23             : #include "crpropa/magneticLens/ModelMatrix.h"
-      24             : #include <ctime>
-      25             : 
-      26             : #include <Eigen/Core>
-      27             : namespace crpropa 
-      28             : {
-      29             : 
-      30           0 : void serialize(const string &filename, const ModelMatrixType& matrix)
-      31             : {
-      32           0 :         ofstream outfile(filename.c_str(), ios::binary);
-      33           0 :         if (!outfile)
-      34             :         {
-      35           0 :                 throw runtime_error("Can't write file: " + filename);
-      36             :         }
-      37             : 
-      38           0 :         uint32_t C = 0;
-      39             :         double val;
-      40             : 
-      41           0 :         C = (uint32_t) (matrix.nonZeros());
-      42           0 :         outfile.write((char*) &C, sizeof(uint32_t));
-      43           0 :         C = (uint32_t) (matrix.rows());
-      44           0 :         outfile.write((char*) &C, sizeof(uint32_t));
-      45           0 :         C = (uint32_t) (matrix.cols());
-      46           0 :         outfile.write((char*) &C, sizeof(uint32_t));
-      47             : 
-      48             :         // serialize non zero elements
-      49           0 :         for (size_t col_idx = 0; col_idx < matrix.cols(); ++col_idx)
-      50             :         {
-      51           0 :                 for (ModelMatrixType::InnerIterator it(matrix,col_idx); it; ++it)
-      52             :                         {
-      53             :                                 it.value();
-      54           0 :                                 C = (uint32_t) it.row();
-      55           0 :                                 outfile.write((char*) &C, sizeof(uint32_t));
-      56             : 
-      57           0 :                                 C = (uint32_t) it.col();
-      58           0 :                                 outfile.write((char*) &C, sizeof(uint32_t));
-      59             : 
-      60           0 :                                 val = it.value();
-      61           0 :                                 outfile.write((char*) &val, sizeof(double));
-      62           0 :                                 if (outfile.fail())
-      63             :                                 {
-      64           0 :                                         throw runtime_error("Error writing file: " + filename);
-      65             :                                 }
-      66             :                         }
-      67             :         }
-      68             : 
-      69           0 :         outfile.close();
-      70           0 : }
-      71             : 
-      72             : 
-      73           0 : void deserialize(const string &filename, ModelMatrixType& matrix)
-      74             : {
-      75           0 :         ifstream infile(filename.c_str(), ios::binary);
-      76           0 :         if (!infile)
-      77             :         {
-      78           0 :                 throw runtime_error("Can't read file: " + filename);
-      79             :         }
-      80             : 
-      81             :         uint32_t nnz, nRows, nColumns;
-      82           0 :         infile.read((char*) &nnz, sizeof(uint32_t));
-      83           0 :         infile.read((char*) &nRows, sizeof(uint32_t));
-      84           0 :         infile.read((char*) &nColumns, sizeof(uint32_t));
-      85           0 :         matrix.resize(nRows, nColumns);
-      86           0 :         matrix.reserve(nnz);
-      87             : 
-      88             :         uint32_t row, column;
-      89             :         double val;
-      90             :         std::vector< Eigen::Triplet<double> > triplets;
-      91           0 :         triplets.resize(nnz);
-      92           0 :         for (size_t i = 0; i < nnz; i++)
-      93             :         {
-      94           0 :                 infile.read((char*) &row, sizeof(uint32_t));
-      95           0 :                 infile.read((char*) &column, sizeof(uint32_t));
-      96           0 :                 infile.read((char*) &val, sizeof(double));
-      97             :                 //M(size1,size2) = val;
-      98           0 :                 triplets[i] = Eigen::Triplet<double>(row, column, val);
-      99             :         }
-     100           0 :         matrix.setFromTriplets(triplets.begin(), triplets.end());
-     101           0 :         matrix.makeCompressed();
-     102           0 : }
-     103             : 
-     104             : 
-     105           0 : double norm_1(const ModelVectorType &v)
-     106             : {
-     107           0 :         return v.cwiseAbs().sum();
-     108             : }
-     109             : 
-     110             : 
-     111           0 : void normalizeColumns(ModelMatrixType &matrix){
-     112           0 :         for (size_t i=0; i< matrix.cols(); i++)
-     113             :         {
-     114           0 :                 ModelVectorType v = matrix.col(i);
-     115           0 :                 double rn = norm_1(v);
-     116           0 :                 matrix.col(i) = v/rn;
-     117             :         }
-     118           0 : }
-     119             : 
-     120             : 
-     121           0 : double maximumOfSumsOfColumns(const ModelMatrixType &matrix) 
-     122             : {
-     123             :         double summax = 0;
-     124           0 :         for (size_t i = 0; i < matrix.cols(); i++)
-     125             :         {
-     126           0 :                 double sum = matrix.col(i).sum();
-     127           0 :                 if (sum > summax)
-     128             :                         summax = sum;
-     129             :         }
-     130           0 :         return summax;
-     131             : }
-     132             : 
-     133           0 :         void normalizeMatrix(ModelMatrixType& matrix, double norm)
-     134             : {
-     135           0 :         matrix /= norm;
-     136           0 : }
-     137             : 
-     138           0 :         void prod_up(const ModelMatrixType& matrix, double* model)
-     139             : {
-     140             : 
-     141             :         // copy storage of model, as matrix vector product cannot be done
-     142             :         // in place
-     143             :         
-     144           0 :         const size_t mSize = matrix.cols();
-     145           0 :         double *origVectorStorage = new double[mSize];
-     146             :         memcpy(origVectorStorage, model, mSize * sizeof(double));
-     147             : 
-     148             : 
-     149             : 
-     150             :         Eigen::Map<Eigen::Matrix<double, Eigen::Dynamic, 1> > origVectorAdaptor(origVectorStorage, mSize);
-     151             :         Eigen::Map<Eigen::Matrix<double, Eigen::Dynamic, 1> > modelVectorAdaptor(model, mSize);
-     152             : 
-     153             :         // perform the optimized product
-     154           0 :         modelVectorAdaptor = matrix * origVectorAdaptor;
-     155             : 
-     156             :         // clean up
-     157           0 :         delete[] origVectorStorage;
-     158           0 : }
-     159             : 
-     160             : 
-     161             : } // namespace parsec
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticLens/ParticleMapsContainer.cpp.func-sort-c.html b/doc/coverageReport/src/magneticLens/ParticleMapsContainer.cpp.func-sort-c.html deleted file mode 100644 index 20670889d..000000000 --- a/doc/coverageReport/src/magneticLens/ParticleMapsContainer.cpp.func-sort-c.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticLens/ParticleMapsContainer.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticLens - ParticleMapsContainer.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:7410570.5 %
Date:2024-04-08 14:58:22Functions:91369.2 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa21ParticleMapsContainer11addParticleEidRKNS_7Vector3IdEEd0
_ZN7crpropa21ParticleMapsContainer17forceWeightUpdateEv0
_ZN7crpropa21ParticleMapsContainer6getMapEid0
_ZN7crpropa21ParticleMapsContainer9applyLensERNS_12MagneticLensE0
_ZN7crpropa21ParticleMapsContainer11getEnergiesEi1
_ZN7crpropa21ParticleMapsContainer14getParticleIdsEv1
_ZN7crpropa21ParticleMapsContainer18getRandomParticlesEmRSt6vectorIiSaIiEERS1_IdSaIdEES7_S7_1
_ZN7crpropa21ParticleMapsContainer11addParticleEidddd2
_ZN7crpropa21ParticleMapsContainerD2Ev2
_ZN7crpropa21ParticleMapsContainer10placeOnMapEidRdS1_420
_ZN7crpropa21ParticleMapsContainer14_updateWeightsEv421
_ZNK7crpropa21ParticleMapsContainer10idx2EnergyEi421
_ZNK7crpropa21ParticleMapsContainer10energy2IdxEd422
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticLens/ParticleMapsContainer.cpp.func.html b/doc/coverageReport/src/magneticLens/ParticleMapsContainer.cpp.func.html deleted file mode 100644 index fec3680af..000000000 --- a/doc/coverageReport/src/magneticLens/ParticleMapsContainer.cpp.func.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticLens/ParticleMapsContainer.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticLens - ParticleMapsContainer.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:7410570.5 %
Date:2024-04-08 14:58:22Functions:91369.2 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa21ParticleMapsContainer10placeOnMapEidRdS1_420
_ZN7crpropa21ParticleMapsContainer11addParticleEidRKNS_7Vector3IdEEd0
_ZN7crpropa21ParticleMapsContainer11addParticleEidddd2
_ZN7crpropa21ParticleMapsContainer11getEnergiesEi1
_ZN7crpropa21ParticleMapsContainer14_updateWeightsEv421
_ZN7crpropa21ParticleMapsContainer14getParticleIdsEv1
_ZN7crpropa21ParticleMapsContainer17forceWeightUpdateEv0
_ZN7crpropa21ParticleMapsContainer18getRandomParticlesEmRSt6vectorIiSaIiEERS1_IdSaIdEES7_S7_1
_ZN7crpropa21ParticleMapsContainer6getMapEid0
_ZN7crpropa21ParticleMapsContainer9applyLensERNS_12MagneticLensE0
_ZN7crpropa21ParticleMapsContainerD2Ev2
_ZNK7crpropa21ParticleMapsContainer10energy2IdxEd422
_ZNK7crpropa21ParticleMapsContainer10idx2EnergyEi421
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticLens/ParticleMapsContainer.cpp.gcov.html b/doc/coverageReport/src/magneticLens/ParticleMapsContainer.cpp.gcov.html deleted file mode 100644 index 58e7fc9e5..000000000 --- a/doc/coverageReport/src/magneticLens/ParticleMapsContainer.cpp.gcov.html +++ /dev/null @@ -1,275 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticLens/ParticleMapsContainer.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticLens - ParticleMapsContainer.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:7410570.5 %
Date:2024-04-08 14:58:22Functions:91369.2 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "HepPID/ParticleIDMethods.hh"
-       2             : #include "crpropa/Random.h"
-       3             : #include "crpropa/magneticLens/ParticleMapsContainer.h"
-       4             : #include "crpropa/Units.h"
-       5             : 
-       6             : #include <iostream>
-       7             : #include <fstream>
-       8             : 
-       9             : namespace crpropa  {
-      10             : 
-      11           2 : ParticleMapsContainer::~ParticleMapsContainer() {
-      12           2 :         for(std::map<int, std::map<int, double*> >::iterator pid_iter = _data.begin(); 
-      13           4 :                         pid_iter != _data.end(); ++pid_iter) {
-      14           2 :                 for(std::map<int, double*>::iterator energy_iter = pid_iter->second.begin();
-      15           4 :                         energy_iter != pid_iter->second.end(); ++energy_iter) {
-      16           2 :                         delete[] (energy_iter->second);
-      17             :                 }
-      18             :         }
-      19           2 : }
-      20             : 
-      21         422 : int ParticleMapsContainer::energy2Idx(double energy) const {
-      22         422 :         double lE = log10(energy / eV);
-      23         422 :         return int((lE - _bin0lowerEdge) / _deltaLogE);
-      24             : }
-      25             : 
-      26         421 : double ParticleMapsContainer::idx2Energy(int idx) const {
-      27         421 :         return pow(10, idx * _deltaLogE + _bin0lowerEdge + _deltaLogE / 2) * eV;
-      28             : }
-      29             : 
-      30             :                 
-      31           0 : double* ParticleMapsContainer::getMap(const int particleId, double energy) {
-      32           0 :         _weightsUpToDate = false;
-      33           0 :         if (_data.find(particleId) == _data.end()) {
-      34           0 :                 std::cerr << "No map for ParticleID " << particleId << std::endl;
-      35           0 :                 return NULL;
-      36             :         }
-      37           0 :         int energyIdx   = energy2Idx(energy);
-      38           0 :         if (_data[particleId].find(energyIdx) == _data[particleId].end()) {
-      39           0 :                 std::cerr << "No map for ParticleID and energy" << energy / eV << " eV" << std::endl;
-      40           0 :                 return NULL;
-      41             :         }
-      42           0 :         return _data[particleId][energy2Idx(energy)];
-      43             : }
-      44             :                         
-      45             :                         
-      46           2 : void ParticleMapsContainer::addParticle(const int particleId, double energy, double galacticLongitude, double galacticLatitude, double weight) {
-      47           2 :         _weightsUpToDate = false;
-      48           2 :         if (_data.find(particleId) == _data.end()) {
-      49             :                 map<int, double*> M;
-      50           2 :                 _data[particleId] = M;
-      51             :         }
-      52             : 
-      53           2 :         int energyIdx   = energy2Idx(energy);
-      54           4 :         if (_data[particleId].find(energyIdx) == _data[particleId].end()) {
-      55           2 :                 _data[particleId][energyIdx] = new double[_pixelization.getNumberOfPixels()];
-      56           2 :                 std::fill(_data[particleId][energyIdx], _data[particleId][energyIdx] + _pixelization.getNumberOfPixels(), 0);
-      57             :         }
-      58             : 
-      59           2 :         uint32_t pixel = _pixelization.direction2Pix(galacticLongitude, galacticLatitude);
-      60           2 :         _data[particleId][energyIdx][pixel] += weight;
-      61           2 : }
-      62             : 
-      63             : 
-      64           0 : void ParticleMapsContainer::addParticle(const int particleId, double energy, const Vector3d &p, double weight) {
-      65           0 :         double galacticLongitude = atan2(-p.y, -p.x);
-      66           0 :         double galacticLatitude =       M_PI / 2 - acos(-p.z / p.getR());
-      67           0 :         addParticle(particleId, energy, galacticLongitude, galacticLatitude, weight);
-      68           0 : }
-      69             : 
-      70             : 
-      71           1 : std::vector<int> ParticleMapsContainer::getParticleIds() {
-      72             :         std::vector<int> ids;
-      73           1 :         for(std::map<int, std::map<int, double*> >::iterator pid_iter = _data.begin(); 
-      74           2 :                         pid_iter != _data.end(); ++pid_iter) {
-      75           1 :                 ids.push_back(pid_iter->first);
-      76             :         }
-      77           1 :         return ids;
-      78             : }
-      79             : 
-      80             : 
-      81           1 : std::vector<double> ParticleMapsContainer::getEnergies(int pid) {
-      82             :         std::vector<double> energies;
-      83           1 :         if (_data.find(pid) != _data.end()) {
-      84           1 :                 for(std::map<int, double*>::iterator iter = _data[pid].begin(); 
-      85           2 :                         iter != _data[pid].end(); ++iter) {
-      86           1 :                         energies.push_back( idx2Energy(iter->first) / eV );
-      87             :                 }
-      88             :         }
-      89           1 :         return energies;
-      90             : }
-      91             : 
-      92             : 
-      93           0 : void ParticleMapsContainer::applyLens(MagneticLens &lens) {
-      94             :         // if lens is normalized, this should not be necessary.
-      95           0 :         _weightsUpToDate = false;
-      96             : 
-      97           0 :         for(std::map<int, std::map<int, double*> >::iterator pid_iter = _data.begin(); 
-      98           0 :                         pid_iter != _data.end(); ++pid_iter) {
-      99           0 :                 for(std::map<int, double*>::iterator energy_iter = pid_iter->second.begin();
-     100           0 :                         energy_iter != pid_iter->second.end(); ++energy_iter) {
-     101             :                         // transform only nuclei
-     102           0 :                         double energy = idx2Energy(energy_iter->first);
-     103           0 :                         int chargeNumber = HepPID::Z(pid_iter->first);
-     104           0 :                         if (chargeNumber != 0 && lens.rigidityCovered(energy / chargeNumber)) {
-     105           0 :                                 lens.transformModelVector(energy_iter->second, energy / chargeNumber);
-     106             :                         } else { // still normalize the vectors 
-     107           0 :                                 for(size_t j=0; j< _pixelization.getNumberOfPixels() ; j++) {
-     108           0 :                                         energy_iter->second[j] /= lens.getNorm();
-     109             :                                 }
-     110             :                         }
-     111             :                 }
-     112             :         }
-     113           0 : }
-     114             : 
-     115             : 
-     116         421 : void ParticleMapsContainer::_updateWeights() {
-     117         421 :         if (_weightsUpToDate)
-     118             :                 return;
-     119             : 
-     120           1 :         for(std::map<int, std::map<int, double*> >::iterator pid_iter = _data.begin(); 
-     121           2 :                         pid_iter != _data.end(); ++pid_iter) {
-     122           1 :                 _weightsPID[pid_iter->first] = 0;
-     123             : 
-     124           1 :                 for(std::map<int, double*>::iterator energy_iter = pid_iter->second.begin();
-     125           2 :                         energy_iter != pid_iter->second.end(); ++energy_iter)  {
-     126             : 
-     127           1 :                         _weights_pidEnergy[pid_iter->first][energy_iter->first] = 0;
-     128       49153 :                         for(size_t j = 0; j< _pixelization.getNumberOfPixels() ; j++) {
-     129       49152 :                                 _weights_pidEnergy[pid_iter->first][energy_iter->first] +=energy_iter->second[j];
-     130       49152 :                                 _weightsPID[pid_iter->first]+=energy_iter->second[j];
-     131             :                         }
-     132           1 :                         _sumOfWeights+=_weights_pidEnergy[pid_iter->first][energy_iter->first];
-     133             :                 }
-     134             :         }
-     135           1 :         _weightsUpToDate = true;
-     136             : }
-     137             : 
-     138             : 
-     139           1 : void ParticleMapsContainer::getRandomParticles(size_t N, vector<int> &particleId, 
-     140             :         vector<double> &energy, vector<double> &galacticLongitudes,
-     141             :         vector<double> &galacticLatitudes) {
-     142           1 :         _updateWeights();
-     143             : 
-     144           1 :         particleId.resize(N);
-     145           1 :         energy.resize(N);
-     146           1 :         galacticLongitudes.resize(N);
-     147           1 :         galacticLatitudes.resize(N);
-     148             : 
-     149         421 :         for(size_t i=0; i< N; i++) {
-     150             :                 //get particle
-     151         420 :                 double r = Random::instance().rand() * _sumOfWeights;
-     152             :                 std::map<int, double>::iterator iter = _weightsPID.begin();
-     153         420 :                 while ((r-= iter->second) > 0) {
-     154             :                         ++iter; 
-     155             :                 }
-     156         420 :                 particleId[i] = iter->first;
-     157             :         
-     158             :                 //get energy
-     159         420 :                 r = Random::instance().rand() * iter->second;
-     160         420 :                 iter = _weights_pidEnergy[particleId[i]].begin();
-     161         420 :                 while ((r-= iter->second) > 0) {
-     162             :                  ++iter; 
-     163             :                 }
-     164         420 :                 energy[i] = idx2Energy(iter->first) / eV;
-     165             : 
-     166         420 :                 placeOnMap(particleId[i], energy[i] * eV, galacticLongitudes[i], galacticLatitudes[i]);
-     167             :         }
-     168           1 : }
-     169             : 
-     170             : 
-     171         420 : bool ParticleMapsContainer::placeOnMap(int pid, double energy, double &galacticLongitude, double &galacticLatitude) {
-     172         420 :         _updateWeights();
-     173             : 
-     174         420 :         if (_data.find(pid) == _data.end()) {
-     175             :                 return false;
-     176             :         }
-     177         420 :         int energyIdx   = energy2Idx(energy);
-     178         840 :         if (_data[pid].find(energyIdx) == _data[pid].end()) {
-     179             :                 return false;
-     180             :         }
-     181             : 
-     182         420 :         double r = Random::instance().rand() * _weights_pidEnergy[pid][energyIdx];
-     183             : 
-     184    10268580 :         for(size_t j = 0; j< _pixelization.getNumberOfPixels(); j++) {
-     185    10268580 :                 r -= _data[pid][energyIdx][j];
-     186    10268580 :                 if (r <= 0) {
-     187         420 :                         _pixelization.getRandomDirectionInPixel(j, galacticLongitude, galacticLatitude);
-     188         420 :                         return true;
-     189             :                 }
-     190             :         }
-     191             :         return false;
-     192             : }
-     193             : 
-     194             : 
-     195           0 : void ParticleMapsContainer::forceWeightUpdate() {
-     196           0 :         _weightsUpToDate = false;
-     197           0 : }
-     198             : 
-     199             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticLens/Pixelization.cpp.func-sort-c.html b/doc/coverageReport/src/magneticLens/Pixelization.cpp.func-sort-c.html deleted file mode 100644 index 70dfc7376..000000000 --- a/doc/coverageReport/src/magneticLens/Pixelization.cpp.func-sort-c.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticLens/Pixelization.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticLens - Pixelization.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:305060.0 %
Date:2024-04-08 14:58:22Functions:6875.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa12Pixelization4nPixEh0
_ZN7crpropa12Pixelization9pix2OrderEj0
_ZN7crpropa12Pixelization25getRandomDirectionInPixelEjRdS1_421
_ZNK7crpropa12Pixelization11spherCo2VecEddRN7healpix6vec3_tIdEE24585
_ZNK7crpropa12Pixelization13direction2PixEdd24585
_ZNK7crpropa12Pixelization13pix2DirectionEjRdS1_36868
_ZNK7crpropa12Pixelization12vec2SphereCoERdS1_RKN7healpix6vec3_tIdEE37289
_ZNK7crpropa12Pixelization15angularDistanceEjj49152
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticLens/Pixelization.cpp.func.html b/doc/coverageReport/src/magneticLens/Pixelization.cpp.func.html deleted file mode 100644 index d568a50f3..000000000 --- a/doc/coverageReport/src/magneticLens/Pixelization.cpp.func.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticLens/Pixelization.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticLens - Pixelization.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:305060.0 %
Date:2024-04-08 14:58:22Functions:6875.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa12Pixelization25getRandomDirectionInPixelEjRdS1_421
_ZN7crpropa12Pixelization4nPixEh0
_ZN7crpropa12Pixelization9pix2OrderEj0
_ZNK7crpropa12Pixelization11spherCo2VecEddRN7healpix6vec3_tIdEE24585
_ZNK7crpropa12Pixelization12vec2SphereCoERdS1_RKN7healpix6vec3_tIdEE37289
_ZNK7crpropa12Pixelization13direction2PixEdd24585
_ZNK7crpropa12Pixelization13pix2DirectionEjRdS1_36868
_ZNK7crpropa12Pixelization15angularDistanceEjj49152
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticLens/Pixelization.cpp.gcov.html b/doc/coverageReport/src/magneticLens/Pixelization.cpp.gcov.html deleted file mode 100644 index 26f97cb78..000000000 --- a/doc/coverageReport/src/magneticLens/Pixelization.cpp.gcov.html +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticLens/Pixelization.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticLens - Pixelization.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:305060.0 %
Date:2024-04-08 14:58:22Functions:6875.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : //----------------------------------------------------------------------
-       2             : // This file is part of PARSEC (http://physik.rwth-aachen.de/parsec)
-       3             : // a parametrized simulation engine for cosmic rays.
-       4             : //
-       5             : // Copyright (C) 2011  Martin Erdmann, Peter Schiffer, Tobias Winchen
-       6             : //                     RWTH Aachen University, Germany
-       7             : // Contact: winchen@physik.rwth-aachen.de
-       8             : //
-       9             : //  This program is free software: you can redistribute it and/or
-      10             : //  modify it under the terms of the GNU General Public License as
-      11             : //  published by the Free Software Foundation, either version 3 of
-      12             : //  the License, or (at your option) any later version.
-      13             : //
-      14             : //  This program is distributed in the hope that it will be useful,
-      15             : //  but WITHOUT ANY WARRANTY; without even the implied warranty of
-      16             : //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-      17             : //  GNU General Public License for more details.
-      18             : //
-      19             : //  You should have received a copy of the GNU General Public License
-      20             : //  along with this program. If not, see <http://www.gnu.org/licenses/>.
-      21             : //----------------------------------------------------------------------
-      22             : 
-      23             : #include "crpropa/magneticLens/Pixelization.h"
-      24             : #include "crpropa/Random.h"
-      25             : 
-      26             : namespace crpropa 
-      27             : {
-      28             : 
-      29             :         healpix::T_Healpix_Base<healpix::int64> Pixelization::_healpix_nest = healpix::T_Healpix_Base<healpix::int64>(29, healpix::NEST);
-      30             : 
-      31             : 
-      32           0 : uint8_t Pixelization::pix2Order(uint32_t pix)
-      33             : {
-      34           0 :         for (uint8_t i = 0; i < _nOrder_max; i++)
-      35             :         {
-      36           0 :                 if (pix == _nPix[i])
-      37           0 :                         return i + 1;
-      38             :         }
-      39             :         return 0;
-      40             : }
-      41             : 
-      42           0 : uint32_t Pixelization::nPix(uint8_t order)
-      43             : {
-      44           0 :         if (order > _nOrder_max)
-      45             :         {
-      46             :                 return 0;
-      47             :         }
-      48             :         else
-      49             :         {
-      50           0 :                 return _nPix[order - 1];
-      51             :         }
-      52             : }
-      53             : 
-      54       24585 : uint32_t Pixelization::direction2Pix(double longitude, double latitude) const
-      55             : {
-      56             :         healpix::vec3 v;
-      57       24585 :         spherCo2Vec(longitude, latitude, v);
-      58             :         try
-      59             :         {
-      60       24585 :                 uint32_t i = (uint32_t) _healpix->vec2pix(v);
-      61       24585 :                 return i;
-      62             :         }
-      63           0 :         catch (healpix::PlanckError &e)
-      64             :         {
-      65           0 :                 std::cerr << "Healpix error triggered from direction2Pix(" << longitude << ", " << latitude  << ")\n";
-      66           0 :                 std::cerr << " v = " << v.x <<", " << v.y << ", " <<  v.z << std::endl;
-      67           0 :                 std::cerr << "\n The original exception reads:\n";
-      68           0 :                 std::cerr << e.what() << std::endl;
-      69           0 :                 throw;
-      70           0 :         }
-      71             : }
-      72             : 
-      73       36868 : void Pixelization::pix2Direction(uint32_t i, double &longitude,
-      74             :                 double &latitude) const
-      75             : {
-      76             :         healpix::vec3 v;
-      77             :         try{
-      78       36868 :                 v = _healpix->pix2vec(i);
-      79             :         }
-      80           0 :         catch (healpix::PlanckError &e)
-      81             :         {
-      82           0 :                 std::cerr << "Healpix error triggered from pix2Direction(" << i << ", &longitude, &latitude " << ")\n";
-      83           0 :                 std::cerr << "The original exception reads:\n";
-      84           0 :                 std::cerr << e.what() << std::endl;
-      85           0 :                 throw;
-      86           0 :         }
-      87             : 
-      88       36868 :         vec2SphereCo(longitude, latitude, v);
-      89       36868 : }
-      90             : 
-      91       24585 : void Pixelization::spherCo2Vec(double phi, double theta,
-      92             :                 healpix::vec3 &V) const
-      93             : {
-      94       24585 :         V.x = cos(phi) * cos(theta);
-      95       24585 :         V.y = sin(phi) * cos(theta);
-      96       24585 :         V.z = sin(theta);
-      97       24585 : }
-      98             : 
-      99       37289 : void Pixelization::vec2SphereCo(double &phi, double &theta,
-     100             :                 const healpix::vec3 &V) const
-     101             : {
-     102       37289 :         theta = asin(V.z);
-     103       37289 :         phi = healpix::safe_atan2(V.y, V.x);
-     104       37289 : }
-     105             : 
-     106             : 
-     107       49152 : double Pixelization::angularDistance(uint32_t i, uint32_t j) const
-     108             : {
-     109             :         healpix::vec3 v1, v2;
-     110       49152 :         v1 = _healpix->pix2vec(i);
-     111       49152 :         v2 = _healpix->pix2vec(j);
-     112       49152 :         double s = v1.x * v2.x + v1.y * v2.y + v1.z * v2.z;
-     113             :         // Failsafe for numerical inaccuracies
-     114       49152 :         return ((s > 1) ? 0 : ((s < -1) ? M_PI : acos(s)));
-     115             : }
-     116             : 
-     117         421 : void Pixelization::getRandomDirectionInPixel(uint32_t i, double &longitude, double &latitude) 
-     118             : {
-     119             :         
-     120         421 :         uint64_t inest = _healpix->ring2nest(i);
-     121         421 :         uint64_t nUp = 29 - _healpix->Order();
-     122         421 :         uint64_t iUp = inest * pow(4, nUp);
-     123         421 :         iUp += Random::instance().randInt64(pow(4, nUp));
-     124             : 
-     125         421 :         healpix::vec3 v = _healpix_nest.pix2vec(iUp);
-     126             :         
-     127         421 :         vec2SphereCo(longitude, latitude, v);
-     128         421 : }
-     129             : } // namespace
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticLens/index-sort-f.html b/doc/coverageReport/src/magneticLens/index-sort-f.html deleted file mode 100644 index 2a95e9fb8..000000000 --- a/doc/coverageReport/src/magneticLens/index-sort-f.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticLens - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticLensHitTotalCoverage
Test:coverage.info.cleanedLines:14732245.7 %
Date:2024-04-08 14:58:22Functions:214151.2 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
ModelMatrix.cpp -
0.0%
-
0.0 %0 / 630.0 %0 / 7
MagneticLens.cpp -
41.3%41.3%
-
41.3 %43 / 10446.2 %6 / 13
ParticleMapsContainer.cpp -
70.5%70.5%
-
70.5 %74 / 10569.2 %9 / 13
Pixelization.cpp -
60.0%60.0%
-
60.0 %30 / 5075.0 %6 / 8
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticLens/index-sort-l.html b/doc/coverageReport/src/magneticLens/index-sort-l.html deleted file mode 100644 index 7bd0ec2a3..000000000 --- a/doc/coverageReport/src/magneticLens/index-sort-l.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticLens - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticLensHitTotalCoverage
Test:coverage.info.cleanedLines:14732245.7 %
Date:2024-04-08 14:58:22Functions:214151.2 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
ModelMatrix.cpp -
0.0%
-
0.0 %0 / 630.0 %0 / 7
MagneticLens.cpp -
41.3%41.3%
-
41.3 %43 / 10446.2 %6 / 13
Pixelization.cpp -
60.0%60.0%
-
60.0 %30 / 5075.0 %6 / 8
ParticleMapsContainer.cpp -
70.5%70.5%
-
70.5 %74 / 10569.2 %9 / 13
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/magneticLens/index.html b/doc/coverageReport/src/magneticLens/index.html deleted file mode 100644 index bacc94ec2..000000000 --- a/doc/coverageReport/src/magneticLens/index.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/magneticLens - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/magneticLensHitTotalCoverage
Test:coverage.info.cleanedLines:14732245.7 %
Date:2024-04-08 14:58:22Functions:214151.2 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
MagneticLens.cpp -
41.3%41.3%
-
41.3 %43 / 10446.2 %6 / 13
ModelMatrix.cpp -
0.0%
-
0.0 %0 / 630.0 %0 / 7
ParticleMapsContainer.cpp -
70.5%70.5%
-
70.5 %74 / 10569.2 %9 / 13
Pixelization.cpp -
60.0%60.0%
-
60.0 %30 / 5075.0 %6 / 8
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/massDistribution/ConstantDensity.cpp.func-sort-c.html b/doc/coverageReport/src/massDistribution/ConstantDensity.cpp.func-sort-c.html deleted file mode 100644 index 506fe0201..000000000 --- a/doc/coverageReport/src/massDistribution/ConstantDensity.cpp.func-sort-c.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/massDistribution/ConstantDensity.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/massDistribution - ConstantDensity.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:748983.1 %
Date:2024-04-08 14:58:22Functions:181994.7 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa15ConstantDensity14getDescriptionB5cxx11Ev0
_ZN7crpropa15ConstantDensity5setH2Eb1
_ZN7crpropa15ConstantDensity5setH2Ed1
_ZN7crpropa15ConstantDensity5setHIEb1
_ZN7crpropa15ConstantDensity5setHIEd1
_ZN7crpropa15ConstantDensity6setHIIEb1
_ZN7crpropa15ConstantDensity6setHIIEd1
_ZN7crpropa15ConstantDensity10getIsForH2Ev2
_ZN7crpropa15ConstantDensity10getIsForHIEv2
_ZN7crpropa15ConstantDensity11getIsForHIIEv2
_ZN7crpropa15ConstantDensityC2Eddd3
_ZNK7crpropa15ConstantDensity10getDensityERKNS_7Vector3IdEE4
_ZNK7crpropa15ConstantDensity12getH2DensityERKNS_7Vector3IdEE4
_ZNK7crpropa15ConstantDensity12getHIDensityERKNS_7Vector3IdEE4
_ZNK7crpropa15ConstantDensity13getHIIDensityERKNS_7Vector3IdEE4
_ZNK7crpropa15ConstantDensity17getNucleonDensityERKNS_7Vector3IdEE4
_ZN7crpropa15ConstantDensity5setH2Ebd5
_ZN7crpropa15ConstantDensity5setHIEbd5
_ZN7crpropa15ConstantDensity6setHIIEbd5
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/massDistribution/ConstantDensity.cpp.func.html b/doc/coverageReport/src/massDistribution/ConstantDensity.cpp.func.html deleted file mode 100644 index f0cb8a317..000000000 --- a/doc/coverageReport/src/massDistribution/ConstantDensity.cpp.func.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/massDistribution/ConstantDensity.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/massDistribution - ConstantDensity.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:748983.1 %
Date:2024-04-08 14:58:22Functions:181994.7 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa15ConstantDensity10getIsForH2Ev2
_ZN7crpropa15ConstantDensity10getIsForHIEv2
_ZN7crpropa15ConstantDensity11getIsForHIIEv2
_ZN7crpropa15ConstantDensity14getDescriptionB5cxx11Ev0
_ZN7crpropa15ConstantDensity5setH2Eb1
_ZN7crpropa15ConstantDensity5setH2Ebd5
_ZN7crpropa15ConstantDensity5setH2Ed1
_ZN7crpropa15ConstantDensity5setHIEb1
_ZN7crpropa15ConstantDensity5setHIEbd5
_ZN7crpropa15ConstantDensity5setHIEd1
_ZN7crpropa15ConstantDensity6setHIIEb1
_ZN7crpropa15ConstantDensity6setHIIEbd5
_ZN7crpropa15ConstantDensity6setHIIEd1
_ZN7crpropa15ConstantDensityC2Eddd3
_ZNK7crpropa15ConstantDensity10getDensityERKNS_7Vector3IdEE4
_ZNK7crpropa15ConstantDensity12getH2DensityERKNS_7Vector3IdEE4
_ZNK7crpropa15ConstantDensity12getHIDensityERKNS_7Vector3IdEE4
_ZNK7crpropa15ConstantDensity13getHIIDensityERKNS_7Vector3IdEE4
_ZNK7crpropa15ConstantDensity17getNucleonDensityERKNS_7Vector3IdEE4
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/massDistribution/ConstantDensity.cpp.gcov.html b/doc/coverageReport/src/massDistribution/ConstantDensity.cpp.gcov.html deleted file mode 100644 index 94c4d2718..000000000 --- a/doc/coverageReport/src/massDistribution/ConstantDensity.cpp.gcov.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/massDistribution/ConstantDensity.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/massDistribution - ConstantDensity.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:748983.1 %
Date:2024-04-08 14:58:22Functions:181994.7 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/massDistribution/ConstantDensity.h"
-       2             : 
-       3             : #include "kiss/logger.h"
-       4             : 
-       5             : #include <sstream>
-       6             : 
-       7             : namespace crpropa{
-       8             : 
-       9           3 : ConstantDensity::ConstantDensity(double HI, double HII, double H2) {
-      10             :         // set all types active which are not equal 0 and change number density
-      11           3 :         if(HI!=0)
-      12           3 :                 setHI(true, HI);
-      13           3 :         if(HII!=0)
-      14           3 :                 setHII(true, HII);
-      15           3 :         if(H2!=0)
-      16           3 :                 setH2(true, H2);
-      17           3 : }
-      18             : 
-      19           4 : double ConstantDensity::getDensity(const Vector3d &position) const {
-      20             :         double n = 0;
-      21             : 
-      22           4 :         if(isHI)
-      23           3 :                 n += HIdensitynumber;
-      24           4 :         if(isHII)
-      25           3 :                 n += HIIdensitynumber;
-      26           4 :         if(isH2)
-      27           3 :                 n += H2densitynumber;
-      28             : 
-      29             :         // check if all densities are deactivated and raise warning if so
-      30           4 :         if((isHI || isHII || isH2) == false){
-      31           2 :                 KISS_LOG_WARNING
-      32           1 :                         << "\nCalled getNucleonDensity on fully deactivated ConstantDensity "
-      33           1 :                         << "gas density model. In this case the density is allways set to 0. \n";
-      34             :         }
-      35             : 
-      36           4 :         return n;
-      37             : }
-      38             : 
-      39           4 : double ConstantDensity::getNucleonDensity(const Vector3d &position) const {
-      40             :         double n = 0;
-      41             : 
-      42           4 :         if(isHI)
-      43           3 :                 n += HIdensitynumber;
-      44           4 :         if(isHII)
-      45           3 :                 n += HIIdensitynumber;
-      46           4 :         if(isH2)
-      47           3 :                 n += 2*H2densitynumber;
-      48             : 
-      49             :         // check if all densities are deactivated and raise warning if so
-      50           4 :         if((isHI || isHII || isH2) == false){
-      51           2 :                 KISS_LOG_WARNING
-      52           1 :                         << "\nCalled getNucleonDensity on fully deactivated ConstantDensity "
-      53           1 :                         << "gas density model. In this case the density is allways set to 0. \n";
-      54             :         }
-      55           4 :         return n;
-      56             : }
-      57             : 
-      58           4 : double ConstantDensity::getHIDensity(const Vector3d &position) const {
-      59           4 :         return HIdensitynumber;
-      60             : }
-      61             : 
-      62           4 : double ConstantDensity::getHIIDensity(const Vector3d &position) const{
-      63           4 :         return HIIdensitynumber;
-      64             : }
-      65             : 
-      66           4 : double ConstantDensity::getH2Density(const Vector3d &position) const{
-      67           4 :         return H2densitynumber;
-      68             : }
-      69             : 
-      70           2 : bool ConstantDensity::getIsForHI() {
-      71           2 :         return isHI;
-      72             : }
-      73             : 
-      74           2 : bool ConstantDensity::getIsForHII() {
-      75           2 :         return isHII;
-      76             : }
-      77             : 
-      78           2 : bool ConstantDensity::getIsForH2() {
-      79           2 :         return isH2;
-      80             : }
-      81             : 
-      82           5 : void ConstantDensity::setHI(bool activate, double densitynumber) {
-      83           5 :         isHI = activate;
-      84           5 :         HIdensitynumber = densitynumber;
-      85           5 : }
-      86             : 
-      87           1 : void ConstantDensity::setHI(bool activate) {
-      88           1 :         setHI(activate, HIdensitynumber);
-      89           1 : }
-      90             : 
-      91           1 : void ConstantDensity::setHI(double densitynumber) {
-      92           1 :         setHI(isHI, densitynumber);
-      93           1 : }
-      94             : 
-      95           5 : void ConstantDensity::setHII(bool activate, double densitynumber) {
-      96           5 :         isHII = activate;
-      97           5 :         HIIdensitynumber = densitynumber;
-      98           5 : }
-      99             : 
-     100           1 : void ConstantDensity::setHII(bool activate) {
-     101           1 :         setHII(activate, HIIdensitynumber);
-     102           1 : }
-     103             : 
-     104           1 : void ConstantDensity::setHII(double densitynumber) {
-     105           1 :         setHII(isHII, densitynumber);
-     106           1 : }
-     107             : 
-     108           5 : void ConstantDensity::setH2(bool activate, double densitynumber) {
-     109           5 :         isH2 = activate;
-     110           5 :         H2densitynumber = densitynumber;
-     111           5 : }
-     112             : 
-     113           1 : void ConstantDensity::setH2(bool activate) {
-     114           1 :         setH2(activate, H2densitynumber);
-     115           1 : }
-     116             : 
-     117           1 : void ConstantDensity::setH2(double densitynumber) {
-     118           1 :         setH2(isH2, densitynumber);
-     119           1 : }
-     120             : 
-     121           0 : std::string ConstantDensity::getDescription() {
-     122           0 :         std::stringstream s;
-     123           0 :         s << "ConstantDensity:\n";
-     124           0 :         s<< "HI component is ";
-     125           0 :         if(!isHI)
-     126           0 :                 s<< "not ";
-     127           0 :         s<< "active and has a density of " << HIdensitynumber/ccm << " cm^-3" << "\nHII component is ";
-     128           0 :         if(!isHII)
-     129           0 :                 s<< "not ";
-     130           0 :         s<<"active and has a density of " << HIIdensitynumber/ccm<<" cm^-3" <<  "\nH2 component is ";
-     131           0 :         if(!isH2)
-     132           0 :                 s<<"not ";
-     133           0 :         s<<"active and has a density of " << H2densitynumber/ccm << " cm^-3";
-     134           0 :         return s.str();
-     135           0 : }
-     136             : 
-     137             : }  // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/massDistribution/Cordes.cpp.func-sort-c.html b/doc/coverageReport/src/massDistribution/Cordes.cpp.func-sort-c.html deleted file mode 100644 index 5ac34bc19..000000000 --- a/doc/coverageReport/src/massDistribution/Cordes.cpp.func-sort-c.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/massDistribution/Cordes.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/massDistribution - Cordes.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:162176.2 %
Date:2024-04-08 14:58:22Functions:6785.7 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa6Cordes14getDescriptionB5cxx11Ev0
_ZN7crpropa6Cordes10getIsForH2Ev1
_ZN7crpropa6Cordes10getIsForHIEv1
_ZN7crpropa6Cordes11getIsForHIIEv1
_ZNK7crpropa6Cordes17getNucleonDensityERKNS_7Vector3IdEE1
_ZNK7crpropa6Cordes10getDensityERKNS_7Vector3IdEE2
_ZNK7crpropa6Cordes13getHIIDensityERKNS_7Vector3IdEE4
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/massDistribution/Cordes.cpp.func.html b/doc/coverageReport/src/massDistribution/Cordes.cpp.func.html deleted file mode 100644 index 6522e9bd4..000000000 --- a/doc/coverageReport/src/massDistribution/Cordes.cpp.func.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/massDistribution/Cordes.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/massDistribution - Cordes.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:162176.2 %
Date:2024-04-08 14:58:22Functions:6785.7 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa6Cordes10getIsForH2Ev1
_ZN7crpropa6Cordes10getIsForHIEv1
_ZN7crpropa6Cordes11getIsForHIIEv1
_ZN7crpropa6Cordes14getDescriptionB5cxx11Ev0
_ZNK7crpropa6Cordes10getDensityERKNS_7Vector3IdEE2
_ZNK7crpropa6Cordes13getHIIDensityERKNS_7Vector3IdEE4
_ZNK7crpropa6Cordes17getNucleonDensityERKNS_7Vector3IdEE1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/massDistribution/Cordes.cpp.gcov.html b/doc/coverageReport/src/massDistribution/Cordes.cpp.gcov.html deleted file mode 100644 index 47a3e4fcf..000000000 --- a/doc/coverageReport/src/massDistribution/Cordes.cpp.gcov.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/massDistribution/Cordes.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/massDistribution - Cordes.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:162176.2 %
Date:2024-04-08 14:58:22Functions:6785.7 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/massDistribution/Cordes.h"
-       2             : #include "crpropa/Common.h"
-       3             : 
-       4             : #include <sstream>
-       5             : 
-       6             : namespace crpropa {
-       7             : 
-       8           4 : double Cordes::getHIIDensity(const Vector3d &position) const {
-       9             :         double n=0;  // in m^-3
-      10             : 
-      11           4 :         double z=position.z;
-      12           4 :         double R = sqrt(position.x*position.x+position.y*position.y);  //radius in galactic disk
-      13             : 
-      14           4 :         n += 0.025/ccm*exp(-fabs(z)/(1*kpc))*exp(-pow_integer<2>(R/(20*kpc)));  // galactocentric component
-      15           4 :         n += 0.2/ccm*exp(-fabs(z)/(0.15*kpc))*exp(-pow_integer<2>((R-4*kpc)/(2*kpc)));  // anular component
-      16             : 
-      17           4 :         return n;
-      18             : }
-      19             : 
-      20           2 : double Cordes::getDensity(const Vector3d &position) const {
-      21           2 :         return Cordes::getHIIDensity(position);
-      22             : }
-      23             : 
-      24           1 : double Cordes::getNucleonDensity(const Vector3d &position) const {
-      25           1 :         return getHIIDensity(position);
-      26             : }
-      27             : 
-      28           1 : bool Cordes::getIsForHI() {
-      29           1 :         return isforHI;
-      30             : }
-      31             : 
-      32           1 : bool Cordes::getIsForHII() {
-      33           1 :         return isforHII;
-      34             : }
-      35             : 
-      36           1 : bool Cordes::getIsForH2() {
-      37           1 :         return isforH2;
-      38             : }
-      39             : 
-      40           0 : std::string Cordes::getDescription() {
-      41           0 :         std::stringstream s;
-      42           0 :         s << "Density Cordes: includes only an HII component";
-      43           0 :         return s.str();
-      44           0 : }
-      45             : 
-      46             : }  // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/massDistribution/Ferriere.cpp.func-sort-c.html b/doc/coverageReport/src/massDistribution/Ferriere.cpp.func-sort-c.html deleted file mode 100644 index 31d3bf13c..000000000 --- a/doc/coverageReport/src/massDistribution/Ferriere.cpp.func-sort-c.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/massDistribution/Ferriere.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/massDistribution - Ferriere.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13615190.1 %
Date:2024-04-08 14:58:22Functions:131492.9 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa8Ferriere14getDescriptionB5cxx11Ev0
_ZN7crpropa8Ferriere10setIsForH2Eb1
_ZN7crpropa8Ferriere10setIsForHIEb1
_ZN7crpropa8Ferriere11setIsForHIIEb1
_ZN7crpropa8Ferriere10getIsForH2Ev4
_ZN7crpropa8Ferriere10getIsForHIEv4
_ZN7crpropa8Ferriere11getIsForHIIEv4
_ZNK7crpropa8Ferriere10getDensityERKNS_7Vector3IdEE5
_ZNK7crpropa8Ferriere17getNucleonDensityERKNS_7Vector3IdEE5
_ZNK7crpropa8Ferriere12getH2DensityERKNS_7Vector3IdEE12
_ZNK7crpropa8Ferriere12getHIDensityERKNS_7Vector3IdEE12
_ZNK7crpropa8Ferriere13getHIIDensityERKNS_7Vector3IdEE12
_ZNK7crpropa8Ferriere17CMZTransformationERKNS_7Vector3IdEE13
_ZNK7crpropa8Ferriere18DiskTransformationERKNS_7Vector3IdEE13
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/massDistribution/Ferriere.cpp.func.html b/doc/coverageReport/src/massDistribution/Ferriere.cpp.func.html deleted file mode 100644 index 0c1bd9d00..000000000 --- a/doc/coverageReport/src/massDistribution/Ferriere.cpp.func.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/massDistribution/Ferriere.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/massDistribution - Ferriere.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13615190.1 %
Date:2024-04-08 14:58:22Functions:131492.9 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa8Ferriere10getIsForH2Ev4
_ZN7crpropa8Ferriere10getIsForHIEv4
_ZN7crpropa8Ferriere10setIsForH2Eb1
_ZN7crpropa8Ferriere10setIsForHIEb1
_ZN7crpropa8Ferriere11getIsForHIIEv4
_ZN7crpropa8Ferriere11setIsForHIIEb1
_ZN7crpropa8Ferriere14getDescriptionB5cxx11Ev0
_ZNK7crpropa8Ferriere10getDensityERKNS_7Vector3IdEE5
_ZNK7crpropa8Ferriere12getH2DensityERKNS_7Vector3IdEE12
_ZNK7crpropa8Ferriere12getHIDensityERKNS_7Vector3IdEE12
_ZNK7crpropa8Ferriere13getHIIDensityERKNS_7Vector3IdEE12
_ZNK7crpropa8Ferriere17CMZTransformationERKNS_7Vector3IdEE13
_ZNK7crpropa8Ferriere17getNucleonDensityERKNS_7Vector3IdEE5
_ZNK7crpropa8Ferriere18DiskTransformationERKNS_7Vector3IdEE13
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/massDistribution/Ferriere.cpp.gcov.html b/doc/coverageReport/src/massDistribution/Ferriere.cpp.gcov.html deleted file mode 100644 index b32294595..000000000 --- a/doc/coverageReport/src/massDistribution/Ferriere.cpp.gcov.html +++ /dev/null @@ -1,349 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/massDistribution/Ferriere.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/massDistribution - Ferriere.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13615190.1 %
Date:2024-04-08 14:58:22Functions:131492.9 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/massDistribution/Ferriere.h"
-       2             : #include "crpropa/Common.h"
-       3             : 
-       4             : #include "kiss/logger.h"
-       5             : 
-       6             : #include <sstream>
-       7             : 
-       8             : namespace crpropa {
-       9             : 
-      10          13 : Vector3d Ferriere::CMZTransformation(const Vector3d &position) const {
-      11             :         // set galactocentric coordinate system with the Sun at (-8.5,0.,0.) instead of (8.5, 0, 0) to be consistand with JF12 implementation
-      12          13 :         double x = -position.x;
-      13          13 :         double y = -position.y;
-      14             : 
-      15             :         double xC = -50*pc;             //offset
-      16             :         double yC = 50*pc;
-      17             :         double sinTc = sin(70.*deg);
-      18             :         double cosTc = cos(70.*deg);
-      19             : 
-      20             :         Vector3d pos;
-      21          13 :         pos.x = (x - xC)*cosTc + (y - yC)*sinTc;
-      22          13 :         pos.y = -(x - xC)*sinTc + (y - yC)*cosTc;
-      23          13 :         pos.z = position.z;
-      24             : 
-      25          13 :         return pos;
-      26             : }
-      27             : 
-      28          13 : Vector3d Ferriere::DiskTransformation(const Vector3d &position) const {
-      29             :         // set galactocentric coordinate system with the Sun at (-8.5,0.,0.) instead of (8.5, 0, 0) to be consistand with JF12 implementation
-      30          13 :         double x = -position.x;
-      31          13 :         double y = - position.y;
-      32          13 :         double z = position.z;
-      33             : 
-      34             :         double alphaD = 13.5*deg;  // rotation arround x-axis
-      35             :         double sinAd = sin(alphaD);
-      36             :         double cosAd = cos(alphaD);
-      37             :         double betaD = 20.*deg;  // rotation arround y'-axis
-      38             :         double sinBd = sin(betaD);
-      39             :         double cosBd = cos(betaD);
-      40             :         double TettaD = 48.5*deg;  // rotation arround x"-axis
-      41             :         double sinTd = sin(TettaD);
-      42             :         double cosTd = cos(TettaD);
-      43             : 
-      44             :         Vector3d pos;
-      45             : 
-      46          13 :         pos.x = x*cosBd*cosTd - y*(sinAd*sinBd*cosTd -cosAd*sinTd)-z*(cosAd*sinBd*cosTd +sinAd*sinTd);
-      47             : 
-      48          13 :         pos.y =  -x*cosBd*sinTd;
-      49          13 :         pos.y += y*(sinAd*sinBd*sinTd +cosAd*cosTd);
-      50          13 :         pos.y += z*(cosAd*sinBd*sinTd -sinAd*cosTd);
-      51             : 
-      52          13 :         pos.z = x*sinBd;
-      53          13 :         pos.z += y*sinAd*cosBd;
-      54          13 :         pos.z += z*cosAd*cosBd;
-      55             : 
-      56          13 :         return pos;
-      57             : }
-      58             : 
-      59          12 : double Ferriere::getHIDensity(const Vector3d &position) const {
-      60             :         double n = 0;
-      61          12 :         double R = sqrt(position.x*position.x+position.y*position.y);
-      62             : 
-      63          12 :         if(R<3*kpc)
-      64             :         {
-      65             :                 // density at center
-      66           6 :                 Vector3d pos = CMZTransformation(position);  // coordinate trafo
-      67           6 :                 double x = pos.x/pc;  // all units in pc
-      68           6 :                 double y = pos.y/pc;
-      69           6 :                 double z = pos.z/pc;
-      70             : 
-      71           6 :                 double A = sqrt(x*x+2.5*2.5*y*y);
-      72           6 :                 double nCMZ = 8.8/ccm*exp(-pow_integer<4>((A-125.)/137))*exp(-pow_integer<2>(z/54.));
-      73             : 
-      74             :                 // density in disk
-      75           6 :                 pos = DiskTransformation(position);  // Corrdinate Trafo
-      76           6 :                 x = pos.x/pc;  // all units in pc
-      77           6 :                 y = pos.y/pc;
-      78           6 :                 z = pos.z/pc;
-      79             : 
-      80           6 :                 A = sqrt(x*x+3.1*3.1*y*y);
-      81           6 :                 double nDisk = 0.34/ccm*exp(-pow_integer<4>((A-1200.)/438.))*exp(-pow_integer<2>(z/120));
-      82             : 
-      83           6 :                 n = nCMZ + nDisk;
-      84             :         }
-      85             :         else{  // outer region
-      86           6 :                 double z = position.z/pc;
-      87             :                 double a;
-      88           6 :                 if(R<=Rsun){
-      89             :                         a = 1;
-      90             :                 } else {
-      91           3 :                         a = R/Rsun;
-      92             :                 }
-      93             : 
-      94           6 :                 double nCold = 0.859*exp(-pow_integer<2>(z/(127*a))); // cold HI
-      95           6 :                 nCold += 0.047*exp(-pow_integer<2>(z/(318*a)));
-      96           6 :                 nCold += 0.094*exp(-fabs(z)/(403*a));
-      97           6 :                 nCold *= 0.340/ccm/(a*a);
-      98             : 
-      99           6 :                 double nWarm = (1.745 - 1.289/a)*exp(-pow_integer<2>(z/(127*a)));  // warm HI
-     100           6 :                 nWarm += (0.473 - 0.070/a)*exp(-pow_integer<2>(z/(318*a)));
-     101           6 :                 nWarm += (0.283 - 0.142/a)*exp(-fabs(z)/(403*a));
-     102           6 :                 nWarm *= 0.226/ccm/a;
-     103             : 
-     104           6 :                 n = nWarm + nCold;
-     105             :         }
-     106             : 
-     107          12 :         return n;
-     108             : }
-     109             : 
-     110          12 : double Ferriere::getHIIDensity(const Vector3d &position) const {
-     111             :         double n = 0;
-     112          12 :         double R = sqrt(position.x*position.x+position.y*position.y);
-     113             : 
-     114          12 :         if(R< 3*kpc){   // inner
-     115           6 :                 double x = position.x/pc;
-     116           6 :                 double y = position.y/pc;
-     117           6 :                 double z = position.z/pc;
-     118             : 
-     119             :                 // warm interstellar matter
-     120           6 :                 double H = (x*x + pow_integer<2>(y+10.))/(145*145);
-     121           6 :                 double nWIM = exp(-H)* exp(-pow_integer<2>(z+20.)/(26*26));
-     122           6 :                 nWIM += 0.009*exp(-pow_integer<2>((R/pc-3700)/(0.5*3700)))*1/pow_integer<2>(cosh(z/140.));
-     123           6 :                 nWIM += 0.005*cos(M_PI*R/pc*0.5/17000)*1/pow_integer<2>(cosh(z/950.));
-     124           6 :                 nWIM *= 8.0/ccm;  // rescaling with density at center
-     125             : 
-     126             :                 //very hot interstellar matter
-     127             :                 double alphaVH = 21.*deg;  // angle for very hot IM in radiant
-     128             :                 double cosA = cos(alphaVH);
-     129             :                 double sinA = sin(alphaVH);
-     130           6 :                 double etta = y*cosA+z*sinA;  // coordinate transformation for VHIM along major axis
-     131           6 :                 double chi = -y*sinA+z*cosA;
-     132             : 
-     133           6 :                 double nVHIM = 0.29/ccm*exp(-((x*x+etta*etta)/(162.*162.)+chi*chi/(90*90)));
-     134             : 
-     135           6 :                 n = nWIM + nVHIM;
-     136             :         } else {  // outer region
-     137           6 :                 double z = position.z;
-     138             : 
-     139           6 :                 double nWarm = 0.0237/ccm*exp(-(R*R-Rsun*Rsun)/pow_integer<2>(37*kpc))*exp(-fabs(z)/(1*kpc));
-     140           6 :                 nWarm += 0.0013/ccm*exp(-(pow_integer<2>(R-4*kpc)-pow_integer<2>(Rsun-4*kpc))/pow_integer<2>(2*kpc))*exp(-fabs(z)/(150*pc));
-     141             : 
-     142           6 :                 double nHot = 0.12*exp(-(R-Rsun)/(4.9*kpc));
-     143           6 :                 nHot += 0.88*exp(-(pow_integer<2>(R-4.5*kpc)-pow_integer<2>(Rsun-4.5*kpc))/pow_integer<2>(2.9*kpc));
-     144           6 :                 nHot *= pow(R/Rsun, -1.65);
-     145           6 :                 nHot *= exp(-fabs(z)/((1500*pc)*pow(R/Rsun,1.65)));
-     146           6 :                 nHot *= 4.8e-4/ccm;
-     147             : 
-     148           6 :                 n= nWarm + nHot;
-     149             :         }
-     150          12 :         return n;
-     151             : }
-     152             : 
-     153          12 : double Ferriere::getH2Density(const Vector3d &position) const{
-     154             :         double n=0;
-     155          12 :         double R=sqrt(position.x*position.x+position.y*position.y);
-     156             : 
-     157          12 :         if(R<3*kpc) {
-     158             :                 // density at center
-     159           6 :                 Vector3d pos =CMZTransformation(position);  // coord trafo for CMZ
-     160           6 :                 double x = pos.x/pc;  // all units in pc
-     161           6 :                 double y = pos.y/pc;
-     162           6 :                 double z = pos.z/pc;
-     163             : 
-     164           6 :                 double A = sqrt(x*x+pow(2.5*y,2));  // ellipticity
-     165           6 :                 double nCMZ = exp(-pow((A-125.)/137.,4))*exp(-pow(z/18.,2));
-     166           6 :                 nCMZ *= 150/ccm;  // rescaling
-     167             : 
-     168             :                 // density in disk
-     169           6 :                 pos = DiskTransformation(position);  // coord trafo for disk
-     170           6 :                 x=pos.x/pc;
-     171           6 :                 y=pos.y/pc;
-     172           6 :                 z=pos.z/pc;
-     173             : 
-     174           6 :                 A = sqrt(x*x+pow_integer<2>(3.1*y));
-     175           6 :                 double nDISK = exp(-pow_integer<4>((A-1200)/438))*exp(-pow_integer<2>(z/42));
-     176           6 :                 nDISK *= 4.8/ccm;  // rescaling
-     177             : 
-     178           6 :                 n = nCMZ + nDISK;
-     179             :         } else {  // outer region
-     180           6 :                 double z = position.z/pc;
-     181           6 :                 n = pow(R/Rsun, -0.58);
-     182           6 :                 n *= exp(-(pow_integer<2>(R-4.5*kpc)-pow_integer<2>(Rsun-4.5*kpc))/pow_integer<2>(2.9*kpc));
-     183           6 :                 n *= exp(-pow_integer<2>(z/(81*pow(R/Rsun,0.58))));
-     184           6 :                 n *= 0.58/ccm;  // rescaling
-     185             :         }
-     186             : 
-     187          12 :         return n;
-     188             : }
-     189             : 
-     190           5 : double Ferriere::getDensity(const Vector3d &position) const{
-     191             :         double n=0;
-     192           5 :         if(isforHI){
-     193           4 :                 n += getHIDensity(position);
-     194             :         }
-     195           5 :         if(isforHII){
-     196           4 :                 n+=getHIIDensity(position);
-     197             :         }
-     198           5 :         if(isforH2){
-     199           4 :                 n+=getH2Density(position);
-     200             :         }
-     201             :         // check if all densities are deactivated and raise warning if so
-     202           5 :         if((isforHI || isforHII || isforH2) == false){
-     203           2 :                 KISS_LOG_WARNING
-     204           1 :                         << "\nCalled getDensity on fully deactivated Ferriere \n"
-     205           1 :                         << "gas density model. The total density is set to 0.";
-     206             :         }
-     207             : 
-     208           5 :         return n;
-     209             : }
-     210             : 
-     211           5 : double Ferriere::getNucleonDensity(const Vector3d &position) const{
-     212             :         double n=0;
-     213           5 :         if(isforHI){
-     214           4 :                 n += getHIDensity(position);
-     215             :         }
-     216           5 :         if(isforHII){
-     217           4 :                 n+=getHIIDensity(position);
-     218             :         }
-     219           5 :         if(isforH2){
-     220           4 :                 n+= 2*getH2Density(position);
-     221             :         }
-     222             : 
-     223             :         // check if all densities are deactivated and raise warning if so
-     224           5 :         if((isforHI || isforHII || isforH2) == false){
-     225           2 :                 KISS_LOG_WARNING
-     226           1 :                         << "\nCalled getNucleonDensity on fully deactivated Ferriere \n"
-     227           1 :                         << "gas density model. The total density is set to 0.";
-     228             :         }
-     229             : 
-     230           5 :         return n;
-     231             : }
-     232             : 
-     233           1 : void Ferriere::setIsForHI(bool HI){
-     234           1 :         isforHI = HI;
-     235           1 : }
-     236             : 
-     237           1 : void Ferriere::setIsForHII(bool HII){
-     238           1 :         isforHII = HII;
-     239           1 : }
-     240             : 
-     241           1 : void Ferriere::setIsForH2(bool H2){
-     242           1 :         isforH2 = H2;
-     243           1 : }
-     244             : 
-     245           4 : bool Ferriere::getIsForHI(){
-     246           4 :         return isforHI;
-     247             : }
-     248             : 
-     249           4 : bool Ferriere::getIsForHII(){
-     250           4 :         return isforHII;
-     251             : }
-     252             : 
-     253           4 : bool Ferriere::getIsForH2(){
-     254           4 :         return isforH2;
-     255             : }
-     256             : 
-     257           0 : std::string Ferriere::getDescription() {
-     258           0 :         std::stringstream s;
-     259           0 :         s << "Density model Ferriere 2007:\n";
-     260           0 :         s<< "HI component is ";
-     261           0 :         if(!isforHI)
-     262           0 :                 s<< "not ";
-     263           0 :         s<< "active.\nHII component is ";
-     264           0 :         if(!isforHII)
-     265           0 :                 s<< "not ";
-     266           0 :         s<<"active.\nH2 component is ";
-     267           0 :         if(!isforH2)
-     268           0 :                 s<<"not ";
-     269           0 :         s<<"active.";
-     270           0 :         return s.str();
-     271           0 : }
-     272             : 
-     273             : }  // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/massDistribution/Massdistribution.cpp.func-sort-c.html b/doc/coverageReport/src/massDistribution/Massdistribution.cpp.func-sort-c.html deleted file mode 100644 index bf02e8f4f..000000000 --- a/doc/coverageReport/src/massDistribution/Massdistribution.cpp.func-sort-c.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/massDistribution/Massdistribution.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/massDistribution - Massdistribution.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:658576.5 %
Date:2024-04-08 14:58:22Functions:192286.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11DensityGrid14getDescriptionB5cxx11Ev0
_ZN7crpropa11DensityGrid7setGridENS_7ref_ptrINS_4GridIfEEEE0
_ZN7crpropa11DensityList14getDescriptionB5cxx11Ev0
_ZN7crpropa11DensityGrid10setIsForH2Eb1
_ZN7crpropa11DensityGrid10setIsForHIEb1
_ZN7crpropa11DensityGrid11setIsForHIIEb1
_ZNK7crpropa11DensityGrid10getDensityERKNS_7Vector3IdEE1
_ZNK7crpropa11DensityGrid17getNucleonDensityERKNS_7Vector3IdEE1
_ZNK7crpropa11DensityList10getDensityERKNS_7Vector3IdEE1
_ZNK7crpropa11DensityList12getH2DensityERKNS_7Vector3IdEE1
_ZNK7crpropa11DensityList12getHIDensityERKNS_7Vector3IdEE1
_ZNK7crpropa11DensityList13getHIIDensityERKNS_7Vector3IdEE1
_ZNK7crpropa11DensityList17getNucleonDensityERKNS_7Vector3IdEE1
_ZN7crpropa11DensityGrid10getIsForH2Ev2
_ZN7crpropa11DensityGrid10getIsForHIEv2
_ZN7crpropa11DensityGrid11getIsForHIIEv2
_ZN7crpropa11DensityGridC2ENS_7ref_ptrINS_4GridIfEEEEbbb2
_ZN7crpropa11DensityList10addDensityENS_7ref_ptrINS_7DensityEEE2
_ZNK7crpropa11DensityGrid12getH2DensityERKNS_7Vector3IdEE3
_ZNK7crpropa11DensityGrid12getHIDensityERKNS_7Vector3IdEE3
_ZNK7crpropa11DensityGrid13getHIIDensityERKNS_7Vector3IdEE3
_ZN7crpropa11DensityGrid12checkAndWarnEv5
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/massDistribution/Massdistribution.cpp.func.html b/doc/coverageReport/src/massDistribution/Massdistribution.cpp.func.html deleted file mode 100644 index 350b48552..000000000 --- a/doc/coverageReport/src/massDistribution/Massdistribution.cpp.func.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/massDistribution/Massdistribution.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/massDistribution - Massdistribution.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:658576.5 %
Date:2024-04-08 14:58:22Functions:192286.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11DensityGrid10getIsForH2Ev2
_ZN7crpropa11DensityGrid10getIsForHIEv2
_ZN7crpropa11DensityGrid10setIsForH2Eb1
_ZN7crpropa11DensityGrid10setIsForHIEb1
_ZN7crpropa11DensityGrid11getIsForHIIEv2
_ZN7crpropa11DensityGrid11setIsForHIIEb1
_ZN7crpropa11DensityGrid12checkAndWarnEv5
_ZN7crpropa11DensityGrid14getDescriptionB5cxx11Ev0
_ZN7crpropa11DensityGrid7setGridENS_7ref_ptrINS_4GridIfEEEE0
_ZN7crpropa11DensityGridC2ENS_7ref_ptrINS_4GridIfEEEEbbb2
_ZN7crpropa11DensityList10addDensityENS_7ref_ptrINS_7DensityEEE2
_ZN7crpropa11DensityList14getDescriptionB5cxx11Ev0
_ZNK7crpropa11DensityGrid10getDensityERKNS_7Vector3IdEE1
_ZNK7crpropa11DensityGrid12getH2DensityERKNS_7Vector3IdEE3
_ZNK7crpropa11DensityGrid12getHIDensityERKNS_7Vector3IdEE3
_ZNK7crpropa11DensityGrid13getHIIDensityERKNS_7Vector3IdEE3
_ZNK7crpropa11DensityGrid17getNucleonDensityERKNS_7Vector3IdEE1
_ZNK7crpropa11DensityList10getDensityERKNS_7Vector3IdEE1
_ZNK7crpropa11DensityList12getH2DensityERKNS_7Vector3IdEE1
_ZNK7crpropa11DensityList12getHIDensityERKNS_7Vector3IdEE1
_ZNK7crpropa11DensityList13getHIIDensityERKNS_7Vector3IdEE1
_ZNK7crpropa11DensityList17getNucleonDensityERKNS_7Vector3IdEE1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/massDistribution/Massdistribution.cpp.gcov.html b/doc/coverageReport/src/massDistribution/Massdistribution.cpp.gcov.html deleted file mode 100644 index 8d925d1a5..000000000 --- a/doc/coverageReport/src/massDistribution/Massdistribution.cpp.gcov.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/massDistribution/Massdistribution.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/massDistribution - Massdistribution.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:658576.5 %
Date:2024-04-08 14:58:22Functions:192286.4 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/massDistribution/Massdistribution.h"
-       2             : #include <sstream>
-       3             : namespace crpropa {
-       4             : 
-       5           2 : void DensityList::addDensity(ref_ptr<Density> dens) {
-       6           2 :         DensityList.push_back(dens);
-       7           2 : }
-       8             : 
-       9           1 : double DensityList::getDensity(const Vector3d &position) const {
-      10             :         double n = 0.;
-      11           3 :         for (int i = 0; i < DensityList.size(); i++)
-      12           2 :                 n += DensityList[i]->getDensity(position);
-      13           1 :         return n;
-      14             : }
-      15             : 
-      16           1 : double DensityList::getHIDensity(const Vector3d &position) const {
-      17             :         double n = 0.;
-      18           3 :         for (int i = 0; i < DensityList.size(); i++)
-      19           2 :                 n += DensityList[i]->getHIDensity(position);
-      20           1 :         return n;
-      21             : }
-      22             : 
-      23           1 : double DensityList::getHIIDensity(const Vector3d &position) const {
-      24             :         double n = 0.;
-      25           3 :         for (int i = 0; i < DensityList.size(); i++)
-      26           2 :                 n += DensityList[i]->getHIIDensity(position);
-      27           1 :         return n;
-      28             : }
-      29             : 
-      30           1 : double DensityList::getH2Density(const Vector3d &position) const {
-      31             :         double n = 0.;
-      32           3 :         for (int i = 0; i < DensityList.size(); i++)
-      33           2 :                 n += DensityList[i]->getH2Density(position);
-      34           1 :         return n;
-      35             : }
-      36             : 
-      37           1 : double DensityList::getNucleonDensity(const Vector3d &position) const {
-      38             :         double n = 0.;
-      39           3 :         for (int i = 0; i < DensityList.size(); i++)
-      40           2 :                 n += DensityList[i]->getNucleonDensity(position);
-      41           1 :         return n;
-      42             : }
-      43             : 
-      44           0 : std::string DensityList::getDescription() {
-      45           0 :         std::stringstream ss; 
-      46           0 :         ss << "DensityList with " << DensityList.size() << " modules: \n";
-      47           0 :         for (int i = 0; i < DensityList.size(); i++) {
-      48           0 :                 ss << "density " << i + 1 << ": " << DensityList[i] -> getDescription();
-      49             :         }
-      50             :         
-      51           0 :         return ss.str();
-      52           0 : }
-      53             : 
-      54             : // ----------- DensityGrid -----------------------------------------------------------------
-      55             : 
-      56           2 : DensityGrid::DensityGrid(ref_ptr<Grid1f> grid, bool isForHI, bool isForHII, bool isForH2) : 
-      57           2 :         grid(grid), isForHI(isForHI), isForHII(isForHII), isForH2(isForH2) {
-      58           2 :                 checkAndWarn();
-      59           2 :         }
-      60             : 
-      61           5 : void DensityGrid::checkAndWarn() {
-      62           5 :         bool allDeactivated = (isForHI == false) && (isForHII == false) && (isForH2 == false);
-      63             :         if (allDeactivated) {
-      64           0 :                 KISS_LOG_WARNING << "DensityGrid has all types deactivated."
-      65           0 :                         << "In this case all output will be n = 0. \n"
-      66           0 :                         << "Please activate the intended particle type. \n";
-      67             :         }
-      68           5 : }
-      69             : 
-      70           3 : double DensityGrid::getHIDensity(const Vector3d &position) const {
-      71           3 :         if (isForHI)
-      72           3 :                 return grid -> interpolate(position);
-      73             :         else 
-      74             :                 return 0.;
-      75             : }
-      76             : 
-      77           3 : double DensityGrid::getHIIDensity(const Vector3d &position) const {
-      78           3 :         if (isForHII) 
-      79           0 :                 return grid -> interpolate(position);
-      80             :         else
-      81             :                 return 0.;
-      82             : }
-      83             : 
-      84           3 : double DensityGrid::getH2Density(const Vector3d &position) const {
-      85           3 :         if (isForH2)
-      86           0 :                 return grid -> interpolate(position);
-      87             :         else
-      88             :                 return 0.;
-      89             : }
-      90             : 
-      91           1 : double DensityGrid::getDensity(const Vector3d &position) const {
-      92             :         double n = 0;
-      93           1 :         n += getHIDensity(position);
-      94           1 :         n += getHIIDensity(position);
-      95           1 :         n += getH2Density(position);
-      96             : 
-      97           1 :         return n;
-      98             : }
-      99             : 
-     100           1 : double DensityGrid::getNucleonDensity(const Vector3d &position) const {
-     101             :         double n = 0;
-     102           1 :         n += getHIDensity(position);
-     103           1 :         n += getHIIDensity(position);
-     104           1 :         n += 2 * getH2Density(position);
-     105             : 
-     106           1 :         return n;
-     107             : }
-     108             : 
-     109           2 : bool DensityGrid::getIsForHI() {
-     110           2 :         return isForHI;
-     111             : }
-     112             : 
-     113           2 : bool DensityGrid::getIsForHII() {
-     114           2 :         return isForHII;
-     115             : }
-     116             : 
-     117           2 : bool DensityGrid::getIsForH2() {
-     118           2 :         return isForH2;
-     119             : }
-     120             : 
-     121           1 : void DensityGrid::setIsForHI(bool b) {
-     122           1 :         isForHI = b;
-     123           1 :         checkAndWarn();
-     124           1 : }
-     125             : 
-     126           1 : void DensityGrid::setIsForHII(bool b) {
-     127           1 :         isForHII = b;
-     128           1 :         checkAndWarn();
-     129           1 : }
-     130             : 
-     131           1 : void DensityGrid::setIsForH2(bool b) {
-     132           1 :         isForH2 = b;
-     133           1 :         checkAndWarn();
-     134           1 : }
-     135             : 
-     136           0 : void DensityGrid::setGrid(ref_ptr<Grid1f> grid) {
-     137           0 :         this->grid = grid;
-     138           0 : }
-     139             : 
-     140           0 : std::string DensityGrid::getDescription() {
-     141           0 :         std::stringstream ss;
-     142           0 :         ss << "Density in a given grid \n"; 
-     143           0 :         return ss.str();
-     144           0 : }
-     145             : 
-     146             : } //namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/massDistribution/Nakanishi.cpp.func-sort-c.html b/doc/coverageReport/src/massDistribution/Nakanishi.cpp.func-sort-c.html deleted file mode 100644 index 6cf5bc02a..000000000 --- a/doc/coverageReport/src/massDistribution/Nakanishi.cpp.func-sort-c.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/massDistribution/Nakanishi.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/massDistribution - Nakanishi.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:587082.9 %
Date:2024-04-08 14:58:22Functions:131492.9 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa9Nakanishi14getDescriptionB5cxx11Ev0
_ZN7crpropa9Nakanishi10setIsForH2Eb1
_ZN7crpropa9Nakanishi10setIsForHIEb1
_ZN7crpropa9Nakanishi11getIsForHIIEv1
_ZN7crpropa9Nakanishi10getIsForH2Ev3
_ZN7crpropa9Nakanishi10getIsForHIEv3
_ZNK7crpropa9Nakanishi10getDensityERKNS_7Vector3IdEE3
_ZNK7crpropa9Nakanishi17getNucleonDensityERKNS_7Vector3IdEE3
_ZNK7crpropa9Nakanishi12getH2DensityERKNS_7Vector3IdEE6
_ZNK7crpropa9Nakanishi12getHIDensityERKNS_7Vector3IdEE6
_ZNK7crpropa9Nakanishi16getH2ScaleheightERKNS_7Vector3IdEE8
_ZNK7crpropa9Nakanishi16getHIScaleheightERKNS_7Vector3IdEE8
_ZNK7crpropa9Nakanishi17getH2PlanedensityERKNS_7Vector3IdEE8
_ZNK7crpropa9Nakanishi17getHIPlanedensityERKNS_7Vector3IdEE8
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/massDistribution/Nakanishi.cpp.func.html b/doc/coverageReport/src/massDistribution/Nakanishi.cpp.func.html deleted file mode 100644 index 13484a861..000000000 --- a/doc/coverageReport/src/massDistribution/Nakanishi.cpp.func.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/massDistribution/Nakanishi.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/massDistribution - Nakanishi.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:587082.9 %
Date:2024-04-08 14:58:22Functions:131492.9 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa9Nakanishi10getIsForH2Ev3
_ZN7crpropa9Nakanishi10getIsForHIEv3
_ZN7crpropa9Nakanishi10setIsForH2Eb1
_ZN7crpropa9Nakanishi10setIsForHIEb1
_ZN7crpropa9Nakanishi11getIsForHIIEv1
_ZN7crpropa9Nakanishi14getDescriptionB5cxx11Ev0
_ZNK7crpropa9Nakanishi10getDensityERKNS_7Vector3IdEE3
_ZNK7crpropa9Nakanishi12getH2DensityERKNS_7Vector3IdEE6
_ZNK7crpropa9Nakanishi12getHIDensityERKNS_7Vector3IdEE6
_ZNK7crpropa9Nakanishi16getH2ScaleheightERKNS_7Vector3IdEE8
_ZNK7crpropa9Nakanishi16getHIScaleheightERKNS_7Vector3IdEE8
_ZNK7crpropa9Nakanishi17getH2PlanedensityERKNS_7Vector3IdEE8
_ZNK7crpropa9Nakanishi17getHIPlanedensityERKNS_7Vector3IdEE8
_ZNK7crpropa9Nakanishi17getNucleonDensityERKNS_7Vector3IdEE3
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/massDistribution/Nakanishi.cpp.gcov.html b/doc/coverageReport/src/massDistribution/Nakanishi.cpp.gcov.html deleted file mode 100644 index 79649cf3d..000000000 --- a/doc/coverageReport/src/massDistribution/Nakanishi.cpp.gcov.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/massDistribution/Nakanishi.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/massDistribution - Nakanishi.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:587082.9 %
Date:2024-04-08 14:58:22Functions:131492.9 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/massDistribution/Nakanishi.h"
-       2             : #include "crpropa/Common.h"
-       3             : 
-       4             : #include "kiss/logger.h"
-       5             : 
-       6             : #include <sstream>
-       7             : 
-       8             : namespace crpropa {
-       9             : 
-      10           8 : double Nakanishi::getHIScaleheight(const Vector3d &position) const {
-      11           8 :         double R = sqrt(pow_integer<2>(position.x)+pow_integer<2>(position.y));      // radius in galactic plane
-      12           8 :         double scaleheight = 1.06*pc*(116.3 +19.3*R/kpc+4.1*pow_integer<2>(R/kpc)-0.05*pow_integer<3>(R/kpc));
-      13           8 :         return scaleheight;
-      14             :         }
-      15             : 
-      16           8 : double Nakanishi::getHIPlanedensity(const Vector3d &position) const {
-      17           8 :         double R = sqrt(pow_integer<2>(position.x)+pow_integer<2>(position.y));      // radius in galactic plane
-      18           8 :         double planedensity = 0.94/ccm*(0.6*exp(-R/(2.4*kpc))+0.24*exp(-pow_integer<2>((R-9.5*kpc)/(4.8*kpc))));
-      19           8 :         return planedensity;
-      20             :         }
-      21             : 
-      22             : 
-      23           8 : double Nakanishi::getH2Scaleheight(const Vector3d &position) const {
-      24           8 :         double R = sqrt(pow_integer<2>(position.x)+ pow_integer<2>(position.y));  // radius in galactic plane
-      25           8 :         double scaleheight = 1.06*pc*( 10.8*exp(0.28*R/kpc)+42.78);
-      26           8 :         return scaleheight;
-      27             : }
-      28             : 
-      29           8 : double Nakanishi::getH2Planedensity(const Vector3d &position) const {
-      30           8 :         double R = sqrt(pow_integer<2>(position.x)+pow_integer<2>(position.y));  // radius in galactic plane
-      31           8 :         double planedensity =0.94/ccm*(11.2*exp(-R*R/(0.874*kpc*kpc)) +0.83*exp(-pow_integer<2>((R-4*kpc)/(3.2*kpc))));
-      32           8 :         return planedensity;
-      33             : }
-      34             : 
-      35           6 : double Nakanishi::getHIDensity(const Vector3d &position) const {
-      36             :         double n = 0;  // density
-      37           6 :         double planedensity = getHIPlanedensity(position);
-      38           6 :         double scaleheight = getHIScaleheight(position);
-      39           6 :         n = planedensity*pow(0.5,pow_integer<2>(position.z/scaleheight));
-      40             : 
-      41           6 :         return n;
-      42             : }
-      43             : 
-      44           6 : double Nakanishi::getH2Density(const Vector3d &position) const {
-      45             :         double n = 0;  // density
-      46           6 :         double planedensity = getH2Planedensity(position);
-      47           6 :         double scaleheight = getH2Scaleheight(position);
-      48           6 :         n = planedensity*pow(0.5,pow_integer<2>(position.z/scaleheight));
-      49             : 
-      50           6 :         return n;
-      51             : }
-      52             : 
-      53           3 : double Nakanishi::getDensity(const Vector3d &position) const {
-      54             :         double n = 0;
-      55           3 :         if(isforHI)
-      56           2 :                 n += getHIDensity(position);
-      57           3 :         if(isforH2)
-      58           2 :                 n += getH2Density(position);
-      59             :         
-      60             :         // check if all densities are deactivated and raise warning if so
-      61           3 :         if((isforHI || isforH2) == false){
-      62           2 :                 KISS_LOG_WARNING
-      63           1 :                         << "\n"<<"Called getDensity on fully deactivated Nakanishi \n"
-      64           1 :                         << "gas density model. The total density is set to 0.";
-      65             :         }
-      66           3 :         return n;
-      67             : }
-      68             : 
-      69           3 : double Nakanishi::getNucleonDensity(const Vector3d &position) const {
-      70             :         double n = 0;
-      71           3 :         if(isforHI)
-      72           2 :                 n += getHIDensity(position);
-      73           3 :         if(isforH2)
-      74           2 :                 n += 2*getH2Density(position);  // weight 2 for molecular hydrogen
-      75             : 
-      76             :         // check if all densities are deactivated and raise warning if so
-      77           3 :         if((isforHI || isforH2) == false){
-      78           2 :                 KISS_LOG_WARNING
-      79           1 :                         << "\n"<<"Called getNucleonDensity on fully deactivated Nakanishi \n"
-      80           1 :                         << "gas density model. The total density is set to 0.";
-      81             :         }
-      82             : 
-      83           3 :         return n;
-      84             : }
-      85             : 
-      86           3 : bool Nakanishi::getIsForHI() {
-      87           3 :         return isforHI;
-      88             : }
-      89             : 
-      90           1 : bool Nakanishi::getIsForHII() {
-      91           1 :         return isforHII;
-      92             : }
-      93           3 : bool Nakanishi::getIsForH2() {
-      94           3 :         return isforH2;
-      95             : }
-      96             : 
-      97           1 : void Nakanishi::setIsForHI(bool HI) {
-      98           1 :         isforHI = HI;
-      99           1 : }
-     100             : 
-     101           1 : void Nakanishi::setIsForH2(bool H2) {
-     102           1 :         isforH2 = H2;
-     103           1 : }
-     104             : 
-     105           0 : std::string Nakanishi::getDescription() {
-     106           0 :         std::stringstream s;
-     107           0 :         s << "Density model Nakanishi:\n";
-     108           0 :         s<< "HI component is ";
-     109           0 :         if(isforHI==false)
-     110           0 :                 s<< "not ";
-     111           0 :         s<< "active.\nH2 component is ";
-     112           0 :         if(isforH2==false)
-     113           0 :                 s<<"not ";
-     114           0 :         s<<"active.\nNakanishi has no HII component.";
-     115             : 
-     116           0 :         return s.str();
-     117           0 : }
-     118             : 
-     119             : }  // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/massDistribution/index-sort-f.html b/doc/coverageReport/src/massDistribution/index-sort-f.html deleted file mode 100644 index 8608e5fe2..000000000 --- a/doc/coverageReport/src/massDistribution/index-sort-f.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/massDistribution - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/massDistributionHitTotalCoverage
Test:coverage.info.cleanedLines:34941683.9 %
Date:2024-04-08 14:58:22Functions:697690.8 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Cordes.cpp -
76.2%76.2%
-
76.2 %16 / 2185.7 %6 / 7
Massdistribution.cpp -
76.5%76.5%
-
76.5 %65 / 8586.4 %19 / 22
Ferriere.cpp -
90.1%90.1%
-
90.1 %136 / 15192.9 %13 / 14
Nakanishi.cpp -
82.9%82.9%
-
82.9 %58 / 7092.9 %13 / 14
ConstantDensity.cpp -
83.1%83.1%
-
83.1 %74 / 8994.7 %18 / 19
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/massDistribution/index-sort-l.html b/doc/coverageReport/src/massDistribution/index-sort-l.html deleted file mode 100644 index 9ce5836f7..000000000 --- a/doc/coverageReport/src/massDistribution/index-sort-l.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/massDistribution - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/massDistributionHitTotalCoverage
Test:coverage.info.cleanedLines:34941683.9 %
Date:2024-04-08 14:58:22Functions:697690.8 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Cordes.cpp -
76.2%76.2%
-
76.2 %16 / 2185.7 %6 / 7
Massdistribution.cpp -
76.5%76.5%
-
76.5 %65 / 8586.4 %19 / 22
Nakanishi.cpp -
82.9%82.9%
-
82.9 %58 / 7092.9 %13 / 14
ConstantDensity.cpp -
83.1%83.1%
-
83.1 %74 / 8994.7 %18 / 19
Ferriere.cpp -
90.1%90.1%
-
90.1 %136 / 15192.9 %13 / 14
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/massDistribution/index.html b/doc/coverageReport/src/massDistribution/index.html deleted file mode 100644 index dbbcaaf42..000000000 --- a/doc/coverageReport/src/massDistribution/index.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/massDistribution - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/massDistributionHitTotalCoverage
Test:coverage.info.cleanedLines:34941683.9 %
Date:2024-04-08 14:58:22Functions:697690.8 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
ConstantDensity.cpp -
83.1%83.1%
-
83.1 %74 / 8994.7 %18 / 19
Cordes.cpp -
76.2%76.2%
-
76.2 %16 / 2185.7 %6 / 7
Ferriere.cpp -
90.1%90.1%
-
90.1 %136 / 15192.9 %13 / 14
Massdistribution.cpp -
76.5%76.5%
-
76.5 %65 / 8586.4 %19 / 22
Nakanishi.cpp -
82.9%82.9%
-
82.9 %58 / 7092.9 %13 / 14
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/Acceleration.cpp.func-sort-c.html b/doc/coverageReport/src/module/Acceleration.cpp.func-sort-c.html deleted file mode 100644 index dcbc5453c..000000000 --- a/doc/coverageReport/src/module/Acceleration.cpp.func-sort-c.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/Acceleration.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - Acceleration.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0890.0 %
Date:2024-04-08 14:58:22Functions:0140.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16SecondOrderFermiC2Eddj0
_ZN7crpropa17ParticleSplittingC2EPNS_7SurfaceEiidNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa17QuasiLinearTheory6modifyEdPNS_9CandidateE0
_ZN7crpropa17QuasiLinearTheoryC2Eddd0
_ZN7crpropa22DirectedFlowScatteringC2ENS_7Vector3IdEEd0
_ZN7crpropa26AbstractAccelerationModule3addEPNS_18StepLengthModifierE0
_ZN7crpropa26AbstractAccelerationModuleC2Ed0
_ZN7crpropa28DirectedFlowOfScatterCenters6modifyEdPNS_9CandidateE0
_ZN7crpropa28DirectedFlowOfScatterCentersC2ERKNS_7Vector3IdEE0
_ZNK7crpropa16SecondOrderFermi21scatterCenterVelocityEPNS_9CandidateE0
_ZNK7crpropa17ParticleSplitting7processEPNS_9CandidateE0
_ZNK7crpropa22DirectedFlowScattering21scatterCenterVelocityEPNS_9CandidateE0
_ZNK7crpropa26AbstractAccelerationModule7processEPNS_9CandidateE0
_ZNK7crpropa26AbstractAccelerationModule7scatterEPNS_9CandidateERKNS_7Vector3IdEE0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/Acceleration.cpp.func.html b/doc/coverageReport/src/module/Acceleration.cpp.func.html deleted file mode 100644 index d528f5cfc..000000000 --- a/doc/coverageReport/src/module/Acceleration.cpp.func.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/Acceleration.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - Acceleration.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0890.0 %
Date:2024-04-08 14:58:22Functions:0140.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16SecondOrderFermiC2Eddj0
_ZN7crpropa17ParticleSplittingC2EPNS_7SurfaceEiidNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa17QuasiLinearTheory6modifyEdPNS_9CandidateE0
_ZN7crpropa17QuasiLinearTheoryC2Eddd0
_ZN7crpropa22DirectedFlowScatteringC2ENS_7Vector3IdEEd0
_ZN7crpropa26AbstractAccelerationModule3addEPNS_18StepLengthModifierE0
_ZN7crpropa26AbstractAccelerationModuleC2Ed0
_ZN7crpropa28DirectedFlowOfScatterCenters6modifyEdPNS_9CandidateE0
_ZN7crpropa28DirectedFlowOfScatterCentersC2ERKNS_7Vector3IdEE0
_ZNK7crpropa16SecondOrderFermi21scatterCenterVelocityEPNS_9CandidateE0
_ZNK7crpropa17ParticleSplitting7processEPNS_9CandidateE0
_ZNK7crpropa22DirectedFlowScattering21scatterCenterVelocityEPNS_9CandidateE0
_ZNK7crpropa26AbstractAccelerationModule7processEPNS_9CandidateE0
_ZNK7crpropa26AbstractAccelerationModule7scatterEPNS_9CandidateERKNS_7Vector3IdEE0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/Acceleration.cpp.gcov.html b/doc/coverageReport/src/module/Acceleration.cpp.gcov.html deleted file mode 100644 index 11ea17011..000000000 --- a/doc/coverageReport/src/module/Acceleration.cpp.gcov.html +++ /dev/null @@ -1,260 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/Acceleration.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - Acceleration.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0890.0 %
Date:2024-04-08 14:58:22Functions:0140.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/Acceleration.h"
-       2             : #include <crpropa/Common.h>
-       3             : #include <crpropa/Random.h>
-       4             : #include <cmath>
-       5             : 
-       6             : namespace crpropa {
-       7             : 
-       8           0 : AbstractAccelerationModule::AbstractAccelerationModule(double _stepLength)
-       9           0 :         : crpropa::Module(), stepLength(_stepLength) {}
-      10             : 
-      11             : 
-      12           0 : void AbstractAccelerationModule::add(StepLengthModifier *modifier) {
-      13           0 :         modifiers.push_back(modifier);
-      14           0 : }
-      15             : 
-      16             : 
-      17           0 : void AbstractAccelerationModule::scatter(
-      18             :         crpropa::Candidate *candidate,
-      19             :         const crpropa::Vector3d &scatter_center_velocity) const {
-      20             :         // particle momentum in lab frame
-      21           0 :         const double E = candidate->current.getEnergy();
-      22           0 :         const crpropa::Vector3d p = candidate->current.getMomentum();
-      23             : 
-      24             :         // transform to rest frame of scatter center (p: prime)
-      25           0 :         const double beta = scatter_center_velocity.getR() / crpropa::c_light;
-      26           0 :         const double gamma = 1. / sqrt(1 - beta * beta);
-      27           0 :         const double Ep = gamma * (E - scatter_center_velocity.dot(p));
-      28             :         const crpropa::Vector3d pp = (p - scatter_center_velocity* E /
-      29             :                 (crpropa::c_light * crpropa::c_light)) * gamma;
-      30             : 
-      31             :         // scatter into random direction
-      32           0 :         const crpropa::Vector3d pp_new = crpropa::Random::instance().randVector() * pp.getR();
-      33             : 
-      34             :         // transform back
-      35           0 :         const double E_new = gamma * (Ep + scatter_center_velocity.dot(pp_new));
-      36             :         const crpropa::Vector3d p_new = (pp_new + scatter_center_velocity * Ep /
-      37             :                 (crpropa::c_light * crpropa::c_light)) * gamma;
-      38             : 
-      39             :         // update candidate properties
-      40           0 :         candidate->current.setEnergy(E_new);
-      41           0 :         candidate->current.setDirection(p_new / p_new.getR());
-      42           0 : }
-      43             : 
-      44             : 
-      45           0 : void AbstractAccelerationModule::process(crpropa::Candidate *candidate) const {
-      46           0 :         double currentStepLength = stepLength;
-      47           0 :         for (auto m : modifiers) {
-      48           0 :                 currentStepLength = m->modify(currentStepLength, candidate);
-      49             :         }
-      50             : 
-      51           0 :         double step = candidate->getCurrentStep();
-      52           0 :         while (step > 0) {
-      53           0 :                 double randDistance = -1. * log(crpropa::Random::instance().rand()) * currentStepLength;
-      54             : 
-      55           0 :                 if (step < randDistance) {
-      56           0 :                         candidate->limitNextStep(0.1 * currentStepLength);
-      57           0 :                         return;
-      58             :                 }
-      59           0 :                 scatter(candidate, scatterCenterVelocity(candidate));
-      60           0 :                 step -= randDistance;
-      61             :         }
-      62             : }
-      63             : 
-      64             : 
-      65           0 : SecondOrderFermi::SecondOrderFermi(double scatterVelocity, double stepLength,
-      66           0 :                                                                    unsigned int sizeOfPitchangleTable)
-      67             :         : AbstractAccelerationModule(stepLength),
-      68           0 :           scatterVelocity(scatterVelocity) {
-      69           0 :         setDescription("SecondOrderFermi Acceleration");
-      70           0 :         angle.resize(sizeOfPitchangleTable);
-      71           0 :         angleCDF.resize(sizeOfPitchangleTable);
-      72             : 
-      73             :         // have a discretized table of beamed pitch angles
-      74           0 :         for (unsigned int i =0; i < sizeOfPitchangleTable; i++) {
-      75           0 :                 angle[i] = i * M_PI / (sizeOfPitchangleTable-1);
-      76           0 :                 angleCDF[i] = (angle[i] +scatterVelocity / crpropa::c_light * sin(angle[i])) / M_PI;
-      77             :         }
-      78           0 : }
-      79             : 
-      80             : 
-      81           0 : crpropa::Vector3d SecondOrderFermi::scatterCenterVelocity(crpropa::Candidate *candidate) const
-      82             : {
-      83           0 :         size_t idx = crpropa::closestIndex(crpropa::Random::instance().rand(), angleCDF);
-      84           0 :         crpropa::Vector3d rv = crpropa::Random::instance().randVector();
-      85           0 :         crpropa::Vector3d rotationAxis = candidate->current.getDirection().cross(rv);
-      86             : 
-      87           0 :         rv = candidate->current.getDirection().getRotated(rotationAxis, M_PI - angle[idx]);
-      88           0 :         return rv * scatterVelocity;
-      89             : }
-      90             : 
-      91             : 
-      92           0 : DirectedFlowOfScatterCenters::DirectedFlowOfScatterCenters(
-      93           0 :         const Vector3d &scatterCenterVelocity)
-      94           0 :         : __scatterVelocity(scatterCenterVelocity) {}
-      95             : 
-      96             : 
-      97           0 : double DirectedFlowOfScatterCenters::modify(double steplength, Candidate* candidate)
-      98             : {
-      99           0 :         double directionModifier = (-1. * __scatterVelocity.dot(candidate->current.getDirection()) + c_light) / c_light;
-     100           0 :         return steplength / directionModifier;
-     101             : }
-     102             : 
-     103             : 
-     104           0 : DirectedFlowScattering::DirectedFlowScattering(
-     105           0 :         crpropa::Vector3d scatterCenterVelocity, double stepLength)
-     106           0 :         : __scatterVelocity(scatterCenterVelocity),
-     107           0 :           AbstractAccelerationModule(stepLength) {
-     108             : 
-     109             :         // In a directed field of scatter centers, the probability to encounter a
-     110             :         // scatter center depends on the direction of the candidate.
-     111           0 :         StepLengthModifier *mod = new DirectedFlowOfScatterCenters(__scatterVelocity);
-     112           0 :         this->add(mod);
-     113           0 : }
-     114             : 
-     115             : 
-     116           0 : crpropa::Vector3d DirectedFlowScattering::scatterCenterVelocity(
-     117             :         crpropa::Candidate *candidate) const { // does not depend on candidate here.
-     118           0 :         return __scatterVelocity;
-     119             : }
-     120             : 
-     121             : 
-     122           0 : QuasiLinearTheory::QuasiLinearTheory(double referenecEnergy,
-     123             :                                                                          double turbulenceIndex,
-     124           0 :                                                                          double minimumRigidity)
-     125           0 :         : __referenceEnergy(referenecEnergy), __turbulenceIndex(turbulenceIndex),
-     126           0 :           __minimumRigidity(minimumRigidity) {}
-     127             : 
-     128             : 
-     129           0 : double QuasiLinearTheory::modify(double steplength, Candidate* candidate)
-     130             : {
-     131           0 :         if (candidate->current.getRigidity() < __minimumRigidity)
-     132             :         {
-     133           0 :                 return steplength * std::pow(__minimumRigidity /
-     134           0 :                         (__referenceEnergy / eV), 2. - __turbulenceIndex);
-     135             :         }
-     136             :         else
-     137             :         {
-     138           0 :                 return steplength * std::pow(candidate->current.getRigidity() /
-     139           0 :                         (__referenceEnergy / eV), 2. - __turbulenceIndex);
-     140             :         }
-     141             : }
-     142             : 
-     143             : 
-     144           0 : ParticleSplitting::ParticleSplitting(Surface *surface, int      crossingThreshold, 
-     145           0 :         int numberSplits, double minWeight, std::string counterid)
-     146           0 :         : surface(surface), crossingThreshold(crossingThreshold),
-     147           0 :           numberSplits(numberSplits), minWeight(minWeight), counterid(counterid){};
-     148             : 
-     149           0 : void ParticleSplitting::process(Candidate *candidate) const {
-     150             :         const double currentDistance =
-     151           0 :                 surface->distance(candidate->current.getPosition());
-     152             :         const double previousDistance =
-     153           0 :                 surface->distance(candidate->previous.getPosition());
-     154             : 
-     155           0 :         if (currentDistance * previousDistance > 0)
-     156             :                 // candidate remains on the same side
-     157             :                 return;
-     158             : 
-     159           0 :         if (candidate->getWeight() < minWeight)
-     160             :                 return;
-     161             : 
-     162             :         int num_crossings = 1;
-     163           0 :         if (candidate->hasProperty(counterid))
-     164           0 :                 num_crossings = candidate->getProperty(counterid).toInt32() + 1;
-     165           0 :         candidate->setProperty(counterid, num_crossings);
-     166             : 
-     167           0 :         if (num_crossings % crossingThreshold != 0)
-     168             :                 return;
-     169             : 
-     170           0 :         candidate->updateWeight(1. / numberSplits);
-     171             : 
-     172           0 :         for (size_t i = 1; i < numberSplits; i++) {
-     173             :                 // No recursive split as the weights of the secondaries created
-     174             :                 // before the split are not affected
-     175           0 :                 ref_ptr<Candidate> new_candidate = candidate->clone(false);
-     176           0 :                 new_candidate->parent = candidate;
-     177           0 :                 uint64_t snr = Candidate::getNextSerialNumber();
-     178           0 :                 Candidate::setNextSerialNumber(snr + 1);
-     179           0 :                 new_candidate->setSerialNumber(snr);
-     180             :                 candidate->addSecondary(new_candidate);
-     181             :         }
-     182             : };
-     183             : 
-     184             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/AdiabaticCooling.cpp.func-sort-c.html b/doc/coverageReport/src/module/AdiabaticCooling.cpp.func-sort-c.html deleted file mode 100644 index d39555576..000000000 --- a/doc/coverageReport/src/module/AdiabaticCooling.cpp.func-sort-c.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/AdiabaticCooling.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - AdiabaticCooling.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:232785.2 %
Date:2024-04-08 14:58:22Functions:55100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16AdiabaticCoolingC2ENS_7ref_ptrINS_14AdvectionFieldEEEd1
_ZNK7crpropa16AdiabaticCooling8getLimitEv1
_ZN7crpropa16AdiabaticCoolingC2ENS_7ref_ptrINS_14AdvectionFieldEEE2
_ZNK7crpropa16AdiabaticCooling7processEPNS_9CandidateE2
_ZN7crpropa16AdiabaticCooling8setLimitEd3
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/AdiabaticCooling.cpp.func.html b/doc/coverageReport/src/module/AdiabaticCooling.cpp.func.html deleted file mode 100644 index c94a74943..000000000 --- a/doc/coverageReport/src/module/AdiabaticCooling.cpp.func.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/AdiabaticCooling.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - AdiabaticCooling.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:232785.2 %
Date:2024-04-08 14:58:22Functions:55100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16AdiabaticCooling8setLimitEd3
_ZN7crpropa16AdiabaticCoolingC2ENS_7ref_ptrINS_14AdvectionFieldEEE2
_ZN7crpropa16AdiabaticCoolingC2ENS_7ref_ptrINS_14AdvectionFieldEEEd1
_ZNK7crpropa16AdiabaticCooling7processEPNS_9CandidateE2
_ZNK7crpropa16AdiabaticCooling8getLimitEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/AdiabaticCooling.cpp.gcov.html b/doc/coverageReport/src/module/AdiabaticCooling.cpp.gcov.html deleted file mode 100644 index 1a9adcc18..000000000 --- a/doc/coverageReport/src/module/AdiabaticCooling.cpp.gcov.html +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/AdiabaticCooling.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - AdiabaticCooling.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:232785.2 %
Date:2024-04-08 14:58:22Functions:55100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/AdiabaticCooling.h"
-       2             : 
-       3             : namespace crpropa {
-       4             : 
-       5           2 : AdiabaticCooling::AdiabaticCooling(ref_ptr<AdvectionField> advectionField) :
-       6           2 :         advectionField(advectionField) {
-       7           2 :         setLimit(0.1);
-       8           2 : }
-       9             : 
-      10           1 : AdiabaticCooling::AdiabaticCooling(ref_ptr<AdvectionField> advectionField, double limit) :
-      11           1 :         advectionField(advectionField) {
-      12           1 :         setLimit(limit);
-      13           1 : }
-      14             : 
-      15           2 : void AdiabaticCooling::process(Candidate *c) const {
-      16             : 
-      17           2 :         Vector3d pos = c->current.getPosition();
-      18           2 :         double E = c->current.getEnergy(); // Note we use E=p/c (relativistic limit)
-      19             :         
-      20             :         double Div = 0.;        
-      21             :         try {
-      22           2 :                 Div +=  advectionField->getDivergence(pos);
-      23             :         } 
-      24           0 :         catch (std::exception &e) {
-      25           0 :                 KISS_LOG_ERROR  << "AdiabaticCooling: Exception in getDivergence.\n" 
-      26           0 :                                 << e.what();
-      27           0 :         }
-      28             :         
-      29           2 :         double dEdt = -E / 3. * Div;    // cooling due to advection -p/3 * div(V_wind)
-      30             :                                         // (see e.g. Kopp et al. Computer Physics Communication 183
-      31             :                                         // (2012) 530-542)
-      32           2 :         double dt = c->getCurrentStep() / c_light;
-      33           2 :         double dE = dEdt * dt;
-      34             :         
-      35           2 :         c->current.setEnergy(E + dE);
-      36           2 :         if (dEdt==0) {
-      37             :                 return;
-      38             :         }       
-      39           1 :         c->limitNextStep(limit * E / fabs(dEdt) *c_light);
-      40             : }
-      41             : 
-      42           3 : void AdiabaticCooling::setLimit(double l) {
-      43           3 :         limit = l;
-      44           3 : }
-      45             : 
-      46           1 : double AdiabaticCooling::getLimit() const {
-      47           1 :         return limit;
-      48             : }
-      49             :         
-      50             :         
-      51             : 
-      52             : 
-      53             : 
-      54             : } // end namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/Boundary.cpp.func-sort-c.html b/doc/coverageReport/src/module/Boundary.cpp.func-sort-c.html deleted file mode 100644 index 402ed01de..000000000 --- a/doc/coverageReport/src/module/Boundary.cpp.func-sort-c.html +++ /dev/null @@ -1,252 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/Boundary.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - Boundary.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:10621948.4 %
Date:2024-04-08 14:58:22Functions:204544.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11PeriodicBox7setSizeENS_7Vector3IdEE0
_ZN7crpropa11PeriodicBox9setOriginENS_7Vector3IdEE0
_ZN7crpropa11PeriodicBoxC2Ev0
_ZN7crpropa13CubicBoundary7setSizeEd0
_ZN7crpropa13CubicBoundary9setOriginENS_7Vector3IdEE0
_ZN7crpropa13CubicBoundaryC2Ev0
_ZN7crpropa13ReflectiveBox7setSizeENS_7Vector3IdEE0
_ZN7crpropa13ReflectiveBox9setOriginENS_7Vector3IdEE0
_ZN7crpropa13ReflectiveBoxC2Ev0
_ZN7crpropa17SphericalBoundary9setCenterENS_7Vector3IdEE0
_ZN7crpropa17SphericalBoundary9setRadiusEd0
_ZN7crpropa17SphericalBoundaryC2Ev0
_ZN7crpropa19CylindricalBoundary9setHeightEd0
_ZN7crpropa19CylindricalBoundary9setOriginENS_7Vector3IdEE0
_ZN7crpropa19CylindricalBoundary9setRadiusEd0
_ZN7crpropa19CylindricalBoundaryC2Ev0
_ZN7crpropa19EllipsoidalBoundary12setMajorAxisEd0
_ZN7crpropa19EllipsoidalBoundary14setFocalPointsENS_7Vector3IdEES2_0
_ZN7crpropa19EllipsoidalBoundaryC2Ev0
_ZNK7crpropa11PeriodicBox14getDescriptionB5cxx11Ev0
_ZNK7crpropa13CubicBoundary14getDescriptionB5cxx11Ev0
_ZNK7crpropa13ReflectiveBox14getDescriptionB5cxx11Ev0
_ZNK7crpropa17SphericalBoundary14getDescriptionB5cxx11Ev0
_ZNK7crpropa19CylindricalBoundary14getDescriptionB5cxx11Ev0
_ZNK7crpropa19EllipsoidalBoundary14getDescriptionB5cxx11Ev0
_ZN7crpropa13ReflectiveBoxC2ENS_7Vector3IdEES2_1
_ZN7crpropa17SphericalBoundary12setLimitStepEb1
_ZN7crpropa17SphericalBoundary9setMarginEd1
_ZN7crpropa19CylindricalBoundary12setLimitStepEb1
_ZN7crpropa19CylindricalBoundary9setMarginEd1
_ZN7crpropa19EllipsoidalBoundary12setLimitStepEb1
_ZN7crpropa19EllipsoidalBoundary9setMarginEd1
_ZNK7crpropa13ReflectiveBox7processEPNS_9CandidateE1
_ZN7crpropa11PeriodicBoxC2ENS_7Vector3IdEES2_2
_ZN7crpropa13CubicBoundary12setLimitStepEb2
_ZN7crpropa13CubicBoundary9setMarginEd2
_ZNK7crpropa11PeriodicBox7processEPNS_9CandidateE2
_ZN7crpropa17SphericalBoundaryC2ENS_7Vector3IdEEd3
_ZN7crpropa19CylindricalBoundaryC2ENS_7Vector3IdEEdd3
_ZN7crpropa19EllipsoidalBoundaryC2ENS_7Vector3IdEES2_d3
_ZNK7crpropa17SphericalBoundary7processEPNS_9CandidateE3
_ZNK7crpropa19CylindricalBoundary7processEPNS_9CandidateE3
_ZNK7crpropa19EllipsoidalBoundary7processEPNS_9CandidateE3
_ZN7crpropa13CubicBoundaryC2ENS_7Vector3IdEEd4
_ZNK7crpropa13CubicBoundary7processEPNS_9CandidateE4
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/Boundary.cpp.func.html b/doc/coverageReport/src/module/Boundary.cpp.func.html deleted file mode 100644 index faa7abed3..000000000 --- a/doc/coverageReport/src/module/Boundary.cpp.func.html +++ /dev/null @@ -1,252 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/Boundary.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - Boundary.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:10621948.4 %
Date:2024-04-08 14:58:22Functions:204544.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa11PeriodicBox7setSizeENS_7Vector3IdEE0
_ZN7crpropa11PeriodicBox9setOriginENS_7Vector3IdEE0
_ZN7crpropa11PeriodicBoxC2ENS_7Vector3IdEES2_2
_ZN7crpropa11PeriodicBoxC2Ev0
_ZN7crpropa13CubicBoundary12setLimitStepEb2
_ZN7crpropa13CubicBoundary7setSizeEd0
_ZN7crpropa13CubicBoundary9setMarginEd2
_ZN7crpropa13CubicBoundary9setOriginENS_7Vector3IdEE0
_ZN7crpropa13CubicBoundaryC2ENS_7Vector3IdEEd4
_ZN7crpropa13CubicBoundaryC2Ev0
_ZN7crpropa13ReflectiveBox7setSizeENS_7Vector3IdEE0
_ZN7crpropa13ReflectiveBox9setOriginENS_7Vector3IdEE0
_ZN7crpropa13ReflectiveBoxC2ENS_7Vector3IdEES2_1
_ZN7crpropa13ReflectiveBoxC2Ev0
_ZN7crpropa17SphericalBoundary12setLimitStepEb1
_ZN7crpropa17SphericalBoundary9setCenterENS_7Vector3IdEE0
_ZN7crpropa17SphericalBoundary9setMarginEd1
_ZN7crpropa17SphericalBoundary9setRadiusEd0
_ZN7crpropa17SphericalBoundaryC2ENS_7Vector3IdEEd3
_ZN7crpropa17SphericalBoundaryC2Ev0
_ZN7crpropa19CylindricalBoundary12setLimitStepEb1
_ZN7crpropa19CylindricalBoundary9setHeightEd0
_ZN7crpropa19CylindricalBoundary9setMarginEd1
_ZN7crpropa19CylindricalBoundary9setOriginENS_7Vector3IdEE0
_ZN7crpropa19CylindricalBoundary9setRadiusEd0
_ZN7crpropa19CylindricalBoundaryC2ENS_7Vector3IdEEdd3
_ZN7crpropa19CylindricalBoundaryC2Ev0
_ZN7crpropa19EllipsoidalBoundary12setLimitStepEb1
_ZN7crpropa19EllipsoidalBoundary12setMajorAxisEd0
_ZN7crpropa19EllipsoidalBoundary14setFocalPointsENS_7Vector3IdEES2_0
_ZN7crpropa19EllipsoidalBoundary9setMarginEd1
_ZN7crpropa19EllipsoidalBoundaryC2ENS_7Vector3IdEES2_d3
_ZN7crpropa19EllipsoidalBoundaryC2Ev0
_ZNK7crpropa11PeriodicBox14getDescriptionB5cxx11Ev0
_ZNK7crpropa11PeriodicBox7processEPNS_9CandidateE2
_ZNK7crpropa13CubicBoundary14getDescriptionB5cxx11Ev0
_ZNK7crpropa13CubicBoundary7processEPNS_9CandidateE4
_ZNK7crpropa13ReflectiveBox14getDescriptionB5cxx11Ev0
_ZNK7crpropa13ReflectiveBox7processEPNS_9CandidateE1
_ZNK7crpropa17SphericalBoundary14getDescriptionB5cxx11Ev0
_ZNK7crpropa17SphericalBoundary7processEPNS_9CandidateE3
_ZNK7crpropa19CylindricalBoundary14getDescriptionB5cxx11Ev0
_ZNK7crpropa19CylindricalBoundary7processEPNS_9CandidateE3
_ZNK7crpropa19EllipsoidalBoundary14getDescriptionB5cxx11Ev0
_ZNK7crpropa19EllipsoidalBoundary7processEPNS_9CandidateE3
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/Boundary.cpp.gcov.html b/doc/coverageReport/src/module/Boundary.cpp.gcov.html deleted file mode 100644 index 0e651f732..000000000 --- a/doc/coverageReport/src/module/Boundary.cpp.gcov.html +++ /dev/null @@ -1,370 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/Boundary.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - Boundary.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:10621948.4 %
Date:2024-04-08 14:58:22Functions:204544.4 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/Boundary.h"
-       2             : #include "crpropa/Units.h"
-       3             : 
-       4             : #include <sstream>
-       5             : 
-       6             : namespace crpropa {
-       7             : 
-       8           0 : PeriodicBox::PeriodicBox() :
-       9           0 :                 origin(Vector3d(0, 0, 0)), size(Vector3d(0, 0, 0)) {
-      10           0 : }
-      11             : 
-      12           2 : PeriodicBox::PeriodicBox(Vector3d o, Vector3d s) :
-      13           2 :                 origin(o), size(s) {
-      14           2 : }
-      15             : 
-      16           2 : void PeriodicBox::process(Candidate *c) const {
-      17           2 :         Vector3d pos = c->current.getPosition();
-      18           2 :         Vector3d n = ((pos - origin) / size).floor();
-      19             : 
-      20           2 :         if ((n.x == 0) and (n.y == 0) and (n.z == 0))
-      21             :                 return; // do nothing if candidate is inside the box
-      22             : 
-      23           2 :         c->current.setPosition(pos - n * size);
-      24           2 :         c->previous.setPosition(c->previous.getPosition() - n * size);
-      25           2 :         c->source.setPosition(c->source.getPosition() - n * size);
-      26           2 :         c->created.setPosition(c->created.getPosition() - n * size);
-      27             : }
-      28             : 
-      29           0 : void PeriodicBox::setOrigin(Vector3d o) {
-      30             :         origin = o;
-      31           0 : }
-      32           0 : void PeriodicBox::setSize(Vector3d s) {
-      33             :         size = s;
-      34           0 : }
-      35             : 
-      36           0 : std::string PeriodicBox::getDescription() const {
-      37           0 :         std::stringstream s;
-      38           0 :         s << "Periodic box: origin " << origin / Mpc << " Mpc, ";
-      39           0 :         s << "size " << size / Mpc << " Mpc";
-      40           0 :         return s.str();
-      41           0 : }
-      42             : 
-      43           0 : ReflectiveBox::ReflectiveBox() :
-      44           0 :                 origin(Vector3d(0, 0, 0)), size(Vector3d(0, 0, 0)) {
-      45           0 : }
-      46             : 
-      47           1 : ReflectiveBox::ReflectiveBox(Vector3d o, Vector3d s) :
-      48           1 :                 origin(o), size(s) {
-      49           1 : }
-      50             : 
-      51           1 : void ReflectiveBox::process(Candidate *c) const {
-      52           1 :         Vector3d cur = (c->current.getPosition() - origin) / size; // current position in cell units
-      53           1 :         Vector3d n = cur.floor();
-      54             : 
-      55           1 :         if ((n.x == 0) and (n.y == 0) and (n.z == 0))
-      56             :                 return; // do nothing if candidate is inside the box
-      57             : 
-      58             :         // flip direction
-      59           1 :         Vector3d nReflect(pow(-1, n.x), pow(-1, n.y), pow(-1, n.z));
-      60           1 :         c->current.setDirection(c->current.getDirection() * nReflect);
-      61           1 :         c->previous.setDirection(c->previous.getDirection() * nReflect);
-      62           1 :         c->created.setDirection(c->created.getDirection() * nReflect);
-      63           1 :         c->source.setDirection(c->source.getDirection() * nReflect);
-      64             : 
-      65           1 :         Vector3d src = (c->source.getPosition() - origin) / size; // initial position in cell units
-      66           1 :         Vector3d cre = (c->created.getPosition() - origin) / size; // initial position in cell units
-      67           1 :         Vector3d prv = (c->previous.getPosition() - origin) / size; // previous position in cell units
-      68             : 
-      69             :         // repeatedly translate until the current position is inside the cell
-      70           1 :         while ((cur.x < 0) or (cur.x > 1)) {
-      71           0 :                 double t = 2 * (cur.x > 1);
-      72           0 :                 src.x = t - src.x;
-      73           0 :                 cre.x = t - cre.x;
-      74           0 :                 prv.x = t - prv.x;
-      75           0 :                 cur.x = t - cur.x;
-      76             :         }
-      77           1 :         while ((cur.y < 0) or (cur.y > 1)) {
-      78           0 :                 double t = 2 * (cur.y > 1);
-      79           0 :                 src.y = t - src.y;
-      80           0 :                 cre.y = t - cre.y;
-      81           0 :                 prv.y = t - prv.y;
-      82           0 :                 cur.y = t - cur.y;
-      83             :         }
-      84           2 :         while ((cur.z < 0) or (cur.z > 1)) {
-      85           1 :                 double t = 2 * (cur.z > 1);
-      86           1 :                 src.z = t - src.z;
-      87           1 :                 cre.z = t - cre.z;
-      88           1 :                 prv.z = t - prv.z;
-      89           1 :                 cur.z = t - cur.z;
-      90             :         }
-      91             : 
-      92           1 :         c->current.setPosition(cur * size + origin);
-      93           1 :         c->source.setPosition(src * size + origin);
-      94           1 :         c->created.setPosition(cre * size + origin);
-      95           1 :         c->previous.setPosition(prv * size + origin);
-      96             : }
-      97             : 
-      98           0 : void ReflectiveBox::setOrigin(Vector3d o) {
-      99             :         origin = o;
-     100           0 : }
-     101           0 : void ReflectiveBox::setSize(Vector3d s) {
-     102             :         size = s;
-     103           0 : }
-     104             : 
-     105           0 : std::string ReflectiveBox::getDescription() const {
-     106           0 :         std::stringstream s;
-     107           0 :         s << "Reflective box: origin " << origin / Mpc << " Mpc, ";
-     108           0 :         s << "size " << size / Mpc << " Mpc";
-     109           0 :         return s.str();
-     110           0 : }
-     111             : 
-     112           0 : CubicBoundary::CubicBoundary() :
-     113           0 :                 origin(Vector3d(0, 0, 0)), size(0), limitStep(true), margin(0.1 * kpc) {
-     114           0 : }
-     115             : 
-     116           4 : CubicBoundary::CubicBoundary(Vector3d o, double s) :
-     117           4 :                 origin(o), size(s), limitStep(true), margin(0.1 * kpc) {
-     118           4 : }
-     119             : 
-     120           4 : void CubicBoundary::process(Candidate *c) const {
-     121           4 :         Vector3d r = c->current.getPosition() - origin;
-     122             :         double lo = r.min();
-     123             :         double hi = r.max();
-     124           4 :         if ((lo <= 0) or (hi >= size)) {
-     125           1 :                 reject(c);
-     126             :         }
-     127           4 :         if (limitStep) {
-     128           4 :                 c->limitNextStep(lo + margin);
-     129           4 :                 c->limitNextStep(size - hi + margin);
-     130             :         }
-     131           4 : }
-     132             : 
-     133           0 : void CubicBoundary::setOrigin(Vector3d o) {
-     134             :         origin = o;
-     135           0 : }
-     136           0 : void CubicBoundary::setSize(double s) {
-     137           0 :         size = s;
-     138           0 : }
-     139           2 : void CubicBoundary::setMargin(double m) {
-     140           2 :         margin = m;
-     141           2 : }
-     142           2 : void CubicBoundary::setLimitStep(bool b) {
-     143           2 :         limitStep = b;
-     144           2 : }
-     145             : 
-     146           0 : std::string CubicBoundary::getDescription() const {
-     147           0 :         std::stringstream s;
-     148           0 :         s << "Cubic Boundary: origin " << origin / Mpc << " Mpc, ";
-     149           0 :         s << "size " << size / Mpc << " Mpc, ";
-     150           0 :         s << "Flag: '" << rejectFlagKey << "' -> '" << rejectFlagValue << "', ";
-     151           0 :         s << "MakeInactive: " << (makeRejectedInactive ? "yes" : "no");
-     152           0 :         if (rejectAction.valid())
-     153           0 :                 s << ", Action: " << rejectAction->getDescription();
-     154           0 :         return s.str();
-     155           0 : }
-     156             : 
-     157           0 : SphericalBoundary::SphericalBoundary() :
-     158           0 :                 center(Vector3d(0, 0, 0)), radius(0), limitStep(true), margin(0.1 * kpc) {
-     159           0 : }
-     160             : 
-     161           3 : SphericalBoundary::SphericalBoundary(Vector3d c, double r) :
-     162           3 :                 center(c), radius(r), limitStep(true), margin(0.1 * kpc) {
-     163           3 : }
-     164             : 
-     165           3 : void SphericalBoundary::process(Candidate *c) const {
-     166           3 :         double d = (c->current.getPosition() - center).getR();
-     167           3 :         if (d >= radius) {
-     168           1 :                 reject(c);
-     169             :         }
-     170           3 :         if (limitStep)
-     171           3 :                 c->limitNextStep(radius - d + margin);
-     172           3 : }
-     173             : 
-     174           0 : void SphericalBoundary::setCenter(Vector3d c) {
-     175             :         center = c;
-     176           0 : }
-     177           0 : void SphericalBoundary::setRadius(double r) {
-     178           0 :         radius = r;
-     179           0 : }
-     180           1 : void SphericalBoundary::setMargin(double m) {
-     181           1 :         margin = m;
-     182           1 : }
-     183           1 : void SphericalBoundary::setLimitStep(bool b) {
-     184           1 :         limitStep = b;
-     185           1 : }
-     186             : 
-     187           0 : std::string SphericalBoundary::getDescription() const {
-     188           0 :         std::stringstream s;
-     189           0 :         s << "Spherical Boundary: radius " << radius / Mpc << " Mpc, ";
-     190           0 :         s << "around " << center / Mpc << " Mpc, ";
-     191           0 :         s << "Flag: '" << rejectFlagKey << "' -> '" << rejectFlagValue << "', ";
-     192           0 :         s << "MakeInactive: " << (makeRejectedInactive ? "yes" : "no");
-     193           0 :         if (rejectAction.valid())
-     194           0 :                 s << ", Action: " << rejectAction->getDescription();
-     195           0 :         return s.str();
-     196           0 : }
-     197             : 
-     198           0 : EllipsoidalBoundary::EllipsoidalBoundary() :
-     199             :                 focalPoint1(Vector3d(0, 0, 0)), focalPoint2(Vector3d(0, 0, 0)),
-     200           0 :                 majorAxis(0), limitStep(true), margin(0.1 * kpc) {
-     201           0 : }
-     202             : 
-     203           3 : EllipsoidalBoundary::EllipsoidalBoundary(Vector3d f1, Vector3d f2, double a) :
-     204           3 :                 focalPoint1(f1), focalPoint2(f2), majorAxis(a), limitStep(true),
-     205           3 :                 margin(0.1 * kpc) {
-     206           3 : }
-     207             : 
-     208           3 : void EllipsoidalBoundary::process(Candidate *c) const {
-     209           3 :         Vector3d pos = c->current.getPosition();
-     210           3 :         double d = pos.getDistanceTo(focalPoint1) + pos.getDistanceTo(focalPoint2);
-     211           3 :         if (d >= majorAxis) {
-     212           1 :                 reject(c);
-     213             :         }
-     214           3 :         if (limitStep)
-     215           3 :                 c->limitNextStep(majorAxis - d + margin);
-     216           3 : }
-     217             : 
-     218           0 : void EllipsoidalBoundary::setFocalPoints(Vector3d f1, Vector3d f2) {
-     219             :         focalPoint1 = f1;
-     220             :         focalPoint2 = f2;
-     221           0 : }
-     222           0 : void EllipsoidalBoundary::setMajorAxis(double a) {
-     223           0 :         majorAxis = a;
-     224           0 : }
-     225           1 : void EllipsoidalBoundary::setMargin(double m) {
-     226           1 :         margin = m;
-     227           1 : }
-     228           1 : void EllipsoidalBoundary::setLimitStep(bool b) {
-     229           1 :         limitStep = b;
-     230           1 : }
-     231             : 
-     232           0 : std::string EllipsoidalBoundary::getDescription() const {
-     233           0 :         std::stringstream s;
-     234           0 :         s << "Ellipsoidal Boundary: F1 = " << focalPoint1 / Mpc << " Mpc, ";
-     235           0 :         s << "F2 = " << focalPoint2 / Mpc << " Mpc, ";
-     236           0 :         s << "major axis " << majorAxis / Mpc << " Mpc; ";
-     237           0 :         s << "Flag: '" << rejectFlagKey << "' -> '" << rejectFlagValue << "', ";
-     238           0 :         s << "MakeInactive: " << (makeRejectedInactive ? "yes" : "no");
-     239           0 :         if (rejectAction.valid())
-     240           0 :                 s << ", Action: " << rejectAction->getDescription();
-     241           0 :         return s.str();
-     242           0 : }
-     243             : 
-     244           0 : CylindricalBoundary::CylindricalBoundary() :
-     245           0 :   origin(Vector3d(0,0,0)), height(0), radius(0), limitStep(false), margin(0) {
-     246           0 : }
-     247             : 
-     248           3 : CylindricalBoundary::CylindricalBoundary(Vector3d o, double h, double r) :
-     249           3 :   origin(o), height(h), radius(r), limitStep(false) , margin(0){
-     250           3 : }
-     251             : 
-     252           3 : void CylindricalBoundary::process(Candidate *c) const {
-     253           3 :         Vector3d d = c->current.getPosition() - origin;
-     254           3 :         double R2 = pow(d.x, 2.)+pow(d.y, 2.);
-     255           3 :         double Z = fabs(d.z);
-     256           3 :         if ( R2 < pow(radius, 2.) and Z < height/2.) {
-     257           2 :                 if(limitStep) {
-     258           2 :                         c->limitNextStep(std::min(radius - pow(R2, 0.5), height/2. - Z) + margin);   
-     259             :                 }
-     260             :           return;
-     261             :         }
-     262           1 :         reject(c);
-     263             : }
-     264             : 
-     265           0 : void CylindricalBoundary::setOrigin(Vector3d o) {
-     266             :         origin = o;
-     267           0 : }
-     268           0 : void CylindricalBoundary::setHeight(double h) {
-     269           0 :         height = h;
-     270           0 : }
-     271           0 : void CylindricalBoundary::setRadius(double r) {
-     272           0 :         radius = r;
-     273           0 : }
-     274           1 : void CylindricalBoundary::setLimitStep(bool b) {
-     275           1 :         limitStep = b;
-     276           1 : }
-     277           1 : void CylindricalBoundary::setMargin(double m) {
-     278           1 :         margin = m;
-     279           1 : }
-     280             : 
-     281             : 
-     282           0 : std::string CylindricalBoundary::getDescription() const {
-     283           0 :         std::stringstream s;
-     284           0 :         s << "Cylindrical Boundary: origin = " << origin / kpc << " kpc, ";
-     285           0 :         s << "radius = " << radius / kpc << " kpc, ";
-     286           0 :         s << "height" << height / kpc << " kpc; ";
-     287           0 :         s << "Flag: '" << rejectFlagKey << "' -> '" << rejectFlagValue << "', ";
-     288           0 :         s << "MakeInactive: " << (makeRejectedInactive ? "yes" : "no");
-     289           0 :         if (rejectAction.valid())
-     290           0 :                 s << ", Action: " << rejectAction->getDescription();
-     291           0 :         return s.str();
-     292           0 : }
-     293             : 
-     294             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/BreakCondition.cpp.func-sort-c.html b/doc/coverageReport/src/module/BreakCondition.cpp.func-sort-c.html deleted file mode 100644 index 59b7031c8..000000000 --- a/doc/coverageReport/src/module/BreakCondition.cpp.func-sort-c.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/BreakCondition.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - BreakCondition.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:6317236.6 %
Date:2024-04-08 14:58:22Functions:153839.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa13MinimumEnergy16setMinimumEnergyEd0
_ZN7crpropa15DetectionLength18setDetectionLengthEd0
_ZN7crpropa15MinimumRedshift18getMinimumRedshiftEv0
_ZN7crpropa15MinimumRedshift18setMinimumRedshiftEd0
_ZN7crpropa15MinimumRigidity18setMinimumRigidityEd0
_ZN7crpropa15MinimumRigidityC2Ed0
_ZN7crpropa19MinimumChargeNumber22setMinimumChargeNumberEi0
_ZN7crpropa23MaximumTrajectoryLength26setMaximumTrajectoryLengthEd0
_ZNK7crpropa13MinimumEnergy14getDescriptionB5cxx11Ev0
_ZNK7crpropa13MinimumEnergy16getMinimumEnergyEv0
_ZNK7crpropa15DetectionLength14getDescriptionB5cxx11Ev0
_ZNK7crpropa15DetectionLength18getDetectionLengthEv0
_ZNK7crpropa15MinimumRedshift14getDescriptionB5cxx11Ev0
_ZNK7crpropa15MinimumRigidity14getDescriptionB5cxx11Ev0
_ZNK7crpropa15MinimumRigidity18getMinimumRigidityEv0
_ZNK7crpropa15MinimumRigidity7processEPNS_9CandidateE0
_ZNK7crpropa19MinimumChargeNumber14getDescriptionB5cxx11Ev0
_ZNK7crpropa19MinimumChargeNumber22getMinimumChargeNumberEv0
_ZNK7crpropa23MaximumTrajectoryLength14getDescriptionB5cxx11Ev0
_ZNK7crpropa23MaximumTrajectoryLength20getObserverPositionsEv0
_ZNK7crpropa23MaximumTrajectoryLength26getMaximumTrajectoryLengthEv0
_ZNK7crpropa26MinimumEnergyPerParticleId14getDescriptionB5cxx11Ev0
_ZNK7crpropa26MinimumEnergyPerParticleId22getMinimumEnergyOthersEv0
_ZN7crpropa15DetectionLengthC2Ed1
_ZN7crpropa15MinimumRedshiftC2Ed1
_ZN7crpropa19MinimumChargeNumberC2Ei1
_ZN7crpropa23MaximumTrajectoryLength19addObserverPositionERKNS_7Vector3IdEE1
_ZN7crpropa26MinimumEnergyPerParticleId22setMinimumEnergyOthersEd1
_ZN7crpropa26MinimumEnergyPerParticleIdC2Ed1
_ZN7crpropa13MinimumEnergyC2Ed2
_ZNK7crpropa15DetectionLength7processEPNS_9CandidateE2
_ZNK7crpropa15MinimumRedshift7processEPNS_9CandidateE2
_ZN7crpropa26MinimumEnergyPerParticleId3addEid3
_ZNK7crpropa19MinimumChargeNumber7processEPNS_9CandidateE4
_ZNK7crpropa26MinimumEnergyPerParticleId7processEPNS_9CandidateE5
_ZN7crpropa23MaximumTrajectoryLengthC2Ed13
_ZNK7crpropa13MinimumEnergy7processEPNS_9CandidateE7644
_ZNK7crpropa23MaximumTrajectoryLength7processEPNS_9CandidateE491649
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/BreakCondition.cpp.func.html b/doc/coverageReport/src/module/BreakCondition.cpp.func.html deleted file mode 100644 index 9734252c0..000000000 --- a/doc/coverageReport/src/module/BreakCondition.cpp.func.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/BreakCondition.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - BreakCondition.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:6317236.6 %
Date:2024-04-08 14:58:22Functions:153839.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa13MinimumEnergy16setMinimumEnergyEd0
_ZN7crpropa13MinimumEnergyC2Ed2
_ZN7crpropa15DetectionLength18setDetectionLengthEd0
_ZN7crpropa15DetectionLengthC2Ed1
_ZN7crpropa15MinimumRedshift18getMinimumRedshiftEv0
_ZN7crpropa15MinimumRedshift18setMinimumRedshiftEd0
_ZN7crpropa15MinimumRedshiftC2Ed1
_ZN7crpropa15MinimumRigidity18setMinimumRigidityEd0
_ZN7crpropa15MinimumRigidityC2Ed0
_ZN7crpropa19MinimumChargeNumber22setMinimumChargeNumberEi0
_ZN7crpropa19MinimumChargeNumberC2Ei1
_ZN7crpropa23MaximumTrajectoryLength19addObserverPositionERKNS_7Vector3IdEE1
_ZN7crpropa23MaximumTrajectoryLength26setMaximumTrajectoryLengthEd0
_ZN7crpropa23MaximumTrajectoryLengthC2Ed13
_ZN7crpropa26MinimumEnergyPerParticleId22setMinimumEnergyOthersEd1
_ZN7crpropa26MinimumEnergyPerParticleId3addEid3
_ZN7crpropa26MinimumEnergyPerParticleIdC2Ed1
_ZNK7crpropa13MinimumEnergy14getDescriptionB5cxx11Ev0
_ZNK7crpropa13MinimumEnergy16getMinimumEnergyEv0
_ZNK7crpropa13MinimumEnergy7processEPNS_9CandidateE7644
_ZNK7crpropa15DetectionLength14getDescriptionB5cxx11Ev0
_ZNK7crpropa15DetectionLength18getDetectionLengthEv0
_ZNK7crpropa15DetectionLength7processEPNS_9CandidateE2
_ZNK7crpropa15MinimumRedshift14getDescriptionB5cxx11Ev0
_ZNK7crpropa15MinimumRedshift7processEPNS_9CandidateE2
_ZNK7crpropa15MinimumRigidity14getDescriptionB5cxx11Ev0
_ZNK7crpropa15MinimumRigidity18getMinimumRigidityEv0
_ZNK7crpropa15MinimumRigidity7processEPNS_9CandidateE0
_ZNK7crpropa19MinimumChargeNumber14getDescriptionB5cxx11Ev0
_ZNK7crpropa19MinimumChargeNumber22getMinimumChargeNumberEv0
_ZNK7crpropa19MinimumChargeNumber7processEPNS_9CandidateE4
_ZNK7crpropa23MaximumTrajectoryLength14getDescriptionB5cxx11Ev0
_ZNK7crpropa23MaximumTrajectoryLength20getObserverPositionsEv0
_ZNK7crpropa23MaximumTrajectoryLength26getMaximumTrajectoryLengthEv0
_ZNK7crpropa23MaximumTrajectoryLength7processEPNS_9CandidateE491649
_ZNK7crpropa26MinimumEnergyPerParticleId14getDescriptionB5cxx11Ev0
_ZNK7crpropa26MinimumEnergyPerParticleId22getMinimumEnergyOthersEv0
_ZNK7crpropa26MinimumEnergyPerParticleId7processEPNS_9CandidateE5
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/BreakCondition.cpp.gcov.html b/doc/coverageReport/src/module/BreakCondition.cpp.gcov.html deleted file mode 100644 index 315b82cba..000000000 --- a/doc/coverageReport/src/module/BreakCondition.cpp.gcov.html +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/BreakCondition.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - BreakCondition.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:6317236.6 %
Date:2024-04-08 14:58:22Functions:153839.5 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/BreakCondition.h"
-       2             : #include "crpropa/ParticleID.h"
-       3             : #include "crpropa/Units.h"
-       4             : 
-       5             : #include <sstream>
-       6             : 
-       7             : namespace crpropa {
-       8             : 
-       9          13 : MaximumTrajectoryLength::MaximumTrajectoryLength(double maxLength) :
-      10          13 :                 maxLength(maxLength) {
-      11          13 : }
-      12             : 
-      13           0 : void MaximumTrajectoryLength::setMaximumTrajectoryLength(double length) {
-      14           0 :         maxLength = length;
-      15           0 : }
-      16             : 
-      17           0 : double MaximumTrajectoryLength::getMaximumTrajectoryLength() const {
-      18           0 :         return maxLength;
-      19             : }
-      20             : 
-      21           1 : void MaximumTrajectoryLength::addObserverPosition(const Vector3d& position) {
-      22           1 :         observerPositions.push_back(position);
-      23           1 : }
-      24             : 
-      25           0 : const std::vector<Vector3d>& MaximumTrajectoryLength::getObserverPositions() const {
-      26           0 :         return observerPositions;
-      27             : }
-      28             : 
-      29           0 : std::string MaximumTrajectoryLength::getDescription() const {
-      30           0 :         std::stringstream s;
-      31           0 :         s << "Maximum trajectory length: " << maxLength / Mpc << " Mpc, ";
-      32           0 :         s << "Flag: '" << rejectFlagKey << "' -> '" << rejectFlagValue << "', ";
-      33           0 :         s << "MakeInactive: " << (makeRejectedInactive ? "yes" : "no");
-      34           0 :         if (rejectAction.valid())
-      35           0 :                 s << ", Action: " << rejectAction->getDescription();
-      36           0 :         s << "\n  Observer positions: \n";
-      37           0 :         for (size_t i = 0; i < observerPositions.size(); i++)
-      38           0 :                 s << "    - " << observerPositions[i] / Mpc << " Mpc\n";
-      39           0 :         return s.str();
-      40           0 : }
-      41             : 
-      42      491649 : void MaximumTrajectoryLength::process(Candidate *c) const {
-      43      491649 :         double length = c->getTrajectoryLength();
-      44      491649 :         Vector3d position = c->current.getPosition();
-      45             : 
-      46      491649 :         if(observerPositions.size()) {
-      47             :                 bool inRange = false;
-      48           4 :                 for (size_t i = 0; i < observerPositions.size(); i++) {
-      49           2 :                         double distance = position.getDistanceTo(observerPositions[i]);
-      50           2 :                         if (distance + length < maxLength)
-      51             :                                 inRange = true;
-      52             :                 }
-      53           2 :                 if (!inRange) {
-      54           1 :                         reject(c);
-      55             :                         return;
-      56             :                 }
-      57             :         }
-      58             : 
-      59      491648 :         if (length >= maxLength) {
-      60        1107 :                 reject(c);
-      61             :         } else {
-      62      490541 :                 c->limitNextStep(maxLength - length);
-      63             :         }
-      64             : }
-      65             : 
-      66             : //*****************************************************************************
-      67           2 : MinimumEnergy::MinimumEnergy(double minEnergy) :
-      68           2 :                 minEnergy(minEnergy) {
-      69           2 : }
-      70             : 
-      71           0 : void MinimumEnergy::setMinimumEnergy(double energy) {
-      72           0 :         minEnergy = energy;
-      73           0 : }
-      74             : 
-      75           0 : double MinimumEnergy::getMinimumEnergy() const {
-      76           0 :         return minEnergy;
-      77             : }
-      78             : 
-      79        7644 : void MinimumEnergy::process(Candidate *c) const {
-      80        7644 :         if (c->current.getEnergy() > minEnergy)
-      81             :                 return;
-      82             :         else
-      83           1 :                 reject(c);
-      84             : }
-      85             : 
-      86           0 : std::string MinimumEnergy::getDescription() const {
-      87           0 :         std::stringstream s;
-      88           0 :         s << "Minimum energy: " << minEnergy / EeV << " EeV, ";
-      89           0 :         s << "Flag: '" << rejectFlagKey << "' -> '" << rejectFlagValue << "', ";
-      90           0 :         s << "MakeInactive: " << (makeRejectedInactive ? "yes" : "no");
-      91           0 :         if (rejectAction.valid())
-      92           0 :                 s << ", Action: " << rejectAction->getDescription();
-      93           0 :         return s.str();
-      94           0 : }
-      95             : 
-      96             : //*****************************************************************************
-      97           0 : MinimumRigidity::MinimumRigidity(double minRigidity) :
-      98           0 :                 minRigidity(minRigidity) {
-      99           0 : }
-     100             : 
-     101           0 : void MinimumRigidity::setMinimumRigidity(double minRigidity) {
-     102           0 :         this->minRigidity = minRigidity;
-     103           0 : }
-     104             : 
-     105           0 : double MinimumRigidity::getMinimumRigidity() const {
-     106           0 :         return minRigidity;
-     107             : }
-     108             : 
-     109           0 : void MinimumRigidity::process(Candidate *c) const {
-     110           0 :         if (c->current.getRigidity() < minRigidity)
-     111           0 :                 reject(c);
-     112           0 : }
-     113             : 
-     114           0 : std::string MinimumRigidity::getDescription() const {
-     115           0 :         std::stringstream s;
-     116           0 :         s << "Minimum rigidity: " << minRigidity / EeV << " EeV, ";
-     117           0 :         s << "Flag: '" << rejectFlagKey << "' -> '" << rejectFlagValue << "', ";
-     118           0 :         s << "MakeInactive: " << (makeRejectedInactive ? "yes" : "no");
-     119           0 :         if (rejectAction.valid())
-     120           0 :                 s << ", Action: " << rejectAction->getDescription();
-     121           0 :         return s.str();
-     122           0 : }
-     123             : 
-     124             : //*****************************************************************************
-     125           1 : MinimumRedshift::MinimumRedshift(double zmin) :
-     126           1 :                 zmin(zmin) {
-     127           1 : }
-     128             : 
-     129           0 : void MinimumRedshift::setMinimumRedshift(double z) {
-     130           0 :         zmin = z;
-     131           0 : }
-     132             : 
-     133           0 : double MinimumRedshift::getMinimumRedshift() {
-     134           0 :         return zmin;
-     135             : }
-     136             : 
-     137           2 : void MinimumRedshift::process(Candidate* c) const {
-     138           2 :         if (c->getRedshift() > zmin)
-     139             :                 return;
-     140             :         else
-     141           1 :                 reject(c);
-     142             : }
-     143             : 
-     144           0 : std::string MinimumRedshift::getDescription() const {
-     145           0 :         std::stringstream s;
-     146           0 :         s << "Minimum redshift: " << zmin << ", ";
-     147           0 :         s << "Flag: '" << rejectFlagKey << "' -> '" << rejectFlagValue << "', ";
-     148           0 :         s << "MakeInactive: " << (makeRejectedInactive ? "yes" : "no");
-     149           0 :         if (rejectAction.valid())
-     150           0 :                 s << ", Action: " << rejectAction->getDescription();
-     151           0 :         return s.str();
-     152           0 : }
-     153             : 
-     154             : //*****************************************************************************
-     155           1 : MinimumChargeNumber::MinimumChargeNumber(int minChargeNumber) :
-     156           1 :                 minChargeNumber(minChargeNumber) {
-     157           1 : }
-     158             : 
-     159           0 : void MinimumChargeNumber::setMinimumChargeNumber(int chargeNumber) {
-     160           0 :         minChargeNumber = chargeNumber;
-     161           0 : }
-     162             : 
-     163           0 : int MinimumChargeNumber::getMinimumChargeNumber() const {
-     164           0 :         return minChargeNumber;
-     165             : }
-     166             : 
-     167           4 : void MinimumChargeNumber::process(Candidate *c) const {
-     168           4 :         if (chargeNumber(c->current.getId()) > minChargeNumber)
-     169             :                 return;
-     170             :         else
-     171           2 :                 reject(c);
-     172             : }
-     173             : 
-     174           0 : std::string MinimumChargeNumber::getDescription() const {
-     175           0 :         std::stringstream s;
-     176           0 :         s << "Minimum charge number: " << minChargeNumber;
-     177           0 :         s << "Flag: '" << rejectFlagKey << "' -> '" << rejectFlagValue << "', ";
-     178           0 :         s << "MakeInactive: " << (makeRejectedInactive ? "yes" : "no");
-     179           0 :         if (rejectAction.valid())
-     180           0 :                 s << ", Action: " << rejectAction->getDescription();
-     181           0 :         return s.str();
-     182           0 : }
-     183             : 
-     184             : //*****************************************************************************
-     185           1 : MinimumEnergyPerParticleId::MinimumEnergyPerParticleId(double minEnergyOthers) {
-     186           1 :         setMinimumEnergyOthers(minEnergyOthers);
-     187           1 : }
-     188             : 
-     189           3 : void MinimumEnergyPerParticleId::add(int id, double energy) {
-     190           3 :         particleIds.push_back(id);
-     191           3 :         minEnergies.push_back(energy);
-     192           3 : }
-     193             : 
-     194           1 : void MinimumEnergyPerParticleId::setMinimumEnergyOthers(double energy) {
-     195           1 :         minEnergyOthers = energy;
-     196           1 : }
-     197             : 
-     198           0 : double MinimumEnergyPerParticleId::getMinimumEnergyOthers() const {
-     199           0 :         return minEnergyOthers;
-     200             : }
-     201             : 
-     202           5 : void MinimumEnergyPerParticleId::process(Candidate *c) const {
-     203          15 :         for (int i = 0; i < particleIds.size(); i++) {
-     204          12 :                 if (c->current.getId() == particleIds[i]) {
-     205           5 :                         if (c->current.getEnergy() < minEnergies[i])
-     206           3 :                                 reject(c);
-     207             :                         else
-     208             :                                 return;
-     209             :                 }
-     210             :         }
-     211             : 
-     212           3 :         if (c->current.getEnergy() < minEnergyOthers)
-     213           1 :                 reject(c);
-     214             :         else
-     215             :                 return;
-     216             : }
-     217             : 
-     218           0 : std::string MinimumEnergyPerParticleId::getDescription() const {
-     219           0 :         std::stringstream s;
-     220           0 :         s << "Minimum energy for non-specified particles: " << minEnergyOthers / eV << " eV";
-     221           0 :         for (int i = 0; i < minEnergies.size(); i++) {
-     222           0 :                 s << "  for particle " << particleIds[i] << " : " << minEnergies[i] / eV << " eV";
-     223             :         }
-     224           0 :         s << "Flag: '" << rejectFlagKey << "' -> '" << rejectFlagValue << "', ";
-     225           0 :         s << "MakeInactive: " << (makeRejectedInactive ? "yes" : "no");
-     226           0 :         if (rejectAction.valid())
-     227           0 :                 s << ", Action: " << rejectAction->getDescription();
-     228           0 :         return s.str();
-     229           0 : }
-     230             : 
-     231             : //*****************************************************************************
-     232           1 : DetectionLength::DetectionLength(double detLength) :
-     233           1 :                 detLength(detLength) {
-     234           1 : }
-     235             : 
-     236           0 : void DetectionLength::setDetectionLength(double length) {
-     237           0 :         detLength = length;
-     238           0 : }
-     239             : 
-     240           0 : double DetectionLength::getDetectionLength() const {
-     241           0 :         return detLength;
-     242             : }
-     243             : 
-     244             : 
-     245           0 : std::string DetectionLength::getDescription() const {
-     246           0 :         std::stringstream s;
-     247           0 :         s << "Detection length: " << detLength / kpc << " kpc, ";
-     248           0 :         s << "Flag: '" << rejectFlagKey << "' -> '" << rejectFlagValue << "', ";
-     249           0 :         s << "MakeInactive: " << (makeRejectedInactive ? "yes" : "no");
-     250           0 :         if (rejectAction.valid())
-     251           0 :                 s << ", Action: " << rejectAction->getDescription();
-     252           0 :         return s.str();
-     253           0 : }
-     254             : 
-     255           2 : void DetectionLength::process(Candidate *c) const {
-     256           2 :         double length = c->getTrajectoryLength();
-     257           2 :         double step = c->getCurrentStep();
-     258             : 
-     259           2 :         if (length >= detLength && length - step < detLength) {
-     260           1 :                 reject(c);
-     261             :         } else {
-     262           1 :                 c->limitNextStep(detLength - length);
-     263             :         }
-     264           2 : }
-     265             : 
-     266             : 
-     267             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/CandidateSplitting.cpp.func-sort-c.html b/doc/coverageReport/src/module/CandidateSplitting.cpp.func-sort-c.html deleted file mode 100644 index d7f065f98..000000000 --- a/doc/coverageReport/src/module/CandidateSplitting.cpp.func-sort-c.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/CandidateSplitting.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - CandidateSplitting.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:536186.9 %
Date:2024-04-08 14:58:22Functions:101190.9 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa18CandidateSplittingC2Ev0
_ZN7crpropa18CandidateSplitting16setEnergyBinsDSAEddi1
_ZN7crpropa18CandidateSplittingC2Eddi1
_ZNK7crpropa18CandidateSplitting16getMinimalWeightEv1
_ZNK7crpropa18CandidateSplitting9getNsplitEv1
_ZN7crpropa18CandidateSplitting13setEnergyBinsEdddb3
_ZN7crpropa18CandidateSplittingC2Eiddddb3
_ZN7crpropa18CandidateSplitting16setMinimalWeightEd4
_ZN7crpropa18CandidateSplitting9setNsplitEi4
_ZNK7crpropa18CandidateSplitting13getEnergyBinsEv6
_ZNK7crpropa18CandidateSplitting7processEPNS_9CandidateE6
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/CandidateSplitting.cpp.func.html b/doc/coverageReport/src/module/CandidateSplitting.cpp.func.html deleted file mode 100644 index 8031c35f7..000000000 --- a/doc/coverageReport/src/module/CandidateSplitting.cpp.func.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/CandidateSplitting.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - CandidateSplitting.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:536186.9 %
Date:2024-04-08 14:58:22Functions:101190.9 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa18CandidateSplitting13setEnergyBinsEdddb3
_ZN7crpropa18CandidateSplitting16setEnergyBinsDSAEddi1
_ZN7crpropa18CandidateSplitting16setMinimalWeightEd4
_ZN7crpropa18CandidateSplitting9setNsplitEi4
_ZN7crpropa18CandidateSplittingC2Eddi1
_ZN7crpropa18CandidateSplittingC2Eiddddb3
_ZN7crpropa18CandidateSplittingC2Ev0
_ZNK7crpropa18CandidateSplitting13getEnergyBinsEv6
_ZNK7crpropa18CandidateSplitting16getMinimalWeightEv1
_ZNK7crpropa18CandidateSplitting7processEPNS_9CandidateE6
_ZNK7crpropa18CandidateSplitting9getNsplitEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/CandidateSplitting.cpp.gcov.html b/doc/coverageReport/src/module/CandidateSplitting.cpp.gcov.html deleted file mode 100644 index c8cd11eb0..000000000 --- a/doc/coverageReport/src/module/CandidateSplitting.cpp.gcov.html +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/CandidateSplitting.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - CandidateSplitting.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:536186.9 %
Date:2024-04-08 14:58:22Functions:101190.9 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/CandidateSplitting.h"
-       2             : 
-       3             : namespace crpropa {
-       4             : 
-       5           0 : CandidateSplitting::CandidateSplitting() {
-       6             :         // no particle splitting if EnergyBins and NSplit are not specified
-       7           0 :         setNsplit(0);
-       8           0 :         setMinimalWeight(1.);
-       9           0 : }
-      10             : 
-      11           3 : CandidateSplitting::CandidateSplitting(int nSplit, double Emin, double Emax,  double nBins, double minWeight, bool log) {
-      12           3 :         setNsplit(nSplit);
-      13           3 :         setEnergyBins(Emin, Emax, nBins, log);
-      14           3 :         setMinimalWeight(minWeight);
-      15           3 : }
-      16             : 
-      17           1 : CandidateSplitting::CandidateSplitting(double spectralIndex, double Emin, int nBins)  {
-      18             :         // to use with Diffusive Shock Acceleration
-      19           1 :         if (spectralIndex > 0){
-      20           0 :                 throw std::runtime_error(
-      21           0 :                                 "CandidateSplitting: spectralIndex > 0 !"); 
-      22             :         }
-      23             : 
-      24           1 :         setNsplit(2); // always split in 2, calculate bins in energy for given spectrum:
-      25           1 :         double dE = pow(1. / 2, 1. / (spectralIndex + 1)); 
-      26           1 :         setEnergyBinsDSA(Emin, dE, nBins);
-      27           1 :         setMinimalWeight(1. / pow(2, nBins));
-      28           1 : }
-      29             : 
-      30           6 : void CandidateSplitting::process(Candidate *c) const {
-      31           6 :         double currE = c->current.getEnergy(); 
-      32           6 :         double prevE = c->previous.getEnergy();
-      33             : 
-      34           6 :         if (c->getWeight() <= minWeight){
-      35             :                 // minimal weight reached, no splitting
-      36             :                 return;
-      37             :         }
-      38           5 :         if (currE < Ebins[0] || nSplit == 0 ){
-      39             :                 // current energy is smaller than first bin -> no splitting
-      40             :                 // or, number of splits = 0
-      41             :                 return;
-      42             :         }
-      43           4 :         for (size_t i = 0; i < Ebins.size(); ++i){
-      44             :                 
-      45           4 :                 if( prevE < Ebins[i] ){
-      46             :                         // previous energy is in energy bin [i-1, i]
-      47           3 :                         if(currE < Ebins[i]){
-      48             :                                 //assuming that dE greater than 0, prevE and E in same energy bin -> no splitting
-      49             :                                 return;
-      50             :                         }
-      51             :                         // current energy is in energy bin [i,i+1] or higher -> particle splitting for each crossing
-      52           4 :                         for (size_t j = i; j < Ebins.size(); ++j ){
-      53             : 
-      54             :                                 // adapted from Acceleration Module:
-      55           4 :                                 c->updateWeight(1. / nSplit); // * 1/n_split
-      56             : 
-      57           8 :                                 for (int i = 1; i < nSplit; i++) {
-      58             :                                 
-      59           4 :                                         ref_ptr<Candidate> new_candidate = c->clone(false);
-      60           4 :                                         new_candidate->parent = c;
-      61           4 :                                         new_candidate->previous.setEnergy(currE); // so that new candidate is not split again in next step!
-      62             :                                         c->addSecondary(new_candidate);
-      63             :                                 }
-      64           4 :                                 if (j < Ebins.size()-1 && currE < Ebins[j+1]){
-      65             :                                         // candidate is in energy bin [j, j+1] -> no further splitting
-      66             :                                         return;
-      67             :                                 }
-      68             :                         }
-      69             :                         return;
-      70             :                 }
-      71             :         }
-      72             : }
-      73             : 
-      74           3 : void CandidateSplitting::setEnergyBins(double Emin, double Emax, double nBins, bool log) {
-      75           3 :         Ebins.resize(0);
-      76           3 :         if (Emin > Emax){
-      77           0 :                 throw std::runtime_error(
-      78           0 :                                 "CandidateSplitting: Emin > Emax!");
-      79             :         }
-      80           3 :         double dE = (Emax-Emin)/nBins;
-      81          14 :         for (size_t i = 0; i < nBins; ++i) {
-      82          11 :                 if (log == true) {
-      83           4 :                         Ebins.push_back(Emin * pow(Emax / Emin, i / (nBins - 1.0)));
-      84             :                 } else {
-      85           7 :                         Ebins.push_back(Emin + i * dE);
-      86             :                 }
-      87             :         }
-      88           3 : }
-      89             : 
-      90           1 : void CandidateSplitting::setEnergyBinsDSA(double Emin, double dE, int n) {
-      91           1 :         Ebins.resize(0);
-      92           5 :         for (size_t i = 1; i < n + 1; ++i) {
-      93           4 :                 Ebins.push_back(Emin * pow(dE, i));
-      94             :         }
-      95           1 : }
-      96             : 
-      97           6 : const std::vector<double>& CandidateSplitting::getEnergyBins() const {
-      98           6 :         return Ebins;
-      99             : }
-     100             : 
-     101           4 : void CandidateSplitting::setNsplit(int n) {
-     102           4 :         nSplit = n;
-     103           4 : }
-     104             : 
-     105           4 : void CandidateSplitting::setMinimalWeight(double w) {
-     106           4 :         minWeight = w;
-     107           4 : }
-     108             : 
-     109           1 : int CandidateSplitting::getNsplit() const {
-     110           1 :         return nSplit;
-     111             : }
-     112             : 
-     113           1 : double CandidateSplitting::getMinimalWeight() const {
-     114           1 :         return minWeight;
-     115             : }
-     116             : 
-     117             : } // end namespace crpropa
-     118             : 
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/DiffusionSDE.cpp.func-sort-c.html b/doc/coverageReport/src/module/DiffusionSDE.cpp.func-sort-c.html deleted file mode 100644 index 119a389bf..000000000 --- a/doc/coverageReport/src/module/DiffusionSDE.cpp.func-sort-c.html +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/DiffusionSDE.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - DiffusionSDE.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:15420276.2 %
Date:2024-04-08 14:58:22Functions:222588.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa12DiffusionSDE14getDescriptionB5cxx11Ev0
_ZNK7crpropa12DiffusionSDE16getMagneticFieldEv0
_ZNK7crpropa12DiffusionSDE17getAdvectionFieldEv0
_ZNK7crpropa12DiffusionSDE10getEpsilonEv1
_ZNK7crpropa12DiffusionSDE12getToleranceEv1
_ZNK7crpropa12DiffusionSDE14getMaximumStepEv1
_ZNK7crpropa12DiffusionSDE14getMinimumStepEv1
_ZN7crpropa12DiffusionSDE17setAdvectionFieldENS_7ref_ptrINS_14AdvectionFieldEEE3
_ZN7crpropa12DiffusionSDEC2ENS_7ref_ptrINS_13MagneticFieldEEENS1_INS_14AdvectionFieldEEEdddd3
_ZN7crpropa12DiffusionSDEC2ENS_7ref_ptrINS_13MagneticFieldEEEdddd4
_ZNK7crpropa12DiffusionSDE8getAlphaEv5
_ZNK7crpropa12DiffusionSDE8getScaleEv5
_ZN7crpropa12DiffusionSDE10setEpsilonEd7
_ZN7crpropa12DiffusionSDE12setToleranceEd7
_ZN7crpropa12DiffusionSDE14setMaximumStepEd7
_ZN7crpropa12DiffusionSDE14setMinimumStepEd7
_ZN7crpropa12DiffusionSDE16setMagneticFieldENS_7ref_ptrINS_13MagneticFieldEEE7
_ZN7crpropa12DiffusionSDE8setAlphaEd7
_ZN7crpropa12DiffusionSDE8setScaleEd7
_ZNK7crpropa12DiffusionSDE9driftStepERKNS_7Vector3IdEERS2_d120001
_ZNK7crpropa12DiffusionSDE27getAdvectionFieldAtPositionENS_7Vector3IdEE120002
_ZNK7crpropa12DiffusionSDE16calculateBTensorEdPdNS_7Vector3IdEES3_d480002
_ZNK7crpropa12DiffusionSDE7processEPNS_9CandidateE480003
_ZNK7crpropa12DiffusionSDE7tryStepERKNS_7Vector3IdEERS2_S5_dd960004
_ZNK7crpropa12DiffusionSDE26getMagneticFieldAtPositionENS_7Vector3IdEEd5760025
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/DiffusionSDE.cpp.func.html b/doc/coverageReport/src/module/DiffusionSDE.cpp.func.html deleted file mode 100644 index d4e981a1a..000000000 --- a/doc/coverageReport/src/module/DiffusionSDE.cpp.func.html +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/DiffusionSDE.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - DiffusionSDE.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:15420276.2 %
Date:2024-04-08 14:58:22Functions:222588.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa12DiffusionSDE10setEpsilonEd7
_ZN7crpropa12DiffusionSDE12setToleranceEd7
_ZN7crpropa12DiffusionSDE14setMaximumStepEd7
_ZN7crpropa12DiffusionSDE14setMinimumStepEd7
_ZN7crpropa12DiffusionSDE16setMagneticFieldENS_7ref_ptrINS_13MagneticFieldEEE7
_ZN7crpropa12DiffusionSDE17setAdvectionFieldENS_7ref_ptrINS_14AdvectionFieldEEE3
_ZN7crpropa12DiffusionSDE8setAlphaEd7
_ZN7crpropa12DiffusionSDE8setScaleEd7
_ZN7crpropa12DiffusionSDEC2ENS_7ref_ptrINS_13MagneticFieldEEENS1_INS_14AdvectionFieldEEEdddd3
_ZN7crpropa12DiffusionSDEC2ENS_7ref_ptrINS_13MagneticFieldEEEdddd4
_ZNK7crpropa12DiffusionSDE10getEpsilonEv1
_ZNK7crpropa12DiffusionSDE12getToleranceEv1
_ZNK7crpropa12DiffusionSDE14getDescriptionB5cxx11Ev0
_ZNK7crpropa12DiffusionSDE14getMaximumStepEv1
_ZNK7crpropa12DiffusionSDE14getMinimumStepEv1
_ZNK7crpropa12DiffusionSDE16calculateBTensorEdPdNS_7Vector3IdEES3_d480002
_ZNK7crpropa12DiffusionSDE16getMagneticFieldEv0
_ZNK7crpropa12DiffusionSDE17getAdvectionFieldEv0
_ZNK7crpropa12DiffusionSDE26getMagneticFieldAtPositionENS_7Vector3IdEEd5760025
_ZNK7crpropa12DiffusionSDE27getAdvectionFieldAtPositionENS_7Vector3IdEE120002
_ZNK7crpropa12DiffusionSDE7processEPNS_9CandidateE480003
_ZNK7crpropa12DiffusionSDE7tryStepERKNS_7Vector3IdEERS2_S5_dd960004
_ZNK7crpropa12DiffusionSDE8getAlphaEv5
_ZNK7crpropa12DiffusionSDE8getScaleEv5
_ZNK7crpropa12DiffusionSDE9driftStepERKNS_7Vector3IdEERS2_d120001
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/DiffusionSDE.cpp.gcov.html b/doc/coverageReport/src/module/DiffusionSDE.cpp.gcov.html deleted file mode 100644 index 51ca09aab..000000000 --- a/doc/coverageReport/src/module/DiffusionSDE.cpp.gcov.html +++ /dev/null @@ -1,480 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/DiffusionSDE.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - DiffusionSDE.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:15420276.2 %
Date:2024-04-08 14:58:22Functions:222588.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/DiffusionSDE.h"
-       2             : 
-       3             : 
-       4             : using namespace crpropa;
-       5             : 
-       6             : // Defining Cash-Karp coefficients
-       7             : const double a[] = { 0., 0., 0., 0., 0., 0., 1. / 5., 0., 0., 0., 0.,
-       8             :                 0., 3. / 40., 9. / 40., 0., 0., 0., 0., 3. / 10., -9. / 10., 6. / 5.,
-       9             :                 0., 0., 0., -11. / 54., 5. / 2., -70. / 27., 35. / 27., 0., 0., 1631.
-      10             :                                 / 55296., 175. / 512., 575. / 13824., 44275. / 110592., 253.
-      11             :                                 / 4096., 0. };
-      12             : 
-      13             : const double b[] = { 37. / 378., 0, 250. / 621., 125. / 594., 0., 512.
-      14             :                 / 1771. };
-      15             : 
-      16             : const double bs[] = { 2825. / 27648., 0., 18575. / 48384., 13525.
-      17             :                 / 55296., 277. / 14336., 1. / 4. };
-      18             : 
-      19             : 
-      20             : 
-      21           4 : DiffusionSDE::DiffusionSDE(ref_ptr<MagneticField> magneticField, double tolerance,
-      22           4 :                                  double minStep, double maxStep, double epsilon) :
-      23           4 :         minStep(0)
-      24             : {
-      25           4 :         setMagneticField(magneticField);
-      26           4 :         setMaximumStep(maxStep);
-      27           4 :         setMinimumStep(minStep);
-      28           4 :         setTolerance(tolerance);
-      29           4 :         setEpsilon(epsilon);
-      30           4 :         setScale(1.);
-      31           4 :         setAlpha(1./3.);
-      32           4 :         }
-      33             : 
-      34           3 : DiffusionSDE::DiffusionSDE(ref_ptr<MagneticField> magneticField, ref_ptr<AdvectionField> advectionField, double tolerance, double minStep, double maxStep, double epsilon) :
-      35           3 :         minStep(0)
-      36             : {
-      37           6 :         setMagneticField(magneticField);
-      38           3 :         setAdvectionField(advectionField);
-      39           3 :         setMaximumStep(maxStep);
-      40           3 :         setMinimumStep(minStep);
-      41           3 :         setTolerance(tolerance);
-      42           3 :         setEpsilon(epsilon);
-      43           3 :         setScale(1.);
-      44           3 :         setAlpha(1./3.);
-      45           3 :         }
-      46             : 
-      47      480003 : void DiffusionSDE::process(Candidate *candidate) const {
-      48             : 
-      49             :     // save the new previous particle state
-      50             : 
-      51      480003 :         ParticleState &current = candidate->current;
-      52             :         candidate->previous = current;
-      53             : 
-      54      480003 :         double h = clip(candidate->getNextStep(), minStep, maxStep) / c_light;
-      55      480003 :         Vector3d PosIn = current.getPosition();
-      56      480003 :         Vector3d DirIn = current.getDirection();
-      57             : 
-      58             :     // rectilinear propagation for neutral particles
-      59             :     // If an advection field is provided the drift is also included
-      60      480003 :         if (current.getCharge() == 0) {
-      61           1 :                 Vector3d dir = current.getDirection();
-      62           1 :                 Vector3d Pos = current.getPosition();
-      63             : 
-      64             :                 Vector3d LinProp(0.);
-      65           1 :                 if (advectionField){
-      66           0 :                         driftStep(Pos, LinProp, h);
-      67             :                 }
-      68             : 
-      69           1 :                 current.setPosition(Pos + LinProp + dir*h*c_light);
-      70           1 :                 candidate->setCurrentStep(h * c_light);
-      71           1 :                 candidate->setNextStep(maxStep);
-      72             :                 return;
-      73             :         }
-      74             : 
-      75      480002 :         double z = candidate->getRedshift();
-      76      480002 :         double rig = current.getEnergy() / current.getCharge();
-      77             : 
-      78             : 
-      79             :     // Calculate the Diffusion tensor
-      80      480002 :         double BTensor[] = {0., 0., 0., 0., 0., 0., 0., 0., 0.};
-      81      480002 :         calculateBTensor(rig, BTensor, PosIn, DirIn, z);
-      82             : 
-      83             : 
-      84             :     // Generate random numbers
-      85      480002 :         double eta[] = {0., 0., 0.};
-      86     1920008 :         for(size_t i=0; i < 3; i++) {
-      87     1440006 :                 eta[i] =  Random::instance().randNorm();
-      88             :         }
-      89             : 
-      90      480002 :         double TStep = BTensor[0] * eta[0];
-      91      480002 :         double NStep = BTensor[4] * eta[1];
-      92      480002 :         double BStep = BTensor[8] * eta[2];
-      93             : 
-      94             :         Vector3d TVec(0.);
-      95             :         Vector3d NVec(0.);
-      96             :         Vector3d BVec(0.);
-      97             : 
-      98             :         Vector3d DirOut = Vector3d(0.);
-      99             : 
-     100             : 
-     101      480002 :         double propTime = TStep * sqrt(h) / c_light;
-     102             :         size_t counter = 0;
-     103             :         double r=42.; //arbitrary number larger than one
-     104             : 
-     105             :         do {
-     106             :                 Vector3d PosOut = Vector3d(0.);
-     107             :                 Vector3d PosErr = Vector3d(0.);
-     108      480002 :                 tryStep(PosIn, PosOut, PosErr, z, propTime);
-     109             :             // calculate the relative position error r and the next time step h
-     110      480002 :                 r = PosErr.getR() / tolerance;
-     111      480002 :                 propTime *= 0.5;
-     112      480002 :                 counter += 1;
-     113             : 
-     114             :     // Check for better break condition
-     115      480002 :         } while (r > 1 && fabs(propTime) >= minStep/c_light);
-     116             : 
-     117             : 
-     118      480002 :         size_t stepNumber = pow(2, counter-1);
-     119      480002 :         double allowedTime = TStep * sqrt(h) / c_light / stepNumber;
-     120             :         Vector3d Start = PosIn;
-     121             :         Vector3d PosOut = Vector3d(0.);
-     122             :         Vector3d PosErr = Vector3d(0.);
-     123      960004 :         for (size_t j=0; j<stepNumber; j++) {
-     124      480002 :                 tryStep(Start, PosOut, PosErr, z, allowedTime);
-     125             :                 Start = PosOut;
-     126             :         }
-     127             : 
-     128             :     // Normalize the tangent vector
-     129      480002 :         TVec = (PosOut-PosIn).getUnitVector();
-     130             :     // Exception: If the magnetic field vanishes: Use only advection.
-     131             :     // If an advection field is not provided --> rectilinear propagation.
-     132             :         double tTest = TVec.getR();
-     133      480002 :         if (tTest != tTest) {
-     134           2 :                 Vector3d dir = current.getDirection();
-     135           2 :                 Vector3d Pos = current.getPosition();
-     136             :                 Vector3d LinProp(0.);
-     137           2 :                 if (advectionField){
-     138           1 :                         driftStep(Pos, LinProp, h);
-     139           1 :                         current.setPosition(Pos + LinProp);
-     140           1 :                         candidate->setCurrentStep(h*c_light);
-     141           1 :                         double newStep = 5*h*c_light;
-     142             :                         newStep = clip(newStep, minStep, maxStep);
-     143           1 :                         candidate->setNextStep(newStep);
-     144             :                         return;
-     145             :                 }
-     146           1 :                 current.setPosition(Pos + dir*h*c_light);
-     147           1 :                 candidate->setCurrentStep(h*c_light);
-     148           1 :                 double newStep = 5*h*c_light;
-     149           1 :                 newStep = clip(newStep, minStep, maxStep);
-     150           1 :                 candidate->setNextStep(newStep);
-     151           1 :                 return;
-     152             :         }
-     153             : 
-     154             :     // Choose a random perpendicular vector as the Normal-vector.
-     155             :     // Prevent 'nan's in the NVec-vector in the case of <TVec, NVec> = 0.
-     156      960000 :         while (NVec.getR()==0.){
-     157      480000 :                 Vector3d RandomVector = Random::instance().randVector();
-     158             :                 NVec = TVec.cross( RandomVector );
-     159             :         }
-     160      480000 :         NVec = NVec.getUnitVector();
-     161             : 
-     162             :     // Calculate the Binormal-vector
-     163      480000 :         BVec = (TVec.cross(NVec)).getUnitVector();
-     164             : 
-     165             :     // Calculate the advection step
-     166             :         Vector3d LinProp(0.);
-     167      480000 :         if (advectionField){
-     168      120000 :                 driftStep(PosIn, LinProp, h);
-     169             :         }
-     170             : 
-     171             :     // Integration of the SDE with a Mayorama-Euler-method
-     172      480000 :         Vector3d PO = PosOut + LinProp + (NVec * NStep + BVec * BStep) * sqrt(h) ;
-     173             : 
-     174             :     // Throw error message if something went wrong with propagation.
-     175             :     // Deactivate candidate.
-     176             :         bool NaN = std::isnan(PO.getR());
-     177      480000 :         if (NaN == true){
-     178           0 :                   candidate->setActive(false);
-     179           0 :                   KISS_LOG_WARNING
-     180           0 :                         << "\nCandidate with 'nan'-position occured: \n"
-     181           0 :                         << "position = " << PO << "\n"
-     182           0 :                         << "PosIn = " << PosIn << "\n"
-     183           0 :                         << "TVec = " << TVec << "\n"
-     184           0 :                         << "TStep = " << std::abs(TStep) << "\n"
-     185           0 :                         << "NVec = " << NVec << "\n"
-     186             :                         << "NStep = " << NStep << "\n"
-     187           0 :                         << "BVec = " << BVec << "\n"
-     188             :                         << "BStep = " << BStep << "\n"
-     189           0 :                         << "Candidate is deactivated!\n";
-     190             :                   return;
-     191             :         }
-     192             : 
-     193             :         //DirOut = (PO - PosIn - LinProp).getUnitVector(); //Advection does not change the momentum vector
-     194             :         // Random direction around the tangential direction accounts for the pitch angle average.
-     195      480000 :         DirOut = Random::instance().randConeVector(TVec, M_PI/2.);
-     196      480000 :         current.setPosition(PO);
-     197      480000 :         current.setDirection(DirOut);
-     198      480000 :         candidate->setCurrentStep(h * c_light);
-     199             : 
-     200             :         double nextStep;
-     201      480000 :         if (stepNumber>1){
-     202           0 :                 nextStep = h*pow(stepNumber, -2.)*c_light;
-     203             :         }
-     204             :         else {
-     205      480000 :                 nextStep = 4 * h*c_light;
-     206             :         }
-     207             : 
-     208      480000 :         candidate->setNextStep(nextStep);
-     209             : 
-     210             :         // Debugging and Testing
-     211             :         // Delete comments if additional information should be stored in candidate
-     212             :         // This property "arcLength" can be interpreted as the effective arclength
-     213             :         // of the propagation along a magnetic field line.
-     214             : 
-     215             : /*
-     216             :         const std::string AL = "arcLength";
-     217             :         if (candidate->hasProperty(AL) == false){
-     218             :           double arcLen = (TStep + NStep + BStep) * sqrt(h);
-     219             :           candidate->setProperty(AL, arcLen);
-     220             :           return;
-     221             :         }
-     222             :         else {
-     223             :           double arcLen = candidate->getProperty(AL);
-     224             :           arcLen += (TStep + NStep + BStep) * sqrt(h);
-     225             :           candidate->setProperty(AL, arcLen);
-     226             :         }
-     227             : */
-     228             : 
-     229             : }
-     230             : 
-     231             : 
-     232      960004 : void DiffusionSDE::tryStep(const Vector3d &PosIn, Vector3d &POut, Vector3d &PosErr,double z, double propStep) const {
-     233             : 
-     234             :         Vector3d k[] = {Vector3d(0.),Vector3d(0.),Vector3d(0.),Vector3d(0.),Vector3d(0.),Vector3d(0.)};
-     235             :         POut = PosIn;
-     236             :         //calculate the sum k_i * b_i
-     237     6720028 :         for (size_t i = 0; i < 6; i++) {
-     238             : 
-     239             :                 Vector3d y_n = PosIn;
-     240    20160084 :                 for (size_t j = 0; j < i; j++)
-     241    14400060 :                   y_n += k[j] * a[i * 6 + j] * propStep;
-     242             : 
-     243             :                 // update k_i = direction of the regular magnetic mean field
-     244     5760024 :                 Vector3d BField = getMagneticFieldAtPosition(y_n, z);
-     245             : 
-     246     5760024 :                 k[i] = BField.getUnitVector() * c_light;
-     247             : 
-     248     5760024 :                 POut += k[i] * b[i] * propStep;
-     249     5760024 :                 PosErr +=  (k[i] * (b[i] - bs[i])) * propStep / kpc;
-     250             : 
-     251             :         }
-     252      960004 : }
-     253             : 
-     254      120001 : void DiffusionSDE::driftStep(const Vector3d &pos, Vector3d &linProp, double h) const {
-     255      120001 :         Vector3d advField = getAdvectionFieldAtPosition(pos);
-     256             :         linProp += advField * h;
-     257      120001 :         return;
-     258             : }
-     259             : 
-     260      480002 : void DiffusionSDE::calculateBTensor(double r, double BTen[], Vector3d pos, Vector3d dir, double z) const {
-     261             : 
-     262      480002 :     double DifCoeff = scale * 6.1e24 * pow((std::abs(r) / 4.0e9), alpha);
-     263      480002 :     BTen[0] = pow( 2  * DifCoeff, 0.5);
-     264      480002 :     BTen[4] = pow(2 * epsilon * DifCoeff, 0.5);
-     265      480002 :     BTen[8] = pow(2 * epsilon * DifCoeff, 0.5);
-     266      480002 :     return;
-     267             : 
-     268             : }
-     269             : 
-     270             : 
-     271           7 : void DiffusionSDE::setMinimumStep(double min) {
-     272           7 :         if (min < 0)
-     273           0 :                 throw std::runtime_error("DiffusionSDE: minStep < 0 ");
-     274           7 :         if (min > maxStep)
-     275           0 :                 throw std::runtime_error("DiffusionSDE: minStep > maxStep");
-     276           7 :         minStep = min;
-     277           7 : }
-     278             : 
-     279           7 : void DiffusionSDE::setMaximumStep(double max) {
-     280           7 :         if (max < minStep)
-     281           0 :                 throw std::runtime_error("DiffusionSDE: maxStep < minStep");
-     282           7 :         maxStep = max;
-     283           7 : }
-     284             : 
-     285             : 
-     286           7 : void DiffusionSDE::setTolerance(double tol) {
-     287           7 :         if ((tol > 1) or (tol < 0))
-     288           0 :                 throw std::runtime_error(
-     289           0 :                                 "DiffusionSDE: tolerance error not in range 0-1");
-     290           7 :         tolerance = tol;
-     291           7 : }
-     292             : 
-     293           7 : void DiffusionSDE::setEpsilon(double e) {
-     294           7 :         if ((e > 1) or (e < 0))
-     295           0 :                 throw std::runtime_error(
-     296           0 :                                 "DiffusionSDE: epsilon not in range 0-1");
-     297           7 :         epsilon = e;
-     298           7 : }
-     299             : 
-     300             : 
-     301           7 : void DiffusionSDE::setAlpha(double a) {
-     302           7 :         if ((a > 2.) or (a < 0))
-     303           0 :                 throw std::runtime_error(
-     304           0 :                                 "DiffusionSDE: alpha not in range 0-2");
-     305           7 :         alpha = a;
-     306           7 : }
-     307             : 
-     308           7 : void DiffusionSDE::setScale(double s) {
-     309           7 :         if (s < 0)
-     310           0 :                 throw std::runtime_error(
-     311           0 :                                 "DiffusionSDE: Scale error: Scale < 0");
-     312           7 :         scale = s;
-     313           7 : }
-     314             : 
-     315           7 : void DiffusionSDE::setMagneticField(ref_ptr<MagneticField> f) {
-     316           7 :         magneticField = f;
-     317           7 : }
-     318             : 
-     319           3 : void DiffusionSDE::setAdvectionField(ref_ptr<AdvectionField> f) {
-     320           3 :         advectionField = f;
-     321           3 : }
-     322             : 
-     323           1 : double DiffusionSDE::getMinimumStep() const {
-     324           1 :         return minStep;
-     325             : }
-     326             : 
-     327           1 : double DiffusionSDE::getMaximumStep() const {
-     328           1 :         return maxStep;
-     329             : }
-     330             : 
-     331           1 : double DiffusionSDE::getTolerance() const {
-     332           1 :         return tolerance;
-     333             : }
-     334             : 
-     335           1 : double DiffusionSDE::getEpsilon() const {
-     336           1 :         return epsilon;
-     337             : }
-     338             : 
-     339           5 : double DiffusionSDE::getAlpha() const {
-     340           5 :         return alpha;
-     341             : }
-     342             : 
-     343           5 : double DiffusionSDE::getScale() const {
-     344           5 :         return scale;
-     345             : }
-     346             : 
-     347           0 : ref_ptr<MagneticField> DiffusionSDE::getMagneticField() const {
-     348           0 :         return magneticField;
-     349             : }
-     350             : 
-     351     5760025 : Vector3d DiffusionSDE::getMagneticFieldAtPosition(Vector3d pos, double z) const {
-     352             :         Vector3d B(0, 0, 0);
-     353             :         try {
-     354             :                 // check if field is valid and use the field vector at the
-     355             :                 // position pos with the redshift z
-     356     5760025 :                 if (magneticField.valid())
-     357     5760025 :                         B = magneticField->getField(pos, z);
-     358             :         }
-     359           0 :         catch (std::exception &e) {
-     360           0 :                 KISS_LOG_ERROR  << "DiffusionSDE: Exception in DiffusionSDE::getMagneticFieldAtPosition.\n"
-     361           0 :                                 << e.what();
-     362           0 :         }       
-     363     5760025 :         return B;
-     364             : }
-     365             : 
-     366           0 : ref_ptr<AdvectionField> DiffusionSDE::getAdvectionField() const {
-     367           0 :         return advectionField;
-     368             : }
-     369             : 
-     370      120002 : Vector3d DiffusionSDE::getAdvectionFieldAtPosition(Vector3d pos) const {
-     371             :         Vector3d AdvField(0.);
-     372             :         try {
-     373             :                 // check if field is valid and use the field vector at the
-     374             :                 // position pos
-     375      120002 :                 if (advectionField.valid())
-     376      120002 :                         AdvField = advectionField->getField(pos);
-     377             :         }
-     378           0 :         catch (std::exception &e) {
-     379           0 :                 KISS_LOG_ERROR  << "DiffusionSDE: Exception in DiffusionSDE::getAdvectionFieldAtPosition.\n"
-     380           0 :                                 << e.what();
-     381           0 :         }
-     382      120002 :         return AdvField;
-     383             : }
-     384             : 
-     385           0 : std::string DiffusionSDE::getDescription() const {
-     386           0 :         std::stringstream s;
-     387           0 :         s << "minStep: " << minStep / kpc  << " kpc, ";
-     388           0 :         s << "maxStep: " << maxStep / kpc  << " kpc, ";
-     389           0 :         s << "tolerance: " << tolerance << "\n";
-     390             : 
-     391           0 :         if (epsilon != 0.1) {
-     392           0 :           s << "epsilon: " << epsilon << ", ";
-     393             :           }
-     394             : 
-     395           0 :         if (alpha != 1./3.) {
-     396           0 :           s << "alpha: " << alpha << "\n";
-     397             :           }
-     398             : 
-     399           0 :         if (scale != 1.) {
-     400           0 :           s << "D_0: " << scale*6.1e24 << " m^2/s" << "\n";
-     401             :           }
-     402             : 
-     403           0 :         return s.str();
-     404           0 : }
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/EMDoublePairProduction.cpp.func-sort-c.html b/doc/coverageReport/src/module/EMDoublePairProduction.cpp.func-sort-c.html deleted file mode 100644 index a80dbd404..000000000 --- a/doc/coverageReport/src/module/EMDoublePairProduction.cpp.func-sort-c.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/EMDoublePairProduction.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - EMDoublePairProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:687294.4 %
Date:2024-04-08 14:58:22Functions:1010100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa22EMDoublePairProduction17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZNK7crpropa22EMDoublePairProduction18performInteractionEPNS_9CandidateE1
_ZNK7crpropa22EMDoublePairProduction7processEPNS_9CandidateE1
_ZNK7crpropa22EMDoublePairProduction17getInteractionTagB5cxx11Ev2
_ZN7crpropa22EMDoublePairProduction11setThinningEd3
_ZN7crpropa22EMDoublePairProduction8setLimitEd3
_ZN7crpropa22EMDoublePairProductionC2ENS_7ref_ptrINS_11PhotonFieldEEEbdd3
_ZN7crpropa22EMDoublePairProduction16setHaveElectronsEb4
_ZN7crpropa22EMDoublePairProduction14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE15
_ZN7crpropa22EMDoublePairProduction8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE15
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/EMDoublePairProduction.cpp.func.html b/doc/coverageReport/src/module/EMDoublePairProduction.cpp.func.html deleted file mode 100644 index 4e691a3a6..000000000 --- a/doc/coverageReport/src/module/EMDoublePairProduction.cpp.func.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/EMDoublePairProduction.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - EMDoublePairProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:687294.4 %
Date:2024-04-08 14:58:22Functions:1010100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa22EMDoublePairProduction11setThinningEd3
_ZN7crpropa22EMDoublePairProduction14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE15
_ZN7crpropa22EMDoublePairProduction16setHaveElectronsEb4
_ZN7crpropa22EMDoublePairProduction17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa22EMDoublePairProduction8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE15
_ZN7crpropa22EMDoublePairProduction8setLimitEd3
_ZN7crpropa22EMDoublePairProductionC2ENS_7ref_ptrINS_11PhotonFieldEEEbdd3
_ZNK7crpropa22EMDoublePairProduction17getInteractionTagB5cxx11Ev2
_ZNK7crpropa22EMDoublePairProduction18performInteractionEPNS_9CandidateE1
_ZNK7crpropa22EMDoublePairProduction7processEPNS_9CandidateE1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/EMDoublePairProduction.cpp.gcov.html b/doc/coverageReport/src/module/EMDoublePairProduction.cpp.gcov.html deleted file mode 100644 index 5469562c6..000000000 --- a/doc/coverageReport/src/module/EMDoublePairProduction.cpp.gcov.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/EMDoublePairProduction.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - EMDoublePairProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:687294.4 %
Date:2024-04-08 14:58:22Functions:1010100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/EMDoublePairProduction.h"
-       2             : #include "crpropa/Units.h"
-       3             : #include "crpropa/Random.h"
-       4             : 
-       5             : #include <fstream>
-       6             : #include <limits>
-       7             : #include <stdexcept>
-       8             : 
-       9             : namespace crpropa {
-      10             : 
-      11           3 : EMDoublePairProduction::EMDoublePairProduction(ref_ptr<PhotonField> photonField, bool haveElectrons, double thinning, double limit) {
-      12           3 :         setPhotonField(photonField);
-      13           3 :         setHaveElectrons(haveElectrons);
-      14           3 :         setLimit(limit);
-      15           3 :         setThinning(thinning);
-      16           3 : }
-      17             : 
-      18          15 : void EMDoublePairProduction::setPhotonField(ref_ptr<PhotonField> photonField) {
-      19          15 :         this->photonField = photonField;
-      20          15 :         std::string fname = photonField->getFieldName();
-      21          15 :         setDescription("EMDoublePairProduction: " + fname);
-      22          45 :         initRate(getDataPath("EMDoublePairProduction/rate_" + fname + ".txt"));
-      23          15 : }
-      24             : 
-      25           4 : void EMDoublePairProduction::setHaveElectrons(bool haveElectrons) {
-      26           4 :         this->haveElectrons = haveElectrons;
-      27           4 : }
-      28             : 
-      29           3 : void EMDoublePairProduction::setLimit(double limit) {
-      30           3 :         this->limit = limit;
-      31           3 : }
-      32             : 
-      33           3 : void EMDoublePairProduction::setThinning(double thinning) {
-      34           3 :         this->thinning = thinning;
-      35           3 : }
-      36             : 
-      37          15 : void EMDoublePairProduction::initRate(std::string filename) {
-      38          15 :         std::ifstream infile(filename.c_str());
-      39             : 
-      40          15 :         if (!infile.good())
-      41           0 :                 throw std::runtime_error("EMDoublePairProduction: could not open file " + filename);
-      42             : 
-      43             :         // clear previously loaded interaction rates
-      44          15 :         tabEnergy.clear();
-      45          15 :         tabRate.clear();
-      46             : 
-      47        3306 :         while (infile.good()) {
-      48        3291 :                 if (infile.peek() != '#') {
-      49             :                         double a, b;
-      50             :                         infile >> a >> b;
-      51        3231 :                         if (infile) {
-      52        3216 :                                 tabEnergy.push_back(pow(10, a) * eV);
-      53        3216 :                                 tabRate.push_back(b / Mpc);
-      54             :                         }
-      55             :                 }
-      56        3291 :                 infile.ignore(std::numeric_limits < std::streamsize > ::max(), '\n');
-      57             :         }
-      58          15 :         infile.close();
-      59          15 : }
-      60             : 
-      61             : 
-      62           1 : void EMDoublePairProduction::performInteraction(Candidate *candidate) const {
-      63             :         // the photon is lost after the interaction
-      64           1 :         candidate->setActive(false);
-      65             : 
-      66           1 :         if (not haveElectrons)
-      67           0 :                 return;
-      68             : 
-      69             :         // Use assumption of Lee 96 arXiv:9604098
-      70             :         // Energy is equally shared between one e+e- pair, but take mass of second e+e- pair into account.
-      71             :         // This approximation has been shown to be valid within -1.5%.
-      72           1 :         double z = candidate->getRedshift();
-      73           1 :         double E = candidate->current.getEnergy() * (1 + z);
-      74           1 :         double Ee = (E - 2 * mass_electron * c_squared) / 2;
-      75             : 
-      76           1 :         Random &random = Random::instance();
-      77           1 :         Vector3d pos = random.randomInterpolatedPosition(candidate->previous.getPosition(), candidate->current.getPosition());
-      78             : 
-      79           1 :         double f = Ee / E;
-      80             : 
-      81           1 :         if (haveElectrons) {
-      82           1 :                 if (random.rand() < pow(1 - f, thinning)) {
-      83           1 :                         double w = 1. / pow(1 - f, thinning);
-      84           1 :                         candidate->addSecondary( 11, Ee / (1 + z), pos, w, interactionTag);
-      85             :                 } 
-      86           1 :                 if (random.rand() < pow(f, thinning)) {
-      87           1 :                         double w = 1. / pow(f, thinning);
-      88           1 :                         candidate->addSecondary(-11, Ee / (1 + z), pos, w, interactionTag);
-      89             :                 }
-      90             :         }
-      91             : }
-      92             : 
-      93           1 : void EMDoublePairProduction::process(Candidate *candidate) const {
-      94             :         // check if photon
-      95           1 :         if (candidate->current.getId() != 22)
-      96             :                 return;
-      97             : 
-      98             :         // scale the electron energy instead of background photons
-      99           1 :         double z = candidate->getRedshift();
-     100           1 :         double E = (1 + z) * candidate->current.getEnergy();
-     101             : 
-     102             :         // check if in tabulated energy range
-     103           1 :         if (E < tabEnergy.front() or (E > tabEnergy.back()))
-     104             :                 return;
-     105             : 
-     106             :         // interaction rate
-     107           1 :         double rate = interpolate(E, tabEnergy, tabRate);
-     108           1 :         rate *= pow_integer<2>(1 + z) * photonField->getRedshiftScaling(z);
-     109             : 
-     110             :         // check for interaction
-     111           1 :         Random &random = Random::instance();
-     112           1 :         double randDistance = -log(random.rand()) / rate;
-     113           1 :         double step = candidate->getCurrentStep();
-     114           1 :         if (step < randDistance) {
-     115           1 :                 candidate->limitNextStep(limit / rate);
-     116           1 :                 return;
-     117             :         } else { // after performing interaction photon ceases to exist (hence return)
-     118           0 :                 performInteraction(candidate);
-     119           0 :                 return;
-     120             :         }
-     121             : 
-     122             : }
-     123             : 
-     124           1 : void EMDoublePairProduction::setInteractionTag(std::string tag) {
-     125           1 :         interactionTag = tag;
-     126           1 : }
-     127             : 
-     128           2 : std::string EMDoublePairProduction::getInteractionTag() const {
-     129           2 :         return interactionTag;
-     130             : }
-     131             : 
-     132             : 
-     133             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/EMInverseComptonScattering.cpp.func-sort-c.html b/doc/coverageReport/src/module/EMInverseComptonScattering.cpp.func-sort-c.html deleted file mode 100644 index 8878c9d70..000000000 --- a/doc/coverageReport/src/module/EMInverseComptonScattering.cpp.func-sort-c.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/EMInverseComptonScattering.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - EMInverseComptonScattering.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:12813396.2 %
Date:2024-04-08 14:58:22Functions:1313100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa26EMInverseComptonScattering17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa32ICSSecondariesEnergyDistribution6sampleEdd1
_ZN7crpropa32ICSSecondariesEnergyDistributionC2Ev1
_ZNK7crpropa26EMInverseComptonScattering18performInteractionEPNS_9CandidateE1
_ZNK7crpropa26EMInverseComptonScattering17getInteractionTagB5cxx11Ev2
_ZN7crpropa26EMInverseComptonScattering11setThinningEd5
_ZN7crpropa26EMInverseComptonScattering8setLimitEd5
_ZN7crpropa26EMInverseComptonScatteringC2ENS_7ref_ptrINS_11PhotonFieldEEEbdd5
_ZN7crpropa26EMInverseComptonScattering14setHavePhotonsEb6
_ZN7crpropa26EMInverseComptonScattering14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE17
_ZN7crpropa26EMInverseComptonScattering18initCumulativeRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE17
_ZN7crpropa26EMInverseComptonScattering8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE17
_ZNK7crpropa26EMInverseComptonScattering7processEPNS_9CandidateE15285
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/EMInverseComptonScattering.cpp.func.html b/doc/coverageReport/src/module/EMInverseComptonScattering.cpp.func.html deleted file mode 100644 index aa4472145..000000000 --- a/doc/coverageReport/src/module/EMInverseComptonScattering.cpp.func.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/EMInverseComptonScattering.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - EMInverseComptonScattering.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:12813396.2 %
Date:2024-04-08 14:58:22Functions:1313100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa26EMInverseComptonScattering11setThinningEd5
_ZN7crpropa26EMInverseComptonScattering14setHavePhotonsEb6
_ZN7crpropa26EMInverseComptonScattering14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE17
_ZN7crpropa26EMInverseComptonScattering17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa26EMInverseComptonScattering18initCumulativeRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE17
_ZN7crpropa26EMInverseComptonScattering8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE17
_ZN7crpropa26EMInverseComptonScattering8setLimitEd5
_ZN7crpropa26EMInverseComptonScatteringC2ENS_7ref_ptrINS_11PhotonFieldEEEbdd5
_ZN7crpropa32ICSSecondariesEnergyDistribution6sampleEdd1
_ZN7crpropa32ICSSecondariesEnergyDistributionC2Ev1
_ZNK7crpropa26EMInverseComptonScattering17getInteractionTagB5cxx11Ev2
_ZNK7crpropa26EMInverseComptonScattering18performInteractionEPNS_9CandidateE1
_ZNK7crpropa26EMInverseComptonScattering7processEPNS_9CandidateE15285
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/EMInverseComptonScattering.cpp.gcov.html b/doc/coverageReport/src/module/EMInverseComptonScattering.cpp.gcov.html deleted file mode 100644 index c5f4dfec4..000000000 --- a/doc/coverageReport/src/module/EMInverseComptonScattering.cpp.gcov.html +++ /dev/null @@ -1,325 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/EMInverseComptonScattering.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - EMInverseComptonScattering.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:12813396.2 %
Date:2024-04-08 14:58:22Functions:1313100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/EMInverseComptonScattering.h"
-       2             : #include "crpropa/Units.h"
-       3             : #include "crpropa/Random.h"
-       4             : #include "crpropa/Common.h"
-       5             : 
-       6             : #include <fstream>
-       7             : #include <limits>
-       8             : #include <stdexcept>
-       9             : 
-      10             : namespace crpropa {
-      11             : 
-      12             : static const double mec2 = mass_electron * c_squared;
-      13             : 
-      14           5 : EMInverseComptonScattering::EMInverseComptonScattering(ref_ptr<PhotonField> photonField, bool havePhotons, double thinning, double limit) {
-      15           5 :         setPhotonField(photonField);
-      16           5 :         setHavePhotons(havePhotons);
-      17           5 :         setLimit(limit);
-      18           5 :         setThinning(thinning);
-      19           5 : }
-      20             : 
-      21          17 : void EMInverseComptonScattering::setPhotonField(ref_ptr<PhotonField> photonField) {
-      22          17 :         this->photonField = photonField;
-      23          17 :         std::string fname = photonField->getFieldName();
-      24          17 :         setDescription("EMInverseComptonScattering: " + fname);
-      25          51 :         initRate(getDataPath("EMInverseComptonScattering/rate_" + fname + ".txt"));
-      26          51 :         initCumulativeRate(getDataPath("EMInverseComptonScattering/cdf_" + fname + ".txt"));
-      27          17 : }
-      28             : 
-      29           6 : void EMInverseComptonScattering::setHavePhotons(bool havePhotons) {
-      30           6 :         this->havePhotons = havePhotons;
-      31           6 : }
-      32             : 
-      33           5 : void EMInverseComptonScattering::setLimit(double limit) {
-      34           5 :         this->limit = limit;
-      35           5 : }
-      36             : 
-      37           5 : void EMInverseComptonScattering::setThinning(double thinning) {
-      38           5 :         this->thinning = thinning;
-      39           5 : }
-      40             : 
-      41          17 : void EMInverseComptonScattering::initRate(std::string filename) {
-      42          17 :         std::ifstream infile(filename.c_str());
-      43             : 
-      44          17 :         if (!infile.good())
-      45           0 :                 throw std::runtime_error("EMInverseComptonScattering: could not open file " + filename);
-      46             : 
-      47             :         // clear previously loaded tables
-      48          17 :         tabEnergy.clear();
-      49          17 :         tabRate.clear();
-      50             : 
-      51        4879 :         while (infile.good()) {
-      52        4862 :                 if (infile.peek() != '#') {
-      53             :                         double a, b;
-      54             :                         infile >> a >> b;
-      55        4794 :                         if (infile) {
-      56        4777 :                                 tabEnergy.push_back(pow(10, a) * eV);
-      57        4777 :                                 tabRate.push_back(b / Mpc);
-      58             :                         }
-      59             :                 }
-      60        4862 :                 infile.ignore(std::numeric_limits < std::streamsize > ::max(), '\n');
-      61             :         }
-      62          17 :         infile.close();
-      63          17 : }
-      64             : 
-      65          17 : void EMInverseComptonScattering::initCumulativeRate(std::string filename) {
-      66          17 :         std::ifstream infile(filename.c_str());
-      67             : 
-      68          17 :         if (!infile.good())
-      69           0 :                 throw std::runtime_error("EMInverseComptonScattering: could not open file " + filename);
-      70             : 
-      71             :         // clear previously loaded tables
-      72          17 :         tabE.clear();
-      73          17 :         tabs.clear();
-      74          17 :         tabCDF.clear();
-      75             :         
-      76             :         // skip header
-      77          85 :         while (infile.peek() == '#')
-      78          68 :                 infile.ignore(std::numeric_limits < std::streamsize > ::max(), '\n');
-      79             : 
-      80             :         // read s values in first line
-      81             :         double a;
-      82             :         infile >> a; // skip first value
-      83        3000 :         while (infile.good() and (infile.peek() != '\n')) {
-      84             :                 infile >> a;
-      85        2983 :                 tabs.push_back(pow(10, a) * eV * eV);
-      86             :         }
-      87             : 
-      88             :         // read all following lines: E, cdf values
-      89        4794 :         while (infile.good()) {
-      90             :                 infile >> a;
-      91        4794 :                 if (!infile)
-      92             :                         break;  // end of file
-      93        4777 :                 tabE.push_back(pow(10, a) * eV);
-      94             :                 std::vector<double> cdf;
-      95      843000 :                 for (int i = 0; i < tabs.size(); i++) {
-      96             :                         infile >> a;
-      97      838223 :                         cdf.push_back(a / Mpc);
-      98             :                 }
-      99        4777 :                 tabCDF.push_back(cdf);
-     100             :         }
-     101          17 :         infile.close();
-     102          17 : }
-     103             : 
-     104             : // Class to calculate the energy distribution of the ICS photon and to sample from it
-     105             : class ICSSecondariesEnergyDistribution {
-     106             :         private:
-     107             :                 std::vector< std::vector<double> > data;
-     108             :                 std::vector<double> s_values;
-     109             :                 size_t Ns;
-     110             :                 size_t Nrer;
-     111             :                 double s_min;
-     112             :                 double s_max;
-     113             :                 double dls;
-     114             : 
-     115             :         public:
-     116             :                 // differential cross-section, see Lee '96 (arXiv:9604098), eq. 23 for x = Ee'/Ee
-     117             :                 double dSigmadE(double x, double beta) {
-     118     1000000 :                         double q = ((1 - beta) / beta) * (1 - 1./x);
-     119     1000000 :                         return ((1 + beta) / beta) * (x + 1./x + 2 * q + q * q);
-     120             :                 }
-     121             : 
-     122             :                 // create the cumulative energy distribution of the up-scattered photon
-     123           1 :                 ICSSecondariesEnergyDistribution() {
-     124           1 :                         Ns = 1000;
-     125           1 :                         Nrer = 1000;
-     126           1 :                         s_min = mec2 * mec2;
-     127           1 :                         s_max = 2e23 * eV * eV;
-     128           1 :                         dls = (log(s_max) - log(s_min)) / Ns;
-     129           1 :                         data = std::vector< std::vector<double> >(1000, std::vector<double>(1000));
-     130           1 :                         std::vector<double> data_i(1000);
-     131             : 
-     132             :                         // tabulate s bin borders
-     133           1 :                         s_values = std::vector<double>(1001);
-     134        1002 :                         for (size_t i = 0; i < Ns + 1; ++i)
-     135        1001 :                                 s_values[i] = s_min * exp(i*dls);
-     136             : 
-     137             : 
-     138             :                         // for each s tabulate cumulative differential cross section
-     139        1001 :                         for (size_t i = 0; i < Ns; i++) {
-     140        1000 :                                 double s = s_min * exp((i+0.5) * dls);
-     141        1000 :                                 double beta = (s - s_min) / (s + s_min);
-     142        1000 :                                 double x0 = (1 - beta) / (1 + beta);
-     143        1000 :                                 double dlx = -log(x0) / Nrer;
-     144             : 
-     145             :                                 // cumulative midpoint integration
-     146        1000 :                                 data_i[0] = dSigmadE(x0, beta) * expm1(dlx);
-     147     1000000 :                                 for (size_t j = 1; j < Nrer; j++) {
-     148      999000 :                                         double x = x0 * exp((j+0.5) * dlx);
-     149      999000 :                                         double dx = exp((j+1) * dlx) - exp(j * dlx);
-     150      999000 :                                         data_i[j] = dSigmadE(x, beta) * dx;
-     151      999000 :                                         data_i[j] += data_i[j-1];
-     152             :                                 }
-     153        1000 :                                 data[i] = data_i;
-     154             :                         }
-     155           1 :                 }
-     156             : 
-     157             :                 // draw random energy for the up-scattered photon Ep(Ee, s)
-     158           1 :                 double sample(double Ee, double s) {
-     159           1 :                         size_t idx = std::lower_bound(s_values.begin(), s_values.end(), s) - s_values.begin();
-     160           1 :                         std::vector<double> s0 = data[idx];
-     161           1 :                         Random &random = Random::instance();
-     162           1 :                         size_t j = random.randBin(s0) + 1; // draw random bin (upper bin boundary returned)
-     163           1 :                         double beta = (s - s_min) / (s + s_min);
-     164           1 :                         double x0 = (1 - beta) / (1 + beta);
-     165           1 :                         double dlx = -log(x0) / Nrer;
-     166           1 :                         double binWidth = x0 * (exp(j * dlx) - exp((j-1) * dlx));
-     167           1 :                         double Ep = (x0 * exp((j-1) * dlx) + binWidth) * Ee;
-     168           2 :                         return std::min(Ee, Ep); // prevent Ep > Ee from numerical inaccuracies
-     169             :                 }
-     170             : };
-     171             : 
-     172           1 : void EMInverseComptonScattering::performInteraction(Candidate *candidate) const {
-     173             :         // scale the particle energy instead of background photons
-     174           1 :         double z = candidate->getRedshift();
-     175           1 :         double E = candidate->current.getEnergy() * (1 + z);
-     176             : 
-     177           1 :         if (E < tabE.front() or E > tabE.back())
-     178             :                 return;
-     179             : 
-     180             :         // sample the value of s
-     181           1 :         Random &random = Random::instance();
-     182           1 :         size_t i = closestIndex(E, tabE);
-     183           1 :         size_t j = random.randBin(tabCDF[i]);
-     184           1 :         double s_kin = pow(10, log10(tabs[j]) + (random.rand() - 0.5) * 0.1);
-     185           1 :         double s = s_kin + mec2 * mec2;
-     186             : 
-     187             :         // sample electron energy after scattering
-     188           1 :         static ICSSecondariesEnergyDistribution distribution;
-     189           1 :         double Enew = distribution.sample(E, s);
-     190             : 
-     191             :         // add up-scattered photon
-     192           1 :         double Esecondary = E - Enew;
-     193           1 :         double f = Enew / E;
-     194           1 :         if (havePhotons) {
-     195           1 :                 if (random.rand() < pow(1 - f, thinning)) {
-     196           1 :                         double w = 1. / pow(1 - f, thinning);
-     197           1 :                         Vector3d pos = random.randomInterpolatedPosition(candidate->previous.getPosition(), candidate->current.getPosition());
-     198           1 :                         candidate->addSecondary(22, Esecondary / (1 + z), pos, w, interactionTag);
-     199             :                 }
-     200             :         }
-     201             : 
-     202             :         // update the primary particle energy; do this after adding the secondary to correctly set the secondary's parent
-     203           1 :         candidate->current.setEnergy(Enew / (1 + z));
-     204             : }
-     205             : 
-     206       15285 : void EMInverseComptonScattering::process(Candidate *candidate) const {
-     207             :         // check if electron / positron
-     208       15285 :         int id = candidate->current.getId();
-     209       15285 :         if (abs(id) != 11)
-     210             :                 return;
-     211             : 
-     212             :         // scale the particle energy instead of background photons
-     213           1 :         double z = candidate->getRedshift();
-     214           1 :         double E = candidate->current.getEnergy() * (1 + z);
-     215             : 
-     216           1 :         if (E < tabEnergy.front() or (E > tabEnergy.back()))
-     217             :                 return;
-     218             : 
-     219             :         // interaction rate
-     220           1 :         double rate = interpolate(E, tabEnergy, tabRate);
-     221           1 :         rate *= pow_integer<2>(1 + z) * photonField->getRedshiftScaling(z);
-     222             : 
-     223             :         // run this loop at least once to limit the step size
-     224           1 :         double step = candidate->getCurrentStep();
-     225           1 :         Random &random = Random::instance();
-     226             :         do {
-     227           1 :                 double randDistance = -log(random.rand()) / rate;
-     228             : 
-     229             :                 // check for interaction; if it doesn't ocurr, limit next step
-     230           1 :                 if (step < randDistance) {
-     231           1 :                         candidate->limitNextStep(limit / rate);
-     232           1 :                         return;
-     233             :                 }
-     234           0 :                 performInteraction(candidate);
-     235             : 
-     236             :                 // repeat with remaining step
-     237           0 :                 step -= randDistance;
-     238           0 :         } while (step > 0);
-     239             : }
-     240             : 
-     241           1 : void EMInverseComptonScattering::setInteractionTag(std::string tag) {
-     242           1 :         interactionTag = tag;
-     243           1 : }
-     244             : 
-     245           2 : std::string EMInverseComptonScattering::getInteractionTag() const {
-     246           2 :         return interactionTag;
-     247             : }
-     248             : 
-     249             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/EMPairProduction.cpp.func-sort-c.html b/doc/coverageReport/src/module/EMPairProduction.cpp.func-sort-c.html deleted file mode 100644 index 084270148..000000000 --- a/doc/coverageReport/src/module/EMPairProduction.cpp.func-sort-c.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/EMPairProduction.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - EMPairProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13413797.8 %
Date:2024-04-08 14:58:22Functions:1313100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16EMPairProduction17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa31PPSecondariesEnergyDistributionC2Ev1
_ZNK7crpropa16EMPairProduction17getInteractionTagB5cxx11Ev2
_ZN7crpropa16EMPairProduction8setLimitEd9
_ZN7crpropa16EMPairProductionC2ENS_7ref_ptrINS_11PhotonFieldEEEbdd9
_ZN7crpropa16EMPairProduction11setThinningEd13
_ZN7crpropa16EMPairProduction16setHaveElectronsEb14
_ZN7crpropa16EMPairProduction14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE33
_ZN7crpropa16EMPairProduction18initCumulativeRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE33
_ZN7crpropa16EMPairProduction8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE33
_ZN7crpropa31PPSecondariesEnergyDistribution6sampleEdd563
_ZNK7crpropa16EMPairProduction18performInteractionEPNS_9CandidateE563
_ZNK7crpropa16EMPairProduction7processEPNS_9CandidateE16965
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/EMPairProduction.cpp.func.html b/doc/coverageReport/src/module/EMPairProduction.cpp.func.html deleted file mode 100644 index 082cd9399..000000000 --- a/doc/coverageReport/src/module/EMPairProduction.cpp.func.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/EMPairProduction.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - EMPairProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13413797.8 %
Date:2024-04-08 14:58:22Functions:1313100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16EMPairProduction11setThinningEd13
_ZN7crpropa16EMPairProduction14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE33
_ZN7crpropa16EMPairProduction16setHaveElectronsEb14
_ZN7crpropa16EMPairProduction17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa16EMPairProduction18initCumulativeRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE33
_ZN7crpropa16EMPairProduction8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE33
_ZN7crpropa16EMPairProduction8setLimitEd9
_ZN7crpropa16EMPairProductionC2ENS_7ref_ptrINS_11PhotonFieldEEEbdd9
_ZN7crpropa31PPSecondariesEnergyDistribution6sampleEdd563
_ZN7crpropa31PPSecondariesEnergyDistributionC2Ev1
_ZNK7crpropa16EMPairProduction17getInteractionTagB5cxx11Ev2
_ZNK7crpropa16EMPairProduction18performInteractionEPNS_9CandidateE563
_ZNK7crpropa16EMPairProduction7processEPNS_9CandidateE16965
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/EMPairProduction.cpp.gcov.html b/doc/coverageReport/src/module/EMPairProduction.cpp.gcov.html deleted file mode 100644 index b3986bf74..000000000 --- a/doc/coverageReport/src/module/EMPairProduction.cpp.gcov.html +++ /dev/null @@ -1,340 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/EMPairProduction.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - EMPairProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13413797.8 %
Date:2024-04-08 14:58:22Functions:1313100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/EMPairProduction.h"
-       2             : #include "crpropa/Units.h"
-       3             : #include "crpropa/Random.h"
-       4             : 
-       5             : #include <fstream>
-       6             : #include <limits>
-       7             : #include <stdexcept>
-       8             : 
-       9             : 
-      10             : namespace crpropa {
-      11             : 
-      12             : static const double mec2 = mass_electron * c_squared;
-      13             : 
-      14           9 : EMPairProduction::EMPairProduction(ref_ptr<PhotonField> photonField, bool haveElectrons, double thinning, double limit) {
-      15           9 :         setPhotonField(photonField);
-      16           9 :         setThinning(thinning);
-      17           9 :         setLimit(limit);
-      18           9 :         setHaveElectrons(haveElectrons);
-      19           9 : }
-      20             : 
-      21          33 : void EMPairProduction::setPhotonField(ref_ptr<PhotonField> photonField) {
-      22          33 :         this->photonField = photonField;
-      23          33 :         std::string fname = photonField->getFieldName();
-      24          33 :         setDescription("EMPairProduction: " + fname);
-      25          99 :         initRate(getDataPath("EMPairProduction/rate_" + fname + ".txt"));
-      26          99 :         initCumulativeRate(getDataPath("EMPairProduction/cdf_" + fname + ".txt"));
-      27          33 : }
-      28             : 
-      29          14 : void EMPairProduction::setHaveElectrons(bool haveElectrons) {
-      30          14 :         this->haveElectrons = haveElectrons;
-      31          14 : }
-      32             : 
-      33           9 : void EMPairProduction::setLimit(double limit) {
-      34           9 :         this->limit = limit;
-      35           9 : }
-      36             : 
-      37          13 : void EMPairProduction::setThinning(double thinning) {
-      38          13 :         this->thinning = thinning;
-      39          13 : }
-      40             : 
-      41          33 : void EMPairProduction::initRate(std::string filename) {
-      42          33 :         std::ifstream infile(filename.c_str());
-      43             : 
-      44          33 :         if (!infile.good())
-      45           0 :                 throw std::runtime_error("EMPairProduction: could not open file " + filename);
-      46             : 
-      47             :         // clear previously loaded interaction rates
-      48          33 :         tabEnergy.clear();
-      49          33 :         tabRate.clear();
-      50             : 
-      51        7510 :         while (infile.good()) {
-      52        7477 :                 if (infile.peek() != '#') {
-      53             :                         double a, b;
-      54             :                         infile >> a >> b;
-      55        7345 :                         if (infile) {
-      56        7312 :                                 tabEnergy.push_back(pow(10, a) * eV);
-      57        7312 :                                 tabRate.push_back(b / Mpc);
-      58             :                         }
-      59             :                 }
-      60        7477 :                 infile.ignore(std::numeric_limits < std::streamsize > ::max(), '\n');
-      61             :         }
-      62          33 :         infile.close();
-      63          33 : }
-      64             : 
-      65          33 : void EMPairProduction::initCumulativeRate(std::string filename) {
-      66          33 :         std::ifstream infile(filename.c_str());
-      67             : 
-      68          33 :         if (!infile.good())
-      69           0 :                 throw std::runtime_error("EMPairProduction: could not open file " + filename);
-      70             : 
-      71             :         // clear previously loaded tables
-      72          33 :         tabE.clear();
-      73          33 :         tabs.clear();
-      74          33 :         tabCDF.clear();
-      75             :         
-      76             :         // skip header
-      77         165 :         while (infile.peek() == '#')
-      78         132 :                 infile.ignore(std::numeric_limits < std::streamsize > ::max(), '\n');
-      79             : 
-      80             :         // read s values in first line
-      81             :         double a;
-      82             :         infile >> a; // skip first value
-      83        3663 :         while (infile.good() and (infile.peek() != '\n')) {
-      84             :                 infile >> a;
-      85        3630 :                 tabs.push_back(pow(10, a) * eV * eV);
-      86             :         }
-      87             : 
-      88             :         // read all following lines: E, cdf values
-      89        7345 :         while (infile.good()) {
-      90             :                 infile >> a;
-      91        7345 :                 if (!infile)
-      92             :                         break;  // end of file
-      93        7312 :                 tabE.push_back(pow(10, a) * eV);
-      94             :                 std::vector<double> cdf;
-      95      811632 :                 for (int i = 0; i < tabs.size(); i++) {
-      96             :                         infile >> a;
-      97      804320 :                         cdf.push_back(a / Mpc);
-      98             :                 }
-      99        7312 :                 tabCDF.push_back(cdf);
-     100             :         }
-     101          33 :         infile.close();
-     102          33 : }
-     103             : 
-     104             : // Hold an data array to interpolate the energy distribution on
-     105             : class PPSecondariesEnergyDistribution {
-     106             :         private:
-     107             :                 std::vector<double> tab_s;
-     108             :                 std::vector< std::vector<double> > data;
-     109             :                 size_t N;
-     110             : 
-     111             :         public:
-     112             :                 // differential cross section for pair production for x = Epositron/Egamma, compare Lee 96 arXiv:9604098
-     113             :                 double dSigmadE_PPx(double x, double beta) {
-     114     1000000 :                         double A = (x / (1. - x) + (1. - x) / x );
-     115     1000000 :                         double B =  (1. / x + 1. / (1. - x) );
-     116        1000 :                         double y = (1 - beta * beta);
-     117     1000000 :                         return A + y * B - y * y / 4 * B * B;
-     118             :                 }
-     119             : 
-     120           1 :                 PPSecondariesEnergyDistribution() {
-     121           1 :                         N = 1000;
-     122             :                         size_t Ns = 1000;
-     123             :                         double s_min = 4 * mec2 * mec2;
-     124             :                         double s_max = 1e23 * eV * eV;
-     125             :                         double dls = log(s_max / s_min) / Ns;
-     126           1 :                         data = std::vector< std::vector<double> >(Ns, std::vector<double>(N));
-     127           1 :                         tab_s = std::vector<double>(Ns + 1);
-     128             : 
-     129        1002 :                         for (size_t i = 0; i < Ns + 1; ++i)
-     130        1001 :                                 tab_s[i] = s_min * exp(i*dls); // tabulate s bin borders
-     131             : 
-     132        1001 :                         for (size_t i = 0; i < Ns; i++) {
-     133        1000 :                                 double s = s_min * exp(i*dls + 0.5*dls);
-     134        1000 :                                 double beta = sqrt(1 - s_min/s);
-     135        1000 :                                 double x0 = (1 - beta) / 2;
-     136        1000 :                                 double dx = log((1 + beta) / (1 - beta)) / N;
-     137             : 
-     138             :                                 // cumulative midpoint integration
-     139        1000 :                                 std::vector<double> data_i(1000);
-     140        1000 :                                 data_i[0] = dSigmadE_PPx(x0, beta) * expm1(dx);
-     141     1000000 :                                 for (size_t j = 1; j < N; j++) {
-     142      999000 :                                         double x = x0 * exp(j*dx + 0.5*dx);
-     143      999000 :                                         double binWidth = exp((j+1)*dx)-exp(j*dx);
-     144      999000 :                                         data_i[j] = dSigmadE_PPx(x, beta) * binWidth + data_i[j-1];
-     145             :                                 }
-     146        1000 :                                 data[i] = data_i;
-     147             :                         }
-     148           1 :                 }
-     149             : 
-     150             :                 // sample positron energy from cdf(E, s_kin)
-     151         563 :                 double sample(double E0, double s) {
-     152             :                         // get distribution for given s
-     153         563 :                         size_t idx = std::lower_bound(tab_s.begin(), tab_s.end(), s) - tab_s.begin();
-     154         563 :                         if (idx > data.size())
-     155             :                                 return NAN;
-     156             :                                 
-     157         563 :                         std::vector<double> s0 = data[idx];
-     158             : 
-     159             :                         // draw random bin
-     160         563 :                         Random &random = Random::instance();
-     161         563 :                         size_t j = random.randBin(s0) + 1;
-     162             : 
-     163             :                         double s_min = 4. * mec2 * mec2;
-     164         563 :                         double beta = sqrtl(1. - s_min / s);
-     165         563 :                         double x0 = (1. - beta) / 2.;
-     166         563 :                         double dx = log((1 + beta) / (1 - beta)) / N;
-     167         563 :                         double binWidth = x0 * (exp(j*dx) - exp((j-1)*dx));
-     168         563 :                         if (random.rand() < 0.5)
-     169         290 :                                 return E0 * (x0 * exp((j-1) * dx) + binWidth);
-     170             :                         else
-     171         273 :                                 return E0 * (1 - (x0 * exp((j-1) * dx) + binWidth));
-     172             :                 }
-     173             : };
-     174             : 
-     175         563 : void EMPairProduction::performInteraction(Candidate *candidate) const {
-     176             :         // scale particle energy instead of background photon energy
-     177         563 :         double z = candidate->getRedshift();
-     178         563 :         double E = candidate->current.getEnergy() * (1 + z);
-     179             : 
-     180             :         // check if secondary electron pair needs to be produced
-     181         563 :         if (not haveElectrons)
-     182           0 :                 return;
-     183             : 
-     184             :         // check if in tabulated energy range
-     185         563 :         if (E < tabE.front() or (E > tabE.back()))
-     186             :                 return;
-     187             : 
-     188             :         // sample the value of s
-     189         563 :         Random &random = Random::instance();
-     190         563 :         size_t i = closestIndex(E, tabE);  // find closest tabulation point
-     191         563 :         size_t j = random.randBin(tabCDF[i]);
-     192        1092 :         double lo = std::max(4 * mec2 * mec2, tabs[j-1]);  // first s-tabulation point below min(s_kin) = (2 me c^2)^2; ensure physical value
-     193         563 :         double hi = tabs[j];
-     194         563 :         double s = lo + random.rand() * (hi - lo);
-     195             : 
-     196             :         // sample electron / positron energy
-     197         563 :         static PPSecondariesEnergyDistribution interpolation;
-     198         563 :         double Ee = interpolation.sample(E, s);
-     199         563 :         double Ep = E - Ee;
-     200         563 :         double f = Ep / E;
-     201             : 
-     202             :         // for some backgrounds Ee=nan due to precision limitations.
-     203         563 :         if (not std::isfinite(Ee) || not std::isfinite(Ep))
-     204             :                 return;
-     205             : 
-     206             :         // photon is lost after interacting
-     207         563 :         candidate->setActive(false);
-     208             : 
-     209             :         // sample random position along current step
-     210         563 :         Vector3d pos = random.randomInterpolatedPosition(candidate->previous.getPosition(), candidate->current.getPosition());
-     211             :         // apply sampling
-     212         563 :         if (random.rand() < pow(f, thinning)) {
-     213         563 :                 double w = 1. / pow(f, thinning);
-     214         563 :                 candidate->addSecondary(11, Ep / (1 + z), pos, w, interactionTag);
-     215             :         }
-     216         563 :         if (random.rand() < pow(1 - f, thinning)){
-     217         563 :                 double w = 1. / pow(1 - f, thinning);
-     218         563 :                 candidate->addSecondary(-11, Ee / (1 + z), pos, w, interactionTag);  
-     219             :         }
-     220             : }
-     221             : 
-     222       16965 : void EMPairProduction::process(Candidate *candidate) const {
-     223             :         // check if photon
-     224       16965 :         if (candidate->current.getId() != 22)
-     225             :                 return;
-     226             : 
-     227             :         // scale particle energy instead of background photon energy
-     228         841 :         double z = candidate->getRedshift();
-     229         841 :         double E = candidate->current.getEnergy() * (1 + z);
-     230             : 
-     231             :         // check if in tabulated energy range
-     232         841 :         if ((E < tabEnergy.front()) or (E > tabEnergy.back()))
-     233             :                 return;
-     234             : 
-     235             :         // interaction rate
-     236         651 :         double rate = interpolate(E, tabEnergy, tabRate);
-     237         651 :         rate *= pow_integer<2>(1 + z) * photonField->getRedshiftScaling(z);
-     238             : 
-     239             :         // run this loop at least once to limit the step size 
-     240         651 :         double step = candidate->getCurrentStep();
-     241         651 :         Random &random = Random::instance();
-     242             :         do {
-     243         651 :                 double randDistance = -log(random.rand()) / rate;
-     244             :                 // check for interaction; if it doesn't ocurr, limit next step
-     245         651 :                 if (step < randDistance) { 
-     246          89 :                         candidate->limitNextStep(limit / rate);
-     247             :                 } else {
-     248         562 :                         performInteraction(candidate);
-     249         562 :                         return;
-     250             :                 }
-     251          89 :                 step -= randDistance; 
-     252          89 :         } while (step > 0.);
-     253             : 
-     254             : }
-     255             : 
-     256           1 : void EMPairProduction::setInteractionTag(std::string tag) {
-     257           1 :         interactionTag = tag;
-     258           1 : }
-     259             : 
-     260           2 : std::string EMPairProduction::getInteractionTag() const {
-     261           2 :         return interactionTag;
-     262             : }
-     263             : 
-     264             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/EMTripletPairProduction.cpp.func-sort-c.html b/doc/coverageReport/src/module/EMTripletPairProduction.cpp.func-sort-c.html deleted file mode 100644 index bfb861b6b..000000000 --- a/doc/coverageReport/src/module/EMTripletPairProduction.cpp.func-sort-c.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/EMTripletPairProduction.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - EMTripletPairProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:9410094.0 %
Date:2024-04-08 14:58:22Functions:1111100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa23EMTripletPairProduction17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZNK7crpropa23EMTripletPairProduction18performInteractionEPNS_9CandidateE1
_ZNK7crpropa23EMTripletPairProduction7processEPNS_9CandidateE1
_ZNK7crpropa23EMTripletPairProduction17getInteractionTagB5cxx11Ev2
_ZN7crpropa23EMTripletPairProduction11setThinningEd3
_ZN7crpropa23EMTripletPairProduction8setLimitEd3
_ZN7crpropa23EMTripletPairProductionC2ENS_7ref_ptrINS_11PhotonFieldEEEbdd3
_ZN7crpropa23EMTripletPairProduction16setHaveElectronsEb4
_ZN7crpropa23EMTripletPairProduction14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE15
_ZN7crpropa23EMTripletPairProduction18initCumulativeRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE15
_ZN7crpropa23EMTripletPairProduction8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE15
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/EMTripletPairProduction.cpp.func.html b/doc/coverageReport/src/module/EMTripletPairProduction.cpp.func.html deleted file mode 100644 index bfa5c293f..000000000 --- a/doc/coverageReport/src/module/EMTripletPairProduction.cpp.func.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/EMTripletPairProduction.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - EMTripletPairProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:9410094.0 %
Date:2024-04-08 14:58:22Functions:1111100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa23EMTripletPairProduction11setThinningEd3
_ZN7crpropa23EMTripletPairProduction14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE15
_ZN7crpropa23EMTripletPairProduction16setHaveElectronsEb4
_ZN7crpropa23EMTripletPairProduction17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa23EMTripletPairProduction18initCumulativeRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE15
_ZN7crpropa23EMTripletPairProduction8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE15
_ZN7crpropa23EMTripletPairProduction8setLimitEd3
_ZN7crpropa23EMTripletPairProductionC2ENS_7ref_ptrINS_11PhotonFieldEEEbdd3
_ZNK7crpropa23EMTripletPairProduction17getInteractionTagB5cxx11Ev2
_ZNK7crpropa23EMTripletPairProduction18performInteractionEPNS_9CandidateE1
_ZNK7crpropa23EMTripletPairProduction7processEPNS_9CandidateE1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/EMTripletPairProduction.cpp.gcov.html b/doc/coverageReport/src/module/EMTripletPairProduction.cpp.gcov.html deleted file mode 100644 index a959e6b81..000000000 --- a/doc/coverageReport/src/module/EMTripletPairProduction.cpp.gcov.html +++ /dev/null @@ -1,263 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/EMTripletPairProduction.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - EMTripletPairProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:9410094.0 %
Date:2024-04-08 14:58:22Functions:1111100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/EMTripletPairProduction.h"
-       2             : #include "crpropa/Units.h"
-       3             : #include "crpropa/Random.h"
-       4             : 
-       5             : #include <fstream>
-       6             : #include <limits>
-       7             : #include <stdexcept>
-       8             : 
-       9             : namespace crpropa {
-      10             : 
-      11             : static const double mec2 = mass_electron * c_squared;
-      12             : 
-      13           3 : EMTripletPairProduction::EMTripletPairProduction(ref_ptr<PhotonField> photonField, bool haveElectrons, double thinning, double limit) {
-      14           3 :         setPhotonField(photonField);
-      15           3 :         setHaveElectrons(haveElectrons);
-      16           3 :         setLimit(limit);
-      17           3 :         setThinning(thinning);
-      18           3 : }
-      19             : 
-      20          15 : void EMTripletPairProduction::setPhotonField(ref_ptr<PhotonField> photonField) {
-      21          15 :         this->photonField = photonField;
-      22          15 :         std::string fname = photonField->getFieldName();
-      23          15 :         setDescription("EMTripletPairProduction: " + fname);
-      24          45 :         initRate(getDataPath("EMTripletPairProduction/rate_" + fname + ".txt"));
-      25          45 :         initCumulativeRate(getDataPath("EMTripletPairProduction/cdf_" + fname + ".txt"));
-      26          15 : }
-      27             : 
-      28           4 : void EMTripletPairProduction::setHaveElectrons(bool haveElectrons) {
-      29           4 :         this->haveElectrons = haveElectrons;
-      30           4 : }
-      31             : 
-      32           3 : void EMTripletPairProduction::setLimit(double limit) {
-      33           3 :         this->limit = limit;
-      34           3 : }
-      35             : 
-      36           3 : void EMTripletPairProduction::setThinning(double thinning) {
-      37           3 :         this->thinning = thinning;
-      38           3 : }
-      39             : 
-      40          15 : void EMTripletPairProduction::initRate(std::string filename) {
-      41          15 :         std::ifstream infile(filename.c_str());
-      42             : 
-      43          15 :         if (!infile.good())
-      44           0 :                 throw std::runtime_error("EMTripletPairProduction: could not open file " + filename);
-      45             : 
-      46             :         // clear previously loaded interaction rates
-      47          15 :         tabEnergy.clear();
-      48          15 :         tabRate.clear();
-      49             : 
-      50        3340 :         while (infile.good()) {
-      51        3325 :                 if (infile.peek() != '#') {
-      52             :                         double a, b;
-      53             :                         infile >> a >> b;
-      54        3265 :                         if (infile) {
-      55        3250 :                                 tabEnergy.push_back(pow(10, a) * eV);
-      56        3250 :                                 tabRate.push_back(b / Mpc);
-      57             :                         }
-      58             :                 }
-      59        3325 :                 infile.ignore(std::numeric_limits < std::streamsize > ::max(), '\n');
-      60             :         }
-      61          15 :         infile.close();
-      62          15 : }
-      63             : 
-      64          15 : void EMTripletPairProduction::initCumulativeRate(std::string filename) {
-      65          15 :         std::ifstream infile(filename.c_str());
-      66             : 
-      67          15 :         if (!infile.good())
-      68           0 :                 throw std::runtime_error(
-      69           0 :                                 "EMTripletPairProduction: could not open file " + filename);
-      70             : 
-      71             :         // clear previously loaded tables
-      72          15 :         tabE.clear();
-      73          15 :         tabs.clear();
-      74          15 :         tabCDF.clear();
-      75             :         
-      76             :         // skip header
-      77          75 :         while (infile.peek() == '#')
-      78          60 :                 infile.ignore(std::numeric_limits < std::streamsize > ::max(), '\n');
-      79             : 
-      80             :         // read s values in first line
-      81             :         double a;
-      82             :         infile >> a; // skip first value
-      83        1590 :         while (infile.good() and (infile.peek() != '\n')) {
-      84             :                 infile >> a;
-      85        1575 :                 tabs.push_back(pow(10, a) * eV * eV);
-      86             :         }
-      87             : 
-      88             :         // read all following lines: E, cdf values
-      89        3265 :         while (infile.good()) {
-      90             :                 infile >> a;
-      91        3265 :                 if (!infile)
-      92             :                         break;  // end of file
-      93        3250 :                 tabE.push_back(pow(10, a) * eV);
-      94             :                 std::vector<double> cdf;
-      95      344500 :                 for (int i = 0; i < tabs.size(); i++) {
-      96             :                         infile >> a;
-      97      341250 :                         cdf.push_back(a / Mpc);
-      98             :                 }
-      99        3250 :                 tabCDF.push_back(cdf);
-     100             :         }
-     101          15 :         infile.close();
-     102          15 : }
-     103             : 
-     104           1 : void EMTripletPairProduction::performInteraction(Candidate *candidate) const {
-     105           1 :         int id = candidate->current.getId();
-     106           1 :         if  (abs(id) != 11)
-     107             :                 return;
-     108             : 
-     109             :         // scale the particle energy instead of background photons
-     110           1 :         double z = candidate->getRedshift();
-     111           1 :         double E = candidate->current.getEnergy() * (1 + z);
-     112             : 
-     113           1 :         if (E < tabE.front() or E > tabE.back())
-     114             :                 return;
-     115             : 
-     116             :         // sample the value of eps
-     117           1 :         Random &random = Random::instance();
-     118           1 :         size_t i = closestIndex(E, tabE);
-     119           1 :         size_t j = random.randBin(tabCDF[i]);
-     120           1 :         double s_kin = pow(10, log10(tabs[j]) + (random.rand() - 0.5) * 0.1);
-     121           1 :         double eps = s_kin / 4. / E; // random background photon energy
-     122             : 
-     123             :         // Use approximation from A. Mastichiadis et al., Astroph. Journ. 300:178-189 (1986), eq. 30.
-     124             :         // This approx is valid only for alpha >=100 where alpha = p0*eps*costheta - E0*eps
-     125             :         // For our purposes, me << E0 --> p0~E0 --> alpha = E0*eps*(costheta - 1) >= 100
-     126           1 :         double Epp = 5.7e-1 * pow(eps / mec2, -0.56) * pow(E / mec2, 0.44) * mec2;
-     127             : 
-     128           1 :         double f = Epp / E;
-     129             : 
-     130           1 :         if (haveElectrons) {
-     131           1 :                 Vector3d pos = random.randomInterpolatedPosition(candidate->previous.getPosition(), candidate->current.getPosition());
-     132           1 :                 if (random.rand() < pow(1 - f, thinning)) {
-     133           1 :                         double w = 1. / pow(1 - f, thinning);
-     134           1 :                         candidate->addSecondary(11, Epp / (1 + z), pos, w, interactionTag);
-     135             :                 }
-     136           1 :                 if (random.rand() < pow(f, thinning)) {
-     137           1 :                         double w = 1. / pow(f, thinning);
-     138           1 :                         candidate->addSecondary(-11, Epp / (1 + z), pos, w, interactionTag);
-     139             :                 }
-     140             :         }
-     141             :         // Update the primary particle energy.
-     142             :         // This is done after adding the secondaries to correctly set the secondaries parent
-     143           1 :         candidate->current.setEnergy((E - 2 * Epp) / (1. + z));
-     144             : }
-     145             : 
-     146           1 : void EMTripletPairProduction::process(Candidate *candidate) const {
-     147             :         // check if electron / positron
-     148           1 :         int id = candidate->current.getId();
-     149           1 :         if (abs(id) != 11)
-     150             :                 return;
-     151             : 
-     152             :         // scale the particle energy instead of background photons
-     153           1 :         double z = candidate->getRedshift();
-     154           1 :         double E = (1 + z) * candidate->current.getEnergy();
-     155             : 
-     156             :         // check if in tabulated energy range
-     157           1 :         if ((E < tabEnergy.front()) or (E > tabEnergy.back()))
-     158             :                 return;
-     159             : 
-     160             :         // cosmological scaling of interaction distance (comoving)
-     161           1 :         double scaling = pow_integer<2>(1 + z) * photonField->getRedshiftScaling(z);
-     162           1 :         double rate = scaling * interpolate(E, tabEnergy, tabRate);
-     163             : 
-     164             :         // run this loop at least once to limit the step size
-     165           1 :         double step = candidate->getCurrentStep();
-     166           1 :         Random &random = Random::instance();
-     167             :         do {
-     168           1 :                 double randDistance = -log(random.rand()) / rate;
-     169             :                 // check for interaction; if it doesn't occur, limit next step
-     170           1 :                 if (step < randDistance) { 
-     171           1 :                         candidate->limitNextStep(limit / rate);
-     172           1 :                         return;
-     173             :                 }
-     174           0 :                 performInteraction(candidate);
-     175           0 :                 step -= randDistance; 
-     176           0 :         } while (step > 0.);
-     177             : }
-     178             : 
-     179           1 : void EMTripletPairProduction::setInteractionTag(std::string tag) {
-     180           1 :         interactionTag = tag;
-     181           1 : }
-     182             : 
-     183           2 : std::string EMTripletPairProduction::getInteractionTag() const {
-     184           2 :         return interactionTag;
-     185             : }
-     186             : 
-     187             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/ElasticScattering.cpp.func-sort-c.html b/doc/coverageReport/src/module/ElasticScattering.cpp.func-sort-c.html deleted file mode 100644 index 222b6680f..000000000 --- a/doc/coverageReport/src/module/ElasticScattering.cpp.func-sort-c.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/ElasticScattering.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - ElasticScattering.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:637090.0 %
Date:2024-04-08 14:58:22Functions:5771.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa17ElasticScattering17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZNK7crpropa17ElasticScattering17getInteractionTagB5cxx11Ev0
_ZNK7crpropa17ElasticScattering7processEPNS_9CandidateE1
_ZN7crpropa17ElasticScatteringC2ENS_7ref_ptrINS_11PhotonFieldEEE2
_ZN7crpropa17ElasticScattering14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE4
_ZN7crpropa17ElasticScattering7initCDFENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE4
_ZN7crpropa17ElasticScattering8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE4
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/ElasticScattering.cpp.func.html b/doc/coverageReport/src/module/ElasticScattering.cpp.func.html deleted file mode 100644 index 8ecf24e21..000000000 --- a/doc/coverageReport/src/module/ElasticScattering.cpp.func.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/ElasticScattering.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - ElasticScattering.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:637090.0 %
Date:2024-04-08 14:58:22Functions:5771.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa17ElasticScattering14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE4
_ZN7crpropa17ElasticScattering17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa17ElasticScattering7initCDFENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE4
_ZN7crpropa17ElasticScattering8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE4
_ZN7crpropa17ElasticScatteringC2ENS_7ref_ptrINS_11PhotonFieldEEE2
_ZNK7crpropa17ElasticScattering17getInteractionTagB5cxx11Ev0
_ZNK7crpropa17ElasticScattering7processEPNS_9CandidateE1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/ElasticScattering.cpp.gcov.html b/doc/coverageReport/src/module/ElasticScattering.cpp.gcov.html deleted file mode 100644 index f5b2d7a8c..000000000 --- a/doc/coverageReport/src/module/ElasticScattering.cpp.gcov.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/ElasticScattering.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - ElasticScattering.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:637090.0 %
Date:2024-04-08 14:58:22Functions:5771.4 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/ElasticScattering.h"
-       2             : #include "crpropa/Units.h"
-       3             : #include "crpropa/ParticleID.h"
-       4             : #include "crpropa/ParticleMass.h"
-       5             : #include "crpropa/Random.h"
-       6             : 
-       7             : #include <cmath>
-       8             : #include <limits>
-       9             : #include <sstream>
-      10             : #include <fstream>
-      11             : #include <stdexcept>
-      12             : 
-      13             : namespace crpropa {
-      14             : 
-      15             : const double ElasticScattering::lgmin = 6.;  // minimum log10(Lorentz-factor)
-      16             : const double ElasticScattering::lgmax = 14.; // maximum log10(Lorentz-factor)
-      17             : const size_t ElasticScattering::nlg = 201;   // number of Lorentz-factor steps
-      18             : const double ElasticScattering::epsmin = log10(2 * eV) + 3;    // log10 minimum photon background energy in nucleus rest frame for elastic scattering
-      19             : const double ElasticScattering::epsmax = log10(2 * eV) + 8.12; // log10 maximum photon background energy in nucleus rest frame for elastic scattering
-      20             : const size_t ElasticScattering::neps = 513; // number of photon background energies in nucleus rest frame
-      21             : 
-      22           2 : ElasticScattering::ElasticScattering(ref_ptr<PhotonField> f) {
-      23           2 :         setPhotonField(f);
-      24           2 : }
-      25             : 
-      26           4 : void ElasticScattering::setPhotonField(ref_ptr<PhotonField> photonField) {
-      27           4 :         this->photonField = photonField;
-      28           4 :         std::string fname = photonField->getFieldName();
-      29           4 :         setDescription("ElasticScattering: " + fname);
-      30          12 :         initRate(getDataPath("ElasticScattering/rate_" + fname.substr(0,3) + ".txt"));
-      31          12 :         initCDF(getDataPath("ElasticScattering/cdf_" + fname.substr(0,3) + ".txt"));
-      32           4 : }
-      33             : 
-      34           4 : void ElasticScattering::initRate(std::string filename) {
-      35           4 :         std::ifstream infile(filename.c_str());
-      36           4 :         if (not infile.good())
-      37           0 :                 throw std::runtime_error("ElasticScattering: could not open file " + filename);
-      38             : 
-      39           4 :         tabRate.clear();
-      40             : 
-      41         824 :         while (infile.good()) {
-      42         824 :                 if (infile.peek() == '#') {
-      43          16 :                         infile.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
-      44          16 :                         continue;
-      45             :                 }
-      46             :                 double r;
-      47             :                 infile >> r;
-      48         808 :                 if (!infile)
-      49             :                         break;
-      50         804 :                 tabRate.push_back(r / Mpc);
-      51             :         }
-      52             : 
-      53           4 :         infile.close();
-      54           4 : }
-      55             : 
-      56           4 : void ElasticScattering::initCDF(std::string filename) {
-      57           4 :         std::ifstream infile(filename.c_str());
-      58           4 :         if (not infile.good())
-      59           0 :                 throw std::runtime_error("ElasticScattering: could not open file " + filename);
-      60             : 
-      61           4 :         tabCDF.clear();
-      62             :         std::string line;
-      63             :         double a;
-      64         820 :         while (std::getline(infile, line)) {
-      65         816 :                 if (line[0] == '#')
-      66          12 :                         continue;
-      67             : 
-      68         804 :                 std::stringstream lineStream(line);
-      69             :                 lineStream >> a;
-      70             : 
-      71         804 :                 std::vector<double> cdf(neps);
-      72      413256 :                 for (size_t i = 0; i < neps; i++) {
-      73             :                         lineStream >> a;
-      74      412452 :                         cdf[i] = a;
-      75             :                 }
-      76         804 :                 tabCDF.push_back(cdf);
-      77         804 :         }
-      78             : 
-      79           4 :         infile.close();
-      80           4 : }
-      81             : 
-      82           1 : void ElasticScattering::process(Candidate *candidate) const {
-      83           1 :         int id = candidate->current.getId();
-      84           1 :         double z = candidate->getRedshift();
-      85             : 
-      86           1 :         if (not isNucleus(id))
-      87             :                 return;
-      88             : 
-      89           1 :         double lg = log10(candidate->current.getLorentzFactor() * (1 + z));
-      90           1 :         if ((lg < lgmin) or (lg > lgmax))
-      91             :                 return;
-      92             : 
-      93           1 :         int A = massNumber(id);
-      94           1 :         int Z = chargeNumber(id);
-      95           1 :         int N = A - Z;
-      96             : 
-      97           1 :         double step = candidate->getCurrentStep();
-      98           8 :         while (step > 0) {
-      99             : 
-     100           8 :                 double rate = interpolateEquidistant(lg, lgmin, lgmax, tabRate);
-     101           8 :                 rate *= Z * N / double(A);  // TRK scaling
-     102           8 :                 rate *= pow_integer<2>(1 + z) * photonField->getRedshiftScaling(z);  // cosmological scaling
-     103             : 
-     104             :                 // check for interaction
-     105           8 :                 Random &random = Random::instance();
-     106           8 :                 double randDist = -log(random.rand()) / rate;
-     107           8 :                 if (step < randDist)
-     108           1 :                         return;
-     109             : 
-     110             :                 // draw random background photon energy from CDF
-     111           7 :                 size_t i = floor((lg - lgmin) / (lgmax - lgmin) * (nlg - 1)); // index of closest gamma tabulation point
-     112           7 :                 size_t j = random.randBin(tabCDF[i]) - 1; // index of next lower tabulated eps value
-     113             :                 double binWidth = (epsmax - epsmin) / (neps - 1); // logarithmic bin width
-     114           7 :                 double eps = pow(10, epsmin + (j + random.rand()) * binWidth);
-     115             : 
-     116             :                 // boost to lab frame
-     117           7 :                 double cosTheta = 2 * random.rand() - 1;
-     118           7 :                 double E = eps * candidate->current.getLorentzFactor() * (1. - cosTheta);
-     119             : 
-     120           7 :                 Vector3d pos = random.randomInterpolatedPosition(candidate->previous.getPosition(), candidate->current.getPosition());
-     121           7 :                 candidate->addSecondary(22, E, pos, 1., interactionTag);
-     122             : 
-     123             :                 // repeat with remaining step
-     124           7 :                 step -= randDist;
-     125             :         }
-     126             : }
-     127             : 
-     128           0 : void ElasticScattering::setInteractionTag(std::string tag) {
-     129           0 :         this -> interactionTag = tag;
-     130           0 : }
-     131             : 
-     132           0 : std::string ElasticScattering::getInteractionTag() const {
-     133           0 :         return interactionTag;
-     134             : }
-     135             : 
-     136             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/ElectronPairProduction.cpp.func-sort-c.html b/doc/coverageReport/src/module/ElectronPairProduction.cpp.func-sort-c.html deleted file mode 100644 index 03ac203cf..000000000 --- a/doc/coverageReport/src/module/ElectronPairProduction.cpp.func-sort-c.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/ElectronPairProduction.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - ElectronPairProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:859292.4 %
Date:2024-04-08 14:58:22Functions:91090.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa22ElectronPairProduction8setLimitEd0
_ZN7crpropa22ElectronPairProduction12initSpectrumENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa22ElectronPairProduction16setHaveElectronsEb1
_ZN7crpropa22ElectronPairProduction17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZNK7crpropa22ElectronPairProduction17getInteractionTagB5cxx11Ev2
_ZN7crpropa22ElectronPairProductionC2ENS_7ref_ptrINS_11PhotonFieldEEEbd10
_ZN7crpropa22ElectronPairProduction14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE19
_ZN7crpropa22ElectronPairProduction8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE19
_ZNK7crpropa22ElectronPairProduction10lossLengthEidd15446
_ZNK7crpropa22ElectronPairProduction7processEPNS_9CandidateE15447
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/ElectronPairProduction.cpp.func.html b/doc/coverageReport/src/module/ElectronPairProduction.cpp.func.html deleted file mode 100644 index 5da0c6c27..000000000 --- a/doc/coverageReport/src/module/ElectronPairProduction.cpp.func.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/ElectronPairProduction.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - ElectronPairProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:859292.4 %
Date:2024-04-08 14:58:22Functions:91090.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa22ElectronPairProduction12initSpectrumENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa22ElectronPairProduction14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE19
_ZN7crpropa22ElectronPairProduction16setHaveElectronsEb1
_ZN7crpropa22ElectronPairProduction17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa22ElectronPairProduction8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE19
_ZN7crpropa22ElectronPairProduction8setLimitEd0
_ZN7crpropa22ElectronPairProductionC2ENS_7ref_ptrINS_11PhotonFieldEEEbd10
_ZNK7crpropa22ElectronPairProduction10lossLengthEidd15446
_ZNK7crpropa22ElectronPairProduction17getInteractionTagB5cxx11Ev2
_ZNK7crpropa22ElectronPairProduction7processEPNS_9CandidateE15447
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/ElectronPairProduction.cpp.gcov.html b/doc/coverageReport/src/module/ElectronPairProduction.cpp.gcov.html deleted file mode 100644 index 5204a21c0..000000000 --- a/doc/coverageReport/src/module/ElectronPairProduction.cpp.gcov.html +++ /dev/null @@ -1,233 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/ElectronPairProduction.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - ElectronPairProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:859292.4 %
Date:2024-04-08 14:58:22Functions:91090.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/ElectronPairProduction.h"
-       2             : #include "crpropa/Units.h"
-       3             : #include "crpropa/ParticleID.h"
-       4             : #include "crpropa/ParticleMass.h"
-       5             : #include "crpropa/Random.h"
-       6             : 
-       7             : #include <fstream>
-       8             : #include <limits>
-       9             : #include <stdexcept>
-      10             : 
-      11             : namespace crpropa {
-      12             : 
-      13          10 : ElectronPairProduction::ElectronPairProduction(ref_ptr<PhotonField> photonField,
-      14          10 :                 bool haveElectrons, double limit) {
-      15          10 :         this->haveElectrons = haveElectrons;
-      16          10 :         this->limit = limit;
-      17          10 :         setPhotonField(photonField);
-      18          10 : }
-      19             : 
-      20          19 : void ElectronPairProduction::setPhotonField(ref_ptr<PhotonField> photonField) {
-      21          19 :         this->photonField = photonField;
-      22          19 :         std::string fname = photonField->getFieldName();
-      23          19 :         setDescription("ElectronPairProduction: " + fname);
-      24          57 :         initRate(getDataPath("ElectronPairProduction/lossrate_" + fname + ".txt"));
-      25          19 :         if (haveElectrons) { // Load secondary spectra only if electrons should be produced
-      26           0 :                 initSpectrum(getDataPath("ElectronPairProduction/spectrum_" + fname.substr(0,3) + ".txt"));
-      27             :         }
-      28          19 : }
-      29             : 
-      30           1 : void ElectronPairProduction::setHaveElectrons(bool haveElectrons) {
-      31           1 :         this->haveElectrons = haveElectrons;
-      32           1 :         if (haveElectrons) { // Load secondary spectra in case haveElectrons was changed to true
-      33           1 :                 std::string fname = photonField->getFieldName();
-      34           3 :                 initSpectrum(getDataPath("ElectronPairProduction/spectrum_" + fname.substr(0,3) + ".txt"));
-      35             :         }
-      36           1 : }
-      37             : 
-      38           0 : void ElectronPairProduction::setLimit(double limit) {
-      39           0 :         this->limit = limit;
-      40           0 : }
-      41             : 
-      42          19 : void ElectronPairProduction::initRate(std::string filename) {
-      43          19 :         std::ifstream infile(filename.c_str());
-      44             : 
-      45          19 :         if (!infile.good())
-      46           0 :                 throw std::runtime_error("ElectronPairProduction: could not open file " + filename);
-      47             : 
-      48             :         // clear previously loaded interaction rates
-      49          19 :         tabLorentzFactor.clear();
-      50          19 :         tabLossRate.clear();
-      51             : 
-      52        2853 :         while (infile.good()) {
-      53        2834 :                 if (infile.peek() != '#') {
-      54             :                         double a, b;
-      55             :                         infile >> a >> b;
-      56        2777 :                         if (infile) {
-      57        2758 :                                 tabLorentzFactor.push_back(pow(10, a));
-      58        2758 :                                 tabLossRate.push_back(b / Mpc);
-      59             :                         }
-      60             :                 }
-      61        2834 :                 infile.ignore(std::numeric_limits < std::streamsize > ::max(), '\n');
-      62             :         }
-      63          19 :         infile.close();
-      64          19 : }
-      65             : 
-      66           1 : void ElectronPairProduction::initSpectrum(std::string filename) {
-      67           1 :         std::ifstream infile(filename.c_str());
-      68           1 :         if (!infile.good())
-      69           0 :                 throw std::runtime_error("ElectronPairProduction: could not open file " + filename);
-      70             : 
-      71             :         double dNdE;
-      72           1 :         tabSpectrum.resize(70);
-      73          71 :         for (size_t i = 0; i < 70; i++) {
-      74          70 :                 tabSpectrum[i].resize(170);
-      75       11970 :                 for (size_t j = 0; j < 170; j++) {
-      76             :                         infile >> dNdE;
-      77       11900 :                         tabSpectrum[i][j] = dNdE * pow(10, (7 + 0.1 * j)); // read electron distribution pdf(Ee) ~ dN/dEe * Ee
-      78             :                 }
-      79       11900 :                 for (size_t j = 1; j < 170; j++) {
-      80       11830 :                         tabSpectrum[i][j] += tabSpectrum[i][j - 1]; // cdf(Ee), unnormalized
-      81             :                 }
-      82             :         }
-      83           1 :         infile.close();
-      84           1 : }
-      85             : 
-      86       15446 : double ElectronPairProduction::lossLength(int id, double lf, double z) const {
-      87       15446 :         double Z = chargeNumber(id);
-      88       15446 :         if (Z == 0)
-      89             :                 return std::numeric_limits<double>::max(); // no pair production on uncharged particles
-      90             : 
-      91       14944 :         lf *= (1 + z);
-      92       14944 :         if (lf < tabLorentzFactor.front())
-      93             :                 return std::numeric_limits<double>::max(); // below energy threshold
-      94             : 
-      95             :         double rate;
-      96       14921 :         if (lf < tabLorentzFactor.back())
-      97       14921 :                 rate = interpolate(lf, tabLorentzFactor, tabLossRate); // interpolation
-      98             :         else
-      99           0 :                 rate = tabLossRate.back() * pow(lf / tabLorentzFactor.back(), -0.6); // extrapolation
-     100             : 
-     101       14921 :         double A = nuclearMass(id) / mass_proton; // more accurate than massNumber(Id)
-     102       14921 :         rate *= Z * Z / A * pow_integer<3>(1 + z) * photonField->getRedshiftScaling(z);
-     103       14921 :         return 1. / rate;
-     104             : }
-     105             : 
-     106       15447 : void ElectronPairProduction::process(Candidate *c) const {
-     107       15447 :         int id = c->current.getId();
-     108       15447 :         if (not (isNucleus(id)))
-     109             :                 return; // only nuclei
-     110             : 
-     111       15446 :         double lf = c->current.getLorentzFactor();
-     112       15446 :         double z = c->getRedshift();
-     113       15446 :         double losslen = lossLength(id, lf, z);  // energy loss length
-     114       15446 :         if (losslen >= std::numeric_limits<double>::max())
-     115             :                 return;
-     116             : 
-     117       14921 :         double step = c->getCurrentStep() / (1 + z); // step size in local frame
-     118       14921 :         double loss = step / losslen;  // relative energy loss
-     119             : 
-     120       14921 :         if (haveElectrons) {
-     121           1 :                 double dE = c->current.getEnergy() * loss;  // energy loss
-     122           1 :                 int i = round((log10(lf) - 6.05) * 10);  // find closest cdf(Ee|log10(gamma))
-     123           1 :                 i = std::min(std::max(i, 0), 69);
-     124           1 :                 Random &random = Random::instance();
-     125             : 
-     126             :                 // draw pairs as long as their energy is smaller than the pair production energy loss
-     127        6534 :                 while (dE > 0) {
-     128        6534 :                         size_t j = random.randBin(tabSpectrum[i]);
-     129        6534 :                         double Ee = pow(10, 6.95 + (j + random.rand()) * 0.1) * eV;
-     130        6534 :                         double Epair = 2 * Ee; // NOTE: electron and positron in general don't have same lab frame energy, but averaged over many draws the result is consistent
-     131             :                         // if the remaining energy is not sufficient check for random accepting
-     132        6534 :                         if (Epair > dE)
-     133           1 :                                 if (random.rand() > (dE / Epair))
-     134             :                                         break; // not accepted
-     135             : 
-     136             :                         // create pair and repeat with remaining energy
-     137        6533 :                         dE -= Epair;
-     138        6533 :                         Vector3d pos = random.randomInterpolatedPosition(c->previous.getPosition(), c->current.getPosition());
-     139        6533 :                         c->addSecondary( 11, Ee, pos, 1., interactionTag);
-     140        6533 :                         c->addSecondary(-11, Ee, pos, 1., interactionTag);
-     141             :                 }
-     142             :         }
-     143             : 
-     144       14921 :         c->current.setLorentzFactor(lf * (1 - loss));
-     145       14921 :         c->limitNextStep(limit * losslen);
-     146             : }
-     147             : 
-     148           1 : void ElectronPairProduction::setInteractionTag(std::string tag) {
-     149           1 :         interactionTag = tag;
-     150           1 : }
-     151             : 
-     152           2 : std::string ElectronPairProduction::getInteractionTag() const {
-     153           2 :         return interactionTag;
-     154             : }
-     155             : 
-     156             : 
-     157             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/HDF5Output.cpp.func-sort-c.html b/doc/coverageReport/src/module/HDF5Output.cpp.func-sort-c.html deleted file mode 100644 index 7c1102518..000000000 --- a/doc/coverageReport/src/module/HDF5Output.cpp.func-sort-c.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/HDF5Output.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - HDF5Output.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:122415.0 %
Date:2024-04-08 14:58:22Functions:41428.6 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa10HDF5Output13setFlushLimitEj0
_ZN7crpropa10HDF5Output21insertDoubleAttributeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKd0
_ZN7crpropa10HDF5Output21insertStringAttributeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_0
_ZN7crpropa10HDF5OutputC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa10HDF5OutputC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_6Output10OutputTypeE0
_ZN7crpropa10HDF5OutputD0Ev0
_ZN7crpropa23variantTypeToH5T_NATIVEENS_7Variant4TypeE0
_ZNK7crpropa10HDF5Output14getDescriptionB5cxx11Ev0
_ZNK7crpropa10HDF5Output5flushEv0
_ZNK7crpropa10HDF5Output7processEPNS_9CandidateE0
_ZN7crpropa10HDF5Output4openERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa10HDF5Output5closeEv1
_ZN7crpropa10HDF5OutputC2Ev1
_ZN7crpropa10HDF5OutputD2Ev1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/HDF5Output.cpp.func.html b/doc/coverageReport/src/module/HDF5Output.cpp.func.html deleted file mode 100644 index 23798cfed..000000000 --- a/doc/coverageReport/src/module/HDF5Output.cpp.func.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/HDF5Output.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - HDF5Output.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:122415.0 %
Date:2024-04-08 14:58:22Functions:41428.6 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa10HDF5Output13setFlushLimitEj0
_ZN7crpropa10HDF5Output21insertDoubleAttributeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKd0
_ZN7crpropa10HDF5Output21insertStringAttributeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_0
_ZN7crpropa10HDF5Output4openERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa10HDF5Output5closeEv1
_ZN7crpropa10HDF5OutputC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa10HDF5OutputC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_6Output10OutputTypeE0
_ZN7crpropa10HDF5OutputC2Ev1
_ZN7crpropa10HDF5OutputD0Ev0
_ZN7crpropa10HDF5OutputD2Ev1
_ZN7crpropa23variantTypeToH5T_NATIVEENS_7Variant4TypeE0
_ZNK7crpropa10HDF5Output14getDescriptionB5cxx11Ev0
_ZNK7crpropa10HDF5Output5flushEv0
_ZNK7crpropa10HDF5Output7processEPNS_9CandidateE0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/HDF5Output.cpp.gcov.html b/doc/coverageReport/src/module/HDF5Output.cpp.gcov.html deleted file mode 100644 index 653ba85ea..000000000 --- a/doc/coverageReport/src/module/HDF5Output.cpp.gcov.html +++ /dev/null @@ -1,468 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/HDF5Output.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - HDF5Output.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:122415.0 %
Date:2024-04-08 14:58:22Functions:41428.6 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #ifdef CRPROPA_HAVE_HDF5
-       2             : 
-       3             : #include "crpropa/module/HDF5Output.h"
-       4             : #include "crpropa/Version.h"
-       5             : #include "crpropa/Random.h"
-       6             : #include "kiss/logger.h"
-       7             : 
-       8             : #include <hdf5.h>
-       9             : #include <cstring>
-      10             : 
-      11             : const hsize_t RANK = 1;
-      12             : const hsize_t BUFFER_SIZE = 1024 * 16;
-      13             : 
-      14             : namespace crpropa {
-      15             : 
-      16             : // map variant types to H5T_NATIVE
-      17           0 : hid_t variantTypeToH5T_NATIVE(Variant::Type type) {
-      18             :         if (type == Variant::TYPE_INT64)
-      19           0 :                 return H5T_NATIVE_INT64;
-      20             :         else if(type == Variant::TYPE_BOOL)
-      21           0 :                 return H5T_NATIVE_HBOOL;
-      22             :         else if(type == Variant::TYPE_CHAR)
-      23           0 :                 return H5T_NATIVE_CHAR;
-      24             :         else if(type == Variant::TYPE_UCHAR)
-      25           0 :                 return H5T_NATIVE_UCHAR;
-      26             :         else if(type == Variant::TYPE_INT16)
-      27           0 :                 return H5T_NATIVE_INT16;
-      28             :         else if(type == Variant::TYPE_UINT16)
-      29           0 :                 return H5T_NATIVE_UINT16;
-      30             :         else if(type == Variant::TYPE_INT32)
-      31           0 :                 return H5T_NATIVE_INT32;
-      32             :         else if(type == Variant::TYPE_UINT32)
-      33           0 :                 return H5T_NATIVE_UINT32;
-      34             :         else if(type == Variant::TYPE_INT64)
-      35             :                 return H5T_NATIVE_INT64;
-      36             :         else if(type == Variant::TYPE_UINT64)
-      37           0 :                 return H5T_NATIVE_UINT64;
-      38             :         else if(type == Variant::TYPE_FLOAT)
-      39           0 :                 return H5T_NATIVE_FLOAT;
-      40             :         else if(type == Variant::TYPE_DOUBLE)
-      41           0 :                 return H5T_NATIVE_DOUBLE;
-      42             :         else if(type == Variant::TYPE_STRING)
-      43           0 :                 return H5T_C_S1;
-      44             :         else
-      45             :         {
-      46           0 :                 KISS_LOG_ERROR << "variantTypeToH5T_NATIVE:: Type: " << Variant::getTypeName(type) << " unknown.";
-      47           0 :                 throw std::runtime_error("No matching HDF type for Variant type");
-      48             :         }
-      49             : }
-      50             : 
-      51           1 : HDF5Output::HDF5Output() :  Output(), filename(), file(-1), sid(-1), dset(-1), dataspace(-1), candidatesSinceFlush(0), flushLimit(std::numeric_limits<unsigned int>::max()) {
-      52           1 : }
-      53             : 
-      54           0 : HDF5Output::HDF5Output(const std::string& filename) :  Output(), filename(filename), file(-1), sid(-1), dset(-1), dataspace(-1), candidatesSinceFlush(0), flushLimit(std::numeric_limits<unsigned int>::max()) {
-      55           0 : }
-      56             : 
-      57           0 : HDF5Output::HDF5Output(const std::string& filename, OutputType outputtype) :  Output(outputtype), filename(filename), file(-1), sid(-1), dset(-1), dataspace(-1), candidatesSinceFlush(0), flushLimit(std::numeric_limits<unsigned int>::max()) {
-      58             :         outputtype = outputtype;
-      59           0 : }
-      60             : 
-      61           1 : HDF5Output::~HDF5Output() {
-      62           1 :         close();
-      63           2 : }
-      64             : 
-      65           0 : herr_t HDF5Output::insertStringAttribute(const std::string &key, const std::string &value){
-      66             :         hid_t   strtype, attr_space, version_attr;
-      67           0 :         hsize_t dims = 0;
-      68             :         herr_t  status;
-      69             : 
-      70           0 :         strtype = H5Tcopy(H5T_C_S1);
-      71           0 :         status = H5Tset_size(strtype, value.size());
-      72             : 
-      73           0 :         attr_space = H5Screate_simple(0, &dims, NULL);
-      74           0 :         version_attr = H5Acreate2(dset, key.c_str(), strtype, attr_space, H5P_DEFAULT, H5P_DEFAULT);
-      75           0 :         status = H5Awrite(version_attr, strtype, value.c_str());
-      76           0 :         status = H5Aclose(version_attr);
-      77           0 :         status = H5Sclose(attr_space);
-      78             : 
-      79           0 :         return status;
-      80             : }
-      81             : 
-      82           0 : herr_t HDF5Output::insertDoubleAttribute(const std::string &key, const double &value){
-      83             :         hid_t   type, attr_space, version_attr;
-      84           0 :         hsize_t dims = 0;
-      85             :         herr_t  status;
-      86             : 
-      87           0 :         type = H5Tcopy(H5T_NATIVE_DOUBLE);
-      88             : 
-      89           0 :         attr_space = H5Screate_simple(0, &dims, NULL);
-      90           0 :         version_attr = H5Acreate2(dset, key.c_str(), type, attr_space, H5P_DEFAULT, H5P_DEFAULT);
-      91           0 :         status = H5Awrite(version_attr, type, &value);
-      92           0 :         status = H5Aclose(version_attr);
-      93           0 :         status = H5Sclose(attr_space);
-      94             : 
-      95           0 :         return status;
-      96             : }
-      97             : 
-      98             : 
-      99             : 
-     100           1 : void HDF5Output::open(const std::string& filename) {
-     101           1 :         file = H5Fcreate(filename.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
-     102           1 :         if (file < 0)
-     103           2 :                 throw std::runtime_error(std::string("Cannot create file: ") + filename);
-     104             : 
-     105             : 
-     106           0 :         sid = H5Tcreate(H5T_COMPOUND, sizeof(OutputRow));
-     107           0 :         if (fields.test(TrajectoryLengthColumn))
-     108           0 :                 H5Tinsert(sid, "D", HOFFSET(OutputRow, D), H5T_NATIVE_DOUBLE);
-     109           0 :         if (fields.test(RedshiftColumn))
-     110           0 :                 H5Tinsert(sid, "z", HOFFSET(OutputRow, z), H5T_NATIVE_DOUBLE);
-     111           0 :         if (fields.test(SerialNumberColumn))
-     112           0 :                 H5Tinsert(sid, "SN", HOFFSET(OutputRow, SN), H5T_NATIVE_UINT64);
-     113           0 :         if (fields.test(CurrentIdColumn))
-     114           0 :                 H5Tinsert(sid, "ID", HOFFSET(OutputRow, ID), H5T_NATIVE_INT32);
-     115           0 :         if (fields.test(CurrentEnergyColumn))
-     116           0 :                 H5Tinsert(sid, "E", HOFFSET(OutputRow, E), H5T_NATIVE_DOUBLE);
-     117           0 :         if (fields.test(CurrentPositionColumn) && oneDimensional)
-     118           0 :                 H5Tinsert(sid, "X", HOFFSET(OutputRow, X), H5T_NATIVE_DOUBLE);
-     119           0 :         if (fields.test(CurrentPositionColumn) && not oneDimensional) {
-     120           0 :                 H5Tinsert(sid, "X", HOFFSET(OutputRow, X), H5T_NATIVE_DOUBLE);
-     121           0 :                 H5Tinsert(sid, "Y", HOFFSET(OutputRow, Y), H5T_NATIVE_DOUBLE);
-     122           0 :                 H5Tinsert(sid, "Z", HOFFSET(OutputRow, Z), H5T_NATIVE_DOUBLE);
-     123             :         }
-     124           0 :         if (fields.test(CurrentDirectionColumn) && not oneDimensional) {
-     125           0 :                 H5Tinsert(sid, "Px", HOFFSET(OutputRow, Px), H5T_NATIVE_DOUBLE);
-     126           0 :                 H5Tinsert(sid, "Py", HOFFSET(OutputRow, Py), H5T_NATIVE_DOUBLE);
-     127           0 :                 H5Tinsert(sid, "Pz", HOFFSET(OutputRow, Pz), H5T_NATIVE_DOUBLE);
-     128             :         }
-     129           0 :         if (fields.test(SerialNumberColumn))
-     130           0 :                 H5Tinsert(sid, "SN0", HOFFSET(OutputRow, SN0), H5T_NATIVE_UINT64);
-     131           0 :         if (fields.test(SourceIdColumn))
-     132           0 :                 H5Tinsert(sid, "ID0", HOFFSET(OutputRow, ID0), H5T_NATIVE_INT32);
-     133           0 :         if (fields.test(SourceEnergyColumn))
-     134           0 :                 H5Tinsert(sid, "E0", HOFFSET(OutputRow, E0), H5T_NATIVE_DOUBLE);
-     135           0 :         if (fields.test(SourcePositionColumn) && oneDimensional)
-     136           0 :                 H5Tinsert(sid, "X0", HOFFSET(OutputRow, X0), H5T_NATIVE_DOUBLE);
-     137           0 :         if (fields.test(SourcePositionColumn) && not oneDimensional){
-     138           0 :                 H5Tinsert(sid, "X0", HOFFSET(OutputRow, X0), H5T_NATIVE_DOUBLE);
-     139           0 :                 H5Tinsert(sid, "Y0", HOFFSET(OutputRow, Y0), H5T_NATIVE_DOUBLE);
-     140           0 :                 H5Tinsert(sid, "Z0", HOFFSET(OutputRow, Z0), H5T_NATIVE_DOUBLE);
-     141             :         }
-     142           0 :         if (fields.test(SourceDirectionColumn) && not oneDimensional) {
-     143           0 :                 H5Tinsert(sid, "P0x", HOFFSET(OutputRow, P0x), H5T_NATIVE_DOUBLE);
-     144           0 :                 H5Tinsert(sid, "P0y", HOFFSET(OutputRow, P0y), H5T_NATIVE_DOUBLE);
-     145           0 :                 H5Tinsert(sid, "P0z", HOFFSET(OutputRow, P0z), H5T_NATIVE_DOUBLE);
-     146             :         }
-     147           0 :         if (fields.test(SerialNumberColumn))
-     148           0 :                 H5Tinsert(sid, "SN1", HOFFSET(OutputRow, SN1), H5T_NATIVE_UINT64);
-     149           0 :         if (fields.test(CreatedIdColumn))
-     150           0 :                 H5Tinsert(sid, "ID1", HOFFSET(OutputRow, ID1), H5T_NATIVE_INT32);
-     151           0 :         if (fields.test(CreatedEnergyColumn))
-     152           0 :                 H5Tinsert(sid, "E1", HOFFSET(OutputRow, E1), H5T_NATIVE_DOUBLE);
-     153           0 :         if (fields.test(CreatedPositionColumn) && oneDimensional)
-     154           0 :                 H5Tinsert(sid, "X1", HOFFSET(OutputRow, X1), H5T_NATIVE_DOUBLE);
-     155           0 :         if (fields.test(CreatedPositionColumn) && not oneDimensional) {
-     156           0 :                 H5Tinsert(sid, "X1", HOFFSET(OutputRow, X1), H5T_NATIVE_DOUBLE);
-     157           0 :                 H5Tinsert(sid, "Y1", HOFFSET(OutputRow, Y1), H5T_NATIVE_DOUBLE);
-     158           0 :                 H5Tinsert(sid, "Z1", HOFFSET(OutputRow, Z1), H5T_NATIVE_DOUBLE);
-     159             :         }
-     160           0 :         if (fields.test(CreatedDirectionColumn) && not oneDimensional) {
-     161           0 :                 H5Tinsert(sid, "P1x", HOFFSET(OutputRow, P1x), H5T_NATIVE_DOUBLE);
-     162           0 :                 H5Tinsert(sid, "P1y", HOFFSET(OutputRow, P1y), H5T_NATIVE_DOUBLE);
-     163           0 :                 H5Tinsert(sid, "P1z", HOFFSET(OutputRow, P1z), H5T_NATIVE_DOUBLE);
-     164             :         }
-     165           0 :         if (fields.test(WeightColumn))
-     166           0 :                 H5Tinsert(sid, "W", HOFFSET(OutputRow, weight), H5T_NATIVE_DOUBLE);
-     167             :         
-     168           0 :         if (fields.test(CandidateTagColumn)) 
-     169           0 :                 H5Tinsert(sid, "tag", HOFFSET(OutputRow, tag), H5T_C_S1);
-     170             : 
-     171           0 :         size_t pos = 0;
-     172           0 :         for(std::vector<Output::Property>::const_iterator iter = properties.begin();
-     173           0 :                         iter != properties.end(); ++iter)
-     174             :         {
-     175           0 :                         hid_t type = variantTypeToH5T_NATIVE((*iter).defaultValue.getType());
-     176           0 :                         if (type == H5T_C_S1)
-     177             :                         { // set size of string field to size of default value!
-     178           0 :                                 type = H5Tcopy(H5T_C_S1);
-     179           0 :                                 H5Tset_size(type, (*iter).defaultValue.toString().size());
-     180             :                         }
-     181             : 
-     182           0 :                         H5Tinsert(sid, (*iter).name.c_str(), HOFFSET(OutputRow, propertyBuffer) + pos, type);
-     183           0 :                   pos += (*iter).defaultValue.getSize();
-     184             :         }
-     185           0 :         if (pos >= propertyBufferSize)
-     186             :         {
-     187           0 :                 KISS_LOG_ERROR << "Using " << pos << " bytes for properties output. Maximum is " << propertyBufferSize << " bytes.";
-     188           0 :                 throw std::runtime_error("Size of property buffer exceeded");
-     189             :         }
-     190             : 
-     191             :         // chunked prop
-     192           0 :         hid_t plist = H5Pcreate(H5P_DATASET_CREATE);
-     193           0 :         H5Pset_layout(plist, H5D_CHUNKED);
-     194           0 :         hsize_t chunk_dims[RANK] = {BUFFER_SIZE};
-     195           0 :         H5Pset_chunk(plist, RANK, chunk_dims);
-     196           0 :         H5Pset_deflate(plist, 5);
-     197             : 
-     198           0 :         hsize_t dims[RANK] = {0};
-     199           0 :         hsize_t max_dims[RANK] = {H5S_UNLIMITED};
-     200           0 :         dataspace = H5Screate_simple(RANK, dims, max_dims);
-     201             : 
-     202           0 :         dset = H5Dcreate2(file, "CRPROPA3", sid, dataspace, H5P_DEFAULT, plist, H5P_DEFAULT);
-     203             : 
-     204           0 :         insertStringAttribute("OutputType", outputName);
-     205           0 :         insertStringAttribute("Version", g_GIT_DESC);
-     206           0 :         insertDoubleAttribute("LengthScale", this->lengthScale);
-     207           0 :         insertDoubleAttribute("EnergyScale", this->energyScale);
-     208             : 
-     209             :         // add ranom seeds
-     210           0 :         std::vector< std::vector<uint32_t> > seeds = Random::getSeedThreads();
-     211           0 :         for (size_t i = 0; i < seeds.size(); i++)
-     212             :         {
-     213             :                 hid_t   type, attr_space, version_attr;
-     214             :                 herr_t  status;
-     215           0 :                 hsize_t dims[] = {1, 0};
-     216           0 :                 dims[1] = seeds[i].size();
-     217             : 
-     218           0 :                 type = H5Tarray_create(H5T_NATIVE_ULONG, 2, dims);
-     219             : 
-     220           0 :                 attr_space = H5Screate_simple(0, dims, NULL);
-     221             :                 char nameBuffer[256];
-     222             :                 sprintf(nameBuffer, "SEED_%03lu", i);
-     223           0 :                 KISS_LOG_DEBUG << "Creating HDF5 attribute: " << nameBuffer << " with dimensions " << dims[0] << "x" << dims[1] ;
-     224             : 
-     225           0 :                 version_attr = H5Acreate2(dset, nameBuffer, type, attr_space, H5P_DEFAULT, H5P_DEFAULT);
-     226           0 :                 status = H5Awrite(version_attr, type, &seeds[i][0]);
-     227           0 :                 status = H5Aclose(version_attr);
-     228           0 :                 status = H5Sclose(attr_space);
-     229             : 
-     230             :         }
-     231             : 
-     232             : 
-     233           0 :         H5Pclose(plist);
-     234             : 
-     235           0 :         buffer.reserve(BUFFER_SIZE);
-     236           0 :         time(&lastFlush);
-     237           0 : }
-     238             : 
-     239           1 : void HDF5Output::close() {
-     240           1 :         if (file >= 0) {
-     241           0 :                 flush();
-     242           0 :                 H5Dclose(dset);
-     243           0 :                 H5Tclose(sid);
-     244           0 :                 H5Sclose(dataspace);
-     245           0 :                 H5Fclose(file);
-     246           0 :                 file = -1;
-     247             :         }
-     248           1 : }
-     249             : 
-     250           0 : void HDF5Output::process(Candidate* candidate) const {
-     251           0 :         #pragma omp critical
-     252             :         {
-     253           0 :         if (file == -1)
-     254             :                 // This is ugly, but necesary as otherwise the user has to manually open the
-     255             :                 // file before processing the first candidate
-     256           0 :                 const_cast<HDF5Output*>(this)->open(filename);
-     257             :         }
-     258             : 
-     259             :         OutputRow r;
-     260           0 :         r.D = candidate->getTrajectoryLength() / lengthScale;
-     261           0 :         r.z = candidate->getRedshift();
-     262             : 
-     263           0 :         r.SN = candidate->getSerialNumber();
-     264           0 :         r.ID = candidate->current.getId();
-     265           0 :         r.E = candidate->current.getEnergy() / energyScale;
-     266           0 :         Vector3d v = candidate->current.getPosition() / lengthScale;
-     267           0 :         r.X = v.x;
-     268           0 :         r.Y = v.y;
-     269           0 :         r.Z = v.z;
-     270           0 :         v = candidate->current.getDirection();
-     271           0 :         r.Px = v.x;
-     272           0 :         r.Py = v.y;
-     273           0 :         r.Pz = v.z;
-     274             : 
-     275           0 :         r.SN0 = candidate->getSourceSerialNumber();
-     276           0 :         r.ID0 = candidate->source.getId();
-     277           0 :         r.E0 = candidate->source.getEnergy() / energyScale;
-     278           0 :         v = candidate->source.getPosition() / lengthScale;
-     279           0 :         r.X0 = v.x;
-     280           0 :         r.Y0 = v.y;
-     281           0 :         r.Z0 = v.z;
-     282           0 :         v = candidate->source.getDirection();
-     283           0 :         r.P0x = v.x;
-     284           0 :         r.P0y = v.y;
-     285           0 :         r.P0z = v.z;
-     286             : 
-     287           0 :         r.SN1 = candidate->getCreatedSerialNumber();
-     288           0 :         r.ID1 = candidate->created.getId();
-     289           0 :         r.E1 = candidate->created.getEnergy() / energyScale;
-     290           0 :         v = candidate->created.getPosition() / lengthScale;
-     291           0 :         r.X1 = v.x;
-     292           0 :         r.Y1 = v.y;
-     293           0 :         r.Z1 = v.z;
-     294           0 :         v = candidate->created.getDirection();
-     295           0 :         r.P1x = v.x;
-     296           0 :         r.P1y = v.y;
-     297           0 :         r.P1z = v.z;
-     298             : 
-     299           0 :         r.weight= candidate->getWeight();
-     300             : 
-     301           0 :         r.tag = candidate->getTagOrigin();
-     302             : 
-     303             :         size_t pos = 0;
-     304           0 :         for(std::vector<Output::Property>::const_iterator iter = properties.begin();
-     305           0 :                         iter != properties.end(); ++iter)
-     306             :         {
-     307           0 :                   Variant v;
-     308           0 :                         if (candidate->hasProperty((*iter).name))
-     309             :                         {
-     310           0 :                                 v = candidate->getProperty((*iter).name);
-     311             :                         }
-     312             :                         else
-     313             :                         {
-     314           0 :                                 v = (*iter).defaultValue;
-     315             :                         }
-     316           0 :                         pos += v.copyToBuffer(&r.propertyBuffer[pos]);
-     317           0 :         }
-     318             : 
-     319           0 :         #pragma omp critical
-     320             :         {
-     321           0 :                 const_cast<HDF5Output*>(this)->candidatesSinceFlush++;
-     322           0 :                 Output::process(candidate);
-     323             : 
-     324           0 :                 buffer.push_back(r);
-     325             : 
-     326             : 
-     327           0 :                 if (buffer.size() >= buffer.capacity())
-     328             :                 {
-     329           0 :                         KISS_LOG_DEBUG << "HDF5Output: Flush due to buffer capacity exceeded";
-     330           0 :                         flush();
-     331             :                 }
-     332           0 :                 else if (candidatesSinceFlush >= flushLimit)
-     333             :                 {
-     334           0 :                         KISS_LOG_DEBUG << "HDF5Output: Flush due to number of candidates";
-     335           0 :                         flush();
-     336             :                 }
-     337           0 :                 else if (difftime(time(NULL), lastFlush) > 60*10)
-     338             :                 {
-     339           0 :                         KISS_LOG_DEBUG << "HDF5Output: Flush due to time exceeded";
-     340           0 :                         flush();
-     341             :                 }
-     342             :         }
-     343           0 : }
-     344             : 
-     345           0 : void HDF5Output::flush() const {
-     346           0 :         const_cast<HDF5Output*>(this)->lastFlush = time(NULL);
-     347           0 :         const_cast<HDF5Output*>(this)->candidatesSinceFlush = 0;
-     348             : 
-     349             :         hsize_t n = buffer.size();
-     350             : 
-     351           0 :         if (n == 0)
-     352           0 :                 return;
-     353             : 
-     354           0 :         hid_t file_space = H5Dget_space(dset);
-     355           0 :         hsize_t count = H5Sget_simple_extent_npoints(file_space);
-     356             : 
-     357             :         // resize dataset
-     358           0 :         hsize_t new_size[RANK] = {count + n};
-     359           0 :         H5Dset_extent(dset, new_size);
-     360             : 
-     361             :         // get updated filespace
-     362           0 :         H5Sclose(file_space);
-     363           0 :         file_space = H5Dget_space(dset);
-     364             : 
-     365           0 :         hsize_t offset[RANK] = {count};
-     366           0 :         hsize_t cnt[RANK] = {n};
-     367             : 
-     368           0 :         H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, cnt, NULL);
-     369           0 :         hid_t mspace_id = H5Screate_simple(RANK, cnt, NULL);
-     370             : 
-     371           0 :         H5Dwrite(dset, sid, mspace_id, file_space, H5P_DEFAULT, buffer.data());
-     372             : 
-     373           0 :         H5Sclose(mspace_id);
-     374           0 :         H5Sclose(file_space);
-     375             : 
-     376           0 :         buffer.clear();
-     377             : 
-     378           0 :         H5Fflush(file, H5F_SCOPE_GLOBAL);
-     379             : }
-     380             : 
-     381           0 : std::string HDF5Output::getDescription() const  {
-     382           0 :         return "HDF5Output";
-     383             : }
-     384             : 
-     385           0 : void HDF5Output::setFlushLimit(unsigned int N)
-     386             : {
-     387           0 :         flushLimit = N;
-     388           0 : }
-     389             : 
-     390             : } // namespace crpropa
-     391             : 
-     392             : #endif // CRPROPA_HAVE_HDF5
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/MomentumDiffusion.cpp.func-sort-c.html b/doc/coverageReport/src/module/MomentumDiffusion.cpp.func-sort-c.html deleted file mode 100644 index 8f9c1026b..000000000 --- a/doc/coverageReport/src/module/MomentumDiffusion.cpp.func-sort-c.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/MomentumDiffusion.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - MomentumDiffusion.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:114524.4 %
Date:2024-04-08 14:58:22Functions:31030.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa25ConstantMomentumDiffusionC2Edd0
_ZNK7crpropa25ConstantMomentumDiffusion14getDescriptionB5cxx11Ev0
_ZNK7crpropa25ConstantMomentumDiffusion16calculateAScalarEd0
_ZNK7crpropa25ConstantMomentumDiffusion16calculateBScalarEv0
_ZNK7crpropa25ConstantMomentumDiffusion6getDppEv0
_ZNK7crpropa25ConstantMomentumDiffusion7processEPNS_9CandidateE0
_ZNK7crpropa25ConstantMomentumDiffusion8getLimitEv0
_ZN7crpropa25ConstantMomentumDiffusion6setDppEd1
_ZN7crpropa25ConstantMomentumDiffusionC2Ed1
_ZN7crpropa25ConstantMomentumDiffusion8setLimitEd2
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/MomentumDiffusion.cpp.func.html b/doc/coverageReport/src/module/MomentumDiffusion.cpp.func.html deleted file mode 100644 index 377203fb6..000000000 --- a/doc/coverageReport/src/module/MomentumDiffusion.cpp.func.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/MomentumDiffusion.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - MomentumDiffusion.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:114524.4 %
Date:2024-04-08 14:58:22Functions:31030.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa25ConstantMomentumDiffusion6setDppEd1
_ZN7crpropa25ConstantMomentumDiffusion8setLimitEd2
_ZN7crpropa25ConstantMomentumDiffusionC2Ed1
_ZN7crpropa25ConstantMomentumDiffusionC2Edd0
_ZNK7crpropa25ConstantMomentumDiffusion14getDescriptionB5cxx11Ev0
_ZNK7crpropa25ConstantMomentumDiffusion16calculateAScalarEd0
_ZNK7crpropa25ConstantMomentumDiffusion16calculateBScalarEv0
_ZNK7crpropa25ConstantMomentumDiffusion6getDppEv0
_ZNK7crpropa25ConstantMomentumDiffusion7processEPNS_9CandidateE0
_ZNK7crpropa25ConstantMomentumDiffusion8getLimitEv0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/MomentumDiffusion.cpp.gcov.html b/doc/coverageReport/src/module/MomentumDiffusion.cpp.gcov.html deleted file mode 100644 index 926f0af54..000000000 --- a/doc/coverageReport/src/module/MomentumDiffusion.cpp.gcov.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/MomentumDiffusion.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - MomentumDiffusion.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:114524.4 %
Date:2024-04-08 14:58:22Functions:31030.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/MomentumDiffusion.h"
-       2             : 
-       3             : using namespace crpropa;
-       4             : 
-       5           1 : ConstantMomentumDiffusion::ConstantMomentumDiffusion(double Dpp) {
-       6           1 :         setLimit(0.1);
-       7           1 :         setDpp(Dpp);
-       8           1 : }
-       9             : 
-      10           0 : ConstantMomentumDiffusion::ConstantMomentumDiffusion(double Dpp, double limit) {
-      11           0 :         setLimit(limit);
-      12           0 :         setDpp(Dpp);
-      13           0 : }
-      14             : 
-      15           0 : void ConstantMomentumDiffusion::process(Candidate *c) const {
-      16           0 :         double rig = c->current.getRigidity();
-      17           0 :         if (std::isinf(rig)) {
-      18             :                 return; // Only charged particles
-      19             :         }
-      20             :         
-      21           0 :         double p = c->current.getEnergy() / c_light; // Note we use E=p/c (relativistic limit)
-      22           0 :         double dt = c->getCurrentStep() / c_light;
-      23             :         
-      24           0 :         double eta =  Random::instance().randNorm();
-      25           0 :         double domega = eta * sqrt(dt);
-      26             :         
-      27           0 :         double AScal = calculateAScalar(p);
-      28           0 :         double BScal = calculateBScalar();
-      29             : 
-      30           0 :         double dp = AScal * dt + BScal * domega;
-      31           0 :         c->current.setEnergy((p + dp) * c_light);
-      32             :         
-      33           0 :         c->limitNextStep(limit * p / AScal * c_light);
-      34             : }
-      35             : 
-      36           0 : double ConstantMomentumDiffusion::calculateAScalar(double p) const {
-      37           0 :         double a = + 2. / p * Dpp;
-      38           0 :         return a; 
-      39             : }
-      40             : 
-      41           0 : double ConstantMomentumDiffusion::calculateBScalar() const {
-      42           0 :         double b = sqrt(2 * Dpp);
-      43           0 :         return b;
-      44             : }
-      45             : 
-      46           1 : void ConstantMomentumDiffusion::setDpp(double d) {
-      47           1 :         if (d < 0 )
-      48           0 :                 throw std::runtime_error(
-      49           0 :                                 "ConstantMomentumDiffusion: Dpp must be non-negative");
-      50           1 :         Dpp = d;
-      51           1 : }
-      52             : 
-      53           2 : void ConstantMomentumDiffusion::setLimit(double l) {
-      54           2 :         limit = l;
-      55           2 : }
-      56             : 
-      57           0 : double ConstantMomentumDiffusion::getDpp() const {
-      58           0 :         return Dpp;
-      59             : }
-      60             : 
-      61           0 : double ConstantMomentumDiffusion::getLimit() const {
-      62           0 :         return limit;
-      63             : }
-      64             : 
-      65           0 : std::string ConstantMomentumDiffusion::getDescription() const {
-      66           0 :         std::stringstream s;
-      67           0 :         s << "limit: " << limit << "\n";
-      68           0 :         s << "Dpp: " << Dpp / (meter * meter / second) << " m^2/s";
-      69             : 
-      70           0 :         return s.str();
-      71           0 : }
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/NuclearDecay.cpp.func-sort-c.html b/doc/coverageReport/src/module/NuclearDecay.cpp.func-sort-c.html deleted file mode 100644 index dde7b40eb..000000000 --- a/doc/coverageReport/src/module/NuclearDecay.cpp.func-sort-c.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/NuclearDecay.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - NuclearDecay.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13716881.5 %
Date:2024-04-08 14:58:22Functions:111384.6 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa12NuclearDecay12meanFreePathEid0
_ZN7crpropa12NuclearDecay8setLimitEd0
_ZN7crpropa12NuclearDecay14setHavePhotonsEb1
_ZN7crpropa12NuclearDecay16setHaveNeutrinosEb1
_ZN7crpropa12NuclearDecay17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa12NuclearDecay16setHaveElectronsEb2
_ZNK7crpropa12NuclearDecay17getInteractionTagB5cxx11Ev2
_ZN7crpropa12NuclearDecayC2Ebbbd9
_ZNK7crpropa12NuclearDecay13gammaEmissionEPNS_9CandidateEi11
_ZNK7crpropa12NuclearDecay9betaDecayEPNS_9CandidateEb499
_ZNK7crpropa12NuclearDecay15nucleonEmissionEPNS_9CandidateEii699
_ZNK7crpropa12NuclearDecay18performInteractionEPNS_9CandidateEi984
_ZNK7crpropa12NuclearDecay7processEPNS_9CandidateE7647
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/NuclearDecay.cpp.func.html b/doc/coverageReport/src/module/NuclearDecay.cpp.func.html deleted file mode 100644 index 2adf42079..000000000 --- a/doc/coverageReport/src/module/NuclearDecay.cpp.func.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/NuclearDecay.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - NuclearDecay.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13716881.5 %
Date:2024-04-08 14:58:22Functions:111384.6 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa12NuclearDecay12meanFreePathEid0
_ZN7crpropa12NuclearDecay14setHavePhotonsEb1
_ZN7crpropa12NuclearDecay16setHaveElectronsEb2
_ZN7crpropa12NuclearDecay16setHaveNeutrinosEb1
_ZN7crpropa12NuclearDecay17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa12NuclearDecay8setLimitEd0
_ZN7crpropa12NuclearDecayC2Ebbbd9
_ZNK7crpropa12NuclearDecay13gammaEmissionEPNS_9CandidateEi11
_ZNK7crpropa12NuclearDecay15nucleonEmissionEPNS_9CandidateEii699
_ZNK7crpropa12NuclearDecay17getInteractionTagB5cxx11Ev2
_ZNK7crpropa12NuclearDecay18performInteractionEPNS_9CandidateEi984
_ZNK7crpropa12NuclearDecay7processEPNS_9CandidateE7647
_ZNK7crpropa12NuclearDecay9betaDecayEPNS_9CandidateEb499
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/NuclearDecay.cpp.gcov.html b/doc/coverageReport/src/module/NuclearDecay.cpp.gcov.html deleted file mode 100644 index a9a87ffa4..000000000 --- a/doc/coverageReport/src/module/NuclearDecay.cpp.gcov.html +++ /dev/null @@ -1,395 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/NuclearDecay.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - NuclearDecay.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:13716881.5 %
Date:2024-04-08 14:58:22Functions:111384.6 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/NuclearDecay.h"
-       2             : #include "crpropa/Units.h"
-       3             : #include "crpropa/ParticleID.h"
-       4             : #include "crpropa/ParticleMass.h"
-       5             : #include "crpropa/Random.h"
-       6             : 
-       7             : #include <fstream>
-       8             : #include <limits>
-       9             : #include <cmath>
-      10             : #include <stdexcept>
-      11             : 
-      12             : #include "kiss/logger.h"
-      13             : 
-      14             : namespace crpropa {
-      15             : 
-      16           9 : NuclearDecay::NuclearDecay(bool electrons, bool photons, bool neutrinos, double l) {
-      17           9 :         haveElectrons = electrons;
-      18           9 :         havePhotons = photons;
-      19           9 :         haveNeutrinos = neutrinos;
-      20           9 :         limit = l;
-      21           9 :         setDescription("NuclearDecay");
-      22             : 
-      23             :         // load decay table
-      24          18 :         std::string filename = getDataPath("nuclear_decay.txt");
-      25           9 :         std::ifstream infile(filename.c_str());
-      26           9 :         if (!infile.good())
-      27           0 :                 throw std::runtime_error(
-      28           0 :                                 "crpropa::NuclearDecay: could not open file " + filename);
-      29             : 
-      30           9 :         decayTable.resize(27 * 31);
-      31             :         std::string line;
-      32        8550 :         while (std::getline(infile,line)) {
-      33        8541 :                 std::stringstream stream(line);
-      34        8541 :                 if (stream.peek() == '#')
-      35             :                         continue;
-      36             :                 DecayMode decay;
-      37             :                 int Z, N;
-      38             :                 double lifetime;
-      39        8523 :                 stream >> Z >> N >> decay.channel >> lifetime;
-      40        8523 :                 decay.rate = 1. / lifetime / c_light; // decay rate in [1/m]
-      41             :                 std::vector<double> gamma;
-      42             :                 double val;
-      43       34227 :                 while (stream >> val)
-      44       25704 :                         gamma.push_back(val);
-      45       21375 :                 for (int i = 0; i < gamma.size(); i += 2) {
-      46       12852 :                         decay.energy.push_back(gamma[i] * keV);
-      47       12852 :                         decay.intensity.push_back(gamma[i+1]);
-      48             :                 }
-      49        8523 :                 if (infile)
-      50        8523 :                         decayTable[Z * 31 + N].push_back(decay);
-      51        8541 :         }
-      52           9 :         infile.close();
-      53          18 : }
-      54             : 
-      55           2 : void NuclearDecay::setHaveElectrons(bool b) {
-      56           2 :         haveElectrons = b;
-      57           2 : }
-      58             : 
-      59           1 : void NuclearDecay::setHavePhotons(bool b) {
-      60           1 :         havePhotons = b;
-      61           1 : }
-      62             : 
-      63           1 : void NuclearDecay::setHaveNeutrinos(bool b) {
-      64           1 :         haveNeutrinos = b;
-      65           1 : }
-      66             : 
-      67           0 : void NuclearDecay::setLimit(double l) {
-      68           0 :         limit = l;
-      69           0 : }
-      70             : 
-      71        7647 : void NuclearDecay::process(Candidate *candidate) const {
-      72             :         // the loop should be processed at least once for limiting the next step
-      73        7647 :         double step = candidate->getCurrentStep();
-      74        7647 :         double z = candidate->getRedshift();
-      75             :         do {
-      76             :                 // check if nucleus
-      77        7672 :                 int id = candidate->current.getId();
-      78        7672 :                 if (not (isNucleus(id)))
-      79             :                         return;
-      80             : 
-      81        7671 :                 int A = massNumber(id);
-      82        7671 :                 int Z = chargeNumber(id);
-      83        7671 :                 int N = A - Z;
-      84             : 
-      85             :                 // check if particle can decay
-      86        7671 :                 const std::vector<DecayMode> &decays = decayTable[Z * 31 + N];
-      87        7671 :                 if (decays.size() == 0)
-      88             :                         return;
-      89             : 
-      90             :                 // find interaction mode with minimum random decay distance
-      91         328 :                 Random &random = Random::instance();
-      92             :                 double randDistance = std::numeric_limits<double>::max();
-      93             :                 int channel;
-      94             :                 double totalRate = 0;
-      95             : 
-      96         656 :                 for (size_t i = 0; i < decays.size(); i++) {
-      97         328 :                         double rate = decays[i].rate;
-      98         328 :                         rate /= candidate->current.getLorentzFactor();  // relativistic time dilation
-      99         328 :                         rate /= (1 + z);  // rate per light travel distance -> rate per comoving distance
-     100         328 :                         totalRate += rate;
-     101         328 :                         double d = -log(random.rand()) / rate;
-     102         328 :                         if (d > randDistance)
-     103           0 :                                 continue;
-     104             :                         randDistance = d;
-     105         328 :                         channel = decays[i].channel;
-     106             :                 }
-     107             : 
-     108             :                 // check if interaction doesn't happen
-     109         328 :                 if (step < randDistance) {
-     110             :                         // limit next step to a fraction of the mean free path
-     111         303 :                         candidate->limitNextStep(limit / totalRate);
-     112         303 :                         return;
-     113             :                 }
-     114             : 
-     115             :                 // interact and repeat with remaining step
-     116          25 :                 performInteraction(candidate, channel);
-     117          25 :                 step -= randDistance;
-     118          25 :         } while (step > 0);
-     119             : }
-     120             : 
-     121         984 : void NuclearDecay::performInteraction(Candidate *candidate, int channel) const {
-     122             :         // interpret decay channel
-     123             :         int nBetaMinus = digit(channel, 10000);
-     124             :         int nBetaPlus = digit(channel, 1000);
-     125             :         int nAlpha = digit(channel, 100);
-     126             :         int nProton = digit(channel, 10);
-     127             :         int nNeutron = digit(channel, 1);
-     128             : 
-     129             :         // perform decays
-     130         984 :         if (havePhotons)
-     131          11 :                 gammaEmission(candidate,channel);
-     132        1314 :         for (size_t i = 0; i < nBetaMinus; i++)
-     133         330 :                 betaDecay(candidate, false);
-     134        1153 :         for (size_t i = 0; i < nBetaPlus; i++)
-     135         169 :                 betaDecay(candidate, true);
-     136        1008 :         for (size_t i = 0; i < nAlpha; i++)
-     137          24 :                 nucleonEmission(candidate, 4, 2);
-     138        1319 :         for (size_t i = 0; i < nProton; i++)
-     139         335 :                 nucleonEmission(candidate, 1, 1);
-     140        1324 :         for (size_t i = 0; i < nNeutron; i++)
-     141         340 :                 nucleonEmission(candidate, 1, 0);
-     142         984 : }
-     143             : 
-     144          11 : void NuclearDecay::gammaEmission(Candidate *candidate, int channel) const {
-     145          11 :         int id = candidate->current.getId();
-     146          11 :         int Z = chargeNumber(id);
-     147          11 :         int N = massNumber(id) - Z;
-     148             : 
-     149             :         // get photon energies and emission probabilities for decay channel
-     150          11 :         const std::vector<DecayMode> &decays = decayTable[Z * 31 + N];
-     151             :         size_t idecay = decays.size();
-     152          21 :         while (idecay-- != 0) {
-     153          21 :                 if (decays[idecay].channel == channel)
-     154             :                         break;
-     155             :         }
-     156             : 
-     157             :         const std::vector<double> &energy = decays[idecay].energy;
-     158             :         const std::vector<double> &intensity = decays[idecay].intensity;
-     159             : 
-     160             :         // check if photon emission available
-     161          11 :         if (energy.size() == 0)
-     162           0 :                 return;
-     163             : 
-     164          11 :         Random &random = Random::instance();
-     165          11 :         Vector3d pos = random.randomInterpolatedPosition(candidate->previous.getPosition(), candidate->current.getPosition());
-     166             : 
-     167          26 :         for (int i = 0; i < energy.size(); ++i) {
-     168             :                 // check if photon of specific energy is emitted
-     169          15 :                 if (random.rand() > intensity[i])
-     170           5 :                         continue;
-     171             :                 // create secondary photon; boost to lab frame
-     172          10 :                 double cosTheta = 2 * random.rand() - 1;
-     173          10 :                 double E = energy[i] * candidate->current.getLorentzFactor() * (1. - cosTheta);
-     174          10 :                 candidate->addSecondary(22, E, pos, 1., interactionTag);
-     175             :         }
-     176             : }
-     177             : 
-     178         499 : void NuclearDecay::betaDecay(Candidate *candidate, bool isBetaPlus) const {
-     179         499 :         double gamma = candidate->current.getLorentzFactor();
-     180         499 :         int id = candidate->current.getId();
-     181         499 :         int A = massNumber(id);
-     182         499 :         int Z = chargeNumber(id);
-     183             : 
-     184             :         // beta- decay
-     185             :         int electronId = 11; // electron
-     186             :         int neutrinoId = -12; // anti-electron neutrino
-     187             :         int dZ = 1;
-     188             :         // beta+ decay
-     189         499 :         if (isBetaPlus) {
-     190             :                 electronId = -11; // positron
-     191             :                 neutrinoId = 12; // electron neutrino
-     192             :                 dZ = -1;
-     193             :         }
-     194             : 
-     195             :         // update candidate, nuclear recoil negligible
-     196             :         try
-     197             :         {
-     198         499 :                 candidate->current.setId(nucleusId(A, Z + dZ));
-     199             :         }
-     200           0 :         catch (std::runtime_error &e)
-     201             :         {
-     202           0 :                 KISS_LOG_ERROR<< "Something went wrong in the NuclearDecay\n" << "Please report this error on https://github.com/CRPropa/CRPropa3/issues including your simulation setup and the following random seed:\n" << Random::instance().getSeed_base64();
-     203           0 :                 throw;
-     204           0 :         }
-     205             : 
-     206         499 :         candidate->current.setLorentzFactor(gamma);
-     207             : 
-     208         499 :         if (not (haveElectrons or haveNeutrinos))
-     209         487 :                 return;
-     210             : 
-     211             :         // Q-value of the decay, subtract total energy of emitted photons
-     212          12 :         double m1 = nuclearMass(A, Z);
-     213          12 :         double m2 = nuclearMass(A, Z+dZ);
-     214          12 :         double Q = (m1 - m2 - mass_electron) * c_squared;
-     215             : 
-     216             :         // generate cdf of electron energy, neglecting Coulomb correction
-     217             :         // see Basdevant, Fundamentals in Nuclear Physics, eq. (4.92)
-     218             :         // This leads to deviations from theoretical expectations at low 
-     219             :         // primary energies.
-     220             :         std::vector<double> energies;
-     221             :         std::vector<double> densities; // cdf(E), unnormalized
-     222             : 
-     223          12 :         energies.reserve(51);
-     224          12 :         densities.reserve(51);
-     225             : 
-     226             :         double me = mass_electron * c_squared;
-     227          12 :         double cdf = 0;
-     228         624 :         for (int i = 0; i <= 50; i++) {
-     229         612 :                 double E = me + i / 50. * Q;
-     230         612 :                 cdf += E * sqrt(E * E - me * me) * pow(Q + me - E, 2);
-     231         612 :                 energies.push_back(E);
-     232         612 :                 densities.push_back(cdf);
-     233             :         }
-     234             : 
-     235             :         // draw random electron energy and angle
-     236             :         // assumption of ultra-relativistic particles 
-     237             :         // leads to deviations from theoretical predictions
-     238             :         // is not problematic for usual CRPropa energies E>~TeV
-     239          12 :         Random &random = Random::instance();
-     240          12 :         double E = interpolate(random.rand() * cdf, densities, energies);
-     241          12 :         double p = sqrt(E * E - me * me);  // p*c
-     242          12 :         double cosTheta = 2 * random.rand() - 1;
-     243             : 
-     244             :         // boost to lab frame
-     245          12 :         double Ee = gamma * (E - p * cosTheta);
-     246          12 :         double Enu = gamma * (Q + me - E) * (1 + cosTheta);  // pnu*c ~ Enu
-     247             : 
-     248          12 :         Vector3d pos = random.randomInterpolatedPosition(candidate->previous.getPosition(), candidate->current.getPosition());
-     249          12 :         if (haveElectrons)
-     250          12 :                 candidate->addSecondary(electronId, Ee, pos, 1., interactionTag);
-     251          12 :         if (haveNeutrinos)
-     252          10 :                 candidate->addSecondary(neutrinoId, Enu, pos, 1., interactionTag);
-     253             : }
-     254             : 
-     255         699 : void NuclearDecay::nucleonEmission(Candidate *candidate, int dA, int dZ) const {
-     256         699 :         Random &random = Random::instance();
-     257         699 :         int id = candidate->current.getId();
-     258         699 :         int A = massNumber(id);
-     259         699 :         int Z = chargeNumber(id);
-     260         699 :         double EpA = candidate->current.getEnergy() / double(A);
-     261             : 
-     262             :         try
-     263             :         {
-     264         699 :                 candidate->current.setId(nucleusId(A - dA, Z - dZ));
-     265             :         }
-     266           0 :         catch (std::runtime_error &e)
-     267             :         {
-     268           0 :                 KISS_LOG_ERROR<< "Something went wrong in the NuclearDecay\n" << "Please report this error on https://github.com/CRPropa/CRPropa3/issues including your simulation setup and the following random seed:\n" << Random::instance().getSeed_base64();
-     269           0 :                 throw;
-     270           0 :         }
-     271             : 
-     272         699 :         candidate->current.setEnergy(EpA * (A - dA));
-     273         699 :         Vector3d pos = random.randomInterpolatedPosition(candidate->previous.getPosition(),candidate->current.getPosition());
-     274             : 
-     275             :         try
-     276             :         {
-     277         699 :                 candidate->addSecondary(nucleusId(dA, dZ), EpA * dA, pos, 1., interactionTag);
-     278             :         }
-     279           0 :         catch (std::runtime_error &e)
-     280             :         {
-     281           0 :                 KISS_LOG_ERROR<< "Something went wrong in the NuclearDecay\n" << "Please report this error on https://github.com/CRPropa/CRPropa3/issues including your simulation setup and the following random seed:\n" << Random::instance().getSeed_base64();
-     282           0 :                 throw;
-     283           0 :         }
-     284             : 
-     285         699 : }
-     286             : 
-     287           0 : double NuclearDecay::meanFreePath(int id, double gamma) {
-     288           0 :         if (not (isNucleus(id)))
-     289             :                 return std::numeric_limits<double>::max();
-     290             : 
-     291           0 :         int A = massNumber(id);
-     292           0 :         int Z = chargeNumber(id);
-     293           0 :         int N = A - Z;
-     294             : 
-     295             :         // check if particle can decay
-     296           0 :         const std::vector<DecayMode> &decays = decayTable[Z * 31 + N];
-     297           0 :         if (decays.size() == 0)
-     298             :                 return std::numeric_limits<double>::max();
-     299             : 
-     300             :         double totalRate = 0;
-     301             : 
-     302           0 :         for (size_t i = 0; i < decays.size(); i++) {
-     303           0 :                 double rate = decays[i].rate;
-     304           0 :                 rate /= gamma;
-     305           0 :                 totalRate += rate;
-     306             :         }
-     307             : 
-     308           0 :         return 1. / totalRate;
-     309             : }
-     310             : 
-     311           1 : void NuclearDecay::setInteractionTag(std::string tag) {
-     312           1 :         interactionTag = tag;
-     313           1 : }
-     314             : 
-     315           2 : std::string NuclearDecay::getInteractionTag() const {
-     316           2 :         return interactionTag;
-     317             : }
-     318             : 
-     319             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/Observer.cpp.func-sort-c.html b/doc/coverageReport/src/module/Observer.cpp.func-sort-c.html deleted file mode 100644 index 7bf409276..000000000 --- a/doc/coverageReport/src/module/Observer.cpp.func-sort-c.html +++ /dev/null @@ -1,248 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/Observer.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - Observer.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8018044.4 %
Date:2024-04-08 14:58:22Functions:164436.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16ObserverTrackingC2ENS_7Vector3IdEEdd0
_ZN7crpropa21ObserverTimeEvolutionC2Ev0
_ZN7crpropa22ObserverParticleIdVetoC2Ei0
_ZN7crpropa22ObserverRedshiftWindowC2Edd0
_ZNK7crpropa10Observer1D14getDescriptionB5cxx11Ev0
_ZNK7crpropa15ObserverFeature14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa15ObserverFeature14getDescriptionB5cxx11Ev0
_ZNK7crpropa15ObserverSurface14getDescriptionB5cxx11Ev0
_ZNK7crpropa16ObserverTracking14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa16ObserverTracking14getDescriptionB5cxx11Ev0
_ZNK7crpropa17ObserverDetectAll14getDescriptionB5cxx11Ev0
_ZNK7crpropa18ObserverPhotonVeto14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa18ObserverPhotonVeto14getDescriptionB5cxx11Ev0
_ZNK7crpropa19ObserverNucleusVeto14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa19ObserverNucleusVeto14getDescriptionB5cxx11Ev0
_ZNK7crpropa20ObserverElectronVeto14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa20ObserverElectronVeto14getDescriptionB5cxx11Ev0
_ZNK7crpropa20ObserverInactiveVeto14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa20ObserverInactiveVeto14getDescriptionB5cxx11Ev0
_ZNK7crpropa20ObserverNeutrinoVeto14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa20ObserverNeutrinoVeto14getDescriptionB5cxx11Ev0
_ZNK7crpropa21ObserverTimeEvolution14getDescriptionB5cxx11Ev0
_ZNK7crpropa21ObserverTimeEvolution8getTimesEv0
_ZNK7crpropa22ObserverParticleIdVeto14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa22ObserverParticleIdVeto14getDescriptionB5cxx11Ev0
_ZNK7crpropa22ObserverRedshiftWindow14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa22ObserverRedshiftWindow14getDescriptionB5cxx11Ev0
_ZNK7crpropa8Observer14getDescriptionB5cxx11Ev0
_ZN7crpropa21ObserverTimeEvolutionC2Eddd1
_ZN7crpropa21ObserverTimeEvolutionC2Edddb1
_ZN7crpropa15ObserverSurfaceC2EPNS_7SurfaceE2
_ZN7crpropa21ObserverTimeEvolution12addTimeRangeEdddb2
_ZN7crpropa8Observer11onDetectionEPNS_6ModuleEb2
_ZN7crpropa8Observer24setDeactivateOnDetectionEb2
_ZN7crpropa8Observer7setFlagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_2
_ZNK7crpropa17ObserverDetectAll14checkDetectionEPNS_9CandidateE2
_ZN7crpropa21ObserverTimeEvolution7addTimeERKd4
_ZNK7crpropa15ObserverSurface14checkDetectionEPNS_9CandidateE4
_ZNK7crpropa21ObserverTimeEvolution14checkDetectionEPNS_9CandidateE6
_ZN7crpropa8Observer3addEPNS_15ObserverFeatureE10
_ZN7crpropa8ObserverC2Ev10
_ZNK7crpropa15ObserverFeature11onDetectionEPNS_9CandidateE52
_ZNK7crpropa10Observer1D14checkDetectionEPNS_9CandidateE7664
_ZNK7crpropa8Observer7processEPNS_9CandidateE7681
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/Observer.cpp.func.html b/doc/coverageReport/src/module/Observer.cpp.func.html deleted file mode 100644 index d3bea8de7..000000000 --- a/doc/coverageReport/src/module/Observer.cpp.func.html +++ /dev/null @@ -1,248 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/Observer.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - Observer.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8018044.4 %
Date:2024-04-08 14:58:22Functions:164436.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa15ObserverSurfaceC2EPNS_7SurfaceE2
_ZN7crpropa16ObserverTrackingC2ENS_7Vector3IdEEdd0
_ZN7crpropa21ObserverTimeEvolution12addTimeRangeEdddb2
_ZN7crpropa21ObserverTimeEvolution7addTimeERKd4
_ZN7crpropa21ObserverTimeEvolutionC2Eddd1
_ZN7crpropa21ObserverTimeEvolutionC2Edddb1
_ZN7crpropa21ObserverTimeEvolutionC2Ev0
_ZN7crpropa22ObserverParticleIdVetoC2Ei0
_ZN7crpropa22ObserverRedshiftWindowC2Edd0
_ZN7crpropa8Observer11onDetectionEPNS_6ModuleEb2
_ZN7crpropa8Observer24setDeactivateOnDetectionEb2
_ZN7crpropa8Observer3addEPNS_15ObserverFeatureE10
_ZN7crpropa8Observer7setFlagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_2
_ZN7crpropa8ObserverC2Ev10
_ZNK7crpropa10Observer1D14checkDetectionEPNS_9CandidateE7664
_ZNK7crpropa10Observer1D14getDescriptionB5cxx11Ev0
_ZNK7crpropa15ObserverFeature11onDetectionEPNS_9CandidateE52
_ZNK7crpropa15ObserverFeature14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa15ObserverFeature14getDescriptionB5cxx11Ev0
_ZNK7crpropa15ObserverSurface14checkDetectionEPNS_9CandidateE4
_ZNK7crpropa15ObserverSurface14getDescriptionB5cxx11Ev0
_ZNK7crpropa16ObserverTracking14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa16ObserverTracking14getDescriptionB5cxx11Ev0
_ZNK7crpropa17ObserverDetectAll14checkDetectionEPNS_9CandidateE2
_ZNK7crpropa17ObserverDetectAll14getDescriptionB5cxx11Ev0
_ZNK7crpropa18ObserverPhotonVeto14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa18ObserverPhotonVeto14getDescriptionB5cxx11Ev0
_ZNK7crpropa19ObserverNucleusVeto14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa19ObserverNucleusVeto14getDescriptionB5cxx11Ev0
_ZNK7crpropa20ObserverElectronVeto14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa20ObserverElectronVeto14getDescriptionB5cxx11Ev0
_ZNK7crpropa20ObserverInactiveVeto14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa20ObserverInactiveVeto14getDescriptionB5cxx11Ev0
_ZNK7crpropa20ObserverNeutrinoVeto14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa20ObserverNeutrinoVeto14getDescriptionB5cxx11Ev0
_ZNK7crpropa21ObserverTimeEvolution14checkDetectionEPNS_9CandidateE6
_ZNK7crpropa21ObserverTimeEvolution14getDescriptionB5cxx11Ev0
_ZNK7crpropa21ObserverTimeEvolution8getTimesEv0
_ZNK7crpropa22ObserverParticleIdVeto14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa22ObserverParticleIdVeto14getDescriptionB5cxx11Ev0
_ZNK7crpropa22ObserverRedshiftWindow14checkDetectionEPNS_9CandidateE0
_ZNK7crpropa22ObserverRedshiftWindow14getDescriptionB5cxx11Ev0
_ZNK7crpropa8Observer14getDescriptionB5cxx11Ev0
_ZNK7crpropa8Observer7processEPNS_9CandidateE7681
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/Observer.cpp.gcov.html b/doc/coverageReport/src/module/Observer.cpp.gcov.html deleted file mode 100644 index e54a180c9..000000000 --- a/doc/coverageReport/src/module/Observer.cpp.gcov.html +++ /dev/null @@ -1,427 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/Observer.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - Observer.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8018044.4 %
Date:2024-04-08 14:58:22Functions:164436.4 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/Observer.h"
-       2             : #include "crpropa/Units.h"
-       3             : #include "crpropa/ParticleID.h"
-       4             : #include "crpropa/Cosmology.h"
-       5             : 
-       6             : #include "kiss/logger.h"
-       7             : 
-       8             : #include <iostream>
-       9             : #include <cmath>
-      10             : 
-      11             : namespace crpropa {
-      12             : 
-      13             : // Observer -------------------------------------------------------------------
-      14          10 : Observer::Observer() :
-      15          10 :                 makeInactive(true), clone(false) {
-      16          10 : }
-      17             : 
-      18          10 : void Observer::add(ObserverFeature *feature) {
-      19          10 :         features.push_back(feature);
-      20          10 : }
-      21             : 
-      22           2 : void Observer::onDetection(Module *action, bool clone_) {
-      23           2 :         detectionAction = action;
-      24           2 :         clone = clone_;
-      25           2 : }
-      26             : 
-      27        7681 : void Observer::process(Candidate *candidate) const {
-      28             :         // loop over all features and have them check the particle
-      29             :         DetectionState state = NOTHING;
-      30       15362 :         for (int i = 0; i < features.size(); i++) {
-      31        7681 :                 DetectionState s = features[i]->checkDetection(candidate);
-      32        7681 :                 if (s == VETO)
-      33             :                         state = VETO;
-      34        7681 :                 else if ((s == DETECTED) && (state != VETO))
-      35             :                         state = DETECTED;
-      36             :         }
-      37             : 
-      38        7681 :         if (state == DETECTED) {
-      39         104 :                 for (int i = 0; i < features.size(); i++) {
-      40          52 :                         features[i]->onDetection(candidate);
-      41             :                 }
-      42             : 
-      43          52 :                 if (detectionAction.valid()) {
-      44          38 :                         if (clone)
-      45           0 :                                 detectionAction->process(candidate->clone(false));
-      46             :                         else
-      47          38 :                                 detectionAction->process(candidate);
-      48             :                 }
-      49             : 
-      50          52 :                 if (!flagKey.empty())
-      51           4 :                         candidate->setProperty(flagKey, flagValue);
-      52             : 
-      53          52 :                 if (makeInactive)
-      54          48 :                         candidate->setActive(false);
-      55             :         }
-      56        7681 : }
-      57             : 
-      58           2 : void Observer::setFlag(std::string key, std::string value) {
-      59           2 :         flagKey = key;
-      60           2 :         flagValue = value;
-      61           2 : }
-      62             : 
-      63           0 : std::string Observer::getDescription() const {
-      64           0 :         std::stringstream ss;
-      65           0 :         ss << "Observer";
-      66           0 :         for (int i = 0; i < features.size(); i++)
-      67           0 :                 ss << "\n    " << features[i]->getDescription() << "\n";
-      68           0 :         ss << "    Flag: '" << flagKey << "' -> '" << flagValue << "'\n";
-      69           0 :         ss << "    MakeInactive: " << (makeInactive ? "yes\n" : "no\n");
-      70           0 :         if (detectionAction.valid())
-      71           0 :                 ss << "    Action: " << detectionAction->getDescription() << ", clone: " << (clone ? "yes" : "no");
-      72             : 
-      73           0 :         return ss.str();
-      74           0 : }
-      75             : 
-      76           2 : void Observer::setDeactivateOnDetection(bool deactivate) {
-      77           2 :         makeInactive = deactivate;
-      78           2 : }
-      79             : 
-      80             : // ObserverFeature ------------------------------------------------------------
-      81           0 : DetectionState ObserverFeature::checkDetection(Candidate *candidate) const {
-      82           0 :         return NOTHING;
-      83             : }
-      84             : 
-      85          52 : void ObserverFeature::onDetection(Candidate *candidate) const {
-      86          52 : }
-      87             : 
-      88           0 : std::string ObserverFeature::getDescription() const {
-      89           0 :         return description;
-      90             : }
-      91             : 
-      92             : // ObserverDetectAll ----------------------------------------------------------
-      93           2 : DetectionState ObserverDetectAll::checkDetection(Candidate *candidate) const {
-      94           2 :         return DETECTED;
-      95             : }
-      96             : 
-      97           0 : std::string ObserverDetectAll::getDescription() const {
-      98           0 :         return description;
-      99             : }
-     100             : 
-     101             : // ObserverTracking --------------------------------------------------------
-     102           0 : ObserverTracking::ObserverTracking(Vector3d center, double radius, double stepSize) :
-     103           0 :                 center(center), radius(radius), stepSize(stepSize) {
-     104             :         if (stepSize == 0) {
-     105             :                 stepSize = radius / 10.;
-     106             :         }
-     107           0 : }
-     108             : 
-     109           0 : DetectionState ObserverTracking::checkDetection(Candidate *candidate) const {
-     110             :         // current distance to observer sphere center
-     111           0 :         double d = (candidate->current.getPosition() - center).getR();
-     112             : 
-     113             :         // no detection if outside of observer sphere
-     114           0 :         if (d > radius) {
-     115             :                 // conservatively limit next step to prevent overshooting
-     116           0 :                 candidate->limitNextStep(fabs(d - radius));
-     117             : 
-     118           0 :                 return NOTHING;
-     119             :         } else {
-     120             :                 // limit next step
-     121           0 :                 candidate->limitNextStep(stepSize);
-     122             : 
-     123           0 :                 return DETECTED;
-     124             :         }
-     125             : }
-     126             : 
-     127           0 : std::string ObserverTracking::getDescription() const {
-     128           0 :         std::stringstream ss;
-     129           0 :         ss << "ObserverTracking: ";
-     130           0 :         ss << "center = " << center / Mpc << " Mpc, ";
-     131           0 :         ss << "radius = " << radius / Mpc << " Mpc";
-     132           0 :         ss << "stepSize = " << stepSize / Mpc << " Mpc";
-     133           0 :         return ss.str();
-     134           0 : }
-     135             : 
-     136             : // Observer1D --------------------------------------------------------------
-     137        7664 : DetectionState Observer1D::checkDetection(Candidate *candidate) const {
-     138        7664 :         double x = candidate->current.getPosition().x;
-     139        7664 :         if (x > 0) {
-     140             :                 // Limits the next step size to prevent candidates from overshooting in case of non-detection
-     141        7625 :                 candidate->limitNextStep(x);
-     142        7625 :                 return NOTHING;
-     143             :         }
-     144             :         // Detects particles when reaching x = 0
-     145             :         return DETECTED;
-     146             : }
-     147             : 
-     148           0 : std::string Observer1D::getDescription() const {
-     149           0 :         return "Observer1D: observer at x = 0";
-     150             : }
-     151             : 
-     152             : // ObserverRedshiftWindow -----------------------------------------------------
-     153           0 : ObserverRedshiftWindow::ObserverRedshiftWindow(double zmin, double zmax) :
-     154           0 :                 zmin(zmin), zmax(zmax) {
-     155           0 : }
-     156             : 
-     157           0 : DetectionState ObserverRedshiftWindow::checkDetection(
-     158             :                 Candidate *candidate) const {
-     159           0 :         double z = candidate->getRedshift();
-     160           0 :         if (z > zmax)
-     161             :                 return VETO;
-     162           0 :         if (z < zmin)
-     163           0 :                 return VETO;
-     164             :         return NOTHING;
-     165             : }
-     166             : 
-     167           0 : std::string ObserverRedshiftWindow::getDescription() const {
-     168           0 :         std::stringstream ss;
-     169           0 :         ss << "ObserverRedshiftWindow: z = " << zmin << " - " << zmax;
-     170           0 :         return ss.str();
-     171           0 : }
-     172             : 
-     173             : // ObserverInactiveVeto -------------------------------------------------------
-     174           0 : DetectionState ObserverInactiveVeto::checkDetection(Candidate *c) const {
-     175           0 :         if (not(c->isActive()))
-     176           0 :                 return VETO;
-     177             :         return NOTHING;
-     178             : }
-     179             : 
-     180           0 : std::string ObserverInactiveVeto::getDescription() const {
-     181           0 :         return "ObserverInactiveVeto";
-     182             : }
-     183             : 
-     184             : // ObserverNucleusVeto --------------------------------------------------------
-     185           0 : DetectionState ObserverNucleusVeto::checkDetection(Candidate *c) const {
-     186           0 :         if (isNucleus(c->current.getId()))
-     187           0 :                 return VETO;
-     188             :         return NOTHING;
-     189             : }
-     190             : 
-     191           0 : std::string ObserverNucleusVeto::getDescription() const {
-     192           0 :         return "ObserverNucleusVeto";
-     193             : }
-     194             : 
-     195             : // ObserverNeutrinoVeto -------------------------------------------------------
-     196           0 : DetectionState ObserverNeutrinoVeto::checkDetection(Candidate *c) const {
-     197           0 :         int id = abs(c->current.getId());
-     198           0 :         if ((id == 12) or (id == 14) or (id == 16))
-     199           0 :                 return VETO;
-     200             :         return NOTHING;
-     201             : }
-     202             : 
-     203           0 : std::string ObserverNeutrinoVeto::getDescription() const {
-     204           0 :         return "ObserverNeutrinoVeto";
-     205             : }
-     206             : 
-     207             : // ObserverPhotonVeto ---------------------------------------------------------
-     208           0 : DetectionState ObserverPhotonVeto::checkDetection(Candidate *c) const {
-     209           0 :         if (c->current.getId() == 22)
-     210           0 :                 return VETO;
-     211             :         return NOTHING;
-     212             : }
-     213             : 
-     214           0 : std::string ObserverPhotonVeto::getDescription() const {
-     215           0 :         return "ObserverPhotonVeto";
-     216             : }
-     217             : 
-     218             : // ObserverElectronVeto ---------------------------------------------------------
-     219           0 : DetectionState ObserverElectronVeto::checkDetection(Candidate *c) const {
-     220           0 :         if (abs(c->current.getId()) == 11)
-     221           0 :                 return VETO;
-     222             :         return NOTHING;
-     223             : }
-     224             : 
-     225           0 : std::string ObserverElectronVeto::getDescription() const {
-     226           0 :         return "ObserverElectronVeto";
-     227             : }
-     228             : 
-     229             : // ObserverCustomVeto -------------------------------------------------------
-     230           0 : ObserverParticleIdVeto::ObserverParticleIdVeto(int pId) {
-     231           0 :         vetoParticleId = pId;
-     232           0 : }
-     233             : 
-     234           0 : DetectionState ObserverParticleIdVeto::checkDetection(Candidate *c) const {
-     235           0 :         if (c->current.getId() == vetoParticleId)
-     236           0 :                 return VETO;
-     237             :         return NOTHING;
-     238             : }
-     239             : 
-     240           0 : std::string ObserverParticleIdVeto::getDescription() const {
-     241           0 :         return "ObserverParticleIdVeto";
-     242             : }
-     243             : 
-     244             : 
-     245             : // ObserverTimeEvolution --------------------------------------------------------
-     246           0 : ObserverTimeEvolution::ObserverTimeEvolution() {}
-     247             : 
-     248           1 : ObserverTimeEvolution::ObserverTimeEvolution(double min, double dist, double numb) {
-     249           1 :         double max = min + numb * dist;
-     250             :         bool log = false;
-     251           1 :         addTimeRange(min, max, numb, log);
-     252           1 : }
-     253             : 
-     254           1 : ObserverTimeEvolution::ObserverTimeEvolution(double min, double max, double numb, bool log) {
-     255           1 :         addTimeRange(min, max, numb, log);
-     256           1 : }
-     257             : 
-     258             : 
-     259           6 : DetectionState ObserverTimeEvolution::checkDetection(Candidate *c) const {
-     260             : 
-     261           6 :         if (detList.size()) {
-     262           6 :                 double length = c->getTrajectoryLength();
-     263             :                 size_t index;
-     264           6 :                 const std::string DI = "DetectionIndex";
-     265             :                 std::string value;
-     266             : 
-     267             :                 // Load the last detection index
-     268           6 :                 if (c->hasProperty(DI)) {
-     269           4 :                         index = c->getProperty(DI).asUInt64();
-     270             :                 }
-     271             :                 else {
-     272             :                         index = 0;
-     273             :                 }
-     274             : 
-     275             :                 // Break if the particle has been detected once for all detList entries.
-     276           6 :                 if (index > detList.size()) {
-     277             :                         return NOTHING;
-     278             :                 }
-     279             : 
-     280             :                 // Calculate the distance to next detection
-     281           6 :                 double distance = length - detList[index];
-     282             : 
-     283             :                 // Limit next step and detect candidate.
-     284             :                 // Increase the index by one in case of detection
-     285           6 :                 if (distance < 0.) {
-     286           2 :                         c->limitNextStep(-distance);
-     287             :                         return NOTHING;
-     288             :                 }
-     289             :                 else {
-     290             : 
-     291           4 :                         if (index < detList.size()-1) {
-     292           2 :                                 c->limitNextStep(detList[index+1]-length);
-     293             :                         }
-     294           4 :                         c->setProperty(DI, Variant::fromUInt64(index+1));
-     295             : 
-     296           4 :                         return DETECTED;
-     297             :                 }
-     298             :         }
-     299             :         return NOTHING;
-     300             : }
-     301             : 
-     302           4 : void ObserverTimeEvolution::addTime(const double& t) {
-     303           4 :         detList.push_back(t);
-     304           4 : }
-     305             : 
-     306           2 : void ObserverTimeEvolution::addTimeRange(double min, double max, double numb, bool log) {
-     307           6 :         for (size_t i = 0; i < numb; i++) {
-     308           4 :                 if (log == true) {
-     309           2 :                         addTime(min * pow(max / min, i / (numb - 1.0)));
-     310             :                 } else {
-     311           2 :                         addTime(min + i * (max - min) / numb);
-     312             :                 }
-     313             :         }
-     314           2 : }
-     315             : 
-     316           0 : const std::vector<double>& ObserverTimeEvolution::getTimes() const {
-     317           0 :         return detList;
-     318             : }
-     319             : 
-     320           0 : std::string ObserverTimeEvolution::getDescription() const {
-     321           0 :         std::stringstream s;
-     322           0 :         s << "List of Detection lengths in kpc";
-     323           0 :         for (size_t i = 0; i < detList.size(); i++)
-     324           0 :           s << "  - " << detList[i] / kpc;
-     325           0 :         return s.str();
-     326           0 : }
-     327             : 
-     328             : // ObserverSurface--------------------------------------------------------------
-     329           2 : ObserverSurface::ObserverSurface(Surface* _surface) : surface(_surface) { }
-     330             : 
-     331           4 : DetectionState ObserverSurface::checkDetection(Candidate *candidate) const
-     332             : {
-     333           4 :                 double currentDistance = surface->distance(candidate->current.getPosition());
-     334           4 :                 double previousDistance = surface->distance(candidate->previous.getPosition());
-     335           4 :                 candidate->limitNextStep(fabs(currentDistance));
-     336             : 
-     337           4 :                 if (currentDistance * previousDistance > 0)
-     338             :                         return NOTHING;
-     339           2 :                 else if (previousDistance == 0)
-     340             :                         return NOTHING;
-     341             :                 else
-     342           2 :                         return DETECTED;
-     343             : }
-     344             : 
-     345           0 : std::string ObserverSurface::getDescription() const {
-     346           0 :         std::stringstream ss;
-     347           0 :         ss << "ObserverSurface: << " << surface->getDescription();
-     348           0 :         return ss.str();
-     349           0 : }
-     350             : 
-     351             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/Output.cpp.func-sort-c.html b/doc/coverageReport/src/module/Output.cpp.func-sort-c.html deleted file mode 100644 index 8aa2d21bc..000000000 --- a/doc/coverageReport/src/module/Output.cpp.func-sort-c.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/Output.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - Output.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:889889.8 %
Date:2024-04-08 14:58:22Functions:141687.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa6Output14setEnergyScaleEd0
_ZN7crpropa6Output14setLengthScaleEd0
_ZN7crpropa6Output10disableAllEv1
_ZN7crpropa6Output14enablePropertyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_7VariantES8_1
_ZN7crpropa6Output7disableENS0_12OutputColumnE1
_ZNK7crpropa6Output4sizeEv1
_ZN7crpropa6Output6enableENS0_12OutputColumnE2
_ZN7crpropa6OutputC2Ev4
_ZN7crpropa6Output9enableAllEv5
_ZN7crpropa6Output13setOutputTypeENS0_10OutputTypeE8
_ZN7crpropa6OutputC2ENS0_10OutputTypeE8
_ZN7crpropa6Output5set1DEb9
_ZN7crpropa6Output14OutputTypeNameB5cxx11ENS0_10OutputTypeE12
_ZN7crpropa6Output3setENS0_12OutputColumnEb38
_ZNK7crpropa6Output7processEPNS_9CandidateE59
_ZN7crpropa6Output6modifyEv65
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/Output.cpp.func.html b/doc/coverageReport/src/module/Output.cpp.func.html deleted file mode 100644 index e967462c5..000000000 --- a/doc/coverageReport/src/module/Output.cpp.func.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/Output.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - Output.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:889889.8 %
Date:2024-04-08 14:58:22Functions:141687.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa6Output10disableAllEv1
_ZN7crpropa6Output13setOutputTypeENS0_10OutputTypeE8
_ZN7crpropa6Output14OutputTypeNameB5cxx11ENS0_10OutputTypeE12
_ZN7crpropa6Output14enablePropertyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_7VariantES8_1
_ZN7crpropa6Output14setEnergyScaleEd0
_ZN7crpropa6Output14setLengthScaleEd0
_ZN7crpropa6Output3setENS0_12OutputColumnEb38
_ZN7crpropa6Output5set1DEb9
_ZN7crpropa6Output6enableENS0_12OutputColumnE2
_ZN7crpropa6Output6modifyEv65
_ZN7crpropa6Output7disableENS0_12OutputColumnE1
_ZN7crpropa6Output9enableAllEv5
_ZN7crpropa6OutputC2ENS0_10OutputTypeE8
_ZN7crpropa6OutputC2Ev4
_ZNK7crpropa6Output4sizeEv1
_ZNK7crpropa6Output7processEPNS_9CandidateE59
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/Output.cpp.gcov.html b/doc/coverageReport/src/module/Output.cpp.gcov.html deleted file mode 100644 index d08f567ad..000000000 --- a/doc/coverageReport/src/module/Output.cpp.gcov.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/Output.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - Output.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:889889.8 %
Date:2024-04-08 14:58:22Functions:141687.5 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/Output.h"
-       2             : #include "crpropa/Units.h"
-       3             : 
-       4             : #include <stdexcept>
-       5             : 
-       6             : namespace crpropa {
-       7             : 
-       8           4 : Output::Output() : outputName(OutputTypeName(Everything)), lengthScale(Mpc), energyScale(EeV), oneDimensional(false), count(0) {
-       9           4 :         enableAll();
-      10           4 : }
-      11             : 
-      12           8 : Output::Output(OutputType outputType) : outputName(OutputTypeName(outputType)), lengthScale(Mpc), energyScale(EeV), oneDimensional(false), count(0) {
-      13           8 :         setOutputType(outputType);
-      14           8 : }
-      15             : 
-      16          12 : std::string Output::OutputTypeName(OutputType outputType) {
-      17          12 :         if (outputType == Trajectory1D)
-      18           1 :                 return "Trajectory1D";
-      19          11 :         if (outputType == Event1D)
-      20           4 :                 return "Event1D";
-      21           7 :         if (outputType == Trajectory3D)
-      22           1 :                 return "Trajectory3D";
-      23           6 :         if (outputType == Event3D)
-      24           1 :                 return "Event3D";
-      25           5 :         return "Everything";
-      26             : }
-      27             : 
-      28          65 : void Output::modify() {
-      29          65 :         if (count > 0)
-      30           0 :                 throw std::runtime_error("Output: cannot change Output parameters after data has been written to file.");
-      31          65 : }
-      32             : 
-      33          59 : void Output::process(Candidate *c) const {
-      34          59 :         count++;
-      35          59 : }
-      36             : 
-      37           8 : void Output::setOutputType(OutputType outputtype) {
-      38           8 :         modify();
-      39           8 :         if (outputtype == Trajectory1D) {
-      40             :                 // X, ID, E
-      41           1 :                 set(CurrentPositionColumn, true);
-      42           1 :                 set(CurrentIdColumn, true);
-      43           1 :                 set(CurrentEnergyColumn, true);
-      44           1 :                 set1D(true);
-      45           7 :         } else if (outputtype == Event1D) {
-      46             :                 // D, ID, E, ID0, E0
-      47           4 :                 set(TrajectoryLengthColumn, true);
-      48           4 :                 set(CurrentIdColumn, true);
-      49           4 :                 set(CurrentEnergyColumn, true);
-      50           4 :                 set(SourceIdColumn, true);
-      51           4 :                 set(SourceEnergyColumn, true);
-      52           4 :                 set1D(true);
-      53           3 :         } else if (outputtype == Trajectory3D) {
-      54             :                 // D, ID, E, X, Y, Z, Px, Py, Pz
-      55           1 :                 set(TrajectoryLengthColumn, true);
-      56           1 :                 set(CurrentIdColumn, true);
-      57           1 :                 set(CurrentEnergyColumn, true);
-      58           1 :                 set(CurrentPositionColumn, true);
-      59           1 :                 set(CurrentDirectionColumn, true);
-      60           1 :                 set1D(false);
-      61           2 :         } else if (outputtype == Event3D) {
-      62             :                 // D, ID, E, X, Y, Z, Px, Py, Pz, ID0, E0, X0, Y0, Z0, P0x, P0y, P0z
-      63           1 :                 set(TrajectoryLengthColumn, true);
-      64           1 :                 set(CurrentIdColumn, true);
-      65           1 :                 set(CurrentEnergyColumn, true);
-      66           1 :                 set(CurrentPositionColumn, true);
-      67           1 :                 set(CurrentDirectionColumn, true);
-      68           1 :                 set(SourceIdColumn, true);
-      69           1 :                 set(SourceEnergyColumn, true);
-      70           1 :                 set(SourcePositionColumn, true);
-      71           1 :                 set(SourceDirectionColumn, true);
-      72           1 :                 set1D(false);
-      73           1 :         } else if (outputtype == Everything) {
-      74           1 :                 enableAll();
-      75           1 :                 set1D(false);
-      76             :         } else {
-      77           0 :                 throw std::runtime_error("Output: unknown output type");
-      78             :         }
-      79           8 : }
-      80             : 
-      81           0 : void Output::setEnergyScale(double scale) {
-      82           0 :         modify();
-      83           0 :         energyScale = scale;
-      84           0 : }
-      85             : 
-      86           0 : void Output::setLengthScale(double scale) {
-      87           0 :         modify();
-      88           0 :         lengthScale = scale;
-      89           0 : }
-      90             : 
-      91           9 : void Output::set1D(bool value) {
-      92           9 :         modify();
-      93           9 :         oneDimensional = value;
-      94           9 : }
-      95             : 
-      96           2 : void Output::enable(OutputColumn field) {
-      97           2 :         modify();
-      98           2 :         fields.set(field, true);
-      99           2 : }
-     100             : 
-     101           1 : void Output::disable(OutputColumn field) {
-     102           1 :         modify();
-     103           1 :         fields.set(field, false);
-     104           1 : }
-     105             : 
-     106          38 : void Output::set(OutputColumn field, bool value) {
-     107          38 :         modify();
-     108          38 :         fields.set(field, value);
-     109          38 : }
-     110             : 
-     111           5 : void Output::enableAll() {
-     112           5 :         modify();
-     113             :         fields.set();
-     114           5 : }
-     115             : 
-     116           1 : void Output::disableAll() {
-     117           1 :         modify();
-     118             :         fields.reset();
-     119           1 : }
-     120             : 
-     121           1 : size_t Output::size() const {
-     122           1 :         return count;
-     123             : }
-     124             : 
-     125           1 : void Output::enableProperty(const std::string &property, const Variant &defaultValue, const std::string &comment) {
-     126           1 :         modify();
-     127           1 :         Property prop;
-     128             :         prop.name = property;
-     129             :         prop.comment = comment;
-     130           1 :         prop.defaultValue = defaultValue;
-     131           1 :         properties.push_back(prop);
-     132           1 : };
-     133             : 
-     134             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/OutputShell.cpp.func-sort-c.html b/doc/coverageReport/src/module/OutputShell.cpp.func-sort-c.html deleted file mode 100644 index 98f8d83aa..000000000 --- a/doc/coverageReport/src/module/OutputShell.cpp.func-sort-c.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/OutputShell.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - OutputShell.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0270.0 %
Date:2024-04-08 14:58:22Functions:060.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa11ShellOutput14getDescriptionB5cxx11Ev0
_ZNK7crpropa11ShellOutput7processEPNS_9CandidateE0
_ZNK7crpropa13ShellOutput1D14getDescriptionB5cxx11Ev0
_ZNK7crpropa13ShellOutput1D7processEPNS_9CandidateE0
_ZNK7crpropa19ShellPropertyOutput14getDescriptionB5cxx11Ev0
_ZNK7crpropa19ShellPropertyOutput7processEPNS_9CandidateE0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/OutputShell.cpp.func.html b/doc/coverageReport/src/module/OutputShell.cpp.func.html deleted file mode 100644 index 2ba776c67..000000000 --- a/doc/coverageReport/src/module/OutputShell.cpp.func.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/OutputShell.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - OutputShell.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0270.0 %
Date:2024-04-08 14:58:22Functions:060.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa11ShellOutput14getDescriptionB5cxx11Ev0
_ZNK7crpropa11ShellOutput7processEPNS_9CandidateE0
_ZNK7crpropa13ShellOutput1D14getDescriptionB5cxx11Ev0
_ZNK7crpropa13ShellOutput1D7processEPNS_9CandidateE0
_ZNK7crpropa19ShellPropertyOutput14getDescriptionB5cxx11Ev0
_ZNK7crpropa19ShellPropertyOutput7processEPNS_9CandidateE0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/OutputShell.cpp.gcov.html b/doc/coverageReport/src/module/OutputShell.cpp.gcov.html deleted file mode 100644 index 5ac2e949a..000000000 --- a/doc/coverageReport/src/module/OutputShell.cpp.gcov.html +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/OutputShell.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - OutputShell.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0270.0 %
Date:2024-04-08 14:58:22Functions:060.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/OutputShell.h"
-       2             : #include "crpropa/Units.h"
-       3             : 
-       4             : #include <iomanip>
-       5             : 
-       6             : namespace crpropa {
-       7             : 
-       8           0 : void ShellOutput::process(Candidate* c) const {
-       9           0 : #pragma omp critical
-      10             :         {
-      11             :                 std::cout << std::fixed << std::showpoint << std::setprecision(3)
-      12             :                                 << std::setw(6);
-      13           0 :                 std::cout << c->getTrajectoryLength() / Mpc << " Mpc,  ";
-      14           0 :                 std::cout << c->getRedshift() << ",  ";
-      15           0 :                 std::cout << c->current.getId() << ",  ";
-      16           0 :                 std::cout << c->current.getEnergy() / EeV << " EeV,  ";
-      17           0 :                 std::cout << c->current.getPosition() / Mpc << " Mpc,  ";
-      18           0 :                 std::cout << c->current.getDirection();
-      19             :                 std::cout << std::endl;
-      20             :         }
-      21           0 : }
-      22             : 
-      23           0 : std::string ShellOutput::getDescription() const {
-      24           0 :         return "Shell output";
-      25             : }
-      26             : 
-      27           0 : void ShellOutput1D::process(Candidate* c) const {
-      28           0 : #pragma omp critical
-      29             :         {
-      30             :                 std::cout << std::fixed << std::showpoint << std::setprecision(3)
-      31             :                                 << std::setw(6);
-      32           0 :                 std::cout << c->current.getPosition().x / Mpc << " Mpc,  ";
-      33           0 :                 std::cout << c->getRedshift() << ",  ";
-      34           0 :                 std::cout << c->current.getId() << ",  ";
-      35           0 :                 std::cout << c->current.getEnergy() / EeV << " EeV";
-      36             :                 std::cout << std::endl;
-      37             :         }
-      38           0 : }
-      39             : 
-      40           0 : std::string ShellOutput1D::getDescription() const {
-      41           0 :         return "Shell output for 1D";
-      42             : }
-      43             : 
-      44           0 : void ShellPropertyOutput::process(Candidate* c) const {
-      45             :         Candidate::PropertyMap::const_iterator i = c->properties.begin();
-      46           0 : #pragma omp critical
-      47             :         {
-      48           0 :                 for ( ; i != c->properties.end(); i++) {
-      49           0 :                         std::cout << "  " << i->first << ", " << i->second << std::endl;
-      50             :                 }
-      51             :         }
-      52           0 : }
-      53             : 
-      54           0 : std::string ShellPropertyOutput::getDescription() const {
-      55           0 :         return "Shell property output";
-      56             : }
-      57             : 
-      58             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/ParticleCollector.cpp.func-sort-c.html b/doc/coverageReport/src/module/ParticleCollector.cpp.func-sort-c.html deleted file mode 100644 index 066818d57..000000000 --- a/doc/coverageReport/src/module/ParticleCollector.cpp.func-sort-c.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/ParticleCollector.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - ParticleCollector.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:547275.0 %
Date:2024-04-08 14:58:22Functions:172470.8 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa17ParticleCollectorC2Em0
_ZN7crpropa17ParticleCollectorC2Emb0
_ZN7crpropa17ParticleCollectorC2Embb0
_ZNK7crpropa17ParticleCollector14getDescriptionB5cxx11Ev0
_ZNK7crpropa17ParticleCollector3endEv0
_ZNK7crpropa17ParticleCollector5beginEv0
_ZNK7crpropa17ParticleCollector8getCloneEv0
_ZN7crpropa17ParticleCollector4loadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZNK7crpropa17ParticleCollector13getTrajectoryENS_7ref_ptrINS_10ModuleListEEEmNS1_INS_6ModuleEEE1
_ZNK7crpropa17ParticleCollector13getTrajectoryEPNS_10ModuleListEmPNS_6ModuleE1
_ZNK7crpropa17ParticleCollector4dumpERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa17ParticleCollector8setCloneEb2
_ZNK7crpropa17ParticleCollector12getContainerEv2
_ZNK7crpropa17ParticleCollector9reprocessEPNS_6ModuleE2
_ZN7crpropa17ParticleCollector5beginEv5
_ZNK7crpropa17ParticleCollector4sizeEv6
_ZN7crpropa17ParticleCollectorD0Ev8
_ZNK7crpropa17ParticleCollectorixEm8
_ZN7crpropa17ParticleCollector14clearContainerEv14
_ZN7crpropa17ParticleCollectorC2Ev14
_ZN7crpropa17ParticleCollectorD2Ev14
_ZN7crpropa17ParticleCollector3endEv30
_ZNK7crpropa17ParticleCollector7processENS_7ref_ptrINS_9CandidateEEE30
_ZNK7crpropa17ParticleCollector7processEPNS_9CandidateE3206
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/ParticleCollector.cpp.func.html b/doc/coverageReport/src/module/ParticleCollector.cpp.func.html deleted file mode 100644 index a393ca64a..000000000 --- a/doc/coverageReport/src/module/ParticleCollector.cpp.func.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/ParticleCollector.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - ParticleCollector.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:547275.0 %
Date:2024-04-08 14:58:22Functions:172470.8 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa17ParticleCollector14clearContainerEv14
_ZN7crpropa17ParticleCollector3endEv30
_ZN7crpropa17ParticleCollector4loadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa17ParticleCollector5beginEv5
_ZN7crpropa17ParticleCollector8setCloneEb2
_ZN7crpropa17ParticleCollectorC2Em0
_ZN7crpropa17ParticleCollectorC2Emb0
_ZN7crpropa17ParticleCollectorC2Embb0
_ZN7crpropa17ParticleCollectorC2Ev14
_ZN7crpropa17ParticleCollectorD0Ev8
_ZN7crpropa17ParticleCollectorD2Ev14
_ZNK7crpropa17ParticleCollector12getContainerEv2
_ZNK7crpropa17ParticleCollector13getTrajectoryENS_7ref_ptrINS_10ModuleListEEEmNS1_INS_6ModuleEEE1
_ZNK7crpropa17ParticleCollector13getTrajectoryEPNS_10ModuleListEmPNS_6ModuleE1
_ZNK7crpropa17ParticleCollector14getDescriptionB5cxx11Ev0
_ZNK7crpropa17ParticleCollector3endEv0
_ZNK7crpropa17ParticleCollector4dumpERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZNK7crpropa17ParticleCollector4sizeEv6
_ZNK7crpropa17ParticleCollector5beginEv0
_ZNK7crpropa17ParticleCollector7processENS_7ref_ptrINS_9CandidateEEE30
_ZNK7crpropa17ParticleCollector7processEPNS_9CandidateE3206
_ZNK7crpropa17ParticleCollector8getCloneEv0
_ZNK7crpropa17ParticleCollector9reprocessEPNS_6ModuleE2
_ZNK7crpropa17ParticleCollectorixEm8
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/ParticleCollector.cpp.gcov.html b/doc/coverageReport/src/module/ParticleCollector.cpp.gcov.html deleted file mode 100644 index b881f5f25..000000000 --- a/doc/coverageReport/src/module/ParticleCollector.cpp.gcov.html +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/ParticleCollector.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - ParticleCollector.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:547275.0 %
Date:2024-04-08 14:58:22Functions:172470.8 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/ParticleCollector.h"
-       2             : #include "crpropa/module/TextOutput.h"
-       3             : #include "crpropa/Units.h"
-       4             : 
-       5             : namespace crpropa {
-       6             : 
-       7          14 : ParticleCollector::ParticleCollector() : nBuffer(10e6), clone(false), recursive(false)  {
-       8          14 :         container.reserve(nBuffer); // for 1e6 candidates ~ 500MB of RAM
-       9          14 : }
-      10             : 
-      11           0 : ParticleCollector::ParticleCollector(const std::size_t nBuffer) : clone(false), recursive(false)  {
-      12           0 :         container.reserve(nBuffer);
-      13           0 : }
-      14             : 
-      15           0 : ParticleCollector::ParticleCollector(const std::size_t nBuffer, const bool clone) : recursive(false) {
-      16           0 :         container.reserve(nBuffer);
-      17           0 : }
-      18             : 
-      19           0 : ParticleCollector::ParticleCollector(const std::size_t nBuffer, const bool clone, const bool recursive) {
-      20           0 :         container.reserve(nBuffer);
-      21           0 : }
-      22             : 
-      23        3206 : void ParticleCollector::process(Candidate *c) const {
-      24        6412 : #pragma omp critical
-      25             :         {
-      26        3206 :                 if(clone)
-      27          50 :                         container.push_back(c->clone(recursive));
-      28             :                 else
-      29        6362 :                         container.push_back(c);
-      30             :         }
-      31        3206 : }
-      32             : 
-      33          30 : void ParticleCollector::process(ref_ptr<Candidate> c) const {
-      34          30 :         ParticleCollector::process((Candidate*) c);
-      35          30 : }
-      36             : 
-      37           2 : void ParticleCollector::reprocess(Module *action) const {
-      38          14 :         for (ParticleCollector::iterator itr = container.begin(); itr != container.end(); ++itr){
-      39          12 :                 if (clone)
-      40           0 :                         action->process((*(itr->get())).clone(false));
-      41             :                 else
-      42          12 :                         action->process(itr->get());
-      43             :         }
-      44           2 : }
-      45             : 
-      46           1 : void ParticleCollector::dump(const std::string &filename) const {
-      47           1 :         TextOutput output(filename.c_str(), Output::Everything);
-      48           1 :         reprocess(&output);
-      49           1 :         output.close();
-      50           1 : }
-      51             : 
-      52           1 : void ParticleCollector::load(const std::string &filename){
-      53           1 :         TextOutput::load(filename.c_str(), this);
-      54           1 : }
-      55             : 
-      56          22 : ParticleCollector::~ParticleCollector() {
-      57          14 :         clearContainer();
-      58          22 : }
-      59             : 
-      60           6 : std::size_t ParticleCollector::size() const {
-      61           6 :         return container.size();
-      62             : }
-      63             : 
-      64           8 : ref_ptr<Candidate> ParticleCollector::operator[](const std::size_t i) const {
-      65           8 :         return container[i];
-      66             : }
-      67             : 
-      68          14 : void ParticleCollector::clearContainer() {
-      69          14 :         container.clear();
-      70          14 : }
-      71             : 
-      72           2 : std::vector<ref_ptr<Candidate> >& ParticleCollector::getContainer() const {
-      73           2 :         return container;
-      74             : }
-      75             : 
-      76           2 : void ParticleCollector::setClone(bool b) {
-      77           2 :         clone = b;
-      78           2 : }
-      79             : 
-      80           0 : bool ParticleCollector::getClone() const {
-      81           0 :         return clone;
-      82             : }
-      83             : 
-      84           0 : std::string ParticleCollector::getDescription() const {
-      85           0 :         return "ParticleCollector";
-      86             : }
-      87             : 
-      88           5 : ParticleCollector::iterator ParticleCollector::begin() {
-      89           5 :         return container.begin();
-      90             : }
-      91             : 
-      92           0 : ParticleCollector::const_iterator ParticleCollector::begin() const {
-      93           0 :         return container.begin();
-      94             : }
-      95             : 
-      96          30 : ParticleCollector::iterator ParticleCollector::end() {
-      97          30 :         return container.end();
-      98             : }
-      99             : 
-     100           0 : ParticleCollector::const_iterator ParticleCollector::end() const {
-     101           0 :         return container.end();
-     102             : }
-     103             : 
-     104           1 : void ParticleCollector::getTrajectory(ModuleList* mlist, std::size_t i, Module *output) const {
-     105           1 :         ref_ptr<Candidate> c_tmp = container[i]->clone();
-     106             : 
-     107           1 :         c_tmp->restart();
-     108             : 
-     109           1 :         mlist->add(output);
-     110           1 :         mlist->run(c_tmp);
-     111           1 :         mlist->remove(mlist->size()-1);
-     112           1 : }
-     113             : 
-     114           1 : void ParticleCollector::getTrajectory(ref_ptr<ModuleList> mlist, std::size_t i, ref_ptr<Module> output) const {
-     115           1 :         ParticleCollector::getTrajectory((ModuleList*) mlist, i, (Module*) output);
-     116           1 : }
-     117             : 
-     118             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/PhotoDisintegration.cpp.func-sort-c.html b/doc/coverageReport/src/module/PhotoDisintegration.cpp.func-sort-c.html deleted file mode 100644 index 3a3f0982b..000000000 --- a/doc/coverageReport/src/module/PhotoDisintegration.cpp.func-sort-c.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/PhotoDisintegration.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - PhotoDisintegration.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:14017580.0 %
Date:2024-04-08 14:58:22Functions:101283.3 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa19PhotoDisintegration10lossLengthEidd0
_ZN7crpropa19PhotoDisintegration8setLimitEd0
_ZN7crpropa19PhotoDisintegration14setHavePhotonsEb1
_ZN7crpropa19PhotoDisintegration17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZNK7crpropa19PhotoDisintegration17getInteractionTagB5cxx11Ev2
_ZN7crpropa19PhotoDisintegrationC2ENS_7ref_ptrINS_11PhotonFieldEEEbd11
_ZN7crpropa19PhotoDisintegration13initBranchingENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE22
_ZN7crpropa19PhotoDisintegration14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE22
_ZN7crpropa19PhotoDisintegration18initPhotonEmissionENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE22
_ZN7crpropa19PhotoDisintegration8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE22
_ZNK7crpropa19PhotoDisintegration18performInteractionEPNS_9CandidateEi265
_ZNK7crpropa19PhotoDisintegration7processEPNS_9CandidateE16849
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/PhotoDisintegration.cpp.func.html b/doc/coverageReport/src/module/PhotoDisintegration.cpp.func.html deleted file mode 100644 index 7207f6b5b..000000000 --- a/doc/coverageReport/src/module/PhotoDisintegration.cpp.func.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/PhotoDisintegration.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - PhotoDisintegration.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:14017580.0 %
Date:2024-04-08 14:58:22Functions:101283.3 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa19PhotoDisintegration10lossLengthEidd0
_ZN7crpropa19PhotoDisintegration13initBranchingENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE22
_ZN7crpropa19PhotoDisintegration14setHavePhotonsEb1
_ZN7crpropa19PhotoDisintegration14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE22
_ZN7crpropa19PhotoDisintegration17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa19PhotoDisintegration18initPhotonEmissionENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE22
_ZN7crpropa19PhotoDisintegration8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE22
_ZN7crpropa19PhotoDisintegration8setLimitEd0
_ZN7crpropa19PhotoDisintegrationC2ENS_7ref_ptrINS_11PhotonFieldEEEbd11
_ZNK7crpropa19PhotoDisintegration17getInteractionTagB5cxx11Ev2
_ZNK7crpropa19PhotoDisintegration18performInteractionEPNS_9CandidateEi265
_ZNK7crpropa19PhotoDisintegration7processEPNS_9CandidateE16849
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/PhotoDisintegration.cpp.gcov.html b/doc/coverageReport/src/module/PhotoDisintegration.cpp.gcov.html deleted file mode 100644 index 9d6164c97..000000000 --- a/doc/coverageReport/src/module/PhotoDisintegration.cpp.gcov.html +++ /dev/null @@ -1,406 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/PhotoDisintegration.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - PhotoDisintegration.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:14017580.0 %
Date:2024-04-08 14:58:22Functions:101283.3 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/PhotoDisintegration.h"
-       2             : #include "crpropa/Units.h"
-       3             : #include "crpropa/ParticleID.h"
-       4             : #include "crpropa/ParticleMass.h"
-       5             : #include "crpropa/Random.h"
-       6             : #include "kiss/logger.h"
-       7             : 
-       8             : #include <cmath>
-       9             : #include <limits>
-      10             : #include <sstream>
-      11             : #include <fstream>
-      12             : #include <stdexcept>
-      13             : 
-      14             : namespace crpropa {
-      15             : 
-      16             : const double PhotoDisintegration::lgmin = 6;  // minimum log10(Lorentz-factor)
-      17             : const double PhotoDisintegration::lgmax = 14; // maximum log10(Lorentz-factor)
-      18             : const size_t PhotoDisintegration::nlg = 201;  // number of Lorentz-factor steps
-      19             : 
-      20          11 : PhotoDisintegration::PhotoDisintegration(ref_ptr<PhotonField> f, bool havePhotons, double limit) {
-      21          11 :         setPhotonField(f);
-      22          11 :         this->havePhotons = havePhotons;
-      23          11 :         this->limit = limit;
-      24          11 : }
-      25             : 
-      26          22 : void PhotoDisintegration::setPhotonField(ref_ptr<PhotonField> photonField) {
-      27          22 :         this->photonField = photonField;
-      28          22 :         std::string fname = photonField->getFieldName();
-      29          22 :         setDescription("PhotoDisintegration: " + fname);
-      30          66 :         initRate(getDataPath("Photodisintegration/rate_" + fname + ".txt"));
-      31          66 :         initBranching(getDataPath("Photodisintegration/branching_" + fname + ".txt"));
-      32          66 :         initPhotonEmission(getDataPath("Photodisintegration/photon_emission_" + fname.substr(0,3) + ".txt"));
-      33          22 : }
-      34             : 
-      35           1 : void PhotoDisintegration::setHavePhotons(bool havePhotons) {
-      36           1 :         this->havePhotons = havePhotons;
-      37           1 : }
-      38             : 
-      39           0 : void PhotoDisintegration::setLimit(double limit) {
-      40           0 :         this->limit = limit;
-      41           0 : }
-      42             : 
-      43          22 : void PhotoDisintegration::initRate(std::string filename) {
-      44          22 :         std::ifstream infile(filename.c_str());
-      45          22 :         if (not infile.good())
-      46           0 :                 throw std::runtime_error("PhotoDisintegration: could not open file " + filename);
-      47             : 
-      48             :         // clear previously loaded interaction rates
-      49          22 :         pdRate.clear();
-      50          22 :         pdRate.resize(27 * 31);
-      51             : 
-      52             :         std::string line;
-      53        4158 :         while (std::getline(infile, line)) {
-      54        4136 :                 if (line[0] == '#')
-      55          66 :                         continue;
-      56        4070 :                 std::stringstream lineStream(line);
-      57             : 
-      58             :                 int Z, N;
-      59        4070 :                 lineStream >> Z;
-      60        4070 :                 lineStream >> N;
-      61             : 
-      62             :                 double r;
-      63      822140 :                 for (size_t i = 0; i < nlg; i++) {
-      64             :                         lineStream >> r;
-      65      818070 :                         pdRate[Z * 31 + N].push_back(r / Mpc);
-      66             :                 }
-      67        4070 :         }
-      68          22 :         infile.close();
-      69          22 : }
-      70             : 
-      71          22 : void PhotoDisintegration::initBranching(std::string filename) {
-      72          22 :         std::ifstream infile(filename.c_str());
-      73          22 :         if (not infile.good())
-      74           0 :                 throw std::runtime_error("PhotoDisintegration: could not open file " + filename);
-      75             : 
-      76             :         // clear previously loaded interaction rates
-      77          22 :         pdBranch.clear();
-      78          22 :         pdBranch.resize(27 * 31);
-      79             : 
-      80             :         std::string line;
-      81       48532 :         while (std::getline(infile, line)) {
-      82       48510 :                 if (line[0] == '#')
-      83          66 :                         continue;
-      84             : 
-      85       48444 :                 std::stringstream lineStream(line);
-      86             : 
-      87             :                 int Z, N;
-      88       48444 :                 lineStream >> Z;
-      89       48444 :                 lineStream >> N;
-      90             : 
-      91             :                 Branch branch;
-      92       48444 :                 lineStream >> branch.channel;
-      93             : 
-      94             :                 double r;
-      95     9785688 :                 for (size_t i = 0; i < nlg; i++) {
-      96             :                         lineStream >> r;
-      97     9737244 :                         branch.branchingRatio.push_back(r);
-      98             :                 }
-      99             : 
-     100       48444 :                 pdBranch[Z * 31 + N].push_back(branch);
-     101       48444 :         }
-     102             : 
-     103          22 :         infile.close();
-     104          22 : }
-     105             : 
-     106          22 : void PhotoDisintegration::initPhotonEmission(std::string filename) {
-     107          22 :         std::ifstream infile(filename.c_str());
-     108          22 :         if (not infile.good())
-     109           0 :                 throw std::runtime_error("PhotoDisintegration: could not open file " + filename);
-     110             : 
-     111             :         // clear previously loaded emission probabilities
-     112          22 :         pdPhoton.clear();
-     113             : 
-     114             :         std::string line;
-     115      209154 :         while (std::getline(infile, line)) {
-     116      209132 :                 if (line[0] == '#')
-     117          66 :                         continue;
-     118             : 
-     119      209066 :                 std::stringstream lineStream(line);
-     120             : 
-     121             :                 int Z, N, Zd, Nd;
-     122      209066 :                 lineStream >> Z;
-     123      209066 :                 lineStream >> N;
-     124      209066 :                 lineStream >> Zd;
-     125      209066 :                 lineStream >> Nd;
-     126             : 
-     127             :                 PhotonEmission em;
-     128             :                 lineStream >> em.energy;
-     129      209066 :                 em.energy *= eV;
-     130             : 
-     131             :                 double r;
-     132    42231332 :                 for (size_t i = 0; i < nlg; i++) {
-     133             :                         lineStream >> r;
-     134    42022266 :                         em.emissionProbability.push_back(r);
-     135             :                 }
-     136             : 
-     137      209066 :                 int key = Z * 1000000 + N * 10000 + Zd * 100 + Nd;
-     138      209066 :                 if (pdPhoton.find(key) == pdPhoton.end()) {
-     139             :                         std::vector<PhotonEmission> emissions;
-     140       41096 :                         pdPhoton[key] = emissions;
-     141       41096 :                 }
-     142      209066 :                 pdPhoton[key].push_back(em);
-     143      209066 :         }
-     144             : 
-     145          22 :         infile.close();
-     146          22 : }
-     147             : 
-     148       16849 : void PhotoDisintegration::process(Candidate *candidate) const {
-     149             :         // execute the loop at least once for limiting the next step
-     150       16849 :         double step = candidate->getCurrentStep();
-     151             :         do {
-     152             :                 // check if nucleus
-     153       17112 :                 int id = candidate->current.getId();
-     154       17112 :                 if (not isNucleus(id))
-     155             :                         return;
-     156             : 
-     157       17111 :                 int A = massNumber(id);
-     158       17111 :                 int Z = chargeNumber(id);
-     159       17111 :                 int N = A - Z;
-     160       17111 :                 size_t idx = Z * 31 + N;
-     161             : 
-     162             :                 // check if disintegration data available
-     163       17111 :                 if ((Z > 26) or (N > 30))
-     164             :                         return;
-     165       17111 :                 if (pdRate[idx].size() == 0)
-     166             :                         return;
-     167             : 
-     168             :                 // check if in tabulated energy range
-     169        1517 :                 double z = candidate->getRedshift();
-     170        1517 :                 double lg = log10(candidate->current.getLorentzFactor() * (1 + z));
-     171        1517 :                 if ((lg <= lgmin) or (lg >= lgmax))
-     172             :                         return;
-     173             : 
-     174        1517 :                 double rate = interpolateEquidistant(lg, lgmin, lgmax, pdRate[idx]);
-     175        1517 :                 rate *= pow_integer<2>(1 + z) * photonField->getRedshiftScaling(z); // cosmological scaling, rate per comoving distance
-     176             : 
-     177             :                 // check if interaction occurs in this step
-     178             :                 // otherwise limit next step to a fraction of the mean free path
-     179        1517 :                 Random &random = Random::instance();
-     180        1517 :                 double randDist = -log(random.rand()) / rate;
-     181        1517 :                 if (step < randDist) {
-     182        1254 :                         candidate->limitNextStep(limit / rate);
-     183        1254 :                         return;
-     184             :                 }
-     185             : 
-     186             :                 // select channel and interact
-     187             :                 const std::vector<Branch> &branches = pdBranch[idx];
-     188         263 :                 double cmp = random.rand();
-     189         263 :                 int l = round((lg - lgmin) / (lgmax - lgmin) * (nlg - 1)); // index of closest tabulation point
-     190             :                 size_t i = 0;
-     191        2133 :                 while ((i < branches.size()) and (cmp > 0)) {
-     192        1870 :                         cmp -= branches[i].branchingRatio[l];
-     193        1870 :                         i++;
-     194             :                 }
-     195         263 :                 performInteraction(candidate, branches[i-1].channel);
-     196             : 
-     197             :                 // repeat with remaining step
-     198         263 :                 step -= randDist;
-     199         263 :         } while (step > 0);
-     200             : }
-     201             : 
-     202         265 : void PhotoDisintegration::performInteraction(Candidate *candidate, int channel) const {
-     203         265 :         KISS_LOG_DEBUG << "Photodisintegration::performInteraction. Channel " <<  channel << " on candidate " << candidate->getDescription(); 
-     204             :         // parse disintegration channel
-     205             :         int nNeutron = digit(channel, 100000);
-     206             :         int nProton = digit(channel, 10000);
-     207             :         int nH2 = digit(channel, 1000);
-     208             :         int nH3 = digit(channel, 100);
-     209             :         int nHe3 = digit(channel, 10);
-     210             :         int nHe4 = digit(channel, 1);
-     211             : 
-     212         265 :         int dA = -nNeutron - nProton - 2 * nH2 - 3 * nH3 - 3 * nHe3 - 4 * nHe4;
-     213         265 :         int dZ = -nProton - nH2 - nH3 - 2 * nHe3 - 2 * nHe4;
-     214             : 
-     215         265 :         int id = candidate->current.getId();
-     216         265 :         int A = massNumber(id);
-     217         265 :         int Z = chargeNumber(id);
-     218         265 :         double EpA = candidate->current.getEnergy() / A;
-     219             : 
-     220             :         // create secondaries
-     221         265 :         Random &random = Random::instance();
-     222         265 :         Vector3d pos = random.randomInterpolatedPosition(candidate->previous.getPosition(), candidate->current.getPosition());
-     223             :         try
-     224             :         {
-     225         458 :                 for (size_t i = 0; i < nNeutron; i++)
-     226         193 :                         candidate->addSecondary(nucleusId(1, 0), EpA, pos, 1., interactionTag);
-     227         379 :                 for (size_t i = 0; i < nProton; i++)
-     228         114 :                         candidate->addSecondary(nucleusId(1, 1), EpA, pos, 1., interactionTag);
-     229         265 :                 for (size_t i = 0; i < nH2; i++)
-     230           0 :                         candidate->addSecondary(nucleusId(2, 1), EpA * 2, pos, 1., interactionTag);
-     231         267 :                 for (size_t i = 0; i < nH3; i++)
-     232           2 :                         candidate->addSecondary(nucleusId(3, 1), EpA * 3, pos, 1., interactionTag);
-     233         265 :                 for (size_t i = 0; i < nHe3; i++)
-     234           0 :                         candidate->addSecondary(nucleusId(3, 2), EpA * 3, pos, 1., interactionTag);
-     235         309 :                 for (size_t i = 0; i < nHe4; i++)
-     236          44 :                         candidate->addSecondary(nucleusId(4, 2), EpA * 4, pos, 1., interactionTag);
-     237             : 
-     238             : 
-     239             :         // update particle
-     240             :           candidate->created = candidate->current;
-     241         265 :                 candidate->current.setId(nucleusId(A + dA, Z + dZ));
-     242         265 :                 candidate->current.setEnergy(EpA * (A + dA));
-     243             :         }
-     244           0 :         catch (std::runtime_error &e)
-     245             :         {
-     246           0 :                 KISS_LOG_ERROR << "Something went wrong in the PhotoDisentigration\n" << "Please report this error on https://github.com/CRPropa/CRPropa3/issues including your simulation setup and the following random seed:\n" << Random::instance().getSeed_base64();
-     247           0 :                 throw;
-     248           0 :         }
-     249             : 
-     250         265 :         if (not havePhotons)
-     251             :                 return;
-     252             : 
-     253             :         // create photons
-     254          32 :         double z = candidate->getRedshift();
-     255          32 :         double lg = log10(candidate->current.getLorentzFactor() * (1 + z));
-     256          32 :         double lf = candidate->current.getLorentzFactor();
-     257             : 
-     258          32 :         int l = round((lg - lgmin) / (lgmax - lgmin) * (nlg - 1));  // index of closest tabulation point
-     259          32 :         int key = Z*1e6 + (A-Z)*1e4 + (Z+dZ)*1e2 + (A+dA) - (Z+dZ);
-     260             : 
-     261         227 :         for (int i = 0; i < pdPhoton[key].size(); i++) {
-     262             :                 // check for random emission
-     263         195 :                 if (random.rand() > pdPhoton[key][i].emissionProbability[l])
-     264         162 :                         continue;
-     265             : 
-     266             :                 // boost to lab frame
-     267          33 :                 double cosTheta = 2 * random.rand() - 1;
-     268          33 :                 double E = pdPhoton[key][i].energy * lf * (1 - cosTheta);
-     269          33 :                 candidate->addSecondary(22, E, pos, 1., interactionTag);
-     270             :         }
-     271             : }
-     272             : 
-     273           0 : double PhotoDisintegration::lossLength(int id, double gamma, double z) {
-     274             :         // check if nucleus
-     275           0 :         if (not (isNucleus(id)))
-     276             :                 return std::numeric_limits<double>::max();
-     277             : 
-     278           0 :         int A = massNumber(id);
-     279           0 :         int Z = chargeNumber(id);
-     280           0 :         int N = A - Z;
-     281           0 :         size_t idx = Z * 31 + N;
-     282             : 
-     283             :         // check if disintegration data available
-     284           0 :         if ((Z > 26) or (N > 30))
-     285             :                 return std::numeric_limits<double>::max();
-     286             :         const std::vector<double> &rate = pdRate[idx];
-     287           0 :         if (rate.size() == 0)
-     288             :                 return std::numeric_limits<double>::max();
-     289             : 
-     290             :         // check if in tabulated energy range
-     291           0 :         double lg = log10(gamma * (1 + z));
-     292           0 :         if ((lg <= lgmin) or (lg >= lgmax))
-     293             :                 return std::numeric_limits<double>::max();
-     294             : 
-     295             :         // total interaction rate
-     296           0 :         double lossRate = interpolateEquidistant(lg, lgmin, lgmax, rate);
-     297             : 
-     298             :         // comological scaling, rate per physical distance
-     299           0 :         lossRate *= pow_integer<3>(1 + z) * photonField->getRedshiftScaling(z);
-     300             : 
-     301             :         // average number of nucleons lost for all disintegration channels
-     302             :         double avg_dA = 0;
-     303             :         const std::vector<Branch> &branches = pdBranch[idx];
-     304           0 :         for (size_t i = 0; i < branches.size(); i++) {
-     305           0 :                 int channel = branches[i].channel;
-     306             :                 int dA = 0;
-     307             :                 dA += 1 * digit(channel, 100000);
-     308           0 :                 dA += 1 * digit(channel, 10000);
-     309           0 :                 dA += 2 * digit(channel, 1000);
-     310           0 :                 dA += 3 * digit(channel, 100);
-     311           0 :                 dA += 3 * digit(channel, 10);
-     312           0 :                 dA += 4 * digit(channel, 1);
-     313             : 
-     314           0 :                 double br = interpolateEquidistant(lg, lgmin, lgmax, branches[i].branchingRatio);
-     315           0 :                 avg_dA += br * dA;
-     316             :         }
-     317             : 
-     318           0 :         lossRate *= avg_dA / A;
-     319           0 :         return 1 / lossRate;
-     320             : }
-     321             : 
-     322           1 : void PhotoDisintegration::setInteractionTag(std::string tag) {
-     323           1 :         interactionTag = tag;
-     324           1 : }
-     325             : 
-     326           2 : std::string PhotoDisintegration::getInteractionTag() const {
-     327           2 :         return interactionTag;
-     328             : }
-     329             : 
-     330             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/PhotoPionProduction.cpp.func-sort-c.html b/doc/coverageReport/src/module/PhotoPionProduction.cpp.func-sort-c.html deleted file mode 100644 index 7b6272449..000000000 --- a/doc/coverageReport/src/module/PhotoPionProduction.cpp.func-sort-c.html +++ /dev/null @@ -1,232 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/PhotoPionProduction.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - PhotoPionProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:24638763.6 %
Date:2024-04-08 14:58:22Functions:244060.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa19PhotoPionProduction10lossLengthEidd0
_ZN7crpropa19PhotoPionProduction12setSampleLogEb0
_ZN7crpropa19PhotoPionProduction16setHaveElectronsEb0
_ZN7crpropa19PhotoPionProduction16setHaveNeutrinosEb0
_ZN7crpropa19PhotoPionProduction19setCorrectionFactorEd0
_ZN7crpropa19PhotoPionProduction19setHaveAntiNucleonsEb0
_ZN7crpropa19PhotoPionProduction25setHaveRedshiftDependenceEb0
_ZN7crpropa19PhotoPionProduction8setLimitEd0
_ZNK7crpropa19PhotoPionProduction11sophiaEventEbdd0
_ZNK7crpropa19PhotoPionProduction12getSampleLogEv0
_ZNK7crpropa19PhotoPionProduction14getHavePhotonsEv0
_ZNK7crpropa19PhotoPionProduction16getHaveElectronsEv0
_ZNK7crpropa19PhotoPionProduction16getHaveNeutrinosEv0
_ZNK7crpropa19PhotoPionProduction19getHaveAntiNucleonsEv0
_ZNK7crpropa19PhotoPionProduction25getHaveRedshiftDependenceEv0
_ZNK7crpropa19PhotoPionProduction8getLimitEv0
_ZN7crpropa19PhotoPionProduction14setHavePhotonsEb1
_ZN7crpropa19PhotoPionProduction17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZNK7crpropa19PhotoPionProduction14getPhotonFieldEv1
_ZNK7crpropa19PhotoPionProduction19getCorrectionFactorEv1
_ZNK7crpropa19PhotoPionProduction17getInteractionTagB5cxx11Ev2
_ZN7crpropa19PhotoPionProductionC2ENS_7ref_ptrINS_11PhotonFieldEEEbbbbdb11
_ZN7crpropa19PhotoPionProduction14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE22
_ZN7crpropa19PhotoPionProduction8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE22
_ZNK7crpropa19PhotoPionProduction17epsMinInteractionEbd28
_ZNK7crpropa19PhotoPionProduction18performInteractionEPNS_9CandidateEb28
_ZNK7crpropa19PhotoPionProduction9sampleEpsEbdd28
_ZNK7crpropa19PhotoPionProduction10probEpsMaxEbdddd29
_ZNK7crpropa19PhotoPionProduction7probEpsEdbdd10689
_ZNK7crpropa19PhotoPionProduction8momentumEbd10717
_ZNK7crpropa19PhotoPionProduction7processEPNS_9CandidateE15289
_ZNK7crpropa19PhotoPionProduction10nucleonMFPEddb16206
_ZNK7crpropa19PhotoPionProduction18nucleiModificationEii16206
_ZNK7crpropa19PhotoPionProduction11crossectionEdb170560
_ZNK7crpropa19PhotoPionProduction6functsEdb170560
_ZNK7crpropa19PhotoPionProduction4sMinEv191909
_ZNK7crpropa19PhotoPionProduction2PlEdddd320502
_ZNK7crpropa19PhotoPionProduction11breitwignerEddddb1442259
_ZNK7crpropa19PhotoPionProduction2EfEddd1612819
_ZNK7crpropa19PhotoPionProduction4massEb1815502
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/PhotoPionProduction.cpp.func.html b/doc/coverageReport/src/module/PhotoPionProduction.cpp.func.html deleted file mode 100644 index 4e52c0c59..000000000 --- a/doc/coverageReport/src/module/PhotoPionProduction.cpp.func.html +++ /dev/null @@ -1,232 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/PhotoPionProduction.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - PhotoPionProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:24638763.6 %
Date:2024-04-08 14:58:22Functions:244060.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa19PhotoPionProduction10lossLengthEidd0
_ZN7crpropa19PhotoPionProduction12setSampleLogEb0
_ZN7crpropa19PhotoPionProduction14setHavePhotonsEb1
_ZN7crpropa19PhotoPionProduction14setPhotonFieldENS_7ref_ptrINS_11PhotonFieldEEE22
_ZN7crpropa19PhotoPionProduction16setHaveElectronsEb0
_ZN7crpropa19PhotoPionProduction16setHaveNeutrinosEb0
_ZN7crpropa19PhotoPionProduction17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa19PhotoPionProduction19setCorrectionFactorEd0
_ZN7crpropa19PhotoPionProduction19setHaveAntiNucleonsEb0
_ZN7crpropa19PhotoPionProduction25setHaveRedshiftDependenceEb0
_ZN7crpropa19PhotoPionProduction8initRateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE22
_ZN7crpropa19PhotoPionProduction8setLimitEd0
_ZN7crpropa19PhotoPionProductionC2ENS_7ref_ptrINS_11PhotonFieldEEEbbbbdb11
_ZNK7crpropa19PhotoPionProduction10nucleonMFPEddb16206
_ZNK7crpropa19PhotoPionProduction10probEpsMaxEbdddd29
_ZNK7crpropa19PhotoPionProduction11breitwignerEddddb1442259
_ZNK7crpropa19PhotoPionProduction11crossectionEdb170560
_ZNK7crpropa19PhotoPionProduction11sophiaEventEbdd0
_ZNK7crpropa19PhotoPionProduction12getSampleLogEv0
_ZNK7crpropa19PhotoPionProduction14getHavePhotonsEv0
_ZNK7crpropa19PhotoPionProduction14getPhotonFieldEv1
_ZNK7crpropa19PhotoPionProduction16getHaveElectronsEv0
_ZNK7crpropa19PhotoPionProduction16getHaveNeutrinosEv0
_ZNK7crpropa19PhotoPionProduction17epsMinInteractionEbd28
_ZNK7crpropa19PhotoPionProduction17getInteractionTagB5cxx11Ev2
_ZNK7crpropa19PhotoPionProduction18nucleiModificationEii16206
_ZNK7crpropa19PhotoPionProduction18performInteractionEPNS_9CandidateEb28
_ZNK7crpropa19PhotoPionProduction19getCorrectionFactorEv1
_ZNK7crpropa19PhotoPionProduction19getHaveAntiNucleonsEv0
_ZNK7crpropa19PhotoPionProduction25getHaveRedshiftDependenceEv0
_ZNK7crpropa19PhotoPionProduction2EfEddd1612819
_ZNK7crpropa19PhotoPionProduction2PlEdddd320502
_ZNK7crpropa19PhotoPionProduction4massEb1815502
_ZNK7crpropa19PhotoPionProduction4sMinEv191909
_ZNK7crpropa19PhotoPionProduction6functsEdb170560
_ZNK7crpropa19PhotoPionProduction7probEpsEdbdd10689
_ZNK7crpropa19PhotoPionProduction7processEPNS_9CandidateE15289
_ZNK7crpropa19PhotoPionProduction8getLimitEv0
_ZNK7crpropa19PhotoPionProduction8momentumEbd10717
_ZNK7crpropa19PhotoPionProduction9sampleEpsEbdd28
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/PhotoPionProduction.cpp.gcov.html b/doc/coverageReport/src/module/PhotoPionProduction.cpp.gcov.html deleted file mode 100644 index 5a80e6b6b..000000000 --- a/doc/coverageReport/src/module/PhotoPionProduction.cpp.gcov.html +++ /dev/null @@ -1,758 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/PhotoPionProduction.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - PhotoPionProduction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:24638763.6 %
Date:2024-04-08 14:58:22Functions:244060.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/PhotoPionProduction.h"
-       2             : #include "crpropa/Units.h"
-       3             : #include "crpropa/ParticleID.h"
-       4             : #include "crpropa/Random.h"
-       5             : 
-       6             : #include "kiss/convert.h"
-       7             : #include "kiss/logger.h"
-       8             : #include "sophia.h"
-       9             : 
-      10             : #include <limits>
-      11             : #include <cmath>
-      12             : #include <sstream>
-      13             : #include <fstream>
-      14             : #include <stdexcept>
-      15             : 
-      16             : namespace crpropa {
-      17             : 
-      18          11 : PhotoPionProduction::PhotoPionProduction(ref_ptr<PhotonField> field, bool photons, bool neutrinos, bool electrons, bool antiNucleons, double l, bool redshift) {
-      19          11 :         havePhotons = photons;
-      20          11 :         haveNeutrinos = neutrinos;
-      21          11 :         haveElectrons = electrons;
-      22          11 :         haveAntiNucleons = antiNucleons;
-      23          11 :         haveRedshiftDependence = redshift;
-      24          11 :         limit = l;
-      25          11 :         setPhotonField(field);
-      26          11 : }
-      27             : 
-      28          22 : void PhotoPionProduction::setPhotonField(ref_ptr<PhotonField> field) {
-      29          22 :         photonField = field;
-      30          22 :         std::string fname = photonField->getFieldName();
-      31          22 :         if (haveRedshiftDependence) {
-      32           0 :                 if (photonField->hasRedshiftDependence() == false){
-      33           0 :                         std::cout << "PhotoPionProduction: tabulated redshift dependence not needed for " + fname + ", switching off" << std::endl;
-      34           0 :                         haveRedshiftDependence = false;
-      35             :                 }
-      36             :                 else {
-      37           0 :                         KISS_LOG_WARNING << "PhotoPionProduction: You are using the 2-dimensional tabulated redshift evolution, which is not available for other interactions. To be consistent across all interactions you may deactivate this <setHaveRedshiftDependence(False)>.";
-      38             :                 }
-      39             :         }
-      40             :         
-      41          22 :         setDescription("PhotoPionProduction: " + fname);
-      42          22 :         if (haveRedshiftDependence){
-      43           0 :                 initRate(getDataPath("PhotoPionProduction/rate_" + fname.replace(0, 3, "IRBz") + ".txt"));
-      44             :         }
-      45             :         else
-      46          66 :                 initRate(getDataPath("PhotoPionProduction/rate_" + fname + ".txt"));
-      47          22 : }
-      48             : 
-      49           1 : void PhotoPionProduction::setHavePhotons(bool b) {
-      50           1 :         havePhotons = b;
-      51           1 : }
-      52             :         
-      53           0 : void PhotoPionProduction::setHaveElectrons(bool b) {
-      54           0 :         haveElectrons = b;
-      55           0 : }
-      56             : 
-      57           0 : void PhotoPionProduction::setHaveNeutrinos(bool b) {
-      58           0 :         haveNeutrinos = b;
-      59           0 : }
-      60             : 
-      61           0 : void PhotoPionProduction::setHaveAntiNucleons(bool b) {
-      62           0 :         haveAntiNucleons = b;
-      63           0 : }
-      64             : 
-      65           0 : void PhotoPionProduction::setHaveRedshiftDependence(bool b) {
-      66           0 :         haveRedshiftDependence = b;
-      67           0 :         setPhotonField(photonField);
-      68           0 : }
-      69             : 
-      70           0 : void PhotoPionProduction::setLimit(double l) {
-      71           0 :         limit = l;
-      72           0 : }
-      73             : 
-      74          22 : void PhotoPionProduction::initRate(std::string filename) {
-      75             :         // clear previously loaded tables
-      76          22 :         tabLorentz.clear();
-      77          22 :         tabRedshifts.clear();
-      78          22 :         tabProtonRate.clear();
-      79          22 :         tabNeutronRate.clear();
-      80             : 
-      81          22 :         std::ifstream infile(filename.c_str());
-      82          22 :         if (!infile.good())
-      83           0 :                 throw std::runtime_error("PhotoPionProduction: could not open file " + filename);
-      84             : 
-      85          22 :         if (haveRedshiftDependence) {
-      86             :                 double zOld = -1, aOld = -1;
-      87           0 :                 while (infile.good()) {
-      88           0 :                         if (infile.peek() == '#') {
-      89           0 :                                 infile.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
-      90           0 :                                 continue;
-      91             :                         }
-      92             :                         double z, a, b, c;
-      93             :                         infile >> z >> a >> b >> c;
-      94           0 :                         if (!infile)
-      95             :                                 break;
-      96           0 :                         if (z > zOld) {
-      97           0 :                                 tabRedshifts.push_back(z);
-      98           0 :                                 zOld = z;
-      99             :                         }
-     100           0 :                         if (a > aOld) {
-     101           0 :                                 tabLorentz.push_back(pow(10, a));
-     102           0 :                                 aOld = a;
-     103             :                         }
-     104           0 :                         tabProtonRate.push_back(b / Mpc);
-     105           0 :                         tabNeutronRate.push_back(c / Mpc);
-     106             :                 }
-     107             :         } else {
-     108        5610 :                 while (infile.good()) {
-     109        5610 :                         if (infile.peek() == '#') {
-     110          66 :                                 infile.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
-     111          66 :                                 continue;
-     112             :                         }
-     113             :                         double a, b, c;
-     114             :                         infile >> a >> b >> c;
-     115        5544 :                         if (!infile)
-     116             :                                 break;
-     117        5522 :                         tabLorentz.push_back(pow(10, a));
-     118        5522 :                         tabProtonRate.push_back(b / Mpc);
-     119        5522 :                         tabNeutronRate.push_back(c / Mpc);
-     120             :                 }
-     121             :         }
-     122             : 
-     123          22 :         infile.close();
-     124          22 : }
-     125             : 
-     126       16206 : double PhotoPionProduction::nucleonMFP(double gamma, double z, bool onProton) const {
-     127       16206 :         const std::vector<double> &tabRate = (onProton)? tabProtonRate : tabNeutronRate;
-     128             : 
-     129             :         // scale nucleus energy instead of background photon energy
-     130       16206 :         gamma *= (1 + z);
-     131       16206 :         if (gamma < tabLorentz.front() or (gamma > tabLorentz.back()))
-     132             :                 return std::numeric_limits<double>::max();
-     133             : 
-     134             :         double rate;
-     135       16206 :         if (haveRedshiftDependence)
-     136           0 :                 rate = interpolate2d(z, gamma, tabRedshifts, tabLorentz, tabRate);
-     137             :         else
-     138       16206 :                 rate = interpolate(gamma, tabLorentz, tabRate) * photonField->getRedshiftScaling(z);
-     139             : 
-     140             :         // cosmological scaling
-     141       16206 :         rate *= pow_integer<2>(1 + z);
-     142             : 
-     143       16206 :         return 1. / rate;
-     144             : }
-     145             : 
-     146       16206 : double PhotoPionProduction::nucleiModification(int A, int X) const {
-     147       16206 :         if (A == 1)
-     148             :                 return 1.;
-     149        1801 :         if (A <= 8)
-     150         453 :                 return 0.85 * pow(X, 2. / 3.);
-     151        1348 :         return 0.85 * X;
-     152             : }
-     153             : 
-     154       15289 : void PhotoPionProduction::process(Candidate *candidate) const {
-     155       15289 :         double step = candidate->getCurrentStep();
-     156       15289 :         double z = candidate->getRedshift();
-     157             :         // the loop is processed at least once for limiting the next step
-     158             :         do {
-     159             :                 // check if nucleus
-     160       15307 :                 int id = candidate->current.getId();
-     161       15307 :                 if (!isNucleus(id))
-     162             :                         return;
-     163             : 
-     164             :                 // find interaction with minimum random distance
-     165       15306 :                 Random &random = Random::instance();
-     166             :                 double randDistance = std::numeric_limits<double>::max();
-     167             :                 double meanFreePath;
-     168             :                 double totalRate = 0;
-     169             :                 bool onProton = true; // interacting particle: proton or neutron
-     170             : 
-     171       15306 :                 int A = massNumber(id);
-     172       15306 :                 int Z = chargeNumber(id);
-     173       15306 :                 int N = A - Z;
-     174       15306 :                 double gamma = candidate->current.getLorentzFactor();
-     175             : 
-     176             :                 // check for interaction on protons
-     177       15306 :                 if (Z > 0) {
-     178       14758 :                         meanFreePath = nucleonMFP(gamma, z, true) / nucleiModification(A, Z);
-     179       14758 :                         randDistance = -log(random.rand()) * meanFreePath;
-     180       14758 :                         totalRate += 1. / meanFreePath;
-     181             :                 }
-     182             :                 // check for interaction on neutrons
-     183       15306 :                 if (N > 0) {
-     184        1448 :                         meanFreePath = nucleonMFP(gamma, z, false) / nucleiModification(A, N);
-     185        1448 :                         totalRate += 1. / meanFreePath;
-     186        1448 :                         double d = -log(random.rand()) * meanFreePath;
-     187        1448 :                         if (d < randDistance) {
-     188             :                                 randDistance = d;
-     189             :                                 onProton = false;
-     190             :                         }
-     191             :                 }
-     192             : 
-     193             :                 // check if interaction does not happen
-     194       15306 :                 if (step < randDistance) {
-     195       15288 :                         if (totalRate > 0.)
-     196       15288 :                                 candidate->limitNextStep(limit / totalRate);
-     197       15288 :                         return;
-     198             :                 }
-     199             : 
-     200             :                 // interact and repeat with remaining step
-     201          18 :                 performInteraction(candidate, onProton);
-     202          18 :                 step -= randDistance;
-     203          18 :         } while (step > 0);
-     204             : }
-     205             : 
-     206          28 : void PhotoPionProduction::performInteraction(Candidate *candidate, bool onProton) const {
-     207          28 :         int id = candidate->current.getId();
-     208          28 :         int A = massNumber(id);
-     209          28 :         int Z = chargeNumber(id);
-     210          28 :         double E = candidate->current.getEnergy();
-     211          28 :         double EpA = E / A;
-     212          28 :         double z = candidate->getRedshift();
-     213             : 
-     214             :         // SOPHIA simulates interactions only for protons / neutrons.
-     215             :         // For anti-protons / neutrons assume charge symmetry and change all
-     216             :         // interaction products from particle <--> anti-particle (sign)
-     217          28 :         int sign = (id > 0) ? 1 : -1;
-     218             : 
-     219             :         // check if below SOPHIA's energy threshold
-     220          56 :         double E_threshold = (photonField->getFieldName() == "CMB") ? 3.72e18 * eV : 5.83e15 * eV;
-     221          28 :         if (EpA * (1 + z) < E_threshold)
-     222           0 :                 return;
-     223             : 
-     224             :         // SOPHIA - input:
-     225          28 :         int nature = 1 - static_cast<int>(onProton);  // 0=proton, 1=neutron
-     226          28 :         double Ein = EpA / GeV;  // GeV is the SOPHIA standard unit
-     227          28 :         double eps = sampleEps(onProton, EpA, z) / GeV;  // GeV for SOPHIA
-     228             : 
-     229             :         // SOPHIA - output:
-     230             :         double outputEnergy[5][2000];  // [GeV/c, GeV/c, GeV/c, GeV, GeV/c^2]
-     231             :         int outPartID[2000];
-     232             :         int nParticles;
-     233             : 
-     234          56 : #pragma omp critical
-     235             :         {
-     236          28 :                 sophiaevent_(nature, Ein, eps, outputEnergy, outPartID, nParticles);
-     237             :         }
-     238             : 
-     239          28 :         Random &random = Random::instance();
-     240          28 :         Vector3d pos = random.randomInterpolatedPosition(candidate->previous.getPosition(), candidate->current.getPosition());
-     241             :         std::vector<int> pnType;  // filled with either 13 (proton) or 14 (neutron)
-     242             :         std::vector<double> pnEnergy;  // corresponding energies of proton or neutron
-     243          28 :         if (nParticles == 0)
-     244             :                 return;
-     245         146 :         for (int i = 0; i < nParticles; i++) { // loop over out-going particles
-     246         118 :                 double Eout = outputEnergy[3][i] * GeV; // only the energy is used; could be changed for more detail
-     247         118 :                 int pType = outPartID[i];
-     248         118 :                 switch (pType) {
-     249          28 :                 case 13: // proton
-     250             :                 case 14: // neutron
-     251             :                         // proton and neutron data is taken to determine primary particle in a later step
-     252          28 :                         pnType.push_back(pType);
-     253          28 :                         pnEnergy.push_back(Eout);
-     254             :                         break;
-     255           0 :                 case -13: // anti-proton
-     256             :                 case -14: // anti-neutron
-     257           0 :                         if (haveAntiNucleons)
-     258             :                                 try
-     259             :                                 {
-     260           0 :                                         candidate->addSecondary(-sign * nucleusId(1, 14 + pType), Eout, pos, 1., interactionTag);
-     261             :                                 }
-     262           0 :                                 catch (std::runtime_error &e)
-     263             :                                 {
-     264           0 :                                         KISS_LOG_ERROR<< "Something went wrong in the PhotoPionProduction (anti-nucleon production)\n" << "Something went wrong in the PhotoPionProduction\n"<< "Please report this error on https://github.com/CRPropa/CRPropa3/issues including your simulation setup and the following random seed:\n" << Random::instance().getSeed_base64();
-     265           0 :                                         throw;
-     266           0 :                                 }
-     267             :                         break;
-     268          22 :                 case 1: // photon
-     269          22 :                         if (havePhotons)
-     270          14 :                                 candidate->addSecondary(22, Eout, pos, 1., interactionTag);
-     271             :                         break;
-     272          12 :                 case 2: // positron
-     273          12 :                         if (haveElectrons)
-     274           2 :                                 candidate->addSecondary(sign * -11, Eout, pos, 1., interactionTag);
-     275             :                         break;
-     276           5 :                 case 3: // electron
-     277           5 :                         if (haveElectrons)
-     278           2 :                                 candidate->addSecondary(sign * 11, Eout, pos, 1., interactionTag);
-     279             :                         break;
-     280          12 :                 case 15: // nu_e
-     281          12 :                         if (haveNeutrinos)
-     282           2 :                                 candidate->addSecondary(sign * 12, Eout, pos, 1., interactionTag);
-     283             :                         break;
-     284           5 :                 case 16: // anti-nu_e
-     285           5 :                         if (haveNeutrinos)
-     286           2 :                                 candidate->addSecondary(sign * -12, Eout, pos, 1., interactionTag);
-     287             :                         break;
-     288          17 :                 case 17: // nu_mu
-     289          17 :                         if (haveNeutrinos)
-     290           4 :                                 candidate->addSecondary(sign * 14, Eout, pos, 1., interactionTag);
-     291             :                         break;
-     292          17 :                 case 18: // anti-nu_mu
-     293          17 :                         if (haveNeutrinos)
-     294           4 :                                 candidate->addSecondary(sign * -14, Eout, pos, 1., interactionTag);
-     295             :                         break;
-     296           0 :                 default:
-     297           0 :                         throw std::runtime_error("PhotoPionProduction: unexpected particle " + kiss::str(pType));
-     298             :                 }
-     299             :         }
-     300          28 :         double maxEnergy = *std::max_element(pnEnergy.begin(), pnEnergy.end());  // criterion for being declared primary
-     301          56 :         for (int i = 0; i < pnEnergy.size(); ++i) {
-     302          28 :                 if (pnEnergy[i] == maxEnergy) {  // nucleon is primary particle
-     303          28 :                         if (A == 1) {
-     304             :                                 // single interacting nucleon
-     305          25 :                                 candidate->current.setEnergy(pnEnergy[i]);
-     306             :                                 try
-     307             :                                 {
-     308          25 :                                         candidate->current.setId(sign * nucleusId(1, 14 - pnType[i]));
-     309             :                                 }
-     310           0 :                                 catch (std::runtime_error &e)
-     311             :                                 {
-     312           0 :                                         KISS_LOG_ERROR<< "Something went wrong in the PhotoPionProduction (primary particle, A==1)\n" << "Please report this error on https://github.com/CRPropa/CRPropa3/issues including your simulation setup and the following random seed:\n" << Random::instance().getSeed_base64();
-     313           0 :                                         throw;
-     314           0 :                                 }
-     315             :                         } else {
-     316             :                                 // interacting nucleon is part of nucleus: it is emitted from the nucleus
-     317           3 :                                 candidate->current.setEnergy(E - EpA);
-     318             :                                 try
-     319             :                                 {
-     320           3 :                                         candidate->current.setId(sign * nucleusId(A - 1, Z - int(onProton)));
-     321           3 :                                         candidate->addSecondary(sign * nucleusId(1, 14 - pnType[i]), pnEnergy[i], pos, 1., interactionTag);
-     322             :                                 }
-     323           0 :                                 catch (std::runtime_error &e)
-     324             :                                 {
-     325           0 :                                         KISS_LOG_ERROR<< "Something went wrong in the PhotoPionProduction (primary particle, A!=1)\n" << "Please report this error on https://github.com/CRPropa/CRPropa3/issues including your simulation setup and the following random seed:\n" << Random::instance().getSeed_base64();
-     326           0 :                                         throw;
-     327           0 :                                 }
-     328             :                         }
-     329             :                 } else {  // nucleon is secondary proton or neutron
-     330           0 :                         candidate->addSecondary(sign * nucleusId(1, 14 - pnType[i]), pnEnergy[i], pos, 1., interactionTag);
-     331             :                 }
-     332             :         }
-     333             : }
-     334             : 
-     335           0 : double PhotoPionProduction::lossLength(int id, double gamma, double z) {
-     336           0 :         int A = massNumber(id);
-     337           0 :         int Z = chargeNumber(id);
-     338           0 :         int N = A - Z;
-     339             : 
-     340             :         double lossRate = 0;
-     341           0 :         if (Z > 0)
-     342           0 :                 lossRate += 1 / nucleonMFP(gamma, z, true) * nucleiModification(A, Z);
-     343           0 :         if (N > 0)
-     344           0 :                 lossRate += 1 / nucleonMFP(gamma, z, false) * nucleiModification(A, N);
-     345             : 
-     346             :         // approximate the relative energy loss
-     347             :         // - nucleons keep the fraction of mass to delta-resonance mass
-     348             :         // - nuclei lose the energy 1/A the interacting nucleon is carrying
-     349           0 :         double relativeEnergyLoss = (A == 1) ? 1 - 938. / 1232. : 1. / A;
-     350           0 :         lossRate *= relativeEnergyLoss;
-     351             : 
-     352             :         // scaling factor: interaction rate --> energy loss rate
-     353           0 :         lossRate *= (1 + z);
-     354             : 
-     355           0 :         return 1. / lossRate;
-     356             : }
-     357             : 
-     358           0 : SophiaEventOutput PhotoPionProduction::sophiaEvent(bool onProton, double Ein, double eps) const {
-     359             :         // SOPHIA - input:
-     360           0 :         int nature = 1 - static_cast<int>(onProton);  // 0=proton, 1=neutron
-     361           0 :         Ein /= GeV;  // GeV is the SOPHIA standard unit
-     362           0 :         eps /= GeV;  // GeV for SOPHIA
-     363             : 
-     364             :         // SOPHIA - output:
-     365             :         double outputEnergy[5][2000];  // [Px GeV/c, Py GeV/c, Pz GeV/c, E GeV, m0 GeV/c^2]
-     366             :         int outPartID[2000];
-     367             :         int nParticles;
-     368             : 
-     369           0 :         sophiaevent_(nature, Ein, eps, outputEnergy, outPartID, nParticles);
-     370             : 
-     371             :         // convert SOPHIA IDs to PDG naming convention & create particles
-     372             :         SophiaEventOutput output;
-     373           0 :         output.nParticles = nParticles;
-     374           0 :         for (int i = 0; i < nParticles; ++i) {
-     375           0 :                 int id = 0;
-     376           0 :                 int partType = outPartID[i];
-     377           0 :                 switch (partType) {
-     378           0 :                         case 13:  // proton
-     379             :                         case 14:  // neutron
-     380           0 :                                 id = nucleusId(1, 14 - partType);
-     381           0 :                                 break;
-     382           0 :                         case -13:  // anti-proton
-     383             :                         case -14:  // anti-neutron
-     384           0 :                                 id = -nucleusId(1, 14 + partType);
-     385           0 :                                 break;
-     386           0 :                         case 1:  // photon
-     387           0 :                                 id = 22;
-     388           0 :                                 break;
-     389           0 :                         case 2:  // positron
-     390           0 :                                 id = -11;
-     391           0 :                                 break;
-     392           0 :                         case 3:  // electron
-     393           0 :                                 id = 11;
-     394           0 :                                 break;
-     395           0 :                         case 15:  // nu_e
-     396           0 :                                 id = 12;
-     397           0 :                                 break;
-     398           0 :                         case 16:  // anti-nu_e
-     399           0 :                                 id = -12;
-     400           0 :                                 break;
-     401           0 :                         case 17:  // nu_mu
-     402           0 :                                 id = 14;
-     403           0 :                                 break;
-     404           0 :                         case 18:  // anti-nu_mu
-     405           0 :                                 id = -14;
-     406           0 :                                 break;
-     407           0 :                         default:
-     408           0 :                                 throw std::runtime_error("PhotoPionProduction: unexpected particle " + kiss::str(partType));
-     409             :                 }
-     410           0 :                 output.energy.push_back(outputEnergy[3][i] * GeV); // only the energy is used; could be changed for more detail
-     411           0 :                 output.id.push_back(id);
-     412             :         }
-     413           0 :         return output;
-     414           0 : }
-     415             : 
-     416          28 : double PhotoPionProduction::sampleEps(bool onProton, double E, double z) const {
-     417             :         // sample eps between epsMin ... epsMax
-     418          28 :         double Ein = E / GeV;
-     419          56 :         double epsMin = std::max(photonField -> getMinimumPhotonEnergy(z) / eV, epsMinInteraction(onProton, Ein));
-     420          28 :         double epsMax = photonField -> getMaximumPhotonEnergy(z) / eV;
-     421          28 :         double pEpsMax = probEpsMax(onProton, Ein, z, epsMin, epsMax);
-     422             : 
-     423          28 :         Random &random = Random::instance();
-     424        5034 :         for (int i = 0; i < 1000000; i++) {
-     425        5034 :                 double eps = epsMin + random.rand() * (epsMax - epsMin);
-     426        5034 :                 double pEps = probEps(eps, onProton, Ein, z);
-     427        5034 :                 if (random.rand() * pEpsMax < pEps)
-     428          28 :                         return eps * eV;
-     429             :         }
-     430           0 :         throw std::runtime_error("error: no photon found in sampleEps, please make sure that photon field provides photons for the interaction by adapting the energy range of the tabulated photon field.");
-     431             : }
-     432             : 
-     433          28 : double PhotoPionProduction::epsMinInteraction(bool onProton, double Ein) const {
-     434             :         // labframe energy of least energetic photon where PPP can occur
-     435             :         // this kind-of ties samplingEps to the PPP and SOPHIA
-     436          28 :         const double m = mass(onProton);
-     437          28 :         const double p = momentum(onProton, Ein);
-     438          28 :         double epsMin = 1.e9 * (1.1646 - m * m) / 2. / (Ein + p); // eV
-     439          28 :         return epsMin;
-     440             : }
-     441             : 
-     442          29 : double PhotoPionProduction::probEpsMax(bool onProton, double Ein, double z, double epsMin, double epsMax) const {
-     443             :         // find pEpsMax by testing photon energies (eps) for their interaction
-     444             :         // probabilities (p) in order to find the maximum (max) probability
-     445             :         const int nrSteps = 100;
-     446             :         double pEpsMaxTested = 0.;
-     447             :         double step = 0.;
-     448          29 :         if (sampleLog){
-     449             :                 // sample in logspace with stepsize that is at max Δlog(E/eV) = 0.01 or otherwise dep. on size of energy range with nrSteps+1 steps log. equidis. spaced
-     450          29 :                 step = std::min(0.01, std::log10(epsMax / epsMin) / nrSteps);
-     451             :         } else
-     452           0 :                 step = (epsMax - epsMin) / nrSteps;
-     453             : 
-     454             :         double epsDummy = 0.;
-     455             :         int i = 0;
-     456        5684 :         while (epsDummy < epsMax) {
-     457        5655 :                 if (sampleLog)
-     458        5655 :                         epsDummy = epsMin * pow(10, step * i);
-     459             :                 else
-     460           0 :                         epsDummy = epsMin + step * i;
-     461        5655 :                 double p = probEps(epsDummy, onProton, Ein, z);
-     462        5655 :                 if(p > pEpsMaxTested)
-     463             :                         pEpsMaxTested = p;
-     464        5655 :                 i++;
-     465             :         }
-     466             :         // the following factor corrects for only trying to find the maximum on nrIteration photon energies
-     467             :         // the factor should be determined in convergence tests
-     468          29 :         double pEpsMax = pEpsMaxTested * correctionFactor;
-     469             : 
-     470          29 :         if(pEpsMax == 0) {
-     471           0 :                 KISS_LOG_WARNING << "pEpsMax is 0 in the following configuration: \n"
-     472           0 :                         << "\t" << "onProton: " << onProton << "\n"
-     473           0 :                         << "\t" << "Ein: " << Ein << " [GeV] \n"
-     474           0 :                         << "\t" << "epsRange [eV] " << epsMin << "\t" << epsMax << "\n"
-     475           0 :                         << "\t" << "redshift: " << z << "\n"
-     476           0 :                         << "\t" << "sample Log " << sampleLog << " with step " << step << " [eV] \n";
-     477             :         }
-     478             : 
-     479          29 :         return pEpsMax;
-     480             : }
-     481             : 
-     482       10689 : double PhotoPionProduction::probEps(double eps, bool onProton, double Ein, double z) const {
-     483             :         // probEps returns "probability to encounter a photon of energy eps", given a primary nucleon
-     484             :         // note, probEps does not return a normalized probability [0,...,1]
-     485       10689 :         double photonDensity = photonField->getPhotonDensity(eps * eV, z) * ccm / eps;
-     486       10689 :         if (photonDensity != 0.) {
-     487       10689 :                 const double p = momentum(onProton, Ein);
-     488       10689 :                 const double sMax = mass(onProton) * mass(onProton) + 2. * eps * (Ein + p) / 1.e9;
-     489       10689 :                 if (sMax <= sMin())
-     490             :                         return 0;
-     491       95940 :                 double sIntegr = gaussInt([this, onProton](double s) { return this->functs(s, onProton); }, sMin(), sMax);
-     492       10660 :                 return photonDensity * sIntegr / eps / eps / p / 8. * 1.e18 * 1.e6;
-     493             :         }
-     494             :         return 0;
-     495             : }
-     496             : 
-     497       10717 : double PhotoPionProduction::momentum(bool onProton, double Ein) const {
-     498       10717 :         const double m = mass(onProton);
-     499       10717 :         const double momentumHadron = sqrt(Ein * Ein - m * m);  // GeV/c
-     500       10717 :         return momentumHadron;
-     501             : }
-     502             : 
-     503      170560 : double PhotoPionProduction::crossection(double eps, bool onProton) const {
-     504      170560 :         const double m = mass(onProton);
-     505      170560 :         const double s = m * m + 2. * m * eps;
-     506      170560 :         if (s < sMin())
-     507             :                 return 0.;
-     508             :         double cross_res = 0.;
-     509             :         double cross_dir = 0.;
-     510             :         double cross_dir1 = 0.;
-     511             :         double cross_dir2 = 0.;
-     512             :         double sig_res[9];
-     513             : 
-     514             :         // first half of array: 9x proton resonance data | second half of array 9x neutron resonance data
-     515             :         static const double AMRES[18] = {1.231, 1.440, 1.515, 1.525, 1.675, 1.680, 1.690, 1.895, 1.950, 1.231, 1.440, 1.515, 1.525, 1.675, 1.675, 1.690, 1.895, 1.950};
-     516             :         static const double BGAMMA[18] = {5.6, 0.5, 4.6, 2.5, 1.0, 2.1, 2.0, 0.2, 1.0, 6.1, 0.3, 4.0, 2.5, 0.0, 0.2, 2.0, 0.2, 1.0};
-     517             :         static const double WIDTH[18] = {0.11, 0.35, 0.11, 0.1, 0.16, 0.125, 0.29, 0.35, 0.3, 0.11, 0.35, 0.11, 0.1, 0.16, 0.150, 0.29, 0.35, 0.3};
-     518             :         static const double RATIOJ[18] = {1., 0.5, 1., 0.5, 0.5, 1.5, 1., 1.5, 2., 1., 0.5, 1., 0.5, 0.5, 1.5, 1., 1.5, 2.};
-     519             :         static const double AM2[2] = {0.882792, 0.880351};
-     520             : 
-     521      170560 :         const int idx = onProton? 0 : 9;
-     522             :         double SIG0[9];
-     523     1705600 :         for (int i = 0; i < 9; ++i) {
-     524     1535040 :                 SIG0[i] = 4.893089117 / AM2[int(onProton)] * RATIOJ[i + idx] * BGAMMA[i + idx];
-     525             :         }
-     526      170560 :         if (eps <= 10.) {
-     527      160251 :                 cross_res = breitwigner(SIG0[0], WIDTH[0 + idx], AMRES[0 + idx], eps, onProton) * Ef(eps, 0.152, 0.17);
-     528             :                 sig_res[0] = cross_res;
-     529     1442259 :                 for (int i = 1; i < 9; ++i) {
-     530     1282008 :                         sig_res[i] = breitwigner(SIG0[i], WIDTH[i + idx], AMRES[i + idx], eps, onProton) * Ef(eps, 0.15, 0.38);
-     531     1282008 :                         cross_res += sig_res[i];
-     532             :                 }
-     533             :                 // direct channel
-     534      160251 :                 if ((eps > 0.1) && (eps < 0.6)) {
-     535       66492 :                         cross_dir1 = 92.7 * Pl(eps, 0.152, 0.25, 2.0)  // single pion production
-     536       66492 :                                            + 40. * std::exp(-(eps - 0.29) * (eps - 0.29) / 0.002)
-     537       66492 :                                            - 15. * std::exp(-(eps - 0.37) * (eps - 0.37) / 0.002);
-     538             :                 } else {
-     539       93759 :                         cross_dir1 = 92.7 * Pl(eps, 0.152, 0.25, 2.0);  // single pion production
-     540             :                 }
-     541      160251 :                 cross_dir2 = 37.7 * Pl(eps, 0.4, 0.6, 2.0);  // double pion production
-     542      160251 :                 cross_dir = cross_dir1 + cross_dir2;
-     543             :         }
-     544             :         // fragmentation 2:
-     545      170560 :         double cross_frag2 = onProton? 80.3 : 60.2;
-     546      170560 :         cross_frag2 *= Ef(eps, 0.5, 0.1) * std::pow(s, -0.34);
-     547             :         // multipion production/fragmentation 1 cross section
-     548             :         double cs_multidiff = 0.;
-     549             :         double cs_multi = 0.;
-     550             :         double cross_diffr1 = 0.;
-     551             :         double cross_diffr2 = 0.;
-     552             :         double cross_diffr = 0.;
-     553      170560 :         if (eps > 0.85) {
-     554       92272 :                 double ss1 = (eps - 0.85) / 0.69;
-     555       92272 :                 double ss2 = onProton? 29.3 : 26.4;
-     556       92272 :                 ss2 *= std::pow(s, -0.34) + 59.3 * std::pow(s, 0.095);
-     557       92272 :                 cs_multidiff = (1. - std::exp(-ss1)) * ss2;
-     558       92272 :                 cs_multi = 0.89 * cs_multidiff;
-     559             :                 // diffractive scattering:
-     560             :                 cross_diffr1 = 0.099 * cs_multidiff;
-     561             :                 cross_diffr2 = 0.011 * cs_multidiff;
-     562       92272 :                 cross_diffr = 0.11 * cs_multidiff;
-     563             :                 // **************************************
-     564       92272 :                 ss1 = std::pow(eps - 0.85, 0.75) / 0.64;
-     565       92272 :                 ss2 = 74.1 * std::pow(eps, -0.44) + 62. * std::pow(s, 0.08);
-     566       92272 :                 double cs_tmp = 0.96 * (1. - std::exp(-ss1)) * ss2;
-     567       92272 :                 cross_diffr1 = 0.14 * cs_tmp;
-     568       92272 :                 cross_diffr2 = 0.013 * cs_tmp;
-     569       92272 :                 double cs_delta = cross_frag2 - (cross_diffr1 + cross_diffr2 - cross_diffr);
-     570       92272 :                 if (cs_delta < 0.) {
-     571             :                         cross_frag2 = 0.;
-     572           0 :                         cs_multi += cs_delta;
-     573             :                 } else {
-     574             :                         cross_frag2 = cs_delta;
-     575             :                 }
-     576             :                 cross_diffr = cross_diffr1 + cross_diffr2;
-     577       92272 :                 cs_multidiff = cs_multi + cross_diffr;
-     578             :         // in the original SOPHIA code, here is a switch for the return argument.
-     579             :         // Here, only one case (compare in SOPHIA: NDIR=3) is needed.
-     580             :         }
-     581      170560 :         return cross_res + cross_dir + cs_multidiff + cross_frag2;
-     582             : }
-     583             : 
-     584      320502 : double PhotoPionProduction::Pl(double eps, double epsTh, double epsMax, double alpha) const {
-     585      320502 :         if (epsTh > eps)
-     586             :                 return 0.;
-     587      266687 :         const double a = alpha * epsMax / epsTh;
-     588      266687 :         const double prod1 = std::pow((eps - epsTh) / (epsMax - epsTh), a - alpha);
-     589      266687 :         const double prod2 = std::pow(eps / epsMax, -a);
-     590      266687 :         return prod1 * prod2;
-     591             : }
-     592             : 
-     593     1612819 : double PhotoPionProduction::Ef(double eps, double epsTh, double w) const {
-     594     1612819 :         const double wTh = w + epsTh;
-     595     1612819 :         if (eps <= epsTh) {
-     596             :                 return 0.;
-     597     1551121 :         } else if ((eps > epsTh) && (eps < wTh)) {
-     598      547581 :                 return (eps - epsTh) / w;
-     599     1003540 :         } else if (eps >= wTh) {
-     600             :                 return 1.;
-     601             :         } else {
-     602           0 :                 throw std::runtime_error("error in function Ef");
-     603             :         }
-     604             : }
-     605             : 
-     606     1442259 : double PhotoPionProduction::breitwigner(double sigma0, double gamma, double DMM, double epsPrime, bool onProton) const {
-     607     1442259 :         const double m = mass(onProton);
-     608     1442259 :         const double s = m * m + 2. * m * epsPrime;
-     609     1442259 :         const double gam2s = gamma * gamma * s;
-     610     1442259 :         return sigma0 * (s / epsPrime / epsPrime) * gam2s / ((s - DMM * DMM) * (s - DMM * DMM) + gam2s);
-     611             : }
-     612             : 
-     613      170560 : double PhotoPionProduction::functs(double s, bool onProton) const {
-     614      170560 :         const double m = mass(onProton);
-     615      170560 :         const double factor = s - m * m;
-     616      170560 :         const double epsPrime = factor / 2. / m;
-     617      170560 :         const double sigmaPg = crossection(epsPrime, onProton);
-     618      170560 :         return factor * sigmaPg;
-     619             : }
-     620             : 
-     621     1815502 : double PhotoPionProduction::mass(bool onProton) const {
-     622     1815502 :         const double m =  onProton ? mass_proton : mass_neutron;
-     623     1815502 :         return m / GeV * c_squared;
-     624             : }
-     625             : 
-     626      191909 : double PhotoPionProduction::sMin() const {
-     627      191909 :         return 1.1646; // [GeV^2] head-on collision
-     628             : }
-     629             : 
-     630           0 : void PhotoPionProduction::setSampleLog(bool b) {
-     631           0 :         sampleLog = b;
-     632           0 : }
-     633             : 
-     634           0 : void PhotoPionProduction::setCorrectionFactor(double factor) {
-     635           0 :         correctionFactor = factor;
-     636           0 : }
-     637             : 
-     638           1 : ref_ptr<PhotonField> PhotoPionProduction::getPhotonField() const {
-     639           1 :         return photonField;
-     640             : }
-     641             : 
-     642           0 : bool PhotoPionProduction::getHavePhotons() const {
-     643           0 :         return havePhotons;
-     644             : }
-     645             : 
-     646           0 : bool PhotoPionProduction::getHaveNeutrinos() const {
-     647           0 :         return haveNeutrinos;
-     648             : }
-     649             : 
-     650           0 : bool PhotoPionProduction::getHaveElectrons() const {
-     651           0 :         return haveElectrons;
-     652             : }
-     653             : 
-     654           0 : bool PhotoPionProduction::getHaveAntiNucleons() const {
-     655           0 :         return haveAntiNucleons;
-     656             : }
-     657             : 
-     658           0 : bool PhotoPionProduction::getHaveRedshiftDependence() const {
-     659           0 :         return haveRedshiftDependence;
-     660             : }
-     661             : 
-     662           0 : double PhotoPionProduction::getLimit() const {
-     663           0 :         return limit;
-     664             : }
-     665             : 
-     666           0 : bool PhotoPionProduction::getSampleLog() const {
-     667           0 :         return sampleLog;
-     668             : }
-     669             : 
-     670           1 : double PhotoPionProduction::getCorrectionFactor() const {
-     671           1 :         return correctionFactor;
-     672             : }
-     673             : 
-     674           1 : void PhotoPionProduction::setInteractionTag(std::string tag) {
-     675           1 :         interactionTag = tag;
-     676           1 : }
-     677             : 
-     678           2 : std::string PhotoPionProduction::getInteractionTag() const {
-     679           2 :         return interactionTag;
-     680             : }
-     681             : 
-     682             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/PhotonOutput1D.cpp.func-sort-c.html b/doc/coverageReport/src/module/PhotonOutput1D.cpp.func-sort-c.html deleted file mode 100644 index 20fda8338..000000000 --- a/doc/coverageReport/src/module/PhotonOutput1D.cpp.func-sort-c.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/PhotonOutput1D.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - PhotonOutput1D.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0560.0 %
Date:2024-04-08 14:58:22Functions:090.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa14PhotonOutput1D4gzipEv0
_ZN7crpropa14PhotonOutput1D5closeEv0
_ZN7crpropa14PhotonOutput1DC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa14PhotonOutput1DC2ERSo0
_ZN7crpropa14PhotonOutput1DC2Ev0
_ZN7crpropa14PhotonOutput1DD0Ev0
_ZN7crpropa14PhotonOutput1DD2Ev0
_ZNK7crpropa14PhotonOutput1D14getDescriptionB5cxx11Ev0
_ZNK7crpropa14PhotonOutput1D7processEPNS_9CandidateE0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/PhotonOutput1D.cpp.func.html b/doc/coverageReport/src/module/PhotonOutput1D.cpp.func.html deleted file mode 100644 index bb7a35aac..000000000 --- a/doc/coverageReport/src/module/PhotonOutput1D.cpp.func.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/PhotonOutput1D.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - PhotonOutput1D.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0560.0 %
Date:2024-04-08 14:58:22Functions:090.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa14PhotonOutput1D4gzipEv0
_ZN7crpropa14PhotonOutput1D5closeEv0
_ZN7crpropa14PhotonOutput1DC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE0
_ZN7crpropa14PhotonOutput1DC2ERSo0
_ZN7crpropa14PhotonOutput1DC2Ev0
_ZN7crpropa14PhotonOutput1DD0Ev0
_ZN7crpropa14PhotonOutput1DD2Ev0
_ZNK7crpropa14PhotonOutput1D14getDescriptionB5cxx11Ev0
_ZNK7crpropa14PhotonOutput1D7processEPNS_9CandidateE0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/PhotonOutput1D.cpp.gcov.html b/doc/coverageReport/src/module/PhotonOutput1D.cpp.gcov.html deleted file mode 100644 index 18cb674db..000000000 --- a/doc/coverageReport/src/module/PhotonOutput1D.cpp.gcov.html +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/PhotonOutput1D.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - PhotonOutput1D.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:0560.0 %
Date:2024-04-08 14:58:22Functions:090.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/PhotonOutput1D.h"
-       2             : #include "crpropa/Units.h"
-       3             : 
-       4             : #include <iostream>
-       5             : #include <sstream>
-       6             : #include <cstdio>
-       7             : #include <stdexcept>
-       8             : 
-       9             : #include "kiss/string.h"
-      10             : #include "kiss/logger.h"
-      11             : 
-      12             : #ifdef CRPROPA_HAVE_ZLIB
-      13             : #include <ozstream.hpp>
-      14             : #endif
-      15             : 
-      16             : using namespace std;
-      17             : 
-      18             : namespace crpropa {
-      19             : 
-      20           0 : PhotonOutput1D::PhotonOutput1D() : out(&std::cout) {
-      21           0 :         KISS_LOG_WARNING << "PhotonOutput1D is deprecated and will be removed in the future. Replace with TextOutput or HDF5Output with features ObserverNucleusVeto + ObserverDetectAll";
-      22           0 : }
-      23             : 
-      24           0 : PhotonOutput1D::PhotonOutput1D(std::ostream &out) : out(&out) {
-      25           0 :         KISS_LOG_WARNING << "PhotonOutput1D is deprecated and will be removed in the future. Replace with TextOutput or HDF5Output with features ObserverNucleusVeto + ObserverDetectAll";
-      26           0 : }
-      27             : 
-      28           0 : PhotonOutput1D::PhotonOutput1D(const std::string &filename) : outfile(
-      29           0 :         filename.c_str(), std::ios::binary), out(&outfile), filename(filename) {
-      30           0 :         KISS_LOG_WARNING << "PhotonOutput1D is deprecated and will be removed in the future. Replace with TextOutput or HDF5Output with features ObserverNucleusVeto + ObserverDetectAll";
-      31           0 :         if (kiss::ends_with(filename, ".gz"))
-      32           0 :                 gzip();
-      33             : 
-      34           0 :         *out << "#ID\tE\tD\tpID\tpE\tiID\tiE\tiD\n";
-      35           0 :         *out << "#\n";
-      36           0 :         *out << "# ID          Id of particle (photon, electron, positron)\n";
-      37           0 :         *out << "# E           Energy [EeV]\n";
-      38           0 :         *out << "# D           Comoving distance to origin [Mpc]\n";
-      39           0 :         *out << "# pID         Id of parent particle\n";
-      40           0 :         *out << "# pE          Energy [EeV] of parent particle\n";
-      41           0 :         *out << "# iID         Id of source particle\n";
-      42           0 :         *out << "# iE          Energy [EeV] of source particle\n";
-      43           0 :         *out << "# iD          Comoving distance [Mpc] to source\n";
-      44           0 :         *out << "#\n";
-      45           0 : }
-      46             : 
-      47           0 : void PhotonOutput1D::process(Candidate *candidate) const {
-      48           0 :         int pid = candidate->current.getId();
-      49           0 :         if ((pid != 22) and (abs(pid) != 11))
-      50           0 :                 return;
-      51             : 
-      52             :         char buffer[1024];
-      53             :         size_t p = 0;
-      54             : 
-      55           0 :         p += std::sprintf(buffer + p, "%4i\t", pid);
-      56           0 :         p += std::sprintf(buffer + p, "%g\t", candidate->current.getEnergy() / EeV);
-      57           0 :         p += std::sprintf(buffer + p, "%8.4f\t", candidate->current.getPosition().getR() / Mpc);
-      58             : 
-      59           0 :         p += std::sprintf(buffer + p, "%10i\t", candidate->created.getId());
-      60           0 :         p += std::sprintf(buffer + p, "%8.4f\t", candidate->created.getEnergy() / EeV);
-      61             : 
-      62           0 :         p += std::sprintf(buffer + p, "%10i\t", candidate->source.getId());
-      63           0 :         p += std::sprintf(buffer + p, "%8.4f\t", candidate->source.getEnergy() / EeV);
-      64           0 :         p += std::sprintf(buffer + p, "%8.4f\n", candidate->source.getPosition().getR() / Mpc);
-      65             : 
-      66           0 : #pragma omp critical
-      67             :         {
-      68           0 :                 out->write(buffer, p);
-      69             :         }
-      70             : 
-      71           0 :         candidate->setActive(false);
-      72             : }
-      73             : 
-      74           0 : void PhotonOutput1D::close() {
-      75             :         #ifdef CRPROPA_HAVE_ZLIB
-      76           0 :                 zstream::ogzstream *zs = dynamic_cast<zstream::ogzstream *>(out);
-      77           0 :                 if (zs) {
-      78           0 :                         zs->close();
-      79           0 :                         delete out;
-      80           0 :                         out = 0;
-      81             :                 }
-      82             :         #endif
-      83           0 :         outfile.flush();
-      84           0 : }
-      85             : 
-      86           0 : string PhotonOutput1D::getDescription() const {
-      87           0 :         std::stringstream s;
-      88             :         s << "PhotonOutput1D: Output file = " << filename;
-      89           0 :         return s.str();
-      90           0 : }
-      91             : 
-      92           0 : PhotonOutput1D::~PhotonOutput1D() {
-      93           0 :         close();
-      94           0 : }
-      95             : 
-      96           0 : void PhotonOutput1D::gzip() {
-      97             :         #ifdef CRPROPA_HAVE_ZLIB
-      98           0 :                 out = new zstream::ogzstream(*out);
-      99             :         #else
-     100             :                 throw std::runtime_error("CRPropa was build without Zlib compression!");
-     101             :         #endif
-     102           0 : }
-     103             : 
-     104             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/PropagationBP.cpp.func-sort-c.html b/doc/coverageReport/src/module/PropagationBP.cpp.func-sort-c.html deleted file mode 100644 index ba52b0e12..000000000 --- a/doc/coverageReport/src/module/PropagationBP.cpp.func-sort-c.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/PropagationBP.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - PropagationBP.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:9210488.5 %
Date:2024-04-08 14:58:22Functions:151693.8 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa13PropagationBP14getDescriptionB5cxx11Ev0
_ZNK7crpropa13PropagationBP12getToleranceEv2
_ZNK7crpropa13PropagationBP14getMinimumStepEv2
_ZNK7crpropa13PropagationBP8getFieldEv2
_ZN7crpropa13PropagationBPC2ENS_7ref_ptrINS_13MagneticFieldEEEddd5
_ZNK7crpropa13PropagationBP14getMaximumStepEv5
_ZN7crpropa13PropagationBPC2ENS_7ref_ptrINS_13MagneticFieldEEEd10
_ZN7crpropa13PropagationBP8setFieldENS_7ref_ptrINS_13MagneticFieldEEE16
_ZN7crpropa13PropagationBP12setToleranceEd22
_ZN7crpropa13PropagationBP14setMaximumStepEd22
_ZN7crpropa13PropagationBP14setMinimumStepEd24
_ZNK7crpropa13PropagationBP15errorEstimationENS_7Vector3IdEES2_d28
_ZNK7crpropa13PropagationBP7tryStepERKNS0_1YERS1_S4_dRNS_13ParticleStateEddd28
_ZNK7crpropa13PropagationBP7processEPNS_9CandidateE37
_ZNK7crpropa13PropagationBP2dYENS_7Vector3IdEES2_dddd103
_ZNK7crpropa13PropagationBP18getFieldAtPositionENS_7Vector3IdEEd104
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/PropagationBP.cpp.func.html b/doc/coverageReport/src/module/PropagationBP.cpp.func.html deleted file mode 100644 index d14b61859..000000000 --- a/doc/coverageReport/src/module/PropagationBP.cpp.func.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/PropagationBP.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - PropagationBP.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:9210488.5 %
Date:2024-04-08 14:58:22Functions:151693.8 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa13PropagationBP12setToleranceEd22
_ZN7crpropa13PropagationBP14setMaximumStepEd22
_ZN7crpropa13PropagationBP14setMinimumStepEd24
_ZN7crpropa13PropagationBP8setFieldENS_7ref_ptrINS_13MagneticFieldEEE16
_ZN7crpropa13PropagationBPC2ENS_7ref_ptrINS_13MagneticFieldEEEd10
_ZN7crpropa13PropagationBPC2ENS_7ref_ptrINS_13MagneticFieldEEEddd5
_ZNK7crpropa13PropagationBP12getToleranceEv2
_ZNK7crpropa13PropagationBP14getDescriptionB5cxx11Ev0
_ZNK7crpropa13PropagationBP14getMaximumStepEv5
_ZNK7crpropa13PropagationBP14getMinimumStepEv2
_ZNK7crpropa13PropagationBP15errorEstimationENS_7Vector3IdEES2_d28
_ZNK7crpropa13PropagationBP18getFieldAtPositionENS_7Vector3IdEEd104
_ZNK7crpropa13PropagationBP2dYENS_7Vector3IdEES2_dddd103
_ZNK7crpropa13PropagationBP7processEPNS_9CandidateE37
_ZNK7crpropa13PropagationBP7tryStepERKNS0_1YERS1_S4_dRNS_13ParticleStateEddd28
_ZNK7crpropa13PropagationBP8getFieldEv2
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/PropagationBP.cpp.gcov.html b/doc/coverageReport/src/module/PropagationBP.cpp.gcov.html deleted file mode 100644 index 8e1869baf..000000000 --- a/doc/coverageReport/src/module/PropagationBP.cpp.gcov.html +++ /dev/null @@ -1,285 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/PropagationBP.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - PropagationBP.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:9210488.5 %
Date:2024-04-08 14:58:22Functions:151693.8 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/PropagationBP.h"
-       2             : 
-       3             : #include <sstream>
-       4             : #include <stdexcept>
-       5             : #include <vector>
-       6             : 
-       7             : namespace crpropa {
-       8          28 :         void PropagationBP::tryStep(const Y &y, Y &out, Y &error, double h,
-       9             :                         ParticleState &particle, double z, double q, double m) const {
-      10          28 :                 out = dY(y.x, y.u, h, z, q, m);  // 1 step with h
-      11             : 
-      12          28 :                 Y outHelp = dY(y.x, y.u, h/2, z, q, m);  // 2 steps with h/2
-      13          28 :                 Y outCompare = dY(outHelp.x, outHelp.u, h/2, z, q, m);
-      14             : 
-      15          28 :                 error = errorEstimation(out.x , outCompare.x , h);
-      16          28 :         }
-      17             : 
-      18             : 
-      19         103 :         PropagationBP::Y PropagationBP::dY(Vector3d pos, Vector3d dir, double step,
-      20             :                         double z, double q, double m) const {
-      21             :                 // half leap frog step in the position
-      22             :                 pos += dir * step / 2.;
-      23             : 
-      24             :                 // get B field at particle position
-      25         103 :                 Vector3d B = getFieldAtPosition(pos, z);
-      26             : 
-      27             :                 // Boris help vectors
-      28             :                 Vector3d t = B * q / 2 / m * step / c_light;
-      29         103 :                 Vector3d s = t * 2 / (1 + t.dot(t));
-      30             :                 Vector3d v_help;
-      31             : 
-      32             :                 // Boris push
-      33             :                 v_help = dir + dir.cross(t);
-      34             :                 dir = dir + v_help.cross(s);
-      35             : 
-      36             :                 // the other half leap frog step in the position
-      37             :                 pos += dir * step / 2.;
-      38         103 :                 return Y(pos, dir);
-      39             :         }
-      40             : 
-      41             : 
-      42             :         // with a fixed step size
-      43          10 :         PropagationBP::PropagationBP(ref_ptr<MagneticField> field, double fixedStep) :
-      44          10 :                         minStep(0) {
-      45          10 :                 setField(field);
-      46          10 :                 setTolerance(0.42);
-      47          10 :                 setMaximumStep(fixedStep);
-      48          10 :                 setMinimumStep(fixedStep);
-      49          10 :         }
-      50             : 
-      51             : 
-      52             :         // with adaptive step size
-      53           5 :         PropagationBP::PropagationBP(ref_ptr<MagneticField> field, double tolerance, double minStep, double maxStep) :
-      54           5 :                         minStep(0) {
-      55           7 :                 setField(field);
-      56           5 :                 setTolerance(tolerance);
-      57           4 :                 setMaximumStep(maxStep);
-      58           4 :                 setMinimumStep(minStep);
-      59           3 :         }
-      60             : 
-      61             : 
-      62          37 :         void PropagationBP::process(Candidate *candidate) const {
-      63             :                 // save the new previous particle state
-      64          37 :                 ParticleState &current = candidate->current;
-      65             :                 candidate->previous = current;
-      66             : 
-      67          37 :                 Y yIn(current.getPosition(), current.getDirection());
-      68             : 
-      69             :                 // calculate charge of particle
-      70          37 :                 double q = current.getCharge();
-      71          37 :                 double step = maxStep;
-      72             : 
-      73             :                 // rectilinear propagation for neutral particles
-      74          37 :                 if (q == 0) {
-      75           2 :                         step = clip(candidate->getNextStep(), minStep, maxStep);
-      76           1 :                         current.setPosition(yIn.x + yIn.u * step);
-      77           1 :                         candidate->setCurrentStep(step);
-      78           1 :                         candidate->setNextStep(maxStep);
-      79             :                         return;
-      80             :                 }
-      81             : 
-      82             :                 Y yOut, yErr;
-      83          36 :                 double newStep = step;
-      84          36 :                 double z = candidate->getRedshift();
-      85          36 :                 double m = current.getEnergy()/(c_light * c_light);
-      86             : 
-      87             :                 // if minStep is the same as maxStep the adaptive algorithm with its error
-      88             :                 // estimation is not needed and the computation time can be saved:
-      89          36 :                 if (minStep == maxStep){
-      90          19 :                         yOut = dY(yIn.x, yIn.u, step, z, q, m);
-      91             :                 } else {
-      92          17 :                         step = clip(candidate->getNextStep(), minStep, maxStep);
-      93          17 :                         newStep = step;
-      94             :                         double r = 42;  // arbitrary value
-      95             : 
-      96             :                         // try performing step until the target error (tolerance) or the minimum/maximum step size has been reached
-      97             :                         while (true) {
-      98          28 :                                 tryStep(yIn, yOut, yErr, step, current, z, q, m);
-      99          28 :                                 r = yErr.u.getR() / tolerance;  // ratio of absolute direction error and tolerance
-     100          28 :                                 if (r > 1) {  // large direction error relative to tolerance, try to decrease step size
-     101          18 :                                         if (step == minStep)  // already minimum step size
-     102             :                                                 break;
-     103             :                                         else {
-     104          11 :                                                 newStep = step * 0.95 * pow(r, -0.2);
-     105          19 :                                                 newStep = std::max(newStep, 0.1 * step); // limit step size decrease
-     106          11 :                                                 newStep = std::max(newStep, minStep); // limit step size to minStep
-     107             :                                                 step = newStep;
-     108             :                                         }
-     109             :                                 } else {  // small direction error relative to tolerance, try to increase step size
-     110          10 :                                         if (step != maxStep) {  // only update once if maximum step size yet not reached
-     111          10 :                                                 newStep = step * 0.95 * pow(r, -0.2);
-     112          17 :                                                 newStep = std::min(newStep, 5 * step); // limit step size increase
-     113          10 :                                                 newStep = std::min(newStep, maxStep); // limit step size to maxStep
-     114             :                                         }
-     115             :                                         break;
-     116             :                                 }
-     117             :                         }
-     118             :                 }
-     119             : 
-     120          36 :                 current.setPosition(yOut.x);
-     121          36 :                 current.setDirection(yOut.u.getUnitVector());
-     122          36 :                 candidate->setCurrentStep(step);
-     123          36 :                 candidate->setNextStep(newStep);
-     124             :         }
-     125             : 
-     126             : 
-     127          16 :         void PropagationBP::setField(ref_ptr<MagneticField> f) {
-     128          16 :                 field = f;
-     129          16 :         }
-     130             : 
-     131             : 
-     132           2 :         ref_ptr<MagneticField> PropagationBP::getField() const {
-     133           2 :                 return field;
-     134             :         }
-     135             : 
-     136             : 
-     137         104 :         Vector3d PropagationBP::getFieldAtPosition(Vector3d pos, double z) const {
-     138             :                 Vector3d B(0, 0, 0);
-     139             :                 try {
-     140             :                         // check if field is valid and use the field vector at the
-     141             :                         // position pos with the redshift z
-     142         104 :                         if (field.valid())
-     143         104 :                                 B = field->getField(pos, z);
-     144           0 :                 } catch (std::exception &e) {
-     145           0 :                         KISS_LOG_ERROR  << "PropagationBP: Exception in PropagationBP::getFieldAtPosition.\n"
-     146           0 :                                         << e.what();
-     147           0 :                 }       
-     148         104 :                 return B;
-     149             :         }
-     150             : 
-     151             : 
-     152          28 :         double PropagationBP::errorEstimation(const Vector3d x1, const Vector3d x2, double step) const {
-     153             :                 // compare the position after one step with the position after two steps with step/2.
-     154             :                 Vector3d diff = (x1 - x2);
-     155             : 
-     156          28 :                 double S = diff.getR() / (step * (1 - 1/4.) );  // 1/4 = (1/2)²  number of steps for x1 divided by number of steps for x2 to the power of p (order)
-     157             : 
-     158          28 :                 return S;
-     159             :         }
-     160             : 
-     161             : 
-     162          22 :         void PropagationBP::setTolerance(double tol) {
-     163          22 :                 if ((tol > 1) or (tol < 0))
-     164           2 :                         throw std::runtime_error(
-     165           4 :                                         "PropagationBP: target error not in range 0-1");
-     166          20 :                 tolerance = tol;
-     167          20 :         }
-     168             : 
-     169             : 
-     170          24 :         void PropagationBP::setMinimumStep(double min) {
-     171          24 :                 if (min < 0)
-     172           1 :                         throw std::runtime_error("PropagationBP: minStep < 0 ");
-     173          23 :                 if (min > maxStep)
-     174           2 :                         throw std::runtime_error("PropagationBP: minStep > maxStep");
-     175          21 :                 minStep = min;
-     176          21 :         }
-     177             : 
-     178             : 
-     179          22 :         void PropagationBP::setMaximumStep(double max) {
-     180          22 :                 if (max < minStep)
-     181           1 :                         throw std::runtime_error("PropagationBP: maxStep < minStep");
-     182          21 :                 maxStep = max;
-     183          21 :         }
-     184             : 
-     185             : 
-     186           2 :         double PropagationBP::getTolerance() const {
-     187           2 :                 return tolerance;
-     188             :         }
-     189             : 
-     190             : 
-     191           2 :         double PropagationBP::getMinimumStep() const {
-     192           2 :                 return minStep;
-     193             :         }
-     194             : 
-     195             : 
-     196           5 :         double PropagationBP::getMaximumStep() const {
-     197           5 :                 return maxStep;
-     198             :         }
-     199             : 
-     200             : 
-     201           0 :         std::string PropagationBP::getDescription() const {
-     202           0 :                 std::stringstream s;
-     203           0 :                 s << "Propagation in magnetic fields using the adaptive Boris push method.";
-     204           0 :                 s << " Target error: " << tolerance;
-     205           0 :                 s << ", Minimum Step: " << minStep / kpc << " kpc";
-     206           0 :                 s << ", Maximum Step: " << maxStep / kpc << " kpc";
-     207           0 :                 return s.str();
-     208           0 :         }
-     209             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/PropagationCK.cpp.func-sort-c.html b/doc/coverageReport/src/module/PropagationCK.cpp.func-sort-c.html deleted file mode 100644 index 01527a79b..000000000 --- a/doc/coverageReport/src/module/PropagationCK.cpp.func-sort-c.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/PropagationCK.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - PropagationCK.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:859787.6 %
Date:2024-04-08 14:58:22Functions:131492.9 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa13PropagationCK14getDescriptionB5cxx11Ev0
_ZNK7crpropa13PropagationCK12getToleranceEv2
_ZNK7crpropa13PropagationCK14getMinimumStepEv2
_ZNK7crpropa13PropagationCK8getFieldEv2
_ZNK7crpropa13PropagationCK14getMaximumStepEv3
_ZN7crpropa13PropagationCKC2ENS_7ref_ptrINS_13MagneticFieldEEEddd13
_ZN7crpropa13PropagationCK8setFieldENS_7ref_ptrINS_13MagneticFieldEEE14
_ZN7crpropa13PropagationCK12setToleranceEd18
_ZN7crpropa13PropagationCK14setMaximumStepEd19
_ZN7crpropa13PropagationCK14setMinimumStepEd22
_ZNK7crpropa13PropagationCK7processEPNS_9CandidateE34
_ZNK7crpropa13PropagationCK7tryStepERKNS0_1YERS1_S4_dRNS_13ParticleStateEd42
_ZNK7crpropa13PropagationCK4dYdtERKNS0_1YERNS_13ParticleStateEd252
_ZNK7crpropa13PropagationCK18getFieldAtPositionENS_7Vector3IdEEd253
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/PropagationCK.cpp.func.html b/doc/coverageReport/src/module/PropagationCK.cpp.func.html deleted file mode 100644 index 6461ce48c..000000000 --- a/doc/coverageReport/src/module/PropagationCK.cpp.func.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/PropagationCK.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - PropagationCK.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:859787.6 %
Date:2024-04-08 14:58:22Functions:131492.9 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa13PropagationCK12setToleranceEd18
_ZN7crpropa13PropagationCK14setMaximumStepEd19
_ZN7crpropa13PropagationCK14setMinimumStepEd22
_ZN7crpropa13PropagationCK8setFieldENS_7ref_ptrINS_13MagneticFieldEEE14
_ZN7crpropa13PropagationCKC2ENS_7ref_ptrINS_13MagneticFieldEEEddd13
_ZNK7crpropa13PropagationCK12getToleranceEv2
_ZNK7crpropa13PropagationCK14getDescriptionB5cxx11Ev0
_ZNK7crpropa13PropagationCK14getMaximumStepEv3
_ZNK7crpropa13PropagationCK14getMinimumStepEv2
_ZNK7crpropa13PropagationCK18getFieldAtPositionENS_7Vector3IdEEd253
_ZNK7crpropa13PropagationCK4dYdtERKNS0_1YERNS_13ParticleStateEd252
_ZNK7crpropa13PropagationCK7processEPNS_9CandidateE34
_ZNK7crpropa13PropagationCK7tryStepERKNS0_1YERS1_S4_dRNS_13ParticleStateEd42
_ZNK7crpropa13PropagationCK8getFieldEv2
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/PropagationCK.cpp.gcov.html b/doc/coverageReport/src/module/PropagationCK.cpp.gcov.html deleted file mode 100644 index 037e88d09..000000000 --- a/doc/coverageReport/src/module/PropagationCK.cpp.gcov.html +++ /dev/null @@ -1,278 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/PropagationCK.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - PropagationCK.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:859787.6 %
Date:2024-04-08 14:58:22Functions:131492.9 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/PropagationCK.h"
-       2             : 
-       3             : #include <limits>
-       4             : #include <sstream>
-       5             : #include <stdexcept>
-       6             : #include <vector>
-       7             : 
-       8             : namespace crpropa {
-       9             : 
-      10             : // Cash-Karp coefficients
-      11             : const double cash_karp_a[] = {
-      12             :         0., 0., 0., 0., 0., 0.,
-      13             :         1. / 5., 0., 0., 0., 0., 0.,
-      14             :         3. / 40., 9. / 40., 0., 0., 0., 0.,
-      15             :         3. / 10., -9. / 10., 6. / 5., 0., 0., 0.,
-      16             :         -11. / 54., 5. / 2., -70. / 27., 35. / 27., 0., 0.,
-      17             :         1631. / 55296., 175. / 512., 575. / 13824., 44275. / 110592., 253. / 4096., 0.
-      18             : };
-      19             : 
-      20             : const double cash_karp_b[] = {
-      21             :         37. / 378., 0, 250. / 621., 125. / 594., 0., 512. / 1771.
-      22             : };
-      23             : 
-      24             : const double cash_karp_bs[] = {
-      25             :         2825. / 27648., 0., 18575. / 48384., 13525. / 55296., 277. / 14336., 1. / 4.
-      26             : };
-      27             : 
-      28          42 : void PropagationCK::tryStep(const Y &y, Y &out, Y &error, double h,
-      29             :                 ParticleState &particle, double z) const {
-      30             :         std::vector<Y> k;
-      31          42 :         k.reserve(6);
-      32             : 
-      33             :         out = y;
-      34             :         error = Y(0);
-      35             : 
-      36             :         // calculate the sum of b_i * k_i
-      37         294 :         for (size_t i = 0; i < 6; i++) {
-      38             : 
-      39             :                 Y y_n = y;
-      40         882 :                 for (size_t j = 0; j < i; j++)
-      41         630 :                         y_n += k[j] * a[i * 6 + j] * h;
-      42             : 
-      43             :                 // update k_i
-      44         252 :                 k[i] = dYdt(y_n, particle, z);
-      45             : 
-      46         252 :                 out += k[i] * b[i] * h;
-      47         252 :                 error += k[i] * (b[i] - bs[i]) * h;
-      48             :         }
-      49          42 : }
-      50             : 
-      51         252 : PropagationCK::Y PropagationCK::dYdt(const Y &y, ParticleState &p, double z) const {
-      52             :         // normalize direction vector to prevent numerical losses
-      53         252 :         Vector3d velocity = y.u.getUnitVector() * c_light;
-      54             :         
-      55             :         // get B field at particle position
-      56         252 :         Vector3d B = getFieldAtPosition(y.x, z);
-      57             : 
-      58             :         // Lorentz force: du/dt = q*c/E * (v x B)
-      59         252 :         Vector3d dudt = p.getCharge() * c_light / p.getEnergy() * velocity.cross(B);
-      60         252 :         return Y(velocity, dudt);
-      61             : }
-      62             : 
-      63          13 : PropagationCK::PropagationCK(ref_ptr<MagneticField> field, double tolerance,
-      64          13 :                 double minStep, double maxStep) :
-      65          13 :                 minStep(0) {
-      66          15 :         setField(field);
-      67          13 :         setTolerance(tolerance);
-      68          12 :         setMaximumStep(maxStep);
-      69          12 :         setMinimumStep(minStep);
-      70             : 
-      71             :         // load Cash-Karp coefficients
-      72             :         a.assign(cash_karp_a, cash_karp_a + 36);
-      73             :         b.assign(cash_karp_b, cash_karp_b + 6);
-      74             :         bs.assign(cash_karp_bs, cash_karp_bs + 6);
-      75          11 : }
-      76             : 
-      77          34 : void PropagationCK::process(Candidate *candidate) const {
-      78             :         // save the new previous particle state
-      79          34 :         ParticleState &current = candidate->current;
-      80             :         candidate->previous = current;
-      81             : 
-      82          34 :         Y yIn(current.getPosition(), current.getDirection());
-      83          34 :         double step = maxStep;
-      84             : 
-      85             :         // rectilinear propagation for neutral particles
-      86          34 :         if (current.getCharge() == 0) {
-      87           2 :                 step = clip(candidate->getNextStep(), minStep, maxStep);
-      88           1 :                 current.setPosition(yIn.x + yIn.u * step);
-      89           1 :                 candidate->setCurrentStep(step);
-      90           1 :                 candidate->setNextStep(maxStep);
-      91             :                 return;
-      92             :         }
-      93             : 
-      94             :         Y yOut, yErr;
-      95          33 :         double newStep = step;
-      96          33 :         double z = candidate->getRedshift();
-      97             : 
-      98             : 
-      99             :         // if minStep is the same as maxStep the adaptive algorithm with its error
-     100             :         // estimation is not needed and the computation time can be saved:
-     101          33 :         if (minStep == maxStep){
-     102          10 :                 tryStep(yIn, yOut, yErr, step / c_light, current, z);
-     103             :         } else {
-     104          23 :                 step = clip(candidate->getNextStep(), minStep, maxStep);
-     105          23 :                 newStep = step;
-     106             :                 double r = 42;  // arbitrary value
-     107             : 
-     108             :                 // try performing step until the target error (tolerance) or the minimum/maximum step size has been reached
-     109             :                 while (true) {
-     110          32 :                         tryStep(yIn, yOut, yErr, step / c_light, current, z);
-     111          32 :                         r = yErr.u.getR() / tolerance;  // ratio of absolute direction error and tolerance
-     112          32 :                         if (r > 1) {  // large direction error relative to tolerance, try to decrease step size
-     113          10 :                                 if (step == minStep)  // already minimum step size
-     114             :                                         break;
-     115             :                                 else {
-     116           9 :                                         newStep = step * 0.95 * pow(r, -0.2);
-     117          17 :                                         newStep = std::max(newStep, 0.1 * step); // limit step size decrease
-     118           9 :                                         newStep = std::max(newStep, minStep); // limit step size to minStep
-     119             :                                         step = newStep;
-     120             :                                 }
-     121             :                         } else {  // small direction error relative to tolerance, try to increase step size
-     122          22 :                                 if (step != maxStep) {  // only update once if maximum step size yet not reached
-     123          22 :                                         newStep = step * 0.95 * pow(r, -0.2);
-     124          35 :                                         newStep = std::min(newStep, 5 * step); // limit step size increase
-     125          22 :                                         newStep = std::min(newStep, maxStep); // limit step size to maxStep
-     126             :                                 }
-     127             :                                 break;
-     128             :                         }
-     129             :                 }
-     130             :         }
-     131             : 
-     132          33 :         current.setPosition(yOut.x);
-     133          33 :         current.setDirection(yOut.u.getUnitVector());
-     134          33 :         candidate->setCurrentStep(step);
-     135          33 :         candidate->setNextStep(newStep);
-     136             : }
-     137             : 
-     138          14 : void PropagationCK::setField(ref_ptr<MagneticField> f) {
-     139          14 :         field = f;
-     140          14 : }
-     141             : 
-     142           2 : ref_ptr<MagneticField> PropagationCK::getField() const {
-     143           2 :         return field;
-     144             : }
-     145             : 
-     146         253 : Vector3d PropagationCK::getFieldAtPosition(Vector3d pos, double z) const {
-     147             :         Vector3d B(0, 0, 0);
-     148             :         try {
-     149             :                 // check if field is valid and use the field vector at the
-     150             :                 // position pos with the redshift z
-     151         253 :                 if (field.valid())
-     152         253 :                         B = field->getField(pos, z);
-     153           0 :         } catch (std::exception &e) {
-     154           0 :                 KISS_LOG_ERROR  << "PropagationCK: Exception in PropagationCK::getFieldAtPosition.\n"
-     155           0 :                                 << e.what();
-     156           0 :         }       
-     157         253 :         return B;
-     158             : }
-     159             : 
-     160          18 : void PropagationCK::setTolerance(double tol) {
-     161          18 :         if ((tol > 1) or (tol < 0))
-     162           2 :                 throw std::runtime_error(
-     163           4 :                                 "PropagationCK: target error not in range 0-1");
-     164          16 :         tolerance = tol;
-     165          16 : }
-     166             : 
-     167          22 : void PropagationCK::setMinimumStep(double min) {
-     168          22 :         if (min < 0)
-     169           1 :                 throw std::runtime_error("PropagationCK: minStep < 0 ");
-     170          21 :         if (min > maxStep)
-     171           2 :                 throw std::runtime_error("PropagationCK: minStep > maxStep");
-     172          19 :         minStep = min;
-     173          19 : }
-     174             : 
-     175          19 : void PropagationCK::setMaximumStep(double max) {
-     176          19 :         if (max < minStep)
-     177           1 :                 throw std::runtime_error("PropagationCK: maxStep < minStep");
-     178          18 :         maxStep = max;
-     179          18 : }
-     180             : 
-     181           2 : double PropagationCK::getTolerance() const {
-     182           2 :         return tolerance;
-     183             : }
-     184             : 
-     185           2 : double PropagationCK::getMinimumStep() const {
-     186           2 :         return minStep;
-     187             : }
-     188             : 
-     189           3 : double PropagationCK::getMaximumStep() const {
-     190           3 :         return maxStep;
-     191             : }
-     192             : 
-     193           0 : std::string PropagationCK::getDescription() const {
-     194           0 :         std::stringstream s;
-     195           0 :         s << "Propagation in magnetic fields using the Cash-Karp method.";
-     196           0 :         s << " Target error: " << tolerance;
-     197           0 :         s << ", Minimum Step: " << minStep / kpc << " kpc";
-     198           0 :         s << ", Maximum Step: " << maxStep / kpc << " kpc";
-     199           0 :         return s.str();
-     200           0 : }
-     201             : 
-     202             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/Redshift.cpp.func-sort-c.html b/doc/coverageReport/src/module/Redshift.cpp.func-sort-c.html deleted file mode 100644 index 8258b1e94..000000000 --- a/doc/coverageReport/src/module/Redshift.cpp.func-sort-c.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/Redshift.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - Redshift.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:92832.1 %
Date:2024-04-08 14:58:22Functions:1425.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa14FutureRedshift14getDescriptionB5cxx11Ev0
_ZNK7crpropa14FutureRedshift7processEPNS_9CandidateE0
_ZNK7crpropa8Redshift14getDescriptionB5cxx11Ev0
_ZNK7crpropa8Redshift7processEPNS_9CandidateE7644
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/Redshift.cpp.func.html b/doc/coverageReport/src/module/Redshift.cpp.func.html deleted file mode 100644 index 39944b158..000000000 --- a/doc/coverageReport/src/module/Redshift.cpp.func.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/Redshift.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - Redshift.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:92832.1 %
Date:2024-04-08 14:58:22Functions:1425.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa14FutureRedshift14getDescriptionB5cxx11Ev0
_ZNK7crpropa14FutureRedshift7processEPNS_9CandidateE0
_ZNK7crpropa8Redshift14getDescriptionB5cxx11Ev0
_ZNK7crpropa8Redshift7processEPNS_9CandidateE7644
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/Redshift.cpp.gcov.html b/doc/coverageReport/src/module/Redshift.cpp.gcov.html deleted file mode 100644 index f41db2d01..000000000 --- a/doc/coverageReport/src/module/Redshift.cpp.gcov.html +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/Redshift.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - Redshift.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:92832.1 %
Date:2024-04-08 14:58:22Functions:1425.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/Redshift.h"
-       2             : #include "crpropa/Units.h"
-       3             : #include "crpropa/Cosmology.h"
-       4             : 
-       5             : #include <limits>
-       6             : 
-       7             : namespace crpropa {
-       8             : 
-       9        7644 : void Redshift::process(Candidate *c) const {
-      10        7644 :         double z = c->getRedshift();
-      11             : 
-      12             :         // check if z = 0
-      13        7644 :         if (z <= std::numeric_limits<double>::min())
-      14          21 :                 return;
-      15             : 
-      16             :         // use small step approximation:  dz = H(z) / c * ds
-      17        7623 :         double dz = hubbleRate(z) / c_light * c->getCurrentStep();
-      18             : 
-      19             :         // prevent dz > z
-      20        7623 :         dz = std::min(dz, z);
-      21             : 
-      22             :         // update redshift
-      23        7623 :         c->setRedshift(z - dz);
-      24             : 
-      25             :         // adiabatic energy loss: dE / dz = E / (1 + z)
-      26        7623 :         double E = c->current.getEnergy();
-      27        7623 :         c->current.setEnergy(E * (1 - dz / (1 + z)));
-      28             : }
-      29             : 
-      30           0 : std::string Redshift::getDescription() const {
-      31           0 :         std::stringstream s;
-      32           0 :         s << "Redshift: h0 = " << hubbleRate() / 1e5 * Mpc << ", omegaL = "
-      33           0 :                         << omegaL() << ", omegaM = " << omegaM();
-      34           0 :         return s.str();
-      35           0 : }
-      36             : 
-      37           0 : void FutureRedshift::process(Candidate *c) const {
-      38           0 :         double z = c->getRedshift();
-      39             : 
-      40             :         // check if z = -1
-      41           0 :         if (z <= -1)
-      42             :                 return;
-      43             : 
-      44             :         // use small step approximation:  dz = H(z) / c * ds
-      45           0 :         double dz = hubbleRate(z) / c_light * c->getCurrentStep();
-      46             : 
-      47             :         // update redshift
-      48           0 :         c->setRedshift(z - dz);
-      49             : 
-      50             :         // adiabatic energy loss: dE / dz = E / (1 + z)
-      51           0 :         double E = c->current.getEnergy();
-      52           0 :         c->current.setEnergy(E * (1 - dz / (1 + z)));
-      53             : }
-      54             : 
-      55           0 : std::string FutureRedshift::getDescription() const {
-      56           0 :         std::stringstream s;
-      57           0 :         s << "FutureRedshift: h0 = " << hubbleRate() / 1e5 * Mpc << ", omegaL = "
-      58           0 :                         << omegaL() << ", omegaM = " << omegaM();
-      59           0 :         return s.str();
-      60           0 : }
-      61             : 
-      62             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/RestrictToRegion.cpp.func-sort-c.html b/doc/coverageReport/src/module/RestrictToRegion.cpp.func-sort-c.html deleted file mode 100644 index 89ada30d6..000000000 --- a/doc/coverageReport/src/module/RestrictToRegion.cpp.func-sort-c.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/RestrictToRegion.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - RestrictToRegion.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:61250.0 %
Date:2024-04-08 14:58:22Functions:2366.7 %
-
- -
- - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZNK7crpropa16RestrictToRegion14getDescriptionB5cxx11Ev0
_ZN7crpropa16RestrictToRegionC2EPNS_6ModuleEPNS_7SurfaceE1
_ZNK7crpropa16RestrictToRegion7processEPNS_9CandidateE2
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/RestrictToRegion.cpp.func.html b/doc/coverageReport/src/module/RestrictToRegion.cpp.func.html deleted file mode 100644 index 6024c3ad3..000000000 --- a/doc/coverageReport/src/module/RestrictToRegion.cpp.func.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/RestrictToRegion.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - RestrictToRegion.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:61250.0 %
Date:2024-04-08 14:58:22Functions:2366.7 %
-
- -
- - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16RestrictToRegionC2EPNS_6ModuleEPNS_7SurfaceE1
_ZNK7crpropa16RestrictToRegion14getDescriptionB5cxx11Ev0
_ZNK7crpropa16RestrictToRegion7processEPNS_9CandidateE2
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/RestrictToRegion.cpp.gcov.html b/doc/coverageReport/src/module/RestrictToRegion.cpp.gcov.html deleted file mode 100644 index 38282b565..000000000 --- a/doc/coverageReport/src/module/RestrictToRegion.cpp.gcov.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/RestrictToRegion.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - RestrictToRegion.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:61250.0 %
Date:2024-04-08 14:58:22Functions:2366.7 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/RestrictToRegion.h" 
-       2             : 
-       3             : #include <sstream>
-       4             : 
-       5             : namespace crpropa {
-       6             : 
-       7           1 : RestrictToRegion::RestrictToRegion(Module* _module, Surface* _surface) : module(_module), surface(_surface) { 
-       8           1 : };
-       9             : 
-      10           2 : void RestrictToRegion::process(Candidate *candidate) const {
-      11           2 :         if (surface->distance(candidate->current.getPosition()) <= 0) {
-      12           1 :                 module->process(candidate);
-      13             :         }
-      14           2 : };
-      15             : 
-      16           0 : std::string RestrictToRegion::getDescription() const {
-      17           0 :         std::stringstream s;
-      18             :         s << "RestrictToArea:\n"
-      19           0 :                 << "  Module: " << module->getDescription() << std::endl
-      20           0 :                 << "  Region: " << surface->getDescription() << std::endl;
-      21           0 :         return s.str();
-      22           0 : };
-      23             : 
-      24             : 
-      25             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/SimplePropagation.cpp.func-sort-c.html b/doc/coverageReport/src/module/SimplePropagation.cpp.func-sort-c.html deleted file mode 100644 index 1d24c0fb2..000000000 --- a/doc/coverageReport/src/module/SimplePropagation.cpp.func-sort-c.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/SimplePropagation.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - SimplePropagation.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:123336.4 %
Date:2024-04-08 14:58:22Functions:2728.6 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa17SimplePropagation14setMaximumStepEd0
_ZN7crpropa17SimplePropagation14setMinimumStepEd0
_ZNK7crpropa17SimplePropagation14getDescriptionB5cxx11Ev0
_ZNK7crpropa17SimplePropagation14getMaximumStepEv0
_ZNK7crpropa17SimplePropagation14getMinimumStepEv0
_ZN7crpropa17SimplePropagationC2Edd12
_ZNK7crpropa17SimplePropagation7processEPNS_9CandidateE19294
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/SimplePropagation.cpp.func.html b/doc/coverageReport/src/module/SimplePropagation.cpp.func.html deleted file mode 100644 index 2f86027c0..000000000 --- a/doc/coverageReport/src/module/SimplePropagation.cpp.func.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/SimplePropagation.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - SimplePropagation.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:123336.4 %
Date:2024-04-08 14:58:22Functions:2728.6 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa17SimplePropagation14setMaximumStepEd0
_ZN7crpropa17SimplePropagation14setMinimumStepEd0
_ZN7crpropa17SimplePropagationC2Edd12
_ZNK7crpropa17SimplePropagation14getDescriptionB5cxx11Ev0
_ZNK7crpropa17SimplePropagation14getMaximumStepEv0
_ZNK7crpropa17SimplePropagation14getMinimumStepEv0
_ZNK7crpropa17SimplePropagation7processEPNS_9CandidateE19294
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/SimplePropagation.cpp.gcov.html b/doc/coverageReport/src/module/SimplePropagation.cpp.gcov.html deleted file mode 100644 index c01c7f1d1..000000000 --- a/doc/coverageReport/src/module/SimplePropagation.cpp.gcov.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/SimplePropagation.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - SimplePropagation.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:123336.4 %
Date:2024-04-08 14:58:22Functions:2728.6 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/SimplePropagation.h"
-       2             : 
-       3             : #include <sstream>
-       4             : #include <stdexcept>
-       5             : 
-       6             : namespace crpropa {
-       7             : 
-       8          12 : SimplePropagation::SimplePropagation(double minStep, double maxStep) :
-       9          12 :                 minStep(minStep), maxStep(maxStep) {
-      10          12 :         if (minStep > maxStep)
-      11           0 :                 throw std::runtime_error("SimplePropagation: minStep > maxStep");
-      12          12 : }
-      13             : 
-      14       19294 : void SimplePropagation::process(Candidate *c) const {
-      15             :         c->previous = c->current;
-      16             : 
-      17       19294 :         double step = clip(c->getNextStep(), minStep, maxStep);
-      18       19294 :         c->setCurrentStep(step);
-      19       19294 :         Vector3d pos = c->current.getPosition();
-      20       19294 :         Vector3d dir = c->current.getDirection();
-      21       19294 :         c->current.setPosition(pos + dir * step);
-      22       19294 :         c->setNextStep(maxStep);
-      23       19294 : }
-      24             : 
-      25           0 : void SimplePropagation::setMinimumStep(double step) {
-      26           0 :         if (step > maxStep)
-      27           0 :                 throw std::runtime_error("SimplePropagation: minStep > maxStep");
-      28           0 :         minStep = step;
-      29           0 : }
-      30             : 
-      31           0 : void SimplePropagation::setMaximumStep(double step) {
-      32           0 :         if (minStep > step)
-      33           0 :                 throw std::runtime_error("SimplePropagation: minStep > maxStep");
-      34           0 :         maxStep = step;
-      35           0 : }
-      36             : 
-      37           0 : double SimplePropagation::getMinimumStep() const {
-      38           0 :         return minStep;
-      39             : }
-      40             : 
-      41           0 : double SimplePropagation::getMaximumStep() const {
-      42           0 :         return maxStep;
-      43             : }
-      44             : 
-      45           0 : std::string SimplePropagation::getDescription() const {
-      46           0 :         std::stringstream s;
-      47           0 :         s << "SimplePropagation: Step size = " << minStep / kpc
-      48           0 :                         << " - " << maxStep / kpc << " kpc";
-      49           0 :         return s.str();
-      50           0 : }
-      51             : 
-      52             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/SynchrotronRadiation.cpp.func-sort-c.html b/doc/coverageReport/src/module/SynchrotronRadiation.cpp.func-sort-c.html deleted file mode 100644 index d0dcbba06..000000000 --- a/doc/coverageReport/src/module/SynchrotronRadiation.cpp.func-sort-c.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/SynchrotronRadiation.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - SynchrotronRadiation.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8113161.8 %
Date:2024-04-08 14:58:22Functions:102147.6 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa20SynchrotronRadiation11getThinningEv0
_ZN7crpropa20SynchrotronRadiation11setThinningEd0
_ZN7crpropa20SynchrotronRadiation14getHavePhotonsEv0
_ZN7crpropa20SynchrotronRadiation17getMaximumSamplesEv0
_ZN7crpropa20SynchrotronRadiation7getBrmsEv0
_ZN7crpropa20SynchrotronRadiation8getFieldEv0
_ZN7crpropa20SynchrotronRadiation8getLimitEv0
_ZN7crpropa20SynchrotronRadiation8setFieldENS_7ref_ptrINS_13MagneticFieldEEE0
_ZN7crpropa20SynchrotronRadiationC2ENS_7ref_ptrINS_13MagneticFieldEEEbdid0
_ZNK7crpropa20SynchrotronRadiation14getDescriptionB5cxx11Ev0
_ZNK7crpropa20SynchrotronRadiation21getSecondaryThresholdEv0
_ZN7crpropa20SynchrotronRadiation12initSpectrumEv1
_ZN7crpropa20SynchrotronRadiation14setHavePhotonsEb1
_ZN7crpropa20SynchrotronRadiation17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa20SynchrotronRadiation17setMaximumSamplesEi1
_ZN7crpropa20SynchrotronRadiation21setSecondaryThresholdEd1
_ZN7crpropa20SynchrotronRadiation7setBrmsEd1
_ZN7crpropa20SynchrotronRadiation8setLimitEd1
_ZN7crpropa20SynchrotronRadiationC2Edbdid1
_ZNK7crpropa20SynchrotronRadiation7processEPNS_9CandidateE1
_ZNK7crpropa20SynchrotronRadiation17getInteractionTagB5cxx11Ev2
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/SynchrotronRadiation.cpp.func.html b/doc/coverageReport/src/module/SynchrotronRadiation.cpp.func.html deleted file mode 100644 index bc212b37e..000000000 --- a/doc/coverageReport/src/module/SynchrotronRadiation.cpp.func.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/SynchrotronRadiation.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - SynchrotronRadiation.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8113161.8 %
Date:2024-04-08 14:58:22Functions:102147.6 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa20SynchrotronRadiation11getThinningEv0
_ZN7crpropa20SynchrotronRadiation11setThinningEd0
_ZN7crpropa20SynchrotronRadiation12initSpectrumEv1
_ZN7crpropa20SynchrotronRadiation14getHavePhotonsEv0
_ZN7crpropa20SynchrotronRadiation14setHavePhotonsEb1
_ZN7crpropa20SynchrotronRadiation17getMaximumSamplesEv0
_ZN7crpropa20SynchrotronRadiation17setInteractionTagENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE1
_ZN7crpropa20SynchrotronRadiation17setMaximumSamplesEi1
_ZN7crpropa20SynchrotronRadiation21setSecondaryThresholdEd1
_ZN7crpropa20SynchrotronRadiation7getBrmsEv0
_ZN7crpropa20SynchrotronRadiation7setBrmsEd1
_ZN7crpropa20SynchrotronRadiation8getFieldEv0
_ZN7crpropa20SynchrotronRadiation8getLimitEv0
_ZN7crpropa20SynchrotronRadiation8setFieldENS_7ref_ptrINS_13MagneticFieldEEE0
_ZN7crpropa20SynchrotronRadiation8setLimitEd1
_ZN7crpropa20SynchrotronRadiationC2ENS_7ref_ptrINS_13MagneticFieldEEEbdid0
_ZN7crpropa20SynchrotronRadiationC2Edbdid1
_ZNK7crpropa20SynchrotronRadiation14getDescriptionB5cxx11Ev0
_ZNK7crpropa20SynchrotronRadiation17getInteractionTagB5cxx11Ev2
_ZNK7crpropa20SynchrotronRadiation21getSecondaryThresholdEv0
_ZNK7crpropa20SynchrotronRadiation7processEPNS_9CandidateE1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/SynchrotronRadiation.cpp.gcov.html b/doc/coverageReport/src/module/SynchrotronRadiation.cpp.gcov.html deleted file mode 100644 index 3ea130039..000000000 --- a/doc/coverageReport/src/module/SynchrotronRadiation.cpp.gcov.html +++ /dev/null @@ -1,306 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/SynchrotronRadiation.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - SynchrotronRadiation.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8113161.8 %
Date:2024-04-08 14:58:22Functions:102147.6 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/SynchrotronRadiation.h"
-       2             : #include "crpropa/Units.h"
-       3             : #include "crpropa/Random.h"
-       4             : 
-       5             : #include <fstream>
-       6             : #include <limits>
-       7             : #include <stdexcept>
-       8             : 
-       9             : namespace crpropa {
-      10             : 
-      11           0 : SynchrotronRadiation::SynchrotronRadiation(ref_ptr<MagneticField> field, bool havePhotons, double thinning, int nSamples, double limit) {
-      12           0 :         setField(field);
-      13           0 :         setBrms(0);
-      14           0 :         initSpectrum();
-      15           0 :         setHavePhotons(havePhotons);
-      16           0 :         setLimit(limit);
-      17           0 :         setSecondaryThreshold(1e6 * eV);
-      18           0 :         setMaximumSamples(nSamples);
-      19           0 : }
-      20             : 
-      21           1 : SynchrotronRadiation::SynchrotronRadiation(double Brms, bool havePhotons, double thinning, int nSamples, double limit) {
-      22           1 :         setBrms(Brms);
-      23           1 :         initSpectrum();
-      24           1 :         setHavePhotons(havePhotons);
-      25           1 :         setLimit(limit);
-      26           1 :         setSecondaryThreshold(1e6 * eV);
-      27           1 :         setMaximumSamples(nSamples);
-      28           1 : }
-      29             : 
-      30           0 : void SynchrotronRadiation::setField(ref_ptr<MagneticField> f) {
-      31           0 :         this->field = f;
-      32           0 : }
-      33             : 
-      34           0 : ref_ptr<MagneticField> SynchrotronRadiation::getField() {
-      35           0 :         return field;
-      36             : }
-      37             : 
-      38           1 : void SynchrotronRadiation::setBrms(double Brms) {
-      39           1 :         this->Brms = Brms;
-      40           1 : }
-      41             : 
-      42           0 : double SynchrotronRadiation::getBrms() {
-      43           0 :         return Brms;
-      44             : }
-      45             : 
-      46           1 : void SynchrotronRadiation::setHavePhotons(bool havePhotons) {
-      47           1 :         this->havePhotons = havePhotons;
-      48           1 : }
-      49             : 
-      50           0 : bool SynchrotronRadiation::getHavePhotons() {
-      51           0 :         return havePhotons;
-      52             : }
-      53             : 
-      54           0 : void SynchrotronRadiation::setThinning(double thinning) {
-      55           0 :         this->thinning = thinning;
-      56           0 : }
-      57             : 
-      58           0 : double SynchrotronRadiation::getThinning() {
-      59           0 :         return thinning;
-      60             : }
-      61             : 
-      62           1 : void SynchrotronRadiation::setLimit(double limit) {
-      63           1 :         this->limit = limit;
-      64           1 : }
-      65             : 
-      66           0 : double SynchrotronRadiation::getLimit() {
-      67           0 :         return limit;
-      68             : }
-      69             : 
-      70           1 : void SynchrotronRadiation::setMaximumSamples(int nmax) {
-      71           1 :         maximumSamples = nmax;
-      72           1 : }
-      73             : 
-      74           0 : int SynchrotronRadiation::getMaximumSamples() {
-      75           0 :         return maximumSamples;
-      76             : }
-      77             : 
-      78           1 : void SynchrotronRadiation::setSecondaryThreshold(double threshold) {
-      79           1 :         secondaryThreshold = threshold;
-      80           1 : }
-      81             : 
-      82           0 : double SynchrotronRadiation::getSecondaryThreshold() const {
-      83           0 :         return secondaryThreshold;
-      84             : }
-      85             : 
-      86           1 : void SynchrotronRadiation::initSpectrum() {
-      87           2 :         std::string filename = getDataPath("Synchrotron/spectrum.txt");
-      88           1 :         std::ifstream infile(filename.c_str());
-      89             : 
-      90           1 :         if (!infile.good())
-      91           0 :                 throw std::runtime_error("SynchrotronRadiation: could not open file " + filename);
-      92             : 
-      93             :         // clear previously loaded interaction rates
-      94           1 :         tabx.clear();
-      95           1 :         tabCDF.clear();
-      96             : 
-      97        1407 :         while (infile.good()) {
-      98        1406 :                 if (infile.peek() != '#') {
-      99             :                         double a, b;
-     100             :                         infile >> a >> b;
-     101        1402 :                         if (infile) {
-     102        1401 :                                 tabx.push_back(pow(10, a));
-     103        1401 :                                 tabCDF.push_back(b);
-     104             :                         }
-     105             :                 }
-     106        1406 :                 infile.ignore(std::numeric_limits < std::streamsize > ::max(), '\n');
-     107             :         }
-     108           1 :         infile.close();
-     109           2 : }
-     110             : 
-     111           1 : void SynchrotronRadiation::process(Candidate *candidate) const {
-     112           1 :         double charge = fabs(candidate->current.getCharge());
-     113           1 :         if (charge == 0)
-     114           0 :                 return; // only charged particles
-     115             : 
-     116             :         // calculate gyroradius, evaluated at the current position
-     117           1 :         double z = candidate->getRedshift();
-     118             :         double B;
-     119           1 :         if (field.valid()) {
-     120           0 :                 Vector3d Bvec = field->getField(candidate->current.getPosition(), z);
-     121           0 :                 B = Bvec.cross(candidate->current.getDirection()).getR();
-     122             :         } else {
-     123           1 :                 B = sqrt(2. / 3) * Brms; // average perpendicular field component
-     124             :         }
-     125           1 :         B *= pow(1 + z, 2); // cosmological scaling
-     126           1 :         double Rg = candidate->current.getMomentum().getR() / charge / B;
-     127             : 
-     128             :         // calculate energy loss
-     129           1 :         double lf = candidate->current.getLorentzFactor();
-     130           1 :         double dEdx = 1. / 6 / M_PI / epsilon0 * pow(lf * lf - 1, 2) * pow(charge / Rg, 2); // Jackson p. 770 (14.31)
-     131           1 :         double step = candidate->getCurrentStep() / (1 + z); // step size in local frame
-     132           1 :         double dE = step * dEdx;
-     133             : 
-     134             :         // apply energy loss and limit next step
-     135           1 :         double E = candidate->current.getEnergy();
-     136           1 :         candidate->current.setEnergy(E - dE);
-     137           1 :         candidate->limitNextStep(limit * E / dEdx);
-     138             : 
-     139             :         // optionally add secondary photons
-     140           1 :         if (not(havePhotons))
-     141             :                 return;
-     142             : 
-     143             :         // check if photons with energies > 14 * Ecrit are possible
-     144           1 :         double Ecrit = 3. / 4 * h_planck / M_PI * c_light * pow(lf, 3) / Rg;
-     145           1 :         if (14 * Ecrit < secondaryThreshold)
-     146             :                 return;
-     147             : 
-     148             :         // draw photons up to the total energy loss
-     149             :         // if maximumSamples is reached before that, compensate the total energy afterwards
-     150           1 :         Random &random = Random::instance();
-     151             :         double dE0 = dE;
-     152             :         std::vector<double> energies;
-     153             :         int counter = 0;
-     154     3620603 :         while (dE > 0) {
-     155             :                 // draw random value between 0 and maximum of corresponding cdf
-     156             :                 // choose bin of s where cdf(x) = cdf_rand -> x_rand
-     157     3620602 :                 size_t i = random.randBin(tabCDF); // draw random bin (upper bin boundary returned)
-     158     3620602 :                 double binWidth = (tabx[i] - tabx[i-1]);
-     159     3620602 :                 double x = tabx[i-1] + random.rand() * binWidth; // draw random x uniformly distributed in bin
-     160     3620602 :                 double Ephoton = x * Ecrit;
-     161             : 
-     162             :                 // if the remaining energy is not sufficient check for random accepting
-     163     3620602 :                 if (Ephoton > dE) {
-     164           1 :                         if (random.rand() > (dE / Ephoton))
-     165             :                                 break; // not accepted
-     166             :                 }
-     167             : 
-     168             :                 // only activate the "per-step" sampling if maximumSamples is explicitly set.
-     169     3620602 :                 if (maximumSamples > 0) {
-     170           0 :                         if (counter >= maximumSamples) 
-     171             :                                 break;                  
-     172             :                 }
-     173             : 
-     174             :                 // store energies in array
-     175     3620602 :                 energies.push_back(Ephoton);
-     176             : 
-     177             :                 // energy loss
-     178     3620602 :                 dE -= Ephoton;
-     179             : 
-     180             :                 // counter for sampling break condition;
-     181     3620602 :                 counter++;
-     182             :         }
-     183             : 
-     184             :         // while loop before gave total energy which is just a fraction of the required
-     185             :         double w1 = 1;
-     186           1 :         if (maximumSamples > 0 && dE > 0)
-     187           0 :                 w1 = 1. / (1. - dE / dE0); 
-     188             : 
-     189             :         // loop over sampled photons and attribute weights accordingly
-     190     3620603 :         for (int i = 0; i < energies.size(); i++) {
-     191     3620602 :                 double Ephoton = energies[i];
-     192     3620602 :                 double f = Ephoton / (E - dE0);
-     193     3620602 :                 double w = w1 / pow(f, thinning);
-     194             : 
-     195             :                 // thinning procedure: accepts only a few random secondaries
-     196     3620602 :                 if (random.rand() < pow(f, thinning)) {
-     197     3620602 :                         Vector3d pos = random.randomInterpolatedPosition(candidate->previous.getPosition(), candidate->current.getPosition());
-     198     3620602 :                         if (Ephoton > secondaryThreshold) // create only photons with energies above threshold
-     199     3309554 :                                 candidate->addSecondary(22, Ephoton, pos, w, interactionTag);
-     200             :                 }
-     201             :         }
-     202             : }
-     203             : 
-     204           0 : std::string SynchrotronRadiation::getDescription() const {
-     205           0 :         std::stringstream s;
-     206           0 :         s << "Synchrotron radiation";
-     207           0 :         if (field.valid())
-     208           0 :                 s << " for specified magnetic field";
-     209             :         else
-     210           0 :                 s << " for Brms = " << Brms / nG << " nG";
-     211           0 :         if (havePhotons)
-     212           0 :                 s << ", synchrotron photons E > " << secondaryThreshold / eV << " eV";
-     213             :         else
-     214           0 :                 s << ", no synchrotron photons";
-     215           0 :         if (maximumSamples > 0)
-     216           0 :                 s << "maximum number of photon samples: " << maximumSamples;
-     217           0 :         if (thinning > 0)
-     218           0 :                 s << "thinning parameter: " << thinning; 
-     219           0 :         return s.str();
-     220           0 : }
-     221             : 
-     222           1 : void SynchrotronRadiation::setInteractionTag(std::string tag) {
-     223           1 :         interactionTag = tag;
-     224           1 : }
-     225             : 
-     226           2 : std::string SynchrotronRadiation::getInteractionTag() const {
-     227           2 :         return interactionTag;
-     228             : }
-     229             : 
-     230             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/TextOutput.cpp.func-sort-c.html b/doc/coverageReport/src/module/TextOutput.cpp.func-sort-c.html deleted file mode 100644 index 97378d014..000000000 --- a/doc/coverageReport/src/module/TextOutput.cpp.func-sort-c.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/TextOutput.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - TextOutput.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:21924988.0 %
Date:2024-04-08 14:58:22Functions:91464.3 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa10TextOutput4gzipEv0
_ZN7crpropa10TextOutputC2ERSo0
_ZN7crpropa10TextOutputC2ERSoNS_6Output10OutputTypeE0
_ZN7crpropa10TextOutputC2Ev0
_ZNK7crpropa10TextOutput14getDescriptionB5cxx11Ev0
_ZN7crpropa10TextOutput4loadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPNS_17ParticleCollectorE1
_ZN7crpropa10TextOutputC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_6Output10OutputTypeE1
_ZN7crpropa10TextOutputD0Ev1
_ZN7crpropa10TextOutputC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE2
_ZN7crpropa10TextOutputC2ENS_6Output10OutputTypeE7
_ZN7crpropa10TextOutputD2Ev9
_ZNK7crpropa10TextOutput11printHeaderEv9
_ZN7crpropa10TextOutput5closeEv10
_ZNK7crpropa10TextOutput7processEPNS_9CandidateE54
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/TextOutput.cpp.func.html b/doc/coverageReport/src/module/TextOutput.cpp.func.html deleted file mode 100644 index 1ca5f18f5..000000000 --- a/doc/coverageReport/src/module/TextOutput.cpp.func.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/TextOutput.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - TextOutput.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:21924988.0 %
Date:2024-04-08 14:58:22Functions:91464.3 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa10TextOutput4gzipEv0
_ZN7crpropa10TextOutput4loadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPNS_17ParticleCollectorE1
_ZN7crpropa10TextOutput5closeEv10
_ZN7crpropa10TextOutputC2ENS_6Output10OutputTypeE7
_ZN7crpropa10TextOutputC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE2
_ZN7crpropa10TextOutputC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_6Output10OutputTypeE1
_ZN7crpropa10TextOutputC2ERSo0
_ZN7crpropa10TextOutputC2ERSoNS_6Output10OutputTypeE0
_ZN7crpropa10TextOutputC2Ev0
_ZN7crpropa10TextOutputD0Ev1
_ZN7crpropa10TextOutputD2Ev9
_ZNK7crpropa10TextOutput11printHeaderEv9
_ZNK7crpropa10TextOutput14getDescriptionB5cxx11Ev0
_ZNK7crpropa10TextOutput7processEPNS_9CandidateE54
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/TextOutput.cpp.gcov.html b/doc/coverageReport/src/module/TextOutput.cpp.gcov.html deleted file mode 100644 index 7ac87a19d..000000000 --- a/doc/coverageReport/src/module/TextOutput.cpp.gcov.html +++ /dev/null @@ -1,457 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/TextOutput.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - TextOutput.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:21924988.0 %
Date:2024-04-08 14:58:22Functions:91464.3 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/TextOutput.h"
-       2             : #include "crpropa/module/ParticleCollector.h"
-       3             : #include "crpropa/Units.h"
-       4             : #include "crpropa/Version.h"
-       5             : #include "crpropa/Random.h"
-       6             : #include "crpropa/base64.h"
-       7             : 
-       8             : #include "kiss/string.h"
-       9             : 
-      10             : #include <cstdio>
-      11             : #include <stdexcept>
-      12             : #include <iostream>
-      13             : 
-      14             : #ifdef CRPROPA_HAVE_ZLIB
-      15             : #include <izstream.hpp>
-      16             : #include <ozstream.hpp>
-      17             : #endif
-      18             : 
-      19             : namespace crpropa {
-      20             : 
-      21           0 : TextOutput::TextOutput() : Output(), out(&std::cout), storeRandomSeeds(false) {
-      22           0 : }
-      23             : 
-      24           7 : TextOutput::TextOutput(OutputType outputtype) : Output(outputtype), out(&std::cout), storeRandomSeeds(false) {
-      25           7 : }
-      26             : 
-      27           0 : TextOutput::TextOutput(std::ostream &out) : Output(), out(&out), storeRandomSeeds(false) {
-      28           0 : }
-      29             : 
-      30           0 : TextOutput::TextOutput(std::ostream &out,
-      31           0 :                 OutputType outputtype) : Output(outputtype), out(&out), storeRandomSeeds(false) {
-      32           0 : }
-      33             : 
-      34           4 : TextOutput::TextOutput(const std::string &filename) :  Output(), outfile(filename.c_str(),
-      35           2 :                                 std::ios::binary), out(&outfile),  filename(
-      36           4 :                                 filename), storeRandomSeeds(false) {
-      37           2 :         if (!outfile.is_open())
-      38           2 :                 throw std::runtime_error(std::string("Cannot create file: ") + filename);
-      39           3 :         if (kiss::ends_with(filename, ".gz"))
-      40           0 :                 gzip();
-      41           3 : }
-      42             : 
-      43           1 : TextOutput::TextOutput(const std::string &filename,
-      44           2 :                                 OutputType outputtype) : Output(outputtype), outfile(filename.c_str(),
-      45           1 :                                 std::ios::binary), out(&outfile), filename(
-      46           2 :                                 filename), storeRandomSeeds(false) {
-      47           1 :         if (!outfile.is_open())
-      48           0 :                 throw std::runtime_error(std::string("Cannot create file: ") + filename);
-      49           2 :         if (kiss::ends_with(filename, ".gz"))
-      50           0 :                 gzip();
-      51           1 : }
-      52             : 
-      53           9 : void TextOutput::printHeader() const {
-      54           9 :         *out << "#";
-      55           9 :         if (fields.test(TrajectoryLengthColumn))
-      56           6 :                 *out << "\tD";
-      57           9 :         if (fields.test(RedshiftColumn))
-      58           2 :                 *out << "\tz";
-      59           9 :         if (fields.test(SerialNumberColumn))
-      60           3 :                 *out << "\tSN";
-      61           9 :         if (fields.test(CurrentIdColumn))
-      62           8 :                 *out << "\tID";
-      63           9 :         if (fields.test(CurrentEnergyColumn))
-      64           8 :                 *out << "\tE";
-      65           9 :         if (fields.test(CurrentPositionColumn) && oneDimensional)
-      66           2 :                 *out << "\tX";
-      67           9 :         if (fields.test(CurrentPositionColumn) && not oneDimensional)
-      68           3 :                 *out << "\tX\tY\tZ";
-      69           9 :         if (fields.test(CurrentDirectionColumn) && not oneDimensional)
-      70           3 :                 *out << "\tPx\tPy\tPz";
-      71           9 :         if (fields.test(SerialNumberColumn))
-      72           3 :                 *out << "\tSN0";
-      73           9 :         if (fields.test(SourceIdColumn))
-      74           6 :                 *out << "\tID0";
-      75           9 :         if (fields.test(SourceEnergyColumn))
-      76           6 :                 *out << "\tE0";
-      77           9 :         if (fields.test(SourcePositionColumn) && oneDimensional) 
-      78           1 :                 *out << "\tX0";
-      79           9 :         if (fields.test(SourcePositionColumn) && not oneDimensional)
-      80           2 :                 *out << "\tX0\tY0\tZ0";
-      81           9 :         if (fields.test(SourceDirectionColumn) && not oneDimensional)
-      82           2 :                 *out << "\tP0x\tP0y\tP0z";
-      83           9 :         if (fields.test(SerialNumberColumn))
-      84           3 :                 *out << "\tSN1";
-      85           9 :         if (fields.test(CreatedIdColumn))
-      86           2 :                 *out << "\tID1";
-      87           9 :         if (fields.test(CreatedEnergyColumn))
-      88           2 :                 *out << "\tE1";
-      89           9 :         if (fields.test(CreatedPositionColumn) && oneDimensional)
-      90           1 :                 *out << "\tX1";
-      91           9 :         if (fields.test(CreatedPositionColumn) && not oneDimensional)
-      92           1 :                 *out << "\tX1\tY1\tZ1";
-      93           9 :         if (fields.test(CreatedDirectionColumn) && not oneDimensional)
-      94           1 :                 *out << "\tP1x\tP1y\tP1z";
-      95           9 :         if (fields.test(WeightColumn))
-      96           2 :                 *out << "\tW";
-      97           9 :         if (fields.test(CandidateTagColumn))
-      98           3 :                 *out << "\ttag";
-      99           9 :         for(std::vector<Property>::const_iterator iter = properties.begin();
-     100          10 :                         iter != properties.end(); ++iter)
-     101             :         {
-     102           1 :                 *out << "\t" << (*iter).name;
-     103             :         }
-     104             : 
-     105           9 :         *out << "\n#\n";
-     106           9 :         if (fields.test(TrajectoryLengthColumn))
-     107           6 :                 *out << "# D             Trajectory length [" << lengthScale / Mpc
-     108           6 :                                 << " Mpc]\n";
-     109           9 :         if (fields.test(RedshiftColumn))
-     110           2 :                 *out << "# z             Redshift\n";
-     111           9 :         if (fields.test(SerialNumberColumn))
-     112           3 :                 *out << "# SN/SN0/SN1    Serial number. Unique (within this run) id of the particle.\n";
-     113           1 :         if (fields.test(CurrentIdColumn) || fields.test(CreatedIdColumn)
-     114          10 :                         || fields.test(SourceIdColumn))
-     115           8 :                 *out << "# ID/ID0/ID1    Particle type (PDG MC numbering scheme)\n";
-     116           1 :         if (fields.test(CurrentEnergyColumn) || fields.test(CreatedEnergyColumn)
-     117          10 :                         || fields.test(SourceEnergyColumn))
-     118           8 :                 *out << "# E/E0/E1       Energy [" << energyScale / EeV << " EeV]\n";
-     119           4 :         if (fields.test(CurrentPositionColumn) || fields.test(CreatedPositionColumn)
-     120          13 :                         || fields.test(SourcePositionColumn))
-     121           5 :                 *out << "# X/X0/X1...    Position [" << lengthScale / Mpc << " Mpc]\n";
-     122             :         if (fields.test(CurrentDirectionColumn)
-     123           5 :                         || fields.test(CreatedDirectionColumn)
-     124          14 :                         || fields.test(SourceDirectionColumn))
-     125           4 :                 *out << "# Px/P0x/P1x... Heading (unit vector of momentum)\n";
-     126           9 :         if (fields.test(WeightColumn))
-     127           2 :                 *out << "# W             Weights" << " \n";
-     128           9 :         if (fields.test(CandidateTagColumn)) {
-     129           3 :                 *out << "# tag           Candidate tag can be given by the source feature (user defined tag) or by the following interaction process \n";
-     130           3 :                 *out << "#\tES  \tElasticScattering \n" << "#\tEPP \tElectronPairProduction \n" << "#\tEMPP\tEMPairProduction\n"
-     131             :                         << "#\tEMDP\tEMDoublePairProduction\n" << "#\tEMTP\tEMTripletPairProduction \n" << "#\tEMIC\tEMInverseComptonScattering\n"
-     132             :                         << "#\tND  \tNuclearDecay\n" << "#\tPD  \tPhotoDisintegration\n" << "#\tPPP  \tPhotoPionProduction\n" << "#\tSYN \tSynchrotronRadiation\n"
-     133           3 :                         << "#\tPRIM/SEC\t primary / secondary particle\n";
-     134             :         }
-     135           9 :         for(std::vector<Property>::const_iterator iter = properties.begin();
-     136          10 :                         iter != properties.end(); ++iter)
-     137             :         {
-     138           2 :                         *out << "# " << (*iter).name << " " << (*iter).comment << "\n";
-     139             :         }
-     140             : 
-     141           9 :         *out << "# no index = current, 0 = at source, 1 = at point of creation\n#\n";
-     142          18 :         *out << "# CRPropa version: " << g_GIT_DESC << "\n#\n";
-     143             : 
-     144           9 :         if (storeRandomSeeds)
-     145             :         {
-     146           0 :                 *out << "# Random seeds:\n";
-     147           0 :                 std::vector< std::vector<uint32_t> > seeds = Random::getSeedThreads();
-     148             : 
-     149           0 :                 for (size_t i =0; i < seeds.size(); i++)
-     150             :                 {
-     151           0 :                         std::string encoded_data = Base64::encode((unsigned char*) &seeds[i][0], sizeof(seeds[i][0]) * seeds[i].size() / sizeof(unsigned char));
-     152           0 :                         *out << "#   Thread " << i << ": ";
-     153           0 :                         *out << encoded_data;
-     154           0 :                         *out << "\n";
-     155             :                 }
-     156           0 :         }
-     157           9 : }
-     158             : 
-     159          54 : void TextOutput::process(Candidate *c) const {
-     160          54 :         if (fields.none() && properties.empty())
-     161           0 :                 return;
-     162             : 
-     163             :         char buffer[1024];
-     164             :         size_t p = 0;
-     165             : 
-     166          54 :         std::locale old_locale = std::locale::global(std::locale::classic());
-     167             : 
-     168          54 :         if (fields.test(TrajectoryLengthColumn))
-     169          51 :                 p += std::sprintf(buffer + p, "%8.5E\t",
-     170          51 :                                 c->getTrajectoryLength() / lengthScale);
-     171             : 
-     172          54 :         if (fields.test(RedshiftColumn))
-     173          47 :                 p += std::sprintf(buffer + p, "%1.5E\t", c->getRedshift());
-     174             : 
-     175          54 :         if (fields.test(SerialNumberColumn))
-     176          48 :                 p += std::sprintf(buffer + p, "%10lu\t",
-     177             :                                 c->getSerialNumber());
-     178          54 :         if (fields.test(CurrentIdColumn))
-     179          53 :                 p += std::sprintf(buffer + p, "%10i\t", c->current.getId());
-     180          54 :         if (fields.test(CurrentEnergyColumn))
-     181          53 :                 p += std::sprintf(buffer + p, "%8.5E\t",
-     182          53 :                                 c->current.getEnergy() / energyScale);
-     183          54 :         if (fields.test(CurrentPositionColumn)) {
-     184          50 :                 if (oneDimensional) {
-     185          37 :                         p += std::sprintf(buffer + p, "%8.5E\t",
-     186          37 :                                         c->current.getPosition().x / lengthScale);
-     187             :                 } else {
-     188          13 :                         const Vector3d pos = c->current.getPosition() / lengthScale;
-     189          13 :                         p += std::sprintf(buffer + p, "%8.5E\t%8.5E\t%8.5E\t", pos.x, pos.y,
-     190             :                                         pos.z);
-     191             :                 }
-     192             :         }
-     193          54 :         if (fields.test(CurrentDirectionColumn)) {
-     194          49 :                 if (not oneDimensional) {
-     195          13 :                         const Vector3d pos = c->current.getDirection();
-     196          13 :                         p += std::sprintf(buffer + p, "%8.5E\t%8.5E\t%8.5E\t", pos.x, pos.y,
-     197             :                                         pos.z);
-     198             :                 }
-     199             :         }
-     200             : 
-     201          54 :         if (fields.test(SerialNumberColumn))
-     202          48 :                 p += std::sprintf(buffer + p, "%10lu\t", c->getSourceSerialNumber());
-     203          54 :         if (fields.test(SourceIdColumn))
-     204          51 :                 p += std::sprintf(buffer + p, "%10i\t", c->source.getId());
-     205          54 :         if (fields.test(SourceEnergyColumn))
-     206          51 :                 p += std::sprintf(buffer + p, "%8.5E\t",
-     207          51 :                                 c->source.getEnergy() / energyScale);
-     208          54 :         if (fields.test(SourcePositionColumn)) {
-     209          48 :                 if (oneDimensional) {
-     210          36 :                         p += std::sprintf(buffer + p, "%8.5E\t",
-     211          36 :                                         c->source.getPosition().x / lengthScale);
-     212             :                 } else {
-     213          12 :                         const Vector3d pos = c->source.getPosition() / lengthScale;
-     214          12 :                         p += std::sprintf(buffer + p, "%8.5E\t%8.5E\t%8.5E\t", pos.x, pos.y,
-     215             :                                         pos.z);
-     216             :                 }
-     217             :         }
-     218          54 :         if (fields.test(SourceDirectionColumn)) {
-     219          48 :                 if (not oneDimensional) {
-     220          12 :                         const Vector3d pos = c->source.getDirection();
-     221          12 :                         p += std::sprintf(buffer + p, "%8.5E\t%8.5E\t%8.5E\t", pos.x, pos.y,
-     222             :                                         pos.z);
-     223             :                 }
-     224             : 
-     225             :         }
-     226             : 
-     227          54 :         if (fields.test(SerialNumberColumn))
-     228          48 :                 p += std::sprintf(buffer + p, "%10lu\t",
-     229             :                                 c->getCreatedSerialNumber());
-     230          54 :         if (fields.test(CreatedIdColumn))
-     231          47 :                 p += std::sprintf(buffer + p, "%10i\t", c->created.getId());
-     232          54 :         if (fields.test(CreatedEnergyColumn))
-     233          47 :                 p += std::sprintf(buffer + p, "%8.5E\t",
-     234          47 :                                 c->created.getEnergy() / energyScale);
-     235          54 :         if (fields.test(CreatedPositionColumn)) {
-     236          47 :                 if (oneDimensional) {
-     237          36 :                         p += std::sprintf(buffer + p, "%8.5E\t",
-     238          36 :                                         c->created.getPosition().x / lengthScale);
-     239             :                 } else {
-     240          11 :                         const Vector3d pos = c->created.getPosition() / lengthScale;
-     241          11 :                         p += std::sprintf(buffer + p, "%8.5E\t%8.5E\t%8.5E\t", pos.x, pos.y,
-     242             :                                         pos.z);
-     243             :                 }
-     244             :         }
-     245          54 :         if (fields.test(CreatedDirectionColumn)) {
-     246          47 :                 if (not oneDimensional) {
-     247          11 :                         const Vector3d pos = c->created.getDirection();
-     248          11 :                         p += std::sprintf(buffer + p, "%8.5E\t%8.5E\t%8.5E\t", pos.x, pos.y,
-     249             :                                         pos.z);
-     250             :                 }
-     251             :         }
-     252          54 :         if (fields.test(WeightColumn)) {
-     253          47 :                 p += std::sprintf(buffer + p, "%8.5E\t", c->getWeight());
-     254             :         }
-     255          54 :         if (fields.test(CandidateTagColumn)) {
-     256          48 :                 p += std::sprintf(buffer + p, "%s\t", c->getTagOrigin().c_str());
-     257             :         }
-     258             : 
-     259          54 :         for(std::vector<Output::Property>::const_iterator iter = properties.begin();
-     260          55 :                         iter != properties.end(); ++iter) {
-     261           1 :                   Variant v;
-     262           1 :                         if (c->hasProperty((*iter).name)) {
-     263           0 :                                 v = c->getProperty((*iter).name);
-     264             :                         } else {
-     265           1 :                                 v = (*iter).defaultValue;
-     266             :                         }
-     267           1 :                         p += std::sprintf(buffer + p, "%s", v.toString("\t").c_str());
-     268           1 :                         p += std::sprintf(buffer + p, "\t");
-     269           1 :         }
-     270          54 :         buffer[p - 1] = '\n';
-     271             : 
-     272          54 :         std::locale::global(old_locale);
-     273             : 
-     274         108 : #pragma omp critical
-     275             :         {
-     276          54 :                 if (count == 0)
-     277           9 :                         printHeader();
-     278          54 :                 Output::process(c);
-     279          54 :                 out->write(buffer, p);
-     280             :         }
-     281             : 
-     282          54 : }
-     283             : 
-     284           1 : void TextOutput::load(const std::string &filename, ParticleCollector *collector){
-     285             : 
-     286             :         std::string line;
-     287             :         std::istream *in;
-     288           1 :         std::ifstream infile(filename.c_str());
-     289             :         
-     290             :         double lengthScale = Mpc; // default Mpc
-     291             :         double energyScale = EeV; // default EeV
-     292             : 
-     293           1 :         if (!infile.good())
-     294           0 :                 throw std::runtime_error("crpropa::TextOutput: could not open file " + filename);
-     295             :         in = &infile;
-     296             :         
-     297           2 :         if (kiss::ends_with(filename, ".gz")){
-     298             : #ifdef CRPROPA_HAVE_ZLIB
-     299           0 :                 in = new zstream::igzstream(*in);
-     300             : #else
-     301             :                 throw std::runtime_error("CRPropa was built without Zlib compression!");
-     302             : #endif
-     303             :         }
-     304             : 
-     305          38 :         while (std::getline(*in, line)) {
-     306          37 :                 std::stringstream stream(line);
-     307          37 :                 if (stream.peek() == '#')
-     308             :                         continue;
-     309             : 
-     310          22 :                 ref_ptr<Candidate> c = new Candidate(); 
-     311             :                 double val_d; int val_i;
-     312             :                 double x, y, z;
-     313             :                 stream >> val_d;
-     314          11 :                 c->setTrajectoryLength(val_d*lengthScale); // D
-     315             :                 stream >> val_d;
-     316          11 :                 c->setRedshift(val_d); // z
-     317          11 :                 stream >> val_i;
-     318          11 :                 c->setSerialNumber(val_i); // SN
-     319          11 :                 stream >> val_i;
-     320          11 :                 c->current.setId(val_i); // ID
-     321             :                 stream >> val_d;
-     322          11 :                 c->current.setEnergy(val_d*energyScale); // E
-     323             :                 stream >> x >> y >> z;
-     324          11 :                 c->current.setPosition(Vector3d(x, y, z)*lengthScale); // X, Y, Z
-     325             :                 stream >> x >> y >> z;
-     326          11 :                 c->current.setDirection(Vector3d(x, y, z)*lengthScale); // Px, Py, Pz
-     327          11 :                 stream >> val_i; // SN0 (TODO: Reconstruct the parent-child relationship)
-     328          11 :                 stream >> val_i;
-     329          11 :                 c->source.setId(val_i); // ID0
-     330             :                 stream >> val_d;
-     331          11 :                 c->source.setEnergy(val_d*energyScale);      // E0
-     332             :                 stream >> x >> y >> z;
-     333          11 :                 c->source.setPosition(Vector3d(x, y, z)*lengthScale); // X0, Y0, Z0
-     334             :                 stream >> x >> y >> z;
-     335          11 :                 c->source.setDirection(Vector3d(x, y, z)*lengthScale); // P0x, P0y, P0z
-     336          11 :                 stream >> val_i; // SN1
-     337          11 :                 stream >> val_i;
-     338          11 :                 c->created.setId(val_i); // ID1
-     339             :                 stream >> val_d;
-     340          11 :                 c->created.setEnergy(val_d*energyScale); // E1
-     341             :                 stream >> x >> y >> z;
-     342          11 :                 c->created.setPosition(Vector3d(x, y, z)*lengthScale); // X1, Y1, Z1
-     343             :                 stream >> x >> y >> z;
-     344          11 :                 c->created.setDirection(Vector3d(x, y, z)*lengthScale); // P1x, P1y, P1z
-     345             :                 stream >> val_d;
-     346          11 :                 c->setWeight(val_d); // W
-     347             : 
-     348          22 :                 collector->process(c);
-     349          37 :         }
-     350           1 :         infile.close();
-     351           2 : }
-     352             : 
-     353           0 : std::string TextOutput::getDescription() const {
-     354           0 :         return "TextOutput";
-     355             : }
-     356             : 
-     357          10 : void TextOutput::close() {
-     358             : #ifdef CRPROPA_HAVE_ZLIB
-     359          10 :         zstream::ogzstream *zs = dynamic_cast<zstream::ogzstream *>(out);
-     360          10 :         if (zs) {
-     361           0 :                 zs->close();
-     362           0 :                 delete out;
-     363           0 :                 out = 0;
-     364             :         }
-     365             : #endif
-     366          10 :         outfile.flush();
-     367          10 : }
-     368             : 
-     369          10 : TextOutput::~TextOutput() {
-     370           9 :         close();
-     371          10 : }
-     372             : 
-     373           0 : void TextOutput::gzip() {
-     374             : #ifdef CRPROPA_HAVE_ZLIB
-     375           0 :         out = new zstream::ogzstream(*out);
-     376             : #else
-     377             :         throw std::runtime_error("CRPropa was built without Zlib compression!");
-     378             : #endif
-     379           0 : }
-     380             : 
-     381             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/Tools.cpp.func-sort-c.html b/doc/coverageReport/src/module/Tools.cpp.func-sort-c.html deleted file mode 100644 index ec6611df0..000000000 --- a/doc/coverageReport/src/module/Tools.cpp.func-sort-c.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/Tools.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - Tools.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:77010.0 %
Date:2024-04-08 14:58:22Functions:21612.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa14ParticleFilter5addIdEi0
_ZN7crpropa14ParticleFilter6getIdsEv0
_ZN7crpropa14ParticleFilter8removeIdEi0
_ZN7crpropa14ParticleFilterC2Ev0
_ZN7crpropa17EmissionMapFiller14setEmissionMapEPNS_11EmissionMapE0
_ZN7crpropa17EmissionMapFillerC2EPNS_11EmissionMapE0
_ZN7crpropa17PerformanceModule3addEPNS_6ModuleE0
_ZN7crpropa17PerformanceModuleD0Ev0
_ZN7crpropa17PerformanceModuleD2Ev0
_ZNK7crpropa14ParticleFilter14getDescriptionB5cxx11Ev0
_ZNK7crpropa17EmissionMapFiller14getDescriptionB5cxx11Ev0
_ZNK7crpropa17EmissionMapFiller7processEPNS_9CandidateE0
_ZNK7crpropa17PerformanceModule14getDescriptionB5cxx11Ev0
_ZNK7crpropa17PerformanceModule7processEPNS_9CandidateE0
_ZN7crpropa14ParticleFilterC2ERKSt3setIiSt4lessIiESaIiEE1
_ZNK7crpropa14ParticleFilter7processEPNS_9CandidateE7
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/Tools.cpp.func.html b/doc/coverageReport/src/module/Tools.cpp.func.html deleted file mode 100644 index 23037d8e8..000000000 --- a/doc/coverageReport/src/module/Tools.cpp.func.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/Tools.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - Tools.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:77010.0 %
Date:2024-04-08 14:58:22Functions:21612.5 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa14ParticleFilter5addIdEi0
_ZN7crpropa14ParticleFilter6getIdsEv0
_ZN7crpropa14ParticleFilter8removeIdEi0
_ZN7crpropa14ParticleFilterC2ERKSt3setIiSt4lessIiESaIiEE1
_ZN7crpropa14ParticleFilterC2Ev0
_ZN7crpropa17EmissionMapFiller14setEmissionMapEPNS_11EmissionMapE0
_ZN7crpropa17EmissionMapFillerC2EPNS_11EmissionMapE0
_ZN7crpropa17PerformanceModule3addEPNS_6ModuleE0
_ZN7crpropa17PerformanceModuleD0Ev0
_ZN7crpropa17PerformanceModuleD2Ev0
_ZNK7crpropa14ParticleFilter14getDescriptionB5cxx11Ev0
_ZNK7crpropa14ParticleFilter7processEPNS_9CandidateE7
_ZNK7crpropa17EmissionMapFiller14getDescriptionB5cxx11Ev0
_ZNK7crpropa17EmissionMapFiller7processEPNS_9CandidateE0
_ZNK7crpropa17PerformanceModule14getDescriptionB5cxx11Ev0
_ZNK7crpropa17PerformanceModule7processEPNS_9CandidateE0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/Tools.cpp.gcov.html b/doc/coverageReport/src/module/Tools.cpp.gcov.html deleted file mode 100644 index 050d3fde4..000000000 --- a/doc/coverageReport/src/module/Tools.cpp.gcov.html +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module/Tools.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/module - Tools.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:77010.0 %
Date:2024-04-08 14:58:22Functions:21612.5 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/module/Tools.h"
-       2             : #include "crpropa/Clock.h"
-       3             : 
-       4             : #include <iostream>
-       5             : #include <sstream>
-       6             : 
-       7             : using namespace std;
-       8             : 
-       9             : namespace crpropa {
-      10             : 
-      11           0 : PerformanceModule::~PerformanceModule() {
-      12             :         double total = 0;
-      13           0 :         for (size_t i = 0; i < modules.size(); i++) {
-      14             :                 _module_info &m = modules[i];
-      15           0 :                 total += m.time;
-      16             :         }
-      17           0 :         cout << "Performance for " << calls << " calls:" << endl;
-      18           0 :         for (size_t i = 0; i < modules.size(); i++) {
-      19             :                 _module_info &m = modules[i];
-      20           0 :                 cout << " - " << floor((1000 * m.time / total) + 0.5) / 10 << "% -> "
-      21           0 :                                 << m.module->getDescription() << ": " << (m.time / calls)
-      22             :                                 << endl;
-      23             :         }
-      24           0 : }
-      25             : 
-      26           0 : void PerformanceModule::add(Module *module) {
-      27             :         _module_info info;
-      28           0 :         info.module = module;
-      29           0 :         info.time = 0;
-      30           0 :         modules.push_back(info);
-      31           0 : }
-      32             : 
-      33           0 : void PerformanceModule::process(Candidate *candidate) const {
-      34           0 :         vector<double> times(modules.size());
-      35           0 :         for (size_t i = 0; i < modules.size(); i++) {
-      36             :                 _module_info &m = modules[i];
-      37           0 :                 double start = Clock::getInstance().getMillisecond();
-      38           0 :                 m.module->process(candidate);
-      39           0 :                 double end = Clock::getInstance().getMillisecond();
-      40           0 :                 times[i] = end - start;
-      41             :         }
-      42             : 
-      43           0 : #pragma omp critical
-      44             :         {
-      45           0 :                 for (size_t i = 0; i < modules.size(); i++) {
-      46             :                         _module_info &m = modules[i];
-      47           0 :                         m.time += times[i];
-      48             :                 }
-      49           0 :                 calls++;
-      50             :         }
-      51           0 : }
-      52             : 
-      53           0 : string PerformanceModule::getDescription() const {
-      54           0 :         stringstream sstr;
-      55           0 :         sstr << "PerformanceModule (";
-      56           0 :         for (size_t i = 0; i < modules.size(); i++) {
-      57             :                 _module_info &m = modules[i];
-      58           0 :                 if (i > 0)
-      59           0 :                         sstr << ", ";
-      60           0 :                 sstr << m.module->getDescription();
-      61             :         }
-      62           0 :         sstr << ")";
-      63           0 :         return sstr.str();
-      64           0 : }
-      65             : 
-      66             : // ----------------------------------------------------------------------------
-      67           0 : ParticleFilter::ParticleFilter() {
-      68             : 
-      69           0 : }
-      70           1 : ParticleFilter::ParticleFilter(const std::set<int> &ids) : ids(ids) {
-      71             : 
-      72           1 : }
-      73           0 : void ParticleFilter::addId(int id) {
-      74             :         ids.insert(id);
-      75           0 : }
-      76           0 : void ParticleFilter::removeId(int id) {
-      77             :         ids.erase(id);
-      78           0 : }
-      79             : 
-      80           0 : std::set<int> &ParticleFilter::getIds() {
-      81           0 :         return ids;
-      82             : }
-      83             : 
-      84           7 : void ParticleFilter::process(Candidate* candidate) const {
-      85          14 :         if (ids.find(candidate->current.getId()) == ids.end())
-      86           5 :                 reject(candidate);
-      87             :         else
-      88           2 :                 accept(candidate);
-      89           7 : }
-      90             : 
-      91           0 : string ParticleFilter::getDescription() const {
-      92           0 :         stringstream sstr;
-      93           0 :         sstr << "ParticleFilter: ";
-      94           0 :         for (std::set<int>::const_iterator i = ids.begin(); i != ids.end(); i++) {
-      95           0 :                 sstr << *i << ", ";
-      96             :         }
-      97           0 :         sstr << ")";
-      98           0 :         return sstr.str();
-      99           0 : }
-     100             : 
-     101             : // ----------------------------------------------------------------------------
-     102           0 : EmissionMapFiller::EmissionMapFiller(EmissionMap *emissionMap) : emissionMap(emissionMap) {
-     103             : 
-     104           0 : }
-     105             : 
-     106           0 : void EmissionMapFiller::setEmissionMap(EmissionMap *emissionMap) {
-     107           0 :         this->emissionMap = emissionMap;
-     108           0 : }
-     109             : 
-     110           0 : void EmissionMapFiller::process(Candidate* candidate) const {
-     111           0 :         if (emissionMap) {
-     112           0 :                 #pragma omp critical
-     113             :                 {
-     114           0 :                         emissionMap->fillMap(candidate->source);
-     115             :                 }
-     116             :         }
-     117           0 : }
-     118             : 
-     119           0 : string EmissionMapFiller::getDescription() const {
-     120           0 :         return "EmissionMapFiller";
-     121             : }
-     122             : 
-     123             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/index-sort-f.html b/doc/coverageReport/src/module/index-sort-f.html deleted file mode 100644 index cb0181bfe..000000000 --- a/doc/coverageReport/src/module/index-sort-f.html +++ /dev/null @@ -1,383 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/moduleHitTotalCoverage
Test:coverage.info.cleanedLines:2250354763.4 %
Date:2024-04-08 14:58:22Functions:28648559.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
OutputShell.cpp -
0.0%
-
0.0 %0 / 270.0 %0 / 6
PhotonOutput1D.cpp -
0.0%
-
0.0 %0 / 560.0 %0 / 9
Acceleration.cpp -
0.0%
-
0.0 %0 / 890.0 %0 / 14
Tools.cpp -
10.0%10.0%
-
10.0 %7 / 7012.5 %2 / 16
Redshift.cpp -
32.1%32.1%
-
32.1 %9 / 2825.0 %1 / 4
SimplePropagation.cpp -
36.4%36.4%
-
36.4 %12 / 3328.6 %2 / 7
HDF5Output.cpp -
5.0%5.0%
-
5.0 %12 / 24128.6 %4 / 14
MomentumDiffusion.cpp -
24.4%24.4%
-
24.4 %11 / 4530.0 %3 / 10
Observer.cpp -
44.4%44.4%
-
44.4 %80 / 18036.4 %16 / 44
BreakCondition.cpp -
36.6%36.6%
-
36.6 %63 / 17239.5 %15 / 38
Boundary.cpp -
48.4%48.4%
-
48.4 %106 / 21944.4 %20 / 45
SynchrotronRadiation.cpp -
61.8%61.8%
-
61.8 %81 / 13147.6 %10 / 21
PhotoPionProduction.cpp -
63.6%63.6%
-
63.6 %246 / 38760.0 %24 / 40
TextOutput.cpp -
88.0%88.0%
-
88.0 %219 / 24964.3 %9 / 14
RestrictToRegion.cpp -
50.0%50.0%
-
50.0 %6 / 1266.7 %2 / 3
ParticleCollector.cpp -
75.0%75.0%
-
75.0 %54 / 7270.8 %17 / 24
ElasticScattering.cpp -
90.0%90.0%
-
90.0 %63 / 7071.4 %5 / 7
PhotoDisintegration.cpp -
80.0%80.0%
-
80.0 %140 / 17583.3 %10 / 12
NuclearDecay.cpp -
81.5%81.5%
-
81.5 %137 / 16884.6 %11 / 13
Output.cpp -
89.8%89.8%
-
89.8 %88 / 9887.5 %14 / 16
DiffusionSDE.cpp -
76.2%76.2%
-
76.2 %154 / 20288.0 %22 / 25
ElectronPairProduction.cpp -
92.4%92.4%
-
92.4 %85 / 9290.0 %9 / 10
CandidateSplitting.cpp -
86.9%86.9%
-
86.9 %53 / 6190.9 %10 / 11
PropagationCK.cpp -
87.6%87.6%
-
87.6 %85 / 9792.9 %13 / 14
PropagationBP.cpp -
88.5%88.5%
-
88.5 %92 / 10493.8 %15 / 16
AdiabaticCooling.cpp -
85.2%85.2%
-
85.2 %23 / 27100.0 %5 / 5
EMDoublePairProduction.cpp -
94.4%94.4%
-
94.4 %68 / 72100.0 %10 / 10
EMTripletPairProduction.cpp -
94.0%94.0%
-
94.0 %94 / 100100.0 %11 / 11
EMInverseComptonScattering.cpp -
96.2%96.2%
-
96.2 %128 / 133100.0 %13 / 13
EMPairProduction.cpp -
97.8%97.8%
-
97.8 %134 / 137100.0 %13 / 13
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/index-sort-l.html b/doc/coverageReport/src/module/index-sort-l.html deleted file mode 100644 index aa76e709f..000000000 --- a/doc/coverageReport/src/module/index-sort-l.html +++ /dev/null @@ -1,383 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/moduleHitTotalCoverage
Test:coverage.info.cleanedLines:2250354763.4 %
Date:2024-04-08 14:58:22Functions:28648559.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
OutputShell.cpp -
0.0%
-
0.0 %0 / 270.0 %0 / 6
PhotonOutput1D.cpp -
0.0%
-
0.0 %0 / 560.0 %0 / 9
Acceleration.cpp -
0.0%
-
0.0 %0 / 890.0 %0 / 14
HDF5Output.cpp -
5.0%5.0%
-
5.0 %12 / 24128.6 %4 / 14
Tools.cpp -
10.0%10.0%
-
10.0 %7 / 7012.5 %2 / 16
MomentumDiffusion.cpp -
24.4%24.4%
-
24.4 %11 / 4530.0 %3 / 10
Redshift.cpp -
32.1%32.1%
-
32.1 %9 / 2825.0 %1 / 4
SimplePropagation.cpp -
36.4%36.4%
-
36.4 %12 / 3328.6 %2 / 7
BreakCondition.cpp -
36.6%36.6%
-
36.6 %63 / 17239.5 %15 / 38
Observer.cpp -
44.4%44.4%
-
44.4 %80 / 18036.4 %16 / 44
Boundary.cpp -
48.4%48.4%
-
48.4 %106 / 21944.4 %20 / 45
RestrictToRegion.cpp -
50.0%50.0%
-
50.0 %6 / 1266.7 %2 / 3
SynchrotronRadiation.cpp -
61.8%61.8%
-
61.8 %81 / 13147.6 %10 / 21
PhotoPionProduction.cpp -
63.6%63.6%
-
63.6 %246 / 38760.0 %24 / 40
ParticleCollector.cpp -
75.0%75.0%
-
75.0 %54 / 7270.8 %17 / 24
DiffusionSDE.cpp -
76.2%76.2%
-
76.2 %154 / 20288.0 %22 / 25
PhotoDisintegration.cpp -
80.0%80.0%
-
80.0 %140 / 17583.3 %10 / 12
NuclearDecay.cpp -
81.5%81.5%
-
81.5 %137 / 16884.6 %11 / 13
AdiabaticCooling.cpp -
85.2%85.2%
-
85.2 %23 / 27100.0 %5 / 5
CandidateSplitting.cpp -
86.9%86.9%
-
86.9 %53 / 6190.9 %10 / 11
PropagationCK.cpp -
87.6%87.6%
-
87.6 %85 / 9792.9 %13 / 14
TextOutput.cpp -
88.0%88.0%
-
88.0 %219 / 24964.3 %9 / 14
PropagationBP.cpp -
88.5%88.5%
-
88.5 %92 / 10493.8 %15 / 16
Output.cpp -
89.8%89.8%
-
89.8 %88 / 9887.5 %14 / 16
ElasticScattering.cpp -
90.0%90.0%
-
90.0 %63 / 7071.4 %5 / 7
ElectronPairProduction.cpp -
92.4%92.4%
-
92.4 %85 / 9290.0 %9 / 10
EMTripletPairProduction.cpp -
94.0%94.0%
-
94.0 %94 / 100100.0 %11 / 11
EMDoublePairProduction.cpp -
94.4%94.4%
-
94.4 %68 / 72100.0 %10 / 10
EMInverseComptonScattering.cpp -
96.2%96.2%
-
96.2 %128 / 133100.0 %13 / 13
EMPairProduction.cpp -
97.8%97.8%
-
97.8 %134 / 137100.0 %13 / 13
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/src/module/index.html b/doc/coverageReport/src/module/index.html deleted file mode 100644 index 7af31a205..000000000 --- a/doc/coverageReport/src/module/index.html +++ /dev/null @@ -1,383 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - src/module - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - src/moduleHitTotalCoverage
Test:coverage.info.cleanedLines:2250354763.4 %
Date:2024-04-08 14:58:22Functions:28648559.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
Acceleration.cpp -
0.0%
-
0.0 %0 / 890.0 %0 / 14
AdiabaticCooling.cpp -
85.2%85.2%
-
85.2 %23 / 27100.0 %5 / 5
Boundary.cpp -
48.4%48.4%
-
48.4 %106 / 21944.4 %20 / 45
BreakCondition.cpp -
36.6%36.6%
-
36.6 %63 / 17239.5 %15 / 38
CandidateSplitting.cpp -
86.9%86.9%
-
86.9 %53 / 6190.9 %10 / 11
DiffusionSDE.cpp -
76.2%76.2%
-
76.2 %154 / 20288.0 %22 / 25
EMDoublePairProduction.cpp -
94.4%94.4%
-
94.4 %68 / 72100.0 %10 / 10
EMInverseComptonScattering.cpp -
96.2%96.2%
-
96.2 %128 / 133100.0 %13 / 13
EMPairProduction.cpp -
97.8%97.8%
-
97.8 %134 / 137100.0 %13 / 13
EMTripletPairProduction.cpp -
94.0%94.0%
-
94.0 %94 / 100100.0 %11 / 11
ElasticScattering.cpp -
90.0%90.0%
-
90.0 %63 / 7071.4 %5 / 7
ElectronPairProduction.cpp -
92.4%92.4%
-
92.4 %85 / 9290.0 %9 / 10
HDF5Output.cpp -
5.0%5.0%
-
5.0 %12 / 24128.6 %4 / 14
MomentumDiffusion.cpp -
24.4%24.4%
-
24.4 %11 / 4530.0 %3 / 10
NuclearDecay.cpp -
81.5%81.5%
-
81.5 %137 / 16884.6 %11 / 13
Observer.cpp -
44.4%44.4%
-
44.4 %80 / 18036.4 %16 / 44
Output.cpp -
89.8%89.8%
-
89.8 %88 / 9887.5 %14 / 16
OutputShell.cpp -
0.0%
-
0.0 %0 / 270.0 %0 / 6
ParticleCollector.cpp -
75.0%75.0%
-
75.0 %54 / 7270.8 %17 / 24
PhotoDisintegration.cpp -
80.0%80.0%
-
80.0 %140 / 17583.3 %10 / 12
PhotoPionProduction.cpp -
63.6%63.6%
-
63.6 %246 / 38760.0 %24 / 40
PhotonOutput1D.cpp -
0.0%
-
0.0 %0 / 560.0 %0 / 9
PropagationBP.cpp -
88.5%88.5%
-
88.5 %92 / 10493.8 %15 / 16
PropagationCK.cpp -
87.6%87.6%
-
87.6 %85 / 9792.9 %13 / 14
Redshift.cpp -
32.1%32.1%
-
32.1 %9 / 2825.0 %1 / 4
RestrictToRegion.cpp -
50.0%50.0%
-
50.0 %6 / 1266.7 %2 / 3
SimplePropagation.cpp -
36.4%36.4%
-
36.4 %12 / 3328.6 %2 / 7
SynchrotronRadiation.cpp -
61.8%61.8%
-
61.8 %81 / 13147.6 %10 / 21
TextOutput.cpp -
88.0%88.0%
-
88.0 %219 / 24964.3 %9 / 14
Tools.cpp -
10.0%10.0%
-
10.0 %7 / 7012.5 %2 / 16
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/index-sort-f.html b/doc/coverageReport/test/index-sort-f.html deleted file mode 100644 index d8992e401..000000000 --- a/doc/coverageReport/test/index-sort-f.html +++ /dev/null @@ -1,243 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - testHitTotalCoverage
Test:coverage.info.cleanedLines:3320339197.9 %
Date:2024-04-08 14:58:22Functions:26427396.7 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
testFunctionalGroups.cpp -
87.0%87.0%
-
87.0 %20 / 2350.0 %1 / 2
testModuleList.cpp -
94.5%94.5%
-
94.5 %52 / 5585.7 %6 / 7
testVector3.cpp -
96.8%96.8%
-
96.8 %90 / 9392.3 %12 / 13
testOutput.cpp -
96.9%96.9%
-
96.9 %157 / 16294.4 %17 / 18
testPropagation.cpp -
99.1%99.1%
-
99.1 %337 / 34094.7 %18 / 19
testSource.cpp -
98.6%98.6%
-
98.6 %279 / 28395.8 %23 / 24
testBreakCondition.cpp -
99.3%99.3%
-
99.3 %398 / 40196.8 %30 / 31
testInteraction.cpp -
94.4%94.4%
-
94.4 %743 / 78798.1 %52 / 53
testCore.cpp -
99.5%99.5%
-
99.5 %654 / 65798.3 %58 / 59
testCandidateSplitting.cpp -
100.0%
-
100.0 %47 / 47100.0 %2 / 2
testAdiabaticCooling.cpp -
100.0%
-
100.0 %23 / 23100.0 %2 / 2
testAdvectionField.cpp -
100.0%
-
100.0 %83 / 83100.0 %5 / 5
testMagneticLens.cpp -
100.0%
-
100.0 %87 / 87100.0 %7 / 7
testDensity.cpp -
100.0%
-
100.0 %166 / 166100.0 %7 / 7
testTurbulentField.cpp -
100.0%
-
100.0 %46 / 46100.0 %8 / 8
testMagneticField.cpp -
100.0%
-
100.0 %138 / 138100.0 %16 / 16
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/index-sort-l.html b/doc/coverageReport/test/index-sort-l.html deleted file mode 100644 index a458518a3..000000000 --- a/doc/coverageReport/test/index-sort-l.html +++ /dev/null @@ -1,243 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - testHitTotalCoverage
Test:coverage.info.cleanedLines:3320339197.9 %
Date:2024-04-08 14:58:22Functions:26427396.7 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
testFunctionalGroups.cpp -
87.0%87.0%
-
87.0 %20 / 2350.0 %1 / 2
testInteraction.cpp -
94.4%94.4%
-
94.4 %743 / 78798.1 %52 / 53
testModuleList.cpp -
94.5%94.5%
-
94.5 %52 / 5585.7 %6 / 7
testVector3.cpp -
96.8%96.8%
-
96.8 %90 / 9392.3 %12 / 13
testOutput.cpp -
96.9%96.9%
-
96.9 %157 / 16294.4 %17 / 18
testSource.cpp -
98.6%98.6%
-
98.6 %279 / 28395.8 %23 / 24
testPropagation.cpp -
99.1%99.1%
-
99.1 %337 / 34094.7 %18 / 19
testBreakCondition.cpp -
99.3%99.3%
-
99.3 %398 / 40196.8 %30 / 31
testCore.cpp -
99.5%99.5%
-
99.5 %654 / 65798.3 %58 / 59
testAdiabaticCooling.cpp -
100.0%
-
100.0 %23 / 23100.0 %2 / 2
testTurbulentField.cpp -
100.0%
-
100.0 %46 / 46100.0 %8 / 8
testCandidateSplitting.cpp -
100.0%
-
100.0 %47 / 47100.0 %2 / 2
testAdvectionField.cpp -
100.0%
-
100.0 %83 / 83100.0 %5 / 5
testMagneticLens.cpp -
100.0%
-
100.0 %87 / 87100.0 %7 / 7
testMagneticField.cpp -
100.0%
-
100.0 %138 / 138100.0 %16 / 16
testDensity.cpp -
100.0%
-
100.0 %166 / 166100.0 %7 / 7
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/index.html b/doc/coverageReport/test/index.html deleted file mode 100644 index 8374654ca..000000000 --- a/doc/coverageReport/test/index.html +++ /dev/null @@ -1,243 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - testHitTotalCoverage
Test:coverage.info.cleanedLines:3320339197.9 %
Date:2024-04-08 14:58:22Functions:26427396.7 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
testAdiabaticCooling.cpp -
100.0%
-
100.0 %23 / 23100.0 %2 / 2
testAdvectionField.cpp -
100.0%
-
100.0 %83 / 83100.0 %5 / 5
testBreakCondition.cpp -
99.3%99.3%
-
99.3 %398 / 40196.8 %30 / 31
testCandidateSplitting.cpp -
100.0%
-
100.0 %47 / 47100.0 %2 / 2
testCore.cpp -
99.5%99.5%
-
99.5 %654 / 65798.3 %58 / 59
testDensity.cpp -
100.0%
-
100.0 %166 / 166100.0 %7 / 7
testFunctionalGroups.cpp -
87.0%87.0%
-
87.0 %20 / 2350.0 %1 / 2
testInteraction.cpp -
94.4%94.4%
-
94.4 %743 / 78798.1 %52 / 53
testMagneticField.cpp -
100.0%
-
100.0 %138 / 138100.0 %16 / 16
testMagneticLens.cpp -
100.0%
-
100.0 %87 / 87100.0 %7 / 7
testModuleList.cpp -
94.5%94.5%
-
94.5 %52 / 5585.7 %6 / 7
testOutput.cpp -
96.9%96.9%
-
96.9 %157 / 16294.4 %17 / 18
testPropagation.cpp -
99.1%99.1%
-
99.1 %337 / 34094.7 %18 / 19
testSource.cpp -
98.6%98.6%
-
98.6 %279 / 28395.8 %23 / 24
testTurbulentField.cpp -
100.0%
-
100.0 %46 / 46100.0 %8 / 8
testVector3.cpp -
96.8%96.8%
-
96.8 %90 / 9392.3 %12 / 13
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testAdiabaticCooling.cpp.func-sort-c.html b/doc/coverageReport/test/testAdiabaticCooling.cpp.func-sort-c.html deleted file mode 100644 index 32530ff4f..000000000 --- a/doc/coverageReport/test/testAdiabaticCooling.cpp.func-sort-c.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testAdiabaticCooling.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testAdiabaticCooling.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:2323100.0 %
Date:2024-04-08 14:58:22Functions:22100.0 %
-
- -
- - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa34AdiabaticCooling_UniformField_Test8TestBodyEv1
_ZN7crpropa44AdiabaticCooling_ConstantSphericalField_Test8TestBodyEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testAdiabaticCooling.cpp.func.html b/doc/coverageReport/test/testAdiabaticCooling.cpp.func.html deleted file mode 100644 index 2bf778f01..000000000 --- a/doc/coverageReport/test/testAdiabaticCooling.cpp.func.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testAdiabaticCooling.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testAdiabaticCooling.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:2323100.0 %
Date:2024-04-08 14:58:22Functions:22100.0 %
-
- -
- - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa34AdiabaticCooling_UniformField_Test8TestBodyEv1
_ZN7crpropa44AdiabaticCooling_ConstantSphericalField_Test8TestBodyEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testAdiabaticCooling.cpp.gcov.html b/doc/coverageReport/test/testAdiabaticCooling.cpp.gcov.html deleted file mode 100644 index 6953c46a9..000000000 --- a/doc/coverageReport/test/testAdiabaticCooling.cpp.gcov.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testAdiabaticCooling.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testAdiabaticCooling.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:2323100.0 %
Date:2024-04-08 14:58:22Functions:22100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/Candidate.h"
-       2             : #include "crpropa/Units.h"
-       3             : #include "crpropa/ParticleID.h"
-       4             : #include "crpropa/advectionField/AdvectionField.h"
-       5             : #include "crpropa/module/AdiabaticCooling.h"
-       6             : #include "gtest/gtest.h"
-       7             : 
-       8             : //#include <fstream>
-       9             : 
-      10             : namespace crpropa {
-      11             : 
-      12             : // AdiabaticCooling ---------------------------------------------------------------
-      13             : 
-      14           2 : TEST (AdiabaticCooling, UniformField) {
-      15             :         // Test in a uniform advection Field
-      16             : 
-      17           2 :         AdiabaticCooling AC(new UniformAdvectionField(Vector3d(1,0,0)));
-      18           1 :         Candidate c(nucleusId(1,1), 1e13*eV);
-      19           1 :         c.setCurrentStep(10*kpc);
-      20           1 :         c.setNextStep(10*kpc);
-      21           1 :         double E = c.current.getEnergy();
-      22           1 :         AC.process(&c);
-      23             : 
-      24             :         // Energy is expected to be conserved
-      25           1 :         EXPECT_DOUBLE_EQ(c.current.getEnergy(), E);
-      26           1 :         EXPECT_DOUBLE_EQ(c.getNextStep(), 10*kpc);
-      27             : 
-      28             :         double limit = 0.2;
-      29           3 :         AdiabaticCooling AC2(new UniformAdvectionField(Vector3d(1,0,0)), limit);
-      30             :         
-      31           1 :         EXPECT_DOUBLE_EQ(AC2.getLimit(), limit);
-      32             : 
-      33             :         //
-      34             : 
-      35           1 : }
-      36             : 
-      37           2 : TEST (AdiabaticCooling, ConstantSphericalField) {
-      38             :         // Constant velocity vector
-      39             :         
-      40           2 :         AdiabaticCooling AC(new ConstantSphericalAdvectionField(Vector3d(0,0,0), 1));
-      41           1 :         Candidate c(nucleusId(1,1), 10);
-      42           1 :         c.current.setPosition(Vector3d(1,0,0));
-      43           1 :         c.setCurrentStep(c_light);
-      44           1 :         c.setNextStep(c_light);
-      45           1 :         double E = c.current.getEnergy();
-      46           1 :         AC.process(&c);
-      47             : 
-      48             :         // Check energy loss and step limitation
-      49           1 :         EXPECT_DOUBLE_EQ(c.current.getEnergy(), E/3.);
-      50           1 :         EXPECT_DOUBLE_EQ(c.getNextStep(), 0.15*c_light);
-      51             : 
-      52           1 : }
-      53             : 
-      54             : 
-      55             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testAdvectionField.cpp.func-sort-c.html b/doc/coverageReport/test/testAdvectionField.cpp.func-sort-c.html deleted file mode 100644 index f4debdd54..000000000 --- a/doc/coverageReport/test/testAdvectionField.cpp.func-sort-c.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testAdvectionField.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testAdvectionField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8383100.0 %
Date:2024-04-08 14:58:22Functions:55100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa38testAdvectionFieldList_SimpleTest_Test8TestBodyEv1
_ZN7crpropa41testUniformAdvectionField_SimpleTest_Test8TestBodyEv1
_ZN7crpropa43testSphericalAdvectionField_SimpleTest_Test8TestBodyEv1
_ZN7crpropa43testSphericalAdvectionShock_SimpleTest_Test8TestBodyEv1
_ZN7crpropa51testConstantSphericalAdvectionField_SimpleTest_Test8TestBodyEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testAdvectionField.cpp.func.html b/doc/coverageReport/test/testAdvectionField.cpp.func.html deleted file mode 100644 index c24ce98a8..000000000 --- a/doc/coverageReport/test/testAdvectionField.cpp.func.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testAdvectionField.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testAdvectionField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8383100.0 %
Date:2024-04-08 14:58:22Functions:55100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa38testAdvectionFieldList_SimpleTest_Test8TestBodyEv1
_ZN7crpropa41testUniformAdvectionField_SimpleTest_Test8TestBodyEv1
_ZN7crpropa43testSphericalAdvectionField_SimpleTest_Test8TestBodyEv1
_ZN7crpropa43testSphericalAdvectionShock_SimpleTest_Test8TestBodyEv1
_ZN7crpropa51testConstantSphericalAdvectionField_SimpleTest_Test8TestBodyEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testAdvectionField.cpp.gcov.html b/doc/coverageReport/test/testAdvectionField.cpp.gcov.html deleted file mode 100644 index e0ac90041..000000000 --- a/doc/coverageReport/test/testAdvectionField.cpp.gcov.html +++ /dev/null @@ -1,245 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testAdvectionField.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testAdvectionField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8383100.0 %
Date:2024-04-08 14:58:22Functions:55100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/advectionField/AdvectionField.h"
-       2             : #include "crpropa/Units.h"
-       3             : #include "crpropa/Common.h"
-       4             : 
-       5             : #include "gtest/gtest.h"
-       6             : #include <stdexcept>
-       7             : #include <cmath>
-       8             : 
-       9             : namespace crpropa {
-      10             : 
-      11           2 : TEST(testUniformAdvectionField, SimpleTest) {
-      12           1 :         UniformAdvectionField A(Vector3d(-1, 5, 3));
-      13           1 :         Vector3d a = A.getField(Vector3d(1, 0, 0));
-      14           1 :         double D = A.getDivergence(Vector3d(1, 0, 0));
-      15           1 :         EXPECT_DOUBLE_EQ(a.x, -1);
-      16           1 :         EXPECT_DOUBLE_EQ(a.y, 5);
-      17           1 :         EXPECT_DOUBLE_EQ(a.z, 3);
-      18           1 :         EXPECT_DOUBLE_EQ(D, 0.);
-      19           1 : }
-      20             : 
-      21           2 : TEST(testAdvectionFieldList, SimpleTest) {
-      22             :         // Test a list of three advection fields
-      23             :         AdvectionFieldList A;
-      24           2 :         A.addField(new UniformAdvectionField(Vector3d(1, 0, 0)));
-      25           2 :         A.addField(new UniformAdvectionField(Vector3d(0, 2, 0)));
-      26           2 :         A.addField(new UniformAdvectionField(Vector3d(0, 0, 3)));
-      27           1 :         Vector3d a = A.getField(Vector3d(0.));
-      28           1 :         double D = A.getDivergence(Vector3d(1, 2, 3));
-      29           1 :         EXPECT_DOUBLE_EQ(a.x, 1);
-      30           1 :         EXPECT_DOUBLE_EQ(a.y, 2);
-      31           1 :         EXPECT_DOUBLE_EQ(a.z, 3);
-      32           1 :         EXPECT_DOUBLE_EQ(D, 0.);
-      33           1 : }
-      34             : 
-      35           2 : TEST(testConstantSphericalAdvectionField, SimpleTest) {
-      36             :         
-      37             :         Vector3d origin(1, 0, 0);
-      38             :         double V_wind(10);
-      39             :         
-      40           1 :         ConstantSphericalAdvectionField A(origin, V_wind);
-      41             :         
-      42             :         // Check the properties of the advection field
-      43           1 :         EXPECT_DOUBLE_EQ(A.getOrigin().x, origin.x);
-      44           1 :         EXPECT_DOUBLE_EQ(A.getOrigin().y, origin.y);
-      45           1 :         EXPECT_DOUBLE_EQ(A.getOrigin().z, origin.z);
-      46             : 
-      47           1 :         EXPECT_DOUBLE_EQ(A.getVWind(), V_wind);
-      48             : 
-      49             :         // Field should be radial with center (1,0,0)
-      50             :         Vector3d Pos(2, 1, 1);
-      51           1 :         Vector3d V = A.getField(Pos);
-      52             : 
-      53           1 :         EXPECT_DOUBLE_EQ(V.x, 10.*pow(3, -0.5));
-      54           1 :         EXPECT_DOUBLE_EQ(V.y, 10.*pow(3, -0.5));
-      55           1 :         EXPECT_DOUBLE_EQ(V.z, 10.*pow(3, -0.5));
-      56             :         
-      57             :         // Divergence should be 2*V/r
-      58             :         Vector3d Pos2(2, 0, 0);
-      59           1 :         double D = A.getDivergence(Pos2);
-      60           1 :         EXPECT_DOUBLE_EQ(D, 2*10);
-      61           1 : }
-      62             : 
-      63           2 : TEST(testSphericalAdvectionField, SimpleTest) {
-      64             : 
-      65             :         Vector3d origin(1, 0, 0);
-      66             :         double R_max(10);
-      67             :         double V_max(1000);
-      68             :         double tau(3.);
-      69             :         double alpha(2.);
-      70             : 
-      71           1 :         SphericalAdvectionField A(origin, R_max, V_max, tau, alpha);
-      72             : 
-      73             :         // Check the properties of the advection field
-      74           1 :         EXPECT_DOUBLE_EQ(A.getOrigin().x, origin.x);
-      75           1 :         EXPECT_DOUBLE_EQ(A.getOrigin().y, origin.y);
-      76           1 :         EXPECT_DOUBLE_EQ(A.getOrigin().z, origin.z);
-      77             :         
-      78           1 :         EXPECT_DOUBLE_EQ(A.getRadius(), R_max);
-      79           1 :         EXPECT_DOUBLE_EQ(A.getVMax(), V_max);
-      80           1 :         EXPECT_DOUBLE_EQ(A.getTau(), tau);
-      81           1 :         EXPECT_DOUBLE_EQ(A.getAlpha(), alpha);
-      82             : 
-      83             :         // Field/divergence should be zero for R>10
-      84           1 :         EXPECT_DOUBLE_EQ(A.getField(Vector3d(12,0,0)).getR(), 0.);
-      85           1 :         EXPECT_DOUBLE_EQ(A.getDivergence(Vector3d(12,0,0)), 0.);
-      86             : 
-      87             :         // Check field and divergence
-      88             :         Vector3d Pos(2, 0, 0);
-      89           1 :         Vector3d a = A.getField(Pos);
-      90           1 :         Vector3d a0 = a.getUnitVector();
-      91           1 :         double d = A.getDivergence(Pos);
-      92             : 
-      93           1 :         EXPECT_DOUBLE_EQ(a0.x, 1.);
-      94           1 :         EXPECT_DOUBLE_EQ(a0.y, 0.);
-      95           1 :         EXPECT_DOUBLE_EQ(a0.z, 0.);
-      96           1 :         EXPECT_DOUBLE_EQ(a.getR(), V_max*(1.-exp(-1./tau)) );
-      97             : 
-      98           1 :         EXPECT_NEAR(d, 1044.624919, 1e-5);
-      99             : 
-     100             :         // Check asymptotic of the Field
-     101           1 :         EXPECT_NEAR(A.getField(Vector3d(11, 0, 0)).getR(), 1000., 1e-4);
-     102             :         
-     103             :         // Divergence should be 2*V_max/r for r>>1
-     104           1 :         EXPECT_NEAR(A.getDivergence(Vector3d(11, 0, 0)), 2*1000./10., 1e-4);
-     105           1 : }
-     106             : 
-     107             : 
-     108           2 : TEST(testSphericalAdvectionShock, SimpleTest) {
-     109             : 
-     110             :         Vector3d origin(0, 0, 0);
-     111             :         double R_0(10);
-     112             :         double V_0(1000);
-     113             :         double lambda(0.1);
-     114             :         double R_rot(1.);
-     115             :         double V_rot(100);
-     116             :         
-     117             : 
-     118           1 :         SphericalAdvectionShock A(origin, R_0, V_0, lambda);
-     119             : 
-     120             :         // Check the properties of the advection field
-     121           1 :         EXPECT_DOUBLE_EQ(A.getOrigin().x, origin.x);
-     122           1 :         EXPECT_DOUBLE_EQ(A.getOrigin().y, origin.y);
-     123           1 :         EXPECT_DOUBLE_EQ(A.getOrigin().z, origin.z);
-     124             :         
-     125           1 :         EXPECT_DOUBLE_EQ(A.getR0(), R_0);
-     126           1 :         EXPECT_DOUBLE_EQ(A.getV0(), V_0);
-     127           1 :         EXPECT_DOUBLE_EQ(A.getLambda(), lambda);
-     128             : 
-     129             :         // Default values for R_Rot is R_0
-     130             :         // Default value for Azimuthal speed is 0
-     131           1 :         EXPECT_DOUBLE_EQ(A.getRRot(), R_0);
-     132           1 :         EXPECT_DOUBLE_EQ(A.getAzimuthalSpeed(), 0.);    
-     133             : 
-     134             :         // Field should drop to 0.625*V_0 at the shock 
-     135             :         // That's a difference to the analytic shock model where it should
-     136             :         // drop to v_r(R_0)=0.25*V_0.
-     137           1 :         EXPECT_DOUBLE_EQ(A.getField(Vector3d(R_0,0,0)).getR(), 0.625*V_0);
-     138             : 
-     139             :         // Field divergence should be zero for R>>R_0
-     140           1 :         EXPECT_NEAR(A.getDivergence(Vector3d(15,0,0)), 0., 1e-10);
-     141             : 
-     142             :         // Check field and divergence
-     143             :         Vector3d Pos(2, 0, 0);
-     144           1 :         Vector3d a = A.getField(Pos);
-     145           1 :         Vector3d a0 = a.getUnitVector();
-     146           1 :         double d = A.getDivergence(Pos);
-     147             : 
-     148           1 :         EXPECT_DOUBLE_EQ(a0.x, 1.);
-     149           1 :         EXPECT_DOUBLE_EQ(a0.y, 0.);
-     150           1 :         EXPECT_DOUBLE_EQ(a0.z, 0.);
-     151           1 :         EXPECT_DOUBLE_EQ(a.getR(), V_0);
-     152             :         
-     153             :         //Set explicitely the azimuthal rotation speed 
-     154           1 :         A.setRRot(R_rot);
-     155           1 :         A.setAzimuthalSpeed(V_rot);
-     156             :         
-     157           1 :         EXPECT_DOUBLE_EQ(A.getRRot(), R_rot);
-     158           1 :         EXPECT_DOUBLE_EQ(A.getAzimuthalSpeed(), V_rot); 
-     159             :         
-     160             :         Vector3d pos(1., 0., 0.);
-     161           1 :         Vector3d f = A.getField(pos);
-     162           1 :         EXPECT_DOUBLE_EQ(f.x, 1000.);
-     163           1 :         EXPECT_DOUBLE_EQ(f.y, 100.);
-     164           1 :         EXPECT_DOUBLE_EQ(f.z, 0.);      
-     165             : 
-     166             :         
-     167           1 : }
-     168             : 
-     169             : } //namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testBreakCondition.cpp.func-sort-c.html b/doc/coverageReport/test/testBreakCondition.cpp.func-sort-c.html deleted file mode 100644 index fdc048a9d..000000000 --- a/doc/coverageReport/test/testBreakCondition.cpp.func-sort-c.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testBreakCondition.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testBreakCondition.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:39840199.3 %
Date:2024-04-08 14:58:22Functions:303196.8 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa4mainEiPPc0
_ZN7crpropa20PeriodicBox_low_Test8TestBodyEv1
_ZN7crpropa21PeriodicBox_high_Test8TestBodyEv1
_ZN7crpropa23MinimumEnergy_test_Test8TestBodyEv1
_ZN7crpropa23ReflectiveBox_high_Test8TestBodyEv1
_ZN7crpropa25CubicBoundary_inside_Test8TestBodyEv1
_ZN7crpropa25DetectionLength_test_Test8TestBodyEv1
_ZN7crpropa25MinimumRedshift_test_Test8TestBodyEv1
_ZN7crpropa26CubicBoundary_outside_Test8TestBodyEv1
_ZN7crpropa26ObserverFeature_Point_Test8TestBodyEv1
_ZN7crpropa29MinimumChargeNumber_test_Test8TestBodyEv1
_ZN7crpropa29SphericalBoundary_inside_Test8TestBodyEv1
_ZN7crpropa30ObserverFeature_DetectAll_Test8TestBodyEv1
_ZN7crpropa30SphericalBoundary_outside_Test8TestBodyEv1
_ZN7crpropa31CylindricalBoundary_inside_Test8TestBodyEv1
_ZN7crpropa31EllipsoidalBoundary_inside_Test8TestBodyEv1
_ZN7crpropa32CylindricalBoundary_outside_Test8TestBodyEv1
_ZN7crpropa32EllipsoidalBoundary_outside_Test8TestBodyEv1
_ZN7crpropa32ObserverFeature_LargeSphere_Test8TestBodyEv1
_ZN7crpropa32ObserverFeature_SmallSphere_Test8TestBodyEv1
_ZN7crpropa32SphericalBoundary_limitStep_Test8TestBodyEv1
_ZN7crpropa33CubicBoundary_limitStepLower_Test8TestBodyEv1
_ZN7crpropa33CubicBoundary_limitStepUpper_Test8TestBodyEv1
_ZN7crpropa33MaximumTrajectoryLength_test_Test8TestBodyEv1
_ZN7crpropa34CylindricalBoundary_limitStep_Test8TestBodyEv1
_ZN7crpropa34EllipsoidalBoundary_limitStep_Test8TestBodyEv1
_ZN7crpropa34ObserverFeature_TimeEvolution_Test8TestBodyEv1
_ZN7crpropa36MinimumEnergyPerParticleId_test_Test8TestBodyEv1
_ZN7crpropa37MaximumTrajectoryLength_observer_Test8TestBodyEv1
_ZN7crpropa37ObserverFeature_TimeEvolutionLog_Test8TestBodyEv1
_ZN7crpropa38RestrictToRegion_RestrictToRegion_Test8TestBodyEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testBreakCondition.cpp.func.html b/doc/coverageReport/test/testBreakCondition.cpp.func.html deleted file mode 100644 index 13dcf1aae..000000000 --- a/doc/coverageReport/test/testBreakCondition.cpp.func.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testBreakCondition.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testBreakCondition.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:39840199.3 %
Date:2024-04-08 14:58:22Functions:303196.8 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa20PeriodicBox_low_Test8TestBodyEv1
_ZN7crpropa21PeriodicBox_high_Test8TestBodyEv1
_ZN7crpropa23MinimumEnergy_test_Test8TestBodyEv1
_ZN7crpropa23ReflectiveBox_high_Test8TestBodyEv1
_ZN7crpropa25CubicBoundary_inside_Test8TestBodyEv1
_ZN7crpropa25DetectionLength_test_Test8TestBodyEv1
_ZN7crpropa25MinimumRedshift_test_Test8TestBodyEv1
_ZN7crpropa26CubicBoundary_outside_Test8TestBodyEv1
_ZN7crpropa26ObserverFeature_Point_Test8TestBodyEv1
_ZN7crpropa29MinimumChargeNumber_test_Test8TestBodyEv1
_ZN7crpropa29SphericalBoundary_inside_Test8TestBodyEv1
_ZN7crpropa30ObserverFeature_DetectAll_Test8TestBodyEv1
_ZN7crpropa30SphericalBoundary_outside_Test8TestBodyEv1
_ZN7crpropa31CylindricalBoundary_inside_Test8TestBodyEv1
_ZN7crpropa31EllipsoidalBoundary_inside_Test8TestBodyEv1
_ZN7crpropa32CylindricalBoundary_outside_Test8TestBodyEv1
_ZN7crpropa32EllipsoidalBoundary_outside_Test8TestBodyEv1
_ZN7crpropa32ObserverFeature_LargeSphere_Test8TestBodyEv1
_ZN7crpropa32ObserverFeature_SmallSphere_Test8TestBodyEv1
_ZN7crpropa32SphericalBoundary_limitStep_Test8TestBodyEv1
_ZN7crpropa33CubicBoundary_limitStepLower_Test8TestBodyEv1
_ZN7crpropa33CubicBoundary_limitStepUpper_Test8TestBodyEv1
_ZN7crpropa33MaximumTrajectoryLength_test_Test8TestBodyEv1
_ZN7crpropa34CylindricalBoundary_limitStep_Test8TestBodyEv1
_ZN7crpropa34EllipsoidalBoundary_limitStep_Test8TestBodyEv1
_ZN7crpropa34ObserverFeature_TimeEvolution_Test8TestBodyEv1
_ZN7crpropa36MinimumEnergyPerParticleId_test_Test8TestBodyEv1
_ZN7crpropa37MaximumTrajectoryLength_observer_Test8TestBodyEv1
_ZN7crpropa37ObserverFeature_TimeEvolutionLog_Test8TestBodyEv1
_ZN7crpropa38RestrictToRegion_RestrictToRegion_Test8TestBodyEv1
_ZN7crpropa4mainEiPPc0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testBreakCondition.cpp.gcov.html b/doc/coverageReport/test/testBreakCondition.cpp.gcov.html deleted file mode 100644 index daded67ee..000000000 --- a/doc/coverageReport/test/testBreakCondition.cpp.gcov.html +++ /dev/null @@ -1,621 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testBreakCondition.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testBreakCondition.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:39840199.3 %
Date:2024-04-08 14:58:22Functions:303196.8 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : /** Unit tests for break condition, observer, boundary and tool modules */
-       2             : 
-       3             : #include "crpropa/module/BreakCondition.h"
-       4             : #include "crpropa/module/Observer.h"
-       5             : #include "crpropa/module/Boundary.h"
-       6             : #include "crpropa/module/Tools.h"
-       7             : #include "crpropa/module/RestrictToRegion.h"
-       8             : #include "crpropa/ParticleID.h"
-       9             : #include "crpropa/Geometry.h"
-      10             : 
-      11             : #include "gtest/gtest.h"
-      12             : 
-      13             : namespace crpropa {
-      14             : 
-      15             : //** ========================= Break conditions ============================= */
-      16           1 : TEST(MinimumEnergy, test) {
-      17           1 :         MinimumEnergy minEnergy(5);
-      18           1 :         Candidate c;
-      19             : 
-      20           1 :         c.current.setEnergy(5.1);
-      21           1 :         minEnergy.process(&c);
-      22           1 :         EXPECT_TRUE(c.isActive());
-      23             : 
-      24           1 :         c.current.setEnergy(4.9);
-      25           1 :         minEnergy.process(&c);
-      26           1 :         EXPECT_FALSE(c.isActive());
-      27           2 :         EXPECT_TRUE(c.hasProperty("Rejected"));
-      28           2 : }
-      29             : 
-      30           1 : TEST(MinimumChargeNumber, test) {
-      31           1 :         MinimumChargeNumber minChargeNumber(20);
-      32           1 :         Candidate c;
-      33             : 
-      34           1 :         c.current.setId(nucleusId(56, 26));
-      35           1 :         minChargeNumber.process(&c);
-      36           1 :         EXPECT_TRUE(c.isActive());
-      37             :         
-      38           1 :         c.current.setId(-nucleusId(56, 26));
-      39           1 :         minChargeNumber.process(&c);
-      40           1 :         EXPECT_TRUE(c.isActive());
-      41             : 
-      42           1 :         c.current.setId(nucleusId(4, 2));
-      43           1 :         minChargeNumber.process(&c);
-      44           1 :         EXPECT_FALSE(c.isActive());
-      45           2 :         EXPECT_TRUE(c.hasProperty("Rejected"));
-      46             :         
-      47           1 :         c.setActive(true);
-      48           1 :         c.removeProperty("Rejected");
-      49             : 
-      50           1 :         c.current.setId(-nucleusId(4, 2));
-      51           1 :         minChargeNumber.process(&c);
-      52           1 :         EXPECT_FALSE(c.isActive());
-      53           2 :         EXPECT_TRUE(c.hasProperty("Rejected"));
-      54           2 : }
-      55             : 
-      56           1 : TEST(MinimumEnergyPerParticleId, test) {
-      57           1 :         MinimumEnergyPerParticleId minEnergy(1);
-      58           1 :         minEnergy.add(22, 10);
-      59           1 :         minEnergy.add(12, 2);
-      60           1 :         minEnergy.add(11, 20);
-      61             : 
-      62           1 :         Candidate c;
-      63             : 
-      64           1 :         c.current.setEnergy(20);
-      65           1 :         c.current.setId(22);
-      66           1 :         minEnergy.process(&c);
-      67           1 :         EXPECT_TRUE(c.isActive());
-      68             : 
-      69           1 :         c.current.setEnergy(5);
-      70           1 :         c.current.setId(22);
-      71           1 :         minEnergy.process(&c);
-      72           1 :         EXPECT_FALSE(c.isActive());
-      73           2 :         EXPECT_TRUE(c.hasProperty("Rejected"));
-      74             : 
-      75           1 :         c.setActive(true);
-      76           1 :         c.removeProperty("Rejected");
-      77             : 
-      78           1 :         c.current.setEnergy(10);
-      79           1 :         c.current.setId(11);
-      80           1 :         minEnergy.process(&c);
-      81           1 :         EXPECT_FALSE(c.isActive());
-      82           2 :         EXPECT_TRUE(c.hasProperty("Rejected"));
-      83             : 
-      84           1 :         c.setActive(true);
-      85           1 :         c.removeProperty("Rejected");
-      86             : 
-      87           1 :         c.current.setEnergy(5);
-      88           1 :         c.current.setId(12);
-      89           1 :         minEnergy.process(&c);
-      90           1 :         EXPECT_TRUE(c.isActive());      
-      91             : 
-      92           1 :         c.current.setEnergy(0.1);
-      93           1 :         c.current.setId(12);
-      94           1 :         minEnergy.process(&c);
-      95           1 :         EXPECT_FALSE(c.isActive());
-      96           2 :         EXPECT_TRUE(c.hasProperty("Rejected"));
-      97           1 : }
-      98             : 
-      99           1 : TEST(MaximumTrajectoryLength, test) {
-     100           1 :         MaximumTrajectoryLength maxLength(10);
-     101           1 :         Candidate c;
-     102             : 
-     103           1 :         c.setTrajectoryLength(9.9);
-     104           1 :         maxLength.process(&c);
-     105           1 :         EXPECT_TRUE(c.isActive());
-     106             : 
-     107           1 :         c.setTrajectoryLength(10.1);
-     108           1 :         maxLength.process(&c);
-     109           1 :         EXPECT_FALSE(c.isActive());
-     110           2 :         EXPECT_TRUE(c.hasProperty("Rejected"));
-     111           1 : }
-     112             : 
-     113           1 : TEST(MaximumTrajectoryLength, observer) {
-     114           1 :         MaximumTrajectoryLength maxLength(12);
-     115           1 :         maxLength.addObserverPosition(Vector3d(10, 0, 0));
-     116           1 :         Candidate c;
-     117           1 :         c.current.setPosition(Vector3d(5, 0, 0));
-     118             : 
-     119           1 :         c.setTrajectoryLength(5);
-     120           1 :         maxLength.process(&c);
-     121           1 :         EXPECT_TRUE(c.isActive());
-     122             : 
-     123           1 :         c.setTrajectoryLength(8);
-     124           1 :         maxLength.process(&c);
-     125           1 :         EXPECT_FALSE(c.isActive());
-     126           1 : }
-     127             : 
-     128           1 : TEST(MinimumRedshift, test) {
-     129           1 :         MinimumRedshift minZ; // default minimum redshift of 0
-     130           1 :         Candidate c;
-     131             : 
-     132           1 :         c.setRedshift(0.1);
-     133           1 :         minZ.process(&c);
-     134           1 :         EXPECT_TRUE(c.isActive());
-     135             : 
-     136           1 :         c.setRedshift(0);
-     137           1 :         minZ.process(&c);
-     138           1 :         EXPECT_FALSE(c.isActive());
-     139           2 :         EXPECT_TRUE(c.hasProperty("Rejected"));
-     140           2 : }
-     141             : 
-     142           1 : TEST(DetectionLength, test) {
-     143           1 :         DetectionLength detL(10);
-     144           1 :         detL.setMakeRejectedInactive(false);
-     145           1 :         Candidate c;
-     146           1 :         c.current.setPosition(Vector3d(5,0,0));
-     147             : 
-     148           1 :         c.setTrajectoryLength(2);
-     149           1 :         detL.process(&c);
-     150           1 :         EXPECT_TRUE(c.isActive());
-     151             :         
-     152           1 :         c.setCurrentStep(10);
-     153           1 :         c.setTrajectoryLength(12);
-     154           1 :         detL.process(&c);
-     155           1 :         EXPECT_TRUE(c.isActive());
-     156           2 :         EXPECT_TRUE(c.hasProperty("Rejected"));
-     157           2 : }
-     158             : 
-     159             : //** ============================= Observers ================================ */
-     160           1 : TEST(ObserverFeature, SmallSphere) {
-     161             :         // detect if the current position is inside and the previous outside of the sphere
-     162           1 :         Observer obs;
-     163           1 :         obs.add(new ObserverSurface(new Sphere (Vector3d(0, 0, 0), 1)));
-     164           1 :         Candidate c;
-     165           1 :         c.setNextStep(10);
-     166             : 
-     167             :         // no detection: particle was inside already
-     168           1 :         c.current.setPosition(Vector3d(0.9, 0, 0));
-     169           1 :         c.previous.setPosition(Vector3d(0.95, 0, 0));
-     170           1 :         obs.process(&c);
-     171           1 :         EXPECT_TRUE(c.isActive());
-     172             : 
-     173             :         // limit step
-     174           1 :         EXPECT_NEAR(c.getNextStep(), 0.1, 0.001);
-     175             : 
-     176             :         // detection: particle just entered
-     177           1 :         c.current.setPosition(Vector3d(0.9, 0, 0));
-     178           1 :         c.previous.setPosition(Vector3d(1.1, 0, 0));
-     179           1 :         obs.process(&c);
-     180           1 :         EXPECT_FALSE(c.isActive());
-     181           1 : }
-     182             : 
-     183           1 : TEST(ObserverFeature, LargeSphere) {
-     184             :         // detect if the current position is outside and the previous inside of the sphere
-     185           1 :         Observer obs;
-     186           1 :         obs.add(new ObserverSurface(new Sphere (Vector3d(0, 0, 0), 10)));
-     187           1 :         Candidate c;
-     188           1 :         c.setNextStep(10);
-     189             : 
-     190             :         // no detection: particle was outside already
-     191           1 :         c.current.setPosition(Vector3d(11, 0, 0));
-     192           1 :         c.previous.setPosition(Vector3d(10.5, 0, 0));
-     193           1 :         obs.process(&c);
-     194           1 :         EXPECT_TRUE(c.isActive());
-     195             : 
-     196             :         // limit step
-     197           1 :         EXPECT_DOUBLE_EQ(c.getNextStep(), 1);
-     198             : 
-     199             :         // detection: particle just left
-     200           1 :         c.current.setPosition(Vector3d(11, 0, 0));
-     201           1 :         c.previous.setPosition(Vector3d(9.5, 0, 0));
-     202           1 :         obs.process(&c);
-     203           1 :         EXPECT_FALSE(c.isActive());
-     204           1 : }
-     205             : 
-     206           1 : TEST(ObserverFeature, Point) {
-     207           1 :         Observer obs;
-     208           1 :         obs.add(new Observer1D());
-     209           1 :         Candidate c;
-     210           1 :         c.setNextStep(10);
-     211             : 
-     212             :         // no detection, limit step
-     213           1 :         c.current.setPosition(Vector3d(5, 0, 0));
-     214           1 :         obs.process(&c);
-     215           1 :         EXPECT_TRUE(c.isActive());
-     216             : 
-     217             :         // limit step
-     218           1 :         EXPECT_DOUBLE_EQ(5, c.getNextStep());
-     219             : 
-     220             :         // detection
-     221           1 :         c.current.setPosition(Vector3d(0, 0, 0));
-     222           1 :         obs.process(&c);
-     223           1 :         EXPECT_FALSE(c.isActive());
-     224           1 : }
-     225             : 
-     226           1 : TEST(ObserverFeature, DetectAll) {
-     227             :         // DetectAll should detect all candidates
-     228           1 :         Observer obs;
-     229           1 :         obs.add(new ObserverDetectAll());
-     230           1 :         Candidate c;
-     231           1 :         obs.process(&c);
-     232           1 :         EXPECT_FALSE(c.isActive());
-     233           1 : }
-     234             : 
-     235           1 : TEST(ObserverFeature, TimeEvolution) {
-     236           1 :   Observer obs;
-     237           1 :   obs.setDeactivateOnDetection(false);
-     238           2 :   obs.setFlag("Detected", "Detected");
-     239           1 :   obs.add(new ObserverTimeEvolution(5, 5, 2));
-     240           1 :   Candidate c;
-     241           1 :   c.setNextStep(10);
-     242           1 :   c.setTrajectoryLength(3);
-     243             :   
-     244             :   // no detection, limit next step
-     245           1 :   obs.process(&c);
-     246           1 :   EXPECT_TRUE(c.isActive());
-     247             : 
-     248             :   // limit step
-     249           1 :   EXPECT_DOUBLE_EQ(2, c.getNextStep());
-     250             :   
-     251             :   // detection one
-     252           1 :   c.setCurrentStep(0.1);
-     253           1 :   c.setTrajectoryLength(5);
-     254           1 :   obs.process(&c);
-     255           1 :   EXPECT_TRUE(c.isActive());
-     256           2 :   EXPECT_TRUE(c.hasProperty("Detected"));
-     257             : 
-     258             :   // delete property
-     259           1 :   c.removeProperty("Detected");
-     260           1 :   EXPECT_FALSE(c.hasProperty("Detected"));
-     261             : 
-     262             :   // detection two
-     263           1 :   c.setCurrentStep(0.1);
-     264           1 :   c.setTrajectoryLength(10.05);
-     265           1 :   obs.process(&c);
-     266           1 :   EXPECT_TRUE(c.isActive());
-     267           2 :   EXPECT_TRUE(c.hasProperty("Detected"));
-     268           1 : }
-     269             : 
-     270           1 : TEST(ObserverFeature, TimeEvolutionLog) {
-     271           1 :   Observer obs;
-     272           1 :   obs.setDeactivateOnDetection(false);
-     273           2 :   obs.setFlag("Detected", "Detected");
-     274             :   // usage of a log scaling for the observer
-     275             :   bool log = true;
-     276           1 :   obs.add(new ObserverTimeEvolution(5, 5, 2, log));
-     277           1 :   Candidate c;
-     278           1 :   c.setNextStep(10);
-     279           1 :   c.setTrajectoryLength(3);
-     280             :   
-     281             :   // no detection, limit next step
-     282           1 :   obs.process(&c);
-     283           1 :   EXPECT_TRUE(c.isActive());
-     284             : 
-     285             :   // limit step
-     286           1 :   EXPECT_DOUBLE_EQ(2, c.getNextStep());
-     287             :   
-     288             :   // detection one
-     289           1 :   c.setCurrentStep(0.1);
-     290           1 :   c.setTrajectoryLength(5);
-     291           1 :   obs.process(&c);
-     292           1 :   EXPECT_TRUE(c.isActive());
-     293           2 :   EXPECT_TRUE(c.hasProperty("Detected"));
-     294             : 
-     295             :   // delete property
-     296           1 :   c.removeProperty("Detected");
-     297           1 :   EXPECT_FALSE(c.hasProperty("Detected"));
-     298             : 
-     299             :   // detection two
-     300           1 :   c.setCurrentStep(0.1);
-     301           1 :   c.setTrajectoryLength(10.05);
-     302           1 :   obs.process(&c);
-     303           1 :   EXPECT_TRUE(c.isActive());
-     304           2 :   EXPECT_TRUE(c.hasProperty("Detected"));
-     305           1 : }
-     306             : 
-     307             : //** ========================= Boundaries =================================== */
-     308           2 : TEST(PeriodicBox, high) {
-     309             :         // Tests if the periodical boundaries place the particle back inside the box and translate the initial position accordingly.
-     310             :         Vector3d origin(2, 2, 2);
-     311             :         Vector3d size(2, 2, 2);
-     312           1 :         PeriodicBox box(origin, size);
-     313             : 
-     314           1 :         Candidate c;
-     315           1 :         c.current.setPosition(Vector3d(4.5, 4.3, 4.4));
-     316           1 :         c.created.setPosition(Vector3d(3, 3, 3));
-     317             : 
-     318           1 :         box.process(&c);
-     319             : 
-     320           1 :         EXPECT_DOUBLE_EQ(2.5, c.current.getPosition().x);
-     321           1 :         EXPECT_DOUBLE_EQ(1, c.created.getPosition().x);
-     322           1 :         EXPECT_DOUBLE_EQ(2.3, c.current.getPosition().y);
-     323           1 :         EXPECT_DOUBLE_EQ(1, c.created.getPosition().y);
-     324           1 :         EXPECT_DOUBLE_EQ(2.4, c.current.getPosition().z);
-     325           1 :         EXPECT_DOUBLE_EQ(1, c.created.getPosition().z);
-     326           2 : }
-     327             : 
-     328           2 : TEST(PeriodicBox, low) {
-     329             :         // Tests if the periodical boundaries place the particle back inside the box and translate the initial position accordingly.
-     330             :         Vector3d origin(0, 0, 0);
-     331             :         Vector3d size(2, 2, 2);
-     332           1 :         PeriodicBox box(origin, size);
-     333             : 
-     334           1 :         Candidate c;
-     335           1 :         c.current.setPosition(Vector3d(-2.5, -0.3, -0.4));
-     336           1 :         c.created.setPosition(Vector3d(1, 1, 1));
-     337             : 
-     338           1 :         box.process(&c);
-     339             : 
-     340           1 :         EXPECT_DOUBLE_EQ(1.5, c.current.getPosition().x);
-     341           1 :         EXPECT_DOUBLE_EQ(5, c.created.getPosition().x);
-     342           1 :         EXPECT_DOUBLE_EQ(1.7, c.current.getPosition().y);
-     343           1 :         EXPECT_DOUBLE_EQ(3, c.created.getPosition().y);
-     344           1 :         EXPECT_DOUBLE_EQ(1.6, c.current.getPosition().z);
-     345           1 :         EXPECT_DOUBLE_EQ(3, c.created.getPosition().z);
-     346           2 : }
-     347             : 
-     348           2 : TEST(ReflectiveBox, high) {
-     349             :         // Tests if the reflective boundaries place the particle back inside the box and translate the initial position accordingly.
-     350             :         // Also the initial and final directions are to be reflected
-     351             :         Vector3d origin(10, 10, 10);
-     352             :         Vector3d size(10, 20, 20);
-     353           1 :         ReflectiveBox box(origin, size);
-     354             : 
-     355           1 :         Candidate c;
-     356           1 :         c.source.setPosition(Vector3d(16, 17, 18));
-     357           1 :         c.source.setDirection(Vector3d(1, 1.6, 1.8));
-     358           1 :         c.created.setPosition(Vector3d(15, 15, 15));
-     359           1 :         c.created.setDirection(Vector3d(0, 0.6, 0.8));
-     360           1 :         c.previous.setPosition(Vector3d(15, 15, 29.5));
-     361           1 :         c.previous.setDirection(Vector3d(0, 0.6, 0.8));
-     362           1 :         c.current.setPosition(Vector3d(15, 15, 30.5));
-     363           1 :         c.current.setDirection(Vector3d(0, 0.6, 0.8));
-     364             : 
-     365           1 :         box.process(&c);
-     366             : 
-     367           1 :         EXPECT_DOUBLE_EQ(16, c.source.getPosition().x);
-     368           1 :         EXPECT_DOUBLE_EQ(17, c.source.getPosition().y);
-     369           1 :         EXPECT_DOUBLE_EQ(42, c.source.getPosition().z);
-     370             : 
-     371           1 :         EXPECT_DOUBLE_EQ(15, c.created.getPosition().x);
-     372           1 :         EXPECT_DOUBLE_EQ(15, c.created.getPosition().y);
-     373           1 :         EXPECT_DOUBLE_EQ(45, c.created.getPosition().z);
-     374             : 
-     375           1 :         EXPECT_DOUBLE_EQ(15, c.previous.getPosition().x);
-     376           1 :         EXPECT_DOUBLE_EQ(15, c.previous.getPosition().y);
-     377           1 :         EXPECT_DOUBLE_EQ(30.5, c.previous.getPosition().z);
-     378             : 
-     379           1 :         EXPECT_DOUBLE_EQ(15, c.current.getPosition().x);
-     380           1 :         EXPECT_DOUBLE_EQ(15, c.current.getPosition().y);
-     381           1 :         EXPECT_DOUBLE_EQ(29.5, c.current.getPosition().z);
-     382             : 
-     383           1 :         EXPECT_DOUBLE_EQ(0, c.created.getDirection().x);
-     384           1 :         EXPECT_DOUBLE_EQ(0.6, c.created.getDirection().y);
-     385           1 :         EXPECT_DOUBLE_EQ(-0.8, c.created.getDirection().z);
-     386             : 
-     387           1 :         EXPECT_DOUBLE_EQ(0, c.previous.getDirection().x);
-     388           1 :         EXPECT_DOUBLE_EQ(0.6, c.previous.getDirection().y);
-     389           1 :         EXPECT_DOUBLE_EQ(-0.8, c.previous.getDirection().z);
-     390             : 
-     391           1 :         EXPECT_DOUBLE_EQ(0, c.current.getDirection().x);
-     392           1 :         EXPECT_DOUBLE_EQ(0.6, c.current.getDirection().y);
-     393           1 :         EXPECT_DOUBLE_EQ(-0.8, c.current.getDirection().z);
-     394           2 : }
-     395             : 
-     396           2 : TEST(CubicBoundary, inside) {
-     397           1 :         CubicBoundary cube(Vector3d(0, 0, 0), 10);
-     398           1 :         Candidate c;
-     399           1 :         c.current.setPosition(Vector3d(9, 5, 5));
-     400           1 :         cube.process(&c);
-     401           1 :         EXPECT_TRUE(c.isActive());
-     402           2 : }
-     403             : 
-     404           2 : TEST(CubicBoundary, outside) {
-     405           1 :         CubicBoundary cube(Vector3d(0, 0, 0), 10);
-     406           1 :         Candidate c;
-     407           1 :         c.current.setPosition(Vector3d(10.1, 5, 5));
-     408           1 :         cube.process(&c);
-     409           1 :         EXPECT_FALSE(c.isActive());
-     410           2 :         EXPECT_TRUE(c.hasProperty("Rejected"));
-     411           2 : }
-     412             : 
-     413           2 : TEST(CubicBoundary, limitStepLower) {
-     414           1 :         CubicBoundary cube(Vector3d(10, 10, 10), 10);
-     415           1 :         cube.setLimitStep(true);
-     416           1 :         cube.setMargin(1);
-     417           1 :         Candidate c;
-     418           1 :         c.current.setPosition(Vector3d(15, 15, 10.5));
-     419           1 :         c.setNextStep(100);
-     420           1 :         cube.process(&c);
-     421           1 :         EXPECT_DOUBLE_EQ(1.5, c.getNextStep());
-     422           2 : }
-     423             : 
-     424           2 : TEST(CubicBoundary, limitStepUpper) {
-     425           1 :         CubicBoundary cube(Vector3d(-10, -10, -10), 10);
-     426           1 :         cube.setLimitStep(true);
-     427           1 :         cube.setMargin(1);
-     428           1 :         Candidate c;
-     429           1 :         c.current.setPosition(Vector3d(-5, -5, -0.5));
-     430           1 :         c.setNextStep(100);
-     431           1 :         cube.process(&c);
-     432           1 :         EXPECT_DOUBLE_EQ(1.5, c.getNextStep());
-     433           2 : }
-     434             : 
-     435           2 : TEST(SphericalBoundary, inside) {
-     436           1 :         SphericalBoundary sphere(Vector3d(0, 0, 0), 10);
-     437           1 :         Candidate c;
-     438           1 :         c.current.setPosition(Vector3d(9, 0, 0));
-     439           1 :         sphere.process(&c);
-     440           1 :         EXPECT_TRUE(c.isActive());
-     441           1 :         EXPECT_FALSE(c.hasProperty("Rejected"));
-     442           2 : }
-     443             : 
-     444           2 : TEST(SphericalBoundary, outside) {
-     445           1 :         SphericalBoundary sphere(Vector3d(0, 0, 0), 10);
-     446           2 :         sphere.setRejectFlag("I passed the galactic border", "Nothing happened");
-     447           1 :         Candidate c;
-     448           1 :         c.current.setPosition(Vector3d(0, -10.1, 0));
-     449           1 :         sphere.process(&c);
-     450           1 :         EXPECT_FALSE(c.isActive());
-     451           2 :         EXPECT_TRUE(c.hasProperty("I passed the galactic border"));
-     452           2 : }
-     453             : 
-     454           2 : TEST(SphericalBoundary, limitStep) {
-     455           1 :         SphericalBoundary sphere(Vector3d(0, 0, 0), 10);
-     456           1 :         sphere.setLimitStep(true);
-     457           1 :         sphere.setMargin(1);
-     458           1 :         Candidate c;
-     459           1 :         c.setNextStep(100);
-     460           1 :         c.current.setPosition(Vector3d(0, 0, 9.5));
-     461           1 :         sphere.process(&c);
-     462           1 :         EXPECT_DOUBLE_EQ(1.5, c.getNextStep());
-     463           2 : }
-     464             : 
-     465           2 : TEST(EllipsoidalBoundary, inside) {
-     466           1 :         EllipsoidalBoundary ellipsoid(Vector3d(-5, 0, 0), Vector3d(5, 0, 0), 15);
-     467           1 :         Candidate c;
-     468           1 :         c.current.setPosition(Vector3d(3, 2, 0));
-     469           1 :         ellipsoid.process(&c);
-     470           1 :         EXPECT_TRUE(c.isActive());
-     471           1 :         EXPECT_FALSE(c.hasProperty("Rejected"));
-     472           2 : }
-     473             : 
-     474           2 : TEST(EllipsoidalBoundary, outside) {
-     475           1 :         EllipsoidalBoundary ellipsoid(Vector3d(-5, 0, 0), Vector3d(5, 0, 0), 15);
-     476           1 :         Candidate c;
-     477           1 :         c.current.setPosition(Vector3d(0, 25, 0));
-     478           1 :         ellipsoid.process(&c);
-     479           1 :         EXPECT_FALSE(c.isActive());
-     480           2 :         EXPECT_TRUE(c.hasProperty("Rejected"));
-     481           2 : }
-     482             : 
-     483           2 : TEST(EllipsoidalBoundary, limitStep) {
-     484           1 :         EllipsoidalBoundary ellipsoid(Vector3d(-5, 0, 0), Vector3d(5, 0, 0), 15);
-     485           1 :         ellipsoid.setLimitStep(true);
-     486           1 :         ellipsoid.setMargin(0.5);
-     487           1 :         Candidate c;
-     488           1 :         c.setNextStep(2);
-     489           1 :         c.current.setPosition(Vector3d(7, 0, 0));
-     490           1 :         ellipsoid.process(&c);
-     491           1 :         EXPECT_DOUBLE_EQ(c.getNextStep(), 1.5);
-     492           2 : }
-     493             : 
-     494           2 : TEST(CylindricalBoundary, inside) {
-     495           1 :         CylindricalBoundary cylinder(Vector3d(0, 0, 0), 2, 15);
-     496           1 :         Candidate c;
-     497           1 :         c.current.setPosition(Vector3d(6, -3, 0.5));
-     498           1 :         cylinder.process(&c);
-     499           1 :         EXPECT_TRUE(c.isActive());
-     500           1 :         EXPECT_FALSE(c.hasProperty("Rejected"));
-     501           2 : }
-     502             : 
-     503           2 : TEST(CylindricalBoundary, outside) {
-     504           1 :         CylindricalBoundary cylinder(Vector3d(0, 0, 0), 2, 15);
-     505           1 :         Candidate c;
-     506           1 :         c.current.setPosition(Vector3d(6, -3, 1.5));
-     507           1 :         cylinder.process(&c);
-     508           1 :         EXPECT_FALSE(c.isActive());
-     509           2 :         EXPECT_TRUE(c.hasProperty("Rejected"));
-     510           2 : }
-     511             : 
-     512           2 : TEST(CylindricalBoundary, limitStep) {
-     513           1 :         CylindricalBoundary cylinder(Vector3d(0, 0, 0), 2, 15);
-     514           1 :         cylinder.setLimitStep(true);
-     515           1 :         cylinder.setMargin(0.5);
-     516           1 :         Candidate c;
-     517           1 :         c.setNextStep(2);
-     518           1 :         c.current.setPosition(Vector3d(7, 0, 0));
-     519           1 :         cylinder.process(&c);
-     520           1 :         EXPECT_DOUBLE_EQ(c.getNextStep(), 1.5);
-     521           2 : }
-     522             : 
-     523           1 : TEST(RestrictToRegion, RestrictToRegion) {
-     524             : 
-     525           1 :         ref_ptr<Observer> obs = new Observer();
-     526           1 :         obs->add(new ObserverDetectAll());
-     527           1 :         RestrictToRegion R(obs, new Sphere(Vector3d(0, 0, 0), 10));
-     528             : 
-     529           1 :         Candidate c;
-     530           1 :         c.previous.setPosition(Vector3d(13,0,0));
-     531           1 :         c.current.setPosition(Vector3d(12,0,0));
-     532           1 :         R.process(&c);
-     533           1 :         EXPECT_TRUE(c.isActive());
-     534           1 :         c.current.setPosition(Vector3d(9,0,0));
-     535           1 :         R.process(&c);
-     536           1 :         EXPECT_FALSE(c.isActive());
-     537           2 : }
-     538             : 
-     539             : 
-     540           0 : int main(int argc, char **argv) {
-     541           0 :         ::testing::InitGoogleTest(&argc, argv);
-     542           0 :         return RUN_ALL_TESTS();
-     543             : }
-     544             : 
-     545             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testCandidateSplitting.cpp.func-sort-c.html b/doc/coverageReport/test/testCandidateSplitting.cpp.func-sort-c.html deleted file mode 100644 index fd272427c..000000000 --- a/doc/coverageReport/test/testCandidateSplitting.cpp.func-sort-c.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testCandidateSplitting.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testCandidateSplitting.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:4747100.0 %
Date:2024-04-08 14:58:22Functions:22100.0 %
-
- -
- - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa38testCandidateSplitting_SimpleTest_Test8TestBodyEv1
_ZN7crpropa39testCandidateSplitting_CheckSplits_Test8TestBodyEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testCandidateSplitting.cpp.func.html b/doc/coverageReport/test/testCandidateSplitting.cpp.func.html deleted file mode 100644 index 5940d2ea4..000000000 --- a/doc/coverageReport/test/testCandidateSplitting.cpp.func.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testCandidateSplitting.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testCandidateSplitting.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:4747100.0 %
Date:2024-04-08 14:58:22Functions:22100.0 %
-
- -
- - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa38testCandidateSplitting_SimpleTest_Test8TestBodyEv1
_ZN7crpropa39testCandidateSplitting_CheckSplits_Test8TestBodyEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testCandidateSplitting.cpp.gcov.html b/doc/coverageReport/test/testCandidateSplitting.cpp.gcov.html deleted file mode 100644 index 7f7795772..000000000 --- a/doc/coverageReport/test/testCandidateSplitting.cpp.gcov.html +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testCandidateSplitting.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testCandidateSplitting.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:4747100.0 %
Date:2024-04-08 14:58:22Functions:22100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/Units.h"
-       2             : #include "crpropa/Common.h"
-       3             : #include "crpropa/ParticleID.h"
-       4             : #include "crpropa/module/CandidateSplitting.h"
-       5             : 
-       6             : #include "gtest/gtest.h"
-       7             : #include <stdexcept>
-       8             : #include <cmath>
-       9             : 
-      10             : namespace crpropa {
-      11             : 
-      12           1 : TEST(testCandidateSplitting, SimpleTest) {
-      13           1 :         int nSplit = 2;
-      14             :         int nBins = 4;
-      15             :         double minWeight = pow(1. / nSplit, 2);
-      16             :         double Emin = 1; // dimensionless for testing
-      17             :         double Emax = 10;       
-      18             : 
-      19           1 :         CandidateSplitting split_lin(nSplit, Emin, Emax, nBins, minWeight);
-      20             :         double dE = (Emax - Emin) / nBins;
-      21           1 :         EXPECT_DOUBLE_EQ(split_lin.getEnergyBins()[0], Emin);
-      22           1 :         EXPECT_DOUBLE_EQ(split_lin.getEnergyBins()[1], Emin + dE);
-      23             : 
-      24           1 :         EXPECT_EQ(split_lin.getNsplit(), nSplit);
-      25           1 :         EXPECT_DOUBLE_EQ(split_lin.getMinimalWeight(), minWeight);
-      26             : 
-      27           2 :         CandidateSplitting split_log(nSplit, Emin, Emax, nBins, minWeight, true);
-      28             :         double dE_log = pow(Emax / Emin, 1. / (nBins - 1.0));
-      29           1 :         EXPECT_DOUBLE_EQ(split_log.getEnergyBins()[0], Emin);
-      30           1 :         EXPECT_DOUBLE_EQ(split_log.getEnergyBins()[1], Emin * dE_log);
-      31             : 
-      32             :         double spectralIndex = -2.;
-      33           2 :         CandidateSplitting split_dsa(spectralIndex, Emin, nBins);
-      34             :         double dE_dsa = pow(1. / 2, 1. / (spectralIndex + 1));
-      35           1 :         EXPECT_DOUBLE_EQ(split_dsa.getEnergyBins()[0], Emin * dE_dsa);
-      36           1 :         EXPECT_DOUBLE_EQ(split_dsa.getEnergyBins()[nBins - 1], Emin * pow(dE_dsa, nBins));
-      37           1 : }
-      38             : 
-      39             : 
-      40           1 : TEST(testCandidateSplitting, CheckSplits) {
-      41             :         int nSplit = 2;
-      42             :         int nBins = 3;
-      43             :         double Emin = 1; // dimensionless for testing
-      44             :         double Emax = 10;
-      45             :         double minWeight = pow(1. / nSplit, 4);
-      46             : 
-      47           1 :         CandidateSplitting splitting(nSplit, Emin, Emax, nBins, minWeight);
-      48           1 :         Candidate c(nucleusId(1,1),0.5);
-      49             :         double weight = 1.0;
-      50           1 :         double serial = c.getSerialNumber();
-      51             :         
-      52           1 :         splitting.process(&c); // no split
-      53           1 :         EXPECT_DOUBLE_EQ(c.getWeight(), weight);
-      54           1 :         EXPECT_DOUBLE_EQ(c.getNextSerialNumber(), serial);
-      55             : 
-      56           1 :         c.current.setEnergy(2); 
-      57           1 :         splitting.process(&c); // 1. split
-      58             :         weight = weight/nSplit;
-      59           1 :         EXPECT_DOUBLE_EQ(c.getWeight(), weight);
-      60           1 :         EXPECT_DOUBLE_EQ(c.getNextSerialNumber(), serial + 1);
-      61           1 :         c.previous.setEnergy(2);
-      62             : 
-      63           1 :         c.current.setEnergy(6); 
-      64           1 :         splitting.process(&c); // 2. split
-      65             :         weight = weight/nSplit;
-      66           1 :         EXPECT_DOUBLE_EQ(c.getWeight(), weight);
-      67           1 :         EXPECT_DOUBLE_EQ(c.getNextSerialNumber(), serial + 2);
-      68           1 :         c.previous.setEnergy(6);
-      69             : 
-      70           1 :         c.current.setEnergy(0.5); 
-      71           1 :         splitting.process(&c); // no split, cooling
-      72           1 :         EXPECT_DOUBLE_EQ(c.getWeight(), weight);
-      73           1 :         EXPECT_DOUBLE_EQ(c.getNextSerialNumber(), serial + 2);
-      74           1 :         c.previous.setEnergy(0.5);
-      75             : 
-      76           1 :         c.current.setEnergy(6); 
-      77           1 :         splitting.process(&c); // 3. & 4. split, crosses two boundaries
-      78             :         weight = weight/nSplit/nSplit;
-      79           1 :         EXPECT_DOUBLE_EQ(c.getWeight(), weight);
-      80           1 :         EXPECT_DOUBLE_EQ(c.getNextSerialNumber(), serial + 4);
-      81           1 :         c.previous.setEnergy(6);
-      82             : 
-      83           1 :         c.current.setEnergy(8); 
-      84           1 :         splitting.process(&c); // no split, minimal weight reached
-      85           1 :         EXPECT_DOUBLE_EQ(c.getWeight(), weight);
-      86           1 :         EXPECT_DOUBLE_EQ(c.getNextSerialNumber(), serial + 4);
-      87           1 :         c.previous.setEnergy(8);
-      88           1 : }
-      89             : 
-      90             : } //namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testCore.cpp.func-sort-c.html b/doc/coverageReport/test/testCore.cpp.func-sort-c.html deleted file mode 100644 index d65894f63..000000000 --- a/doc/coverageReport/test/testCore.cpp.func-sort-c.html +++ /dev/null @@ -1,308 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testCore.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testCore.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:65465799.5 %
Date:2024-04-08 14:58:22Functions:585998.3 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa4mainEiPPc0
_ZN7crpropa16Random_seed_Test8TestBodyEv1
_ZN7crpropa17Grid3f_Speed_Test8TestBodyEv1
_ZN7crpropa17common_digit_Test8TestBodyEv1
_ZN7crpropa18HepPID_charge_Test8TestBodyEv1
_ZN7crpropa19Geometry_Plane_Test8TestBodyEv1
_ZN7crpropa20Geometry_Sphere_Test8TestBodyEv1
_ZN7crpropa20Grid3f_DumpLoad_Test8TestBodyEv1
_ZN7crpropa20common_gaussInt_Test8TestBodyEv1
_ZN7crpropa21Candidate_weight_Test8TestBodyEv1
_ZN7crpropa21ParticleState_id_Test8TestBodyEv1
_ZN7crpropa22EmissionMap_merge_Test8TestBodyEv1
_ZN7crpropa22Grid1f_SimpleTest_Test8TestBodyEv1
_ZN7crpropa22Grid1f_clipVolume_Test8TestBodyEv1
_ZN7crpropa22Random_base64Seed_Test8TestBodyEv1
_ZN7crpropa22VectordGrid_Scale_Test8TestBodyEv1
_ZN7crpropa23Candidate_isActive_Test8TestBodyEv1
_ZN7crpropa23Candidate_property_Test8TestBodyEv1
_ZN7crpropa23Grid3f_DumpLoadTxt_Test8TestBodyEv1
_ZN7crpropa23Grid3f_Periodicity_Test8TestBodyEv1
_ZN7crpropa23Grid_PeriodicClamp_Test8TestBodyEv1
_ZN7crpropa23ParticleState_Mass_Test8TestBodyEv1
_ZN7crpropa23common_interpolate_Test8TestBodyEv1
_ZN7crpropa23common_pow_integer_Test8TestBodyEv1
_ZN7crpropa24Grid1f_ClosestValue_Test8TestBodyEv1
_ZN7crpropa24Grid3f_Reflectivity_Test8TestBodyEv1
_ZN7crpropa24base64_de_en_coding_Test8TestBodyEv1
_ZN7crpropa25Geometry_ParaxialBox_Test8TestBodyEv1
_ZN7crpropa25Grid3f_Interpolation_Test8TestBodyEv1
_ZN7crpropa25Grid_ReflectiveClamp_Test8TestBodyEv1
_ZN7crpropa25ParticleID_isNucleus_Test8TestBodyEv1
_ZN7crpropa25ParticleID_nucleusId_Test8TestBodyEv1
_ZN7crpropa25ParticleState_Charge_Test8TestBodyEv1
_ZN7crpropa25ParticleState_energy_Test8TestBodyEv1
_ZN7crpropa25Variant_copyToBuffer_Test8TestBodyEv1
_ZN7crpropa26Candidate_currentStep_Test8TestBodyEv1
_ZN7crpropa26EmissionMap_functions_Test8TestBodyEv1
_ZN7crpropa26Grid_PeriodicBoundary_Test8TestBodyEv1
_ZN7crpropa26ParticleID_massNumber_Test8TestBodyEv1
_ZN7crpropa26Random_bigSeedStorage_Test8TestBodyEv1
_ZN7crpropa27Candidate_addSecondary_Test8TestBodyEv1
_ZN7crpropa27Candidate_candidateTag_Test8TestBodyEv1
_ZN7crpropa27Candidate_serialNumber_Test8TestBodyEv1
_ZN7crpropa27ParticleState_Rigidity_Test8TestBodyEv1
_ZN7crpropa27ParticleState_momentum_Test8TestBodyEv1
_ZN7crpropa27ParticleState_position_Test8TestBodyEv1
_ZN7crpropa27ParticleState_velocity_Test8TestBodyEv1
_ZN7crpropa28Candidate_limitNextStep_Test8TestBodyEv1
_ZN7crpropa28Grid_ReflectiveBoundary_Test8TestBodyEv1
_ZN7crpropa28ParticleID_chargeNumber_Test8TestBodyEv1
_ZN7crpropa28ParticleState_direction_Test8TestBodyEv1
_ZN7crpropa29Grid1f_TestVectorSpacing_Test8TestBodyEv1
_ZN7crpropa29Variant_stringConversion_Test8TestBodyEv1
_ZN7crpropa30ParticleState_idException_Test8TestBodyEv1
_ZN7crpropa32ParticleState_lorentzFactor_Test8TestBodyEv1
_ZN7crpropa34common_interpolateEquidistant_Test8TestBodyEv1
_ZN7crpropa37Grid1f_GridPropertiesConstructor_Test8TestBodyEv1
_ZN7crpropa39CylindricalProjectionMap_functions_Test8TestBodyEv1
_ZN7crpropa50HepPID_consistencyWithReferenceImplementation_Test8TestBodyEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testCore.cpp.func.html b/doc/coverageReport/test/testCore.cpp.func.html deleted file mode 100644 index 1336167ed..000000000 --- a/doc/coverageReport/test/testCore.cpp.func.html +++ /dev/null @@ -1,308 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testCore.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testCore.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:65465799.5 %
Date:2024-04-08 14:58:22Functions:585998.3 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16Random_seed_Test8TestBodyEv1
_ZN7crpropa17Grid3f_Speed_Test8TestBodyEv1
_ZN7crpropa17common_digit_Test8TestBodyEv1
_ZN7crpropa18HepPID_charge_Test8TestBodyEv1
_ZN7crpropa19Geometry_Plane_Test8TestBodyEv1
_ZN7crpropa20Geometry_Sphere_Test8TestBodyEv1
_ZN7crpropa20Grid3f_DumpLoad_Test8TestBodyEv1
_ZN7crpropa20common_gaussInt_Test8TestBodyEv1
_ZN7crpropa21Candidate_weight_Test8TestBodyEv1
_ZN7crpropa21ParticleState_id_Test8TestBodyEv1
_ZN7crpropa22EmissionMap_merge_Test8TestBodyEv1
_ZN7crpropa22Grid1f_SimpleTest_Test8TestBodyEv1
_ZN7crpropa22Grid1f_clipVolume_Test8TestBodyEv1
_ZN7crpropa22Random_base64Seed_Test8TestBodyEv1
_ZN7crpropa22VectordGrid_Scale_Test8TestBodyEv1
_ZN7crpropa23Candidate_isActive_Test8TestBodyEv1
_ZN7crpropa23Candidate_property_Test8TestBodyEv1
_ZN7crpropa23Grid3f_DumpLoadTxt_Test8TestBodyEv1
_ZN7crpropa23Grid3f_Periodicity_Test8TestBodyEv1
_ZN7crpropa23Grid_PeriodicClamp_Test8TestBodyEv1
_ZN7crpropa23ParticleState_Mass_Test8TestBodyEv1
_ZN7crpropa23common_interpolate_Test8TestBodyEv1
_ZN7crpropa23common_pow_integer_Test8TestBodyEv1
_ZN7crpropa24Grid1f_ClosestValue_Test8TestBodyEv1
_ZN7crpropa24Grid3f_Reflectivity_Test8TestBodyEv1
_ZN7crpropa24base64_de_en_coding_Test8TestBodyEv1
_ZN7crpropa25Geometry_ParaxialBox_Test8TestBodyEv1
_ZN7crpropa25Grid3f_Interpolation_Test8TestBodyEv1
_ZN7crpropa25Grid_ReflectiveClamp_Test8TestBodyEv1
_ZN7crpropa25ParticleID_isNucleus_Test8TestBodyEv1
_ZN7crpropa25ParticleID_nucleusId_Test8TestBodyEv1
_ZN7crpropa25ParticleState_Charge_Test8TestBodyEv1
_ZN7crpropa25ParticleState_energy_Test8TestBodyEv1
_ZN7crpropa25Variant_copyToBuffer_Test8TestBodyEv1
_ZN7crpropa26Candidate_currentStep_Test8TestBodyEv1
_ZN7crpropa26EmissionMap_functions_Test8TestBodyEv1
_ZN7crpropa26Grid_PeriodicBoundary_Test8TestBodyEv1
_ZN7crpropa26ParticleID_massNumber_Test8TestBodyEv1
_ZN7crpropa26Random_bigSeedStorage_Test8TestBodyEv1
_ZN7crpropa27Candidate_addSecondary_Test8TestBodyEv1
_ZN7crpropa27Candidate_candidateTag_Test8TestBodyEv1
_ZN7crpropa27Candidate_serialNumber_Test8TestBodyEv1
_ZN7crpropa27ParticleState_Rigidity_Test8TestBodyEv1
_ZN7crpropa27ParticleState_momentum_Test8TestBodyEv1
_ZN7crpropa27ParticleState_position_Test8TestBodyEv1
_ZN7crpropa27ParticleState_velocity_Test8TestBodyEv1
_ZN7crpropa28Candidate_limitNextStep_Test8TestBodyEv1
_ZN7crpropa28Grid_ReflectiveBoundary_Test8TestBodyEv1
_ZN7crpropa28ParticleID_chargeNumber_Test8TestBodyEv1
_ZN7crpropa28ParticleState_direction_Test8TestBodyEv1
_ZN7crpropa29Grid1f_TestVectorSpacing_Test8TestBodyEv1
_ZN7crpropa29Variant_stringConversion_Test8TestBodyEv1
_ZN7crpropa30ParticleState_idException_Test8TestBodyEv1
_ZN7crpropa32ParticleState_lorentzFactor_Test8TestBodyEv1
_ZN7crpropa34common_interpolateEquidistant_Test8TestBodyEv1
_ZN7crpropa37Grid1f_GridPropertiesConstructor_Test8TestBodyEv1
_ZN7crpropa39CylindricalProjectionMap_functions_Test8TestBodyEv1
_ZN7crpropa4mainEiPPc0
_ZN7crpropa50HepPID_consistencyWithReferenceImplementation_Test8TestBodyEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testCore.cpp.gcov.html b/doc/coverageReport/test/testCore.cpp.gcov.html deleted file mode 100644 index 3e1716747..000000000 --- a/doc/coverageReport/test/testCore.cpp.gcov.html +++ /dev/null @@ -1,1144 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testCore.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testCore.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:65465799.5 %
Date:2024-04-08 14:58:22Functions:585998.3 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : /** Unit tests for core features of CRPropa
-       2             :         Candidate
-       3             :         ParticleState
-       4             :         Random
-       5             :         Common functions
-       6             :  */
-       7             : 
-       8             : #include <complex>
-       9             : 
-      10             : #include "crpropa/Candidate.h"
-      11             : #include "crpropa/base64.h"
-      12             : #include "crpropa/Common.h"
-      13             : #include "crpropa/Units.h"
-      14             : #include "crpropa/ParticleID.h"
-      15             : #include "crpropa/ParticleMass.h"
-      16             : #include "crpropa/Random.h"
-      17             : #include "crpropa/Grid.h"
-      18             : #include "crpropa/GridTools.h"
-      19             : #include "crpropa/Geometry.h"
-      20             : #include "crpropa/EmissionMap.h"
-      21             : #include "crpropa/Vector3.h"
-      22             : 
-      23             : #include <HepPID/ParticleIDMethods.hh>
-      24             : #include "gtest/gtest.h"
-      25             : 
-      26             : namespace crpropa {
-      27             : 
-      28           2 : TEST(ParticleState, position) {
-      29           1 :         ParticleState particle;
-      30             :         Vector3d v(1, 3, 5);
-      31           1 :         particle.setPosition(v * Mpc);
-      32           2 :         EXPECT_TRUE(particle.getPosition() == v * Mpc);
-      33           1 : }
-      34             : 
-      35           2 : TEST(ParticleState, energy) {
-      36           1 :         ParticleState particle;
-      37           1 :         particle.setEnergy(10 * EeV);
-      38           1 :         EXPECT_EQ(particle.getEnergy(), 10 * EeV);
-      39           1 : }
-      40             : 
-      41           2 : TEST(ParticleState, direction) {
-      42           1 :         ParticleState particle;
-      43             :         Vector3d v(1, 2, 3);
-      44           1 :         particle.setDirection(v);
-      45           2 :         EXPECT_TRUE(particle.getDirection() == v.getUnitVector());
-      46           1 : }
-      47             : 
-      48           2 : TEST(ParticleState, velocity) {
-      49           1 :         ParticleState particle;
-      50             :         Vector3d v(1, 1, 0);
-      51           1 :         particle.setDirection(v);
-      52           2 :         EXPECT_TRUE(particle.getVelocity() == v.getUnitVector() * c_light);
-      53           1 : }
-      54             : 
-      55           2 : TEST(ParticleState, momentum) {
-      56           1 :         ParticleState particle;
-      57             :         Vector3d v(0, 1, 0);
-      58           1 :         particle.setDirection(v);
-      59           1 :         particle.setEnergy(100 * EeV);
-      60           2 :         EXPECT_TRUE(particle.getMomentum() == v * (particle.getEnergy() / c_light));
-      61           1 : }
-      62             : 
-      63           2 : TEST(ParticleState, id) {
-      64           1 :         ParticleState particle;
-      65           1 :         particle.setId(nucleusId(12, 6));
-      66           1 :         EXPECT_EQ(particle.getId(), 1000060120);
-      67           1 : }
-      68             : 
-      69             : #ifndef CRPROPA_TESTS_SKIP_EXCEPTIONS
-      70           1 : TEST(ParticleState, idException) {
-      71           1 :         EXPECT_THROW(nucleusId(5, 6), std::runtime_error);
-      72           1 : }
-      73             : #endif
-      74             : 
-      75           2 : TEST(ParticleState, Charge) {
-      76           1 :         ParticleState particle;
-      77             : 
-      78           1 :         particle.setId(nucleusId(56, 26)); // iron
-      79           1 :         EXPECT_DOUBLE_EQ(26 * eplus, particle.getCharge());
-      80             : 
-      81           1 :         particle.setId(-nucleusId(56, 26)); // anti-iron
-      82           1 :         EXPECT_DOUBLE_EQ(-26 * eplus, particle.getCharge());
-      83             : 
-      84           1 :         particle.setId(11); // electron
-      85           1 :         EXPECT_DOUBLE_EQ(-1 * eplus, particle.getCharge());
-      86             : 
-      87           1 :         particle.setId(-11); // positron
-      88           1 :         EXPECT_DOUBLE_EQ(1 * eplus, particle.getCharge());
-      89             : 
-      90           1 :         particle.setId(12); // electron neutrino
-      91           1 :         EXPECT_DOUBLE_EQ(0, particle.getCharge());
-      92             : 
-      93           1 :         particle.setId(-12); // electron anti-neutrino
-      94           1 :         EXPECT_DOUBLE_EQ(0, particle.getCharge());
-      95           1 : }
-      96             : 
-      97           2 : TEST(ParticleState, Rigidity) {
-      98           1 :         ParticleState particle;
-      99             : 
-     100           1 :         particle.setId(nucleusId(1, 1)); // proton
-     101           1 :         particle.setEnergy(1 * EeV);
-     102           1 :         EXPECT_EQ(particle.getRigidity(), 1e18);
-     103           1 : }
-     104             : 
-     105           2 : TEST(ParticleState, Mass) {
-     106           1 :         ParticleState particle;
-     107             : 
-     108           1 :         particle.setId(nucleusId(1, 1)); // proton
-     109           1 :         EXPECT_DOUBLE_EQ(mass_proton, particle.getMass());
-     110             : 
-     111           1 :         particle.setId(nucleusId(1, 0)); // neutron
-     112           1 :         EXPECT_DOUBLE_EQ(mass_neutron, particle.getMass());
-     113             : 
-     114           1 :         int id = nucleusId(56, 26);
-     115           1 :         particle.setId(id); // iron
-     116           1 :         EXPECT_DOUBLE_EQ(nuclearMass(id), particle.getMass());
-     117             : 
-     118           1 :         particle.setId(-id); // anti-iron
-     119           1 :         EXPECT_DOUBLE_EQ(nuclearMass(-id), particle.getMass());
-     120             : 
-     121             :         // approximation for unkown nucleus A * amu - Z * mass_electron
-     122             :         int A = 238; int Z = 92; // Uranium92
-     123           1 :         EXPECT_DOUBLE_EQ(nuclearMass(A, Z), A*amu - Z*mass_electron);
-     124           1 : }
-     125             : 
-     126           2 : TEST(ParticleState, lorentzFactor) {
-     127           1 :         ParticleState particle;
-     128           1 :         particle.setId(nucleusId(1, 1));
-     129           1 :         particle.setEnergy(1e12 * eV);
-     130           1 :         EXPECT_DOUBLE_EQ(particle.getLorentzFactor(),
-     131             :                         1e12 * eV / mass_proton / c_squared);
-     132           1 : }
-     133             : 
-     134           1 : TEST(ParticleID, nucleusId) {
-     135           1 :         EXPECT_EQ(nucleusId(3,2), 1000020030);
-     136           1 : }
-     137             : 
-     138           1 : TEST(ParticleID, chargeNumber) {
-     139           1 :         EXPECT_EQ(chargeNumber(1000020030), 2);
-     140           1 : }
-     141             : 
-     142           1 : TEST(ParticleID, massNumber) {
-     143           1 :         EXPECT_EQ(massNumber(2112), 1);
-     144           1 :         EXPECT_EQ(massNumber(1000020030), 3);
-     145           1 : }
-     146             : 
-     147           1 : TEST(ParticleID, isNucleus) {
-     148           1 :         EXPECT_TRUE(isNucleus(1000020030));
-     149           1 :         EXPECT_FALSE(isNucleus(11));
-     150           1 : }
-     151             : 
-     152           1 : TEST(HepPID, consistencyWithReferenceImplementation) {
-     153             :         // Tests the performance improved version against the default one
-     154           1 :         unsigned long testPID = rand() % 1000000000 + 1000000000;
-     155           8 :         for(size_t i=1; i < 8; i++) {
-     156           7 :                 HepPID::location loc = (HepPID::location) i;
-     157           7 :                 unsigned short newResult = HepPID::digit(loc, testPID);
-     158             :                 //original implementation
-     159           7 :                 int numerator = (int) std::pow(10.0,(loc-1));
-     160           7 :                 EXPECT_EQ(newResult, (HepPID::abspid(testPID)/numerator)%10);
-     161             :         }
-     162           1 : }
-     163             : 
-     164           1 : TEST(HepPID, charge) {
-     165           1 :         EXPECT_DOUBLE_EQ(HepPID::charge(11), -1.);
-     166           1 : }
-     167             : 
-     168           1 : TEST(Candidate, currentStep) {
-     169           1 :         Candidate candidate;
-     170           1 :         candidate.setCurrentStep(1 * Mpc);
-     171           1 :         EXPECT_DOUBLE_EQ(candidate.getCurrentStep(), 1 * Mpc);
-     172           1 : }
-     173             : 
-     174           1 : TEST(Candidate, limitNextStep) {
-     175           1 :         Candidate candidate;
-     176           1 :         candidate.setNextStep(5 * Mpc);
-     177           1 :         EXPECT_DOUBLE_EQ(candidate.getNextStep(), 5 * Mpc);
-     178           1 :         candidate.limitNextStep(2 * Mpc);
-     179           1 :         EXPECT_DOUBLE_EQ(candidate.getNextStep(), 2 * Mpc);
-     180           1 :         candidate.limitNextStep(3 * Mpc);
-     181           1 :         EXPECT_DOUBLE_EQ(candidate.getNextStep(), 2 * Mpc);
-     182           1 : }
-     183             : 
-     184           1 : TEST(Candidate, isActive) {
-     185           1 :         Candidate candidate;
-     186           1 :         EXPECT_TRUE(candidate.isActive());
-     187           1 :         candidate.setActive(false);
-     188           1 :         EXPECT_FALSE(candidate.isActive());
-     189           1 : }
-     190             : 
-     191           1 : TEST(Candidate, property) {
-     192           1 :         Candidate candidate;
-     193           2 :         candidate.setProperty("foo", "bar");
-     194           2 :         EXPECT_TRUE(candidate.hasProperty("foo"));
-     195           2 :         std::string value = candidate.getProperty("foo");
-     196           1 :         EXPECT_EQ("bar", value);
-     197           1 : }
-     198             : 
-     199           1 : TEST(Candidate, weight) {
-     200           1 :     Candidate candidate;
-     201           1 :     EXPECT_EQ (1., candidate.getWeight());
-     202             :     
-     203           1 :     candidate.setWeight(5.);
-     204           1 :     EXPECT_EQ (5., candidate.getWeight());
-     205             :     
-     206           1 :     candidate.updateWeight(3.);
-     207           1 :     EXPECT_EQ (15., candidate.getWeight());
-     208           1 : }
-     209             : 
-     210           1 : TEST(Candidate, addSecondary) {
-     211           1 :         Candidate c;
-     212           1 :         c.setRedshift(5);
-     213           1 :         c.setTrajectoryLength(23);
-     214           1 :         c.setWeight(3.);
-     215           1 :         c.previous.setId(nucleusId(56,26));
-     216           1 :         c.previous.setEnergy(1000);
-     217           1 :         c.previous.setPosition(Vector3d(1,2,3));
-     218           1 :         c.previous.setDirection(Vector3d(0,0,1));
-     219             : 
-     220           1 :         c.addSecondary(nucleusId(1,1), 200);
-     221           2 :         c.addSecondary(nucleusId(1,1), 200, 5.);
-     222           1 :         Candidate s1 = *c.secondaries[0];
-     223           1 :         Candidate s2 = *c.secondaries[1];
-     224             : 
-     225           1 :         EXPECT_EQ(nucleusId(1,1), s1.current.getId());
-     226           1 :         EXPECT_EQ(200, s1.current.getEnergy());
-     227           1 :         EXPECT_EQ(5, s1.getRedshift());
-     228           1 :         EXPECT_EQ(23, s1.getTrajectoryLength());
-     229           1 :         EXPECT_EQ(1000, s1.created.getEnergy());
-     230           1 :         EXPECT_EQ(3., s1.getWeight());
-     231           2 :         EXPECT_TRUE(Vector3d(1,2,3) == s1.created.getPosition());
-     232           2 :         EXPECT_TRUE(Vector3d(0,0,1) == s1.created.getDirection());
-     233           2 :         EXPECT_TRUE(s1.getTagOrigin() == "SEC");
-     234             : 
-     235           1 :         EXPECT_EQ(15., s2.getWeight());
-     236           1 : }
-     237             : 
-     238           1 : TEST(Candidate, candidateTag) {
-     239           1 :         Candidate c;
-     240             : 
-     241             :         // test default tag
-     242           2 :         EXPECT_TRUE(c.getTagOrigin() == "PRIM");
-     243             : 
-     244             :         // test setting tag
-     245           1 :         c.setTagOrigin("myTag");
-     246           2 :         EXPECT_TRUE(c.getTagOrigin() == "myTag");
-     247           1 : }
-     248             : 
-     249           1 : TEST(Candidate, serialNumber) {
-     250           1 :         Candidate::setNextSerialNumber(42);
-     251           1 :         Candidate c;
-     252           1 :         EXPECT_EQ(43, c.getSourceSerialNumber());
-     253           1 : }
-     254             : 
-     255           1 : TEST(common, digit) {
-     256           1 :         EXPECT_EQ(1, digit(1234, 1000));
-     257           1 :         EXPECT_EQ(2, digit(1234, 100));
-     258           1 :         EXPECT_EQ(3, digit(1234, 10));
-     259           1 :         EXPECT_EQ(4, digit(1234, 1));
-     260           1 : }
-     261             : 
-     262           1 : TEST(common, interpolate) {
-     263             :         // create vectors x = (0, 0.02, ... 2) and y = 2x + 3 = (3, ... 7)
-     264           1 :         std::vector<double> xD(101), yD(101);
-     265         102 :         for (int i = 0; i <= 100; i++) {
-     266         101 :                 xD[i] = i * 0.02;
-     267         101 :                 yD[i] = 2 * xD[i] + 3;
-     268             :         }
-     269             : 
-     270             :         // interpolating tabulated values of a linear function should produce exact results
-     271           1 :         Random &R = Random::instance();
-     272             :         double x, ytrue, yinterp;
-     273       10001 :         for (int i = 0; i < 10000; i++) {
-     274       10000 :                 x = R.rand() * 2; // random value between 0 and 2
-     275       10000 :                 ytrue = 2 * x + 3;
-     276       10000 :                 yinterp = interpolate(x, xD, yD);
-     277       10000 :                 EXPECT_DOUBLE_EQ(ytrue, yinterp);
-     278             :         }
-     279             : 
-     280             :         // test interpolation in first bin
-     281             :         x = 0.01;
-     282             :         ytrue = 2 * x + 3;
-     283           1 :         yinterp = interpolate(x, xD, yD);
-     284           1 :         EXPECT_DOUBLE_EQ(ytrue, yinterp);
-     285             : 
-     286             :         // test interpolation in last bin
-     287             :         x = 1.99;
-     288             :         ytrue = 2 * x + 3;
-     289           1 :         yinterp = interpolate(x, xD, yD);
-     290           1 :         EXPECT_DOUBLE_EQ(ytrue, yinterp);
-     291             : 
-     292             :         // value out of range, return lower bound
-     293           1 :         EXPECT_EQ(3, interpolate(-0.001, xD, yD));
-     294             : 
-     295             :         // value out of range, return upper bound
-     296           1 :         EXPECT_EQ(7, interpolate(2.001, xD, yD));
-     297           1 : }
-     298             : 
-     299           1 : TEST(common, interpolateEquidistant) {
-     300           1 :         std::vector<double> yD(100);
-     301         101 :         for (int i = 0; i < 100; i++) {
-     302         100 :                 yD[i] = pow(1 + i * 2. / 99., 2);
-     303             :         }
-     304             : 
-     305             :         // interpolated value should be close to computed
-     306           1 :         double y = interpolateEquidistant(1.5001, 1, 3, yD);
-     307           1 :         EXPECT_NEAR(pow(1.5001, 2), y, 1e-4);
-     308             : 
-     309             :         // value out of range, return lower bound
-     310           1 :         EXPECT_EQ(1, interpolateEquidistant(0.9, 1, 3, yD));
-     311             : 
-     312             :         // value out of range, return lower bound
-     313           1 :         EXPECT_EQ(9, interpolateEquidistant(3.1, 1, 3, yD));
-     314           1 : }
-     315             : 
-     316           1 : TEST(common, pow_integer) {
-     317           1 :         EXPECT_EQ(pow_integer<0>(1.23), 1);
-     318           1 :         EXPECT_FLOAT_EQ(pow_integer<1>(1.234), 1.234);
-     319           1 :         EXPECT_FLOAT_EQ(pow_integer<2>(1.234), pow(1.234, 2));
-     320           1 :         EXPECT_FLOAT_EQ(pow_integer<3>(1.234), pow(1.234, 3));
-     321           1 : }
-     322             : 
-     323           2 : TEST(common, gaussInt) {
-     324           9 :         EXPECT_NEAR(gaussInt(([](double x){ return x*x; }), 0, 10), 1000/3., 1e-4);
-     325           9 :         EXPECT_NEAR(gaussInt(([](double x){ return sin(x)*sin(x); }), 0, M_PI), M_PI/2., 1e-4);
-     326           1 : }
-     327             : 
-     328           1 : TEST(Random, seed) {
-     329           1 :         Random &a = Random::instance();
-     330           1 :         Random &b = Random::instance();
-     331             : 
-     332           1 :         a.seed(42);
-     333           1 :         double r1 = a.rand();
-     334             : 
-     335           1 :         a.seed(42);
-     336           1 :         double r2 = a.rand();
-     337             : 
-     338           1 :         a.seed(42);
-     339           1 :         double r3 = b.rand();
-     340             : 
-     341             :         // seeding should give same random numbers
-     342           1 :         EXPECT_EQ(r1, r2);
-     343             : 
-     344             :         // seeding should work for all instances
-     345           1 :         EXPECT_EQ(r1, r3);
-     346           1 : }
-     347             : 
-     348           1 : TEST(Random, bigSeedStorage) {
-     349           1 :         Random a;
-     350             :         std::vector<uint32_t> bigSeed;
-     351             : 
-     352             :         const size_t nComp = 42;
-     353             :         double values[nComp];
-     354          43 :         for (size_t i = 0; i < nComp; i++)
-     355             :         {
-     356          42 :                 values[i] = a.rand();
-     357             :         }
-     358           1 :         bigSeed = a.getSeed();
-     359           1 :         Random b;
-     360             :         //b.load(bigSeed);
-     361           1 :         b.seed(&bigSeed[0], bigSeed.size());
-     362          43 :         for (size_t i = 0; i < nComp; i++)
-     363             :         {
-     364          42 :                 EXPECT_EQ(values[i], b.rand());
-     365             :         }
-     366             : 
-     367           1 :         a.seed(42);
-     368           1 :         bigSeed = a.getSeed();
-     369           1 :         EXPECT_EQ(bigSeed.size(), 1);
-     370           1 :         EXPECT_EQ(bigSeed[0], 42);
-     371           1 :         b.seed(bigSeed[0]);
-     372          43 :         for (size_t i = 0; i < nComp; i++)
-     373             :         {
-     374          42 :                 EXPECT_EQ(a.rand(), b.rand());
-     375             :         }
-     376             : 
-     377           1 : }
-     378             : 
-     379           1 : TEST(base64, de_en_coding) {
-     380           1 :         Random a;
-     381         100 :         for (int N=1; N < 100; N++) {
-     382             :                 std::vector<uint32_t> data;
-     383          99 :                 data.reserve(N);
-     384        5049 :                 for (int i =0; i<N; i++)
-     385        4950 :                         data.push_back(a.randInt());
-     386             : 
-     387          99 :                 std::string encoded_data = Base64::encode((unsigned char*)&data[0], sizeof(data[0]) * data.size() / sizeof(unsigned char));
-     388             : 
-     389          99 :                 std::string decoded_data = Base64::decode(encoded_data);
-     390          99 :                 size_t S = decoded_data.size() * sizeof(decoded_data[0]) / sizeof(uint32_t);
-     391        5049 :                 for (int i=0; i < S; i++) {
-     392        4950 :                         EXPECT_EQ(((uint32_t*)decoded_data.c_str())[i], data[i]);
-     393             :                 }
-     394             :         }
-     395             : 
-     396           1 : }
-     397             : 
-     398           1 : TEST(Random, base64Seed) {
-     399             : 
-     400           1 :         std::string seed =  "I1+8ANzXYwAqAAAAAwAAAA==";
-     401             :         std::vector<uint32_t> bigSeed;
-     402           1 :         bigSeed.push_back(12345123);
-     403           1 :         bigSeed.push_back(6543324);
-     404           1 :         bigSeed.push_back(42);
-     405           1 :         bigSeed.push_back(3);
-     406           1 :         Random a, b;
-     407           1 :         a.seed(seed);
-     408           1 :         b.seed(&bigSeed[0], bigSeed.size());
-     409             : 
-     410             :         const size_t nComp = 42;
-     411             :         double values[nComp];
-     412          43 :         for (size_t i = 0; i < nComp; i++)
-     413             :         {
-     414          42 :                 EXPECT_EQ(a.rand(), b.rand());
-     415             :         }
-     416           1 : }
-     417             : 
-     418           2 : TEST(Grid, PeriodicClamp) {
-     419             :         // Test correct determination of lower and upper neighbor
-     420             :         int lo, hi;
-     421             : 
-     422             :         periodicClamp(23.12, 8, lo, hi);
-     423           1 :         EXPECT_EQ(7, lo);
-     424           1 :         EXPECT_EQ(0, hi);
-     425             : 
-     426             :         periodicClamp(-23.12, 8, lo, hi);
-     427           1 :         EXPECT_EQ(0, lo);
-     428           1 :         EXPECT_EQ(1, hi);
-     429           1 : }
-     430             : 
-     431           1 : TEST(Grid, PeriodicBoundary) {
-     432             :         // Test correct determination of periodic continuated index
-     433             :         // periodic indices for n=8 should repeat like ...0123456701234567...
-     434             :         int index;
-     435             : 
-     436           1 :         index = periodicBoundary(0, 8);
-     437           1 :         EXPECT_EQ(0, index);
-     438           1 :         index = periodicBoundary(7, 8);
-     439           1 :         EXPECT_EQ(7, index);
-     440           1 :         index = periodicBoundary(8, 8);
-     441           1 :         EXPECT_EQ(0, index);
-     442           1 :         index = periodicBoundary(9, 8);
-     443           1 :         EXPECT_EQ(1, index);
-     444           1 : }
-     445             : 
-     446           1 : TEST(Grid, ReflectiveClamp) {
-     447             :         // Test correct determination of lower and upper neighbor
-     448             :         // reflective indices for n=8 should repeat like ...67765432100123456776...
-     449             :         int lo, hi; 
-     450             :         double res;
-     451             : 
-     452           1 :         reflectiveClamp(23.12, 8, lo, hi, res);
-     453           1 :         EXPECT_EQ(7, lo);
-     454           1 :         EXPECT_EQ(7, hi);
-     455           1 :         EXPECT_FLOAT_EQ(7.12, res);
-     456             : 
-     457           1 :         reflectiveClamp(-23.12, 8, lo, hi, res);
-     458           1 :         EXPECT_EQ(6, lo);
-     459           1 :         EXPECT_EQ(7, hi);
-     460           1 :         EXPECT_FLOAT_EQ(6.12, res);
-     461           1 : }
-     462             : 
-     463           2 : TEST(Grid, ReflectiveBoundary) {
-     464             :         // Test correct determination of reflected index
-     465             :         // reflective indices for n=8 should repeat like ...67765432100123456776...
-     466             :         int index; 
-     467             : 
-     468           1 :         index = reflectiveBoundary(8, 8);
-     469           1 :         EXPECT_EQ(7, index);
-     470           1 :         index = reflectiveBoundary(9, 8);
-     471           1 :         EXPECT_EQ(6, index);
-     472           1 :         index = reflectiveBoundary(0, 8);
-     473           1 :         EXPECT_EQ(0, index);
-     474           1 :         index = reflectiveBoundary(-1, 8);
-     475           1 :         EXPECT_EQ(0, index);
-     476           1 :         index = reflectiveBoundary(-8, 8);
-     477           1 :         EXPECT_EQ(7, index);
-     478           1 :         index = reflectiveBoundary(-9, 8);
-     479           1 :         EXPECT_EQ(7, index);
-     480           1 : }
-     481             : 
-     482           1 : TEST(Grid1f, SimpleTest) {
-     483             :         // Test construction and parameters
-     484           1 :         size_t Nx = 5;
-     485           1 :         size_t Ny = 8;
-     486           1 :         size_t Nz = 10;
-     487             :         double spacing = 2.0;
-     488             :         Vector3d origin(1., 2., 3.);
-     489             : 
-     490           1 :         Grid1f grid(origin, Nx, Ny, Nz, spacing);
-     491             : 
-     492           1 :         EXPECT_TRUE(origin == grid.getOrigin());
-     493           1 :         EXPECT_EQ(Nx, grid.getNx());
-     494           1 :         EXPECT_EQ(Ny, grid.getNy());
-     495           1 :         EXPECT_EQ(Nz, grid.getNz());
-     496           1 :         EXPECT_EQ(Vector3d(spacing), grid.getSpacing());
-     497           1 :         EXPECT_EQ(5 * 8 * 10, grid.getGrid().size());
-     498             : 
-     499             :         // Test index handling: get position of grid point (2, 3, 4)
-     500           1 :         size_t some_index = 2 * Ny * Nz + 3 * Nz + 4;
-     501             :         Vector3d some_grid_point = origin + Vector3d(2, 3, 4) * spacing + Vector3d(spacing / 2.);
-     502           2 :         EXPECT_EQ(some_grid_point, grid.positionFromIndex(some_index));
-     503             :         
-     504             :         //Test if value on gridpoint is correctly retrieved
-     505           1 :         grid.get(2, 3, 4) = 7;
-     506           1 :         EXPECT_FLOAT_EQ(7., grid.getGrid()[some_index]);
-     507             :         //trilinear interpolated
-     508           1 :         EXPECT_FLOAT_EQ(7., grid.interpolate(some_grid_point));
-     509             :         //tricubic interpolated
-     510             :         grid.setInterpolationType(TRICUBIC);
-     511           1 :         EXPECT_FLOAT_EQ(7., grid.interpolate(some_grid_point));
-     512             :         //nearest neighbour interpolated
-     513             :         grid.setInterpolationType(NEAREST_NEIGHBOUR);
-     514           1 :         EXPECT_FLOAT_EQ(7., grid.interpolate(some_grid_point));
-     515             : 
-     516             :         //Test if grid is set to zero outside of volume for clipVolume=true
-     517             :         grid.setClipVolume(true);
-     518           1 :         EXPECT_FLOAT_EQ(0, grid.interpolate(Vector3d(100, 0, 12)));
-     519           1 : }
-     520             : 
-     521           2 : TEST(Grid1f, GridPropertiesConstructor) {
-     522             :         // Test constructor for vector spacing
-     523             :         size_t Nx = 5;
-     524             :         size_t Ny = 8;
-     525             :         size_t Nz = 10;
-     526             :         Vector3d origin = Vector3d(1., 2., 3.);
-     527             :         Vector3d spacing = Vector3d(1., 5., 3.);
-     528             :         GridProperties properties(origin, Nx, Ny, Nz, spacing);
-     529           1 :         Grid1f grid(properties);
-     530             : 
-     531           1 :         EXPECT_EQ(spacing, grid.getSpacing());
-     532             : 
-     533             :         // Test index handling: get position of grid point (1, 7, 6)
-     534             :         size_t some_index = 1 * Ny * Nz + 7 * Nz + 6;
-     535             :         Vector3d some_grid_point = origin + Vector3d(1, 7, 6) * spacing + spacing / 2.;
-     536             : 
-     537             :         //Test if value on gridpoint is correctly retrieved
-     538           1 :         grid.get(1, 7, 6) = 12;
-     539           1 :         EXPECT_FLOAT_EQ(12., grid.getGrid()[some_index]);
-     540             :         //trilinear interpolated
-     541           1 :         EXPECT_FLOAT_EQ(12., grid.interpolate(some_grid_point));
-     542             :         //tricubic interpolated
-     543             :         grid.setInterpolationType(TRICUBIC);
-     544           1 :         EXPECT_FLOAT_EQ(12., grid.interpolate(some_grid_point));
-     545             :         //nearest neighbour interpolated
-     546             :         grid.setInterpolationType(NEAREST_NEIGHBOUR);
-     547           1 :         EXPECT_FLOAT_EQ(12., grid.interpolate(some_grid_point));
-     548           1 : }
-     549             : 
-     550           2 : TEST(Grid1f, TestVectorSpacing) {
-     551             :         // Test constructor for vector spacing
-     552             :         size_t Nx = 5;
-     553             :         size_t Ny = 8;
-     554             :         size_t Nz = 10;
-     555             :         Vector3d origin = Vector3d(1., 2., 3.);
-     556             :         Vector3d spacing = Vector3d(1., 5., 3.);
-     557             : 
-     558           1 :         Grid1f grid(origin, Nx, Ny, Nz, spacing);
-     559             : 
-     560           1 :         EXPECT_EQ(spacing, grid.getSpacing());
-     561             : 
-     562             :         // Test index handling: get position of grid point (1, 7, 6)
-     563             :         size_t some_index = 1 * Ny * Nz + 7 * Nz + 6;
-     564             :         Vector3d some_grid_point = origin + Vector3d(1, 7, 6) * spacing + spacing / 2.;
-     565             : 
-     566             :         //Test if value on gridpoint is correctly retrieved
-     567           1 :         grid.get(1, 7, 6) = 12;
-     568           1 :         EXPECT_FLOAT_EQ(12., grid.getGrid()[some_index]);
-     569             :         //trilinear interpolated
-     570           1 :         EXPECT_FLOAT_EQ(12., grid.interpolate(some_grid_point));
-     571             :         //tricubic interpolated
-     572             :         grid.setInterpolationType(TRICUBIC);
-     573           1 :         EXPECT_FLOAT_EQ(12., grid.interpolate(some_grid_point));
-     574             :         //nearest neighbour interpolated
-     575             :         grid.setInterpolationType(NEAREST_NEIGHBOUR);
-     576           1 :         EXPECT_FLOAT_EQ(12., grid.interpolate(some_grid_point));
-     577           1 : }
-     578             : 
-     579           2 : TEST(Grid1f, ClosestValue) {
-     580             :         // Check some closest values / nearest neighbour interpolation
-     581           1 :         Grid1f grid(Vector3d(0.), 2, 2, 2, 1.);
-     582           1 :         grid.get(0, 0, 0) = 1;
-     583           1 :         grid.get(0, 0, 1) = 2;
-     584           1 :         grid.get(0, 1, 0) = 3;
-     585           1 :         grid.get(0, 1, 1) = 4;
-     586           1 :         grid.get(1, 0, 0) = 5;
-     587           1 :         grid.get(1, 0, 1) = 6;
-     588           1 :         grid.get(1, 1, 0) = 7;
-     589           1 :         grid.get(1, 1, 1) = 8;
-     590             : 
-     591             :         // grid points are at 0.5 and 1.5
-     592           1 :         EXPECT_FLOAT_EQ(1, grid.closestValue(Vector3d(0.1,  0.2, 0.6)));
-     593           1 :         EXPECT_FLOAT_EQ(2, grid.closestValue(Vector3d(0.2, 0.1, 1.3)));
-     594           1 :         EXPECT_FLOAT_EQ(3, grid.closestValue(Vector3d(0.3, 1.2, 0.2)));
-     595           1 :         EXPECT_FLOAT_EQ(7, grid.closestValue(Vector3d(1.7, 1.8, 0.4)));
-     596             : 
-     597             :         //Test if grid is set to zero outside of volume for clipVolume=true
-     598           1 :         EXPECT_NE(0, grid.interpolate(Vector3d(0, 0, 12)));
-     599             :         grid.setClipVolume(true);
-     600           1 :         double b = grid.interpolate(Vector3d(0, 0, 12));
-     601           1 :         EXPECT_FLOAT_EQ(0, b);
-     602           1 : }
-     603             : 
-     604           2 : TEST(Grid1f, clipVolume) {
-     605             :         // Check volume clipping for gridproperties constructor
-     606             :         size_t N = 2;
-     607             :         Vector3d origin = Vector3d(0.);
-     608             :         double spacing = 2;
-     609             :         GridProperties properties(origin, N, spacing);
-     610           1 :         Grid1f grid(properties);
-     611           1 :         grid.get(0, 0, 0) = 1;
-     612           1 :         grid.get(0, 0, 1) = 2;
-     613           1 :         grid.get(0, 1, 0) = 3;
-     614           1 :         grid.get(0, 1, 1) = 4;
-     615           1 :         grid.get(1, 0, 0) = 5;
-     616           1 :         grid.get(1, 0, 1) = 6;
-     617           1 :         grid.get(1, 1, 0) = 7;
-     618           1 :         grid.get(1, 1, 1) = 8;
-     619             : 
-     620             :         //Test if grid is set to zero outside of volume for clipVolume=true
-     621           1 :         EXPECT_NE(0, grid.interpolate(Vector3d(0, 0, 12)));
-     622             :         grid.setClipVolume(true);
-     623           1 :         double b = grid.interpolate(Vector3d(0, 0, 10));
-     624           1 :         EXPECT_FLOAT_EQ(0, b);
-     625           1 : }
-     626             : 
-     627           2 : TEST(Grid3f, Interpolation) {
-     628             :         // Explicitly test trilinear and tricubic interpolation
-     629             :         double spacing = 2.793;
-     630             :         int n = 3;
-     631           1 :         Grid3f grid(Vector3d(0.), n, n, n, spacing);
-     632             :         grid.get(0, 0, 1) = Vector3f(1.7, 0., 0.); // set one value
-     633             : 
-     634             :         Vector3d b;
-     635             :         
-     636             :         //trilinear
-     637             : 
-     638             :         // grid points are at [0.5, 1.5, ...] * spacing
-     639           1 :         b = grid.interpolate(Vector3d(0.5, 0.5, 1.5) * spacing);
-     640           1 :         EXPECT_FLOAT_EQ(1.7, b.x);
-     641             : 
-     642           1 :         b = grid.interpolate(Vector3d(0.5, 0.5, 1.4) * spacing);
-     643           1 :         EXPECT_FLOAT_EQ(1.7 * 0.9, b.x);
-     644             : 
-     645           1 :         b = grid.interpolate(Vector3d(0.5, 0.5, 1.6) * spacing);
-     646           1 :         EXPECT_FLOAT_EQ(1.7 * 0.9, b.x);
-     647             : 
-     648           1 :         b = grid.interpolate(Vector3d(0.5, 0.35, 1.6) * spacing);
-     649           1 :         EXPECT_FLOAT_EQ(1.7 * 0.9 * 0.85, b.x);
-     650             : 
-     651           1 :         b = grid.interpolate(Vector3d(0.5, 2.65, 1.6) * spacing); // using periodic repetition
-     652           1 :         EXPECT_FLOAT_EQ(1.7 * 0.9 * 0.15, b.x);
-     653             :         
-     654             :         //tricubic
-     655             :         #ifdef HAVE_SIMD
-     656             :         grid.setInterpolationType(TRICUBIC);
-     657             :         
-     658           1 :         b = grid.interpolate(Vector3d(0.5, 0.5, 1.5) * spacing);
-     659           1 :         EXPECT_FLOAT_EQ(1.7, b.x);
-     660             : 
-     661           1 :         b = grid.interpolate(Vector3d(0.5, 0.5, 1.4) * spacing);
-     662           1 :         EXPECT_FLOAT_EQ(1.66005015373, b.x);
-     663             : 
-     664           1 :         b = grid.interpolate(Vector3d(0.5, 0.5, 1.6) * spacing);
-     665           1 :         EXPECT_FLOAT_EQ(1.66005003452, b.x);
-     666             : 
-     667           1 :         b = grid.interpolate(Vector3d(0.5, 0.35, 1.6) * spacing);
-     668           1 :         EXPECT_FLOAT_EQ(1.57507634163, b.x);
-     669             : 
-     670           1 :         b = grid.interpolate(Vector3d(0.5, 2.65, 1.6) * spacing);
-     671           1 :         EXPECT_FLOAT_EQ(0.190802007914, b.x);
-     672             :         #endif // HAVE_SIMD
-     673           1 : }
-     674             : 
-     675           2 : TEST(VectordGrid, Scale) {
-     676             :         // Test scaling a field
-     677           1 :         ref_ptr<Grid3f> grid = new Grid3f(Vector3d(0.), 3, 1);
-     678           4 :         for (int ix = 0; ix < 3; ix++)
-     679          12 :                 for (int iy = 0; iy < 3; iy++)
-     680          36 :                         for (int iz = 0; iz < 3; iz++)
-     681          27 :                                 grid->get(ix, iy, iz) = Vector3f(1, 0, 0);
-     682             : 
-     683           1 :         scaleGrid(grid, 5);
-     684           4 :         for (int ix = 0; ix < 3; ix++)
-     685          12 :                 for (int iy = 0; iy < 3; iy++)
-     686          36 :                         for (int iz = 0; iz < 3; iz++)
-     687          27 :                                 EXPECT_FLOAT_EQ(5, grid->interpolate(Vector3d(0.7, 0, 0.1)).x);
-     688           1 : }
-     689             : 
-     690           2 : TEST(Grid3f, Periodicity) {
-     691             :         // Test for periodic boundaries: grid(x+a*n) = grid(x)
-     692             :         size_t n = 3;
-     693             :         double spacing = 3;
-     694             :         double size = n * spacing;
-     695           1 :         Grid3f grid(Vector3d(0.), n, spacing);
-     696           4 :         for (int ix = 0; ix < 3; ix++)
-     697          12 :                 for (int iy = 0; iy < 3; iy++)
-     698          36 :                         for (int iz = 0; iz < 3; iz++)
-     699          27 :                                 grid.get(ix, iy, iz) = Vector3f(iz + ix, iy * iz, ix - iz * iy);
-     700             : 
-     701             :         Vector3d pos(1.2, 2.3, 0.7);
-     702             :         
-     703             :         //trilinear interpolated
-     704           1 :         Vector3f b = grid.interpolate(pos);
-     705           1 :         Vector3f b2 = grid.interpolate(pos + Vector3d(1, 0, 0) * size);
-     706           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
-     707           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
-     708           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
-     709             : 
-     710           1 :         b2 = grid.interpolate(pos + Vector3d(0, 5, 0) * size);
-     711           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
-     712           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
-     713           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
-     714             : 
-     715           1 :         b2 = grid.interpolate(pos + Vector3d(0, 0, -2) * size);
-     716           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
-     717           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
-     718           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
-     719             :         
-     720             :         //tricubic interpolated
-     721             :         #ifdef HAVE_SIMD
-     722             :         grid.setInterpolationType(TRICUBIC);
-     723           1 :         b = grid.interpolate(pos);
-     724           1 :         b2 = grid.interpolate(pos + Vector3d(1, 0, 0) * size);
-     725           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
-     726           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
-     727           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
-     728             : 
-     729           1 :         b2 = grid.interpolate(pos + Vector3d(0, 5, 0) * size);
-     730           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
-     731           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
-     732           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
-     733             : 
-     734           1 :         b2 = grid.interpolate(pos + Vector3d(0, 0, -2) * size);
-     735           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
-     736           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
-     737           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
-     738             :         #endif // HAVE_SIMD
-     739             :         
-     740             :         //nearest neighbour interpolated
-     741             :         grid.setInterpolationType(NEAREST_NEIGHBOUR);
-     742           1 :         b = grid.interpolate(pos);
-     743           1 :         b2 = grid.interpolate(pos + Vector3d(1, 0, 0) * size);
-     744           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
-     745           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
-     746           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
-     747             : 
-     748           1 :         b2 = grid.interpolate(pos + Vector3d(0, 5, 0) * size);
-     749           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
-     750           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
-     751           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
-     752             : 
-     753           1 :         b2 = grid.interpolate(pos + Vector3d(0, 0, -2) * size);
-     754           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
-     755           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
-     756           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
-     757             : 
-     758             :         //Test if grid is set to zero outside of volume for clipVolume=true
-     759             :         grid.setClipVolume(true);
-     760           1 :         Vector3f b3 = grid.interpolate(pos + Vector3d(0, 0, -2) * size);
-     761           1 :         EXPECT_FLOAT_EQ(0., b3.x);
-     762           1 :         EXPECT_FLOAT_EQ(0., b3.y);
-     763           1 :         EXPECT_FLOAT_EQ(0., b3.z);
-     764           1 : }
-     765             : 
-     766           2 : TEST(Grid3f, Reflectivity) {
-     767             :         // Test for reflective boundaries: grid(pos) = grid(x+a) = grid(-x-a)
-     768             :         size_t n = 3;
-     769             :         double spacing = 3;
-     770             :         double size = n * spacing;
-     771           1 :         Grid3f grid(Vector3d(0.), n, spacing);
-     772             :         grid.setReflective(true); //set reflective boundary
-     773           4 :         for (int ix = 0; ix < 3; ix++)
-     774          12 :                 for (int iy = 0; iy < 3; iy++)
-     775          36 :                         for (int iz = 0; iz < 3; iz++)
-     776          27 :                                 grid.get(ix, iy, iz) = Vector3f(iz + ix, iy * iz, ix - iz * iy);
-     777             : 
-     778             :         Vector3d pos(1.2, 2.3, 0.7);
-     779             :         
-     780             :         //trilinear interpolated
-     781           1 :         Vector3f b = grid.interpolate(pos + Vector3d(1,0,0) * spacing);
-     782           1 :         Vector3f b2 = grid.interpolate(pos *(-1) - Vector3d(1,0,0) * spacing);
-     783           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
-     784           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
-     785           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
-     786             :         
-     787           1 :         b = grid.interpolate(pos + Vector3d(0,5,0) * spacing);
-     788           1 :         b2 = grid.interpolate(pos *(-1) - Vector3d(0,5,0) * spacing);
-     789           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
-     790           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
-     791           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
-     792             :         
-     793           1 :         b = grid.interpolate(pos + Vector3d(0,0,-2) * spacing);
-     794           1 :         b2 = grid.interpolate(pos *(-1) - Vector3d(0,0,-2) * spacing);
-     795           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
-     796           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
-     797           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
-     798             :         
-     799             :         //tricubic interpolated
-     800             :         #ifdef HAVE_SIMD
-     801             :         grid.setInterpolationType(TRICUBIC);
-     802           1 :         b = grid.interpolate(pos + Vector3d(1,0,0) * spacing);
-     803           1 :         b2 = grid.interpolate(pos *(-1) - Vector3d(1,0,0) * spacing);
-     804           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
-     805           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
-     806           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
-     807             :         
-     808           1 :         b = grid.interpolate(pos + Vector3d(0,5,0) * spacing);
-     809           1 :         b2 = grid.interpolate(pos *(-1) - Vector3d(0,5,0) * spacing);
-     810           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
-     811           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
-     812           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
-     813             :         
-     814           1 :         b = grid.interpolate(pos + Vector3d(0,0,-2) * spacing);
-     815           1 :         b2 = grid.interpolate(pos *(-1) - Vector3d(0,0,-2) * spacing);
-     816           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
-     817           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
-     818           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
-     819             :         #endif //HAVE_SIMD
-     820             :         
-     821             :         //nearest neighbour interpolated
-     822             :         grid.setInterpolationType(NEAREST_NEIGHBOUR);
-     823           1 :         b = grid.interpolate(pos + Vector3d(1,0,0) * spacing);
-     824           1 :         b2 = grid.interpolate(pos *(-1) - Vector3d(1,0,0) * spacing);
-     825           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
-     826           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
-     827           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
-     828             :         
-     829           1 :         b = grid.interpolate(pos + Vector3d(0,5,0) * spacing);
-     830           1 :         b2 = grid.interpolate(pos *(-1) - Vector3d(0,5,0) * spacing);
-     831           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
-     832           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
-     833           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
-     834             :         
-     835           1 :         b = grid.interpolate(pos + Vector3d(0,0,-2) * spacing);
-     836           1 :         b2 = grid.interpolate(pos *(-1) - Vector3d(0,0,-2) * spacing);
-     837           1 :         EXPECT_FLOAT_EQ(b.x, b2.x);
-     838           1 :         EXPECT_FLOAT_EQ(b.y, b2.y);
-     839           1 :         EXPECT_FLOAT_EQ(b.z, b2.z);
-     840             : 
-     841             :         //Test if grid is set to zero outside of volume for clipVolume=true
-     842             :         grid.setClipVolume(true);
-     843           1 :         Vector3f b3 = grid.interpolate(pos + Vector3d(0, 0, -2) * size);
-     844           1 :         EXPECT_FLOAT_EQ(0., b3.x);
-     845           1 :         EXPECT_FLOAT_EQ(0., b3.y);
-     846           1 :         EXPECT_FLOAT_EQ(0., b3.z);
-     847           1 : }
-     848             : 
-     849           2 : TEST(Grid3f, DumpLoad) {
-     850             :         // Dump and load a field grid
-     851           1 :         ref_ptr<Grid3f> grid1 = new Grid3f(Vector3d(0.), 3, 1);
-     852           1 :         ref_ptr<Grid3f> grid2 = new Grid3f(Vector3d(0.), 3, 1);
-     853             : 
-     854           4 :         for (int ix = 0; ix < 3; ix++)
-     855          12 :                 for (int iy = 0; iy < 3; iy++)
-     856          36 :                         for (int iz = 0; iz < 3; iz++)
-     857          27 :                                 grid1->get(ix, iy, iz) = Vector3f(1, 2, 3);
-     858             : 
-     859           2 :         dumpGrid(grid1, "testDump.raw");
-     860           2 :         loadGrid(grid2, "testDump.raw");
-     861             : 
-     862           4 :         for (int ix = 0; ix < 3; ix++) {
-     863          12 :                 for (int iy = 0; iy < 3; iy++) {
-     864          36 :                         for (int iz = 0; iz < 3; iz++) {
-     865          27 :                                 Vector3f b1 = grid1->get(ix, iy, iz);
-     866             :                                 Vector3f b2 = grid2->get(ix, iy, iz);
-     867          27 :                                 EXPECT_FLOAT_EQ(b1.x, b2.x);
-     868          27 :                                 EXPECT_FLOAT_EQ(b1.y, b2.y);
-     869          27 :                                 EXPECT_FLOAT_EQ(b1.z, b2.z);
-     870             :                         }
-     871             :                 }
-     872             :         }
-     873           1 : }
-     874             : 
-     875           2 : TEST(Grid3f, DumpLoadTxt) {
-     876             :         // Dump and load a field grid
-     877           1 :         ref_ptr<Grid3f> grid1 = new Grid3f(Vector3d(0.), 3, 1);
-     878           1 :         ref_ptr<Grid3f> grid2 = new Grid3f(Vector3d(0.), 3, 1);
-     879             : 
-     880           4 :         for (int ix = 0; ix < 3; ix++)
-     881          12 :                 for (int iy = 0; iy < 3; iy++)
-     882          36 :                         for (int iz = 0; iz < 3; iz++)
-     883          27 :                                 grid1->get(ix, iy, iz) = Vector3f(ix, iy, iz);
-     884             : 
-     885           2 :         dumpGridToTxt(grid1, "testDump.txt", 1e4);
-     886           2 :         loadGridFromTxt(grid2, "testDump.txt", 1e-4);
-     887             : 
-     888           4 :         for (int ix = 0; ix < 3; ix++) {
-     889          12 :                 for (int iy = 0; iy < 3; iy++) {
-     890          36 :                         for (int iz = 0; iz < 3; iz++) {
-     891          27 :                                 Vector3f b1 = grid1->get(ix, iy, iz);
-     892             :                                 Vector3f b2 = grid2->get(ix, iy, iz);
-     893          27 :                                 EXPECT_FLOAT_EQ(b1.x, b2.x);
-     894          27 :                                 EXPECT_FLOAT_EQ(b1.y, b2.y);
-     895          27 :                                 EXPECT_FLOAT_EQ(b1.z, b2.z);
-     896             :                         }
-     897             :                 }
-     898             :         }
-     899           1 : }
-     900             : 
-     901           2 : TEST(Grid3f, Speed) {
-     902             :         // Dump and load a field grid
-     903           1 :         Grid3f grid(Vector3d(0.), 3, 3);
-     904           4 :         for (int ix = 0; ix < 3; ix++)
-     905          12 :                 for (int iy = 0; iy < 3; iy++)
-     906          36 :                         for (int iz = 0; iz < 3; iz++)
-     907          27 :                                 grid.get(ix, iy, iz) = Vector3f(1, 2, 3);
-     908             : 
-     909             :         Vector3d b;
-     910      100001 :         for (int i = 0; i < 100000; i++)
-     911      100000 :                 b = grid.interpolate(Vector3d(i));
-     912           1 : }
-     913             : 
-     914           2 : TEST(CylindricalProjectionMap, functions) {
-     915             :         Vector3d v;
-     916           1 :         v.setRThetaPhi(1.0, 1.2, 2.4);
-     917           1 :         EXPECT_NEAR(v.getPhi(), 2.4, .00001);
-     918           1 :         EXPECT_NEAR(v.getTheta(), 1.2, .000001);
-     919             : 
-     920             : 
-     921             : 
-     922           2 :         CylindricalProjectionMap cpm(24, 12);
-     923           1 :         size_t bin = 50;
-     924           1 :         Vector3d d = cpm.directionFromBin(bin);
-     925           1 :         size_t bin2 = cpm.binFromDirection(d);
-     926           1 :         EXPECT_EQ(bin, bin2);
-     927           1 : }
-     928             : 
-     929           1 : TEST(EmissionMap, functions) {
-     930             : 
-     931           1 :         EmissionMap em(360, 180, 100, 1 * EeV, 100 * EeV);
-     932           1 :         double e = em.energyFromBin(50);
-     933           1 :         size_t b = em.binFromEnergy(50 * EeV);
-     934             : 
-     935             :         Vector3d d(1.0, 0.0, 0.0);
-     936             : 
-     937           1 :         em.fillMap(1, 50 * EeV, d);
-     938             : 
-     939             :         Vector3d d2;
-     940             : 
-     941           1 :         bool r = em.drawDirection(1, 50 * EeV, d2);
-     942           1 :         EXPECT_TRUE(r);
-     943           1 :         EXPECT_TRUE(d.getAngleTo(d2) < (2. * M_PI / 180.));
-     944             : 
-     945           1 :         r = em.drawDirection(1, 30 * EeV, d2);
-     946           1 :         EXPECT_FALSE(r);
-     947             : 
-     948           1 :         r = em.drawDirection(2, 50 * EeV, d2);
-     949           1 :         EXPECT_FALSE(r);
-     950             : 
-     951           1 : }
-     952             : 
-     953           1 : TEST(EmissionMap, merge) {
-     954           1 :         EmissionMap em1, em2;
-     955           1 :         em1.fillMap(1, 50 * EeV, Vector3d(1.0, 0.0, 0.0));
-     956           1 :         em2.fillMap(1, 50 * EeV, Vector3d(0.0, 1.0, 0.0));
-     957           1 :         em2.fillMap(2, 50 * EeV, Vector3d(0.0, 1.0, 0.0));
-     958             : 
-     959           1 :         em1.merge(&em2);
-     960             : 
-     961           1 :         EXPECT_EQ(em1.getMaps().size(), 2);
-     962             : 
-     963           1 :         ref_ptr<CylindricalProjectionMap> cpm = em1.getMap(1, 50 * EeV);
-     964           1 :         size_t bin = cpm->binFromDirection(Vector3d(0.0, 1.0, 0.0));
-     965           1 :         EXPECT_TRUE(cpm->getPdf()[bin] > 0);
-     966           1 : }
-     967             : 
-     968           1 : TEST(Variant, copyToBuffer) {
-     969           1 :         double a = 23.42;
-     970             :         Variant v(a);
-     971             :         double b;
-     972           1 :         v.copyToBuffer(&b);
-     973           1 :         EXPECT_EQ(a, b);
-     974           1 : }
-     975             : 
-     976           1 : TEST(Variant, stringConversion) {
-     977           1 :         Variant v, w;
-     978             :         {
-     979           1 :                 int32_t a = 12;
-     980           1 :                 v = Variant::fromInt32(a);
-     981           1 :                 EXPECT_EQ(a, v.asInt32());
-     982             : 
-     983           1 :                 w = Variant::fromString(v.toString(), v.getType());
-     984           1 :                 EXPECT_EQ(a, w.asInt32());
-     985             :         }
-     986             : 
-     987             :         {
-     988           1 :                 int64_t a = 12;
-     989           1 :                 v = Variant::fromInt64(a);
-     990           1 :                 EXPECT_EQ(a, v.asInt64());
-     991             : 
-     992           1 :                 w = Variant::fromString(v.toString(), v.getType());
-     993           1 :                 EXPECT_EQ(a, w.asInt64());
-     994             :         }
-     995             : 
-     996             :         {
-     997             :                 Vector3d a(1, 2, 3);
-     998             :                 Variant v = Variant::fromVector3d(a);
-     999             :                 Vector3d u = v.asVector3d();
-    1000           1 :                 EXPECT_EQ(a.getX(), u.getX());
-    1001           1 :                 EXPECT_EQ(a.getY(), u.getY());
-    1002           1 :                 EXPECT_EQ(a.getZ(), u.getZ());
-    1003           1 :         }
-    1004             : 
-    1005             :         {
-    1006           1 :                 std::complex<double> a1(1, 1);
-    1007           1 :                 std::complex<double> a2(2, 0);
-    1008             :                 Vector3<std::complex<double>> a(a1, a1, a2);
-    1009             :                 Variant v = Variant::fromVector3c(a);
-    1010             :                 Vector3<std::complex<double>> u = v.asVector3c();
-    1011           1 :                 EXPECT_EQ(a1, u.getX());
-    1012           1 :                 EXPECT_EQ(a1, u.getY());
-    1013           1 :                 EXPECT_EQ(a2, u.getZ());
-    1014           1 :         }
-    1015             : 
-    1016             :         {
-    1017             :                 std::complex<double> a(1, 2);
-    1018             :                 Variant v = Variant::fromComplexDouble(a);
-    1019           1 :                 std::complex<double> u = v.asComplexDouble();
-    1020           1 :                 EXPECT_EQ(u.real(), 1);
-    1021           1 :                 EXPECT_EQ(u.imag(), 2);
-    1022           1 :         }
-    1023             : 
-    1024             :         {
-    1025             :                 std::vector<Variant> a;
-    1026           1 :                 a.push_back(Variant::fromDouble(1));
-    1027           1 :                 a.push_back(Variant::fromDouble(2));
-    1028           1 :                 a.push_back(Variant::fromDouble(3));
-    1029           1 :                 a.push_back(Variant::fromDouble(4));
-    1030             :                 Variant v = Variant::fromVector(a);
-    1031           1 :                 std::vector<Variant> u = v.asVector();
-    1032           1 :                 EXPECT_EQ(a[0], Variant::fromDouble(u[0]));
-    1033           1 :                 EXPECT_EQ(a[1], Variant::fromDouble(u[1]));
-    1034           1 :                 EXPECT_EQ(a[2], Variant::fromDouble(u[2]));
-    1035           1 :                 EXPECT_EQ(a[3], Variant::fromDouble(u[3]));
-    1036           1 :         }
-    1037             : 
-    1038             : 
-    1039           1 : }
-    1040             : 
-    1041           2 : TEST(Geometry, Plane) {
-    1042           1 :         Plane p(Vector3d(0,0,1), Vector3d(0,0,1));
-    1043           1 :         EXPECT_DOUBLE_EQ(-1., p.distance(Vector3d(0, 0, 0)));
-    1044           1 :         EXPECT_DOUBLE_EQ(9., p.distance(Vector3d(1, 1, 10)));
-    1045           1 : }
-    1046             : 
-    1047           2 : TEST(Geometry, Sphere) {
-    1048           1 :         Sphere s(Vector3d(0,0,0), 1.);
-    1049           1 :         EXPECT_DOUBLE_EQ(-1., s.distance(Vector3d(0, 0, 0)));
-    1050           1 :         EXPECT_DOUBLE_EQ(9., s.distance(Vector3d(10, 0, 0)));
-    1051           1 : }
-    1052             : 
-    1053           2 : TEST(Geometry, ParaxialBox) {
-    1054           1 :         ParaxialBox b(Vector3d(0,0,0), Vector3d(3,4,5));
-    1055           1 :         EXPECT_NEAR(-.1, b.distance(Vector3d(0.1, 0.1, 0.1)), 1E-10);
-    1056           1 :         EXPECT_NEAR(-.1, b.distance(Vector3d(0.1, 3.8, 0.1)), 1E-10);
-    1057           1 :         EXPECT_NEAR(-.2, b.distance(Vector3d(0.9, 3.8, 0.9)), 1E-10);
-    1058           1 :         EXPECT_NEAR(7., b.distance(Vector3d(10., 0., 0.)), 1E-10);
-    1059           1 :         EXPECT_NEAR(7., b.distance(Vector3d(10., 2., 0.)), 1E-10);
-    1060           1 :         EXPECT_NEAR(8., b.distance(Vector3d(-8., 0., 0.)), 1E-10);
-    1061           1 : }
-    1062             : 
-    1063           0 : int main(int argc, char **argv) {
-    1064           0 :         ::testing::InitGoogleTest(&argc, argv);
-    1065           0 :         return RUN_ALL_TESTS();
-    1066             : }
-    1067             : 
-    1068             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testDensity.cpp.func-sort-c.html b/doc/coverageReport/test/testDensity.cpp.func-sort-c.html deleted file mode 100644 index b1eb7ef54..000000000 --- a/doc/coverageReport/test/testDensity.cpp.func-sort-c.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testDensity.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testDensity.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:166166100.0 %
Date:2024-04-08 14:58:22Functions:77100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa31testDensityList_SimpleTest_Test8TestBodyEv1
_ZN7crpropa31testGridDensity_SimpleTest_Test8TestBodyEv1
_ZN7crpropa35testConstantDensity_SimpleTest_Test8TestBodyEv1
_ZN7crpropa36testGridDensity_testRetrunValue_Test8TestBodyEv1
_ZN7crpropa41testCordes_checkValueAtCertainPoints_Test8TestBodyEv1
_ZN7crpropa43testFerriere_checkValueAtCertainPoints_Test8TestBodyEv1
_ZN7crpropa44testNakanishi_checkValueAtCertainPoints_Test8TestBodyEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testDensity.cpp.func.html b/doc/coverageReport/test/testDensity.cpp.func.html deleted file mode 100644 index 337e954df..000000000 --- a/doc/coverageReport/test/testDensity.cpp.func.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testDensity.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testDensity.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:166166100.0 %
Date:2024-04-08 14:58:22Functions:77100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa31testDensityList_SimpleTest_Test8TestBodyEv1
_ZN7crpropa31testGridDensity_SimpleTest_Test8TestBodyEv1
_ZN7crpropa35testConstantDensity_SimpleTest_Test8TestBodyEv1
_ZN7crpropa36testGridDensity_testRetrunValue_Test8TestBodyEv1
_ZN7crpropa41testCordes_checkValueAtCertainPoints_Test8TestBodyEv1
_ZN7crpropa43testFerriere_checkValueAtCertainPoints_Test8TestBodyEv1
_ZN7crpropa44testNakanishi_checkValueAtCertainPoints_Test8TestBodyEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testDensity.cpp.gcov.html b/doc/coverageReport/test/testDensity.cpp.gcov.html deleted file mode 100644 index 587a77d5d..000000000 --- a/doc/coverageReport/test/testDensity.cpp.gcov.html +++ /dev/null @@ -1,372 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testDensity.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testDensity.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:166166100.0 %
Date:2024-04-08 14:58:22Functions:77100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/massDistribution/Massdistribution.h"
-       2             : #include "crpropa/massDistribution/Cordes.h"
-       3             : #include "crpropa/massDistribution/Ferriere.h"
-       4             : #include "crpropa/massDistribution/Nakanishi.h"
-       5             : #include "crpropa/massDistribution/ConstantDensity.h"
-       6             : #include "crpropa/Units.h"
-       7             : #include "crpropa/Grid.h"
-       8             : 
-       9             : #include "gtest/gtest.h"
-      10             : 
-      11             : #include <stdexcept>
-      12             : #include <cmath>
-      13             : #include <string>
-      14             : 
-      15             : namespace crpropa {
-      16             : 
-      17           1 : TEST(testConstantDensity, SimpleTest) {
-      18             :         //test ConstantDensity in all types and in total density (output)
-      19           1 :         ConstantDensity n(2/ccm,3/ccm, 2/ccm);
-      20             :         Vector3d p(1*pc,2*pc,1*kpc);    // random position for testing density
-      21           1 :         EXPECT_DOUBLE_EQ(n.getHIDensity(p), 2e6);       // density output in m^-3
-      22           1 :         EXPECT_DOUBLE_EQ(n.getHIIDensity(p), 3e6);
-      23           1 :         EXPECT_DOUBLE_EQ( n.getH2Density(p), 2e6);
-      24           1 :         EXPECT_DOUBLE_EQ(n.getDensity(p), 7e6);         // total density 2+3+2 = 7 (/ccm)
-      25           1 :         EXPECT_DOUBLE_EQ(n.getNucleonDensity(p),9e6);   // nucleon density 2+3+2*2 = 9 (/ccm) factor 2 for molecular hydrogen
-      26             : 
-      27             :         //test set/get function for used type
-      28           1 :         bool useHI = n.getIsForHI();
-      29           1 :         bool useHII= n.getIsForHII();
-      30           1 :         bool useH2 = n.getIsForH2();
-      31             :         //check if all types are activited
-      32           1 :         EXPECT_TRUE(useHI);
-      33           1 :         EXPECT_TRUE(useHII);
-      34           1 :         EXPECT_TRUE(useH2);
-      35             : 
-      36             :         //set density number to 500
-      37           1 :         n.setHI(500.);
-      38           1 :         n.setHII(500.);
-      39           1 :         n.setH2(500.);
-      40             : 
-      41             :         //check if output is changed to 500 in types and is 0 (all deactivated) for Hges
-      42           1 :         EXPECT_DOUBLE_EQ(n.getHIDensity(p), 500.);
-      43           1 :         EXPECT_DOUBLE_EQ(n.getHIIDensity(p), 500.);
-      44           1 :         EXPECT_DOUBLE_EQ(n.getH2Density(p), 500.);
-      45             : 
-      46             :         //deactivate all
-      47           1 :         n.setHI(false);
-      48           1 :         n.setHII(false);
-      49           1 :         n.setH2(false);
-      50             : 
-      51             :         //check if all isfor are set to false
-      52           1 :         useHI = n.getIsForHI();
-      53           1 :         useHII= n.getIsForHII();
-      54           1 :         useH2 = n.getIsForH2();
-      55           1 :         EXPECT_FALSE(useHI);
-      56           1 :         EXPECT_FALSE(useHII);
-      57           1 :         EXPECT_FALSE(useH2);
-      58             : 
-      59             :         //get<type>Density is independent of type activation, getDensity is not independent
-      60             :         //check if getDensity returns 0. (should give a error message in log file)
-      61           1 :         ::testing::internal::CaptureStderr();
-      62           1 :         EXPECT_DOUBLE_EQ(n.getDensity(p), 0);
-      63           1 :         EXPECT_DOUBLE_EQ(n.getNucleonDensity(p),0);
-      64           1 :         std::string captured = testing::internal::GetCapturedStderr();
-      65           1 :         EXPECT_NE(captured.find("WARNING"), std::string::npos);
-      66           1 : }
-      67             : 
-      68             : 
-      69           2 : TEST(testDensityList, SimpleTest) {
-      70             : 
-      71             :         DensityList MS;
-      72           1 :         MS.addDensity(new ConstantDensity(1,1,2));      //sum 4
-      73           2 :         MS.addDensity(new ConstantDensity(2,3,1));      //sum 6
-      74             : 
-      75             :         Vector3d p(50*pc,10*pc,-30*pc); //random position for testing density
-      76           1 :         EXPECT_DOUBLE_EQ(MS.getHIDensity(p),3);
-      77           1 :         EXPECT_DOUBLE_EQ(MS.getHIIDensity(p),4);
-      78           1 :         EXPECT_DOUBLE_EQ(MS.getH2Density(p),3);
-      79           1 :         EXPECT_DOUBLE_EQ(MS.getDensity(p),10);  //sum of sums
-      80           1 :         EXPECT_DOUBLE_EQ(MS.getNucleonDensity(p),13);   // 3+4+2*3 factor 2 for molecular hydrogen
-      81             : 
-      82           1 : }
-      83             : 
-      84           2 : TEST(testCordes, checkValueAtCertainPoints) {
-      85             : 
-      86             :         Cordes n;
-      87             : 
-      88             :         //check type Information
-      89           1 :         EXPECT_FALSE(n.getIsForHI());
-      90           1 :         EXPECT_TRUE(n.getIsForHII());
-      91           1 :         EXPECT_FALSE(n.getIsForH2());
-      92             : 
-      93             :         Vector3d p(3.1*kpc,2.9*kpc,-30*pc);     //position for testing density
-      94             : 
-      95           1 :         EXPECT_NEAR(n.getHIIDensity(p), 184500.,1);     // output in m^-3 ; uncertainty of 1e-6 cm^-3
-      96           1 :         EXPECT_NEAR(n.getDensity(p), 184500.,1);
-      97           1 :         EXPECT_NEAR(n.getNucleonDensity(p), 184500,1);  // only HII component -> no differenz between density and nucleon density
-      98           1 :         p.z=30*pc;                      // invariant density for +/- z
-      99           1 :         EXPECT_NEAR(n.getDensity(p),184500,1);
-     100             : 
-     101           1 : }
-     102             : 
-     103           2 : TEST(testNakanishi, checkValueAtCertainPoints) {
-     104             : 
-     105             :         Nakanishi n;
-     106             : 
-     107             :         //check type Information
-     108           1 :         EXPECT_TRUE(n.getIsForHI());
-     109           1 :         EXPECT_FALSE(n.getIsForHII());
-     110           1 :         EXPECT_TRUE(n.getIsForH2());
-     111             : 
-     112             :         //first position for testing density
-     113             :         Vector3d p(4*kpc,-2.5*kpc,-0.85*kpc);
-     114             : 
-     115             :         //testing HI component
-     116           1 :         EXPECT_NEAR(n.getHIPlanedensity(p),162597,1);   //uncertaincy of 1e-6 cm^-3
-     117           1 :         EXPECT_NEAR(n.getHIScaleheight(p),0.3109*kpc,0.1*pc);
-     118           1 :         EXPECT_NEAR(n.getHIDensity(p),914,1);   //uncertainc 1e-6 cm^-3
-     119             : 
-     120             :         //testing H2 compontent
-     121           1 :         EXPECT_NEAR(n.getH2Planedensity(p),741999,1); //uncertaincy of 1e-6 cm^-3
-     122           1 :         EXPECT_NEAR(n.getH2Scaleheight(p),88.2*pc,0.1*pc);
-     123           1 :         EXPECT_NEAR(n.getH2Density(p),0,1);
-     124             : 
-     125             :         //testing total Density
-     126           1 :         EXPECT_NEAR(n.getDensity(p),914,2); //double uncertaincy for both type á 1cm^-3
-     127           1 :         EXPECT_NEAR(n.getNucleonDensity(p),914,2);      // 914 + 0*2    factor 2 for molecular hydrogen
-     128             : 
-     129             :         //second position for testing density
-     130             :         p = Vector3d(50*pc,100*pc,10*pc);
-     131             : 
-     132             :         //testing HI component
-     133           1 :         EXPECT_NEAR(n.getHIPlanedensity(p),543249,1);
-     134           1 :         EXPECT_NEAR(n.getHIScaleheight(p),125.6*pc,0.1*pc);
-     135           1 :         EXPECT_NEAR(n.getHIDensity(p),540867,1);
-     136             : 
-     137             :         //testing H2 component
-     138           1 :         EXPECT_NEAR(n.getH2Planedensity(p),10556748,1);
-     139           1 :         EXPECT_NEAR(n.getH2Scaleheight(p),57.2*pc,0.1*pc);
-     140           1 :         EXPECT_NEAR(n.getH2Density(p),10335137,1);
-     141             : 
-     142             :         //testing total Density
-     143           1 :         EXPECT_NEAR(n.getDensity(p),10876004,2);
-     144           1 :         EXPECT_NEAR(n.getNucleonDensity(p),21211141,2); // factor 2 in molecular hydrogen
-     145             : 
-     146             :         //test set type function
-     147           1 :         n.setIsForHI(false);
-     148           1 :         EXPECT_FALSE(n.getIsForHI());
-     149           1 :         EXPECT_TRUE(n.getIsForH2());
-     150             : 
-     151           1 :         n.setIsForH2(false);
-     152           1 :         EXPECT_FALSE(n.getIsForHI());
-     153           1 :         EXPECT_FALSE(n.getIsForH2());
-     154             : 
-     155             :         //check if density output is zero if all density-types are deaktivated (should give warning in log-file)
-     156           1 :         ::testing::internal::CaptureStderr();
-     157           1 :         EXPECT_DOUBLE_EQ(n.getDensity(p),0);
-     158           1 :         EXPECT_DOUBLE_EQ(n.getNucleonDensity(p),0);
-     159           1 :         std::string captured = testing::internal::GetCapturedStderr();
-     160           1 :         EXPECT_NE(captured.find("WARNING"), std::string::npos);
-     161             : 
-     162           1 : }
-     163             : 
-     164           1 : TEST(testFerriere, checkValueAtCertainPoints) {
-     165           1 :         ::testing::internal::CaptureStderr();
-     166             :         Ferriere n;
-     167             : 
-     168             :         //check type information
-     169             : 
-     170           1 :         EXPECT_TRUE(n.getIsForHI());
-     171           1 :         EXPECT_TRUE(n.getIsForHII());
-     172           1 :         EXPECT_TRUE(n.getIsForH2());
-     173             : 
-     174             :         //testing density in inner Ring (R <= 3*kpc)
-     175             :         Vector3d p(60*pc,-60*pc,-20*pc);        //testing position in region of CMZ
-     176             : 
-     177             :         //test CMZ Trafo
-     178             :         Vector3d Trafo;
-     179           1 :         Trafo = n.CMZTransformation(p);
-     180           1 :         EXPECT_NEAR(Trafo.x,5.9767*pc,1e-4*pc);
-     181           1 :         EXPECT_NEAR(Trafo.y,12.8171*pc,1e-4*pc);
-     182           1 :         EXPECT_DOUBLE_EQ(Trafo.z,p.z);  //no transformation in z component
-     183             : 
-     184             :         //test DISK Trafo
-     185           1 :         Trafo = n.DiskTransformation(p);
-     186           1 :         EXPECT_NEAR(Trafo.x,11.0660*pc,1e-4*pc);
-     187           1 :         EXPECT_NEAR(Trafo.y,82.5860*pc,1e-4*pc);
-     188           1 :         EXPECT_NEAR(Trafo.z,-25.6338*pc,1e-4*pc);
-     189             : 
-     190             :         //testing density
-     191           1 :         EXPECT_NEAR(n.getHIDensity(p),6237723,1);       //uncertaincy 1e-6 cm^-3
-     192           1 :         EXPECT_NEAR(n.getH2Density(p),35484825,1);
-     193           1 :         EXPECT_NEAR(n.getHIIDensity(p),6243793,1);
-     194           1 :         EXPECT_NEAR(n.getDensity(p),47966341,1);
-     195           1 :         EXPECT_NEAR(n.getNucleonDensity(p),83451166,2);         //factor 2 in molecular hydrogen; double uncertaincy
-     196             : 
-     197             :         Vector3d p2(-500*pc,-900*pc,35*pc);     //testing position in region of the DISK
-     198           1 :         EXPECT_NEAR(n.getHIIDensity(p2),48190,1);
-     199           1 :         EXPECT_NEAR(n.getHIDensity(p2),5,1);
-     200           1 :         EXPECT_NEAR(n.getH2Density(p2),0,1);
-     201           1 :         EXPECT_NEAR(n.getDensity(p2),48195,1);
-     202           1 :         EXPECT_NEAR(n.getNucleonDensity(p2),48195,1);   // no H2 component -> no difference between density and nucleon-density
-     203             : 
-     204             :         //testing the outer region R>3kpc
-     205             :         Vector3d p3(5*kpc,4*kpc,-29*pc);        //testing position with 3kpc < R < R_sun
-     206           1 :         EXPECT_NEAR(n.getHIDensity(p3),540607,1);
-     207           1 :         EXPECT_NEAR(n.getHIIDensity(p3),66495 ,1);
-     208           1 :         EXPECT_NEAR(n.getH2Density(p3),2492685,1);
-     209           1 :         EXPECT_NEAR(n.getDensity(p3),3099787,1);
-     210           1 :         EXPECT_NEAR(n.getNucleonDensity(p3), 5592472,1);
-     211             : 
-     212             :         Vector3d p4(10*kpc,2*kpc,50*pc);        //testing position with R > R_sun
-     213           1 :         EXPECT_NEAR(n.getHIDensity(p4),431294,1);
-     214           1 :         EXPECT_NEAR(n.getHIIDensity(p4),22109,1);
-     215           1 :         EXPECT_NEAR(n.getH2Density(p4),54099,1);
-     216           1 :         EXPECT_NEAR(n.getDensity(p4),507502,1);
-     217           1 :         EXPECT_NEAR(n.getNucleonDensity(p4),561601,1);
-     218             : 
-     219             :         //test get/set type function
-     220           1 :         n.setIsForHI(false);
-     221           1 :         EXPECT_FALSE(n.getIsForHI());
-     222           1 :         EXPECT_TRUE(n.getIsForHII());
-     223           1 :         EXPECT_TRUE(n.getIsForH2());
-     224             : 
-     225           1 :         n.setIsForHII(false);
-     226           1 :         EXPECT_FALSE(n.getIsForHI());
-     227           1 :         EXPECT_FALSE(n.getIsForHII());
-     228           1 :         EXPECT_TRUE(n.getIsForH2());
-     229             : 
-     230           1 :         n.setIsForH2(false);
-     231           1 :         EXPECT_FALSE(n.getIsForHI());
-     232           1 :         EXPECT_FALSE(n.getIsForHII());
-     233           1 :         EXPECT_FALSE(n.getIsForH2());
-     234             : 
-     235             :         //check if density is set to zero if all types are deactivated (should give warning in log-file)
-     236           1 :         EXPECT_DOUBLE_EQ(n.getDensity(p),0);
-     237           1 :         EXPECT_DOUBLE_EQ(n.getNucleonDensity(p),0);
-     238           1 :         std::string captured = testing::internal::GetCapturedStderr();
-     239           1 :         EXPECT_NE(captured.find("WARNING"), std::string::npos);
-     240           1 : }
-     241             : 
-     242           2 : TEST(testGridDensity, SimpleTest) {
-     243           1 :         ref_ptr<Grid1f> grid = new Grid1f(Vector3d(0.), 1, 1, 1, 1.);     
-     244           1 :         DensityGrid dens = DensityGrid(grid, true, false, false);
-     245             : 
-     246             :         // check active types
-     247           1 :         EXPECT_TRUE(dens.getIsForHI()); 
-     248           1 :         EXPECT_FALSE(dens.getIsForHII());
-     249           1 :         EXPECT_FALSE(dens.getIsForH2());
-     250             : 
-     251             :         // check set function
-     252           1 :         dens.setIsForH2(true);
-     253           1 :         EXPECT_TRUE(dens.getIsForH2());
-     254             : 
-     255           1 :         dens.setIsForHII(true);
-     256           1 :         EXPECT_TRUE(dens.getIsForHII());
-     257             : 
-     258           1 :         dens.setIsForHI(false);
-     259           1 :         EXPECT_FALSE(dens.getIsForHI());
-     260           1 : }
-     261             : 
-     262           2 : TEST(testGridDensity, testRetrunValue) {
-     263             :         size_t Nx = 5;
-     264             :         size_t Ny = 8;
-     265             :         size_t Nz = 10;
-     266             :         double spacing = 2.0;
-     267             :         Vector3d origin(1., 2., 3.);
-     268             : 
-     269           1 :         ref_ptr<Grid1f> grid = new Grid1f(origin, Nx, Ny, Nz, spacing);
-     270             : 
-     271             :         // set some values for the grid
-     272           1 :         grid->get(3, 2, 4) = 5;
-     273           1 :         grid->get(3, 2, 5) = 12;
-     274           1 :         grid->get(2, 3, 4) = 6;
-     275             : 
-     276           2 :         DensityGrid dens = DensityGrid(grid, true, false, false);
-     277             : 
-     278             :         // a point in the region where values are defined for the grid.
-     279             :         Vector3d position = origin + Vector3d(2.2, 2.8, 4.1) * spacing; 
-     280           1 :         double valueFromGrid =  grid->interpolate(position);
-     281           1 :         double nHI = dens.getHIDensity(position);
-     282           1 :         double nHII = dens.getHIIDensity(position);
-     283           1 :         double nH2 = dens.getH2Density(position);
-     284           1 :         double nNucleon = dens.getNucleonDensity(position);
-     285           1 :         double nTotal = dens.getDensity(position);
-     286             : 
-     287             :         // Check for values
-     288           1 :         EXPECT_DOUBLE_EQ(valueFromGrid, nHI);
-     289           1 :         EXPECT_DOUBLE_EQ(nHII, 0);      // HII is set to false and should be 0
-     290           1 :         EXPECT_DOUBLE_EQ(nH2, 0);       // H2 is set to false and should be 0
-     291           1 :         EXPECT_DOUBLE_EQ(nNucleon, valueFromGrid);
-     292           1 :         EXPECT_DOUBLE_EQ(nTotal, valueFromGrid);
-     293           1 : }
-     294             : 
-     295             : 
-     296             : } //namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testFunctionalGroups.cpp.func-sort-c.html b/doc/coverageReport/test/testFunctionalGroups.cpp.func-sort-c.html deleted file mode 100644 index 1eaa671c2..000000000 --- a/doc/coverageReport/test/testFunctionalGroups.cpp.func-sort-c.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testFunctionalGroups.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testFunctionalGroups.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:202387.0 %
Date:2024-04-08 14:58:22Functions:1250.0 %
-
- -
- - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa4mainEiPPc0
_ZN7crpropa36testFunctionalGroups_gyroradius_Test8TestBodyEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testFunctionalGroups.cpp.func.html b/doc/coverageReport/test/testFunctionalGroups.cpp.func.html deleted file mode 100644 index 24b5d5269..000000000 --- a/doc/coverageReport/test/testFunctionalGroups.cpp.func.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testFunctionalGroups.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testFunctionalGroups.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:202387.0 %
Date:2024-04-08 14:58:22Functions:1250.0 %
-
- -
- - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa36testFunctionalGroups_gyroradius_Test8TestBodyEv1
_ZN7crpropa4mainEiPPc0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testFunctionalGroups.cpp.gcov.html b/doc/coverageReport/test/testFunctionalGroups.cpp.gcov.html deleted file mode 100644 index e6bdc1708..000000000 --- a/doc/coverageReport/test/testFunctionalGroups.cpp.gcov.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testFunctionalGroups.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testFunctionalGroups.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:202387.0 %
Date:2024-04-08 14:58:22Functions:1250.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "CRPropa.h"
-       2             : #include "gtest/gtest.h"
-       3             : 
-       4             : namespace crpropa {
-       5             : 
-       6             : /*
-       7             :  * Functional test which calculates the particle's gyroradius in a uniform field
-       8             :  * r_g = R / (B*c) = 1 EV / (1 nG * c) \approx 1.08*Mpc
-       9             :  */
-      10           2 : TEST(testFunctionalGroups, gyroradius) {
-      11             :         double energy = 1*EeV;
-      12             :         double field = 1*nG;
-      13             : 
-      14           1 :         ParticleState p;
-      15           1 :         p.setId(nucleusId(1, 1));
-      16           1 :         p.setEnergy(energy);
-      17           1 :         p.setPosition(Vector3d(0, 0, 0));
-      18           1 :         p.setDirection(Vector3d(0, 0, 1));
-      19             : 
-      20           1 :         ref_ptr<Candidate> c = new Candidate(p);
-      21           1 :         ref_ptr<PropagationCK> propa = new PropagationCK(new UniformMagneticField(Vector3d(field, 0, 0)));
-      22           1 :         ref_ptr<ParticleCollector> collector = new ParticleCollector();
-      23           1 :         collector->setClone(true);
-      24           1 :         ref_ptr<ModuleList> sim = new ModuleList();
-      25             : 
-      26             :         Vector3d pos;
-      27             :         double max_y = 0;
-      28             : 
-      29           1 :         sim->add(propa);
-      30           1 :         sim->add(new MaximumTrajectoryLength(10*Mpc));
-      31           1 :         sim->add(collector);
-      32             : 
-      33           1 :         sim->run(c);
-      34             : 
-      35          16 :         for (ParticleCollector::iterator itr = collector->begin(); itr != collector->end(); ++itr){
-      36          15 :                 pos = (*(itr->get())).current.getPosition();
-      37          15 :                 if (max_y < pos.getY())
-      38             :                         max_y = pos.getY();
-      39             :         }
-      40             : 
-      41           1 :         EXPECT_NEAR(max_y/2.0, energy/(field * c_light * eplus), 0.01*Mpc);
-      42             : 
-      43           1 : }
-      44             : 
-      45           0 : int main(int argc, char **argv) {
-      46           0 :         ::testing::InitGoogleTest(&argc, argv);
-      47           0 :         return RUN_ALL_TESTS();
-      48             : }
-      49             : 
-      50             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testInteraction.cpp.func-sort-c.html b/doc/coverageReport/test/testInteraction.cpp.func-sort-c.html deleted file mode 100644 index e28ec63a0..000000000 --- a/doc/coverageReport/test/testInteraction.cpp.func-sort-c.html +++ /dev/null @@ -1,284 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testInteraction.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testInteraction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:74378794.4 %
Date:2024-04-08 14:58:22Functions:525398.1 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa4mainEiPPc0
_ZN7crpropa24Redshift_simpleTest_Test8TestBodyEv1
_ZN7crpropa25NuclearDecay_helium5_Test8TestBodyEv1
_ZN7crpropa26NuclearDecay_lithium4_Test8TestBodyEv1
_ZN7crpropa28NuclearDecay_scandium44_Test8TestBodyEv1
_ZN7crpropa29NuclearDecay_secondaries_Test8TestBodyEv1
_ZN7crpropa29PhotoDisintegration_iron_Test8TestBodyEv1
_ZN7crpropa31NuclearDecay_limitNextStep_Test8TestBodyEv1
_ZN7crpropa31PhotoDisintegration_carbon_Test8TestBodyEv1
_ZN7crpropa31PhotoPionProduction_helium_Test8TestBodyEv1
_ZN7crpropa31PhotoPionProduction_proton_Test8TestBodyEv1
_ZN7crpropa32NuclearDecay_interactionTag_Test8TestBodyEv1
_ZN7crpropa33EMPairProduction_secondaries_Test8TestBodyEv1
_ZN7crpropa33PhotoPionProduction_sampling_Test8TestBodyEv1
_ZN7crpropa34ElasticScattering_secondaries_Test8TestBodyEv1
_ZN7crpropa35EMPairProduction_limitNextStep_Test8TestBodyEv1
_ZN7crpropa35Redshift_limitRedshiftDecrease_Test8TestBodyEv1
_ZN7crpropa36EMPairProduction_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa36EMPairProduction_interactionTag_Test8TestBodyEv1
_ZN7crpropa36NuclearDecay_allChannelsWorking_Test8TestBodyEv1
_ZN7crpropa36NuclearDecay_thisIsNotNucleonic_Test8TestBodyEv1
_ZN7crpropa36PhotoDisintegration_allIsotopes_Test8TestBodyEv1
_ZN7crpropa36PhotoPionProduction_secondaries_Test8TestBodyEv1
_ZN7crpropa37ElasticScattering_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa37ElectronPairProduction_valuesCMB_Test8TestBodyEv1
_ZN7crpropa37ElectronPairProduction_valuesIRB_Test8TestBodyEv1
_ZN7crpropa38PhotoDisintegration_limitNextStep_Test8TestBodyEv1
_ZN7crpropa38PhotoPionProduction_limitNextStep_Test8TestBodyEv1
_ZN7crpropa39EMDoublePairProduction_secondaries_Test8TestBodyEv1
_ZN7crpropa39PhotoDisintegration_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa39PhotoDisintegration_interactionTag_Test8TestBodyEv1
_ZN7crpropa39PhotoPionProduction_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa39PhotoPionProduction_interactionTag_Test8TestBodyEv1
_ZN7crpropa40EMTripletPairProduction_secondaries_Test8TestBodyEv1
_ZN7crpropa40SynchrotronRadiation_interactionTag_Test8TestBodyEv1
_ZN7crpropa41EMDoublePairProduction_limitNextStep_Test8TestBodyEv1
_ZN7crpropa42EMDoublePairProduction_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa42EMDoublePairProduction_interactionTag_Test8TestBodyEv1
_ZN7crpropa42EMTripletPairProduction_limitNextStep_Test8TestBodyEv1
_ZN7crpropa42ElectronPairProduction_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa42ElectronPairProduction_interactionTag_Test8TestBodyEv1
_ZN7crpropa43EMInverseComptonScattering_secondaries_Test8TestBodyEv1
_ZN7crpropa43EMTripletPairProduction_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa43EMTripletPairProduction_interactionTag_Test8TestBodyEv1
_ZN7crpropa43PhotoDisintegration_thisIsNotNucleonic_Test8TestBodyEv1
_ZN7crpropa43PhotoPionProduction_thisIsNotNucleonic_Test8TestBodyEv1
_ZN7crpropa44ElectronPairProduction_energyDecreasing_Test8TestBodyEv1
_ZN7crpropa45EMInverseComptonScattering_limitNextStep_Test8TestBodyEv1
_ZN7crpropa46EMInverseComptonScattering_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa46EMInverseComptonScattering_interactionTag_Test8TestBodyEv1
_ZN7crpropa46ElectronPairProduction_thisIsNotNucleonic_Test8TestBodyEv1
_ZN7crpropa47ElectronPairProduction_belowEnergyTreshold_Test8TestBodyEv1
_ZN7crpropa55Photodisintegration_updateParticleParentProperties_Test8TestBodyEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testInteraction.cpp.func.html b/doc/coverageReport/test/testInteraction.cpp.func.html deleted file mode 100644 index ded452dfc..000000000 --- a/doc/coverageReport/test/testInteraction.cpp.func.html +++ /dev/null @@ -1,284 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testInteraction.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testInteraction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:74378794.4 %
Date:2024-04-08 14:58:22Functions:525398.1 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa24Redshift_simpleTest_Test8TestBodyEv1
_ZN7crpropa25NuclearDecay_helium5_Test8TestBodyEv1
_ZN7crpropa26NuclearDecay_lithium4_Test8TestBodyEv1
_ZN7crpropa28NuclearDecay_scandium44_Test8TestBodyEv1
_ZN7crpropa29NuclearDecay_secondaries_Test8TestBodyEv1
_ZN7crpropa29PhotoDisintegration_iron_Test8TestBodyEv1
_ZN7crpropa31NuclearDecay_limitNextStep_Test8TestBodyEv1
_ZN7crpropa31PhotoDisintegration_carbon_Test8TestBodyEv1
_ZN7crpropa31PhotoPionProduction_helium_Test8TestBodyEv1
_ZN7crpropa31PhotoPionProduction_proton_Test8TestBodyEv1
_ZN7crpropa32NuclearDecay_interactionTag_Test8TestBodyEv1
_ZN7crpropa33EMPairProduction_secondaries_Test8TestBodyEv1
_ZN7crpropa33PhotoPionProduction_sampling_Test8TestBodyEv1
_ZN7crpropa34ElasticScattering_secondaries_Test8TestBodyEv1
_ZN7crpropa35EMPairProduction_limitNextStep_Test8TestBodyEv1
_ZN7crpropa35Redshift_limitRedshiftDecrease_Test8TestBodyEv1
_ZN7crpropa36EMPairProduction_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa36EMPairProduction_interactionTag_Test8TestBodyEv1
_ZN7crpropa36NuclearDecay_allChannelsWorking_Test8TestBodyEv1
_ZN7crpropa36NuclearDecay_thisIsNotNucleonic_Test8TestBodyEv1
_ZN7crpropa36PhotoDisintegration_allIsotopes_Test8TestBodyEv1
_ZN7crpropa36PhotoPionProduction_secondaries_Test8TestBodyEv1
_ZN7crpropa37ElasticScattering_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa37ElectronPairProduction_valuesCMB_Test8TestBodyEv1
_ZN7crpropa37ElectronPairProduction_valuesIRB_Test8TestBodyEv1
_ZN7crpropa38PhotoDisintegration_limitNextStep_Test8TestBodyEv1
_ZN7crpropa38PhotoPionProduction_limitNextStep_Test8TestBodyEv1
_ZN7crpropa39EMDoublePairProduction_secondaries_Test8TestBodyEv1
_ZN7crpropa39PhotoDisintegration_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa39PhotoDisintegration_interactionTag_Test8TestBodyEv1
_ZN7crpropa39PhotoPionProduction_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa39PhotoPionProduction_interactionTag_Test8TestBodyEv1
_ZN7crpropa40EMTripletPairProduction_secondaries_Test8TestBodyEv1
_ZN7crpropa40SynchrotronRadiation_interactionTag_Test8TestBodyEv1
_ZN7crpropa41EMDoublePairProduction_limitNextStep_Test8TestBodyEv1
_ZN7crpropa42EMDoublePairProduction_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa42EMDoublePairProduction_interactionTag_Test8TestBodyEv1
_ZN7crpropa42EMTripletPairProduction_limitNextStep_Test8TestBodyEv1
_ZN7crpropa42ElectronPairProduction_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa42ElectronPairProduction_interactionTag_Test8TestBodyEv1
_ZN7crpropa43EMInverseComptonScattering_secondaries_Test8TestBodyEv1
_ZN7crpropa43EMTripletPairProduction_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa43EMTripletPairProduction_interactionTag_Test8TestBodyEv1
_ZN7crpropa43PhotoDisintegration_thisIsNotNucleonic_Test8TestBodyEv1
_ZN7crpropa43PhotoPionProduction_thisIsNotNucleonic_Test8TestBodyEv1
_ZN7crpropa44ElectronPairProduction_energyDecreasing_Test8TestBodyEv1
_ZN7crpropa45EMInverseComptonScattering_limitNextStep_Test8TestBodyEv1
_ZN7crpropa46EMInverseComptonScattering_allBackgrounds_Test8TestBodyEv1
_ZN7crpropa46EMInverseComptonScattering_interactionTag_Test8TestBodyEv1
_ZN7crpropa46ElectronPairProduction_thisIsNotNucleonic_Test8TestBodyEv1
_ZN7crpropa47ElectronPairProduction_belowEnergyTreshold_Test8TestBodyEv1
_ZN7crpropa4mainEiPPc0
_ZN7crpropa55Photodisintegration_updateParticleParentProperties_Test8TestBodyEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testInteraction.cpp.gcov.html b/doc/coverageReport/test/testInteraction.cpp.gcov.html deleted file mode 100644 index a903e964c..000000000 --- a/doc/coverageReport/test/testInteraction.cpp.gcov.html +++ /dev/null @@ -1,1229 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testInteraction.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testInteraction.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:74378794.4 %
Date:2024-04-08 14:58:22Functions:525398.1 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/Candidate.h"
-       2             : #include "crpropa/Units.h"
-       3             : #include "crpropa/ParticleID.h"
-       4             : #include "crpropa/PhotonBackground.h"
-       5             : #include "crpropa/module/ElectronPairProduction.h"
-       6             : #include "crpropa/module/NuclearDecay.h"
-       7             : #include "crpropa/module/PhotoDisintegration.h"
-       8             : #include "crpropa/module/ElasticScattering.h"
-       9             : #include "crpropa/module/PhotoPionProduction.h"
-      10             : #include "crpropa/module/Redshift.h"
-      11             : #include "crpropa/module/EMPairProduction.h"
-      12             : #include "crpropa/module/EMDoublePairProduction.h"
-      13             : #include "crpropa/module/EMTripletPairProduction.h"
-      14             : #include "crpropa/module/EMInverseComptonScattering.h"
-      15             : #include "crpropa/module/SynchrotronRadiation.h"
-      16             : #include "gtest/gtest.h"
-      17             : 
-      18             : #include <fstream>
-      19             : 
-      20             : namespace crpropa {
-      21             : 
-      22             : // ElectronPairProduction -----------------------------------------------------
-      23           1 : TEST(ElectronPairProduction, allBackgrounds) {
-      24             :         // Test if interaction data files are loaded.
-      25           1 :         ref_ptr<PhotonField> cmb = new CMB();
-      26           1 :         ElectronPairProduction epp(cmb);
-      27           1 :         ref_ptr<PhotonField> irb = new IRB_Kneiske04();
-      28           1 :         epp.setPhotonField(irb);
-      29           2 :         irb = new IRB_Stecker05();
-      30           1 :         epp.setPhotonField(irb);
-      31           2 :         irb = new IRB_Franceschini08();
-      32           1 :         epp.setPhotonField(irb);
-      33           2 :         irb = new IRB_Finke10();
-      34           1 :         epp.setPhotonField(irb);
-      35           2 :         irb = new IRB_Dominguez11();
-      36           1 :         epp.setPhotonField(irb);
-      37           2 :         irb = new IRB_Gilmore12();
-      38           1 :         epp.setPhotonField(irb);
-      39           2 :         irb = new IRB_Stecker16_upper();
-      40           1 :         epp.setPhotonField(irb);
-      41           2 :         irb = new IRB_Stecker16_lower();
-      42           1 :         epp.setPhotonField(irb);
-      43           2 :     irb = new IRB_Finke22();
-      44           2 :         epp.setPhotonField(irb);
-      45           2 : }
-      46             : 
-      47           1 : TEST(ElectronPairProduction, energyDecreasing) {
-      48             :         // Test if energy loss occurs for protons with energies from 1e15 - 1e23 eV.
-      49           1 :         Candidate c;
-      50           1 :         c.setCurrentStep(2 * Mpc);
-      51           1 :         c.current.setId(nucleusId(1, 1)); // proton
-      52             : 
-      53           1 :         ref_ptr<PhotonField> cmb = new CMB();
-      54           1 :         ElectronPairProduction epp1(cmb);
-      55          81 :         for (int i = 0; i < 80; i++) {
-      56          80 :                 double E = pow(10, 15 + i * 0.1) * eV;
-      57          80 :                 c.current.setEnergy(E);
-      58          80 :                 epp1.process(&c);
-      59          80 :                 EXPECT_LE(c.current.getEnergy(), E);
-      60             :         }
-      61             : 
-      62           1 :         ref_ptr<PhotonField> irb = new IRB_Kneiske04();
-      63           2 :         ElectronPairProduction epp2(irb);
-      64          81 :         for (int i = 0; i < 80; i++) {
-      65          80 :                 double E = pow(10, 15 + i * 0.1) * eV;
-      66          80 :                 c.current.setEnergy(E);
-      67          80 :                 epp2.process(&c);
-      68          80 :                 EXPECT_LE(c.current.getEnergy(), E);
-      69             :         }
-      70           2 : }
-      71             : 
-      72           1 : TEST(ElectronPairProduction, belowEnergyTreshold) {
-      73             :         // Test if nothing happens below 1e15 eV.
-      74           1 :         ref_ptr<PhotonField> cmb = new CMB();
-      75           1 :         ElectronPairProduction epp(cmb);
-      76           1 :         Candidate c(nucleusId(1, 1), 1E14 * eV);
-      77           1 :         epp.process(&c);
-      78           1 :         EXPECT_DOUBLE_EQ(1E14 * eV, c.current.getEnergy());
-      79           2 : }
-      80             : 
-      81           1 : TEST(ElectronPairProduction, thisIsNotNucleonic) {
-      82             :         // Test if non-nuclei are skipped.
-      83           1 :         ref_ptr<PhotonField> cmb = new CMB();
-      84           1 :         ElectronPairProduction epp(cmb);
-      85           1 :         Candidate c(11, 1E20 * eV);  // electron
-      86           1 :         epp.process(&c);
-      87           1 :         EXPECT_DOUBLE_EQ(1E20 * eV, c.current.getEnergy());
-      88           2 : }
-      89             : 
-      90           2 : TEST(ElectronPairProduction, valuesCMB) {
-      91             :         // Test if energy loss corresponds to the data table.
-      92             :         std::vector<double> x;
-      93             :         std::vector<double> y;
-      94           2 :         std::ifstream infile(getDataPath("pair_CMB.txt").c_str());
-      95           1 :         while (infile.good()) {
-      96           0 :                 if (infile.peek() != '#') {
-      97             :                         double a, b;
-      98             :                         infile >> a >> b;
-      99           0 :                         if (infile) {
-     100           0 :                                 x.push_back(a * eV);
-     101           0 :                                 y.push_back(b * eV / Mpc);
-     102             :                         }
-     103             :                 }
-     104           0 :                 infile.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
-     105             :         }
-     106           1 :         infile.close();
-     107             : 
-     108           1 :         Candidate c;
-     109           1 :         c.setCurrentStep(1 * Mpc);
-     110           1 :         c.current.setId(nucleusId(1, 1)); // proton
-     111           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     112             : 
-     113           1 :         ElectronPairProduction epp(cmb);
-     114           1 :         for (int i = 0; i < x.size(); i++) {
-     115           0 :                 c.current.setEnergy(x[i]);
-     116           0 :                 epp.process(&c);
-     117           0 :                 double dE = x[i] - c.current.getEnergy();
-     118           0 :                 double dE_table = y[i] * 1 * Mpc;
-     119           0 :                 EXPECT_NEAR(dE_table, dE, 1e-12);
-     120             :         }
-     121           3 : }
-     122             : 
-     123           1 : TEST(ElectronPairProduction, interactionTag) {
-     124             :         
-     125           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     126           0 :         ElectronPairProduction epp(cmb);
-     127             :         
-     128             :         // test the default interaction tag
-     129           2 :         EXPECT_TRUE(epp.getInteractionTag() == "EPP");
-     130             : 
-     131             :         // test changing the interaction tag
-     132           1 :         epp.setInteractionTag("myTag");
-     133           2 :         EXPECT_TRUE(epp.getInteractionTag() == "myTag");
-     134             : 
-     135             :         // test the tag of produced secondaries
-     136           2 :         Candidate c;
-     137           1 :         c.setCurrentStep(1 * Gpc);
-     138           1 :         c.current.setId(nucleusId(1,1));
-     139           1 :         c.current.setEnergy(100 * EeV);
-     140           1 :         epp.setHaveElectrons(true);
-     141           1 :         epp.process(&c);
-     142             :         
-     143           1 :         std::string secondaryTag = c.secondaries[0] -> getTagOrigin();
-     144           1 :         EXPECT_TRUE(secondaryTag == "myTag");
-     145           2 : }
-     146             : 
-     147           2 : TEST(ElectronPairProduction, valuesIRB) {
-     148             :         // Test if energy loss corresponds to the data table.
-     149             :         std::vector<double> x;
-     150             :         std::vector<double> y;
-     151           2 :         std::ifstream infile(getDataPath("pairIRB.txt").c_str());
-     152           1 :         while (infile.good()) {
-     153           0 :                 if (infile.peek() != '#') {
-     154             :                         double a, b;
-     155             :                         infile >> a >> b;
-     156           0 :                         if (infile) {
-     157           0 :                                 x.push_back(a * eV);
-     158           0 :                                 y.push_back(b * eV / Mpc);
-     159             :                         }
-     160             :                 }
-     161           0 :                 infile.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
-     162             :         }
-     163           1 :         infile.close();
-     164             : 
-     165           1 :         Candidate c;
-     166           1 :         c.setCurrentStep(1 * Mpc);
-     167           1 :         c.current.setId(nucleusId(1, 1)); // proton
-     168           1 :         ref_ptr<PhotonField> irb = new IRB_Kneiske04();
-     169             : 
-     170           1 :         ElectronPairProduction epp(irb);
-     171           1 :         for (int i = 0; i < x.size(); i++) {
-     172           0 :                 c.current.setEnergy(x[i]);
-     173           0 :                 epp.process(&c);
-     174           0 :                 double dE = x[i] - c.current.getEnergy();
-     175           0 :                 double dE_table = y[i] * 1 * Mpc;
-     176           0 :                 EXPECT_NEAR(dE, dE_table, 1e-12);
-     177             :         }
-     178           3 : }
-     179             : 
-     180             : // NuclearDecay ---------------------------------------------------------------
-     181           1 : TEST(NuclearDecay, scandium44) {
-     182             :         // Test beta+ decay of 44Sc to 44Ca.
-     183             :         // This test can stochastically fail.
-     184           1 :         NuclearDecay d(true, true);
-     185           1 :         Candidate c(nucleusId(44, 21), 1E18 * eV);
-     186           1 :         c.setCurrentStep(100 * Mpc);
-     187           1 :         double gamma = c.current.getLorentzFactor();
-     188           1 :         d.process(&c);
-     189             :         
-     190             :         // expected decay product: 44Ca
-     191           1 :         EXPECT_EQ(nucleusId(44, 20), c.current.getId());
-     192             : 
-     193             :         // expect Lorentz factor to be conserved
-     194           1 :         EXPECT_DOUBLE_EQ(gamma, c.current.getLorentzFactor());
-     195             :         
-     196             :         // expect at least two secondaries: positron + electron neutrino
-     197           1 :         EXPECT_GE(c.secondaries.size(), 2);
-     198           1 : }
-     199             : 
-     200           1 : TEST(NuclearDecay, lithium4) {
-     201             :         // Test proton dripping of Li-4 to He-3
-     202             :         // This test can stochastically fail
-     203           1 :         NuclearDecay d;
-     204           1 :         Candidate c(nucleusId(4, 3), 4 * EeV);
-     205           1 :         c.setCurrentStep(100 * Mpc);
-     206           1 :         d.process(&c);
-     207             :         
-     208             :         // expected decay product: He-3
-     209           1 :         EXPECT_EQ(nucleusId(3, 2), c.current.getId());
-     210             : 
-     211             :         // expected secondary: proton
-     212           1 :         EXPECT_EQ(1, c.secondaries.size());
-     213           2 :         Candidate c1 = *c.secondaries[0];
-     214           1 :         EXPECT_EQ(nucleusId(1, 1), c1.current.getId());
-     215           1 :         EXPECT_EQ(1 * EeV, c1.current.getEnergy());
-     216           1 : }
-     217             : 
-     218           1 : TEST(NuclearDecay, helium5) {
-     219             :         // Test neutron dripping of He-5 to He-4.
-     220             :         // This test can stochastically fail.
-     221           1 :         NuclearDecay d;
-     222           1 :         Candidate c(nucleusId(5, 2), 5 * EeV);
-     223           1 :         c.setCurrentStep(100 * Mpc);
-     224           1 :         d.process(&c);
-     225             : 
-     226             :         // expected primary: He-4
-     227           1 :         EXPECT_EQ(nucleusId(4, 2), c.current.getId());
-     228           1 :         EXPECT_EQ(4, c.current.getEnergy() / EeV);
-     229             :         
-     230             :         // expected secondary: neutron
-     231           2 :         Candidate c2 = *c.secondaries[0];
-     232           1 :         EXPECT_EQ(nucleusId(1, 0), c2.current.getId());
-     233           1 :         EXPECT_EQ(1, c2.current.getEnergy() / EeV);
-     234           1 : }
-     235             : 
-     236           1 : TEST(NuclearDecay, limitNextStep) {
-     237             :         // Test if next step is limited in case of a neutron.
-     238           1 :         NuclearDecay decay;
-     239           1 :         Candidate c(nucleusId(1, 0), 10 * EeV);
-     240           1 :         c.setNextStep(std::numeric_limits<double>::max());
-     241           1 :         decay.process(&c);
-     242           1 :         EXPECT_LT(c.getNextStep(), std::numeric_limits<double>::max());
-     243           1 : }
-     244             : 
-     245           1 : TEST(NuclearDecay, allChannelsWorking) {
-     246             :         // Test if all nuclear decays are working.
-     247           1 :         NuclearDecay d;
-     248           1 :         Candidate c;
-     249             : 
-     250           2 :         std::ifstream infile(getDataPath("nuclear_decay.txt").c_str());
-     251         951 :         while (infile.good()) {
-     252         950 :                 if (infile.peek() != '#') {
-     253             :                         int Z, N, channel, foo;
-     254         948 :                         infile >> Z >> N >> channel >> foo;
-     255         948 :                         c.current.setId(nucleusId(Z + N, Z));
-     256         948 :                         c.current.setEnergy(80 * EeV);
-     257         948 :                         d.performInteraction(&c, channel);
-     258             :                 }
-     259         950 :                 infile.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
-     260             :         }
-     261           1 :         infile.close();
-     262           1 : }
-     263             : 
-     264           1 : TEST(NuclearDecay, secondaries) {
-     265             :         // Test if all types of secondaries are produced.
-     266           1 :         NuclearDecay d;
-     267           1 :         d.setHaveElectrons(true);
-     268           1 :         d.setHaveNeutrinos(true);
-     269           1 :         d.setHavePhotons(true);
-     270           1 :         Candidate c;
-     271             : 
-     272             :         // He-8 --> Li-8 + e- + neutrino
-     273             :         // additional photon emitted with 84% probability
-     274             :         // --> expect at least 1 photon out of 10 decays
-     275          11 :         for (int i = 0; i < 10; ++i) {
-     276          10 :                 c.current.setId(nucleusId(8, 2));
-     277          10 :                 c.current.setEnergy(5 * EeV);
-     278          10 :                 d.performInteraction(&c, 10000);
-     279             :         }
-     280             : 
-     281             :         // count number of secondaries
-     282           1 :         size_t nElectrons = 0;
-     283           1 :         size_t nNeutrinos = 0;
-     284           1 :         size_t nPhotons = 0;
-     285             : 
-     286          30 :         for(size_t i = 0; i < c.secondaries.size(); ++i) {
-     287          29 :                 int id = (*c.secondaries[i]).current.getId();
-     288          29 :                 if (id == 22) nPhotons++;
-     289          29 :                 if (id == 11) nElectrons++;
-     290          29 :                 if (id == -12) nNeutrinos++;
-     291             :         }
-     292             : 
-     293           1 :         EXPECT_EQ(nElectrons, 10);
-     294           1 :         EXPECT_EQ(nNeutrinos, 10);
-     295           1 :         EXPECT_GE(nPhotons, 1);
-     296           1 : }
-     297             : 
-     298           1 : TEST(NuclearDecay, thisIsNotNucleonic) {
-     299             :         // Test if nothing happens to an electron
-     300           1 :         NuclearDecay decay;
-     301           1 :         Candidate c(11, 10 * EeV);
-     302           1 :         c.setNextStep(std::numeric_limits<double>::max());
-     303           1 :         decay.process(&c);
-     304           1 :         EXPECT_EQ(11, c.current.getId());
-     305           1 :         EXPECT_EQ(10 * EeV, c.current.getEnergy());
-     306           1 : }
-     307             : 
-     308           1 : TEST(NuclearDecay, interactionTag) {
-     309             :         // test default interaction tag
-     310           1 :         NuclearDecay decay;
-     311           2 :         EXPECT_TRUE(decay.getInteractionTag() == "ND");
-     312             : 
-     313             :         // test secondary tag
-     314           1 :         decay.setHaveElectrons(true);
-     315           2 :         Candidate c(nucleusId(8,2), 5 * EeV);
-     316           1 :         decay.performInteraction(&c, 10000);
-     317           3 :         EXPECT_TRUE(c.secondaries[0] -> getTagOrigin() == "ND");
-     318             : 
-     319             :         // test custom tags
-     320           1 :         decay.setInteractionTag("myTag");
-     321           2 :         EXPECT_TRUE(decay.getInteractionTag() == "myTag");
-     322           1 : }
-     323             : 
-     324             : // PhotoDisintegration --------------------------------------------------------
-     325           1 : TEST(PhotoDisintegration, allBackgrounds) {
-     326             :         // Test if interaction data files are loaded.
-     327           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     328           1 :         PhotoDisintegration pd(cmb);
-     329           1 :         ref_ptr<PhotonField> irb = new IRB_Kneiske04();
-     330           1 :         pd.setPhotonField(irb);
-     331           1 :         ref_ptr<PhotonField> urb = new URB_Protheroe96();
-     332           1 :         pd.setPhotonField(urb);
-     333           2 :         irb = new IRB_Stecker05();
-     334           1 :         pd.setPhotonField(irb);
-     335           2 :         irb = new IRB_Franceschini08();
-     336           1 :         pd.setPhotonField(irb);
-     337           2 :         irb = new IRB_Finke10();
-     338           1 :         pd.setPhotonField(irb);
-     339           2 :         irb = new IRB_Dominguez11();
-     340           1 :         pd.setPhotonField(irb);
-     341           2 :         irb = new IRB_Gilmore12();
-     342           1 :         pd.setPhotonField(irb);
-     343           2 :         irb = new IRB_Stecker16_upper();
-     344           1 :         pd.setPhotonField(irb);
-     345           2 :         irb = new IRB_Stecker16_lower();
-     346           1 :         pd.setPhotonField(irb);
-     347           2 :     irb = new IRB_Finke22();
-     348           1 :         pd.setPhotonField(irb);
-     349           2 :         urb = new URB_Nitu21();
-     350           2 :         pd.setPhotonField(urb);
-     351           2 : }
-     352             : 
-     353           1 : TEST(PhotoDisintegration, carbon) {
-     354             :         // Test if a 100 EeV C-12 nucleus photo-disintegrates (at least once) over a distance of 1 Gpc.
-     355             :         // This test can stochastically fail.
-     356           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     357           1 :         PhotoDisintegration pd(cmb);
-     358           1 :         Candidate c;
-     359           1 :         int id = nucleusId(12, 6);
-     360           1 :         c.current.setId(id);
-     361           1 :         c.current.setEnergy(100 * EeV);
-     362           1 :         c.setCurrentStep(1000 * Mpc);
-     363           1 :         pd.process(&c);
-     364             : 
-     365           1 :         EXPECT_TRUE(c.current.getEnergy() < 100 * EeV);
-     366             :         // energy loss
-     367           1 :         EXPECT_TRUE(c.secondaries.size() > 0);
-     368             :         // secondaries produced
-     369             : 
-     370           1 :         double E = c.current.getEnergy();
-     371           1 :         id = c.current.getId();
-     372           1 :         int A = massNumber(id);
-     373           1 :         int Z = chargeNumber(id);
-     374             : 
-     375           2 :         for (int i = 0; i < c.secondaries.size(); i++) {
-     376           1 :                 E += (*c.secondaries[i]).current.getEnergy();
-     377           1 :                 id = (*c.secondaries[i]).current.getId();
-     378           1 :                 A += massNumber(id);
-     379           1 :                 Z += chargeNumber(id);
-     380             :         }
-     381           1 :         EXPECT_EQ(12, A);
-     382             :         // nucleon number conserved
-     383           1 :         EXPECT_EQ(6, Z);
-     384             :         // proton number conserved
-     385           1 :         EXPECT_DOUBLE_EQ(100 * EeV, E);
-     386             :         // energy conserved
-     387           2 : }
-     388             : 
-     389           1 : TEST(PhotoDisintegration, iron) {
-     390             :         // Test if a 200 EeV Fe-56 nucleus photo-disintegrates (at least once) over a distance of 1 Gpc.
-     391             :         // This test can stochastically fail.
-     392           1 :         ref_ptr<PhotonField> irb = new IRB_Kneiske04();
-     393           1 :         PhotoDisintegration pd(irb);
-     394           1 :         Candidate c;
-     395           1 :         int id = nucleusId(56, 26);
-     396           1 :         c.current.setId(id);
-     397           1 :         c.current.setEnergy(200 * EeV);
-     398           1 :         c.setCurrentStep(1000 * Mpc);
-     399           1 :         pd.process(&c);
-     400             : 
-     401             :         // expect energy loss
-     402           1 :         EXPECT_TRUE(c.current.getEnergy() < 200 * EeV);
-     403             :         
-     404             :         // expect secondaries produced
-     405           1 :         EXPECT_TRUE(c.secondaries.size() > 0);
-     406             : 
-     407           1 :         double E = c.current.getEnergy();
-     408           1 :         id = c.current.getId();
-     409           1 :         int A = massNumber(id);
-     410           1 :         int Z = chargeNumber(id);
-     411             : 
-     412          31 :         for (int i = 0; i < c.secondaries.size(); i++) {
-     413          30 :                 E += (*c.secondaries[i]).current.getEnergy();
-     414          30 :                 id = (*c.secondaries[i]).current.getId();
-     415          30 :                 A += massNumber(id);
-     416          30 :                 Z += chargeNumber(id);
-     417             :         }
-     418             : 
-     419             :         // nucleon number conserved
-     420           1 :         EXPECT_EQ(56, A);
-     421             :         
-     422             :         // proton number conserved (no decay active)
-     423           1 :         EXPECT_EQ(26, Z);
-     424             :         
-     425             :         // energy conserved
-     426           1 :         EXPECT_DOUBLE_EQ(200 * EeV, E);
-     427           2 : }
-     428             : 
-     429           1 : TEST(PhotoDisintegration, thisIsNotNucleonic) {
-     430             :         // Test that nothing happens to an electron.
-     431           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     432           1 :         PhotoDisintegration pd(cmb);
-     433           1 :         Candidate c;
-     434           1 :         c.setCurrentStep(1 * Mpc);
-     435           1 :         c.current.setId(11); // electron
-     436           1 :         c.current.setEnergy(10 * EeV);
-     437           1 :         pd.process(&c);
-     438           1 :         EXPECT_EQ(11, c.current.getId());
-     439           1 :         EXPECT_EQ(10 * EeV, c.current.getEnergy());
-     440           2 : }
-     441             : 
-     442           1 : TEST(PhotoDisintegration, limitNextStep) {
-     443             :         // Test if the interaction limits the next propagation step.
-     444           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     445           1 :         PhotoDisintegration pd(cmb);
-     446           1 :         Candidate c;
-     447           1 :         c.setNextStep(std::numeric_limits<double>::max());
-     448           1 :         c.current.setId(nucleusId(4, 2));
-     449           1 :         c.current.setEnergy(200 * EeV);
-     450           1 :         pd.process(&c);
-     451           1 :         EXPECT_LT(c.getNextStep(), std::numeric_limits<double>::max());
-     452           2 : }
-     453             : 
-     454           1 : TEST(PhotoDisintegration, allIsotopes) {
-     455             :         // Test if all isotopes are handled.
-     456           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     457           1 :         PhotoDisintegration pd1(cmb);
-     458           1 :         ref_ptr<PhotonField> irb = new IRB_Kneiske04();
-     459           1 :         PhotoDisintegration pd2(irb);
-     460           1 :         Candidate c;
-     461           1 :         c.setCurrentStep(10 * Mpc);
-     462             : 
-     463          27 :         for (int Z = 1; Z <= 26; Z++) {
-     464         806 :                 for (int N = 1; N <= 30; N++) {
-     465             : 
-     466         780 :                         c.current.setId(nucleusId(Z + N, Z));
-     467         780 :                         c.current.setEnergy(80 * EeV);
-     468         780 :                         pd1.process(&c);
-     469             : 
-     470         780 :                         c.current.setId(nucleusId(Z + N, Z));
-     471         780 :                         c.current.setEnergy(80 * EeV);
-     472         780 :                         pd2.process(&c);
-     473             :                 }
-     474             :         }
-     475           3 : }
-     476             : 
-     477           1 : TEST(Photodisintegration, updateParticleParentProperties) { // Issue: #204
-     478           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     479           1 :         PhotoDisintegration pd(cmb);
-     480             : 
-     481           1 :         Candidate c(nucleusId(56,26), 500 * EeV, Vector3d(1 * Mpc, 0, 0));
-     482             : 
-     483           1 :         pd.performInteraction(&c, 1);
-     484             :         // the candidates parent is the original particle
-     485           1 :         EXPECT_EQ(c.created.getId(), nucleusId(56,26));
-     486             : 
-     487           1 :         pd.performInteraction(&c, 1);
-     488             :         // now it has to be changed
-     489           1 :         EXPECT_NE(c.created.getId(), nucleusId(56,26));
-     490           2 : }
-     491             : 
-     492           1 : TEST(PhotoDisintegration, interactionTag) {
-     493           2 :         PhotoDisintegration pd(new CMB());
-     494             : 
-     495             :         // test default interactionTag
-     496           2 :         EXPECT_TRUE(pd.getInteractionTag() == "PD");
-     497             : 
-     498             :         // test secondary tag
-     499           1 :         pd.setHavePhotons(true);
-     500           2 :         Candidate c(nucleusId(56,26), 500 * EeV);
-     501           1 :         c.setCurrentStep(1 * Gpc);
-     502           1 :         pd.process(&c);
-     503           2 :         EXPECT_TRUE(c.secondaries[0] -> getTagOrigin() == "PD");
-     504             : 
-     505             :         // test custom tag
-     506           1 :         pd.setInteractionTag("myTag");
-     507           2 :         EXPECT_TRUE(pd.getInteractionTag() == "myTag");
-     508           1 : }
-     509             : 
-     510             : // ElasticScattering ----------------------------------------------------------
-     511           1 : TEST(ElasticScattering, allBackgrounds) {
-     512             :         // Test if interaction data files are loaded.
-     513           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     514           1 :         ElasticScattering scattering(cmb);
-     515           1 :         ref_ptr<PhotonField> irb = new IRB_Kneiske04();
-     516           1 :         scattering.setPhotonField(irb);
-     517           1 :         ref_ptr<PhotonField> urb = new URB_Nitu21();
-     518           2 :         scattering.setPhotonField(urb);
-     519           2 : }
-     520             : 
-     521           1 : TEST(ElasticScattering, secondaries) {
-     522             :         // Test the creation of cosmic ray photons.
-     523             :         // This test can stochastically fail.
-     524           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     525           1 :         ElasticScattering scattering(cmb);
-     526           1 :         Candidate c;
-     527           1 :         int id = nucleusId(12, 6);
-     528           1 :         c.current.setId(id);
-     529           1 :         c.current.setEnergy(200 * EeV);
-     530           1 :         c.setCurrentStep(400 * Mpc);
-     531           1 :         scattering.process(&c);
-     532             : 
-     533           1 :         EXPECT_GT(c.secondaries.size(), 0);
-     534             : 
-     535           8 :         for (int i = 0; i < c.secondaries.size(); i++) {
-     536           7 :                 int id = (*c.secondaries[i]).current.getId();
-     537           7 :                 EXPECT_EQ(id, 22);
-     538           7 :                 double energy = (*c.secondaries[i]).current.getEnergy();
-     539           7 :                 EXPECT_GT(energy, 0);
-     540           7 :                 EXPECT_LT(energy, 200 * EeV);
-     541             :         }
-     542           2 : }
-     543             : 
-     544             : // PhotoPionProduction --------------------------------------------------------
-     545           1 : TEST(PhotoPionProduction, allBackgrounds) {
-     546             :         // Test if all interaction data files can be loaded.
-     547           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     548           1 :         PhotoPionProduction ppp(cmb);
-     549           1 :         ref_ptr<PhotonField> irb = new IRB_Kneiske04();
-     550           1 :         ppp.setPhotonField(irb);
-     551           2 :         irb = new IRB_Stecker05();
-     552           1 :         ppp.setPhotonField(irb);
-     553           2 :         irb = new IRB_Franceschini08();
-     554           1 :         ppp.setPhotonField(irb);
-     555           2 :         irb = new IRB_Finke10();
-     556           1 :         ppp.setPhotonField(irb);
-     557           2 :         irb = new IRB_Dominguez11();
-     558           1 :         ppp.setPhotonField(irb);
-     559           2 :         irb = new IRB_Gilmore12();
-     560           1 :         ppp.setPhotonField(irb);
-     561           2 :         irb = new IRB_Stecker16_upper();
-     562           1 :         ppp.setPhotonField(irb);
-     563           2 :         irb = new IRB_Stecker16_lower();
-     564           1 :         ppp.setPhotonField(irb);
-     565           2 :     irb = new IRB_Finke22();
-     566           1 :         ppp.setPhotonField(irb);
-     567           1 :         ref_ptr<PhotonField> urb = new URB_Protheroe96();
-     568           1 :         ppp.setPhotonField(urb);
-     569           2 :         urb = new URB_Nitu21();
-     570           2 :         ppp.setPhotonField(urb);
-     571           2 : }
-     572             : 
-     573           1 : TEST(PhotoPionProduction, proton) {
-     574             :         // Test photopion interaction for 100 EeV proton.
-     575             :         // This test can stochastically fail.
-     576           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     577           1 :         PhotoPionProduction ppp(cmb);
-     578           1 :         Candidate c(nucleusId(1, 1), 100 * EeV);
-     579           1 :         c.setCurrentStep(1000 * Mpc);
-     580           1 :         ppp.process(&c);
-     581             : 
-     582             :         // expect energy loss
-     583           1 :         EXPECT_LT(c.current.getEnergy(), 100. * EeV);
-     584             : 
-     585             :         // expect nucleon number conservation
-     586           1 :         EXPECT_EQ(1, massNumber(c.current.getId()));
-     587             : 
-     588             :         // expect no (nucleonic) secondaries
-     589           1 :         EXPECT_EQ(0, c.secondaries.size());
-     590           2 : }
-     591             : 
-     592           1 : TEST(PhotoPionProduction, helium) {
-     593             :         // Test photo-pion interaction for 400 EeV He nucleus.
-     594             :         // This test can stochastically fail.
-     595           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     596           1 :         PhotoPionProduction ppp(cmb);
-     597           1 :         Candidate c;
-     598           1 :         c.current.setId(nucleusId(4, 2));
-     599           1 :         c.current.setEnergy(400. * EeV);
-     600           1 :         c.setCurrentStep(1000 * Mpc);
-     601           1 :         ppp.process(&c);
-     602           1 :         EXPECT_LT(c.current.getEnergy(), 400. * EeV);
-     603           1 :         int id = c.current.getId();
-     604           1 :         EXPECT_TRUE(massNumber(id) < 4);
-     605           1 :         EXPECT_TRUE(c.secondaries.size() > 0);
-     606           2 : }
-     607             : 
-     608           1 : TEST(PhotoPionProduction, thisIsNotNucleonic) {
-     609             :         // Test if nothing happens to an electron.
-     610           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     611           1 :         PhotoPionProduction ppp(cmb);
-     612           1 :         Candidate c;
-     613           1 :         c.current.setId(11); // electron
-     614           1 :         c.current.setEnergy(10 * EeV);
-     615           1 :         c.setCurrentStep(100 * Mpc);
-     616           1 :         ppp.process(&c);
-     617           1 :         EXPECT_EQ(11, c.current.getId());
-     618           1 :         EXPECT_EQ(10 * EeV, c.current.getEnergy());
-     619           2 : }
-     620             : 
-     621           1 : TEST(PhotoPionProduction, limitNextStep) {
-     622             :         // Test if the interaction limits the next propagation step.
-     623           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     624           1 :         PhotoPionProduction ppp(cmb);
-     625           1 :         Candidate c(nucleusId(1, 1), 200 * EeV);
-     626           1 :         c.setNextStep(std::numeric_limits<double>::max());
-     627           1 :         ppp.process(&c);
-     628           1 :         EXPECT_LT(c.getNextStep(), std::numeric_limits<double>::max());
-     629           2 : }
-     630             : 
-     631           1 : TEST(PhotoPionProduction, secondaries) {
-     632             :         // Test photo-pion interaction for 100 EeV proton.
-     633             :         // This test can stochastically fail.
-     634           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     635           1 :         PhotoPionProduction ppp(cmb, true, true, true);
-     636           1 :         Candidate c(nucleusId(1, 1), 100 * EeV);
-     637           1 :         c.setCurrentStep(1000 * Mpc);
-     638           1 :         ppp.process(&c);
-     639             :         // there should be secondaries
-     640           1 :         EXPECT_GT(c.secondaries.size(), 1);
-     641           2 : }
-     642             : 
-     643           1 : TEST(PhotoPionProduction, sampling) {
-     644             :         // Specific test of photon sampling of photo-pion production
-     645             :         // by testing the calculated pEpsMax for CMB(), also indirectly
-     646             :         // testing epsMinInteraction and logSampling (default).
-     647           1 :         ref_ptr<PhotonField> cmb = new CMB(); //create CMB instance
-     648             :         double energy = 1.e10; //1e10 GeV
-     649             :         bool onProton = true; //proton
-     650             :         double z = 0; //no redshift
-     651           1 :         PhotoPionProduction ppp(cmb, true, true, true);
-     652           1 :         double correctionFactor = ppp.getCorrectionFactor(); //get current correctionFactor
-     653           1 :         double epsMin = std::max(cmb -> getMinimumPhotonEnergy(z) / eV, 0.00710614); // 0.00710614 = epsMinInteraction(onProton,energy)
-     654           1 :         double epsMax = cmb -> getMaximumPhotonEnergy(z) / eV;
-     655           1 :         double pEpsMax = ppp.probEpsMax(onProton, energy, z, epsMin, epsMax) / correctionFactor;
-     656           1 :         EXPECT_DOUBLE_EQ(pEpsMax,132673934934.922);
-     657           2 : }
-     658             : 
-     659           1 : TEST(PhotoPionProduction, interactionTag) {
-     660           2 :         PhotoPionProduction ppp(new CMB());
-     661             : 
-     662             :         // test default interactionTag
-     663           2 :         EXPECT_TRUE(ppp.getInteractionTag() == "PPP");
-     664             : 
-     665             :         // test secondary tag
-     666           1 :         ppp.setHavePhotons(true);
-     667           2 :         Candidate c(nucleusId(1,1), 100 * EeV);
-     668          11 :         for(int i = 0; i <10; i++) 
-     669          10 :                 ppp.performInteraction(&c, true);
-     670           2 :         EXPECT_TRUE(c.secondaries[0] -> getTagOrigin() == "PPP");
-     671             : 
-     672             :         // test custom interactionTag
-     673           1 :         ppp.setInteractionTag("myTag");
-     674           2 :         EXPECT_TRUE(ppp.getInteractionTag() == "myTag");
-     675           1 : }
-     676             : 
-     677             : // Redshift -------------------------------------------------------------------
-     678           2 : TEST(Redshift, simpleTest) {
-     679             :         // Test if redshift is decreased and adiabatic energy loss is applied.
-     680             :         Redshift redshift;
-     681             : 
-     682           1 :         Candidate c;
-     683           1 :         c.setRedshift(0.024);
-     684           1 :         c.current.setEnergy(100 * EeV);
-     685           1 :         c.setCurrentStep(1 * Mpc);
-     686             : 
-     687           1 :         redshift.process(&c);
-     688           1 :         EXPECT_GT(0.024, c.getRedshift()); // expect redshift decrease
-     689           1 :         EXPECT_GT(100, c.current.getEnergy() / EeV); // expect energy loss
-     690           2 : }
-     691             : 
-     692           2 : TEST(Redshift, limitRedshiftDecrease) {
-     693             :         // Test if the redshift decrease is limited to z_updated >= 0.
-     694             :         Redshift redshift;
-     695             : 
-     696           1 :         Candidate c;
-     697           1 :         c.setRedshift(0.024); // roughly corresponds to 100 Mpc
-     698           1 :         c.setCurrentStep(150 * Mpc);
-     699             : 
-     700           1 :         redshift.process(&c);
-     701           1 :         EXPECT_DOUBLE_EQ(0, c.getRedshift());
-     702           2 : }
-     703             : 
-     704             : // EMPairProduction -----------------------------------------------------------
-     705           1 : TEST(EMPairProduction, allBackgrounds) {
-     706             :         // Test if interaction data files are loaded.
-     707           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     708           1 :         EMPairProduction em(cmb);
-     709           1 :         ref_ptr<PhotonField> ebl = new IRB_Kneiske04();
-     710           1 :         em.setPhotonField(ebl);
-     711           1 :         ref_ptr<PhotonField> urb = new URB_Protheroe96();
-     712           1 :         em.setPhotonField(urb);
-     713           2 :         ebl = new IRB_Stecker05();
-     714           1 :         em.setPhotonField(ebl);
-     715           2 :         ebl = new IRB_Franceschini08();
-     716           1 :         em.setPhotonField(ebl);
-     717           2 :         ebl = new IRB_Finke10();
-     718           1 :         em.setPhotonField(ebl);
-     719           2 :         ebl = new IRB_Dominguez11();
-     720           1 :         em.setPhotonField(ebl);
-     721           2 :         ebl = new IRB_Gilmore12();
-     722           1 :         em.setPhotonField(ebl);
-     723           2 :         ebl = new IRB_Stecker16_upper();
-     724           1 :         em.setPhotonField(ebl);
-     725           2 :         ebl = new IRB_Stecker16_lower();
-     726           1 :         em.setPhotonField(ebl);
-     727           2 :         ebl = new IRB_Finke22();
-     728           1 :         em.setPhotonField(ebl);
-     729           2 :         urb = new URB_Fixsen11();
-     730           1 :         em.setPhotonField(urb);
-     731           2 :         urb = new URB_Nitu21();
-     732           2 :         em.setPhotonField(urb);
-     733           2 : }
-     734             : 
-     735           1 : TEST(EMPairProduction, limitNextStep) {
-     736             :         // Test if the interaction limits the next propagation step.
-     737           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     738           1 :         EMPairProduction m(cmb);
-     739           1 :         Candidate c(22, 1E17 * eV);
-     740           1 :         c.setNextStep(std::numeric_limits<double>::max());
-     741           1 :         m.process(&c);
-     742           1 :         EXPECT_LT(c.getNextStep(), std::numeric_limits<double>::max());
-     743           2 : }
-     744             : 
-     745           1 : TEST(EMPairProduction, secondaries) {
-     746             :         // Test if secondaries are correctly produced.
-     747           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     748           1 :         ref_ptr<PhotonField> irb = new IRB_Saldana21();
-     749           1 :         ref_ptr<PhotonField> urb = new URB_Nitu21();
-     750           1 :         EMPairProduction m(cmb);
-     751           1 :         m.setHaveElectrons(true);
-     752           1 :         m.setThinning(0.);
-     753             : 
-     754             :         std::vector<ref_ptr<PhotonField>> fields;
-     755           1 :         fields.push_back(cmb);
-     756           1 :         fields.push_back(irb);
-     757           1 :         fields.push_back(urb);
-     758             : 
-     759             :         // loop over photon backgrounds
-     760           4 :         for (int f = 0; f < fields.size(); f++) {
-     761           3 :                 m.setPhotonField(fields[f]);
-     762         423 :                 for (int i = 0; i < 140; i++) { // loop over energies Ep = (1e10 - 1e23) eV
-     763         420 :                         double Ep = pow(10, 9.05 + 0.1 * i) * eV;
-     764         420 :                         Candidate c(22, Ep);
-     765         420 :                         c.setCurrentStep(1e10 * Mpc);
-     766             : 
-     767         420 :                         m.process(&c);
-     768             : 
-     769             :                         // pass if no interaction has ocurred (no tabulated rates)
-     770         420 :                         if (c.isActive())
-     771             :                                 continue;
-     772             :                         
-     773             :                         // expect 2 secondaries
-     774         311 :                         EXPECT_EQ(c.secondaries.size(), 2);
-     775             : 
-     776             :                         // expect electron / positron with energies 0 < E < Ephoton
-     777             :                         double Etot = 0;
-     778         933 :                         for (int j = 0; j < c.secondaries.size(); j++) {
-     779         622 :                                 Candidate s = *c.secondaries[j];
-     780         622 :                                 EXPECT_EQ(abs(s.current.getId()), 11);
-     781         622 :                                 EXPECT_GT(s.current.getEnergy(), 0);
-     782         622 :                                 EXPECT_LT(s.current.getEnergy(), Ep);
-     783         622 :                                 Etot += s.current.getEnergy();
-     784         622 :                         }
-     785             : 
-     786             :                         // test energy conservation
-     787         311 :                         EXPECT_DOUBLE_EQ(Ep, Etot);
-     788         420 :                 }
-     789             :         }
-     790           2 : }
-     791             : 
-     792           1 : TEST(EMPairProduction, interactionTag) {
-     793           2 :         EMPairProduction m(new CMB());
-     794             : 
-     795             :         // test default interactionTag
-     796           2 :         EXPECT_TRUE(m.getInteractionTag() == "EMPP");
-     797             : 
-     798             :         // test secondary tag
-     799           1 :         m.setHaveElectrons(true);
-     800           2 :         Candidate c(22, 1 * EeV);
-     801           1 :         m.performInteraction(&c);
-     802           2 :         EXPECT_TRUE(c.secondaries[0] -> getTagOrigin() == "EMPP");
-     803             : 
-     804             :         // test custom tag
-     805           1 :         m.setInteractionTag("myTag");
-     806           2 :         EXPECT_TRUE(m.getInteractionTag() == "myTag");
-     807           1 : }
-     808             : 
-     809             : // EMDoublePairProduction -----------------------------------------------------
-     810           1 : TEST(EMDoublePairProduction, allBackgrounds) {
-     811             :         // Test if interaction data files are loaded.
-     812           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     813           1 :         EMDoublePairProduction em(cmb);
-     814           1 :         ref_ptr<PhotonField> ebl = new IRB_Kneiske04();
-     815           1 :         em.setPhotonField(ebl);
-     816           1 :         ref_ptr<PhotonField> urb = new URB_Protheroe96();
-     817           1 :         em.setPhotonField(urb);
-     818           2 :         ebl = new IRB_Stecker05();
-     819           1 :         em.setPhotonField(ebl);
-     820           2 :         ebl = new IRB_Franceschini08();
-     821           1 :         em.setPhotonField(ebl);
-     822           2 :         ebl = new IRB_Finke10();
-     823           1 :         em.setPhotonField(ebl);
-     824           2 :         ebl = new IRB_Dominguez11();
-     825           1 :         em.setPhotonField(ebl);
-     826           2 :         ebl = new IRB_Gilmore12();
-     827           1 :         em.setPhotonField(ebl);
-     828           2 :         ebl = new IRB_Stecker16_upper();
-     829           1 :         em.setPhotonField(ebl);
-     830           2 :         ebl = new IRB_Stecker16_lower();
-     831           1 :         em.setPhotonField(ebl);
-     832           2 :         ebl = new IRB_Finke22();
-     833           1 :         em.setPhotonField(ebl);
-     834           2 :         urb = new URB_Fixsen11();
-     835           1 :         em.setPhotonField(urb);
-     836           2 :         urb = new URB_Nitu21();
-     837           2 :         em.setPhotonField(urb);
-     838           2 : }
-     839             : 
-     840           1 : TEST(EMDoublePairProduction, limitNextStep) {
-     841             :         // Test if the interaction limits the next propagation step.
-     842           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     843           1 :         EMDoublePairProduction m(cmb);
-     844           1 :         Candidate c(22, 1E17 * eV);
-     845           1 :         c.setNextStep(std::numeric_limits<double>::max());
-     846           1 :         m.process(&c);
-     847           1 :         EXPECT_LT(c.getNextStep(), std::numeric_limits<double>::max());
-     848           2 : }
-     849             : 
-     850           1 : TEST(EMDoublePairProduction, secondaries) {
-     851             :         // Test if secondaries are correctly produced.
-     852           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     853           1 :         ref_ptr<PhotonField> irb = new IRB_Saldana21();
-     854           1 :         ref_ptr<PhotonField> urb = new URB_Nitu21();
-     855           1 :         EMPairProduction m(cmb);
-     856           1 :         m.setHaveElectrons(true);
-     857           1 :         m.setThinning(0.);
-     858             : 
-     859             :         std::vector<ref_ptr<PhotonField>> fields;
-     860           1 :         fields.push_back(cmb);
-     861           1 :         fields.push_back(irb);
-     862           1 :         fields.push_back(urb);
-     863             : 
-     864             :         // loop over photon backgrounds
-     865           4 :         for (int f = 0; f < fields.size(); f++) {
-     866           3 :                 m.setPhotonField(fields[f]);
-     867             :                 
-     868             :                 // loop over energies Ep = (1e9 - 1e23) eV
-     869         423 :                 for (int i = 0; i < 140; i++) {
-     870         420 :                         double Ep = pow(10, 9.05 + 0.1 * i) * eV;
-     871         420 :                         Candidate c(22, Ep);
-     872         420 :                         c.setCurrentStep(1e4 * Mpc); // use lower value so that the test can run faster
-     873         420 :                         m.process(&c);
-     874             : 
-     875             :                         // pass if no interaction has occured (no tabulated rates)
-     876         420 :                         if (c.isActive())
-     877             :                                 continue;
-     878             :                         
-     879             :                         // expect 2 secondaries (only one pair is considered)
-     880         251 :                         EXPECT_EQ(c.secondaries.size(), 2);
-     881             : 
-     882             :                         // expect electron / positron with energies 0 < E < Ephoton
-     883             :                         double Etot = 0;
-     884         753 :                         for (int j = 0; j < c.secondaries.size(); j++) {
-     885         502 :                                 Candidate s = *c.secondaries[j];
-     886         502 :                                 EXPECT_EQ(abs(s.current.getId()), 11);
-     887         502 :                                 EXPECT_GT(s.current.getEnergy(), 0);
-     888         502 :                                 EXPECT_LT(s.current.getEnergy(), Ep);
-     889         502 :                                 Etot += s.current.getEnergy();
-     890         502 :                         }
-     891             : 
-     892             :                         // test energy conservation
-     893         251 :                         EXPECT_NEAR(Ep, Etot, 1E-9);
-     894         420 :                 }
-     895             :         }
-     896           2 : }
-     897             : 
-     898           1 : TEST(EMDoublePairProduction, interactionTag) {
-     899           2 :         EMDoublePairProduction m(new CMB());
-     900             : 
-     901             :         // test default interactionTag
-     902           2 :         EXPECT_TRUE(m.getInteractionTag() == "EMDP");
-     903             : 
-     904             :         // test secondary tag
-     905           1 :         m.setHaveElectrons(true);
-     906           2 :         Candidate c(22, 1 * EeV);
-     907           1 :         m.performInteraction(&c);
-     908           2 :         EXPECT_TRUE(c.secondaries[0] -> getTagOrigin() == "EMDP");
-     909             : 
-     910             :         // test custom tag
-     911           1 :         m.setInteractionTag("myTag");
-     912           2 :         EXPECT_TRUE(m.getInteractionTag() == "myTag");
-     913           1 : }
-     914             : 
-     915             : // EMTripletPairProduction ----------------------------------------------------
-     916           1 : TEST(EMTripletPairProduction, allBackgrounds) {
-     917             :         // Test if interaction data files are loaded.
-     918           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     919           1 :         EMTripletPairProduction em(cmb);
-     920           1 :         ref_ptr<PhotonField> ebl = new IRB_Kneiske04();
-     921           1 :         em.setPhotonField(ebl);
-     922           1 :         ref_ptr<PhotonField> urb = new URB_Protheroe96();
-     923           1 :         em.setPhotonField(urb);
-     924           2 :         ebl = new IRB_Stecker05();
-     925           1 :         em.setPhotonField(ebl);
-     926           2 :         ebl = new IRB_Franceschini08();
-     927           1 :         em.setPhotonField(ebl);
-     928           2 :         ebl = new IRB_Finke10();
-     929           1 :         em.setPhotonField(ebl);
-     930           2 :         ebl = new IRB_Dominguez11();
-     931           1 :         em.setPhotonField(ebl);
-     932           2 :         ebl = new IRB_Gilmore12();
-     933           1 :         em.setPhotonField(ebl);
-     934           2 :         ebl = new IRB_Stecker16_upper();
-     935           1 :         em.setPhotonField(ebl);
-     936           2 :         ebl = new IRB_Stecker16_lower();
-     937           1 :         em.setPhotonField(ebl);
-     938           2 :         ebl = new IRB_Finke22();
-     939           1 :         em.setPhotonField(ebl);
-     940           2 :         urb = new URB_Fixsen11();
-     941           1 :         em.setPhotonField(urb);
-     942           2 :         urb = new URB_Nitu21();
-     943           2 :         em.setPhotonField(urb);
-     944           2 : }
-     945             : 
-     946           1 : TEST(EMTripletPairProduction, limitNextStep) {
-     947             :         // Test if the interaction limits the next propagation step.
-     948           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     949           1 :         EMTripletPairProduction m(cmb);
-     950           1 :         Candidate c(11, 1E17 * eV);
-     951           1 :         c.setNextStep(std::numeric_limits<double>::max());
-     952           1 :         m.process(&c);
-     953           1 :         EXPECT_LT(c.getNextStep(), std::numeric_limits<double>::max());
-     954           2 : }
-     955             : 
-     956           1 : TEST(EMTripletPairProduction, secondaries) {
-     957             :         // Test if secondaries are correctly produced.
-     958           1 :         ref_ptr<PhotonField> cmb = new CMB();
-     959           1 :         ref_ptr<PhotonField> irb = new IRB_Saldana21();
-     960           1 :         ref_ptr<PhotonField> urb = new URB_Nitu21();
-     961           1 :         EMPairProduction m(cmb);
-     962           1 :         m.setHaveElectrons(true);
-     963           1 :         m.setThinning(0.);
-     964             : 
-     965             :         std::vector<ref_ptr<PhotonField>> fields;
-     966           1 :         fields.push_back(cmb);
-     967           1 :         fields.push_back(irb);
-     968           1 :         fields.push_back(urb);
-     969             : 
-     970             :         // loop over photon backgrounds
-     971           4 :         for (int f = 0; f < fields.size(); f++) {
-     972           3 :                 m.setPhotonField(fields[f]);
-     973             :                 
-     974             :                 // loop over energies Ep = (1e9 - 1e23) eV
-     975         423 :                 for (int i = 0; i < 140; i++) {
-     976             : 
-     977         420 :                         double Ep = pow(10, 9.05 + 0.1 * i) * eV;
-     978         420 :                         Candidate c(11, Ep);
-     979         420 :                         c.setCurrentStep(1e4 * Mpc); // use lower value so that the test can run faster
-     980         420 :                         m.process(&c);
-     981             : 
-     982             :                         // pass if no interaction has occured (no tabulated rates)
-     983         420 :                         if (c.current.getEnergy() == Ep)
-     984             :                                 continue;
-     985             : 
-     986             :                         // expect positive energy of primary electron
-     987           0 :                         EXPECT_GT(c.current.getEnergy(), 0);
-     988           0 :                         double Etot = c.current.getEnergy();
-     989             : 
-     990             :                         // expect electron / positron with energies 0 < E < Ephoton
-     991           0 :                         for (int j = 0; j < c.secondaries.size(); j++) {
-     992           0 :                                 Candidate s = *c.secondaries[j];
-     993           0 :                                 EXPECT_EQ(abs(s.current.getId()), 11);
-     994           0 :                                 EXPECT_GT(s.current.getEnergy(), 0);
-     995           0 :                                 EXPECT_LT(s.current.getEnergy(), Ep);
-     996           0 :                                 Etot += s.current.getEnergy();
-     997           0 :                         }
-     998             : 
-     999             :                         // test energy conservation
-    1000           0 :                         EXPECT_NEAR(Ep, Etot, 1e-9);
-    1001         420 :                 }
-    1002             :         }
-    1003           2 : }
-    1004             : 
-    1005           1 : TEST(EMTripletPairProduction, interactionTag) {
-    1006           2 :         EMTripletPairProduction m(new CMB());
-    1007             : 
-    1008             :         // test default interactionTag
-    1009           2 :         EXPECT_TRUE(m.getInteractionTag() == "EMTP");
-    1010             : 
-    1011             :         // test secondary tag
-    1012           1 :         m.setHaveElectrons(true);
-    1013           2 :         Candidate c(11, 1 * EeV);
-    1014           1 :         m.performInteraction(&c);
-    1015           2 :         EXPECT_TRUE(c.secondaries[0] -> getTagOrigin() == "EMTP");
-    1016             : 
-    1017             :         // test custom tag
-    1018           1 :         m.setInteractionTag("myTag");
-    1019           2 :         EXPECT_TRUE(m.getInteractionTag() == "myTag");
-    1020           1 : }
-    1021             : 
-    1022             : // EMInverseComptonScattering -------------------------------------------------
-    1023           1 : TEST(EMInverseComptonScattering, allBackgrounds) {
-    1024             :         // Test if interaction data files are loaded.
-    1025           1 :         ref_ptr<PhotonField> cmb = new CMB();
-    1026           1 :         EMInverseComptonScattering em(cmb);
-    1027           1 :         ref_ptr<PhotonField> ebl = new IRB_Kneiske04();
-    1028           1 :         em.setPhotonField(ebl);
-    1029           1 :         ref_ptr<PhotonField> urb = new URB_Protheroe96();
-    1030           1 :         em.setPhotonField(urb);
-    1031           2 :         ebl = new IRB_Stecker05();
-    1032           1 :         em.setPhotonField(ebl);
-    1033           2 :         ebl = new IRB_Franceschini08();
-    1034           1 :         em.setPhotonField(ebl);
-    1035           2 :         ebl = new IRB_Finke10();
-    1036           1 :         em.setPhotonField(ebl);
-    1037           2 :         ebl = new IRB_Dominguez11();
-    1038           1 :         em.setPhotonField(ebl);
-    1039           2 :         ebl = new IRB_Gilmore12();
-    1040           1 :         em.setPhotonField(ebl);
-    1041           2 :         ebl = new IRB_Stecker16_upper();
-    1042           1 :         em.setPhotonField(ebl);
-    1043           2 :         ebl = new IRB_Stecker16_lower();
-    1044           1 :         em.setPhotonField(ebl);
-    1045           2 :         ebl = new IRB_Finke22();
-    1046           1 :         em.setPhotonField(ebl);
-    1047           2 :         urb = new URB_Fixsen11();
-    1048           1 :         em.setPhotonField(urb);
-    1049           2 :         urb = new URB_Nitu21();
-    1050           2 :         em.setPhotonField(urb);
-    1051           2 : }
-    1052             : 
-    1053           1 : TEST(EMInverseComptonScattering, limitNextStep) {
-    1054             :         // Test if the interaction limits the next propagation step.
-    1055           1 :         ref_ptr<PhotonField> cmb = new CMB();
-    1056           1 :         EMInverseComptonScattering m(cmb);
-    1057           1 :         Candidate c(11, 1E17 * eV);
-    1058           1 :         c.setNextStep(std::numeric_limits<double>::max());
-    1059           1 :         m.process(&c);
-    1060           1 :         EXPECT_LT(c.getNextStep(), std::numeric_limits<double>::max());
-    1061           2 : }
-    1062             : 
-    1063           1 : TEST(EMInverseComptonScattering, secondaries) {
-    1064             :         // Test if secondaries are correctly produced.
-    1065           1 :         ref_ptr<PhotonField> cmb = new CMB();
-    1066           1 :         ref_ptr<PhotonField> irb = new IRB_Saldana21();
-    1067           1 :         ref_ptr<PhotonField> urb = new URB_Nitu21();
-    1068           1 :         EMPairProduction m(cmb);
-    1069           1 :         m.setHaveElectrons(true);
-    1070           1 :         m.setThinning(0.);
-    1071             : 
-    1072             :         std::vector<ref_ptr<PhotonField>> fields;
-    1073           1 :         fields.push_back(cmb);
-    1074           1 :         fields.push_back(irb);
-    1075           1 :         fields.push_back(urb);
-    1076             : 
-    1077             :         // loop over photon backgrounds
-    1078           4 :         for (int f = 0; f < fields.size(); f++) {
-    1079           3 :                 m.setPhotonField(fields[f]);
-    1080             :                 
-    1081             :                 // loop over energies Ep = (1e9 - 1e23) eV
-    1082         423 :                 for (int i = 0; i < 140; i++) {
-    1083         420 :                         double Ep = pow(10, 9.05 + 0.1 * i) * eV;
-    1084         420 :                         Candidate c(11, Ep);
-    1085         420 :                         c.setCurrentStep(1e3 * Mpc); // use lower value so that the test can run faster
-    1086         420 :                         m.process(&c);
-    1087             : 
-    1088             :                         // pass if no interaction has occured (no tabulated rates)
-    1089         420 :                         if (c.current.getEnergy() == Ep)
-    1090             :                                 continue;
-    1091             :                         
-    1092             :                         // expect positive energy of primary electron
-    1093           0 :                         EXPECT_GT(c.current.getEnergy(), 0);
-    1094             : 
-    1095             :                         // expect photon with energy 0 < E < Ephoton
-    1096           0 :                         Candidate s = *c.secondaries[0];
-    1097           0 :                         EXPECT_EQ(abs(s.current.getId()), 22);
-    1098           0 :                         EXPECT_TRUE(s.current.getEnergy() >= 0.);
-    1099           0 :                         EXPECT_TRUE(s.current.getEnergy() < Ep);
-    1100             : 
-    1101             : 
-    1102           0 :                         double Etot = c.current.getEnergy();
-    1103           0 :                         for (int j = 0; j < c.secondaries.size(); j++) {
-    1104           0 :                                 s = *c.secondaries[j];
-    1105           0 :                                 Etot += s.current.getEnergy();
-    1106             :                         }
-    1107           0 :                         EXPECT_NEAR(Ep, Etot, 1e-9); 
-    1108         420 :                 }
-    1109             :         }
-    1110           2 : }
-    1111             : 
-    1112           1 : TEST(EMInverseComptonScattering, interactionTag) {
-    1113           2 :         EMInverseComptonScattering m(new CMB());
-    1114             : 
-    1115             :         // test default interactionTag
-    1116           2 :         EXPECT_TRUE(m.getInteractionTag() == "EMIC");
-    1117             : 
-    1118             :         // test secondary tag
-    1119           1 :         m.setHavePhotons(true);
-    1120           2 :         Candidate c(11, 1 * PeV);
-    1121           1 :         m.performInteraction(&c);
-    1122           2 :         EXPECT_TRUE(c.secondaries[0] -> getTagOrigin() == "EMIC");
-    1123             : 
-    1124             :         // test custom tag
-    1125           1 :         m.setInteractionTag("myTag");
-    1126           2 :         EXPECT_TRUE(m.getInteractionTag() == "myTag");
-    1127           1 : }
-    1128             : 
-    1129             : // SynchrotronRadiation -------------------------------------------------
-    1130           1 : TEST(SynchrotronRadiation, interactionTag) {
-    1131           1 :         SynchrotronRadiation s(1 * muG, true);
-    1132             : 
-    1133             :         // test default interactionTag
-    1134           2 :         EXPECT_TRUE(s.getInteractionTag() == "SYN");
-    1135             : 
-    1136             :         // test secondary tag
-    1137           2 :         Candidate c(11, 10 * PeV);
-    1138           1 :         c.setCurrentStep(1 * pc);
-    1139           1 :         s.process(&c);
-    1140           2 :         EXPECT_TRUE(c.secondaries[0] -> getTagOrigin() == "SYN");
-    1141             : 
-    1142             :         // test custom tag
-    1143           1 :         s.setInteractionTag("myTag");
-    1144           2 :         EXPECT_TRUE(s.getInteractionTag() == "myTag");
-    1145           1 : }
-    1146             : 
-    1147             : 
-    1148           0 : int main(int argc, char **argv) {
-    1149           0 :         ::testing::InitGoogleTest(&argc, argv);
-    1150           0 :         return RUN_ALL_TESTS();
-    1151             : }
-    1152             : 
-    1153             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testMagneticField.cpp.func-sort-c.html b/doc/coverageReport/test/testMagneticField.cpp.func-sort-c.html deleted file mode 100644 index aaf4ebc36..000000000 --- a/doc/coverageReport/test/testMagneticField.cpp.func-sort-c.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testMagneticField.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testMagneticField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:138138100.0 %
Date:2024-04-08 14:58:22Functions:1616100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN36testCMZMagneticField_SimpleTest_Test8TestBodyEv1
_ZN37testMagneticFieldList_SimpleTest_Test8TestBodyEv1
_ZN37testToroidalHaloField_SimpleTest_Test8TestBodyEv1
_ZN38testCMZMagneticField_TestNTFField_Test8TestBodyEv1
_ZN39testMagneticDipoleField_SimpleTest_Test8TestBodyEv1
_ZN40testUniformMagneticField_SimpleTest_Test8TestBodyEv1
_ZN41testCMZMagneticField_TestICComponent_Test8TestBodyEv1
_ZN41testPeriodicMagneticField_Exceptions_Test8TestBodyEv1
_ZN42testLogarithmicSpiralField_SimpleTest_Test8TestBodyEv1
_ZN42testMagneticFieldEvolution_SimpleTest_Test8TestBodyEv1
_ZN43testCMZMagneticField_TestRaidoArcField_Test8TestBodyEv1
_ZN44testRenormalizeMagneticField_simpleTest_Test8TestBodyEv1
_ZN47testCMZMagneticField_TestAzimutalComponent_Test8TestBodyEv1
_ZN52testPolarizedSingleModeMagneticField_SimpleTest_Test8TestBodyEv1
main1
_ZNK17EchoMagneticField8getFieldERKN7crpropa7Vector3IdEE3
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testMagneticField.cpp.func.html b/doc/coverageReport/test/testMagneticField.cpp.func.html deleted file mode 100644 index 4842756d7..000000000 --- a/doc/coverageReport/test/testMagneticField.cpp.func.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testMagneticField.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testMagneticField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:138138100.0 %
Date:2024-04-08 14:58:22Functions:1616100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN36testCMZMagneticField_SimpleTest_Test8TestBodyEv1
_ZN37testMagneticFieldList_SimpleTest_Test8TestBodyEv1
_ZN37testToroidalHaloField_SimpleTest_Test8TestBodyEv1
_ZN38testCMZMagneticField_TestNTFField_Test8TestBodyEv1
_ZN39testMagneticDipoleField_SimpleTest_Test8TestBodyEv1
_ZN40testUniformMagneticField_SimpleTest_Test8TestBodyEv1
_ZN41testCMZMagneticField_TestICComponent_Test8TestBodyEv1
_ZN41testPeriodicMagneticField_Exceptions_Test8TestBodyEv1
_ZN42testLogarithmicSpiralField_SimpleTest_Test8TestBodyEv1
_ZN42testMagneticFieldEvolution_SimpleTest_Test8TestBodyEv1
_ZN43testCMZMagneticField_TestRaidoArcField_Test8TestBodyEv1
_ZN44testRenormalizeMagneticField_simpleTest_Test8TestBodyEv1
_ZN47testCMZMagneticField_TestAzimutalComponent_Test8TestBodyEv1
_ZN52testPolarizedSingleModeMagneticField_SimpleTest_Test8TestBodyEv1
_ZNK17EchoMagneticField8getFieldERKN7crpropa7Vector3IdEE3
main1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testMagneticField.cpp.gcov.html b/doc/coverageReport/test/testMagneticField.cpp.gcov.html deleted file mode 100644 index 1da471524..000000000 --- a/doc/coverageReport/test/testMagneticField.cpp.gcov.html +++ /dev/null @@ -1,292 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testMagneticField.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testMagneticField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:138138100.0 %
Date:2024-04-08 14:58:22Functions:1616100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include <stdexcept>
-       2             : 
-       3             : #include "crpropa/magneticField/MagneticFieldGrid.h"
-       4             : #include "crpropa/magneticField/CMZField.h"
-       5             : #include "crpropa/magneticField/PolarizedSingleModeMagneticField.h"
-       6             : #include "crpropa/magneticField/GalacticMagneticField.h"
-       7             : #include "crpropa/Grid.h"
-       8             : #include "crpropa/Units.h"
-       9             : #include "crpropa/Common.h"
-      10             : 
-      11             : #include "gtest/gtest.h"
-      12             : 
-      13             : using namespace crpropa;
-      14             : 
-      15           1 : TEST(testUniformMagneticField, SimpleTest) {
-      16             :         UniformMagneticField B(Vector3d(-1, 5, 3));
-      17             :         Vector3d b = B.getField(Vector3d(1, 0, 0));
-      18           1 :         EXPECT_DOUBLE_EQ(b.getX(), -1);
-      19           1 :         EXPECT_DOUBLE_EQ(b.getY(), 5);
-      20           1 :         EXPECT_DOUBLE_EQ(b.getZ(), 3);
-      21           1 : }
-      22             : 
-      23           2 : TEST(testMagneticDipoleField, SimpleTest) {
-      24             :         // Test magnetic dipole
-      25             :         // mu0 / (4*M_PI) * m / r^3 (2*cos(theta)*e_r + sin(theta)*e_theta)
-      26             :         MagneticDipoleField B(Vector3d(0,0,0), Vector3d(0,0,1), 1);
-      27           1 :         Vector3d b1 = B.getField(Vector3d(0, 0, 1)); // theta = 0
-      28           1 :         Vector3d b2 = B.getField(Vector3d(1, 0, 0)); // theta = 0
-      29           1 :         EXPECT_NEAR(b1.getX(), 0, 1E-8);
-      30           1 :         EXPECT_NEAR(b1.getY(), 0, 1E-8);
-      31           1 :         EXPECT_NEAR(b1.getZ(), mu0 / (4*M_PI) * 2, 1E-8);
-      32           1 :         EXPECT_NEAR(b2.getX(), 0, 1E-8);
-      33           1 :         EXPECT_NEAR(b2.getY(), 0, 1E-8);
-      34           1 :         EXPECT_NEAR(b2.getZ(), -1 * mu0 / (4*M_PI), 1E-8);
-      35           1 : }
-      36             : 
-      37             : #ifdef CRPROPA_HAVE_MUPARSER
-      38           1 : TEST(testRenormalizeMagneticField, simpleTest) {
-      39           1 :         ref_ptr<UniformMagneticField> field = new UniformMagneticField(Vector3d(2*nG, 0, 0));
-      40           2 :         RenormalizeMagneticField modField(field, "B^2-1*nG");
-      41           1 :         Vector3d b = modField.getField(Vector3d(5, 5, 5));
-      42           1 :         EXPECT_NEAR(b.getR(), 3*nG, 0.001);
-      43           2 : }
-      44             : #endif
-      45             : 
-      46           2 : TEST(testMagneticFieldList, SimpleTest) {
-      47             :         // Test a list of three magnetic fields
-      48             :         MagneticFieldList B;
-      49           1 :         B.addField(new UniformMagneticField(Vector3d(1, 0, 0)));
-      50           1 :         B.addField(new UniformMagneticField(Vector3d(0, 2, 0)));
-      51           2 :         B.addField(new UniformMagneticField(Vector3d(0, 0, 3)));
-      52           1 :         Vector3d b = B.getField(Vector3d(0.));
-      53           1 :         EXPECT_DOUBLE_EQ(b.x, 1);
-      54           1 :         EXPECT_DOUBLE_EQ(b.y, 2);
-      55           1 :         EXPECT_DOUBLE_EQ(b.z, 3);
-      56           1 : }
-      57             : 
-      58           1 : TEST(testMagneticFieldEvolution, SimpleTest) {
-      59             :         // Test if this decorator scales the underlying field as (1+z)^m
-      60           1 :         ref_ptr<UniformMagneticField> B = new UniformMagneticField(Vector3d(1,0,0));
-      61             :         double z = 1.2;
-      62             :         double m = 3;
-      63           2 :         MagneticFieldEvolution Bz(B, m);
-      64             : 
-      65             :         // scaled field
-      66           1 :         Vector3d b = Bz.getField(Vector3d(0,0,0), z);
-      67           1 :         EXPECT_DOUBLE_EQ(b.x, pow(1+z, m));
-      68             : 
-      69             :         // unscaled field
-      70           1 :         b = Bz.getField(Vector3d(0,0,0));
-      71           1 :         EXPECT_DOUBLE_EQ(b.x, 1);
-      72           1 : }
-      73             : 
-      74           1 : class EchoMagneticField: public MagneticField {
-      75             : public:
-      76           3 :         Vector3d getField(const Vector3d &position) const {
-      77           3 :                 return position;
-      78             :         }
-      79             : };
-      80             : 
-      81           1 : TEST(testPeriodicMagneticField, Exceptions) {
-      82           1 :         ref_ptr<EchoMagneticField> f = new EchoMagneticField();
-      83             :         ref_ptr<PeriodicMagneticField> p = new PeriodicMagneticField(f,
-      84           1 :                         Vector3d(10000, 10000, 10000), Vector3d(1000, 1000, 1000), true);
-      85             : 
-      86             :         // box 0, 0, 0
-      87           1 :         Vector3d v = p->getField(Vector3d(1000, 2000, 3000));
-      88           1 :         EXPECT_DOUBLE_EQ(0, v.x);
-      89           1 :         EXPECT_DOUBLE_EQ(1000, v.y);
-      90           1 :         EXPECT_DOUBLE_EQ(2000, v.z);
-      91             : 
-      92             :         // box 1, 2, 3
-      93           1 :         v = p->getField(Vector3d(12000, 23000, 34000));
-      94           1 :         EXPECT_DOUBLE_EQ(9000, v.x);
-      95           1 :         EXPECT_DOUBLE_EQ(2000, v.y);
-      96           1 :         EXPECT_DOUBLE_EQ(7000, v.z);
-      97             : 
-      98             :         // box -1, -2, -3
-      99           1 :         v = p->getField(Vector3d(0, -10000, -20000));
-     100           1 :         EXPECT_DOUBLE_EQ(1000, v.x);
-     101           1 :         EXPECT_DOUBLE_EQ(9000, v.y);
-     102           1 :         EXPECT_DOUBLE_EQ(1000, v.z);
-     103             : 
-     104           1 : }
-     105             : 
-     106           1 : TEST(testCMZMagneticField, SimpleTest) {
-     107           1 :         ref_ptr<CMZField> field = new CMZField();
-     108             :         
-     109             :         // check use-Values
-     110           1 :         EXPECT_FALSE(field->getUseMCField());
-     111           1 :         EXPECT_TRUE(field->getUseICField());
-     112           1 :         EXPECT_FALSE(field->getUseNTFField());
-     113           1 :         EXPECT_FALSE(field->getUseRadioArc());
-     114             : 
-     115             :         // check set function
-     116           1 :         field->setUseMCField(true);
-     117           1 :         EXPECT_TRUE(field->getUseMCField());
-     118           1 :         field->setUseICField(false);
-     119           1 :         EXPECT_FALSE(field->getUseICField());
-     120           1 :         field->setUseNTFField(true);
-     121           1 :         EXPECT_TRUE(field->getUseNTFField());
-     122           1 :         field->setUseRadioArc(true);
-     123           1 :         EXPECT_TRUE(field->getUseRadioArc());
-     124           1 : }
-     125             : 
-     126           1 : TEST(testCMZMagneticField, TestICComponent) {
-     127           1 :         ref_ptr<CMZField> field = new CMZField();
-     128             :         Vector3d pos(10*pc,15*pc,-5*pc);        
-     129             : 
-     130             :         // check IC field at given position
-     131           1 :         Vector3d bVec = field->getField(pos);
-     132           1 :         EXPECT_NEAR(bVec.getR(), 10.501*muG, 1E-3*muG);
-     133           1 :         EXPECT_NEAR(bVec.x, 0.225*muG, 1E-3*muG);
-     134           1 :         EXPECT_NEAR(bVec.y, 0.524*muG, 1E-3*muG);
-     135           1 :         EXPECT_NEAR(bVec.z, 10.486*muG, 1E-3*muG);
-     136           1 : }
-     137           1 : TEST(testCMZMagneticField, TestNTFField){
-     138           1 :         ref_ptr<CMZField> field = new CMZField();
-     139             :         Vector3d pos(10*pc,15*pc,-5*pc);        
-     140             :         
-     141             :         // check NFTField at given position
-     142           1 :         Vector3d bVec = field->getNTFField(pos);
-     143           1 :         EXPECT_NEAR(bVec.getR(),1.692*muG, 1e-3*muG);
-     144           1 :         EXPECT_NEAR(bVec.x, -0.584*muG, 1e-3*muG);
-     145           1 :         EXPECT_NEAR(bVec.y, -1.185*muG, 1e-3*muG);
-     146           1 :         EXPECT_NEAR(bVec.z, 1.057*muG, 1e-3*muG);
-     147           1 : }
-     148           1 : TEST(testCMZMagneticField, TestRaidoArcField){
-     149           1 :         ref_ptr<CMZField> field = new CMZField();
-     150             :         Vector3d pos(10*pc,15*pc,-5*pc);        
-     151             : 
-     152             :         // check RadioArcField at given position
-     153           1 :         Vector3d bVec = field->getRadioArcField(pos);
-     154           1 :         EXPECT_NEAR(bVec.getR(), 31.616*muG, 1e-3*muG);
-     155           1 :         EXPECT_NEAR(bVec.x, -4.671*muG, 1e-3*muG);
-     156           1 :         EXPECT_NEAR(bVec.y, 5.465*muG, 1e-3*muG);
-     157           1 :         EXPECT_NEAR(bVec.z, 30.788*muG, 1e-3*muG);
-     158           1 : }
-     159             : 
-     160           1 : TEST(testCMZMagneticField, TestAzimutalComponent){
-     161           1 :         ref_ptr<CMZField> field = new CMZField();
-     162             :         Vector3d mid(12*pc, 9*pc, 20*pc);
-     163             :         Vector3d pos(9*pc, 10*pc, 25*pc);       
-     164             : 
-     165             :         // simple Test for inner part
-     166           1 :         Vector3d bVec = field->BAz(pos, mid, 100, 0.2, 60*pc);
-     167           1 :         EXPECT_NEAR(bVec.x, 3939.782, 1e-3);
-     168           1 :         EXPECT_NEAR(bVec.y, 14347.304, 1e-3);
-     169           1 :         EXPECT_DOUBLE_EQ(bVec.z, 0);
-     170             : 
-     171             :         // simple Test for outer part
-     172           1 :         bVec = field->BAz(pos, mid, 100, 0.2, 10*pc);
-     173           1 :         EXPECT_NEAR(bVec.x, -164.659, 1e-3);
-     174           1 :         EXPECT_NEAR(bVec.y, -1317.270, 1e-3);
-     175           1 :         EXPECT_DOUBLE_EQ(bVec.z, 0);
-     176             : 
-     177             :         // test for molecular Clouds
-     178           1 :         bVec = field->getMCField(pos);
-     179           1 :         EXPECT_NEAR(bVec.x, -8.339*muG, 1e-3*muG);
-     180           1 :         EXPECT_NEAR(bVec.y, -0.850*muG, 1e-3*muG);
-     181           1 :         EXPECT_DOUBLE_EQ(bVec.z, 0);
-     182           1 : }
-     183             : 
-     184           1 : TEST(testToroidalHaloField, SimpleTest) {
-     185           1 :         ref_ptr<ToroidalHaloField> field = new ToroidalHaloField();
-     186           1 :         Vector3d b = field->getField(Vector3d(0.));
-     187           1 :         EXPECT_DOUBLE_EQ(b.x, 0);
-     188           1 :         EXPECT_DOUBLE_EQ(b.y, 0);
-     189           1 :         EXPECT_DOUBLE_EQ(b.z, 0);
-     190             : 
-     191           1 :         b = field->getField(Vector3d(1,0,0));
-     192           1 :         EXPECT_DOUBLE_EQ(b.x, 0.5);
-     193           1 :         EXPECT_DOUBLE_EQ(b.y, 0);
-     194           1 :         EXPECT_DOUBLE_EQ(b.z, 0);
-     195           1 : }
-     196             : 
-     197           1 : TEST(testLogarithmicSpiralField, SimpleTest) {
-     198           1 :         ref_ptr<LogarithmicSpiralField> field = new LogarithmicSpiralField();
-     199           1 :         Vector3d b = field->getField(Vector3d(8.5, 0, 0)*kpc);
-     200           1 :         EXPECT_NEAR(b.x, -1., 1E-2);
-     201           1 :         EXPECT_NEAR(b.y, 0, 1E-10);
-     202           1 :         EXPECT_NEAR(b.z, 0, 1E-10);
-     203           1 : }
-     204             : 
-     205           1 : TEST(testPolarizedSingleModeMagneticField, SimpleTest) {
-     206           1 :         PolarizedSingleModeMagneticField B(2, 4, 0.5, Vector3d(1,1,1), Vector3d(0,1,0), Vector3d(1,0,0), "amplitude", "polarization", "elliptical");
-     207           1 :         Vector3d b = B.getField(Vector3d(1,1,2));
-     208           1 :         EXPECT_DOUBLE_EQ(b.x, 1);
-     209           1 :         EXPECT_NEAR(b.y, 0, 1E-10);
-     210           1 :         EXPECT_NEAR(b.z, 0, 1E-10);
-     211           1 : }
-     212             : 
-     213           1 : int main(int argc, char **argv) {
-     214           1 :         ::testing::InitGoogleTest(&argc, argv);
-     215             :         return RUN_ALL_TESTS();
-     216             : }
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testMagneticLens.cpp.func-sort-c.html b/doc/coverageReport/test/testMagneticLens.cpp.func-sort-c.html deleted file mode 100644 index d114bd5b9..000000000 --- a/doc/coverageReport/test/testMagneticLens.cpp.func-sort-c.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testMagneticLens.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testMagneticLens.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8787100.0 %
Date:2024-04-08 14:58:22Functions:77100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN28MagneticLens_Deflection_Test8TestBodyEv1
_ZN33Pixelization_angularDistance_Test8TestBodyEv1
_ZN35MagneticLens_OutOfBoundsEnergy_Test8TestBodyEv1
_ZN35MagneticLens_Vector3Deflection_Test8TestBodyEv1
_ZN38ParticleMapsContainer_addParticle_Test8TestBodyEv1
_ZN40Pixelization_randomDirectionInPixel_Test8TestBodyEv1
_ZN45ParticleMapsContainer_getRandomParticles_Test8TestBodyEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testMagneticLens.cpp.func.html b/doc/coverageReport/test/testMagneticLens.cpp.func.html deleted file mode 100644 index 8fc41a1d4..000000000 --- a/doc/coverageReport/test/testMagneticLens.cpp.func.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testMagneticLens.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testMagneticLens.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8787100.0 %
Date:2024-04-08 14:58:22Functions:77100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN28MagneticLens_Deflection_Test8TestBodyEv1
_ZN33Pixelization_angularDistance_Test8TestBodyEv1
_ZN35MagneticLens_OutOfBoundsEnergy_Test8TestBodyEv1
_ZN35MagneticLens_Vector3Deflection_Test8TestBodyEv1
_ZN38ParticleMapsContainer_addParticle_Test8TestBodyEv1
_ZN40Pixelization_randomDirectionInPixel_Test8TestBodyEv1
_ZN45ParticleMapsContainer_getRandomParticles_Test8TestBodyEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testMagneticLens.cpp.gcov.html b/doc/coverageReport/test/testMagneticLens.cpp.gcov.html deleted file mode 100644 index e293783f6..000000000 --- a/doc/coverageReport/test/testMagneticLens.cpp.gcov.html +++ /dev/null @@ -1,248 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testMagneticLens.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testMagneticLens.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:8787100.0 %
Date:2024-04-08 14:58:22Functions:77100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : /// Tests gamale with a test lense from file and demonstrating basic
-       2             : /// usage
-       3             : 
-       4             : //--------------------------------------------
-       5             : // Project: Galactic magnetic Lense (GaMaLe) -
-       6             : // Copyright (C) 2009 Tobias Winchen         -
-       7             : //               RWTH Aachen, Germany        -
-       8             : // Contact: winchen@physik.rwth-achen.de     -
-       9             : // Licensed under the GNU GPL v2             - 
-      10             : //--------------------------------------------
-      11             : 
-      12             : #include <string>
-      13             : #include "gtest/gtest.h"
-      14             : 
-      15             : #include "crpropa/magneticLens/MagneticLens.h"
-      16             : #include "crpropa/magneticLens/ModelMatrix.h"
-      17             : #include "crpropa/magneticLens/Pixelization.h"
-      18             : #include "crpropa/magneticLens/ParticleMapsContainer.h"
-      19             : #include "crpropa/Common.h"
-      20             : 
-      21             : using namespace std;
-      22             : using namespace crpropa;
-      23             : 
-      24           1 : TEST(MagneticLens, Deflection)
-      25             : {
-      26           1 :         MagneticLens magneticLens(5);
-      27           1 :         Pixelization P(5);
-      28           1 :         ModelMatrixType M;
-      29           1 :         M.resize(P.nPix(), P.nPix());
-      30           1 :         M.reserve(P.nPix());
-      31             : 
-      32             :         // Map any direction (p,t) to (p, -t)
-      33       12289 :         for (int i=0;i<P.nPix();i++)
-      34             :         {
-      35             :                 double theta, phi;
-      36       12288 :                 P.pix2Direction(i, phi, theta);
-      37       12288 :                 theta*= -1;
-      38       12288 :                 int j = P.direction2Pix(phi, theta);
-      39       12288 :                 M.insert(i,j) =1;
-      40             :         }
-      41             : 
-      42           1 :         magneticLens.setLensPart(M, 10 * EeV, 100 * EeV);
-      43             : 
-      44       12289 :         for (int i=0; i < P.nPix(); i++)
-      45             :         {
-      46             :                 double theta, phi;
-      47       12288 :                 P.pix2Direction(i, phi, theta);
-      48       12288 :                 double theta0 = theta;
-      49             : 
-      50             :                 // No CR is allowed to be lost in this lens
-      51       12288 :                 EXPECT_TRUE(magneticLens.transformCosmicRay(20 * EeV, phi, theta));
-      52       12288 :                 EXPECT_NEAR(theta+theta0,0., 0.05);
-      53             :         }
-      54           2 : }
-      55             : 
-      56           1 : TEST(MagneticLens, Vector3Deflection)
-      57             : {
-      58           1 :         MagneticLens magneticLens(5);
-      59           1 :         Pixelization P(5);
-      60           1 :         ModelMatrixType M;
-      61           1 :         M.resize(P.nPix(), P.nPix());
-      62           1 :         M.reserve(P.nPix());
-      63             : 
-      64             :         // No deflection 
-      65       12289 :         for (int i=0;i<P.nPix();i++)
-      66             :         {
-      67       12288 :                 M.insert(i,i) = 1;
-      68             :         }
-      69             : 
-      70           1 :         magneticLens.setLensPart(M, 10 * EeV, 100 * EeV);
-      71             : 
-      72             :         Vector3d u(1,0,0);
-      73             :         Vector3d v(u);
-      74           1 :         EXPECT_TRUE(magneticLens.transformCosmicRay(20 * EeV, v));
-      75           1 :         EXPECT_NEAR(u.getAngleTo(v), 0., 2. / 180 * M_PI);
-      76             : 
-      77           1 :         u.x = 0; u.y = 1; u.z = 0; v = u;
-      78           1 :         EXPECT_TRUE(magneticLens.transformCosmicRay(20 * EeV, v));
-      79           1 :         EXPECT_NEAR(u.getAngleTo(v), 0., 2. / 180 * M_PI);
-      80             : 
-      81           1 :         u.x = 0; u.y = 0; u.z = 1; v = u;
-      82           1 :         EXPECT_TRUE(magneticLens.transformCosmicRay(20 * EeV, v));
-      83           1 :         EXPECT_NEAR(u.getAngleTo(v), 0., 2. / 180 * M_PI);
-      84             : 
-      85           1 :         u.x = 1; u.y = -2; u.z = 3; v = u;
-      86           1 :         EXPECT_TRUE(magneticLens.transformCosmicRay(20 * EeV, v));
-      87           1 :         EXPECT_NEAR(u.getAngleTo(v), 0., 2. / 180 * M_PI);
-      88           2 : }
-      89             : 
-      90           1 : TEST(MagneticLens, OutOfBoundsEnergy)
-      91             : {
-      92           1 :         MagneticLens magneticLens(5);
-      93           1 :         Pixelization P(5);
-      94           1 :         ModelMatrixType M;
-      95           1 :         M.resize(P.nPix(), P.nPix());
-      96           1 :         M.reserve(P.nPix());
-      97           1 :         magneticLens.setLensPart(M,10. * EeV, 100. * EeV);
-      98           1 :         double theta = 0, phi = 0;
-      99           1 :         EXPECT_FALSE(magneticLens.transformCosmicRay(1. * EeV, phi, theta));
-     100           2 : }
-     101             : 
-     102             : 
-     103           1 : TEST(Pixelization, angularDistance)
-     104             : {
-     105             :         // test for correct angular distance in case of same vectors 
-     106           1 :         Pixelization P(6);
-     107       49153 :         for (int idx =0; idx < P.nPix(); idx++)
-     108             :         {
-     109       49152 :                 double ang = P.angularDistance(idx,idx);
-     110       49152 :                 EXPECT_TRUE(ang == ang);
-     111             :         }
-     112           1 : }
-     113             : 
-     114             : 
-     115           1 : TEST(ParticleMapsContainer, addParticle)
-     116             : {
-     117           1 :   ParticleMapsContainer maps;
-     118           1 :   maps.addParticle(1000010010, 1 * EeV, 0 , 0 );
-     119           1 :   std::vector<int> pids = maps.getParticleIds();
-     120           1 :   EXPECT_EQ(pids.size(), 1);
-     121           1 :   EXPECT_EQ(pids[0], 1000010010);
-     122             : 
-     123           1 :   std::vector<double> energies = maps.getEnergies(1000010010);
-     124           1 :   EXPECT_EQ(energies.size(), 1);
-     125           1 : }
-     126             : 
-     127           1 : TEST(ParticleMapsContainer, getRandomParticles)
-     128             : {
-     129           1 :   ParticleMapsContainer maps(0.002);
-     130           1 :   maps.addParticle(1000010010, 1 * EeV, 0 , 0 );
-     131             :   std::vector<double> energies;
-     132             :   std::vector<double> lons;
-     133             :   std::vector<double> lats;
-     134             :   std::vector<int> particleIds;
-     135             : 
-     136           1 :   size_t N = 420;
-     137           1 :         maps.getRandomParticles(N, particleIds, energies, lons, lats);
-     138             :                         
-     139           1 :   EXPECT_EQ(energies.size(), N);
-     140           1 :   EXPECT_EQ(lons.size(), N);
-     141           1 :   EXPECT_EQ(lats.size(), N);
-     142           1 :   EXPECT_EQ(particleIds.size(), N);
-     143             : 
-     144         421 :   for(size_t i = 0; i < N; i++)
-     145             :   {
-     146         420 :     EXPECT_NEAR(log10(energies[i]), 18, 0.002);
-     147         420 :     EXPECT_EQ(particleIds[i], 1000010010);
-     148         420 :     EXPECT_NEAR(lons[i], 0, 2./180*M_PI);
-     149         420 :     EXPECT_NEAR(lats[i], 0, 2./180*M_PI);
-     150             :   }
-     151             : 
-     152           1 : }
-     153             : 
-     154           1 : TEST(Pixelization, randomDirectionInPixel)
-     155             : {
-     156           1 :   Pixelization p(6);
-     157             :   const double long0 = -35./180 * M_PI;
-     158             :   const double lat0 =  12.08/180 * M_PI;
-     159             : 
-     160           1 :   int pix = p.direction2Pix(long0, lat0);
-     161             : 
-     162             :   double rlon, rlat;
-     163           1 :   p.getRandomDirectionInPixel(pix, rlon, rlat);
-     164             : 
-     165             :   // new direction should be inside the pixel
-     166           1 :   EXPECT_EQ(pix, p.direction2Pix(rlon, rlat));
-     167             : 
-     168             :   // new direction should be different from input 
-     169           1 :   EXPECT_FALSE(long0 == rlon);
-     170           1 :   EXPECT_FALSE(lat0 == rlat);
-     171             : 
-     172           1 : }
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testModuleList.cpp.func-sort-c.html b/doc/coverageReport/test/testModuleList.cpp.func-sort-c.html deleted file mode 100644 index 923a232e2..000000000 --- a/doc/coverageReport/test/testModuleList.cpp.func-sort-c.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testModuleList.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testModuleList.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:525594.5 %
Date:2024-04-08 14:58:22Functions:6785.7 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa4mainEiPPc0
_ZN7crpropa23ModuleList_process_Test8TestBodyEv1
_ZN7crpropa25ModuleList_getModule_Test8TestBodyEv1
_ZN7crpropa25ModuleList_runOpenMP_Test8TestBodyEv1
_ZN7crpropa25ModuleList_runSource_Test8TestBodyEv1
_ZN7crpropa28ModuleList_removeModule_Test8TestBodyEv1
_ZN7crpropa32ModuleList_runCandidateList_Test8TestBodyEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testModuleList.cpp.func.html b/doc/coverageReport/test/testModuleList.cpp.func.html deleted file mode 100644 index 1ac5ff9e1..000000000 --- a/doc/coverageReport/test/testModuleList.cpp.func.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testModuleList.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testModuleList.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:525594.5 %
Date:2024-04-08 14:58:22Functions:6785.7 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa23ModuleList_process_Test8TestBodyEv1
_ZN7crpropa25ModuleList_getModule_Test8TestBodyEv1
_ZN7crpropa25ModuleList_runOpenMP_Test8TestBodyEv1
_ZN7crpropa25ModuleList_runSource_Test8TestBodyEv1
_ZN7crpropa28ModuleList_removeModule_Test8TestBodyEv1
_ZN7crpropa32ModuleList_runCandidateList_Test8TestBodyEv1
_ZN7crpropa4mainEiPPc0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testModuleList.cpp.gcov.html b/doc/coverageReport/test/testModuleList.cpp.gcov.html deleted file mode 100644 index 63abd27da..000000000 --- a/doc/coverageReport/test/testModuleList.cpp.gcov.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testModuleList.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testModuleList.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:525594.5 %
Date:2024-04-08 14:58:22Functions:6785.7 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/ModuleList.h"
-       2             : #include "crpropa/Source.h"
-       3             : #include "crpropa/ParticleID.h"
-       4             : #include "crpropa/module/SimplePropagation.h"
-       5             : #include "crpropa/module/BreakCondition.h"
-       6             : 
-       7             : #include "gtest/gtest.h"
-       8             : 
-       9             : namespace crpropa {
-      10             : 
-      11           1 : TEST(ModuleList, process) {
-      12           1 :         ModuleList modules;
-      13           2 :         modules.add(new SimplePropagation());
-      14           1 :         ParticleState initial;
-      15           1 :         ref_ptr<Candidate> candidate = new Candidate(initial);
-      16           2 :         modules.process(candidate);
-      17           1 : }
-      18             : 
-      19           1 : TEST(ModuleList, getModule) {
-      20           1 :         ModuleList modules;
-      21           1 :         ref_ptr<SimplePropagation> prop = new SimplePropagation();
-      22           1 :         modules.add(prop);
-      23           2 :         EXPECT_TRUE(modules[0] == prop);
-      24           1 : }
-      25             : 
-      26           1 : TEST(ModuleList, removeModule) {
-      27           1 :         ModuleList modules;
-      28           1 :         ref_ptr<SimplePropagation> prop = new SimplePropagation();
-      29           1 :         modules.add(prop);
-      30           1 :         modules.remove(0);
-      31           1 :         EXPECT_EQ(modules.size(), 0);
-      32           1 : }
-      33             : 
-      34           1 : TEST(ModuleList, runCandidateList) {
-      35           1 :         ModuleList modules;
-      36           2 :         modules.add(new SimplePropagation());
-      37           1 :         modules.add(new MaximumTrajectoryLength(1 * Mpc));
-      38           1 :         ParticleState initial;
-      39           1 :         ref_ptr<Candidate> candidate = new Candidate(initial);
-      40           1 :         modules.run(candidate);
-      41           1 :         EXPECT_DOUBLE_EQ(1 * Mpc, candidate->getTrajectoryLength());
-      42           1 :         EXPECT_TRUE(candidate->isActive() == false);
-      43           1 : }
-      44             : 
-      45           1 : TEST(ModuleList, runSource) {
-      46           1 :         ModuleList modules;
-      47           2 :         modules.add(new SimplePropagation());
-      48           1 :         modules.add(new MaximumTrajectoryLength(1 * Mpc));
-      49             :         Source source;
-      50           1 :         source.add(new SourcePosition(Vector3d(10, 0, 0) * Mpc));
-      51           2 :         source.add(new SourceIsotropicEmission());
-      52           1 :         source.add(new SourcePowerLawSpectrum(5 * EeV, 100 * EeV, -2));
-      53           1 :         source.add(new SourceParticleType(nucleusId(1, 1)));
-      54           1 :         modules.setShowProgress(true);
-      55           1 :         modules.run(&source, 100, false);
-      56           1 : }
-      57             : 
-      58             : #if _OPENMP
-      59             : #include <omp.h>
-      60           1 : TEST(ModuleList, runOpenMP) {
-      61           1 :         ModuleList modules;
-      62           2 :         modules.add(new SimplePropagation());
-      63           1 :         modules.add(new MaximumTrajectoryLength(1 * Mpc));
-      64             :         Source source;
-      65           1 :         source.add(new SourcePosition(Vector3d(10, 0, 0) * Mpc));
-      66           2 :         source.add(new SourceIsotropicEmission());
-      67           1 :         source.add(new SourcePowerLawSpectrum(5 * EeV, 100 * EeV, -2));
-      68           1 :         source.add(new SourceParticleType(nucleusId(1, 1)));
-      69           1 :         omp_set_num_threads(2);
-      70           1 :         modules.run(&source, 1000, false);
-      71           1 : }
-      72             : #endif
-      73             : 
-      74           0 : int main(int argc, char **argv) {
-      75           0 :         ::testing::InitGoogleTest(&argc, argv);
-      76           0 :         return RUN_ALL_TESTS();
-      77             : }
-      78             : 
-      79             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testOutput.cpp.func-sort-c.html b/doc/coverageReport/test/testOutput.cpp.func-sort-c.html deleted file mode 100644 index f1f61fe38..000000000 --- a/doc/coverageReport/test/testOutput.cpp.func-sort-c.html +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testOutput.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testOutput.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:15716296.9 %
Date:2024-04-08 14:58:22Functions:171894.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa4mainEiPPc0
_Z11ArraysMatchIiLm10EEN7testing15AssertionResultERAT0__KT_S5_1
_ZN7crpropa16Output_size_Test8TestBodyEv1
_ZN7crpropa27ParticleCollector_size_Test8TestBodyEv1
_ZN7crpropa29TextOutput_printProperty_Test8TestBodyEv1
_ZN7crpropa31ParticleCollector_dumpload_Test8TestBodyEv1
_ZN7crpropa32ParticleCollector_fetchItem_Test8TestBodyEv1
_ZN7crpropa32ParticleCollector_reprocess_Test8TestBodyEv1
_ZN7crpropa34TextOutput_printHeader_Custom_Test8TestBodyEv1
_ZN7crpropa35TextOutput_printHeader_Event1D_Test8TestBodyEv1
_ZN7crpropa35TextOutput_printHeader_Event3D_Test8TestBodyEv1
_ZN7crpropa35TextOutput_printHeader_Version_Test8TestBodyEv1
_ZN7crpropa36ParticleCollector_getTrajectory_Test8TestBodyEv1
_ZN7crpropa36ParticleCollector_runModuleList_Test8TestBodyEv1
_ZN7crpropa39HDF5Output_failOnIllegalOutputFile_Test8TestBodyEv1
_ZN7crpropa39TextOutput_failOnIllegalOutputFile_Test8TestBodyEv1
_ZN7crpropa40TextOutput_printHeader_Trajectory1D_Test8TestBodyEv1
_ZN7crpropa40TextOutput_printHeader_Trajectory3D_Test8TestBodyEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testOutput.cpp.func.html b/doc/coverageReport/test/testOutput.cpp.func.html deleted file mode 100644 index 9920b9d67..000000000 --- a/doc/coverageReport/test/testOutput.cpp.func.html +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testOutput.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testOutput.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:15716296.9 %
Date:2024-04-08 14:58:22Functions:171894.4 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_Z11ArraysMatchIiLm10EEN7testing15AssertionResultERAT0__KT_S5_1
_ZN7crpropa16Output_size_Test8TestBodyEv1
_ZN7crpropa27ParticleCollector_size_Test8TestBodyEv1
_ZN7crpropa29TextOutput_printProperty_Test8TestBodyEv1
_ZN7crpropa31ParticleCollector_dumpload_Test8TestBodyEv1
_ZN7crpropa32ParticleCollector_fetchItem_Test8TestBodyEv1
_ZN7crpropa32ParticleCollector_reprocess_Test8TestBodyEv1
_ZN7crpropa34TextOutput_printHeader_Custom_Test8TestBodyEv1
_ZN7crpropa35TextOutput_printHeader_Event1D_Test8TestBodyEv1
_ZN7crpropa35TextOutput_printHeader_Event3D_Test8TestBodyEv1
_ZN7crpropa35TextOutput_printHeader_Version_Test8TestBodyEv1
_ZN7crpropa36ParticleCollector_getTrajectory_Test8TestBodyEv1
_ZN7crpropa36ParticleCollector_runModuleList_Test8TestBodyEv1
_ZN7crpropa39HDF5Output_failOnIllegalOutputFile_Test8TestBodyEv1
_ZN7crpropa39TextOutput_failOnIllegalOutputFile_Test8TestBodyEv1
_ZN7crpropa40TextOutput_printHeader_Trajectory1D_Test8TestBodyEv1
_ZN7crpropa40TextOutput_printHeader_Trajectory3D_Test8TestBodyEv1
_ZN7crpropa4mainEiPPc0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testOutput.cpp.gcov.html b/doc/coverageReport/test/testOutput.cpp.gcov.html deleted file mode 100644 index 3a91eb777..000000000 --- a/doc/coverageReport/test/testOutput.cpp.gcov.html +++ /dev/null @@ -1,355 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testOutput.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testOutput.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:15716296.9 %
Date:2024-04-08 14:58:22Functions:171894.4 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : /** Unit tests for Output modules of CRPropa
-       2             :     Output
-       3             :     TextOutput
-       4             :     ParticleCollector
-       5             :  */
-       6             : 
-       7             : #include "CRPropa.h"
-       8             : 
-       9             : #include "gtest/gtest.h"
-      10             : #include <iostream>
-      11             : #include <string>
-      12             : 
-      13             : 
-      14             : #ifdef CRPROPA_HAVE_HDF5
-      15             : #include <hdf5.h>
-      16             : #endif
-      17             : 
-      18             : // compare two arrays (intead of using Google Mock)
-      19             : // https://stackoverflow.com/a/10062016/6819103
-      20             : template <typename T, size_t size>
-      21           1 : ::testing::AssertionResult ArraysMatch(const T (&expected)[size],
-      22             :                                        const T (&actual)[size]) {
-      23          11 :         for (size_t i(0); i < size; ++i) {
-      24          10 :                 if (expected[i] != actual[i]) {
-      25             :                         return ::testing::AssertionFailure()
-      26           0 :                                << "array[" << i << "] (" << actual[i] << ") != expected["
-      27           0 :                                << i << "] (" << expected[i] << ")";
-      28             :                 }
-      29             :         }
-      30             : 
-      31           1 :         return ::testing::AssertionSuccess();
-      32             : }
-      33             : 
-      34             : namespace crpropa {
-      35             : 
-      36             : //-- Output
-      37           1 : TEST(Output, size) {
-      38           1 :         Candidate c;
-      39           1 :         Output output;
-      40           6 :         for (int it = 0; it < 5; ++it, output.process(&c));
-      41             : 
-      42           1 :         EXPECT_EQ(output.size(), 5);
-      43           1 : }
-      44             : 
-      45             : //-- TextOutput
-      46           1 : TEST(TextOutput, printHeader_Trajectory1D) {
-      47           1 :         Candidate c;
-      48           1 :         TextOutput output(Output::Trajectory1D);
-      49             : 
-      50           1 :         ::testing::internal::CaptureStdout();
-      51           1 :         output.process(&c);
-      52           1 :         std::string captured = testing::internal::GetCapturedStdout();
-      53             : 
-      54           2 :         EXPECT_EQ(captured.substr(0, captured.find("\n")), "#\tID\tE\tX");
-      55           1 : }
-      56             : 
-      57           1 : TEST(TextOutput, printHeader_Event1D) {
-      58           1 :         Candidate c;
-      59           1 :         TextOutput output(Output::Event1D);
-      60             : 
-      61           1 :         ::testing::internal::CaptureStdout();
-      62           1 :         output.process(&c);
-      63           1 :         std::string captured = testing::internal::GetCapturedStdout();
-      64             : 
-      65           2 :         EXPECT_EQ(captured.substr(0, captured.find("\n")), "#\tD\tID\tE\tID0\tE0");
-      66           1 : }
-      67             : 
-      68           1 : TEST(TextOutput, printHeader_Trajectory3D) {
-      69           1 :         Candidate c;
-      70           1 :         TextOutput output(Output::Trajectory3D);
-      71             : 
-      72           1 :         ::testing::internal::CaptureStdout();
-      73           1 :         output.process(&c);
-      74           1 :         std::string captured = testing::internal::GetCapturedStdout();
-      75             : 
-      76           2 :         EXPECT_EQ(captured.substr(0, captured.find("\n")),
-      77             :                   "#\tD\tID\tE\tX\tY\tZ\tPx\tPy\tPz");
-      78           1 : }
-      79             : 
-      80           1 : TEST(TextOutput, printHeader_Event3D) {
-      81           1 :         Candidate c;
-      82           1 :         TextOutput output(Output::Event3D);
-      83             : 
-      84           1 :         ::testing::internal::CaptureStdout();
-      85           1 :         output.process(&c);
-      86           1 :         std::string captured = testing::internal::GetCapturedStdout();
-      87             : 
-      88           2 :         EXPECT_EQ(
-      89             :             captured.substr(0, captured.find("\n")),
-      90             :             "#\tD\tID\tE\tX\tY\tZ\tPx\tPy\tPz\tID0\tE0\tX0\tY0\tZ0\tP0x\tP0y\tP0z");
-      91           1 : }
-      92             : 
-      93           1 : TEST(TextOutput, printHeader_Custom) {
-      94           1 :         Candidate c;
-      95           1 :         TextOutput output(Output::Event1D);
-      96             : 
-      97           1 :         output.enable(Output::SerialNumberColumn);
-      98           1 :         output.disable(Output::TrajectoryLengthColumn);
-      99           1 :         output.set(Output::RedshiftColumn, false);
-     100           1 :         output.enable(Output::CandidateTagColumn);
-     101             : 
-     102           1 :         ::testing::internal::CaptureStdout();
-     103           1 :         output.process(&c);
-     104           1 :         std::string captured = testing::internal::GetCapturedStdout();
-     105             : 
-     106           2 :         EXPECT_EQ(captured.substr(0, captured.find("\n")),
-     107             :                   "#\tSN\tID\tE\tSN0\tID0\tE0\tSN1\ttag");
-     108           1 : }
-     109             : 
-     110           1 : TEST(TextOutput, printProperty) {
-     111           1 :         Candidate c;
-     112           1 :         TextOutput output(Output::Event1D);
-     113           1 :         output.disableAll();
-     114           2 :         output.enableProperty("foo", 2.0, "Bar");
-     115             : 
-     116           1 :         ::testing::internal::CaptureStdout();
-     117           1 :         output.process(&c);
-     118           1 :         std::string captured = testing::internal::GetCapturedStdout();
-     119             : 
-     120             :         // name in first line of header
-     121           2 :         EXPECT_EQ(captured.substr(0, captured.find("\n")), "#\tfoo");
-     122           1 : }
-     123             : 
-     124           1 : TEST(TextOutput, printHeader_Version) {
-     125           1 :         Candidate c;
-     126           1 :         TextOutput output(Output::Event1D);
-     127             : 
-     128           1 :         ::testing::internal::CaptureStdout();
-     129           1 :         output.process(&c);
-     130           1 :         std::string captured = testing::internal::GetCapturedStdout();
-     131             : 
-     132             :         // length of the prefix is 19 chars
-     133           1 :         size_t version_pos = captured.find("# CRPropa version: ") + 19;
-     134             : 
-     135           2 :         EXPECT_EQ(captured.substr(version_pos,
-     136             :                                   captured.find("\n", version_pos) - version_pos),
-     137             :                   g_GIT_DESC);
-     138           1 : }
-     139             : 
-     140             : #ifndef CRPROPA_TESTS_SKIP_EXCEPTIONS
-     141           1 : TEST(TextOutput, failOnIllegalOutputFile) {
-     142           2 :         EXPECT_THROW(
-     143             :             TextOutput output("THIS_FOLDER_MUST_NOT_EXISTS_12345+/FILE.txt"),
-     144             :             std::runtime_error);
-     145           1 : }
-     146             : #endif
-     147             : 
-     148             : #ifdef CRPROPA_HAVE_HDF5
-     149             : #ifndef CRPROPA_TESTS_SKIP_EXCEPTIONS
-     150           1 : TEST(HDF5Output, failOnIllegalOutputFile) {
-     151           1 :         HDF5Output out;
-     152             :         // disable default error output of HDF5
-     153           1 :         H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
-     154           2 :         EXPECT_THROW(out.open("THIS_FOLDER_MUST_NOT_EXISTS_12345+/FILE.h5"),
-     155             :                      std::runtime_error);
-     156           1 : }
-     157             : #endif
-     158             : #endif
-     159             : 
-     160             : //-- ParticleCollector
-     161           2 : TEST(ParticleCollector, size) {
-     162           2 :         ref_ptr<Candidate> c = new Candidate();
-     163           1 :         ParticleCollector output;
-     164             : 
-     165           6 :         for (int it = 0; it < 5; ++it, output.process(c))
-     166             :                 ;
-     167             : 
-     168           1 :         EXPECT_EQ(output.size(), 5);
-     169           2 : }
-     170             : 
-     171           1 : TEST(ParticleCollector, fetchItem) {
-     172           2 :         ref_ptr<Candidate> c = new Candidate(nucleusId(1, 1), 1 * EeV);
-     173           1 :         ParticleCollector output;
-     174             : 
-     175           1 :         output.process(c);
-     176             : 
-     177           2 :         EXPECT_EQ(output[0], c);
-     178           2 : }
-     179             : 
-     180           1 : TEST(ParticleCollector, reprocess) {
-     181           2 :         ref_ptr<Candidate> c = new Candidate(nucleusId(1, 1), 1 * EeV);
-     182           1 :         ParticleCollector collector;
-     183           1 :         ParticleCollector output;
-     184             : 
-     185           1 :         collector.process(c);
-     186           1 :         collector.reprocess(&output);
-     187             : 
-     188           2 :         EXPECT_EQ(output[0], c);
-     189           2 : }
-     190             : 
-     191           1 : TEST(ParticleCollector, dumpload) {
-     192           2 :         ref_ptr<Candidate> c = new Candidate(nucleusId(1, 1), 1.234 * EeV);
-     193           1 :         c->current.setPosition(Vector3d(1, 2, 3));
-     194           1 :         c->current.setDirection(Vector3d(-1, -1, -1));
-     195           1 :         c->setTrajectoryLength(1 * Mpc);
-     196           1 :         c->setRedshift(2);
-     197             : 
-     198           1 :         ParticleCollector input;
-     199           1 :         ParticleCollector output;
-     200             : 
-     201          12 :         for (int i = 0; i <= 10; ++i) {
-     202          22 :                 input.process(c);
-     203             :         }
-     204             : 
-     205             :         // Well, it would be nicer if we don't need to receate any file
-     206           1 :         input.dump("ParticleCollector_DumpTest.txt");
-     207           1 :         output.load("ParticleCollector_DumpTest.txt");
-     208             : 
-     209           1 :         EXPECT_EQ(input.size(), output.size());
-     210           2 :         EXPECT_EQ(output[0]->current.getEnergy(), c->current.getEnergy());
-     211           2 :         EXPECT_EQ(output[1]->getTrajectoryLength(), c->getTrajectoryLength());
-     212           2 :         EXPECT_EQ(output[2]->current.getId(), c->current.getId());
-     213           2 :         EXPECT_EQ(output[3]->getRedshift(), c->getRedshift());
-     214           2 : }
-     215             : 
-     216             : // Just test if the trajectory is on a line for rectilinear propagation
-     217           1 : TEST(ParticleCollector, getTrajectory) {
-     218             :         int pos_x[10];
-     219           1 :         int pos_x_expected[] = {9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
-     220             : 
-     221           1 :         ParticleState p;
-     222           1 :         p.setPosition(Vector3d(10, 0, 0));
-     223           1 :         p.setDirection(Vector3d(-1, 0, 0));
-     224           1 :         ref_ptr<Candidate> c = new Candidate(p);
-     225             : 
-     226           1 :         ref_ptr<ParticleCollector> output = new ParticleCollector();
-     227           1 :         ref_ptr<ParticleCollector> trajectory = new ParticleCollector();
-     228           1 :         trajectory->setClone(true);
-     229             : 
-     230           1 :         ref_ptr<ModuleList> sim = new ModuleList();
-     231           1 :         sim->add(new SimplePropagation(1, 1));
-     232             : 
-     233           1 :         ref_ptr<Observer> obs = new Observer();
-     234           1 :         obs->add(new Observer1D());
-     235           1 :         obs->onDetection(output);
-     236           1 :         sim->add(obs);
-     237             : 
-     238           2 :         sim->run(c);
-     239             : 
-     240           2 :         output->getTrajectory(sim, 0, trajectory);
-     241             : 
-     242             :         Vector3d pos;
-     243             :         int i = 0;
-     244             : 
-     245           1 :         for (ParticleCollector::iterator itr = trajectory->begin();
-     246          11 :              itr != trajectory->end(); ++itr) {
-     247          10 :                 pos = (*(itr->get())).current.getPosition();
-     248          10 :                 pos_x[i] = pos.getX();
-     249          10 :                 ++i;
-     250             :         }
-     251             : 
-     252           1 :         EXPECT_TRUE(ArraysMatch(pos_x_expected, pos_x));
-     253           1 : }
-     254             : 
-     255           1 : TEST(ParticleCollector, runModuleList) {
-     256           1 :         ModuleList modules;
-     257           2 :         modules.add(new SimplePropagation());
-     258           1 :         modules.add(new MaximumTrajectoryLength(1 * Mpc));
-     259             : 
-     260           1 :         ParticleState p;
-     261           1 :         p.setPosition(Vector3d(10, 0, 0));
-     262           1 :         p.setDirection(Vector3d(-1, 0, 0));
-     263           1 :         ref_ptr<Candidate> c = new Candidate(p);
-     264             : 
-     265           1 :         ref_ptr<ParticleCollector> collector = new ParticleCollector();
-     266             : 
-     267           1 :         collector->process(c);
-     268             : 
-     269           1 :         modules.setShowProgress(false);
-     270           1 :         auto candidates = collector->getContainer();
-     271           1 :         modules.run(&candidates);
-     272           2 : }
-     273             : 
-     274           0 : int main(int argc, char **argv) {
-     275           0 :         ::testing::InitGoogleTest(&argc, argv);
-     276           0 :         return RUN_ALL_TESTS();
-     277             : }
-     278             : 
-     279             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testPropagation.cpp.func-sort-c.html b/doc/coverageReport/test/testPropagation.cpp.func-sort-c.html deleted file mode 100644 index 15ff4021f..000000000 --- a/doc/coverageReport/test/testPropagation.cpp.func-sort-c.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testPropagation.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testPropagation.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:33734099.1 %
Date:2024-04-08 14:58:22Functions:181994.7 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa4mainEiPPc0
_ZN7crpropa29testPropagationBP_proton_Test8TestBodyEv1
_ZN7crpropa29testPropagationCK_proton_Test8TestBodyEv1
_ZN7crpropa30testPropagationBP_neutron_Test8TestBodyEv1
_ZN7crpropa30testPropagationCK_neutron_Test8TestBodyEv1
_ZN7crpropa31testPropagationBP_gyration_Test8TestBodyEv1
_ZN7crpropa31testPropagationCK_gyration_Test8TestBodyEv1
_ZN7crpropa31testSimplePropagation_step_Test8TestBodyEv1
_ZN7crpropa32testPropagationBP_zeroField_Test8TestBodyEv1
_ZN7crpropa32testPropagationCK_zeroField_Test8TestBodyEv1
_ZN7crpropa33testPropagationBP_exceptions_Test8TestBodyEv1
_ZN7crpropa33testPropagationBP_reduceStep_Test8TestBodyEv1
_ZN7crpropa33testPropagationCK_exceptions_Test8TestBodyEv1
_ZN7crpropa33testPropagationCK_reduceStep_Test8TestBodyEv1
_ZN7crpropa34testPropagationBP_constructor_Test8TestBodyEv1
_ZN7crpropa34testPropagationCK_constructor_Test8TestBodyEv1
_ZN7crpropa35testPropagationBP_increaseStep_Test8TestBodyEv1
_ZN7crpropa35testPropagationCK_increaseStep_Test8TestBodyEv1
_ZN7crpropa44testPropagationBP_fixedStepOptimization_Test8TestBodyEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testPropagation.cpp.func.html b/doc/coverageReport/test/testPropagation.cpp.func.html deleted file mode 100644 index 586d6fcc2..000000000 --- a/doc/coverageReport/test/testPropagation.cpp.func.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testPropagation.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testPropagation.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:33734099.1 %
Date:2024-04-08 14:58:22Functions:181994.7 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa29testPropagationBP_proton_Test8TestBodyEv1
_ZN7crpropa29testPropagationCK_proton_Test8TestBodyEv1
_ZN7crpropa30testPropagationBP_neutron_Test8TestBodyEv1
_ZN7crpropa30testPropagationCK_neutron_Test8TestBodyEv1
_ZN7crpropa31testPropagationBP_gyration_Test8TestBodyEv1
_ZN7crpropa31testPropagationCK_gyration_Test8TestBodyEv1
_ZN7crpropa31testSimplePropagation_step_Test8TestBodyEv1
_ZN7crpropa32testPropagationBP_zeroField_Test8TestBodyEv1
_ZN7crpropa32testPropagationCK_zeroField_Test8TestBodyEv1
_ZN7crpropa33testPropagationBP_exceptions_Test8TestBodyEv1
_ZN7crpropa33testPropagationBP_reduceStep_Test8TestBodyEv1
_ZN7crpropa33testPropagationCK_exceptions_Test8TestBodyEv1
_ZN7crpropa33testPropagationCK_reduceStep_Test8TestBodyEv1
_ZN7crpropa34testPropagationBP_constructor_Test8TestBodyEv1
_ZN7crpropa34testPropagationCK_constructor_Test8TestBodyEv1
_ZN7crpropa35testPropagationBP_increaseStep_Test8TestBodyEv1
_ZN7crpropa35testPropagationCK_increaseStep_Test8TestBodyEv1
_ZN7crpropa44testPropagationBP_fixedStepOptimization_Test8TestBodyEv1
_ZN7crpropa4mainEiPPc0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testPropagation.cpp.gcov.html b/doc/coverageReport/test/testPropagation.cpp.gcov.html deleted file mode 100644 index f3e80ad45..000000000 --- a/doc/coverageReport/test/testPropagation.cpp.gcov.html +++ /dev/null @@ -1,632 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testPropagation.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testPropagation.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:33734099.1 %
Date:2024-04-08 14:58:22Functions:181994.7 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/Candidate.h"
-       2             : #include "crpropa/ParticleID.h"
-       3             : #include "crpropa/module/SimplePropagation.h"
-       4             : #include "crpropa/module/PropagationBP.h"
-       5             : #include "crpropa/module/PropagationCK.h"
-       6             : #include "crpropa/magneticField/turbulentField/PlaneWaveTurbulence.h"
-       7             : 
-       8             : #include "gtest/gtest.h"
-       9             : 
-      10             : #include <string>
-      11             : #include <iostream>
-      12             : 
-      13             : namespace crpropa {
-      14             : 
-      15           1 : TEST(testSimplePropagation, step) {
-      16           1 :         double minStep = 20;
-      17           1 :         double maxStep = 100;
-      18           1 :         SimplePropagation propa(minStep, maxStep);
-      19             : 
-      20           1 :         ParticleState p;
-      21           1 :         p.setPosition(Vector3d(0, 0, 0));
-      22           1 :         p.setDirection(Vector3d(0, 1, 0));
-      23             : 
-      24           1 :         Candidate c(p);
-      25           1 :         c.setNextStep(10);
-      26             : 
-      27           1 :         propa.process(&c);
-      28             : 
-      29           1 :         EXPECT_EQ(minStep, c.getCurrentStep());
-      30           1 :         EXPECT_EQ(maxStep, c.getNextStep());
-      31           2 :         EXPECT_EQ(Vector3d(0,  0, 0), c.created.getPosition());
-      32           2 :         EXPECT_EQ(Vector3d(0,  1, 0), c.created.getDirection());
-      33           2 :         EXPECT_EQ(Vector3d(0,  0, 0), c.previous.getPosition());
-      34           2 :         EXPECT_EQ(Vector3d(0,  1, 0), c.previous.getDirection());
-      35           2 :         EXPECT_EQ(Vector3d(0, 20, 0), c.current.getPosition());
-      36           2 :         EXPECT_EQ(Vector3d(0,  1, 0), c.current.getDirection());
-      37           2 : }
-      38             : 
-      39             : 
-      40           1 : TEST(testPropagationCK, zeroField) {
-      41           1 :         PropagationCK propa(new UniformMagneticField(Vector3d(0, 0, 0)));
-      42             : 
-      43             :         double minStep = 0.1 * kpc;
-      44           1 :         propa.setMinimumStep(minStep);
-      45             : 
-      46           1 :         ParticleState p;
-      47           1 :         p.setId(nucleusId(1, 1));
-      48           1 :         p.setEnergy(100 * EeV);
-      49           1 :         p.setPosition(Vector3d(0, 0, 0));
-      50           1 :         p.setDirection(Vector3d(0, 1, 0));
-      51           1 :         Candidate c(p);
-      52           1 :         c.setNextStep(0);
-      53             : 
-      54           1 :         propa.process(&c);
-      55             : 
-      56           1 :         EXPECT_DOUBLE_EQ(minStep, c.getCurrentStep());  // perform minimum step
-      57           1 :         EXPECT_DOUBLE_EQ(5 * minStep, c.getNextStep());  // acceleration by factor 5
-      58           1 : }
-      59             : 
-      60             : #ifndef CRPROPA_TESTS_SKIP_EXCEPTIONS
-      61           1 : TEST(testPropagationCK, exceptions) {
-      62             :         // minStep should be smaller than maxStep
-      63           2 :         EXPECT_THROW(PropagationCK propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)), 0.42, 10 , 0), std::runtime_error);
-      64             :         // Too large tolerance: tolerance should be between 0 and 1
-      65           2 :         EXPECT_THROW(PropagationCK propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)), 42., 10 * kpc , 20 * kpc), std::runtime_error);
-      66             : 
-      67           2 :         PropagationCK propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)));
-      68             : 
-      69             :         // set maximum step, so that it can be tested what happens if a larger minStep is set.
-      70           1 :         propa.setMaximumStep(1 * Mpc);
-      71             : 
-      72             :         // this tests _that_ the expected exception is thrown
-      73           1 :         EXPECT_THROW(propa.setTolerance(2.), std::runtime_error);
-      74           1 :         EXPECT_THROW(propa.setMinimumStep(-1.), std::runtime_error);
-      75           1 :         EXPECT_THROW(propa.setMinimumStep(2 * Mpc), std::runtime_error);
-      76             : 
-      77             :         // set minimum step, so that it can be tested what happens if a smaller maxStep is set.
-      78           1 :         propa.setMinimumStep(0.5 * Mpc);
-      79             : 
-      80           1 :         EXPECT_THROW(propa.setMaximumStep(0.1 * Mpc), std::runtime_error);
-      81           1 : }
-      82             : #endif
-      83             : 
-      84           1 : TEST(testPropagationCK, constructor) {
-      85             :         // Test construction and parameters
-      86           1 :         ref_ptr<MagneticField> bField = new UniformMagneticField(Vector3d(0, 0, 1 * nG));
-      87             : 
-      88           1 :         double minStep = 1.;
-      89           1 :         double maxStep = 100.;
-      90           1 :         double tolerance = 0.01;
-      91             : 
-      92           1 :         PropagationCK propa(bField, tolerance, minStep, maxStep);
-      93             : 
-      94           1 :         EXPECT_EQ(minStep, propa.getMinimumStep());
-      95           1 :         EXPECT_EQ(maxStep, propa.getMaximumStep());
-      96           1 :         EXPECT_EQ(tolerance, propa.getTolerance());
-      97           2 :         EXPECT_EQ(bField, propa.getField());
-      98             : 
-      99             :         // Update parameters
-     100           1 :         minStep = 10.;
-     101           1 :         maxStep = 10.;
-     102           1 :         propa.setTolerance(0.0001);
-     103           1 :         bField = new UniformMagneticField(Vector3d(10 * nG, 0, 1 * nG));
-     104             : 
-     105           1 :         propa.setTolerance(tolerance);
-     106           1 :         propa.setMinimumStep(minStep);
-     107           1 :         propa.setMaximumStep(maxStep);
-     108           1 :         propa.setField(bField);
-     109             : 
-     110           1 :         EXPECT_EQ(minStep, propa.getMinimumStep());
-     111           1 :         EXPECT_EQ(maxStep, propa.getMaximumStep());
-     112           1 :         EXPECT_EQ(tolerance, propa.getTolerance());
-     113           2 :         EXPECT_EQ(bField, propa.getField());
-     114             : 
-     115             :         // The propagation should be initialized with the default constructor
-     116           2 :         PropagationCK propaCKField(bField);
-     117           1 :         EXPECT_EQ(propaCKField.getMaximumStep(), 1 * Gpc);
-     118           2 : }
-     119             : 
-     120             : 
-     121             : // Test if the step size is reduced correctly if the error is too large with respect to the tolerance: r > 1
-     122           1 : TEST(testPropagationCK, reduceStep) {
-     123           1 :         PropagationCK propa(new UniformMagneticField(Vector3d(0, 0, 100 * nG)));
-     124             : 
-     125             :         double minStep = 0.1 * kpc;
-     126             :         double maxStep = 1 * Gpc;
-     127           1 :         propa.setMinimumStep(minStep);
-     128           1 :         propa.setMaximumStep(maxStep);
-     129             :         // small tolerance leads to large values of r
-     130           1 :         propa.setTolerance(1e-15);
-     131             : 
-     132           1 :         ParticleState p;
-     133           1 :         p.setId(nucleusId(1, 1));
-     134           1 :         p.setEnergy(100 * TeV);
-     135           1 :         p.setPosition(Vector3d(0, 0, 0));
-     136           1 :         p.setDirection(Vector3d(0, 1, 0));
-     137           1 :         Candidate c(p);
-     138             :         // large step leads to large errors and thus in combination with the low tolerance to high values of r
-     139           1 :         c.setNextStep(maxStep);
-     140             : 
-     141           1 :         propa.process(&c);
-     142             : 
-     143             :         // adaptive algorithm should propagate particle with minimum step size due to the low value for the tolerance
-     144           1 :         EXPECT_DOUBLE_EQ(minStep, c.getCurrentStep());  // perform minimum step because of large r due to small tolerance
-     145           1 :         EXPECT_DOUBLE_EQ(minStep, c.getNextStep());  // stay at minimum step because of large r due to small tolerance
-     146           1 : }
-     147             : 
-     148             : 
-     149             : // Test if the step size is increased correctly if the error is small with respect to the tolerance: r < 1
-     150           1 : TEST(testPropagationCK, increaseStep) {
-     151           1 :         PropagationCK propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)));
-     152             : 
-     153             :         double minStep = 0.001 * pc;
-     154             :         double maxStep = 3.125 * pc;
-     155           1 :         propa.setMinimumStep(minStep);
-     156           1 :         propa.setMaximumStep(maxStep);
-     157             :         // large tolerance leads to small values of r. Consequently, the step size can be increased.
-     158           1 :         propa.setTolerance(0.9);
-     159             : 
-     160           1 :         ParticleState p;
-     161           1 :         p.setId(nucleusId(1, 1));
-     162           1 :         p.setEnergy(100 * EeV);
-     163           1 :         p.setPosition(Vector3d(0, 0, 0));
-     164           1 :         p.setDirection(Vector3d(0, 1, 0));
-     165           1 :         Candidate c(p);
-     166             : 
-     167             :         // each step the step size can be increased by a factor of 5.
-     168           6 :         for (int i = 1; i < 6; i++){
-     169           5 :                 propa.process(&c);
-     170           5 :                 EXPECT_DOUBLE_EQ(minStep*pow(5, i) / pc, c.getNextStep()/pc);
-     171             :         }
-     172             :         // after 5 steps the maxStep is reached. The current step is, however, less.
-     173           1 :         EXPECT_DOUBLE_EQ(maxStep/pc/5., c.getCurrentStep()/pc);
-     174           1 :         EXPECT_DOUBLE_EQ(maxStep/pc, c.getNextStep()/pc);
-     175           1 : }
-     176             : 
-     177             : 
-     178           1 : TEST(testPropagationCK, proton) {
-     179           1 :         PropagationCK propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)));
-     180             : 
-     181             :         double minStep = 0.1 * kpc;
-     182           1 :         propa.setMinimumStep(minStep);
-     183             : 
-     184           1 :         ParticleState p;
-     185           1 :         p.setId(nucleusId(1, 1));
-     186           1 :         p.setEnergy(100 * EeV);
-     187           1 :         p.setPosition(Vector3d(0, 0, 0));
-     188           1 :         p.setDirection(Vector3d(0, 1, 0));
-     189           1 :         Candidate c(p);
-     190           1 :         c.setNextStep(0);
-     191             : 
-     192           1 :         propa.process(&c);
-     193             : 
-     194           1 :         EXPECT_DOUBLE_EQ(minStep, c.getCurrentStep());  // perform minimum step
-     195           1 :         EXPECT_DOUBLE_EQ(5 * minStep, c.getNextStep());  // acceleration by factor 5
-     196           1 : }
-     197             : 
-     198             : 
-     199             : // Test the numerical results for parallel magnetic field lines along the z-axis
-     200           1 : TEST(testPropagationCK, gyration) {
-     201           1 :         PropagationCK propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)));
-     202             : 
-     203             :         double step = 10. * Mpc;  // gyroradius is 108.1 Mpc
-     204           1 :         propa.setMaximumStep(step);
-     205           1 :         propa.setMinimumStep(step);
-     206             : 
-     207             : 
-     208           1 :         ParticleState p;
-     209           1 :         p.setId(nucleusId(1, 1));
-     210           1 :         p.setEnergy(100 * EeV);
-     211           1 :         p.setPosition(Vector3d(0, 0, 0));
-     212           1 :         p.setDirection(Vector3d(1, 1, 1));
-     213           1 :         Candidate c(p);
-     214           1 :         c.setNextStep(0);
-     215           1 :         propa.process(&c);
-     216             : 
-     217           1 :         double dirX = c.current.getDirection().x;
-     218           1 :         double dirY = c.current.getDirection().y;
-     219           1 :         double dirZ = c.current.getDirection().z;
-     220           1 :         double posZ = c.current.getPosition().z;
-     221             : 
-     222             :         // Test if the analytical solution is achieved for the components of the momentum with the CK method as expected in
-     223             :         // the background magnetic field.
-     224             :         double precision = 1e-7;
-     225             :         double expected = 2 / 3.;
-     226           1 :         EXPECT_NEAR(expected, dirX * dirX + dirY * dirY, expected * precision);  // constant momentum in the plane perpendicular to background magnetic field field
-     227             :         expected = 1 / 3.;
-     228           1 :         EXPECT_NEAR(expected, dirZ * dirZ, expected * precision);  // constant momentum parallel to the background magnetic field
-     229             :         expected = step * step / 3.;
-     230           1 :         EXPECT_NEAR(expected, posZ * posZ, expected * precision);  // constant velocity parallel to the background magnetic field
-     231             : 
-     232             :         // Nine new steps to have finally propagated the particle ten times
-     233          10 :         for (int i = 0; i < 9; i++){
-     234           9 :                 propa.process(&c);
-     235             :         }
-     236             : 
-     237           1 :         dirX = c.current.getDirection().x;
-     238           1 :         dirY = c.current.getDirection().y;
-     239           1 :         dirZ = c.current.getDirection().z;
-     240           1 :         posZ = c.current.getPosition().z;
-     241             : 
-     242             :         // Compare the numerical solutions after ten steps with the analytical solution of the trajectories
-     243             :         expected = 2 / 3.;
-     244           1 :         EXPECT_NEAR(expected, dirX * dirX + dirY * dirY, expected * precision);  // constant momentum in the plane perpendicular to background magnetic field field
-     245             :         expected = 1 / 3.;
-     246           1 :         EXPECT_NEAR(expected, dirZ * dirZ, expected * precision);  // constant momentum parallel to the background magnetic field
-     247             :         expected = 100 * step * step / 3.;
-     248           1 :         EXPECT_NEAR(expected, posZ * posZ, expected * precision);  // constant velocity parallel to the background magnetic field
-     249           1 : }
-     250             : 
-     251             : 
-     252           1 : TEST(testPropagationCK, neutron) {
-     253           1 :         PropagationCK propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)));
-     254           1 :         propa.setMinimumStep(1 * kpc);
-     255           1 :         propa.setMaximumStep(42 * Mpc);
-     256             : 
-     257           1 :         ParticleState p;
-     258           1 :         p.setId(nucleusId(1, 0));
-     259           1 :         p.setEnergy(100 * EeV);
-     260           1 :         p.setPosition(Vector3d(0, 0, 0));
-     261           1 :         p.setDirection(Vector3d(0, 1, 0));
-     262           1 :         Candidate c(p);
-     263             : 
-     264           1 :         propa.process(&c);
-     265             : 
-     266           1 :         EXPECT_DOUBLE_EQ(1 * kpc, c.getCurrentStep());
-     267           1 :         EXPECT_DOUBLE_EQ(42 * Mpc, c.getNextStep());
-     268           2 :         EXPECT_EQ(Vector3d(0, 1 * kpc, 0), c.current.getPosition());
-     269           2 :         EXPECT_EQ(Vector3d(0, 1, 0), c.current.getDirection());
-     270           1 : }
-     271             : 
-     272             : 
-     273           1 : TEST(testPropagationBP, zeroField) {
-     274           1 :         PropagationBP propa(new UniformMagneticField(Vector3d(0, 0, 0)), 1 * kpc);
-     275             : 
-     276             :         double minStep = 0.1 * kpc;
-     277           1 :         propa.setMinimumStep(minStep);
-     278           1 :         propa.setTolerance(0.42);
-     279             : 
-     280           1 :         ParticleState p;
-     281           1 :         p.setId(nucleusId(1, 1));
-     282           1 :         p.setEnergy(100 * EeV);
-     283           1 :         p.setPosition(Vector3d(0, 0, 0));
-     284           1 :         p.setDirection(Vector3d(0, 1, 0));
-     285           1 :         Candidate c(p);
-     286           1 :         c.setNextStep(0);
-     287             : 
-     288           1 :         propa.process(&c);
-     289             : 
-     290           1 :         EXPECT_DOUBLE_EQ(minStep, c.getCurrentStep());  // perform minimum step
-     291           1 :         EXPECT_DOUBLE_EQ(5 * minStep, c.getNextStep());  // acceleration by factor 5
-     292           1 : }
-     293             : 
-     294             : #ifndef CRPROPA_TESTS_SKIP_EXCEPTIONS
-     295           1 : TEST(testPropagationBP, exceptions) {
-     296             :         // minStep should be smaller than maxStep
-     297           2 :         EXPECT_THROW(PropagationBP propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)), 0.42, 10 , 0), std::runtime_error);
-     298             :         // Too large tolerance: tolerance should be between 0 and 1
-     299           2 :         EXPECT_THROW(PropagationBP propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)), 42., 10 * kpc , 20 * kpc), std::runtime_error);
-     300             : 
-     301           2 :         PropagationBP propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)));
-     302             : 
-     303             :         // set maximum step, so that it can be tested what happens if a larger minStep is set.
-     304           1 :         propa.setMaximumStep(1 * Mpc);
-     305             : 
-     306             :         // this tests _that_ the expected exception is thrown
-     307           1 :         EXPECT_THROW(propa.setTolerance(2.), std::runtime_error);
-     308           1 :         EXPECT_THROW(propa.setMinimumStep(-1.), std::runtime_error);
-     309           1 :         EXPECT_THROW(propa.setMinimumStep(2 * Mpc), std::runtime_error);
-     310             : 
-     311             :         // set minimum step, so that it can be tested what happens if a smaller maxStep is set.
-     312           1 :         propa.setMinimumStep(0.5 * Mpc);
-     313             : 
-     314           1 :         EXPECT_THROW(propa.setMaximumStep(0.1 * Mpc), std::runtime_error);
-     315           1 : }
-     316             : #endif
-     317             : 
-     318             : 
-     319           1 : TEST(testPropagationBP, constructor) {
-     320             :         // Test construction and parameters
-     321           1 :         ref_ptr<MagneticField> bField = new UniformMagneticField(Vector3d(0, 0, 1 * nG));
-     322             : 
-     323           1 :         double minStep = 1.;
-     324           1 :         double maxStep = 100.;
-     325           1 :         double tolerance = 0.01;
-     326             : 
-     327           1 :         PropagationBP propa(bField, tolerance, minStep, maxStep);
-     328             : 
-     329           1 :         EXPECT_EQ(minStep, propa.getMinimumStep());
-     330           1 :         EXPECT_EQ(maxStep, propa.getMaximumStep());
-     331           1 :         EXPECT_EQ(tolerance, propa.getTolerance());
-     332           2 :         EXPECT_EQ(bField, propa.getField());
-     333             : 
-     334             :         // Update parameters
-     335           1 :         minStep = 10.;
-     336           1 :         maxStep = 10.;
-     337           1 :         propa.setTolerance(0.0001);
-     338           1 :         bField = new UniformMagneticField(Vector3d(10 * nG, 0, 1 * nG));
-     339             : 
-     340           1 :         propa.setTolerance(tolerance);
-     341           1 :         propa.setMinimumStep(minStep);
-     342           1 :         propa.setMaximumStep(maxStep);
-     343           1 :         propa.setField(bField);
-     344             : 
-     345           1 :         EXPECT_EQ(minStep, propa.getMinimumStep());
-     346           1 :         EXPECT_EQ(maxStep, propa.getMaximumStep());
-     347           1 :         EXPECT_EQ(tolerance, propa.getTolerance());
-     348           2 :         EXPECT_EQ(bField, propa.getField());
-     349             : 
-     350             :         // Test the fixed step size version of the Boris push
-     351           1 :         minStep = 10. * kpc;
-     352           2 :         PropagationBP propaBP(bField, minStep);
-     353           1 :         EXPECT_EQ(propaBP.getMaximumStep(), propaBP.getMaximumStep());
-     354             : 
-     355             :         // The propagation should be initialized with the default constructor
-     356           2 :         PropagationBP propaBPField(bField);
-     357           1 :         EXPECT_EQ(propaBPField.getMaximumStep(), 1 * kpc);
-     358           2 : }
-     359             : 
-     360             : 
-     361             : // Test if the step size is reduced correctly if the error is too large with respect to the tolerance: r > 1
-     362           1 : TEST(testPropagationBP, reduceStep) {
-     363           1 :         PropagationBP propa(new UniformMagneticField(Vector3d(0, 0, 100 * nG)), 1 * kpc);
-     364             : 
-     365             :         double minStep = 0.1 * kpc;
-     366             :         double maxStep = 1 * Gpc;
-     367           1 :         propa.setMinimumStep(minStep);
-     368           1 :         propa.setMaximumStep(maxStep);
-     369             :         // small tolerance leads to large values of r
-     370           1 :         propa.setTolerance(1e-15);
-     371             : 
-     372           1 :         ParticleState p;
-     373           1 :         p.setId(nucleusId(1, 1));
-     374           1 :         p.setEnergy(100 * TeV);
-     375           1 :         p.setPosition(Vector3d(0, 0, 0));
-     376           1 :         p.setDirection(Vector3d(0, 1, 0));
-     377           1 :         Candidate c(p);
-     378             :         // large step leads to large errors and thus in combination with the low tolerance to high values of r
-     379           1 :         c.setNextStep(maxStep);
-     380             : 
-     381           1 :         propa.process(&c);
-     382             : 
-     383             :         // adaptive algorithm should propagate particle with minimum step size due to the low value for the tolerance
-     384           1 :         EXPECT_DOUBLE_EQ(minStep, c.getCurrentStep());  // perform minimum step because of large r due to small tolerance
-     385           1 :         EXPECT_DOUBLE_EQ(minStep, c.getNextStep());  // stay at minimum step because of large r due to small tolerance
-     386           1 : }
-     387             : 
-     388             : 
-     389             : // Test if the step size is increased correctly if the error is small with respect to the tolerance: r < 1
-     390           1 : TEST(testPropagationBP, increaseStep) {
-     391           1 :         PropagationBP propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)), 1 * kpc);
-     392             : 
-     393             :         double minStep = 0.001 * pc;
-     394             :         double maxStep = 3.125 * pc;
-     395           1 :         propa.setMinimumStep(minStep);
-     396           1 :         propa.setMaximumStep(maxStep);
-     397             :         // large tolerance leads to small values of r. Consequently, the step size can be increased.
-     398           1 :         propa.setTolerance(0.9);
-     399             : 
-     400           1 :         ParticleState p;
-     401           1 :         p.setId(nucleusId(1, 1));
-     402           1 :         p.setEnergy(100 * EeV);
-     403           1 :         p.setPosition(Vector3d(0, 0, 0));
-     404           1 :         p.setDirection(Vector3d(0, 1, 0));
-     405           1 :         Candidate c(p);
-     406             : 
-     407             :         // each step the step size can be increased by a factor of 5.
-     408           6 :         for (int i = 1; i < 6; i++){
-     409           5 :                 propa.process(&c);
-     410           5 :                 EXPECT_DOUBLE_EQ(minStep*pow(5, i) / pc, c.getNextStep()/pc);
-     411             :         }
-     412             :         // after 5 steps the maxStep is reached. The current step is, however, less.
-     413           1 :         EXPECT_DOUBLE_EQ(maxStep/pc/5., c.getCurrentStep()/pc);
-     414           1 :         EXPECT_DOUBLE_EQ(maxStep/pc, c.getNextStep()/pc);
-     415           1 : }
-     416             : 
-     417             : 
-     418           1 : TEST(testPropagationBP, proton) {
-     419           1 :         PropagationBP propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)));
-     420             : 
-     421             :         double step = 0.01 * kpc;
-     422           1 :         propa.setMinimumStep(step);
-     423           1 :         propa.setMaximumStep(10*step);
-     424           1 :         propa.setTolerance(0.00001);
-     425             : 
-     426           1 :         ParticleState p;
-     427           1 :         p.setId(nucleusId(1, 1));
-     428           1 :         p.setEnergy(100 * EeV);
-     429           1 :         p.setPosition(Vector3d(0, 0, 0));
-     430           1 :         p.setDirection(Vector3d(0, 1, 0));
-     431           1 :         Candidate c(p);
-     432           1 :         c.setNextStep(0);
-     433             : 
-     434           1 :         propa.process(&c);
-     435             : 
-     436           1 :         EXPECT_DOUBLE_EQ(step, c.getCurrentStep());  // perform step
-     437           1 :         EXPECT_DOUBLE_EQ(5 * step, c.getNextStep());  // acceleration by factor 5
-     438           1 : }
-     439             : 
-     440             : 
-     441             : // Test the numerical results for parallel magnetic field lines along the z-axis
-     442           1 : TEST(testPropagationBP, gyration) {
-     443           1 :         PropagationBP propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)));
-     444             : 
-     445             :         double step = 10. * Mpc;  // gyroradius is 108.1 Mpc
-     446           1 :         propa.setMaximumStep(step);
-     447           1 :         propa.setMinimumStep(step);
-     448             : 
-     449             : 
-     450           1 :         ParticleState p;
-     451           1 :         p.setId(nucleusId(1, 1));
-     452           1 :         p.setEnergy(100 * EeV);
-     453           1 :         p.setPosition(Vector3d(0, 0, 0));
-     454           1 :         p.setDirection(Vector3d(1, 1, 1));
-     455           1 :         Candidate c(p);
-     456           1 :         c.setNextStep(0);
-     457           1 :         propa.process(&c);
-     458             : 
-     459           1 :         double dirX = c.current.getDirection().x;
-     460           1 :         double dirY = c.current.getDirection().y;
-     461           1 :         double dirZ = c.current.getDirection().z;
-     462           1 :         double posZ = c.current.getPosition().z;
-     463             : 
-     464             :         // Test if the analytical solution is achieved for the components of the momentum with the Boris push as expected in
-     465             :         // the background magnetic field.
-     466           1 :         EXPECT_DOUBLE_EQ(2 / 3., dirX * dirX + dirY * dirY);  // constant momentum in the perpendicular plane to background magnetic field field
-     467           1 :         EXPECT_DOUBLE_EQ(1 / 3., dirZ * dirZ);  // constant momentum parallel to the background magnetic field
-     468           1 :         EXPECT_DOUBLE_EQ( step * step / 3., posZ * posZ);  // constant velocity parallel to the background magnetic field
-     469             : 
-     470             :         // Nine new steps to have finally propagated the particle ten times
-     471          10 :         for (int i = 0; i < 9; i++){
-     472           9 :                 propa.process(&c);
-     473             :         }
-     474             : 
-     475           1 :         dirX = c.current.getDirection().x;
-     476           1 :         dirY = c.current.getDirection().y;
-     477           1 :         dirZ = c.current.getDirection().z;
-     478           1 :         posZ = c.current.getPosition().z;
-     479             : 
-     480             :         // Compare the numerical solutions after ten steps with the analytical solution of the trajectories
-     481           1 :         EXPECT_DOUBLE_EQ(2 / 3., dirX * dirX + dirY * dirY);  // constant momentum in the perpendicular plane to background magnetic field field
-     482           1 :         EXPECT_DOUBLE_EQ(1 / 3., dirZ * dirZ);  // constant momentum parallel to the background magnetic field
-     483           1 :         EXPECT_DOUBLE_EQ(100 * step * step / 3., posZ * posZ);  // constant velocity parallel to the background magnetic field
-     484           1 : }
-     485             : 
-     486             : 
-     487             : // Test the that the optimization for fixed step sizes works
-     488           1 : TEST(testPropagationBP, fixedStepOptimization) {
-     489             :         // particle 1 with fixed step sizes
-     490             :         double fixed_step = pc;
-     491           2 :         PropagationBP propa1(new PlaneWaveTurbulence(TurbulenceSpectrum(gauss, pc, 100*pc), 10, 1), fixed_step);
-     492           1 :         ParticleState p1;
-     493           1 :         p1.setId(nucleusId(1, 1));
-     494           1 :         p1.setEnergy(100 * EeV);
-     495           1 :         p1.setPosition(Vector3d(0, 0, 0));
-     496           1 :         p1.setDirection(Vector3d(1, 1, 1));
-     497           1 :         Candidate c1(p1);
-     498           1 :         c1.setNextStep(0);
-     499             :         // Nine new steps to have finally propagated the particle ten times
-     500          10 :         for (int i = 0; i < 9; i++){
-     501           9 :                 propa1.process(&c1);
-     502             :         }
-     503             : 
-     504             :         // particle 2 with different min and max steps. The tolerance is chosen such that particle 2 will be
-     505             :         // propagated with the same step as particle 1, however not using the optimization for fixed step sizes
-     506             :         double tolerance = 1;
-     507           2 :         PropagationBP propa2(new PlaneWaveTurbulence(TurbulenceSpectrum(gauss, pc, 100*pc), 10, 1), tolerance, fixed_step, 1.1*fixed_step);
-     508           1 :         ParticleState p2;
-     509           1 :         p2.setId(nucleusId(1, 1));
-     510           1 :         p2.setEnergy(100 * EeV);
-     511           1 :         p2.setPosition(Vector3d(0, 0, 0));
-     512           1 :         p2.setDirection(Vector3d(1, 1, 1));
-     513           1 :         Candidate c2(p2);
-     514           1 :         c1.setNextStep(0);
-     515             :         // Nine new steps to have finally propagated the particle ten times
-     516          10 :         for (int i = 0; i < 9; i++){
-     517           9 :                 propa2.process(&c2);
-     518             :         }
-     519             : 
-     520           1 :         EXPECT_DOUBLE_EQ(c1.current.getDirection().x, c2.current.getDirection().x);
-     521           1 :         EXPECT_DOUBLE_EQ(c1.current.getDirection().y, c2.current.getDirection().y);
-     522           1 :         EXPECT_DOUBLE_EQ(c1.current.getDirection().z, c2.current.getDirection().z);
-     523           1 :         EXPECT_DOUBLE_EQ(c1.current.getPosition().x, c2.current.getPosition().x);
-     524           1 :         EXPECT_DOUBLE_EQ(c1.current.getPosition().y, c2.current.getPosition().y);
-     525           1 :         EXPECT_DOUBLE_EQ(c1.current.getPosition().z, c2.current.getPosition().z);
-     526           1 : }
-     527             : 
-     528             : 
-     529           1 : TEST(testPropagationBP, neutron) {
-     530           1 :         PropagationBP propa(new UniformMagneticField(Vector3d(0, 0, 1 * nG)));
-     531             : 
-     532           1 :         propa.setMinimumStep(1 * kpc);
-     533           1 :         propa.setMaximumStep(1 * kpc);
-     534             : 
-     535           1 :         ParticleState p;
-     536           1 :         p.setId(nucleusId(1, 0));
-     537           1 :         p.setEnergy(100 * EeV);
-     538           1 :         p.setPosition(Vector3d(0, 0, 0));
-     539           1 :         p.setDirection(Vector3d(0, 1, 0));
-     540           1 :         Candidate c(p);
-     541             : 
-     542           1 :         propa.process(&c);
-     543             : 
-     544           1 :         EXPECT_DOUBLE_EQ(1 * kpc, c.getCurrentStep());
-     545           1 :         EXPECT_DOUBLE_EQ(1 * kpc, c.getNextStep());
-     546           2 :         EXPECT_EQ(Vector3d(0, 1 * kpc, 0), c.current.getPosition());
-     547           2 :         EXPECT_EQ(Vector3d(0, 1, 0), c.current.getDirection());
-     548           1 : }
-     549             : 
-     550             : 
-     551           0 : int main(int argc, char **argv) {
-     552           0 :         ::testing::InitGoogleTest(&argc, argv);
-     553           0 :         return RUN_ALL_TESTS();
-     554             : }
-     555             : 
-     556             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testSource.cpp.func-sort-c.html b/doc/coverageReport/test/testSource.cpp.func-sort-c.html deleted file mode 100644 index d2aaccaf2..000000000 --- a/doc/coverageReport/test/testSource.cpp.func-sort-c.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testSource.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testSource.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:27928398.6 %
Date:2024-04-08 14:58:22Functions:232495.8 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa4mainEiPPc0
_ZN7crpropa24SourceList_noSource_Test8TestBodyEv1
_ZN7crpropa24SourceTag_sourceTag_Test8TestBodyEv1
_ZN7crpropa26SourceList_luminosity_Test8TestBodyEv1
_ZN7crpropa26SourceList_simpleTest_Test8TestBodyEv1
_ZN7crpropa29Source_allPropertiesUsed_Test8TestBodyEv1
_ZN7crpropa30SourcePosition_simpleTest_Test8TestBodyEv1
_ZN7crpropa32SourceUniformBox_simpleTest_Test8TestBodyEv1
_ZN7crpropa33SourceComposition_simpleTest_Test8TestBodyEv1
_ZN7crpropa34SourceDensityGrid_withInRange_Test8TestBodyEv1
_ZN7crpropa34SourceEmissionCone_simpleTest_Test8TestBodyEv1
_ZN7crpropa35SourceUniformSphere_simpleTest_Test8TestBodyEv1
_ZN7crpropa36SourceDensityGrid1D_withInRange_Test8TestBodyEv1
_ZN7crpropa37SourceComposition_throwNoIsotope_Test8TestBodyEv1
_ZN7crpropa37SourceDensityGrid_OneAllowedCell_Test8TestBodyEv1
_ZN7crpropa37SourceSNRDistribution_simpleTest_Test8TestBodyEv1
_ZN7crpropa37SourceUniformCylinder_simpleTest_Test8TestBodyEv1
_ZN7crpropa38SourceDirectedEmission_simpleTest_Test8TestBodyEv1
_ZN7crpropa38SourcePowerLawSpectrum_simpleTest_Test8TestBodyEv1
_ZN7crpropa39SourceDensityGrid1D_OneAllowedCell_Test8TestBodyEv1
_ZN7crpropa39SourceMultiplePositions_simpleTest_Test8TestBodyEv1
_ZN7crpropa40SourceGenericComposition_simpleTest_Test8TestBodyEv1
_ZN7crpropa40SourceRedshiftEvolution_testInRange_Test8TestBodyEv1
_ZN7crpropa41SourceUniformHollowSphere_simpleTest_Test8TestBodyEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testSource.cpp.func.html b/doc/coverageReport/test/testSource.cpp.func.html deleted file mode 100644 index 03ae49b49..000000000 --- a/doc/coverageReport/test/testSource.cpp.func.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testSource.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testSource.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:27928398.6 %
Date:2024-04-08 14:58:22Functions:232495.8 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa24SourceList_noSource_Test8TestBodyEv1
_ZN7crpropa24SourceTag_sourceTag_Test8TestBodyEv1
_ZN7crpropa26SourceList_luminosity_Test8TestBodyEv1
_ZN7crpropa26SourceList_simpleTest_Test8TestBodyEv1
_ZN7crpropa29Source_allPropertiesUsed_Test8TestBodyEv1
_ZN7crpropa30SourcePosition_simpleTest_Test8TestBodyEv1
_ZN7crpropa32SourceUniformBox_simpleTest_Test8TestBodyEv1
_ZN7crpropa33SourceComposition_simpleTest_Test8TestBodyEv1
_ZN7crpropa34SourceDensityGrid_withInRange_Test8TestBodyEv1
_ZN7crpropa34SourceEmissionCone_simpleTest_Test8TestBodyEv1
_ZN7crpropa35SourceUniformSphere_simpleTest_Test8TestBodyEv1
_ZN7crpropa36SourceDensityGrid1D_withInRange_Test8TestBodyEv1
_ZN7crpropa37SourceComposition_throwNoIsotope_Test8TestBodyEv1
_ZN7crpropa37SourceDensityGrid_OneAllowedCell_Test8TestBodyEv1
_ZN7crpropa37SourceSNRDistribution_simpleTest_Test8TestBodyEv1
_ZN7crpropa37SourceUniformCylinder_simpleTest_Test8TestBodyEv1
_ZN7crpropa38SourceDirectedEmission_simpleTest_Test8TestBodyEv1
_ZN7crpropa38SourcePowerLawSpectrum_simpleTest_Test8TestBodyEv1
_ZN7crpropa39SourceDensityGrid1D_OneAllowedCell_Test8TestBodyEv1
_ZN7crpropa39SourceMultiplePositions_simpleTest_Test8TestBodyEv1
_ZN7crpropa40SourceGenericComposition_simpleTest_Test8TestBodyEv1
_ZN7crpropa40SourceRedshiftEvolution_testInRange_Test8TestBodyEv1
_ZN7crpropa41SourceUniformHollowSphere_simpleTest_Test8TestBodyEv1
_ZN7crpropa4mainEiPPc0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testSource.cpp.gcov.html b/doc/coverageReport/test/testSource.cpp.gcov.html deleted file mode 100644 index 5c0300eea..000000000 --- a/doc/coverageReport/test/testSource.cpp.gcov.html +++ /dev/null @@ -1,516 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testSource.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testSource.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:27928398.6 %
Date:2024-04-08 14:58:22Functions:232495.8 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/Source.h"
-       2             : #include "crpropa/Units.h"
-       3             : #include "crpropa/ParticleID.h"
-       4             : 
-       5             : #include "gtest/gtest.h"
-       6             : #include <stdexcept>
-       7             : 
-       8             : namespace crpropa {
-       9             : 
-      10           2 : TEST(SourcePosition, simpleTest) {
-      11             :         Vector3d position(1, 2, 3);
-      12           1 :         SourcePosition source(position);
-      13           1 :         ParticleState ps;
-      14           1 :         source.prepareParticle(ps);
-      15           2 :         EXPECT_EQ(position, ps.getPosition());
-      16           1 : }
-      17             : 
-      18           1 : TEST(SourceMultiplePositions, simpleTest) {
-      19           1 :         SourceMultiplePositions source;
-      20           1 :         source.add(Vector3d(1, 0, 0), 0.25);
-      21           1 :         source.add(Vector3d(2, 0, 0), 0.75);
-      22           1 :         ParticleState ps;
-      23             :         int n1 = 0;
-      24             :         int n2 = 0;
-      25       10001 :         for (int i = 0; i < 10000; i++) {
-      26       10000 :                 source.prepareParticle(ps);
-      27       10000 :                 if (ps.getPosition().x == 1)
-      28        2585 :                         n1++;
-      29        7415 :                 else if (ps.getPosition().x == 2)
-      30        7415 :                         n2++;
-      31             :         }
-      32           1 :         EXPECT_NEAR(n1, 2500, 5 * sqrt(2500));
-      33           1 :         EXPECT_NEAR(n2, 7500, 5 * sqrt(7500));
-      34           1 : }
-      35             : 
-      36           2 : TEST(SourceUniformSphere, simpleTest) {
-      37             :         Vector3d center(0, 0, 0);
-      38           1 :         double radius = 110;
-      39           1 :         SourceUniformSphere source(center, radius);
-      40           1 :         ParticleState ps;
-      41           1 :         source.prepareParticle(ps);
-      42           1 :         double distance = ps.getPosition().getDistanceTo(center);
-      43           1 :         EXPECT_GE(radius, distance);
-      44           1 : }
-      45             : 
-      46           2 : TEST(SourceUniformHollowSphere, simpleTest) {
-      47             :         Vector3d center(0, 0, 0);
-      48           1 :         double radius_inner = 50;
-      49           1 :         double radius_outer = 110;
-      50             :         SourceUniformHollowSphere source(center,
-      51             :                         radius_inner,
-      52           1 :                         radius_outer);
-      53         101 :         for (int i=0; i < 100; ++i) {
-      54         100 :                 ParticleState ps;
-      55         100 :                 source.prepareParticle(ps);
-      56         100 :                 double distance = ps.getPosition().getDistanceTo(center);
-      57         100 :                 EXPECT_GE(radius_outer, distance);
-      58         100 :                 EXPECT_LE(radius_inner, distance);
-      59             :         }
-      60           1 : }
-      61             : 
-      62           2 : TEST(SourceUniformBox, simpleTest) {
-      63             :         Vector3d origin(-7, -2, 0);
-      64             :         Vector3d size(13, 55, 192);
-      65           1 :         SourceUniformBox box(origin, size);
-      66           1 :         ParticleState p;
-      67           1 :         box.prepareParticle(p);
-      68           1 :         Vector3d pos = p.getPosition();
-      69           1 :         EXPECT_LE(origin.x, pos.x);
-      70           1 :         EXPECT_LE(origin.y, pos.y);
-      71           1 :         EXPECT_LE(origin.z, pos.z);
-      72           1 :         EXPECT_GE(size.x, pos.x);
-      73           1 :         EXPECT_GE(size.y, pos.y);
-      74           1 :         EXPECT_GE(size.z, pos.z);
-      75           1 : }
-      76             : 
-      77           2 : TEST(SourceUniformCylinder, simpleTest) {
-      78             :         Vector3d center(0, 0, 0);
-      79             :         double radius = 15;
-      80             :         double height = 2;
-      81           1 :         SourceUniformCylinder cylinder(center, height, radius);
-      82           1 :         ParticleState ps;
-      83           1 :         cylinder.prepareParticle(ps);
-      84           1 :         Vector3d pos = ps.getPosition();
-      85           1 :         double R2 = pos.x*pos.x+pos.y*pos.y;
-      86           1 :         double H = pow(pos.z*pos.z, 0.5);
-      87           1 :         EXPECT_GE(radius*radius, R2);
-      88           1 :         EXPECT_GE(height/2., H);
-      89           1 : }
-      90             : 
-      91           1 : TEST(SourceSNRDistribution, simpleTest) {
-      92             :         double R_earth = 8.5*kpc;
-      93             :         double alpha = 2.0;
-      94             :         double beta = 3.53;
-      95             :         double Z_G = 0.3*kpc;
-      96           1 :         SourceSNRDistribution snr(R_earth,alpha, beta, Z_G);
-      97           1 :         ParticleState ps;
-      98           1 :         snr.prepareParticle(ps);
-      99           1 :         Vector3d pos = ps.getPosition();
-     100           1 :         double R2 = pos.x*pos.x+pos.y*pos.y;
-     101           1 :         EXPECT_GE(20*kpc*20*kpc, R2); // radius must be smaller than 20 kpc
-     102             :         
-     103             :         double R2_mean = 0.;
-     104             :         double Z_mean = 0.;
-     105      100001 :         for (size_t i=0; i<100000; i++) {
-     106      100000 :                 snr.prepareParticle(ps);
-     107      100000 :                 Vector3d pos = ps.getPosition();
-     108      100000 :                 R2_mean += pow(pos.x/kpc, 2.)+pow(pos.y/kpc, 2.);
-     109      100000 :                 Z_mean += pos.z/kpc;
-     110             :         }
-     111           1 :         R2_mean/=100000.;
-     112           1 :         Z_mean/=100000.;
-     113           1 :         EXPECT_NEAR(100.306, R2_mean, 1);
-     114           1 :         EXPECT_NEAR(0., Z_mean, 0.1);
-     115           1 : }
-     116             : 
-     117           2 : TEST(SourceDensityGrid, withInRange) {
-     118             :         // Create a grid with 10^3 cells ranging from (0, 0, 0) to (10, 10, 10)
-     119             :         Vector3d origin(0, 0, 0);
-     120             :         int cells = 10;
-     121             :         double spacing = 1;
-     122           1 :         auto grid = new Grid1f(origin, cells, spacing);
-     123          11 :         for (int ix = 0; ix < cells; ix++)
-     124         110 :                 for (int iy = 0; iy < cells; iy++)
-     125        1100 :                         for (int iz = 0; iz < cells; iz++)
-     126        1000 :                                 grid->get(ix, iy, iz) = ix * iy * iz;
-     127             : 
-     128           2 :         SourceDensityGrid source(grid);
-     129           1 :         ParticleState p;
-     130             : 
-     131           1 :         source.prepareParticle(p);
-     132           1 :         Vector3d pos = p.getPosition();
-     133             : 
-     134             :         // dialed positions should be within the volume (0, 0, 0) - (10, 10, 10)
-     135           1 :         EXPECT_LE(0, pos.x);
-     136           1 :         EXPECT_GE(10, pos.x);
-     137           1 :         EXPECT_LE(0, pos.y);
-     138           1 :         EXPECT_GE(10, pos.y);
-     139           1 :         EXPECT_LE(0, pos.z);
-     140           1 :         EXPECT_GE(10, pos.z);
-     141           1 : }
-     142             : 
-     143           2 : TEST(SourceDensityGrid, OneAllowedCell) {
-     144             :         // Create a grid with 2^3 cells ranging from (0, 0, 0) to (4, 4, 4)
-     145             :         Vector3d origin(0, 0, 0);
-     146             :         int cells = 2;
-     147             :         double spacing = 2;
-     148           1 :         auto grid = new Grid1f(origin, cells, spacing);
-     149             :         
-     150             :         // set all but one cells to 0
-     151           3 :         for (int ix = 0; ix < cells; ix++)
-     152           6 :                 for (int iy = 0; iy < cells; iy++)
-     153          12 :                         for (int iz = 0; iz < cells; iz++)
-     154           8 :                                 grid->get(ix, iy, iz) = 0;
-     155             : 
-     156             :         // set the first cell ((0, 0, 0) to (2, 2, 2))
-     157           1 :         grid->get(0, 0, 0) = 1;
-     158             : 
-     159           2 :         SourceDensityGrid source(grid);
-     160           1 :         ParticleState p;
-     161             : 
-     162           1 :         int nFalse = 0;
-     163             :         Vector3d mean(0, 0, 0);
-     164       10001 :         for (int i = 0; i < 10000; i++) {
-     165       10000 :                 source.prepareParticle(p);
-     166       10000 :                 Vector3d pos = p.getPosition();
-     167             :                 mean += pos;
-     168       10000 :                 if ((pos.x < 0) or (pos.x > 2) or (pos.y < 0) or (pos.y > 2)
-     169       10000 :                                 or (pos.z < 0) or (pos.z > 2))
-     170           0 :                         nFalse++;
-     171             :         }
-     172             : 
-     173             :         // only the first bin should get dialed
-     174           1 :         EXPECT_EQ(0, nFalse);
-     175             : 
-     176             :         // mean should be close to (1, 1, 1) if random positions are uniform in (0, 0, 0) - (2, 2, 2)
-     177             :         mean /= 10000;
-     178           1 :         EXPECT_NEAR(1, mean.x, 0.2);
-     179           1 :         EXPECT_NEAR(1, mean.y, 0.2);
-     180           1 :         EXPECT_NEAR(1, mean.z, 0.2);
-     181           1 : }
-     182             : 
-     183           2 : TEST(SourceDensityGrid1D, withInRange) {
-     184             :         // Create a grid with 10 cells ranging from 0 to 10
-     185             :         Vector3d origin(0, 0, 0);
-     186             :         int nCells = 10;
-     187             :         double spacing = 1.;
-     188           1 :         auto grid = new Grid1f(origin, nCells, 1, 1, spacing);
-     189             : 
-     190             :         // set some values
-     191          11 :         for (int i = 0; i < 10; i++) {
-     192          10 :                 grid->get(i, 0, 0) = 2;
-     193             :         }
-     194             : 
-     195           2 :         SourceDensityGrid1D source(grid);
-     196           1 :         ParticleState p;
-     197             : 
-     198           1 :         source.prepareParticle(p);
-     199           1 :         Vector3d pos = p.getPosition();
-     200             :         // dialed position should be within the range 0 - 10
-     201           1 :         EXPECT_LE(0, pos.x);
-     202           1 :         EXPECT_GE(10, pos.x);
-     203           1 : }
-     204             : 
-     205           2 : TEST(SourceDensityGrid1D, OneAllowedCell) {
-     206             :         // Test if the only allowed cells is repeatedly selected
-     207             :         Vector3d origin(0, 0, 0);
-     208             :         int nCells = 10;
-     209             :         double spacing = 1.;
-     210           1 :         auto grid = new Grid1f(origin, nCells, 1, 1, spacing);
-     211             : 
-     212             :         // set some values
-     213          11 :         for (int i = 0; i < 10; i++) {
-     214          10 :                 grid->get(i, 0, 0) = 0;
-     215             :         }
-     216           1 :         grid->get(5, 0, 0) = 1;
-     217             : 
-     218           2 :         SourceDensityGrid1D source(grid);
-     219           1 :         ParticleState p;
-     220             : 
-     221         101 :         for (int i = 0; i < 100; i++) {
-     222         100 :                 source.prepareParticle(p);
-     223             :                 // dialed position should be in range 5-6
-     224         100 :                 Vector3d pos = p.getPosition();
-     225         100 :                 EXPECT_LE(5, pos.x);
-     226         100 :                 EXPECT_GE(6, pos.x);
-     227             :         }
-     228           1 : }
-     229             : 
-     230           1 : TEST(SourcePowerLawSpectrum, simpleTest) {
-     231           1 :         double Emin = 4 * EeV;
-     232           1 :         double Emax = 200 * EeV;
-     233             :         double index = -2.7;
-     234           1 :         SourcePowerLawSpectrum spectrum(Emin, Emax, index);
-     235           1 :         ParticleState ps;
-     236           1 :         spectrum.prepareParticle(ps);
-     237             : 
-     238             :         // energy should be within Emin - Emax
-     239           1 :         EXPECT_LE(Emin, ps.getEnergy());
-     240           1 :         EXPECT_GE(Emax, ps.getEnergy());
-     241           1 : }
-     242             : 
-     243           1 : TEST(SourceComposition, simpleTest) {
-     244           1 :         double Emin = 10;
-     245             :         double Rmax = 100;
-     246             :         double index = -1;
-     247           1 :         SourceComposition source(Emin, Rmax, index);
-     248           1 :         source.add(nucleusId(6, 3), 1);
-     249           1 :         ParticleState p;
-     250           1 :         source.prepareParticle(p);
-     251           1 :         EXPECT_EQ(nucleusId(6, 3), p.getId());
-     252           1 :         EXPECT_LE(Emin, p.getEnergy());
-     253           1 :         EXPECT_GE(6 * Rmax, p.getEnergy());
-     254           1 : }
-     255             : 
-     256           2 : TEST(SourceDirectedEmission, simpleTest) {
-     257             :         Vector3d mu(1., 0., 0.);
-     258             :         double kappa = 1000.;
-     259           1 :         SourceDirectedEmission source(mu, kappa);
-     260           1 :         Candidate c;
-     261             :         Vector3d meanDir(0., 0., 0.);
-     262        1001 :         for (size_t i = 0; i < 1000; i++) {
-     263        1000 :                 source.prepareCandidate(c);
-     264        1000 :                 meanDir += c.source.getDirection();
-     265        1000 :                 double w = c.getWeight();
-     266        1000 :                 EXPECT_GE(w, 0.);
-     267             :         }
-     268             :         meanDir /= 1000.;
-     269           1 :         EXPECT_NEAR(meanDir.x, 1., 0.1);
-     270           1 :         EXPECT_NEAR(meanDir.y, 0., 0.01);
-     271           1 :         EXPECT_NEAR(meanDir.z, 0., 0.01);
-     272           2 : }
-     273             : 
-     274           2 : TEST(SourceEmissionCone, simpleTest) {
-     275             :         Vector3d direction(42., 0., 0.);
-     276           1 :         double aperture = 1/42.;
-     277             :         
-     278           1 :         SourceEmissionCone source(direction, aperture);
-     279             :         
-     280           1 :         ParticleState p;
-     281           1 :         source.prepareParticle(p);
-     282           1 :         double angle = direction.getAngleTo(p.getDirection());
-     283           1 :         EXPECT_LE(angle, aperture);
-     284           1 : }
-     285             : 
-     286             : #ifdef CRPROPA_HAVE_MUPARSER
-     287           1 : TEST(SourceGenericComposition, simpleTest) {
-     288             :         double Emin = 10;
-     289             :         double Emax = 100;
-     290           1 :         SourceGenericComposition source(Emin, Emax, "E^-2");
-     291           1 :         int id1 = nucleusId(6, 3);
-     292           1 :         int id2 = nucleusId(12, 6);
-     293           1 :         source.add(id1, 1);
-     294           1 :         source.add(id2, 10);
-     295           1 :         ParticleState p;
-     296             :         size_t id1Count = 0, id2Count = 0;
-     297             :         size_t ElowCount = 0, EhighCount = 0;
-     298           1 :         size_t n = 100000;
-     299      100001 :         for (size_t i = 0; i < n; i++) {
-     300      100000 :                 source.prepareParticle(p);
-     301      100000 :                 if (p.getId() == id1)
-     302        8964 :                         id1Count++;
-     303      100000 :                 if (p.getId() == id2)
-     304       91036 :                         id2Count++;
-     305      100000 :                 double e = p.getEnergy();
-     306      100000 :                 if ( (e >= Emin) && (e < 20))
-     307       55702 :                         ElowCount++;
-     308      100000 :                 if ( (e >= 20) && (e <= Emax))
-     309       44298 :                         EhighCount++;
-     310             : 
-     311             :         }
-     312           1 :         EXPECT_EQ(n, id1Count + id2Count);
-     313           1 :         EXPECT_EQ(n, ElowCount + EhighCount);
-     314           1 :         EXPECT_NEAR((float)id1Count/(float)id2Count, 0.1, 0.01);
-     315           1 :         EXPECT_NEAR((float)ElowCount/(float)EhighCount, 1.25, 0.1);
-     316           1 : }
-     317             : #endif
-     318             : 
-     319           1 : TEST(SourceComposition, throwNoIsotope) {
-     320           1 :         SourceComposition source(1, 10, -1);
-     321           1 :         ParticleState ps;
-     322           1 :         EXPECT_THROW(source.prepareParticle(ps), std::runtime_error);
-     323           1 : }
-     324             : 
-     325           1 : TEST(SourceRedshiftEvolution, testInRange) {
-     326           1 :         Candidate c;
-     327             : 
-     328           1 :         double zmin = 0.5;
-     329           1 :         double zmax = 2.5;
-     330             : 
-     331             :         // general case: m
-     332           1 :         SourceRedshiftEvolution source1(3.2, zmin, zmax);
-     333         101 :         for (int i = 0; i < 100; i++) {
-     334         100 :                 source1.prepareCandidate(c);
-     335         100 :                 EXPECT_LE(zmin, c.getRedshift());
-     336         100 :                 EXPECT_GE(zmax, c.getRedshift());
-     337             :         }
-     338             : 
-     339             :         // general case: m = -1
-     340           1 :         SourceRedshiftEvolution source2(-1, zmin, zmax);
-     341         101 :         for (int i = 0; i < 100; i++) {
-     342         100 :                 source2.prepareCandidate(c);
-     343         100 :                 EXPECT_LE(zmin, c.getRedshift());
-     344         100 :                 EXPECT_GE(zmax, c.getRedshift());
-     345             :         }
-     346           1 : }
-     347             : 
-     348           2 : TEST(Source, allPropertiesUsed) {
-     349             :         Source source;
-     350           1 :         source.add(new SourcePosition(Vector3d(10, 0, 0) * Mpc));
-     351           2 :         source.add(new SourceIsotropicEmission());
-     352           1 :         source.add(new SourcePowerLawSpectrum(5 * EeV, 100 * EeV, -2));
-     353           1 :         source.add(new SourceParticleType(nucleusId(8, 4)));
-     354           1 :         source.add(new SourceRedshift(2));
-     355             : 
-     356           1 :         Candidate c = *source.getCandidate();
-     357             : 
-     358           1 :         EXPECT_EQ(2, c.getRedshift());
-     359             : 
-     360           1 :         ParticleState p;
-     361             : 
-     362             :         p = c.source;
-     363           1 :         EXPECT_EQ(nucleusId(8, 4), p.getId());
-     364           1 :         EXPECT_LE(5 * EeV, p.getEnergy());
-     365           1 :         EXPECT_GE(100 * EeV, p.getEnergy());
-     366           2 :         EXPECT_EQ(Vector3d(10, 0, 0) * Mpc, p.getPosition());
-     367             : 
-     368             :         p = c.created;
-     369           1 :         EXPECT_EQ(nucleusId(8, 4), p.getId());
-     370           1 :         EXPECT_LE(5 * EeV, p.getEnergy());
-     371           1 :         EXPECT_GE(100 * EeV, p.getEnergy());
-     372           2 :         EXPECT_EQ(Vector3d(10, 0, 0) * Mpc, p.getPosition());
-     373             : 
-     374             :         p = c.previous;
-     375           1 :         EXPECT_EQ(nucleusId(8, 4), p.getId());
-     376           1 :         EXPECT_LE(5 * EeV, p.getEnergy());
-     377           1 :         EXPECT_GE(100 * EeV, p.getEnergy());
-     378           2 :         EXPECT_EQ(Vector3d(10, 0, 0) * Mpc, p.getPosition());
-     379             : 
-     380             :         p = c.current;
-     381           1 :         EXPECT_EQ(nucleusId(8, 4), p.getId());
-     382           1 :         EXPECT_LE(5 * EeV, p.getEnergy());
-     383           1 :         EXPECT_GE(100 * EeV, p.getEnergy());
-     384           2 :         EXPECT_EQ(Vector3d(10, 0, 0) * Mpc, p.getPosition());
-     385           2 : }
-     386             : 
-     387           2 : TEST(SourceList, simpleTest) {
-     388             :         // test if source list works with one source
-     389             :         SourceList sourceList;
-     390           1 :         ref_ptr<Source> source = new Source;
-     391           1 :         source->add(new SourcePosition(Vector3d(10, 0, 0)));
-     392           1 :         sourceList.add(source);
-     393             : 
-     394           1 :         ref_ptr<Candidate> c = sourceList.getCandidate();
-     395             : 
-     396           2 :         EXPECT_EQ(Vector3d(10, 0, 0), c->created.getPosition());
-     397           2 :         EXPECT_EQ(Vector3d(10, 0, 0), c->previous.getPosition());
-     398           2 :         EXPECT_EQ(Vector3d(10, 0, 0), c->current.getPosition());
-     399           1 : }
-     400             : 
-     401           2 : TEST(SourceList, noSource) {
-     402             :         // test if an error is thrown when source list empty
-     403             :         SourceList sourceList;
-     404           1 :         EXPECT_THROW(sourceList.getCandidate(), std::runtime_error);
-     405           1 : }
-     406             : 
-     407           2 : TEST(SourceList, luminosity) {
-     408             :         // test if the sources are dialed according to their luminosities
-     409             :         SourceList sourceList;
-     410             : 
-     411           1 :         ref_ptr<Source> source1 = new Source;
-     412           1 :         source1->add(new SourceEnergy(100));
-     413           1 :         sourceList.add(source1, 80);
-     414             : 
-     415           1 :         ref_ptr<Source> source2 = new Source;
-     416           1 :         source2->add(new SourceEnergy(0));
-     417           1 :         sourceList.add(source2, 20);
-     418             : 
-     419             :         double meanE = 0;
-     420        1001 :         for (int i = 0; i < 1000; i++) {
-     421        1000 :                 ref_ptr<Candidate> c = sourceList.getCandidate();
-     422        1000 :                 meanE += c->created.getEnergy();
-     423             :         }
-     424           1 :         meanE /= 1000;
-     425           1 :         EXPECT_NEAR(80, meanE, 4); // this test can stochastically fail
-     426           1 : }
-     427             : 
-     428           1 : TEST(SourceTag, sourceTag) {
-     429           1 :         SourceTag tag("mySourceTag");
-     430           1 :         Candidate c;
-     431           1 :         tag.prepareCandidate(c);
-     432           2 :         EXPECT_TRUE(c.getTagOrigin() == "mySourceTag");
-     433           1 : }
-     434             : 
-     435           0 : int main(int argc, char **argv) {
-     436           0 :         ::testing::InitGoogleTest(&argc, argv);
-     437           0 :         return RUN_ALL_TESTS();
-     438             : }
-     439             : 
-     440             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testTurbulentField.cpp.func-sort-c.html b/doc/coverageReport/test/testTurbulentField.cpp.func-sort-c.html deleted file mode 100644 index f9a2c170f..000000000 --- a/doc/coverageReport/test/testTurbulentField.cpp.func-sort-c.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testTurbulentField.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testTurbulentField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:4646100.0 %
Date:2024-04-08 14:58:22Functions:88100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN39testGridTurbulence_Turbulence_seed_Test8TestBodyEv1
_ZN39testTurbulenceSpectrum_constructor_Test8TestBodyEv1
_ZN40testVectorFieldGrid_Turbulence_seed_Test8TestBodyEv1
_ZN45testTurbulenceSpectrum_correlationLength_Test8TestBodyEv1
_ZN46testVectorFieldGrid_Turbulence_bmean_brms_Test8TestBodyEv1
_ZN46testVectorFieldGrid_turbulence_Exceptions_Test8TestBodyEv1
_ZN60testSimpleGridTurbulence_oldFunctionForCrrelationLength_Test8TestBodyEv1
main1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testTurbulentField.cpp.func.html b/doc/coverageReport/test/testTurbulentField.cpp.func.html deleted file mode 100644 index 4a96c6309..000000000 --- a/doc/coverageReport/test/testTurbulentField.cpp.func.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testTurbulentField.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testTurbulentField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:4646100.0 %
Date:2024-04-08 14:58:22Functions:88100.0 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN39testGridTurbulence_Turbulence_seed_Test8TestBodyEv1
_ZN39testTurbulenceSpectrum_constructor_Test8TestBodyEv1
_ZN40testVectorFieldGrid_Turbulence_seed_Test8TestBodyEv1
_ZN45testTurbulenceSpectrum_correlationLength_Test8TestBodyEv1
_ZN46testVectorFieldGrid_Turbulence_bmean_brms_Test8TestBodyEv1
_ZN46testVectorFieldGrid_turbulence_Exceptions_Test8TestBodyEv1
_ZN60testSimpleGridTurbulence_oldFunctionForCrrelationLength_Test8TestBodyEv1
main1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testTurbulentField.cpp.gcov.html b/doc/coverageReport/test/testTurbulentField.cpp.gcov.html deleted file mode 100644 index 642a3acef..000000000 --- a/doc/coverageReport/test/testTurbulentField.cpp.gcov.html +++ /dev/null @@ -1,218 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testTurbulentField.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testTurbulentField.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:4646100.0 %
Date:2024-04-08 14:58:22Functions:88100.0 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include <stdexcept>
-       2             : 
-       3             : #include "crpropa/Grid.h"
-       4             : #include "crpropa/Units.h"
-       5             : #include "crpropa/Common.h"
-       6             : #include "crpropa/GridTools.h"
-       7             : #include "crpropa/magneticField/turbulentField/TurbulentField.h"
-       8             : #include "crpropa/magneticField/turbulentField/GridTurbulence.h"
-       9             : #include "crpropa/magneticField/turbulentField/PlaneWaveTurbulence.h"
-      10             : #include "crpropa/magneticField/turbulentField/SimpleGridTurbulence.h"
-      11             : 
-      12             : #include "gtest/gtest.h"
-      13             : 
-      14             : using namespace crpropa;
-      15             : 
-      16             : //check problems brought up in https://github.com/CRPropa/CRPropa3/issues/322
-      17           1 : TEST(testTurbulenceSpectrum, constructor) {
-      18             :         double sIndex = 5./3.;
-      19             :         double qIndex = 4.;
-      20             :         double bendOver = 1.;
-      21             :         double lMin = 1.; 
-      22             :         double lMax = 10.; 
-      23             :         double brms = 1*muG;
-      24           1 :         auto spectrum = TurbulenceSpectrum(brms, lMin, lMax);
-      25           1 :         EXPECT_DOUBLE_EQ(spectrum.getBrms(), brms);
-      26           1 :         EXPECT_DOUBLE_EQ(spectrum.getLmin(), lMin);
-      27           1 :         EXPECT_DOUBLE_EQ(spectrum.getLmax(), lMax);
-      28           1 :         EXPECT_DOUBLE_EQ(spectrum.getLbendover(), bendOver); //default
-      29           1 :         EXPECT_DOUBLE_EQ(spectrum.getSindex(), sIndex); //default
-      30           1 :         EXPECT_DOUBLE_EQ(spectrum.getQindex(), qIndex); //default
-      31           1 : }
-      32             : 
-      33           1 : TEST(testTurbulenceSpectrum, correlationLength) {
-      34             :         double lMin = 0.00001; // not used for Lc
-      35             :         double lMax = 9999999; // not used for Lc
-      36             :         double lBo = 100;
-      37           1 :         auto spectrum = TurbulenceSpectrum(1*muG, lMin, lMax, lBo);
-      38             :         auto Lc = spectrum.getCorrelationLength();
-      39           1 :     EXPECT_NEAR(Lc, 0.498*lBo, 0.001*lBo);
-      40           1 : }
-      41             : 
-      42             : #ifdef CRPROPA_HAVE_FFTW3F
-      43             : 
-      44           1 : TEST(testSimpleGridTurbulence, oldFunctionForCrrelationLength) { //TODO: remove in future
-      45             :         double lMin = 1*kpc;
-      46             :         double lMax = 1*Gpc;
-      47             :         double alpha = -11/3.;
-      48           1 :         auto Lc = turbulentCorrelationLength(lMin, lMax, alpha);
-      49           1 :     EXPECT_NEAR(Lc, lMax/5, 1*Mpc);
-      50           1 : }
-      51             : 
-      52           2 : TEST(testVectorFieldGrid, Turbulence_bmean_brms) {
-      53             :         // Test for zero mean: <B> = 0
-      54             :         size_t n = 64;
-      55             :         double spacing = 10 * Mpc / n;
-      56             :         double Brms = 1;
-      57             :         double lMin = 2 * spacing;
-      58             :         double lMax = 8 * spacing;
-      59             : 
-      60             :         auto spectrum = SimpleTurbulenceSpectrum(Brms, lMin, lMax);
-      61             :         auto gp = GridProperties(Vector3d(0, 0, 0), n, spacing);
-      62           1 :     auto tf = SimpleGridTurbulence(spectrum, gp);
-      63           1 :         auto grid = tf.getGrid();
-      64             : 
-      65             :         double precision = 1e-7;
-      66           1 :         Vector3f bMean = meanFieldVector(grid);
-      67           1 :         EXPECT_NEAR(0, bMean.x, precision);
-      68           1 :         EXPECT_NEAR(0, bMean.y, precision);
-      69           1 :         EXPECT_NEAR(0, bMean.z, precision);
-      70           2 :         EXPECT_NEAR(1, rmsFieldStrength(grid), precision);
-      71           1 : }
-      72             : 
-      73           2 : TEST(testVectorFieldGrid, Turbulence_seed) {
-      74             :         // Test if seeding produces 2 identical fields
-      75             :         size_t n = 64;
-      76             :         double spacing = 1 * Mpc;
-      77             :         double Brms = 1;
-      78             :         double lMin = 2 * spacing;
-      79             :         double lMax = 8 * spacing;
-      80             :         int seed = 753;
-      81             :         
-      82             :         auto spectrum = SimpleTurbulenceSpectrum(Brms, lMin, lMax);
-      83             : 
-      84             :         auto gp1 = GridProperties(Vector3d(0, 0, 0), n, spacing);
-      85           1 :     auto tf1 = SimpleGridTurbulence(spectrum, gp1,  seed);
-      86             : 
-      87             :         auto gp2 = GridProperties(Vector3d(0, 0, 0), n, spacing);
-      88           1 :     auto tf2 = SimpleGridTurbulence(spectrum, gp2, seed);
-      89             : 
-      90             :         Vector3d pos(22 * Mpc);
-      91           1 :         EXPECT_FLOAT_EQ(tf1.getField(pos).x, tf2.getField(pos).x);
-      92           1 : }
-      93             : 
-      94             : #ifndef CRPROPA_TESTS_SKIP_EXCEPTIONS
-      95           2 : TEST(testVectorFieldGrid, turbulence_Exceptions) {
-      96             :         // Test exceptions
-      97             :         size_t n = 64;
-      98             :         double spacing = 10 * Mpc / n;
-      99             :         double brms = 1;
-     100           1 :         ref_ptr<Grid3f> grid = new Grid3f(Vector3d(0, 0, 0), n, spacing);
-     101             : 
-     102             :         // should be fine
-     103           2 :         EXPECT_NO_THROW(initTurbulence(grid, brms, 2 * spacing, 8 * spacing));
-     104             :         // lMin too small
-     105           2 :         EXPECT_THROW(initTurbulence(grid, brms, 1.5 * spacing, 8 * spacing),
-     106             :                         std::runtime_error);
-     107             :         // lMin > lMax
-     108           2 :         EXPECT_THROW(initTurbulence(grid, brms, 8.1 * spacing, 8 * spacing),
-     109             :                         std::runtime_error);
-     110             :         // lMax too large
-     111           2 :         EXPECT_THROW(initTurbulence(grid, brms, 2 * spacing, 65 * spacing),
-     112             :                         std::runtime_error);
-     113           1 : }
-     114             : #endif
-     115             : 
-     116           1 : TEST(testGridTurbulence, Turbulence_seed) {
-     117             :         // Test if seeding produces 2 identical fields
-     118             :         size_t n = 64;
-     119             :         double spacing = 1 * Mpc;
-     120             :         double Brms = 1;
-     121             :         double lMin = 2 * spacing;
-     122             :         double lMax = 8 * spacing;
-     123             :         double lBo = lMax/6;
-     124             :         int seed = 137;
-     125             :         
-     126           1 :         auto spectrum = TurbulenceSpectrum(Brms, lMin, lMax, lBo);
-     127             : 
-     128             :         auto gp1 = GridProperties(Vector3d(0, 0, 0), n, spacing);
-     129           1 :     auto tf1 = GridTurbulence(spectrum, gp1, seed);
-     130             : 
-     131             :         auto gp2 = GridProperties(Vector3d(0, 0, 0), n, spacing);
-     132           1 :     auto tf2 = GridTurbulence(spectrum, gp2, seed);
-     133             : 
-     134             :         Vector3d pos(22 * Mpc);
-     135           1 :         EXPECT_FLOAT_EQ(tf1.getField(pos).x, tf2.getField(pos).x);
-     136           1 : }
-     137             : #endif // CRPROPA_HAVE_FFTW3F
-     138             : 
-     139           1 : int main(int argc, char **argv) {
-     140           1 :         ::testing::InitGoogleTest(&argc, argv);
-     141             :         return RUN_ALL_TESTS();
-     142             : }
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testVector3.cpp.func-sort-c.html b/doc/coverageReport/test/testVector3.cpp.func-sort-c.html deleted file mode 100644 index b7177d48e..000000000 --- a/doc/coverageReport/test/testVector3.cpp.func-sort-c.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testVector3.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testVector3.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:909396.8 %
Date:2024-04-08 14:58:22Functions:121392.3 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa4mainEiPPc0
_ZN7crpropa16Vector3_dot_Test8TestBodyEv1
_ZN7crpropa16Vector3_mod_Test8TestBodyEv1
_ZN7crpropa18Vector3_angle_Test8TestBodyEv1
_ZN7crpropa18Vector3_cross_Test8TestBodyEv1
_ZN7crpropa21Vector3_distance_Test8TestBodyEv1
_ZN7crpropa21Vector3_division_Test8TestBodyEv1
_ZN7crpropa21Vector3_rotation_Test8TestBodyEv1
_ZN7crpropa22Vector3_magnitude_Test8TestBodyEv1
_ZN7crpropa23Vector3_comparison_Test8TestBodyEv1
_ZN7crpropa24Vector3_unitVectors_Test8TestBodyEv1
_ZN7crpropa27Vector3_multiplication_Test8TestBodyEv1
_ZN7crpropa34Vector3_parallelPerpendicular_Test8TestBodyEv1
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testVector3.cpp.func.html b/doc/coverageReport/test/testVector3.cpp.func.html deleted file mode 100644 index f79586ce3..000000000 --- a/doc/coverageReport/test/testVector3.cpp.func.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testVector3.cpp - functions - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testVector3.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:909396.8 %
Date:2024-04-08 14:58:22Functions:121392.3 %
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function Name Sort by function nameHit count Sort by hit count
_ZN7crpropa16Vector3_dot_Test8TestBodyEv1
_ZN7crpropa16Vector3_mod_Test8TestBodyEv1
_ZN7crpropa18Vector3_angle_Test8TestBodyEv1
_ZN7crpropa18Vector3_cross_Test8TestBodyEv1
_ZN7crpropa21Vector3_distance_Test8TestBodyEv1
_ZN7crpropa21Vector3_division_Test8TestBodyEv1
_ZN7crpropa21Vector3_rotation_Test8TestBodyEv1
_ZN7crpropa22Vector3_magnitude_Test8TestBodyEv1
_ZN7crpropa23Vector3_comparison_Test8TestBodyEv1
_ZN7crpropa24Vector3_unitVectors_Test8TestBodyEv1
_ZN7crpropa27Vector3_multiplication_Test8TestBodyEv1
_ZN7crpropa34Vector3_parallelPerpendicular_Test8TestBodyEv1
_ZN7crpropa4mainEiPPc0
-
-
- - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/test/testVector3.cpp.gcov.html b/doc/coverageReport/test/testVector3.cpp.gcov.html deleted file mode 100644 index a1e919522..000000000 --- a/doc/coverageReport/test/testVector3.cpp.gcov.html +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - LCOV - coverage.info.cleaned - test/testVector3.cpp - - - - - - - - - - - - - - -
LCOV - code coverage report
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Current view:top level - test - testVector3.cpp (source / functions)HitTotalCoverage
Test:coverage.info.cleanedLines:909396.8 %
Date:2024-04-08 14:58:22Functions:121392.3 %
-
- - - - - - - - -

-
          Line data    Source code
-
-       1             : #include "crpropa/Vector3.h"
-       2             : #include "gtest/gtest.h"
-       3             : 
-       4             : namespace crpropa {
-       5             : 
-       6           2 : TEST(Vector3, comparison) {
-       7             :         EXPECT_TRUE(Vector3d(1, 2, 3) == Vector3d(1, 2, 3));
-       8             :         EXPECT_FALSE(Vector3d(1, 2, 3) == Vector3d(2, 3, 4));
-       9           1 : }
-      10             : 
-      11           1 : TEST(Vector3, multiplication) {
-      12             :         Vector3d v(1);
-      13             :         v *= 10;
-      14           1 :         EXPECT_DOUBLE_EQ(v.x, 10);
-      15           1 :         EXPECT_DOUBLE_EQ(v.y, 10);
-      16           1 :         EXPECT_DOUBLE_EQ(v.z, 10);
-      17             :         v = Vector3d(1) * Vector3d(2); // element-wise multiplication
-      18           1 :         EXPECT_DOUBLE_EQ(v.x, 2);
-      19           1 :         EXPECT_DOUBLE_EQ(v.y, 2);
-      20           1 :         EXPECT_DOUBLE_EQ(v.z, 2);
-      21           1 : }
-      22             : 
-      23           1 : TEST(Vector3, division) {
-      24             :         Vector3d v(10);
-      25             :         v /= 10;
-      26           1 :         EXPECT_DOUBLE_EQ(v.x, 1);
-      27           1 :         EXPECT_DOUBLE_EQ(v.y, 1);
-      28           1 :         EXPECT_DOUBLE_EQ(v.z, 1);
-      29             :         v = Vector3d(10) / Vector3d(2); // element-wise division
-      30           1 :         EXPECT_DOUBLE_EQ(v.x, 5);
-      31           1 :         EXPECT_DOUBLE_EQ(v.y, 5);
-      32           1 :         EXPECT_DOUBLE_EQ(v.z, 5);
-      33           1 : }
-      34             : 
-      35           2 : TEST(Vector3, mod) {
-      36             :         Vector3d v(10.1, 10.2, 10.3);
-      37           1 :         v %= 10.2;
-      38           1 :         EXPECT_NEAR(v.x, 10.1, 1e-10); // mod doesn't preserve double precision
-      39           1 :         EXPECT_NEAR(v.y, 0, 1e-10);
-      40           1 :         EXPECT_NEAR(v.z, 0.1, 1e-10);
-      41           1 : }
-      42             : 
-      43           1 : TEST(Vector3, dot) {
-      44             :         double a = Vector3d(1, 0, 0).dot(Vector3d(0, 1, 0));
-      45           1 :         EXPECT_DOUBLE_EQ(a, 0);
-      46             :         double b = Vector3d(-1, 10, 2).dot(Vector3d(5, 1, -3));
-      47           1 :         EXPECT_DOUBLE_EQ(b, -1);
-      48           1 : }
-      49             : 
-      50           2 : TEST(Vector3, cross) {
-      51             :         Vector3d v = Vector3d(1, 0, 0).cross(Vector3d(0, 1, 0));
-      52             :         EXPECT_TRUE(v == Vector3d(0, 0, 1));
-      53           1 : }
-      54             : 
-      55           2 : TEST(Vector3, angle) {
-      56             :         // 45 degrees
-      57           1 :         double a = Vector3d(1, 1, 0).getAngleTo(Vector3d(1, 0, 0));
-      58           1 :         EXPECT_DOUBLE_EQ(a, 45 * M_PI / 180);
-      59             :         // perpendicular vectors
-      60           1 :         double b = Vector3d(0, 0, 1).getAngleTo(Vector3d(0, 0, 1));
-      61           1 :         EXPECT_DOUBLE_EQ(b, 0);
-      62           1 : }
-      63             : 
-      64           2 : TEST(Vector3, unitVectors) {
-      65             :         Vector3d v = Vector3d(2, 0, 0);
-      66           1 :         Vector3d er = v.getUnitVector();
-      67           1 :         Vector3d et = v.getUnitVectorTheta();
-      68           1 :         Vector3d ep = v.getUnitVectorPhi();
-      69             : 
-      70             :         // trigonometrical functions don't preserve double precision
-      71             :         double eps = 1e-16;
-      72           1 :         EXPECT_NEAR(er.x, 1, eps);
-      73           1 :         EXPECT_NEAR(er.y, 0, eps);
-      74           1 :         EXPECT_NEAR(er.z, 0, eps);
-      75             : 
-      76           1 :         EXPECT_NEAR(et.x, 0, eps);
-      77           1 :         EXPECT_NEAR(et.y, 0, eps);
-      78           1 :         EXPECT_NEAR(et.z, -1, eps);
-      79             : 
-      80           1 :         EXPECT_NEAR(ep.x, 0, eps);
-      81           1 :         EXPECT_NEAR(ep.y, 1, eps);
-      82           1 :         EXPECT_NEAR(ep.z, 0, eps);
-      83           1 : }
-      84             : 
-      85           1 : TEST(Vector3, magnitude) {
-      86             :         Vector3d v = Vector3d(1, 2, -2);
-      87           1 :         EXPECT_DOUBLE_EQ(v.getR(), 3);
-      88           1 :         EXPECT_DOUBLE_EQ(v.getR2(), 9);
-      89           1 : }
-      90             : 
-      91           2 : TEST(Vector3, distance) {
-      92           1 :         double a = Vector3d(10, 0, 10).getDistanceTo(Vector3d(10, 0, 0));
-      93           1 :         EXPECT_DOUBLE_EQ(a, 10);
-      94           1 : }
-      95             : 
-      96           2 : TEST(Vector3, rotation) {
-      97             :         Vector3d v, w;
-      98             : 
-      99             :         // rotation by 180 degrees
-     100             :         v = Vector3d(10, 0, 0);
-     101           1 :         w = v.getRotated(Vector3d(0, 2, 0), M_PI);
-     102           1 :         EXPECT_NEAR(w.x, -10, 1e-9);
-     103           1 :         EXPECT_NEAR(w.y, 0, 1e-9);
-     104           1 :         EXPECT_NEAR(w.z, 0, 1e-9);
-     105             : 
-     106             :         // rotation axis parallel to vector --> no rotation
-     107             :         v = Vector3d(10, 0, 0);
-     108           1 :         w = v.getRotated(Vector3d(1, 0, 0), M_PI);
-     109           1 :         EXPECT_NEAR(w.x, 10, 1e-9);
-     110           1 :         EXPECT_NEAR(w.y, 0, 1e-9);
-     111           1 :         EXPECT_NEAR(w.z, 0, 1e-9);
-     112             : 
-     113             :         // rotation by 360 degrees
-     114             :         v = Vector3d(5, 2, 7);
-     115           1 :         w = v.getRotated(Vector3d(1, 8, -4), 2 * M_PI);
-     116           1 :         EXPECT_NEAR(w.x, 5, 1e-9);
-     117           1 :         EXPECT_NEAR(w.y, 2, 1e-9);
-     118           1 :         EXPECT_NEAR(w.z, 7, 1e-9);
-     119             : 
-     120             :         // rotation by zero degrees
-     121             :         v = Vector3d(1, 0, 0);
-     122           1 :         w = v.getRotated(Vector3d(0,1,0), 0);
-     123             : 
-     124           1 :         EXPECT_NEAR(w.x, 1, 1e-9);
-     125           1 :         EXPECT_NEAR(w.y, 0, 1e-9);
-     126           1 :         EXPECT_NEAR(w.z, 0, 1e-9);
-     127             : 
-     128             :         // rotation around zero axis
-     129             :         v = Vector3d(1, 0, 0);
-     130             :         Vector3d a = v.cross(v);
-     131           1 :         w = v.getRotated(a, 0);
-     132             : 
-     133           1 :         EXPECT_NEAR(w.x, 1, 1e-9);
-     134           1 :         EXPECT_NEAR(w.y, 0, 1e-9);
-     135           1 :         EXPECT_NEAR(w.z, 0, 1e-9);
-     136             : 
-     137             : 
-     138             : 
-     139             : 
-     140           1 : }
-     141             : 
-     142           2 : TEST(Vector3, parallelPerpendicular) {
-     143             :         Vector3d v(3, 2, 1);
-     144             :         Vector3d w(0, 1, 0);
-     145             : 
-     146           1 :         Vector3d vpara = v.getParallelTo(w);
-     147           1 :         Vector3d vperp = v.getPerpendicularTo(w);
-     148             : 
-     149           1 :         EXPECT_DOUBLE_EQ(vpara.x, 0);
-     150           1 :         EXPECT_DOUBLE_EQ(vpara.y, 2);
-     151           1 :         EXPECT_DOUBLE_EQ(vpara.z, 0);
-     152           1 :         EXPECT_DOUBLE_EQ(vperp.x, 3);
-     153           1 :         EXPECT_DOUBLE_EQ(vperp.y, 0);
-     154           1 :         EXPECT_DOUBLE_EQ(vperp.z, 1);
-     155           1 : }
-     156             : 
-     157           0 : int main(int argc, char **argv) {
-     158           0 :         ::testing::InitGoogleTest(&argc, argv);
-     159           0 :         return RUN_ALL_TESTS();
-     160             : }
-     161             : 
-     162             : } // namespace crpropa
-
-
-
- - - - -
Generated by: LCOV version 1.14
-
- - - diff --git a/doc/coverageReport/updown.png b/doc/coverageReport/updown.png deleted file mode 100644 index aa56a238b3e6c435265250f9266cd1b8caba0f20..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 117 zcmeAS@N?(olHy`uVBq!ia0vp^AT}Qd8;}%R+`Ae`*?77*hG?8mPH5^{)z4*}Q$iB}huR`+ diff --git a/doc/index.rst b/doc/index.rst index a123374e6..f398dca5b 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -43,10 +43,8 @@ Contents .. toctree:: :caption: DEVEL - :maxdepth: 1 + :maxdepth: 2 pages/Debugging.md pages/Code-Coverage.md pages/Data-files.md - - diff --git a/doc/pages/Code-Coverage.md b/doc/pages/Code-Coverage.md index a70872b04..8621353a5 100644 --- a/doc/pages/Code-Coverage.md +++ b/doc/pages/Code-Coverage.md @@ -17,9 +17,5 @@ make coverage ``` The final report is in ```~/build/coverageReport/index.html``` - -### Code Coverage for the current master version -The report for the current master branch version can be found here. - -.. toctree:: - conerageReport/index.html \ No newline at end of file +### coverage report of the current master branch +The coverage report of the current master branch can be accesed `by clicking here `_ now. \ No newline at end of file From bf9ed4c433105cd6be7b85576697abac57868150 Mon Sep 17 00:00:00 2001 From: Julien Date: Wed, 17 Apr 2024 11:38:19 +0200 Subject: [PATCH 3/7] add individual workfolows for documentation and coverage report --- .github/workflows/create_coverage_report.yml | 59 ++++++++++++++++++++ .github/workflows/create_documentation.yml | 4 +- 2 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/create_coverage_report.yml diff --git a/.github/workflows/create_coverage_report.yml b/.github/workflows/create_coverage_report.yml new file mode 100644 index 000000000..0a24a5080 --- /dev/null +++ b/.github/workflows/create_coverage_report.yml @@ -0,0 +1,59 @@ +name: create-coverage-report +on: [workflow_dispatch] + +jobs: + create-coverage-report: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + config: + - name: "ubuntu-22" + os: ubuntu-22.04 + cxx: "g++-11" + cc: "gcc-11" + fc: "gfortran-11" + swig_builtin: "On" #uses swig 4.0.2 + py: "/usr/bin/python3" #python 3.10 + # define steps to take + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Prerequirements + run: | + sudo apt-get update + sudo apt-get install libmuparser-dev libhdf5-serial-dev libomp5 libomp-dev libfftw3-dev libcfitsio-dev lcov doxygen graphviz + sudo apt-get install pandoc # do not only use pip to install pandoc, see https://stackoverflow.com/questions/62398231/building-docs-fails-due-to-missing-pandoc + pip install -r doc/pages/example_notebooks/requirements.txt # load requirements for notebooks + pip install sphinx sphinx_rtd_theme m2r2 nbsphinx lxml_html_clean breathe pandoc exhale # load requirements for documentation + - name: Set up the build + env: + CXX: ${{ matrix.config.cxx }} + CC: ${{ matrix.config.cc }} + FC: ${{ matrix.config.fc }} + run: | + mkdir build + cd build + cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/.local -DENABLE_PYTHON=True -DPython_EXECUTABLE=${{ matrix.config.py }} -DENABLE_TESTING=On -DENABLE_SWIG_BUILTIN=${{ matrix.config.swig_builtin }} -DSIMD_EXTENSIONS=native -DPython_INSTALL_PACKAGE_DIR=/home/runner/.local/ -DBUILD_DOC=OFF -DENABLE_COVERAGE=On + - name: Build CRPropa + run: | + cd build + make -j + - name: run test + run: | + cd build + make test + continue-on-error: true + - name: coverage report + run: | + cd build + make coverage + tar -zcvf coverage.tar.gz coverageReport + - name: archive documentation + uses: actions/upload-artifact@v4 + with: + name: "coverage" + path: | + build/coverage.tar.gz + \ No newline at end of file diff --git a/.github/workflows/create_documentation.yml b/.github/workflows/create_documentation.yml index 9d8dbc1b7..69f96b279 100644 --- a/.github/workflows/create_documentation.yml +++ b/.github/workflows/create_documentation.yml @@ -50,17 +50,15 @@ jobs: run: | cd build make coverage - tar -zcvf coverage.tar.gz coverageReport - name: build documentation run: | cd build make doc cp -r coverageReport doc/pages/coverageReport - tar -zcvf documentation.tar.gz doc + tar -zcvf documentation.tar.gz doc - name: archive documentation uses: actions/upload-artifact@v4 with: name: "documentation" path: | build/documentation.tar.gz - build/coverage.tar.gz From e6c747a111c037701e58f5848c61f11df7e165f8 Mon Sep 17 00:00:00 2001 From: Julien Date: Wed, 17 Apr 2024 12:22:33 +0200 Subject: [PATCH 4/7] fix sphinx version 7.2.6 --- .github/workflows/create_documentation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create_documentation.yml b/.github/workflows/create_documentation.yml index 69f96b279..0556e6d9a 100644 --- a/.github/workflows/create_documentation.yml +++ b/.github/workflows/create_documentation.yml @@ -27,7 +27,7 @@ jobs: sudo apt-get install libmuparser-dev libhdf5-serial-dev libomp5 libomp-dev libfftw3-dev libcfitsio-dev lcov doxygen graphviz sudo apt-get install pandoc # do not only use pip to install pandoc, see https://stackoverflow.com/questions/62398231/building-docs-fails-due-to-missing-pandoc pip install -r doc/pages/example_notebooks/requirements.txt # load requirements for notebooks - pip install sphinx sphinx_rtd_theme m2r2 nbsphinx lxml_html_clean breathe pandoc exhale # load requirements for documentation + pip install sphinx==7.2.6 sphinx_rtd_theme m2r2 nbsphinx lxml_html_clean breathe pandoc exhale # load requirements for documentation - name: Set up the build env: CXX: ${{ matrix.config.cxx }} From baa586b3c7516ce2a9f86af0047e35016fb876bf Mon Sep 17 00:00:00 2001 From: Julien Date: Wed, 17 Apr 2024 12:33:54 +0200 Subject: [PATCH 5/7] add workflow for deployment of documentation --- .github/workflows/create_coverage_report.yml | 2 +- .../workflows/deploy_new_documentation.yml | 65 +++++++++++++++++++ .gitignore | 2 + 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deploy_new_documentation.yml diff --git a/.github/workflows/create_coverage_report.yml b/.github/workflows/create_coverage_report.yml index 0a24a5080..37653ff29 100644 --- a/.github/workflows/create_coverage_report.yml +++ b/.github/workflows/create_coverage_report.yml @@ -26,7 +26,7 @@ jobs: sudo apt-get install libmuparser-dev libhdf5-serial-dev libomp5 libomp-dev libfftw3-dev libcfitsio-dev lcov doxygen graphviz sudo apt-get install pandoc # do not only use pip to install pandoc, see https://stackoverflow.com/questions/62398231/building-docs-fails-due-to-missing-pandoc pip install -r doc/pages/example_notebooks/requirements.txt # load requirements for notebooks - pip install sphinx sphinx_rtd_theme m2r2 nbsphinx lxml_html_clean breathe pandoc exhale # load requirements for documentation + pip install sphinx==7.2.6 sphinx_rtd_theme m2r2 nbsphinx lxml_html_clean breathe pandoc exhale # load requirements for documentation - name: Set up the build env: CXX: ${{ matrix.config.cxx }} diff --git a/.github/workflows/deploy_new_documentation.yml b/.github/workflows/deploy_new_documentation.yml new file mode 100644 index 000000000..7fc313e0c --- /dev/null +++ b/.github/workflows/deploy_new_documentation.yml @@ -0,0 +1,65 @@ +name: deploy-documentation +on: [workflow_dispatch] + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + config: + - name: "ubuntu-22" + os: ubuntu-22.04 + cxx: "g++-11" + cc: "gcc-11" + fc: "gfortran-11" + swig_builtin: "On" #uses swig 4.0.2 + py: "/usr/bin/python3" #python 3.10 + + # define steps to take + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Prerequirements + run: | + sudo apt-get update + sudo apt-get install libmuparser-dev libhdf5-serial-dev libomp5 libomp-dev libfftw3-dev libcfitsio-dev lcov doxygen graphviz + sudo apt-get install pandoc # do not only use pip to install pandoc, see https://stackoverflow.com/questions/62398231/building-docs-fails-due-to-missing-pandoc + pip install -r doc/pages/example_notebooks/requirements.txt # load requirements for notebooks + pip install sphinx==7.2.6 sphinx_rtd_theme m2r2 nbsphinx lxml_html_clean breathe pandoc exhale # load requirements for documentation + - name: Set up the build + env: + CXX: ${{ matrix.config.cxx }} + CC: ${{ matrix.config.cc }} + FC: ${{ matrix.config.fc }} + run: | + mkdir build + cd build + cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/.local -DENABLE_PYTHON=True -DPython_EXECUTABLE=${{ matrix.config.py }} -DENABLE_TESTING=On -DENABLE_SWIG_BUILTIN=${{ matrix.config.swig_builtin }} -DSIMD_EXTENSIONS=native -DPython_INSTALL_PACKAGE_DIR=/home/runner/.local/ -DBUILD_DOC=On -DENABLE_COVERAGE=On + - name: Build CRPropa + run: | + cd build + make -j + - name: run test + run: | + cd build + make test + continue-on-error: true + - name: coverage report + run: | + cd build + make coverage + - name: build documentation + run: | + cd build + make doc + - name: move final documentation # to avoid conflict with .gitignore + run: | + mv build/doc ~/final_doc + cp -r build/coverageReport ~/final_doc/pages/coverageReport + - name: deploy documentation #deploys the documentation to the gh-pages branch + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: ~/final_doc + diff --git a/.gitignore b/.gitignore index edc79bc75..75599931a 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,8 @@ lib/ share/ doc/api/ +!final_doc/ # needed for deployment of the documentation + cmake/CMakeCache.txt cmake/CMakeFiles/ From 5306f96829c7852190dca8dfee1e6f2ca5835fec Mon Sep 17 00:00:00 2001 From: Julien Date: Wed, 17 Apr 2024 14:17:36 +0200 Subject: [PATCH 6/7] perform documentation deploy on push to master --- .github/workflows/deploy_new_documentation.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy_new_documentation.yml b/.github/workflows/deploy_new_documentation.yml index 7fc313e0c..70783f060 100644 --- a/.github/workflows/deploy_new_documentation.yml +++ b/.github/workflows/deploy_new_documentation.yml @@ -1,5 +1,9 @@ name: deploy-documentation -on: [workflow_dispatch] +on: + push: + branches: + - main + - 'releases/**' jobs: build-and-deploy: From 7d4d84d6957f1d5937cd76494ec9076c3ff5c0ab Mon Sep 17 00:00:00 2001 From: Lukas Merten Date: Mon, 3 Jun 2024 13:11:26 +0200 Subject: [PATCH 7/7] Fixed typo --- doc/pages/Code-Coverage.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/pages/Code-Coverage.md b/doc/pages/Code-Coverage.md index 8621353a5..4ea6e2dac 100644 --- a/doc/pages/Code-Coverage.md +++ b/doc/pages/Code-Coverage.md @@ -17,5 +17,5 @@ make coverage ``` The final report is in ```~/build/coverageReport/index.html``` -### coverage report of the current master branch -The coverage report of the current master branch can be accesed `by clicking here `_ now. \ No newline at end of file +### Coverage report of the current master branch +The coverage report of the current master branch can be accesed `by clicking here `_ now.