function new_flux_surface_type(geoType, Rmaj, R_geo, r, dr, aSurf, &
sHorz, sVert, delm, deln, delmp, delnp, thm, thn, q, shat, nt, mMode, nMode, &
n_mxh, c_mxh, s_mxh, dc_mxh_dr, ds_mxh_dr) result(self)
use optionals, only: get_option_with_default
type(flux_surface_type) :: self
integer, intent(in) :: geoType
real, intent(in), optional :: Rmaj, R_geo, r, dr, aSurf, sHorz, sVert, delm, deln, delmp, delnp, thm, thn, q, shat
integer, intent(in), optional :: nt, mMode, nMode, n_mxh
real, intent(in), optional, dimension(mxh_max_moments) :: c_mxh, dc_mxh_dr
real, intent(in), optional, dimension(mxh_max_moments) :: s_mxh, ds_mxh_dr
real, dimension(mxh_max_moments) :: mxh_defaults
real, parameter :: invalid_value = -999.99
integer, parameter :: invalid_int = -999
mxh_defaults = invalid_value
self%geoType = geoType
self%Rmaj = get_option_with_default(Rmaj, invalid_value)
self%R_geo = get_option_with_default(R_geo, invalid_value)
self%r = get_option_with_default(r, invalid_value)
self%dr = get_option_with_default(dr, invalid_value)
self%aSurf = get_option_with_default(aSurf, invalid_value)
self%sHorz = get_option_with_default(sHorz, invalid_value)
self%sVert = get_option_with_default(sVert, invalid_value)
self%delm = get_option_with_default(delm, invalid_value)
self%deln = get_option_with_default(deln, invalid_value)
self%delmp = get_option_with_default(delmp, invalid_value)
self%delnp = get_option_with_default(delnp, invalid_value)
self%thm = get_option_with_default(thm, invalid_value)
self%thn = get_option_with_default(thn, invalid_value)
self%q = get_option_with_default(q, invalid_value)
self%shat = get_option_with_default(shat, invalid_value)
self%nt = get_option_with_default(nt, invalid_int)
self%mMode = get_option_with_default(mMode, invalid_int)
self%nMode = get_option_with_default(nMode, invalid_int)
self%n_mxh = get_option_with_default(n_mxh, invalid_int)
self%c_mxh = get_option_with_default(c_mxh, mxh_defaults)
self%s_mxh = get_option_with_default(s_mxh, mxh_defaults)
self%dc_mxh_dr = get_option_with_default(dc_mxh_dr, mxh_defaults)
self%ds_mxh_dr = get_option_with_default(ds_mxh_dr, mxh_defaults)
end function new_flux_surface_type