LCOV - code coverage report
Current view: top level - src/magneticField - MagneticFieldGrid.cpp (source / functions) Hit Total Coverage
Test: coverage.info.cleaned Lines: 0 31 0.0 %
Date: 2024-04-29 14:43:01 Functions: 0 11 0.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