GCC Code Coverage Report


Directory: ./
File: src/coordinates/reference_coordinates.f90
Date: 2026-10-22 05:02:02
Coverage Exec Excl Total
Lines: 50.0% 14 0 28
Functions: 100.0% 1 0 1
Branches: 50.0% 13 0 26

Line Branch Exec Source
1 module reference_coordinates
2
3 use, intrinsic :: iso_fortran_env, only: dp => real64
4 use field_boozer_chartmap, only: is_boozer_chartmap
5 use libneo_coordinates, only: coordinate_system_t, make_vmec_coordinate_system, &
6 make_chartmap_coordinate_system, detect_refcoords_file_type, &
7 refcoords_file_chartmap, refcoords_file_vmec_wout, refcoords_file_unknown
8 use new_vmec_stuff_mod, only: vmec_RZ_scale
9 use scaled_chartmap_coordinates, only: wrap_scaled_chartmap_coordinate_system
10
11 implicit none
12
13 class(coordinate_system_t), allocatable, public :: ref_coords
14
15 contains
16
17 74 subroutine init_reference_coordinates(coord_input)
18 character(*), intent(in) :: coord_input
19
20 integer :: file_type, ierr
21 character(len=2048) :: message
22
23
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 74 times.
74 if (len_trim(coord_input) == 0) then
24 ✗ print *, 'reference_coordinates.init_reference_coordinates: ', &
25 ✗ 'coord_input must be set (see params.apply_config_aliases)'
26 ✗ error stop
27 end if
28
29
4/4
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 70 times.
✓ Branch 2 taken 1 time.
✓ Branch 3 taken 3 times.
75 if (allocated(ref_coords)) deallocate (ref_coords)
30
31
2/2
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 66 times.
74 if (is_boozer_chartmap(coord_input)) then
32
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
8 call make_chartmap_coordinate_system(ref_coords, coord_input)
33 8 call wrap_scaled_chartmap_coordinate_system(ref_coords, vmec_RZ_scale)
34 else
35 66 call detect_refcoords_file_type(coord_input, file_type, ierr, message)
36
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 66 times.
66 if (ierr /= 0) then
37 ✗ print *, 'reference_coordinates.init_reference_coordinates: ', &
38 ✗ 'file detection error for ', trim(coord_input)
39 ✗ print *, trim(message)
40 ✗ error stop
41 end if
42
43 3 select case (file_type)
44 case (refcoords_file_chartmap)
45
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
3 call make_chartmap_coordinate_system(ref_coords, coord_input)
46 3 call wrap_scaled_chartmap_coordinate_system(ref_coords, vmec_RZ_scale)
47 case (refcoords_file_vmec_wout)
48
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 63 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
63 call make_vmec_coordinate_system(ref_coords)
49 case (refcoords_file_unknown)
50 ✗ print *, 'reference_coordinates.init_reference_coordinates: ', &
51 ✗ 'unknown file type for ', trim(coord_input)
52 ✗ print *, 'Expected VMEC wout (*.nc with rmnc) or chartmap (*.nc with ', &
53 ✗ 'rho/theta/zeta dims and x/y/z vars)'
54 ✗ error stop
55 case default
56 ✗ print *, 'reference_coordinates.init_reference_coordinates: ', &
57 ✗ 'unexpected file_type ', file_type
58
2/4
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 63 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
132 error stop
59 end select
60 end if
61 74 end subroutine init_reference_coordinates
62
63 end module reference_coordinates
64