diff --git a/.gitignore b/.gitignore index 832a64a..0253c3d 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ sbin/Cscale_field *.o *.mod make/Mk_cmd +julia/lib/*.so # Outputs spectraltools/output diff --git a/julia/gen/StrAer_C.f90 b/julia/gen/StrAer_C.f90 deleted file mode 100644 index 9f96677..0000000 --- a/julia/gen/StrAer_C.f90 +++ /dev/null @@ -1,300 +0,0 @@ -! Autogenerated from Fortran file src/radiance_core/def_aer.F90 -! svn revision 1226 - -module StrAer_C - -use, intrinsic :: iso_c_binding - -use UTILITIES_CF -use def_aer - -implicit none - -private - -contains - - function create_StrAer() result(aer_Cptr) & - bind(C, NAME='PS_create_StrAer') - - implicit none - type(c_ptr) :: aer_Cptr - - TYPE(StrAer), pointer :: aer - - ALLOCATE(aer) - - aer_Cptr = c_loc(aer) - end function create_StrAer - - subroutine delete_StrAer(aer_Cptr) & - bind(C, NAME='PS_delete_StrAer') - - implicit none - type(c_ptr), value, intent(in) :: aer_Cptr - - TYPE(StrAer), pointer :: aer - - call C_F_POINTER(aer_Cptr, aer) - - DEALLOCATE(aer) - - end subroutine delete_StrAer - - function StrAer_get_integer(aer_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrAer_get_integer') - - implicit none - type(c_ptr), value, intent(in) :: aer_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), intent(out) :: val - - ! local variables - TYPE(StrAer), pointer :: aer - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(aer_Cptr, aer) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'n_mode') then - val = aer%n_mode - else - field_OK = .FALSE. - end if - - end function StrAer_get_integer - - function StrAer_set_integer(aer_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrAer_set_integer') - - implicit none - type(c_ptr), value, intent(in) :: aer_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), value, intent(in) :: val - - ! local variables - TYPE(StrAer), pointer :: aer - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(aer_Cptr, aer) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'n_mode') then - aer%n_mode = val - else - field_OK = .FALSE. - end if - - end function StrAer_set_integer - - function StrAer_get_integer_array(aer_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrAer_get_integer_array') - - implicit none - type(c_ptr), value, intent(in) :: aer_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrAer), pointer :: aer - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(aer_Cptr, aer) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'mr_type_index') then - if (allocated(aer%mr_type_index)) then - loc = C_LOC(aer%mr_type_index) - ndim = size(shape(aer%mr_type_index)) - dims(1:ndim) = shape(aer%mr_type_index) - lbounds(1:ndim) = lbound(aer%mr_type_index) - else - loc = C_NULL_PTR - end if - - else if (field == 'mr_source') then - if (allocated(aer%mr_source)) then - loc = C_LOC(aer%mr_source) - ndim = size(shape(aer%mr_source)) - dims(1:ndim) = shape(aer%mr_source) - lbounds(1:ndim) = lbound(aer%mr_source) - else - loc = C_NULL_PTR - end if - - else if (field == 'n_opt_level_prsc') then - if (allocated(aer%n_opt_level_prsc)) then - loc = C_LOC(aer%n_opt_level_prsc) - ndim = size(shape(aer%n_opt_level_prsc)) - dims(1:ndim) = shape(aer%n_opt_level_prsc) - lbounds(1:ndim) = lbound(aer%n_opt_level_prsc) - else - loc = C_NULL_PTR - end if - - else if (field == 'n_phase_term_prsc') then - if (allocated(aer%n_phase_term_prsc)) then - loc = C_LOC(aer%n_phase_term_prsc) - ndim = size(shape(aer%n_phase_term_prsc)) - dims(1:ndim) = shape(aer%n_phase_term_prsc) - lbounds(1:ndim) = lbound(aer%n_phase_term_prsc) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrAer_get_integer_array - - function StrAer_get_real_array(aer_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrAer_get_real_array') - - implicit none - type(c_ptr), value, intent(in) :: aer_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrAer), pointer :: aer - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(aer_Cptr, aer) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'mix_ratio') then - if (allocated(aer%mix_ratio)) then - loc = C_LOC(aer%mix_ratio) - ndim = size(shape(aer%mix_ratio)) - dims(1:ndim) = shape(aer%mix_ratio) - lbounds(1:ndim) = lbound(aer%mix_ratio) - else - loc = C_NULL_PTR - end if - - else if (field == 'mean_rel_humidity') then - if (allocated(aer%mean_rel_humidity)) then - loc = C_LOC(aer%mean_rel_humidity) - ndim = size(shape(aer%mean_rel_humidity)) - dims(1:ndim) = shape(aer%mean_rel_humidity) - lbounds(1:ndim) = lbound(aer%mean_rel_humidity) - else - loc = C_NULL_PTR - end if - - else if (field == 'mode_mix_ratio') then - if (allocated(aer%mode_mix_ratio)) then - loc = C_LOC(aer%mode_mix_ratio) - ndim = size(shape(aer%mode_mix_ratio)) - dims(1:ndim) = shape(aer%mode_mix_ratio) - lbounds(1:ndim) = lbound(aer%mode_mix_ratio) - else - loc = C_NULL_PTR - end if - - else if (field == 'mode_absorption') then - if (allocated(aer%mode_absorption)) then - loc = C_LOC(aer%mode_absorption) - ndim = size(shape(aer%mode_absorption)) - dims(1:ndim) = shape(aer%mode_absorption) - lbounds(1:ndim) = lbound(aer%mode_absorption) - else - loc = C_NULL_PTR - end if - - else if (field == 'mode_scattering') then - if (allocated(aer%mode_scattering)) then - loc = C_LOC(aer%mode_scattering) - ndim = size(shape(aer%mode_scattering)) - dims(1:ndim) = shape(aer%mode_scattering) - lbounds(1:ndim) = lbound(aer%mode_scattering) - else - loc = C_NULL_PTR - end if - - else if (field == 'mode_asymmetry') then - if (allocated(aer%mode_asymmetry)) then - loc = C_LOC(aer%mode_asymmetry) - ndim = size(shape(aer%mode_asymmetry)) - dims(1:ndim) = shape(aer%mode_asymmetry) - lbounds(1:ndim) = lbound(aer%mode_asymmetry) - else - loc = C_NULL_PTR - end if - - else if (field == 'pressure_prsc') then - if (allocated(aer%pressure_prsc)) then - loc = C_LOC(aer%pressure_prsc) - ndim = size(shape(aer%pressure_prsc)) - dims(1:ndim) = shape(aer%pressure_prsc) - lbounds(1:ndim) = lbound(aer%pressure_prsc) - else - loc = C_NULL_PTR - end if - - else if (field == 'absorption_prsc') then - if (allocated(aer%absorption_prsc)) then - loc = C_LOC(aer%absorption_prsc) - ndim = size(shape(aer%absorption_prsc)) - dims(1:ndim) = shape(aer%absorption_prsc) - lbounds(1:ndim) = lbound(aer%absorption_prsc) - else - loc = C_NULL_PTR - end if - - else if (field == 'scattering_prsc') then - if (allocated(aer%scattering_prsc)) then - loc = C_LOC(aer%scattering_prsc) - ndim = size(shape(aer%scattering_prsc)) - dims(1:ndim) = shape(aer%scattering_prsc) - lbounds(1:ndim) = lbound(aer%scattering_prsc) - else - loc = C_NULL_PTR - end if - - else if (field == 'phase_fnc_prsc') then - if (allocated(aer%phase_fnc_prsc)) then - loc = C_LOC(aer%phase_fnc_prsc) - ndim = size(shape(aer%phase_fnc_prsc)) - dims(1:ndim) = shape(aer%phase_fnc_prsc) - lbounds(1:ndim) = lbound(aer%phase_fnc_prsc) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrAer_get_real_array - -end module StrAer_C diff --git a/julia/gen/StrAer_JL.jl b/julia/gen/StrAer_JL.jl deleted file mode 100644 index 68fd7e8..0000000 --- a/julia/gen/StrAer_JL.jl +++ /dev/null @@ -1,162 +0,0 @@ -# Autogenerated from src/radiance_core/def_aer.F90 -# svn revision 1226 - - - mutable struct StrAer - cptr::Ptr{Cvoid} - - function StrAer() - handle = new(ccall((:PS_create_StrAer, libSOCRATES_C), Ptr{Cvoid}, ())) - finalizer(delete_StrAer, handle) - return handle - end - end - - function delete_StrAer(handle::StrAer) - if getfield(handle, :cptr) == Ptr{Cvoid}() - ccall(:jl_safe_printf, Cvoid, (Cstring, ), "error: delete_StrAer attempt to delete null pointer") - else - ccall((:PS_delete_StrAer, libSOCRATES_C), Cvoid, (Ptr{Cvoid},), getfield(handle, :cptr)) - setfield!(handle, :cptr, Ptr{Cvoid}()) - end - return nothing - end - - - # this is used to show values in the REPL and when using IJulia - function Base.show(io::IO, m::MIME"text/plain", handle::StrAer) - println(io, handle) - dump_properties(io, handle) - end - - - function Base.propertynames(handle::StrAer, private::Bool=false) - names = [ - :mr_type_index, - :mr_source, - :mix_ratio, - :mean_rel_humidity, - :n_mode, - :mode_mix_ratio, - :mode_absorption, - :mode_scattering, - :mode_asymmetry, - :n_opt_level_prsc, - :n_phase_term_prsc, - :pressure_prsc, - :absorption_prsc, - :scattering_prsc, - :phase_fnc_prsc, - ] - - return names - end - - - function Base.getproperty(handle::StrAer, field::Symbol) - - - cptr = getfield(handle, :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - - if field == :cptr - return cptr - - elseif field in ( - :n_mode, - ) - val = Ref{Cint}() - field_ok = ccall( - (:PS_StrAer_get_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Cint}), - cptr, String(field), val - ) - Bool(field_ok) || error("StrAer integer field $field not present - coding error") - return val[] - elseif field in ( - :mr_type_index, - :mr_source, - :n_opt_level_prsc, - :n_phase_term_prsc, - ) - loc = Ref{Ptr{Cint}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrAer_get_integer_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cint}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrAer Cint array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - elseif field in ( - :mix_ratio, - :mean_rel_humidity, - :mode_mix_ratio, - :mode_absorption, - :mode_scattering, - :mode_asymmetry, - :pressure_prsc, - :absorption_prsc, - :scattering_prsc, - :phase_fnc_prsc, - ) - loc = Ref{Ptr{Cdouble}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrAer_get_real_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cdouble}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrAer Cdouble array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - else - return getfield(handle, field) - end - - end - - - function Base.setproperty!(handle::StrAer, field::Symbol, val) - - - cptr = getfield(handle, :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :n_mode, - ) - - field_ok = ccall( - (:PS_StrAer_set_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Cint), - cptr, String(field), val - ) - Bool(field_ok) || error("StrAer integer field $field not present - coding error") - return val - else - error("type StrAer has no writeable field $field") - end - - end - diff --git a/julia/gen/StrAtm_C.f90 b/julia/gen/StrAtm_C.f90 deleted file mode 100644 index 51ca4eb..0000000 --- a/julia/gen/StrAtm_C.f90 +++ /dev/null @@ -1,271 +0,0 @@ -! Autogenerated from Fortran file src/radiance_core/def_atm.F90 -! svn revision 1226 - -module StrAtm_C - -use, intrinsic :: iso_c_binding - -use UTILITIES_CF -use def_atm - -implicit none - -private - -contains - - function create_StrAtm() result(atm_Cptr) & - bind(C, NAME='PS_create_StrAtm') - - implicit none - type(c_ptr) :: atm_Cptr - - TYPE(StrAtm), pointer :: atm - - ALLOCATE(atm) - - atm_Cptr = c_loc(atm) - end function create_StrAtm - - subroutine delete_StrAtm(atm_Cptr) & - bind(C, NAME='PS_delete_StrAtm') - - implicit none - type(c_ptr), value, intent(in) :: atm_Cptr - - TYPE(StrAtm), pointer :: atm - - call C_F_POINTER(atm_Cptr, atm) - - DEALLOCATE(atm) - - end subroutine delete_StrAtm - - function StrAtm_get_integer(atm_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrAtm_get_integer') - - implicit none - type(c_ptr), value, intent(in) :: atm_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), intent(out) :: val - - ! local variables - TYPE(StrAtm), pointer :: atm - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(atm_Cptr, atm) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'n_profile') then - val = atm%n_profile - else if (field == 'n_layer') then - val = atm%n_layer - else if (field == 'n_direction') then - val = atm%n_direction - else if (field == 'n_viewing_level') then - val = atm%n_viewing_level - else - field_OK = .FALSE. - end if - - end function StrAtm_get_integer - - function StrAtm_set_integer(atm_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrAtm_set_integer') - - implicit none - type(c_ptr), value, intent(in) :: atm_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), value, intent(in) :: val - - ! local variables - TYPE(StrAtm), pointer :: atm - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(atm_Cptr, atm) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'n_profile') then - atm%n_profile = val - else if (field == 'n_layer') then - atm%n_layer = val - else if (field == 'n_direction') then - atm%n_direction = val - else if (field == 'n_viewing_level') then - atm%n_viewing_level = val - else - field_OK = .FALSE. - end if - - end function StrAtm_set_integer - - function StrAtm_get_real_array(atm_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrAtm_get_real_array') - - implicit none - type(c_ptr), value, intent(in) :: atm_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrAtm), pointer :: atm - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(atm_Cptr, atm) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'lon') then - if (allocated(atm%lon)) then - loc = C_LOC(atm%lon) - ndim = size(shape(atm%lon)) - dims(1:ndim) = shape(atm%lon) - lbounds(1:ndim) = lbound(atm%lon) - else - loc = C_NULL_PTR - end if - - else if (field == 'lat') then - if (allocated(atm%lat)) then - loc = C_LOC(atm%lat) - ndim = size(shape(atm%lat)) - dims(1:ndim) = shape(atm%lat) - lbounds(1:ndim) = lbound(atm%lat) - else - loc = C_NULL_PTR - end if - - else if (field == 'direction') then - if (allocated(atm%direction)) then - loc = C_LOC(atm%direction) - ndim = size(shape(atm%direction)) - dims(1:ndim) = shape(atm%direction) - lbounds(1:ndim) = lbound(atm%direction) - else - loc = C_NULL_PTR - end if - - else if (field == 'viewing_level') then - if (allocated(atm%viewing_level)) then - loc = C_LOC(atm%viewing_level) - ndim = size(shape(atm%viewing_level)) - dims(1:ndim) = shape(atm%viewing_level) - lbounds(1:ndim) = lbound(atm%viewing_level) - else - loc = C_NULL_PTR - end if - - else if (field == 'mass') then - if (allocated(atm%mass)) then - loc = C_LOC(atm%mass) - ndim = size(shape(atm%mass)) - dims(1:ndim) = shape(atm%mass) - lbounds(1:ndim) = lbound(atm%mass) - else - loc = C_NULL_PTR - end if - - else if (field == 'density') then - if (allocated(atm%density)) then - loc = C_LOC(atm%density) - ndim = size(shape(atm%density)) - dims(1:ndim) = shape(atm%density) - lbounds(1:ndim) = lbound(atm%density) - else - loc = C_NULL_PTR - end if - - else if (field == 'p') then - if (allocated(atm%p)) then - loc = C_LOC(atm%p) - ndim = size(shape(atm%p)) - dims(1:ndim) = shape(atm%p) - lbounds(1:ndim) = lbound(atm%p) - else - loc = C_NULL_PTR - end if - - else if (field == 'p_level') then - if (allocated(atm%p_level)) then - loc = C_LOC(atm%p_level) - ndim = size(shape(atm%p_level)) - dims(1:ndim) = shape(atm%p_level) - lbounds(1:ndim) = lbound(atm%p_level) - else - loc = C_NULL_PTR - end if - - else if (field == 't') then - if (allocated(atm%t)) then - loc = C_LOC(atm%t) - ndim = size(shape(atm%t)) - dims(1:ndim) = shape(atm%t) - lbounds(1:ndim) = lbound(atm%t) - else - loc = C_NULL_PTR - end if - - else if (field == 't_level') then - if (allocated(atm%t_level)) then - loc = C_LOC(atm%t_level) - ndim = size(shape(atm%t_level)) - dims(1:ndim) = shape(atm%t_level) - lbounds(1:ndim) = lbound(atm%t_level) - else - loc = C_NULL_PTR - end if - - else if (field == 'r_layer') then - if (allocated(atm%r_layer)) then - loc = C_LOC(atm%r_layer) - ndim = size(shape(atm%r_layer)) - dims(1:ndim) = shape(atm%r_layer) - lbounds(1:ndim) = lbound(atm%r_layer) - else - loc = C_NULL_PTR - end if - - else if (field == 'r_level') then - if (allocated(atm%r_level)) then - loc = C_LOC(atm%r_level) - ndim = size(shape(atm%r_level)) - dims(1:ndim) = shape(atm%r_level) - lbounds(1:ndim) = lbound(atm%r_level) - else - loc = C_NULL_PTR - end if - - else if (field == 'gas_mix_ratio') then - if (allocated(atm%gas_mix_ratio)) then - loc = C_LOC(atm%gas_mix_ratio) - ndim = size(shape(atm%gas_mix_ratio)) - dims(1:ndim) = shape(atm%gas_mix_ratio) - lbounds(1:ndim) = lbound(atm%gas_mix_ratio) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrAtm_get_real_array - -end module StrAtm_C diff --git a/julia/gen/StrAtm_JL.jl b/julia/gen/StrAtm_JL.jl deleted file mode 100644 index b552111..0000000 --- a/julia/gen/StrAtm_JL.jl +++ /dev/null @@ -1,149 +0,0 @@ -# Autogenerated from src/radiance_core/def_atm.F90 -# svn revision 1226 - - - mutable struct StrAtm - cptr::Ptr{Cvoid} - - function StrAtm() - handle = new(ccall((:PS_create_StrAtm, libSOCRATES_C), Ptr{Cvoid}, ())) - finalizer(delete_StrAtm, handle) - return handle - end - end - - function delete_StrAtm(handle::StrAtm) - if getfield(handle, :cptr) == Ptr{Cvoid}() - ccall(:jl_safe_printf, Cvoid, (Cstring, ), "error: delete_StrAtm attempt to delete null pointer") - else - ccall((:PS_delete_StrAtm, libSOCRATES_C), Cvoid, (Ptr{Cvoid},), getfield(handle, :cptr)) - setfield!(handle, :cptr, Ptr{Cvoid}()) - end - return nothing - end - - - # this is used to show values in the REPL and when using IJulia - function Base.show(io::IO, m::MIME"text/plain", handle::StrAtm) - println(io, handle) - dump_properties(io, handle) - end - - - function Base.propertynames(handle::StrAtm, private::Bool=false) - names = [ - :n_profile, - :n_layer, - :lon, - :lat, - :n_direction, - :n_viewing_level, - :direction, - :viewing_level, - :mass, - :density, - :p, - :p_level, - :t, - :t_level, - :r_layer, - :r_level, - :gas_mix_ratio, - ] - - return names - end - - - function Base.getproperty(handle::StrAtm, field::Symbol) - - - cptr = getfield(handle, :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - - if field == :cptr - return cptr - - elseif field in ( - :n_profile, - :n_layer, - :n_direction, - :n_viewing_level, - ) - val = Ref{Cint}() - field_ok = ccall( - (:PS_StrAtm_get_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Cint}), - cptr, String(field), val - ) - Bool(field_ok) || error("StrAtm integer field $field not present - coding error") - return val[] - elseif field in ( - :lon, - :lat, - :direction, - :viewing_level, - :mass, - :density, - :p, - :p_level, - :t, - :t_level, - :r_layer, - :r_level, - :gas_mix_ratio, - ) - loc = Ref{Ptr{Cdouble}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrAtm_get_real_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cdouble}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrAtm Cdouble array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - else - return getfield(handle, field) - end - - end - - - function Base.setproperty!(handle::StrAtm, field::Symbol, val) - - - cptr = getfield(handle, :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :n_profile, - :n_layer, - :n_direction, - :n_viewing_level, - ) - - field_ok = ccall( - (:PS_StrAtm_set_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Cint), - cptr, String(field), val - ) - Bool(field_ok) || error("StrAtm integer field $field not present - coding error") - return val - else - error("type StrAtm has no writeable field $field") - end - - end - diff --git a/julia/gen/StrBound_C.f90 b/julia/gen/StrBound_C.f90 deleted file mode 100644 index f405d91..0000000 --- a/julia/gen/StrBound_C.f90 +++ /dev/null @@ -1,318 +0,0 @@ -! Autogenerated from Fortran file src/radiance_core/def_bound.F90 -! svn revision 1226 - -module StrBound_C - -use, intrinsic :: iso_c_binding - -use UTILITIES_CF -use def_bound - -implicit none - -private - -contains - - function create_StrBound() result(bound_Cptr) & - bind(C, NAME='PS_create_StrBound') - - implicit none - type(c_ptr) :: bound_Cptr - - TYPE(StrBound), pointer :: bound - - ALLOCATE(bound) - - bound_Cptr = c_loc(bound) - end function create_StrBound - - subroutine delete_StrBound(bound_Cptr) & - bind(C, NAME='PS_delete_StrBound') - - implicit none - type(c_ptr), value, intent(in) :: bound_Cptr - - TYPE(StrBound), pointer :: bound - - call C_F_POINTER(bound_Cptr, bound) - - DEALLOCATE(bound) - - end subroutine delete_StrBound - - function StrBound_get_integer(bound_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrBound_get_integer') - - implicit none - type(c_ptr), value, intent(in) :: bound_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), intent(out) :: val - - ! local variables - TYPE(StrBound), pointer :: bound - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(bound_Cptr, bound) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'n_brdf_basis_fnc') then - val = bound%n_brdf_basis_fnc - else if (field == 'n_point_tile') then - val = bound%n_point_tile - else if (field == 'n_tile') then - val = bound%n_tile - else - field_OK = .FALSE. - end if - - end function StrBound_get_integer - - function StrBound_set_integer(bound_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrBound_set_integer') - - implicit none - type(c_ptr), value, intent(in) :: bound_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), value, intent(in) :: val - - ! local variables - TYPE(StrBound), pointer :: bound - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(bound_Cptr, bound) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'n_brdf_basis_fnc') then - bound%n_brdf_basis_fnc = val - else if (field == 'n_point_tile') then - bound%n_point_tile = val - else if (field == 'n_tile') then - bound%n_tile = val - else - field_OK = .FALSE. - end if - - end function StrBound_set_integer - - function StrBound_get_integer_array(bound_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrBound_get_integer_array') - - implicit none - type(c_ptr), value, intent(in) :: bound_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrBound), pointer :: bound - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(bound_Cptr, bound) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'list_tile') then - if (allocated(bound%list_tile)) then - loc = C_LOC(bound%list_tile) - ndim = size(shape(bound%list_tile)) - dims(1:ndim) = shape(bound%list_tile) - lbounds(1:ndim) = lbound(bound%list_tile) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrBound_get_integer_array - - function StrBound_get_real_array(bound_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrBound_get_real_array') - - implicit none - type(c_ptr), value, intent(in) :: bound_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrBound), pointer :: bound - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(bound_Cptr, bound) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'zen_0') then - if (allocated(bound%zen_0)) then - loc = C_LOC(bound%zen_0) - ndim = size(shape(bound%zen_0)) - dims(1:ndim) = shape(bound%zen_0) - lbounds(1:ndim) = lbound(bound%zen_0) - else - loc = C_NULL_PTR - end if - - else if (field == 'azim_0') then - if (allocated(bound%azim_0)) then - loc = C_LOC(bound%azim_0) - ndim = size(shape(bound%azim_0)) - dims(1:ndim) = shape(bound%azim_0) - lbounds(1:ndim) = lbound(bound%azim_0) - else - loc = C_NULL_PTR - end if - - else if (field == 'solar_irrad') then - if (allocated(bound%solar_irrad)) then - loc = C_LOC(bound%solar_irrad) - ndim = size(shape(bound%solar_irrad)) - dims(1:ndim) = shape(bound%solar_irrad) - lbounds(1:ndim) = lbound(bound%solar_irrad) - else - loc = C_NULL_PTR - end if - - else if (field == 'lit') then - if (allocated(bound%lit)) then - loc = C_LOC(bound%lit) - ndim = size(shape(bound%lit)) - dims(1:ndim) = shape(bound%lit) - lbounds(1:ndim) = lbound(bound%lit) - else - loc = C_NULL_PTR - end if - - else if (field == 'cos_zen') then - if (allocated(bound%cos_zen)) then - loc = C_LOC(bound%cos_zen) - ndim = size(shape(bound%cos_zen)) - dims(1:ndim) = shape(bound%cos_zen) - lbounds(1:ndim) = lbound(bound%cos_zen) - else - loc = C_NULL_PTR - end if - - else if (field == 'rho_alb') then - if (allocated(bound%rho_alb)) then - loc = C_LOC(bound%rho_alb) - ndim = size(shape(bound%rho_alb)) - dims(1:ndim) = shape(bound%rho_alb) - lbounds(1:ndim) = lbound(bound%rho_alb) - else - loc = C_NULL_PTR - end if - - else if (field == 'f_brdf') then - if (allocated(bound%f_brdf)) then - loc = C_LOC(bound%f_brdf) - ndim = size(shape(bound%f_brdf)) - dims(1:ndim) = shape(bound%f_brdf) - lbounds(1:ndim) = lbound(bound%f_brdf) - else - loc = C_NULL_PTR - end if - - else if (field == 't_ground') then - if (allocated(bound%t_ground)) then - loc = C_LOC(bound%t_ground) - ndim = size(shape(bound%t_ground)) - dims(1:ndim) = shape(bound%t_ground) - lbounds(1:ndim) = lbound(bound%t_ground) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_ground') then - if (allocated(bound%flux_ground)) then - loc = C_LOC(bound%flux_ground) - ndim = size(shape(bound%flux_ground)) - dims(1:ndim) = shape(bound%flux_ground) - lbounds(1:ndim) = lbound(bound%flux_ground) - else - loc = C_NULL_PTR - end if - - else if (field == 'orog_corr') then - if (allocated(bound%orog_corr)) then - loc = C_LOC(bound%orog_corr) - ndim = size(shape(bound%orog_corr)) - dims(1:ndim) = shape(bound%orog_corr) - lbounds(1:ndim) = lbound(bound%orog_corr) - else - loc = C_NULL_PTR - end if - - else if (field == 'rho_alb_tile') then - if (allocated(bound%rho_alb_tile)) then - loc = C_LOC(bound%rho_alb_tile) - ndim = size(shape(bound%rho_alb_tile)) - dims(1:ndim) = shape(bound%rho_alb_tile) - lbounds(1:ndim) = lbound(bound%rho_alb_tile) - else - loc = C_NULL_PTR - end if - - else if (field == 'frac_tile') then - if (allocated(bound%frac_tile)) then - loc = C_LOC(bound%frac_tile) - ndim = size(shape(bound%frac_tile)) - dims(1:ndim) = shape(bound%frac_tile) - lbounds(1:ndim) = lbound(bound%frac_tile) - else - loc = C_NULL_PTR - end if - - else if (field == 't_tile') then - if (allocated(bound%t_tile)) then - loc = C_LOC(bound%t_tile) - ndim = size(shape(bound%t_tile)) - dims(1:ndim) = shape(bound%t_tile) - lbounds(1:ndim) = lbound(bound%t_tile) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_tile') then - if (allocated(bound%flux_tile)) then - loc = C_LOC(bound%flux_tile) - ndim = size(shape(bound%flux_tile)) - dims(1:ndim) = shape(bound%flux_tile) - lbounds(1:ndim) = lbound(bound%flux_tile) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrBound_get_real_array - -end module StrBound_C diff --git a/julia/gen/StrBound_JL.jl b/julia/gen/StrBound_JL.jl deleted file mode 100644 index 2b8bab5..0000000 --- a/julia/gen/StrBound_JL.jl +++ /dev/null @@ -1,170 +0,0 @@ -# Autogenerated from src/radiance_core/def_bound.F90 -# svn revision 1226 - - - mutable struct StrBound - cptr::Ptr{Cvoid} - - function StrBound() - handle = new(ccall((:PS_create_StrBound, libSOCRATES_C), Ptr{Cvoid}, ())) - finalizer(delete_StrBound, handle) - return handle - end - end - - function delete_StrBound(handle::StrBound) - if getfield(handle, :cptr) == Ptr{Cvoid}() - ccall(:jl_safe_printf, Cvoid, (Cstring, ), "error: delete_StrBound attempt to delete null pointer") - else - ccall((:PS_delete_StrBound, libSOCRATES_C), Cvoid, (Ptr{Cvoid},), getfield(handle, :cptr)) - setfield!(handle, :cptr, Ptr{Cvoid}()) - end - return nothing - end - - - # this is used to show values in the REPL and when using IJulia - function Base.show(io::IO, m::MIME"text/plain", handle::StrBound) - println(io, handle) - dump_properties(io, handle) - end - - - function Base.propertynames(handle::StrBound, private::Bool=false) - names = [ - :zen_0, - :azim_0, - :solar_irrad, - :lit, - :cos_zen, - :n_brdf_basis_fnc, - :rho_alb, - :f_brdf, - :t_ground, - :flux_ground, - :orog_corr, - :n_point_tile, - :n_tile, - :list_tile, - :rho_alb_tile, - :frac_tile, - :t_tile, - :flux_tile, - ] - - return names - end - - - function Base.getproperty(handle::StrBound, field::Symbol) - - - cptr = getfield(handle, :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - - if field == :cptr - return cptr - - elseif field in ( - :n_brdf_basis_fnc, - :n_point_tile, - :n_tile, - ) - val = Ref{Cint}() - field_ok = ccall( - (:PS_StrBound_get_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Cint}), - cptr, String(field), val - ) - Bool(field_ok) || error("StrBound integer field $field not present - coding error") - return val[] - elseif field in ( - :list_tile, - ) - loc = Ref{Ptr{Cint}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrBound_get_integer_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cint}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrBound Cint array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - elseif field in ( - :zen_0, - :azim_0, - :solar_irrad, - :lit, - :cos_zen, - :rho_alb, - :f_brdf, - :t_ground, - :flux_ground, - :orog_corr, - :rho_alb_tile, - :frac_tile, - :t_tile, - :flux_tile, - ) - loc = Ref{Ptr{Cdouble}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrBound_get_real_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cdouble}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrBound Cdouble array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - else - return getfield(handle, field) - end - - end - - - function Base.setproperty!(handle::StrBound, field::Symbol, val) - - - cptr = getfield(handle, :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :n_brdf_basis_fnc, - :n_point_tile, - :n_tile, - ) - - field_ok = ccall( - (:PS_StrBound_set_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Cint), - cptr, String(field), val - ) - Bool(field_ok) || error("StrBound integer field $field not present - coding error") - return val - else - error("type StrBound has no writeable field $field") - end - - end - diff --git a/julia/gen/StrCld_C.f90 b/julia/gen/StrCld_C.f90 deleted file mode 100644 index 138d2a2..0000000 --- a/julia/gen/StrCld_C.f90 +++ /dev/null @@ -1,498 +0,0 @@ -! Autogenerated from Fortran file src/radiance_core/def_cld.F90 -! svn revision 1226 - -module StrCld_C - -use, intrinsic :: iso_c_binding - -use UTILITIES_CF -use def_cld - -implicit none - -private - -contains - - function create_StrCld() result(cld_Cptr) & - bind(C, NAME='PS_create_StrCld') - - implicit none - type(c_ptr) :: cld_Cptr - - TYPE(StrCld), pointer :: cld - - ALLOCATE(cld) - - cld_Cptr = c_loc(cld) - end function create_StrCld - - subroutine delete_StrCld(cld_Cptr) & - bind(C, NAME='PS_delete_StrCld') - - implicit none - type(c_ptr), value, intent(in) :: cld_Cptr - - TYPE(StrCld), pointer :: cld - - call C_F_POINTER(cld_Cptr, cld) - - DEALLOCATE(cld) - - end subroutine delete_StrCld - - function StrCld_get_integer(cld_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrCld_get_integer') - - implicit none - type(c_ptr), value, intent(in) :: cld_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), intent(out) :: val - - ! local variables - TYPE(StrCld), pointer :: cld - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(cld_Cptr, cld) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'n_cloud_type') then - val = cld%n_cloud_type - else if (field == 'n_condensed') then - val = cld%n_condensed - else if (field == 'n_opt_level_drop_prsc') then - val = cld%n_opt_level_drop_prsc - else if (field == 'n_phase_term_drop_prsc') then - val = cld%n_phase_term_drop_prsc - else if (field == 'n_opt_level_ice_prsc') then - val = cld%n_opt_level_ice_prsc - else if (field == 'n_phase_term_ice_prsc') then - val = cld%n_phase_term_ice_prsc - else - field_OK = .FALSE. - end if - - end function StrCld_get_integer - - function StrCld_set_integer(cld_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrCld_set_integer') - - implicit none - type(c_ptr), value, intent(in) :: cld_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), value, intent(in) :: val - - ! local variables - TYPE(StrCld), pointer :: cld - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(cld_Cptr, cld) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'n_cloud_type') then - cld%n_cloud_type = val - else if (field == 'n_condensed') then - cld%n_condensed = val - else if (field == 'n_opt_level_drop_prsc') then - cld%n_opt_level_drop_prsc = val - else if (field == 'n_phase_term_drop_prsc') then - cld%n_phase_term_drop_prsc = val - else if (field == 'n_opt_level_ice_prsc') then - cld%n_opt_level_ice_prsc = val - else if (field == 'n_phase_term_ice_prsc') then - cld%n_phase_term_ice_prsc = val - else - field_OK = .FALSE. - end if - - end function StrCld_set_integer - - function StrCld_get_real(cld_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrCld_get_real') - - implicit none - type(c_ptr), value, intent(in) :: cld_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - real(c_double), intent(out) :: val - - ! local variables - TYPE(StrCld), pointer :: cld - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(cld_Cptr, cld) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'dp_corr_strat') then - val = cld%dp_corr_strat - else if (field == 'dp_corr_conv') then - val = cld%dp_corr_conv - else - field_OK = .FALSE. - end if - - end function StrCld_get_real - - function StrCld_set_real(cld_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrCld_set_real') - - implicit none - type(c_ptr), value, intent(in) :: cld_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - real(c_double), value, intent(in) :: val - - ! local variables - TYPE(StrCld), pointer :: cld - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(cld_Cptr, cld) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'dp_corr_strat') then - cld%dp_corr_strat = val - else if (field == 'dp_corr_conv') then - cld%dp_corr_conv = val - else - field_OK = .FALSE. - end if - - end function StrCld_set_real - - function StrCld_get_integer_array(cld_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrCld_get_integer_array') - - implicit none - type(c_ptr), value, intent(in) :: cld_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrCld), pointer :: cld - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(cld_Cptr, cld) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'type_condensed') then - if (allocated(cld%type_condensed)) then - loc = C_LOC(cld%type_condensed) - ndim = size(shape(cld%type_condensed)) - dims(1:ndim) = shape(cld%type_condensed) - lbounds(1:ndim) = lbound(cld%type_condensed) - else - loc = C_NULL_PTR - end if - - else if (field == 'i_cloud_type') then - if (allocated(cld%i_cloud_type)) then - loc = C_LOC(cld%i_cloud_type) - ndim = size(shape(cld%i_cloud_type)) - dims(1:ndim) = shape(cld%i_cloud_type) - lbounds(1:ndim) = lbound(cld%i_cloud_type) - else - loc = C_NULL_PTR - end if - - else if (field == 'i_condensed_param') then - if (allocated(cld%i_condensed_param)) then - loc = C_LOC(cld%i_condensed_param) - ndim = size(shape(cld%i_condensed_param)) - dims(1:ndim) = shape(cld%i_condensed_param) - lbounds(1:ndim) = lbound(cld%i_condensed_param) - else - loc = C_NULL_PTR - end if - - else if (field == 'condensed_n_phf') then - if (allocated(cld%condensed_n_phf)) then - loc = C_LOC(cld%condensed_n_phf) - ndim = size(shape(cld%condensed_n_phf)) - dims(1:ndim) = shape(cld%condensed_n_phf) - lbounds(1:ndim) = lbound(cld%condensed_n_phf) - else - loc = C_NULL_PTR - end if - - else if (field == 'n_subcol_cld') then - if (allocated(cld%n_subcol_cld)) then - loc = C_LOC(cld%n_subcol_cld) - ndim = size(shape(cld%n_subcol_cld)) - dims(1:ndim) = shape(cld%n_subcol_cld) - lbounds(1:ndim) = lbound(cld%n_subcol_cld) - else - loc = C_NULL_PTR - end if - - else if (field == 'subcol_k') then - if (allocated(cld%subcol_k)) then - loc = C_LOC(cld%subcol_k) - ndim = size(shape(cld%subcol_k)) - dims(1:ndim) = shape(cld%subcol_k) - lbounds(1:ndim) = lbound(cld%subcol_k) - else - loc = C_NULL_PTR - end if - - else if (field == 'first_subcol_k') then - if (allocated(cld%first_subcol_k)) then - loc = C_LOC(cld%first_subcol_k) - ndim = size(shape(cld%first_subcol_k)) - dims(1:ndim) = shape(cld%first_subcol_k) - lbounds(1:ndim) = lbound(cld%first_subcol_k) - else - loc = C_NULL_PTR - end if - - else if (field == 'subcol_reorder') then - if (allocated(cld%subcol_reorder)) then - loc = C_LOC(cld%subcol_reorder) - ndim = size(shape(cld%subcol_reorder)) - dims(1:ndim) = shape(cld%subcol_reorder) - lbounds(1:ndim) = lbound(cld%subcol_reorder) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrCld_get_integer_array - - function StrCld_get_real_array(cld_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrCld_get_real_array') - - implicit none - type(c_ptr), value, intent(in) :: cld_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrCld), pointer :: cld - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(cld_Cptr, cld) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'w_cloud') then - if (allocated(cld%w_cloud)) then - loc = C_LOC(cld%w_cloud) - ndim = size(shape(cld%w_cloud)) - dims(1:ndim) = shape(cld%w_cloud) - lbounds(1:ndim) = lbound(cld%w_cloud) - else - loc = C_NULL_PTR - end if - - else if (field == 'frac_cloud') then - if (allocated(cld%frac_cloud)) then - loc = C_LOC(cld%frac_cloud) - ndim = size(shape(cld%frac_cloud)) - dims(1:ndim) = shape(cld%frac_cloud) - lbounds(1:ndim) = lbound(cld%frac_cloud) - else - loc = C_NULL_PTR - end if - - else if (field == 'condensed_mix_ratio') then - if (allocated(cld%condensed_mix_ratio)) then - loc = C_LOC(cld%condensed_mix_ratio) - ndim = size(shape(cld%condensed_mix_ratio)) - dims(1:ndim) = shape(cld%condensed_mix_ratio) - lbounds(1:ndim) = lbound(cld%condensed_mix_ratio) - else - loc = C_NULL_PTR - end if - - else if (field == 'condensed_dim_char') then - if (allocated(cld%condensed_dim_char)) then - loc = C_LOC(cld%condensed_dim_char) - ndim = size(shape(cld%condensed_dim_char)) - dims(1:ndim) = shape(cld%condensed_dim_char) - lbounds(1:ndim) = lbound(cld%condensed_dim_char) - else - loc = C_NULL_PTR - end if - - else if (field == 'condensed_param_list') then - if (allocated(cld%condensed_param_list)) then - loc = C_LOC(cld%condensed_param_list) - ndim = size(shape(cld%condensed_param_list)) - dims(1:ndim) = shape(cld%condensed_param_list) - lbounds(1:ndim) = lbound(cld%condensed_param_list) - else - loc = C_NULL_PTR - end if - - else if (field == 'c_cloud') then - if (allocated(cld%c_cloud)) then - loc = C_LOC(cld%c_cloud) - ndim = size(shape(cld%c_cloud)) - dims(1:ndim) = shape(cld%c_cloud) - lbounds(1:ndim) = lbound(cld%c_cloud) - else - loc = C_NULL_PTR - end if - - else if (field == 'c_ratio') then - if (allocated(cld%c_ratio)) then - loc = C_LOC(cld%c_ratio) - ndim = size(shape(cld%c_ratio)) - dims(1:ndim) = shape(cld%c_ratio) - lbounds(1:ndim) = lbound(cld%c_ratio) - else - loc = C_NULL_PTR - end if - - else if (field == 'condensed_rel_var_dens') then - if (allocated(cld%condensed_rel_var_dens)) then - loc = C_LOC(cld%condensed_rel_var_dens) - ndim = size(shape(cld%condensed_rel_var_dens)) - dims(1:ndim) = shape(cld%condensed_rel_var_dens) - lbounds(1:ndim) = lbound(cld%condensed_rel_var_dens) - else - loc = C_NULL_PTR - end if - - else if (field == 'drop_pressure_prsc') then - if (allocated(cld%drop_pressure_prsc)) then - loc = C_LOC(cld%drop_pressure_prsc) - ndim = size(shape(cld%drop_pressure_prsc)) - dims(1:ndim) = shape(cld%drop_pressure_prsc) - lbounds(1:ndim) = lbound(cld%drop_pressure_prsc) - else - loc = C_NULL_PTR - end if - - else if (field == 'drop_absorption_prsc') then - if (allocated(cld%drop_absorption_prsc)) then - loc = C_LOC(cld%drop_absorption_prsc) - ndim = size(shape(cld%drop_absorption_prsc)) - dims(1:ndim) = shape(cld%drop_absorption_prsc) - lbounds(1:ndim) = lbound(cld%drop_absorption_prsc) - else - loc = C_NULL_PTR - end if - - else if (field == 'drop_scattering_prsc') then - if (allocated(cld%drop_scattering_prsc)) then - loc = C_LOC(cld%drop_scattering_prsc) - ndim = size(shape(cld%drop_scattering_prsc)) - dims(1:ndim) = shape(cld%drop_scattering_prsc) - lbounds(1:ndim) = lbound(cld%drop_scattering_prsc) - else - loc = C_NULL_PTR - end if - - else if (field == 'drop_phase_fnc_prsc') then - if (allocated(cld%drop_phase_fnc_prsc)) then - loc = C_LOC(cld%drop_phase_fnc_prsc) - ndim = size(shape(cld%drop_phase_fnc_prsc)) - dims(1:ndim) = shape(cld%drop_phase_fnc_prsc) - lbounds(1:ndim) = lbound(cld%drop_phase_fnc_prsc) - else - loc = C_NULL_PTR - end if - - else if (field == 'ice_pressure_prsc') then - if (allocated(cld%ice_pressure_prsc)) then - loc = C_LOC(cld%ice_pressure_prsc) - ndim = size(shape(cld%ice_pressure_prsc)) - dims(1:ndim) = shape(cld%ice_pressure_prsc) - lbounds(1:ndim) = lbound(cld%ice_pressure_prsc) - else - loc = C_NULL_PTR - end if - - else if (field == 'ice_absorption_prsc') then - if (allocated(cld%ice_absorption_prsc)) then - loc = C_LOC(cld%ice_absorption_prsc) - ndim = size(shape(cld%ice_absorption_prsc)) - dims(1:ndim) = shape(cld%ice_absorption_prsc) - lbounds(1:ndim) = lbound(cld%ice_absorption_prsc) - else - loc = C_NULL_PTR - end if - - else if (field == 'ice_scattering_prsc') then - if (allocated(cld%ice_scattering_prsc)) then - loc = C_LOC(cld%ice_scattering_prsc) - ndim = size(shape(cld%ice_scattering_prsc)) - dims(1:ndim) = shape(cld%ice_scattering_prsc) - lbounds(1:ndim) = lbound(cld%ice_scattering_prsc) - else - loc = C_NULL_PTR - end if - - else if (field == 'ice_phase_fnc_prsc') then - if (allocated(cld%ice_phase_fnc_prsc)) then - loc = C_LOC(cld%ice_phase_fnc_prsc) - ndim = size(shape(cld%ice_phase_fnc_prsc)) - dims(1:ndim) = shape(cld%ice_phase_fnc_prsc) - lbounds(1:ndim) = lbound(cld%ice_phase_fnc_prsc) - else - loc = C_NULL_PTR - end if - - else if (field == 'c_sub') then - if (allocated(cld%c_sub)) then - loc = C_LOC(cld%c_sub) - ndim = size(shape(cld%c_sub)) - dims(1:ndim) = shape(cld%c_sub) - lbounds(1:ndim) = lbound(cld%c_sub) - else - loc = C_NULL_PTR - end if - - else if (field == 'frac_cloudy') then - if (allocated(cld%frac_cloudy)) then - loc = C_LOC(cld%frac_cloudy) - ndim = size(shape(cld%frac_cloudy)) - dims(1:ndim) = shape(cld%frac_cloudy) - lbounds(1:ndim) = lbound(cld%frac_cloudy) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrCld_get_real_array - -end module StrCld_C diff --git a/julia/gen/StrCld_JL.jl b/julia/gen/StrCld_JL.jl deleted file mode 100644 index 435426a..0000000 --- a/julia/gen/StrCld_JL.jl +++ /dev/null @@ -1,229 +0,0 @@ -# Autogenerated from src/radiance_core/def_cld.F90 -# svn revision 1226 - - - mutable struct StrCld - cptr::Ptr{Cvoid} - - function StrCld() - handle = new(ccall((:PS_create_StrCld, libSOCRATES_C), Ptr{Cvoid}, ())) - finalizer(delete_StrCld, handle) - return handle - end - end - - function delete_StrCld(handle::StrCld) - if getfield(handle, :cptr) == Ptr{Cvoid}() - ccall(:jl_safe_printf, Cvoid, (Cstring, ), "error: delete_StrCld attempt to delete null pointer") - else - ccall((:PS_delete_StrCld, libSOCRATES_C), Cvoid, (Ptr{Cvoid},), getfield(handle, :cptr)) - setfield!(handle, :cptr, Ptr{Cvoid}()) - end - return nothing - end - - - # this is used to show values in the REPL and when using IJulia - function Base.show(io::IO, m::MIME"text/plain", handle::StrCld) - println(io, handle) - dump_properties(io, handle) - end - - - function Base.propertynames(handle::StrCld, private::Bool=false) - names = [ - :n_cloud_type, - :n_condensed, - :type_condensed, - :i_cloud_type, - :i_condensed_param, - :condensed_n_phf, - :dp_corr_strat, - :dp_corr_conv, - :w_cloud, - :frac_cloud, - :condensed_mix_ratio, - :condensed_dim_char, - :condensed_param_list, - :c_cloud, - :c_ratio, - :condensed_rel_var_dens, - :n_opt_level_drop_prsc, - :n_phase_term_drop_prsc, - :n_opt_level_ice_prsc, - :n_phase_term_ice_prsc, - :drop_pressure_prsc, - :drop_absorption_prsc, - :drop_scattering_prsc, - :drop_phase_fnc_prsc, - :ice_pressure_prsc, - :ice_absorption_prsc, - :ice_scattering_prsc, - :ice_phase_fnc_prsc, - :c_sub, - :frac_cloudy, - :n_subcol_cld, - :subcol_k, - :first_subcol_k, - :subcol_reorder, - ] - - return names - end - - - function Base.getproperty(handle::StrCld, field::Symbol) - - - cptr = getfield(handle, :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - - if field == :cptr - return cptr - - elseif field in ( - :n_cloud_type, - :n_condensed, - :n_opt_level_drop_prsc, - :n_phase_term_drop_prsc, - :n_opt_level_ice_prsc, - :n_phase_term_ice_prsc, - ) - val = Ref{Cint}() - field_ok = ccall( - (:PS_StrCld_get_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Cint}), - cptr, String(field), val - ) - Bool(field_ok) || error("StrCld integer field $field not present - coding error") - return val[] - elseif field in ( - :dp_corr_strat, - :dp_corr_conv, - ) - val = Ref{Cdouble}() - field_ok = ccall( - (:PS_StrCld_get_real, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Cdouble}), - cptr, String(field), val - ) - Bool(field_ok) || error("StrCld real field $field not present - coding error") - return val[] - elseif field in ( - :type_condensed, - :i_cloud_type, - :i_condensed_param, - :condensed_n_phf, - :n_subcol_cld, - :subcol_k, - :first_subcol_k, - :subcol_reorder, - ) - loc = Ref{Ptr{Cint}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrCld_get_integer_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cint}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrCld Cint array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - elseif field in ( - :w_cloud, - :frac_cloud, - :condensed_mix_ratio, - :condensed_dim_char, - :condensed_param_list, - :c_cloud, - :c_ratio, - :condensed_rel_var_dens, - :drop_pressure_prsc, - :drop_absorption_prsc, - :drop_scattering_prsc, - :drop_phase_fnc_prsc, - :ice_pressure_prsc, - :ice_absorption_prsc, - :ice_scattering_prsc, - :ice_phase_fnc_prsc, - :c_sub, - :frac_cloudy, - ) - loc = Ref{Ptr{Cdouble}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrCld_get_real_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cdouble}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrCld Cdouble array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - else - return getfield(handle, field) - end - - end - - - function Base.setproperty!(handle::StrCld, field::Symbol, val) - - - cptr = getfield(handle, :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :n_cloud_type, - :n_condensed, - :n_opt_level_drop_prsc, - :n_phase_term_drop_prsc, - :n_opt_level_ice_prsc, - :n_phase_term_ice_prsc, - ) - - field_ok = ccall( - (:PS_StrCld_set_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Cint), - cptr, String(field), val - ) - Bool(field_ok) || error("StrCld integer field $field not present - coding error") - return val - elseif field in ( - :dp_corr_strat, - :dp_corr_conv, - ) - - field_ok = ccall( - (:PS_StrCld_set_real, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Cdouble), - cptr, String(field), val - ) - Bool(field_ok) || error("StrCld real field $field not present - coding error") - return val - else - error("type StrCld has no writeable field $field") - end - - end - diff --git a/julia/gen/StrCtrl_C.f90 b/julia/gen/StrCtrl_C.f90 deleted file mode 100644 index 703bc3e..0000000 --- a/julia/gen/StrCtrl_C.f90 +++ /dev/null @@ -1,1089 +0,0 @@ -! Autogenerated from Fortran file src/radiance_core/def_control.F90 -! svn revision 1226 - -module StrCtrl_C - -use, intrinsic :: iso_c_binding - -use UTILITIES_CF -use def_control - -implicit none - -private - -contains - - function create_StrCtrl() result(control_Cptr) & - bind(C, NAME='PS_create_StrCtrl') - - implicit none - type(c_ptr) :: control_Cptr - - TYPE(StrCtrl), pointer :: control - - ALLOCATE(control) - - control_Cptr = c_loc(control) - end function create_StrCtrl - - subroutine delete_StrCtrl(control_Cptr) & - bind(C, NAME='PS_delete_StrCtrl') - - implicit none - type(c_ptr), value, intent(in) :: control_Cptr - - TYPE(StrCtrl), pointer :: control - - call C_F_POINTER(control_Cptr, control) - - DEALLOCATE(control) - - end subroutine delete_StrCtrl - - function StrCtrl_get_logical(control_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrCtrl_get_logical') - - implicit none - type(c_ptr), value, intent(in) :: control_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - logical(c_bool), intent(out) :: val - - ! local variables - TYPE(StrCtrl), pointer :: control - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(control_Cptr, control) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'l_microphysics') then - val = control%l_microphysics - else if (field == 'l_gas') then - val = control%l_gas - else if (field == 'l_rayleigh') then - val = control%l_rayleigh - else if (field == 'l_continuum') then - val = control%l_continuum - else if (field == 'l_cont_gen') then - val = control%l_cont_gen - else if (field == 'l_cloud') then - val = control%l_cloud - else if (field == 'l_drop') then - val = control%l_drop - else if (field == 'l_ice') then - val = control%l_ice - else if (field == 'l_aerosol') then - val = control%l_aerosol - else if (field == 'l_aerosol_mode') then - val = control%l_aerosol_mode - else if (field == 'l_aerosol_ccn') then - val = control%l_aerosol_ccn - else if (field == 'l_solar_tail_flux') then - val = control%l_solar_tail_flux - else if (field == 'l_orog') then - val = control%l_orog - else if (field == 'l_orog_fix') then - val = control%l_orog_fix - else if (field == 'l_solvar') then - val = control%l_solvar - else if (field == 'l_h2o') then - val = control%l_h2o - else if (field == 'l_o2') then - val = control%l_o2 - else if (field == 'l_n2o') then - val = control%l_n2o - else if (field == 'l_ch4') then - val = control%l_ch4 - else if (field == 'l_cfc11') then - val = control%l_cfc11 - else if (field == 'l_cfc12') then - val = control%l_cfc12 - else if (field == 'l_cfc113') then - val = control%l_cfc113 - else if (field == 'l_cfc114') then - val = control%l_cfc114 - else if (field == 'l_hcfc22') then - val = control%l_hcfc22 - else if (field == 'l_hfc125') then - val = control%l_hfc125 - else if (field == 'l_hfc134a') then - val = control%l_hfc134a - else if (field == 'l_co') then - val = control%l_co - else if (field == 'l_nh3') then - val = control%l_nh3 - else if (field == 'l_tio') then - val = control%l_tio - else if (field == 'l_vo') then - val = control%l_vo - else if (field == 'l_h2') then - val = control%l_h2 - else if (field == 'l_he') then - val = control%l_he - else if (field == 'l_na') then - val = control%l_na - else if (field == 'l_k') then - val = control%l_k - else if (field == 'l_co2') then - val = control%l_co2 - else if (field == 'l_feh') then - val = control%l_feh - else if (field == 'l_crh') then - val = control%l_crh - else if (field == 'l_li') then - val = control%l_li - else if (field == 'l_rb') then - val = control%l_rb - else if (field == 'l_cs') then - val = control%l_cs - else if (field == 'l_ph3') then - val = control%l_ph3 - else if (field == 'l_c2h2') then - val = control%l_c2h2 - else if (field == 'l_hcn') then - val = control%l_hcn - else if (field == 'l_o3') then - val = control%l_o3 - else if (field == 'l_so2') then - val = control%l_so2 - else if (field == 'l_no2') then - val = control%l_no2 - else if (field == 'l_n2') then - val = control%l_n2 - else if (field == 'l_ar') then - val = control%l_ar - else if (field == 'l_o') then - val = control%l_o - else if (field == 'l_n') then - val = control%l_n - else if (field == 'l_hno3') then - val = control%l_hno3 - else if (field == 'l_no') then - val = control%l_no - else if (field == 'l_no3') then - val = control%l_no3 - else if (field == 'l_n2o5') then - val = control%l_n2o5 - else if (field == 'l_hono') then - val = control%l_hono - else if (field == 'l_ho2no2') then - val = control%l_ho2no2 - else if (field == 'l_h2o2') then - val = control%l_h2o2 - else if (field == 'l_c2h6') then - val = control%l_c2h6 - else if (field == 'l_ch3') then - val = control%l_ch3 - else if (field == 'l_h2co') then - val = control%l_h2co - else if (field == 'l_ho2') then - val = control%l_ho2 - else if (field == 'l_hdo') then - val = control%l_hdo - else if (field == 'l_hcl') then - val = control%l_hcl - else if (field == 'l_hf') then - val = control%l_hf - else if (field == 'l_cosso') then - val = control%l_cosso - else if (field == 'l_tosso') then - val = control%l_tosso - else if (field == 'l_yosos') then - val = control%l_yosos - else if (field == 'l_h2s') then - val = control%l_h2s - else if (field == 'l_cocs') then - val = control%l_cocs - else if (field == 'l_local_cnv_partition') then - val = control%l_local_cnv_partition - else if (field == 'l_global_cloud_top') then - val = control%l_global_cloud_top - else if (field == 'l_avg_phase_fnc') then - val = control%l_avg_phase_fnc - else if (field == 'l_ir_source_quad') then - val = control%l_ir_source_quad - else if (field == 'l_rescale') then - val = control%l_rescale - else if (field == 'l_spherical_solar') then - val = control%l_spherical_solar - else if (field == 'l_spherical_diffuse') then - val = control%l_spherical_diffuse - else if (field == 'l_henyey_greenstein_pf') then - val = control%l_henyey_greenstein_pf - else if (field == 'l_lanczos') then - val = control%l_lanczos - else if (field == 'l_euler_trnf') then - val = control%l_euler_trnf - else if (field == 'l_tile') then - val = control%l_tile - else if (field == 'l_tile_emissivity') then - val = control%l_tile_emissivity - else if (field == 'l_flux_ground') then - val = control%l_flux_ground - else if (field == 'l_extra_top') then - val = control%l_extra_top - else if (field == 'l_rad_deg') then - val = control%l_rad_deg - else if (field == 'l_subsample') then - val = control%l_subsample - else if (field == 'l_mixing_ratio') then - val = control%l_mixing_ratio - else if (field == 'l_map_sub_bands') then - val = control%l_map_sub_bands - else if (field == 'l_clear') then - val = control%l_clear - else if (field == 'l_flux_div') then - val = control%l_flux_div - else if (field == 'l_blue_flux_surf') then - val = control%l_blue_flux_surf - else if (field == 'l_cloud_absorptivity') then - val = control%l_cloud_absorptivity - else if (field == 'l_cloud_extinction') then - val = control%l_cloud_extinction - else if (field == 'l_ls_cloud_absorptivity') then - val = control%l_ls_cloud_absorptivity - else if (field == 'l_ls_cloud_extinction') then - val = control%l_ls_cloud_extinction - else if (field == 'l_cnv_cloud_absorptivity') then - val = control%l_cnv_cloud_absorptivity - else if (field == 'l_cnv_cloud_extinction') then - val = control%l_cnv_cloud_extinction - else if (field == 'l_flux_direct_band') then - val = control%l_flux_direct_band - else if (field == 'l_flux_direct_div_band') then - val = control%l_flux_direct_div_band - else if (field == 'l_flux_direct_sph_band') then - val = control%l_flux_direct_sph_band - else if (field == 'l_flux_down_band') then - val = control%l_flux_down_band - else if (field == 'l_flux_up_band') then - val = control%l_flux_up_band - else if (field == 'l_flux_div_band') then - val = control%l_flux_div_band - else if (field == 'l_flux_direct_clear_band') then - val = control%l_flux_direct_clear_band - else if (field == 'l_flux_direct_clear_div_band') then - val = control%l_flux_direct_clear_div_band - else if (field == 'l_flux_direct_clear_sph_band') then - val = control%l_flux_direct_clear_sph_band - else if (field == 'l_flux_down_clear_band') then - val = control%l_flux_down_clear_band - else if (field == 'l_flux_up_clear_band') then - val = control%l_flux_up_clear_band - else if (field == 'l_flux_div_clear_band') then - val = control%l_flux_div_clear_band - else if (field == 'l_actinic_flux') then - val = control%l_actinic_flux - else if (field == 'l_actinic_flux_clear') then - val = control%l_actinic_flux_clear - else if (field == 'l_actinic_flux_band') then - val = control%l_actinic_flux_band - else if (field == 'l_actinic_flux_clear_band') then - val = control%l_actinic_flux_clear_band - else if (field == 'l_photolysis_rate') then - val = control%l_photolysis_rate - else if (field == 'l_photolysis_rate_clear') then - val = control%l_photolysis_rate_clear - else if (field == 'l_photolysis_div') then - val = control%l_photolysis_div - else if (field == 'l_photolysis_div_clear') then - val = control%l_photolysis_div_clear - else if (field == 'l_aerosol_absorption_band') then - val = control%l_aerosol_absorption_band - else if (field == 'l_aerosol_scattering_band') then - val = control%l_aerosol_scattering_band - else if (field == 'l_aerosol_asymmetry_band') then - val = control%l_aerosol_asymmetry_band - else if (field == 'l_spherical_path_diag') then - val = control%l_spherical_path_diag - else if (field == 'l_contrib_func') then - val = control%l_contrib_func - else if (field == 'l_contrib_func_band') then - val = control%l_contrib_func_band - else if (field == 'l_geostationary') then - val = control%l_geostationary - else - field_OK = .FALSE. - end if - - end function StrCtrl_get_logical - - function StrCtrl_set_logical(control_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrCtrl_set_logical') - - implicit none - type(c_ptr), value, intent(in) :: control_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - logical(c_bool), value, intent(in) :: val - - ! local variables - TYPE(StrCtrl), pointer :: control - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(control_Cptr, control) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'l_microphysics') then - control%l_microphysics = val - else if (field == 'l_gas') then - control%l_gas = val - else if (field == 'l_rayleigh') then - control%l_rayleigh = val - else if (field == 'l_continuum') then - control%l_continuum = val - else if (field == 'l_cont_gen') then - control%l_cont_gen = val - else if (field == 'l_cloud') then - control%l_cloud = val - else if (field == 'l_drop') then - control%l_drop = val - else if (field == 'l_ice') then - control%l_ice = val - else if (field == 'l_aerosol') then - control%l_aerosol = val - else if (field == 'l_aerosol_mode') then - control%l_aerosol_mode = val - else if (field == 'l_aerosol_ccn') then - control%l_aerosol_ccn = val - else if (field == 'l_solar_tail_flux') then - control%l_solar_tail_flux = val - else if (field == 'l_orog') then - control%l_orog = val - else if (field == 'l_orog_fix') then - control%l_orog_fix = val - else if (field == 'l_solvar') then - control%l_solvar = val - else if (field == 'l_h2o') then - control%l_h2o = val - else if (field == 'l_o2') then - control%l_o2 = val - else if (field == 'l_n2o') then - control%l_n2o = val - else if (field == 'l_ch4') then - control%l_ch4 = val - else if (field == 'l_cfc11') then - control%l_cfc11 = val - else if (field == 'l_cfc12') then - control%l_cfc12 = val - else if (field == 'l_cfc113') then - control%l_cfc113 = val - else if (field == 'l_cfc114') then - control%l_cfc114 = val - else if (field == 'l_hcfc22') then - control%l_hcfc22 = val - else if (field == 'l_hfc125') then - control%l_hfc125 = val - else if (field == 'l_hfc134a') then - control%l_hfc134a = val - else if (field == 'l_co') then - control%l_co = val - else if (field == 'l_nh3') then - control%l_nh3 = val - else if (field == 'l_tio') then - control%l_tio = val - else if (field == 'l_vo') then - control%l_vo = val - else if (field == 'l_h2') then - control%l_h2 = val - else if (field == 'l_he') then - control%l_he = val - else if (field == 'l_na') then - control%l_na = val - else if (field == 'l_k') then - control%l_k = val - else if (field == 'l_co2') then - control%l_co2 = val - else if (field == 'l_feh') then - control%l_feh = val - else if (field == 'l_crh') then - control%l_crh = val - else if (field == 'l_li') then - control%l_li = val - else if (field == 'l_rb') then - control%l_rb = val - else if (field == 'l_cs') then - control%l_cs = val - else if (field == 'l_ph3') then - control%l_ph3 = val - else if (field == 'l_c2h2') then - control%l_c2h2 = val - else if (field == 'l_hcn') then - control%l_hcn = val - else if (field == 'l_o3') then - control%l_o3 = val - else if (field == 'l_so2') then - control%l_so2 = val - else if (field == 'l_no2') then - control%l_no2 = val - else if (field == 'l_n2') then - control%l_n2 = val - else if (field == 'l_ar') then - control%l_ar = val - else if (field == 'l_o') then - control%l_o = val - else if (field == 'l_n') then - control%l_n = val - else if (field == 'l_hno3') then - control%l_hno3 = val - else if (field == 'l_no') then - control%l_no = val - else if (field == 'l_no3') then - control%l_no3 = val - else if (field == 'l_n2o5') then - control%l_n2o5 = val - else if (field == 'l_hono') then - control%l_hono = val - else if (field == 'l_ho2no2') then - control%l_ho2no2 = val - else if (field == 'l_h2o2') then - control%l_h2o2 = val - else if (field == 'l_c2h6') then - control%l_c2h6 = val - else if (field == 'l_ch3') then - control%l_ch3 = val - else if (field == 'l_h2co') then - control%l_h2co = val - else if (field == 'l_ho2') then - control%l_ho2 = val - else if (field == 'l_hdo') then - control%l_hdo = val - else if (field == 'l_hcl') then - control%l_hcl = val - else if (field == 'l_hf') then - control%l_hf = val - else if (field == 'l_cosso') then - control%l_cosso = val - else if (field == 'l_tosso') then - control%l_tosso = val - else if (field == 'l_yosos') then - control%l_yosos = val - else if (field == 'l_h2s') then - control%l_h2s = val - else if (field == 'l_cocs') then - control%l_cocs = val - else if (field == 'l_local_cnv_partition') then - control%l_local_cnv_partition = val - else if (field == 'l_global_cloud_top') then - control%l_global_cloud_top = val - else if (field == 'l_avg_phase_fnc') then - control%l_avg_phase_fnc = val - else if (field == 'l_ir_source_quad') then - control%l_ir_source_quad = val - else if (field == 'l_rescale') then - control%l_rescale = val - else if (field == 'l_spherical_solar') then - control%l_spherical_solar = val - else if (field == 'l_spherical_diffuse') then - control%l_spherical_diffuse = val - else if (field == 'l_henyey_greenstein_pf') then - control%l_henyey_greenstein_pf = val - else if (field == 'l_lanczos') then - control%l_lanczos = val - else if (field == 'l_euler_trnf') then - control%l_euler_trnf = val - else if (field == 'l_tile') then - control%l_tile = val - else if (field == 'l_tile_emissivity') then - control%l_tile_emissivity = val - else if (field == 'l_flux_ground') then - control%l_flux_ground = val - else if (field == 'l_extra_top') then - control%l_extra_top = val - else if (field == 'l_rad_deg') then - control%l_rad_deg = val - else if (field == 'l_subsample') then - control%l_subsample = val - else if (field == 'l_mixing_ratio') then - control%l_mixing_ratio = val - else if (field == 'l_map_sub_bands') then - control%l_map_sub_bands = val - else if (field == 'l_clear') then - control%l_clear = val - else if (field == 'l_flux_div') then - control%l_flux_div = val - else if (field == 'l_blue_flux_surf') then - control%l_blue_flux_surf = val - else if (field == 'l_cloud_absorptivity') then - control%l_cloud_absorptivity = val - else if (field == 'l_cloud_extinction') then - control%l_cloud_extinction = val - else if (field == 'l_ls_cloud_absorptivity') then - control%l_ls_cloud_absorptivity = val - else if (field == 'l_ls_cloud_extinction') then - control%l_ls_cloud_extinction = val - else if (field == 'l_cnv_cloud_absorptivity') then - control%l_cnv_cloud_absorptivity = val - else if (field == 'l_cnv_cloud_extinction') then - control%l_cnv_cloud_extinction = val - else if (field == 'l_flux_direct_band') then - control%l_flux_direct_band = val - else if (field == 'l_flux_direct_div_band') then - control%l_flux_direct_div_band = val - else if (field == 'l_flux_direct_sph_band') then - control%l_flux_direct_sph_band = val - else if (field == 'l_flux_down_band') then - control%l_flux_down_band = val - else if (field == 'l_flux_up_band') then - control%l_flux_up_band = val - else if (field == 'l_flux_div_band') then - control%l_flux_div_band = val - else if (field == 'l_flux_direct_clear_band') then - control%l_flux_direct_clear_band = val - else if (field == 'l_flux_direct_clear_div_band') then - control%l_flux_direct_clear_div_band = val - else if (field == 'l_flux_direct_clear_sph_band') then - control%l_flux_direct_clear_sph_band = val - else if (field == 'l_flux_down_clear_band') then - control%l_flux_down_clear_band = val - else if (field == 'l_flux_up_clear_band') then - control%l_flux_up_clear_band = val - else if (field == 'l_flux_div_clear_band') then - control%l_flux_div_clear_band = val - else if (field == 'l_actinic_flux') then - control%l_actinic_flux = val - else if (field == 'l_actinic_flux_clear') then - control%l_actinic_flux_clear = val - else if (field == 'l_actinic_flux_band') then - control%l_actinic_flux_band = val - else if (field == 'l_actinic_flux_clear_band') then - control%l_actinic_flux_clear_band = val - else if (field == 'l_photolysis_rate') then - control%l_photolysis_rate = val - else if (field == 'l_photolysis_rate_clear') then - control%l_photolysis_rate_clear = val - else if (field == 'l_photolysis_div') then - control%l_photolysis_div = val - else if (field == 'l_photolysis_div_clear') then - control%l_photolysis_div_clear = val - else if (field == 'l_aerosol_absorption_band') then - control%l_aerosol_absorption_band = val - else if (field == 'l_aerosol_scattering_band') then - control%l_aerosol_scattering_band = val - else if (field == 'l_aerosol_asymmetry_band') then - control%l_aerosol_asymmetry_band = val - else if (field == 'l_spherical_path_diag') then - control%l_spherical_path_diag = val - else if (field == 'l_contrib_func') then - control%l_contrib_func = val - else if (field == 'l_contrib_func_band') then - control%l_contrib_func_band = val - else if (field == 'l_geostationary') then - control%l_geostationary = val - else - field_OK = .FALSE. - end if - - end function StrCtrl_set_logical - - function StrCtrl_get_integer(control_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrCtrl_get_integer') - - implicit none - type(c_ptr), value, intent(in) :: control_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), intent(out) :: val - - ! local variables - TYPE(StrCtrl), pointer :: control - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(control_Cptr, control) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'isolir') then - val = control%isolir - else if (field == 'first_band') then - val = control%first_band - else if (field == 'last_band') then - val = control%last_band - else if (field == 'i_gas_overlap') then - val = control%i_gas_overlap - else if (field == 'n_esft_red') then - val = control%n_esft_red - else if (field == 'i_gas') then - val = control%i_gas - else if (field == 'i_cloud') then - val = control%i_cloud - else if (field == 'i_cloud_representation') then - val = control%i_cloud_representation - else if (field == 'i_st_water') then - val = control%i_st_water - else if (field == 'i_cnv_water') then - val = control%i_cnv_water - else if (field == 'i_st_ice') then - val = control%i_st_ice - else if (field == 'i_cnv_ice') then - val = control%i_cnv_ice - else if (field == 'i_inhom') then - val = control%i_inhom - else if (field == 'i_mcica_sampling') then - val = control%i_mcica_sampling - else if (field == 'i_overlap') then - val = control%i_overlap - else if (field == 'i_drop_re') then - val = control%i_drop_re - else if (field == 'n_channel') then - val = control%n_channel - else if (field == 'i_angular_integration') then - val = control%i_angular_integration - else if (field == 'i_2stream') then - val = control%i_2stream - else if (field == 'i_solver') then - val = control%i_solver - else if (field == 'i_solver_clear') then - val = control%i_solver_clear - else if (field == 'n_order_gauss') then - val = control%n_order_gauss - else if (field == 'i_truncation') then - val = control%i_truncation - else if (field == 'i_sph_algorithm') then - val = control%i_sph_algorithm - else if (field == 'n_order_phase_solar') then - val = control%n_order_phase_solar - else if (field == 'ls_global_trunc') then - val = control%ls_global_trunc - else if (field == 'ms_min') then - val = control%ms_min - else if (field == 'ms_max') then - val = control%ms_max - else if (field == 'ls_brdf_trunc') then - val = control%ls_brdf_trunc - else if (field == 'n_order_forward') then - val = control%n_order_forward - else if (field == 'i_sph_mode') then - val = control%i_sph_mode - else if (field == 'i_scatter_method') then - val = control%i_scatter_method - else if (field == 'i_solar_src') then - val = control%i_solar_src - else if (field == 'i_direct_tau') then - val = control%i_direct_tau - else - field_OK = .FALSE. - end if - - end function StrCtrl_get_integer - - function StrCtrl_set_integer(control_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrCtrl_set_integer') - - implicit none - type(c_ptr), value, intent(in) :: control_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), value, intent(in) :: val - - ! local variables - TYPE(StrCtrl), pointer :: control - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(control_Cptr, control) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'isolir') then - control%isolir = val - else if (field == 'first_band') then - control%first_band = val - else if (field == 'last_band') then - control%last_band = val - else if (field == 'i_gas_overlap') then - control%i_gas_overlap = val - else if (field == 'n_esft_red') then - control%n_esft_red = val - else if (field == 'i_gas') then - control%i_gas = val - else if (field == 'i_cloud') then - control%i_cloud = val - else if (field == 'i_cloud_representation') then - control%i_cloud_representation = val - else if (field == 'i_st_water') then - control%i_st_water = val - else if (field == 'i_cnv_water') then - control%i_cnv_water = val - else if (field == 'i_st_ice') then - control%i_st_ice = val - else if (field == 'i_cnv_ice') then - control%i_cnv_ice = val - else if (field == 'i_inhom') then - control%i_inhom = val - else if (field == 'i_mcica_sampling') then - control%i_mcica_sampling = val - else if (field == 'i_overlap') then - control%i_overlap = val - else if (field == 'i_drop_re') then - control%i_drop_re = val - else if (field == 'n_channel') then - control%n_channel = val - else if (field == 'i_angular_integration') then - control%i_angular_integration = val - else if (field == 'i_2stream') then - control%i_2stream = val - else if (field == 'i_solver') then - control%i_solver = val - else if (field == 'i_solver_clear') then - control%i_solver_clear = val - else if (field == 'n_order_gauss') then - control%n_order_gauss = val - else if (field == 'i_truncation') then - control%i_truncation = val - else if (field == 'i_sph_algorithm') then - control%i_sph_algorithm = val - else if (field == 'n_order_phase_solar') then - control%n_order_phase_solar = val - else if (field == 'ls_global_trunc') then - control%ls_global_trunc = val - else if (field == 'ms_min') then - control%ms_min = val - else if (field == 'ms_max') then - control%ms_max = val - else if (field == 'ls_brdf_trunc') then - control%ls_brdf_trunc = val - else if (field == 'n_order_forward') then - control%n_order_forward = val - else if (field == 'i_sph_mode') then - control%i_sph_mode = val - else if (field == 'i_scatter_method') then - control%i_scatter_method = val - else if (field == 'i_solar_src') then - control%i_solar_src = val - else if (field == 'i_direct_tau') then - control%i_direct_tau = val - else - field_OK = .FALSE. - end if - - end function StrCtrl_set_integer - - function StrCtrl_get_real(control_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrCtrl_get_real') - - implicit none - type(c_ptr), value, intent(in) :: control_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - real(c_double), intent(out) :: val - - ! local variables - TYPE(StrCtrl), pointer :: control - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(control_Cptr, control) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'gpnt_split') then - val = control%gpnt_split - else if (field == 'accuracy_adaptive') then - val = control%accuracy_adaptive - else if (field == 'euler_factor') then - val = control%euler_factor - else if (field == 'half_angle') then - val = control%half_angle - else if (field == 'sat_hgt') then - val = control%sat_hgt - else if (field == 'sat_lon') then - val = control%sat_lon - else if (field == 'sat_lat') then - val = control%sat_lat - else if (field == 'max_view_lon') then - val = control%max_view_lon - else if (field == 'min_view_lon') then - val = control%min_view_lon - else if (field == 'max_view_lat') then - val = control%max_view_lat - else if (field == 'min_view_lat') then - val = control%min_view_lat - else - field_OK = .FALSE. - end if - - end function StrCtrl_get_real - - function StrCtrl_set_real(control_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrCtrl_set_real') - - implicit none - type(c_ptr), value, intent(in) :: control_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - real(c_double), value, intent(in) :: val - - ! local variables - TYPE(StrCtrl), pointer :: control - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(control_Cptr, control) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'gpnt_split') then - control%gpnt_split = val - else if (field == 'accuracy_adaptive') then - control%accuracy_adaptive = val - else if (field == 'euler_factor') then - control%euler_factor = val - else if (field == 'half_angle') then - control%half_angle = val - else if (field == 'sat_hgt') then - control%sat_hgt = val - else if (field == 'sat_lon') then - control%sat_lon = val - else if (field == 'sat_lat') then - control%sat_lat = val - else if (field == 'max_view_lon') then - control%max_view_lon = val - else if (field == 'min_view_lon') then - control%min_view_lon = val - else if (field == 'max_view_lat') then - control%max_view_lat = val - else if (field == 'min_view_lat') then - control%min_view_lat = val - else - field_OK = .FALSE. - end if - - end function StrCtrl_set_real - - function StrCtrl_get_logical_array(control_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrCtrl_get_logical_array') - - implicit none - type(c_ptr), value, intent(in) :: control_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrCtrl), pointer :: control - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(control_Cptr, control) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'l_flux_tile') then - if (allocated(control%l_flux_tile)) then - loc = C_LOC(control%l_flux_tile) - ndim = size(shape(control%l_flux_tile)) - dims(1:ndim) = shape(control%l_flux_tile) - lbounds(1:ndim) = lbound(control%l_flux_tile) - else - loc = C_NULL_PTR - end if - - else if (field == 'l_clear_band') then - if (allocated(control%l_clear_band)) then - loc = C_LOC(control%l_clear_band) - ndim = size(shape(control%l_clear_band)) - dims(1:ndim) = shape(control%l_clear_band) - lbounds(1:ndim) = lbound(control%l_clear_band) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrCtrl_get_logical_array - - function StrCtrl_get_integer_array(control_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrCtrl_get_integer_array') - - implicit none - type(c_ptr), value, intent(in) :: control_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrCtrl), pointer :: control - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(control_Cptr, control) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'i_scatter_method_band') then - if (allocated(control%i_scatter_method_band)) then - loc = C_LOC(control%i_scatter_method_band) - ndim = size(shape(control%i_scatter_method_band)) - dims(1:ndim) = shape(control%i_scatter_method_band) - lbounds(1:ndim) = lbound(control%i_scatter_method_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'i_gas_overlap_band') then - if (allocated(control%i_gas_overlap_band)) then - loc = C_LOC(control%i_gas_overlap_band) - ndim = size(shape(control%i_gas_overlap_band)) - dims(1:ndim) = shape(control%i_gas_overlap_band) - lbounds(1:ndim) = lbound(control%i_gas_overlap_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'map_channel') then - if (allocated(control%map_channel)) then - loc = C_LOC(control%map_channel) - ndim = size(shape(control%map_channel)) - dims(1:ndim) = shape(control%map_channel) - lbounds(1:ndim) = lbound(control%map_channel) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrCtrl_get_integer_array - - function StrCtrl_get_real_array(control_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrCtrl_get_real_array') - - implicit none - type(c_ptr), value, intent(in) :: control_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrCtrl), pointer :: control - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(control_Cptr, control) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'weight_band') then - if (allocated(control%weight_band)) then - loc = C_LOC(control%weight_band) - ndim = size(shape(control%weight_band)) - dims(1:ndim) = shape(control%weight_band) - lbounds(1:ndim) = lbound(control%weight_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'weight_diag') then - if (allocated(control%weight_diag)) then - loc = C_LOC(control%weight_diag) - ndim = size(shape(control%weight_diag)) - dims(1:ndim) = shape(control%weight_diag) - lbounds(1:ndim) = lbound(control%weight_diag) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrCtrl_get_real_array - - function StrCtrl_get_string(control_Cptr, field_Cstr, val, val_len) result(field_OK) & - bind(C, NAME='PS_StrCtrl_get_string') - - implicit none - type(c_ptr), value, intent(in) :: control_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), value, intent(in) :: val - integer(c_size_t), value, intent(in) :: val_len - - ! local variables - TYPE(StrCtrl), pointer :: control - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(control_Cptr, control) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'spectral_file') then - field_OK = copy_f_to_c_string(val, val_len, control%spectral_file) - else if (field == 'sat_desc') then - field_OK = copy_f_to_c_string(val, val_len, control%sat_desc) - else - field_OK = .FALSE. - end if - - end function StrCtrl_get_string - - function StrCtrl_set_string(control_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrCtrl_set_string') - - implicit none - type(c_ptr), value, intent(in) :: control_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), value, intent(in) :: val - - - ! local variables - TYPE(StrCtrl), pointer :: control - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(control_Cptr, control) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'spectral_file') then - field_OK = copy_c_to_f_string(control%spectral_file, val) - else if (field == 'sat_desc') then - field_OK = copy_c_to_f_string(control%sat_desc, val) - else - field_OK = .FALSE. - end if - - end function StrCtrl_set_string - -end module StrCtrl_C diff --git a/julia/gen/StrCtrl_JL.jl b/julia/gen/StrCtrl_JL.jl deleted file mode 100644 index ca5427c..0000000 --- a/julia/gen/StrCtrl_JL.jl +++ /dev/null @@ -1,743 +0,0 @@ -# Autogenerated from src/radiance_core/def_control.F90 -# svn revision 1226 - - - mutable struct StrCtrl - cptr::Ptr{Cvoid} - - function StrCtrl() - handle = new(ccall((:PS_create_StrCtrl, libSOCRATES_C), Ptr{Cvoid}, ())) - finalizer(delete_StrCtrl, handle) - return handle - end - end - - function delete_StrCtrl(handle::StrCtrl) - if getfield(handle, :cptr) == Ptr{Cvoid}() - ccall(:jl_safe_printf, Cvoid, (Cstring, ), "error: delete_StrCtrl attempt to delete null pointer") - else - ccall((:PS_delete_StrCtrl, libSOCRATES_C), Cvoid, (Ptr{Cvoid},), getfield(handle, :cptr)) - setfield!(handle, :cptr, Ptr{Cvoid}()) - end - return nothing - end - - - # this is used to show values in the REPL and when using IJulia - function Base.show(io::IO, m::MIME"text/plain", handle::StrCtrl) - println(io, handle) - dump_properties(io, handle) - end - - - function Base.propertynames(handle::StrCtrl, private::Bool=false) - names = [ - :spectral_file, - :isolir, - :first_band, - :last_band, - :l_microphysics, - :l_gas, - :l_rayleigh, - :l_continuum, - :l_cont_gen, - :l_cloud, - :l_drop, - :l_ice, - :l_aerosol, - :l_aerosol_mode, - :l_aerosol_ccn, - :l_solar_tail_flux, - :l_orog, - :l_orog_fix, - :l_solvar, - :i_gas_overlap, - :n_esft_red, - :gpnt_split, - :i_gas, - :l_h2o, - :l_o2, - :l_n2o, - :l_ch4, - :l_cfc11, - :l_cfc12, - :l_cfc113, - :l_cfc114, - :l_hcfc22, - :l_hfc125, - :l_hfc134a, - :l_co, - :l_nh3, - :l_tio, - :l_vo, - :l_h2, - :l_he, - :l_na, - :l_k, - :l_co2, - :l_feh, - :l_crh, - :l_li, - :l_rb, - :l_cs, - :l_ph3, - :l_c2h2, - :l_hcn, - :l_o3, - :l_so2, - :l_no2, - :l_n2, - :l_ar, - :l_o, - :l_n, - :l_hno3, - :l_no, - :l_no3, - :l_n2o5, - :l_hono, - :l_ho2no2, - :l_h2o2, - :l_c2h6, - :l_ch3, - :l_h2co, - :l_ho2, - :l_hdo, - :l_hcl, - :l_hf, - :l_cosso, - :l_tosso, - :l_yosos, - :l_h2s, - :l_cocs, - :i_cloud, - :i_cloud_representation, - :i_st_water, - :i_cnv_water, - :i_st_ice, - :i_cnv_ice, - :i_inhom, - :i_mcica_sampling, - :i_overlap, - :i_drop_re, - :l_local_cnv_partition, - :l_global_cloud_top, - :l_avg_phase_fnc, - :n_channel, - :i_angular_integration, - :i_2stream, - :i_solver, - :i_solver_clear, - :n_order_gauss, - :i_truncation, - :i_sph_algorithm, - :n_order_phase_solar, - :ls_global_trunc, - :ms_min, - :ms_max, - :ls_brdf_trunc, - :n_order_forward, - :i_sph_mode, - :i_scatter_method, - :i_solar_src, - :i_direct_tau, - :l_ir_source_quad, - :l_rescale, - :l_spherical_solar, - :l_spherical_diffuse, - :l_henyey_greenstein_pf, - :l_lanczos, - :l_euler_trnf, - :accuracy_adaptive, - :euler_factor, - :half_angle, - :l_tile, - :l_tile_emissivity, - :l_flux_ground, - :l_flux_tile, - :l_extra_top, - :l_rad_deg, - :l_subsample, - :l_mixing_ratio, - :l_map_sub_bands, - :i_scatter_method_band, - :i_gas_overlap_band, - :map_channel, - :weight_band, - :weight_diag, - :l_clear_band, - :l_clear, - :l_flux_div, - :l_blue_flux_surf, - :l_cloud_absorptivity, - :l_cloud_extinction, - :l_ls_cloud_absorptivity, - :l_ls_cloud_extinction, - :l_cnv_cloud_absorptivity, - :l_cnv_cloud_extinction, - :l_flux_direct_band, - :l_flux_direct_div_band, - :l_flux_direct_sph_band, - :l_flux_down_band, - :l_flux_up_band, - :l_flux_div_band, - :l_flux_direct_clear_band, - :l_flux_direct_clear_div_band, - :l_flux_direct_clear_sph_band, - :l_flux_down_clear_band, - :l_flux_up_clear_band, - :l_flux_div_clear_band, - :l_actinic_flux, - :l_actinic_flux_clear, - :l_actinic_flux_band, - :l_actinic_flux_clear_band, - :l_photolysis_rate, - :l_photolysis_rate_clear, - :l_photolysis_div, - :l_photolysis_div_clear, - :l_aerosol_absorption_band, - :l_aerosol_scattering_band, - :l_aerosol_asymmetry_band, - :l_spherical_path_diag, - :l_contrib_func, - :l_contrib_func_band, - :l_geostationary, - :sat_desc, - :sat_hgt, - :sat_lon, - :sat_lat, - :max_view_lon, - :min_view_lon, - :max_view_lat, - :min_view_lat, - ] - - return names - end - - - function Base.getproperty(handle::StrCtrl, field::Symbol) - - - cptr = getfield(handle, :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - - if field == :cptr - return cptr - - elseif field in ( - :l_microphysics, - :l_gas, - :l_rayleigh, - :l_continuum, - :l_cont_gen, - :l_cloud, - :l_drop, - :l_ice, - :l_aerosol, - :l_aerosol_mode, - :l_aerosol_ccn, - :l_solar_tail_flux, - :l_orog, - :l_orog_fix, - :l_solvar, - :l_h2o, - :l_o2, - :l_n2o, - :l_ch4, - :l_cfc11, - :l_cfc12, - :l_cfc113, - :l_cfc114, - :l_hcfc22, - :l_hfc125, - :l_hfc134a, - :l_co, - :l_nh3, - :l_tio, - :l_vo, - :l_h2, - :l_he, - :l_na, - :l_k, - :l_co2, - :l_feh, - :l_crh, - :l_li, - :l_rb, - :l_cs, - :l_ph3, - :l_c2h2, - :l_hcn, - :l_o3, - :l_so2, - :l_no2, - :l_n2, - :l_ar, - :l_o, - :l_n, - :l_hno3, - :l_no, - :l_no3, - :l_n2o5, - :l_hono, - :l_ho2no2, - :l_h2o2, - :l_c2h6, - :l_ch3, - :l_h2co, - :l_ho2, - :l_hdo, - :l_hcl, - :l_hf, - :l_cosso, - :l_tosso, - :l_yosos, - :l_h2s, - :l_cocs, - :l_local_cnv_partition, - :l_global_cloud_top, - :l_avg_phase_fnc, - :l_ir_source_quad, - :l_rescale, - :l_spherical_solar, - :l_spherical_diffuse, - :l_henyey_greenstein_pf, - :l_lanczos, - :l_euler_trnf, - :l_tile, - :l_tile_emissivity, - :l_flux_ground, - :l_extra_top, - :l_rad_deg, - :l_subsample, - :l_mixing_ratio, - :l_map_sub_bands, - :l_clear, - :l_flux_div, - :l_blue_flux_surf, - :l_cloud_absorptivity, - :l_cloud_extinction, - :l_ls_cloud_absorptivity, - :l_ls_cloud_extinction, - :l_cnv_cloud_absorptivity, - :l_cnv_cloud_extinction, - :l_flux_direct_band, - :l_flux_direct_div_band, - :l_flux_direct_sph_band, - :l_flux_down_band, - :l_flux_up_band, - :l_flux_div_band, - :l_flux_direct_clear_band, - :l_flux_direct_clear_div_band, - :l_flux_direct_clear_sph_band, - :l_flux_down_clear_band, - :l_flux_up_clear_band, - :l_flux_div_clear_band, - :l_actinic_flux, - :l_actinic_flux_clear, - :l_actinic_flux_band, - :l_actinic_flux_clear_band, - :l_photolysis_rate, - :l_photolysis_rate_clear, - :l_photolysis_div, - :l_photolysis_div_clear, - :l_aerosol_absorption_band, - :l_aerosol_scattering_band, - :l_aerosol_asymmetry_band, - :l_spherical_path_diag, - :l_contrib_func, - :l_contrib_func_band, - :l_geostationary, - ) - - val = Ref{Cuchar}() - field_ok = ccall( - (:PS_StrCtrl_get_logical, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Cuchar}), - cptr, String(field), val - ) - Bool(field_ok) || error("StrCtrl logical field $field not present - coding error") - return Bool(val[]) - elseif field in ( - :isolir, - :first_band, - :last_band, - :i_gas_overlap, - :n_esft_red, - :i_gas, - :i_cloud, - :i_cloud_representation, - :i_st_water, - :i_cnv_water, - :i_st_ice, - :i_cnv_ice, - :i_inhom, - :i_mcica_sampling, - :i_overlap, - :i_drop_re, - :n_channel, - :i_angular_integration, - :i_2stream, - :i_solver, - :i_solver_clear, - :n_order_gauss, - :i_truncation, - :i_sph_algorithm, - :n_order_phase_solar, - :ls_global_trunc, - :ms_min, - :ms_max, - :ls_brdf_trunc, - :n_order_forward, - :i_sph_mode, - :i_scatter_method, - :i_solar_src, - :i_direct_tau, - ) - val = Ref{Cint}() - field_ok = ccall( - (:PS_StrCtrl_get_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Cint}), - cptr, String(field), val - ) - Bool(field_ok) || error("StrCtrl integer field $field not present - coding error") - return val[] - elseif field in ( - :gpnt_split, - :accuracy_adaptive, - :euler_factor, - :half_angle, - :sat_hgt, - :sat_lon, - :sat_lat, - :max_view_lon, - :min_view_lon, - :max_view_lat, - :min_view_lat, - ) - val = Ref{Cdouble}() - field_ok = ccall( - (:PS_StrCtrl_get_real, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Cdouble}), - cptr, String(field), val - ) - Bool(field_ok) || error("StrCtrl real field $field not present - coding error") - return val[] - elseif field in ( - :l_flux_tile, - :l_clear_band, - ) - loc = Ref{Ptr{Cint}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrCtrl_get_logical_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cint}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrCtrl Cint array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - elseif field in ( - :i_scatter_method_band, - :i_gas_overlap_band, - :map_channel, - ) - loc = Ref{Ptr{Cint}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrCtrl_get_integer_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cint}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrCtrl Cint array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - elseif field in ( - :weight_band, - :weight_diag, - ) - loc = Ref{Ptr{Cdouble}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrCtrl_get_real_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cdouble}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrCtrl Cdouble array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - elseif field in ( - :spectral_file, - :sat_desc, - ) - val = zeros(Cuchar, 1024) - field_ok = ccall( - (:PS_StrCtrl_get_string, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ptr{Cuchar}, Csize_t), - cptr, String(field), val, length(val) - ) - Bool(field_ok) || error("StrCtrl string field $field not present or truncated") - len = findfirst(iszero, val) - 1 - return rstrip(String(val[1:len])) - else - return getfield(handle, field) - end - - end - - - function Base.setproperty!(handle::StrCtrl, field::Symbol, val) - - - cptr = getfield(handle, :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :l_microphysics, - :l_gas, - :l_rayleigh, - :l_continuum, - :l_cont_gen, - :l_cloud, - :l_drop, - :l_ice, - :l_aerosol, - :l_aerosol_mode, - :l_aerosol_ccn, - :l_solar_tail_flux, - :l_orog, - :l_orog_fix, - :l_solvar, - :l_h2o, - :l_o2, - :l_n2o, - :l_ch4, - :l_cfc11, - :l_cfc12, - :l_cfc113, - :l_cfc114, - :l_hcfc22, - :l_hfc125, - :l_hfc134a, - :l_co, - :l_nh3, - :l_tio, - :l_vo, - :l_h2, - :l_he, - :l_na, - :l_k, - :l_co2, - :l_feh, - :l_crh, - :l_li, - :l_rb, - :l_cs, - :l_ph3, - :l_c2h2, - :l_hcn, - :l_o3, - :l_so2, - :l_no2, - :l_n2, - :l_ar, - :l_o, - :l_n, - :l_hno3, - :l_no, - :l_no3, - :l_n2o5, - :l_hono, - :l_ho2no2, - :l_h2o2, - :l_c2h6, - :l_ch3, - :l_h2co, - :l_ho2, - :l_hdo, - :l_hcl, - :l_hf, - :l_cosso, - :l_tosso, - :l_yosos, - :l_h2s, - :l_cocs, - :l_local_cnv_partition, - :l_global_cloud_top, - :l_avg_phase_fnc, - :l_ir_source_quad, - :l_rescale, - :l_spherical_solar, - :l_spherical_diffuse, - :l_henyey_greenstein_pf, - :l_lanczos, - :l_euler_trnf, - :l_tile, - :l_tile_emissivity, - :l_flux_ground, - :l_extra_top, - :l_rad_deg, - :l_subsample, - :l_mixing_ratio, - :l_map_sub_bands, - :l_clear, - :l_flux_div, - :l_blue_flux_surf, - :l_cloud_absorptivity, - :l_cloud_extinction, - :l_ls_cloud_absorptivity, - :l_ls_cloud_extinction, - :l_cnv_cloud_absorptivity, - :l_cnv_cloud_extinction, - :l_flux_direct_band, - :l_flux_direct_div_band, - :l_flux_direct_sph_band, - :l_flux_down_band, - :l_flux_up_band, - :l_flux_div_band, - :l_flux_direct_clear_band, - :l_flux_direct_clear_div_band, - :l_flux_direct_clear_sph_band, - :l_flux_down_clear_band, - :l_flux_up_clear_band, - :l_flux_div_clear_band, - :l_actinic_flux, - :l_actinic_flux_clear, - :l_actinic_flux_band, - :l_actinic_flux_clear_band, - :l_photolysis_rate, - :l_photolysis_rate_clear, - :l_photolysis_div, - :l_photolysis_div_clear, - :l_aerosol_absorption_band, - :l_aerosol_scattering_band, - :l_aerosol_asymmetry_band, - :l_spherical_path_diag, - :l_contrib_func, - :l_contrib_func_band, - :l_geostationary, - ) - - field_ok = ccall( - (:PS_StrCtrl_set_logical, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Cuchar), - cptr, String(field), val - ) - Bool(field_ok) || error("StrCtrl logical field $field not present - coding error") - return val - elseif field in ( - :isolir, - :first_band, - :last_band, - :i_gas_overlap, - :n_esft_red, - :i_gas, - :i_cloud, - :i_cloud_representation, - :i_st_water, - :i_cnv_water, - :i_st_ice, - :i_cnv_ice, - :i_inhom, - :i_mcica_sampling, - :i_overlap, - :i_drop_re, - :n_channel, - :i_angular_integration, - :i_2stream, - :i_solver, - :i_solver_clear, - :n_order_gauss, - :i_truncation, - :i_sph_algorithm, - :n_order_phase_solar, - :ls_global_trunc, - :ms_min, - :ms_max, - :ls_brdf_trunc, - :n_order_forward, - :i_sph_mode, - :i_scatter_method, - :i_solar_src, - :i_direct_tau, - ) - - field_ok = ccall( - (:PS_StrCtrl_set_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Cint), - cptr, String(field), val - ) - Bool(field_ok) || error("StrCtrl integer field $field not present - coding error") - return val - elseif field in ( - :gpnt_split, - :accuracy_adaptive, - :euler_factor, - :half_angle, - :sat_hgt, - :sat_lon, - :sat_lat, - :max_view_lon, - :min_view_lon, - :max_view_lat, - :min_view_lat, - ) - - field_ok = ccall( - (:PS_StrCtrl_set_real, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Cdouble), - cptr, String(field), val - ) - Bool(field_ok) || error("StrCtrl real field $field not present - coding error") - return val - elseif field in ( - :spectral_file, - :sat_desc, - ) - - field_ok = ccall( - (:PS_StrCtrl_set_string, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Cstring), - cptr, String(field), val - ) - Bool(field_ok) || error("StrCtrl string field $field not present or truncated") - return val - else - error("type StrCtrl has no writeable field $field") - end - - end - diff --git a/julia/gen/StrDim_C.f90 b/julia/gen/StrDim_C.f90 deleted file mode 100644 index b5ac2b2..0000000 --- a/julia/gen/StrDim_C.f90 +++ /dev/null @@ -1,234 +0,0 @@ -! Autogenerated from Fortran file src/radiance_core/def_dimen.F90 -! svn revision 1226 - -module StrDim_C - -use, intrinsic :: iso_c_binding - -use UTILITIES_CF -use def_dimen - -implicit none - -private - -contains - - function create_StrDim() result(dimen_Cptr) & - bind(C, NAME='PS_create_StrDim') - - implicit none - type(c_ptr) :: dimen_Cptr - - TYPE(StrDim), pointer :: dimen - - ALLOCATE(dimen) - - dimen_Cptr = c_loc(dimen) - end function create_StrDim - - subroutine delete_StrDim(dimen_Cptr) & - bind(C, NAME='PS_delete_StrDim') - - implicit none - type(c_ptr), value, intent(in) :: dimen_Cptr - - TYPE(StrDim), pointer :: dimen - - call C_F_POINTER(dimen_Cptr, dimen) - - DEALLOCATE(dimen) - - end subroutine delete_StrDim - - function StrDim_get_integer(dimen_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrDim_get_integer') - - implicit none - type(c_ptr), value, intent(in) :: dimen_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), intent(out) :: val - - ! local variables - TYPE(StrDim), pointer :: dimen - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(dimen_Cptr, dimen) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'nd_profile') then - val = dimen%nd_profile - else if (field == 'nd_layer') then - val = dimen%nd_layer - else if (field == 'nd_layer_clr') then - val = dimen%nd_layer_clr - else if (field == 'id_cloud_top') then - val = dimen%id_cloud_top - else if (field == 'nd_2sg_profile') then - val = dimen%nd_2sg_profile - else if (field == 'nd_flux_profile') then - val = dimen%nd_flux_profile - else if (field == 'nd_radiance_profile') then - val = dimen%nd_radiance_profile - else if (field == 'nd_j_profile') then - val = dimen%nd_j_profile - else if (field == 'nd_channel') then - val = dimen%nd_channel - else if (field == 'nd_max_order') then - val = dimen%nd_max_order - else if (field == 'nd_direction') then - val = dimen%nd_direction - else if (field == 'nd_viewing_level') then - val = dimen%nd_viewing_level - else if (field == 'nd_sph_coeff') then - val = dimen%nd_sph_coeff - else if (field == 'nd_brdf_basis_fnc') then - val = dimen%nd_brdf_basis_fnc - else if (field == 'nd_brdf_trunc') then - val = dimen%nd_brdf_trunc - else if (field == 'nd_tile_type') then - val = dimen%nd_tile_type - else if (field == 'nd_aerosol_mode') then - val = dimen%nd_aerosol_mode - else if (field == 'nd_profile_aerosol_prsc') then - val = dimen%nd_profile_aerosol_prsc - else if (field == 'nd_profile_cloud_prsc') then - val = dimen%nd_profile_cloud_prsc - else if (field == 'nd_opt_level_aerosol_prsc') then - val = dimen%nd_opt_level_aerosol_prsc - else if (field == 'nd_opt_level_cloud_prsc') then - val = dimen%nd_opt_level_cloud_prsc - else if (field == 'nd_phf_term_aerosol_prsc') then - val = dimen%nd_phf_term_aerosol_prsc - else if (field == 'nd_phf_term_cloud_prsc') then - val = dimen%nd_phf_term_cloud_prsc - else if (field == 'nd_cloud_component') then - val = dimen%nd_cloud_component - else if (field == 'nd_cloud_type') then - val = dimen%nd_cloud_type - else if (field == 'nd_cloud_representation') then - val = dimen%nd_cloud_representation - else if (field == 'nd_column') then - val = dimen%nd_column - else if (field == 'nd_subcol_gen') then - val = dimen%nd_subcol_gen - else if (field == 'nd_subcol_req') then - val = dimen%nd_subcol_req - else if (field == 'nd_overlap_coeff') then - val = dimen%nd_overlap_coeff - else if (field == 'nd_source_coeff') then - val = dimen%nd_source_coeff - else if (field == 'nd_region') then - val = dimen%nd_region - else if (field == 'nd_point_tile') then - val = dimen%nd_point_tile - else if (field == 'nd_tile') then - val = dimen%nd_tile - else if (field == 'nd_k_term_inner') then - val = dimen%nd_k_term_inner - else - field_OK = .FALSE. - end if - - end function StrDim_get_integer - - function StrDim_set_integer(dimen_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrDim_set_integer') - - implicit none - type(c_ptr), value, intent(in) :: dimen_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), value, intent(in) :: val - - ! local variables - TYPE(StrDim), pointer :: dimen - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(dimen_Cptr, dimen) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'nd_profile') then - dimen%nd_profile = val - else if (field == 'nd_layer') then - dimen%nd_layer = val - else if (field == 'nd_layer_clr') then - dimen%nd_layer_clr = val - else if (field == 'id_cloud_top') then - dimen%id_cloud_top = val - else if (field == 'nd_2sg_profile') then - dimen%nd_2sg_profile = val - else if (field == 'nd_flux_profile') then - dimen%nd_flux_profile = val - else if (field == 'nd_radiance_profile') then - dimen%nd_radiance_profile = val - else if (field == 'nd_j_profile') then - dimen%nd_j_profile = val - else if (field == 'nd_channel') then - dimen%nd_channel = val - else if (field == 'nd_max_order') then - dimen%nd_max_order = val - else if (field == 'nd_direction') then - dimen%nd_direction = val - else if (field == 'nd_viewing_level') then - dimen%nd_viewing_level = val - else if (field == 'nd_sph_coeff') then - dimen%nd_sph_coeff = val - else if (field == 'nd_brdf_basis_fnc') then - dimen%nd_brdf_basis_fnc = val - else if (field == 'nd_brdf_trunc') then - dimen%nd_brdf_trunc = val - else if (field == 'nd_tile_type') then - dimen%nd_tile_type = val - else if (field == 'nd_aerosol_mode') then - dimen%nd_aerosol_mode = val - else if (field == 'nd_profile_aerosol_prsc') then - dimen%nd_profile_aerosol_prsc = val - else if (field == 'nd_profile_cloud_prsc') then - dimen%nd_profile_cloud_prsc = val - else if (field == 'nd_opt_level_aerosol_prsc') then - dimen%nd_opt_level_aerosol_prsc = val - else if (field == 'nd_opt_level_cloud_prsc') then - dimen%nd_opt_level_cloud_prsc = val - else if (field == 'nd_phf_term_aerosol_prsc') then - dimen%nd_phf_term_aerosol_prsc = val - else if (field == 'nd_phf_term_cloud_prsc') then - dimen%nd_phf_term_cloud_prsc = val - else if (field == 'nd_cloud_component') then - dimen%nd_cloud_component = val - else if (field == 'nd_cloud_type') then - dimen%nd_cloud_type = val - else if (field == 'nd_cloud_representation') then - dimen%nd_cloud_representation = val - else if (field == 'nd_column') then - dimen%nd_column = val - else if (field == 'nd_subcol_gen') then - dimen%nd_subcol_gen = val - else if (field == 'nd_subcol_req') then - dimen%nd_subcol_req = val - else if (field == 'nd_overlap_coeff') then - dimen%nd_overlap_coeff = val - else if (field == 'nd_source_coeff') then - dimen%nd_source_coeff = val - else if (field == 'nd_region') then - dimen%nd_region = val - else if (field == 'nd_point_tile') then - dimen%nd_point_tile = val - else if (field == 'nd_tile') then - dimen%nd_tile = val - else if (field == 'nd_k_term_inner') then - dimen%nd_k_term_inner = val - else - field_OK = .FALSE. - end if - - end function StrDim_set_integer - -end module StrDim_C diff --git a/julia/gen/StrDim_JL.jl b/julia/gen/StrDim_JL.jl deleted file mode 100644 index 43cb3c2..0000000 --- a/julia/gen/StrDim_JL.jl +++ /dev/null @@ -1,196 +0,0 @@ -# Autogenerated from src/radiance_core/def_dimen.F90 -# svn revision 1226 - - - mutable struct StrDim - cptr::Ptr{Cvoid} - - function StrDim() - handle = new(ccall((:PS_create_StrDim, libSOCRATES_C), Ptr{Cvoid}, ())) - finalizer(delete_StrDim, handle) - return handle - end - end - - function delete_StrDim(handle::StrDim) - if getfield(handle, :cptr) == Ptr{Cvoid}() - ccall(:jl_safe_printf, Cvoid, (Cstring, ), "error: delete_StrDim attempt to delete null pointer") - else - ccall((:PS_delete_StrDim, libSOCRATES_C), Cvoid, (Ptr{Cvoid},), getfield(handle, :cptr)) - setfield!(handle, :cptr, Ptr{Cvoid}()) - end - return nothing - end - - - # this is used to show values in the REPL and when using IJulia - function Base.show(io::IO, m::MIME"text/plain", handle::StrDim) - println(io, handle) - dump_properties(io, handle) - end - - - function Base.propertynames(handle::StrDim, private::Bool=false) - names = [ - :nd_profile, - :nd_layer, - :nd_layer_clr, - :id_cloud_top, - :nd_2sg_profile, - :nd_flux_profile, - :nd_radiance_profile, - :nd_j_profile, - :nd_channel, - :nd_max_order, - :nd_direction, - :nd_viewing_level, - :nd_sph_coeff, - :nd_brdf_basis_fnc, - :nd_brdf_trunc, - :nd_tile_type, - :nd_aerosol_mode, - :nd_profile_aerosol_prsc, - :nd_profile_cloud_prsc, - :nd_opt_level_aerosol_prsc, - :nd_opt_level_cloud_prsc, - :nd_phf_term_aerosol_prsc, - :nd_phf_term_cloud_prsc, - :nd_cloud_component, - :nd_cloud_type, - :nd_cloud_representation, - :nd_column, - :nd_subcol_gen, - :nd_subcol_req, - :nd_overlap_coeff, - :nd_source_coeff, - :nd_region, - :nd_point_tile, - :nd_tile, - :nd_k_term_inner, - ] - - return names - end - - - function Base.getproperty(handle::StrDim, field::Symbol) - - - cptr = getfield(handle, :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - - if field == :cptr - return cptr - - elseif field in ( - :nd_profile, - :nd_layer, - :nd_layer_clr, - :id_cloud_top, - :nd_2sg_profile, - :nd_flux_profile, - :nd_radiance_profile, - :nd_j_profile, - :nd_channel, - :nd_max_order, - :nd_direction, - :nd_viewing_level, - :nd_sph_coeff, - :nd_brdf_basis_fnc, - :nd_brdf_trunc, - :nd_tile_type, - :nd_aerosol_mode, - :nd_profile_aerosol_prsc, - :nd_profile_cloud_prsc, - :nd_opt_level_aerosol_prsc, - :nd_opt_level_cloud_prsc, - :nd_phf_term_aerosol_prsc, - :nd_phf_term_cloud_prsc, - :nd_cloud_component, - :nd_cloud_type, - :nd_cloud_representation, - :nd_column, - :nd_subcol_gen, - :nd_subcol_req, - :nd_overlap_coeff, - :nd_source_coeff, - :nd_region, - :nd_point_tile, - :nd_tile, - :nd_k_term_inner, - ) - val = Ref{Cint}() - field_ok = ccall( - (:PS_StrDim_get_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Cint}), - cptr, String(field), val - ) - Bool(field_ok) || error("StrDim integer field $field not present - coding error") - return val[] - else - return getfield(handle, field) - end - - end - - - function Base.setproperty!(handle::StrDim, field::Symbol, val) - - - cptr = getfield(handle, :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :nd_profile, - :nd_layer, - :nd_layer_clr, - :id_cloud_top, - :nd_2sg_profile, - :nd_flux_profile, - :nd_radiance_profile, - :nd_j_profile, - :nd_channel, - :nd_max_order, - :nd_direction, - :nd_viewing_level, - :nd_sph_coeff, - :nd_brdf_basis_fnc, - :nd_brdf_trunc, - :nd_tile_type, - :nd_aerosol_mode, - :nd_profile_aerosol_prsc, - :nd_profile_cloud_prsc, - :nd_opt_level_aerosol_prsc, - :nd_opt_level_cloud_prsc, - :nd_phf_term_aerosol_prsc, - :nd_phf_term_cloud_prsc, - :nd_cloud_component, - :nd_cloud_type, - :nd_cloud_representation, - :nd_column, - :nd_subcol_gen, - :nd_subcol_req, - :nd_overlap_coeff, - :nd_source_coeff, - :nd_region, - :nd_point_tile, - :nd_tile, - :nd_k_term_inner, - ) - - field_ok = ccall( - (:PS_StrDim_set_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Cint), - cptr, String(field), val - ) - Bool(field_ok) || error("StrDim integer field $field not present - coding error") - return val - else - error("type StrDim has no writeable field $field") - end - - end - diff --git a/julia/gen/StrOut_C.f90 b/julia/gen/StrOut_C.f90 deleted file mode 100644 index cdae9e1..0000000 --- a/julia/gen/StrOut_C.f90 +++ /dev/null @@ -1,685 +0,0 @@ -! Autogenerated from Fortran file src/radiance_core/def_out.F90 -! svn revision 1226 - -module StrOut_C - -use, intrinsic :: iso_c_binding - -use UTILITIES_CF -use def_out - -implicit none - -private - -contains - - function create_StrOut() result(radout_Cptr) & - bind(C, NAME='PS_create_StrOut') - - implicit none - type(c_ptr) :: radout_Cptr - - TYPE(StrOut), pointer :: radout - - ALLOCATE(radout) - - radout_Cptr = c_loc(radout) - end function create_StrOut - - subroutine delete_StrOut(radout_Cptr) & - bind(C, NAME='PS_delete_StrOut') - - implicit none - type(c_ptr), value, intent(in) :: radout_Cptr - - TYPE(StrOut), pointer :: radout - - call C_F_POINTER(radout_Cptr, radout) - - DEALLOCATE(radout) - - end subroutine delete_StrOut - - function StrOut_get_real_array(radout_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrOut_get_real_array') - - implicit none - type(c_ptr), value, intent(in) :: radout_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrOut), pointer :: radout - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(radout_Cptr, radout) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'flux_direct') then - if (allocated(radout%flux_direct)) then - loc = C_LOC(radout%flux_direct) - ndim = size(shape(radout%flux_direct)) - dims(1:ndim) = shape(radout%flux_direct) - lbounds(1:ndim) = lbound(radout%flux_direct) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_down') then - if (allocated(radout%flux_down)) then - loc = C_LOC(radout%flux_down) - ndim = size(shape(radout%flux_down)) - dims(1:ndim) = shape(radout%flux_down) - lbounds(1:ndim) = lbound(radout%flux_down) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_up') then - if (allocated(radout%flux_up)) then - loc = C_LOC(radout%flux_up) - ndim = size(shape(radout%flux_up)) - dims(1:ndim) = shape(radout%flux_up) - lbounds(1:ndim) = lbound(radout%flux_up) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_div') then - if (allocated(radout%flux_div)) then - loc = C_LOC(radout%flux_div) - ndim = size(shape(radout%flux_div)) - dims(1:ndim) = shape(radout%flux_div) - lbounds(1:ndim) = lbound(radout%flux_div) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_direct_clear') then - if (allocated(radout%flux_direct_clear)) then - loc = C_LOC(radout%flux_direct_clear) - ndim = size(shape(radout%flux_direct_clear)) - dims(1:ndim) = shape(radout%flux_direct_clear) - lbounds(1:ndim) = lbound(radout%flux_direct_clear) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_down_clear') then - if (allocated(radout%flux_down_clear)) then - loc = C_LOC(radout%flux_down_clear) - ndim = size(shape(radout%flux_down_clear)) - dims(1:ndim) = shape(radout%flux_down_clear) - lbounds(1:ndim) = lbound(radout%flux_down_clear) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_up_clear') then - if (allocated(radout%flux_up_clear)) then - loc = C_LOC(radout%flux_up_clear) - ndim = size(shape(radout%flux_up_clear)) - dims(1:ndim) = shape(radout%flux_up_clear) - lbounds(1:ndim) = lbound(radout%flux_up_clear) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_div_clear') then - if (allocated(radout%flux_div_clear)) then - loc = C_LOC(radout%flux_div_clear) - ndim = size(shape(radout%flux_div_clear)) - dims(1:ndim) = shape(radout%flux_div_clear) - lbounds(1:ndim) = lbound(radout%flux_div_clear) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_direct_div') then - if (allocated(radout%flux_direct_div)) then - loc = C_LOC(radout%flux_direct_div) - ndim = size(shape(radout%flux_direct_div)) - dims(1:ndim) = shape(radout%flux_direct_div) - lbounds(1:ndim) = lbound(radout%flux_direct_div) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_direct_sph') then - if (allocated(radout%flux_direct_sph)) then - loc = C_LOC(radout%flux_direct_sph) - ndim = size(shape(radout%flux_direct_sph)) - dims(1:ndim) = shape(radout%flux_direct_sph) - lbounds(1:ndim) = lbound(radout%flux_direct_sph) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_direct_clear_div') then - if (allocated(radout%flux_direct_clear_div)) then - loc = C_LOC(radout%flux_direct_clear_div) - ndim = size(shape(radout%flux_direct_clear_div)) - dims(1:ndim) = shape(radout%flux_direct_clear_div) - lbounds(1:ndim) = lbound(radout%flux_direct_clear_div) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_direct_clear_sph') then - if (allocated(radout%flux_direct_clear_sph)) then - loc = C_LOC(radout%flux_direct_clear_sph) - ndim = size(shape(radout%flux_direct_clear_sph)) - dims(1:ndim) = shape(radout%flux_direct_clear_sph) - lbounds(1:ndim) = lbound(radout%flux_direct_clear_sph) - else - loc = C_NULL_PTR - end if - - else if (field == 'radiance') then - if (allocated(radout%radiance)) then - loc = C_LOC(radout%radiance) - ndim = size(shape(radout%radiance)) - dims(1:ndim) = shape(radout%radiance) - lbounds(1:ndim) = lbound(radout%radiance) - else - loc = C_NULL_PTR - end if - - else if (field == 'photolysis') then - if (allocated(radout%photolysis)) then - loc = C_LOC(radout%photolysis) - ndim = size(shape(radout%photolysis)) - dims(1:ndim) = shape(radout%photolysis) - lbounds(1:ndim) = lbound(radout%photolysis) - else - loc = C_NULL_PTR - end if - - else if (field == 'solar_tail_flux') then - if (allocated(radout%solar_tail_flux)) then - loc = C_LOC(radout%solar_tail_flux) - ndim = size(shape(radout%solar_tail_flux)) - dims(1:ndim) = shape(radout%solar_tail_flux) - lbounds(1:ndim) = lbound(radout%solar_tail_flux) - else - loc = C_NULL_PTR - end if - - else if (field == 'contrib_funci') then - if (allocated(radout%contrib_funci)) then - loc = C_LOC(radout%contrib_funci) - ndim = size(shape(radout%contrib_funci)) - dims(1:ndim) = shape(radout%contrib_funci) - lbounds(1:ndim) = lbound(radout%contrib_funci) - else - loc = C_NULL_PTR - end if - - else if (field == 'contrib_funcf') then - if (allocated(radout%contrib_funcf)) then - loc = C_LOC(radout%contrib_funcf) - ndim = size(shape(radout%contrib_funcf)) - dims(1:ndim) = shape(radout%contrib_funcf) - lbounds(1:ndim) = lbound(radout%contrib_funcf) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_up_tile') then - if (allocated(radout%flux_up_tile)) then - loc = C_LOC(radout%flux_up_tile) - ndim = size(shape(radout%flux_up_tile)) - dims(1:ndim) = shape(radout%flux_up_tile) - lbounds(1:ndim) = lbound(radout%flux_up_tile) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_up_blue_tile') then - if (allocated(radout%flux_up_blue_tile)) then - loc = C_LOC(radout%flux_up_blue_tile) - ndim = size(shape(radout%flux_up_blue_tile)) - dims(1:ndim) = shape(radout%flux_up_blue_tile) - lbounds(1:ndim) = lbound(radout%flux_up_blue_tile) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_direct_blue_surf') then - if (allocated(radout%flux_direct_blue_surf)) then - loc = C_LOC(radout%flux_direct_blue_surf) - ndim = size(shape(radout%flux_direct_blue_surf)) - dims(1:ndim) = shape(radout%flux_direct_blue_surf) - lbounds(1:ndim) = lbound(radout%flux_direct_blue_surf) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_down_blue_surf') then - if (allocated(radout%flux_down_blue_surf)) then - loc = C_LOC(radout%flux_down_blue_surf) - ndim = size(shape(radout%flux_down_blue_surf)) - dims(1:ndim) = shape(radout%flux_down_blue_surf) - lbounds(1:ndim) = lbound(radout%flux_down_blue_surf) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_up_blue_surf') then - if (allocated(radout%flux_up_blue_surf)) then - loc = C_LOC(radout%flux_up_blue_surf) - ndim = size(shape(radout%flux_up_blue_surf)) - dims(1:ndim) = shape(radout%flux_up_blue_surf) - lbounds(1:ndim) = lbound(radout%flux_up_blue_surf) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_direct_band') then - if (allocated(radout%flux_direct_band)) then - loc = C_LOC(radout%flux_direct_band) - ndim = size(shape(radout%flux_direct_band)) - dims(1:ndim) = shape(radout%flux_direct_band) - lbounds(1:ndim) = lbound(radout%flux_direct_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_direct_div_band') then - if (allocated(radout%flux_direct_div_band)) then - loc = C_LOC(radout%flux_direct_div_band) - ndim = size(shape(radout%flux_direct_div_band)) - dims(1:ndim) = shape(radout%flux_direct_div_band) - lbounds(1:ndim) = lbound(radout%flux_direct_div_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_direct_sph_band') then - if (allocated(radout%flux_direct_sph_band)) then - loc = C_LOC(radout%flux_direct_sph_band) - ndim = size(shape(radout%flux_direct_sph_band)) - dims(1:ndim) = shape(radout%flux_direct_sph_band) - lbounds(1:ndim) = lbound(radout%flux_direct_sph_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_down_band') then - if (allocated(radout%flux_down_band)) then - loc = C_LOC(radout%flux_down_band) - ndim = size(shape(radout%flux_down_band)) - dims(1:ndim) = shape(radout%flux_down_band) - lbounds(1:ndim) = lbound(radout%flux_down_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_up_band') then - if (allocated(radout%flux_up_band)) then - loc = C_LOC(radout%flux_up_band) - ndim = size(shape(radout%flux_up_band)) - dims(1:ndim) = shape(radout%flux_up_band) - lbounds(1:ndim) = lbound(radout%flux_up_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_div_band') then - if (allocated(radout%flux_div_band)) then - loc = C_LOC(radout%flux_div_band) - ndim = size(shape(radout%flux_div_band)) - dims(1:ndim) = shape(radout%flux_div_band) - lbounds(1:ndim) = lbound(radout%flux_div_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_direct_clear_band') then - if (allocated(radout%flux_direct_clear_band)) then - loc = C_LOC(radout%flux_direct_clear_band) - ndim = size(shape(radout%flux_direct_clear_band)) - dims(1:ndim) = shape(radout%flux_direct_clear_band) - lbounds(1:ndim) = lbound(radout%flux_direct_clear_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_direct_clear_div_band') then - if (allocated(radout%flux_direct_clear_div_band)) then - loc = C_LOC(radout%flux_direct_clear_div_band) - ndim = size(shape(radout%flux_direct_clear_div_band)) - dims(1:ndim) = shape(radout%flux_direct_clear_div_band) - lbounds(1:ndim) = lbound(radout%flux_direct_clear_div_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_direct_clear_sph_band') then - if (allocated(radout%flux_direct_clear_sph_band)) then - loc = C_LOC(radout%flux_direct_clear_sph_band) - ndim = size(shape(radout%flux_direct_clear_sph_band)) - dims(1:ndim) = shape(radout%flux_direct_clear_sph_band) - lbounds(1:ndim) = lbound(radout%flux_direct_clear_sph_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_down_clear_band') then - if (allocated(radout%flux_down_clear_band)) then - loc = C_LOC(radout%flux_down_clear_band) - ndim = size(shape(radout%flux_down_clear_band)) - dims(1:ndim) = shape(radout%flux_down_clear_band) - lbounds(1:ndim) = lbound(radout%flux_down_clear_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_up_clear_band') then - if (allocated(radout%flux_up_clear_band)) then - loc = C_LOC(radout%flux_up_clear_band) - ndim = size(shape(radout%flux_up_clear_band)) - dims(1:ndim) = shape(radout%flux_up_clear_band) - lbounds(1:ndim) = lbound(radout%flux_up_clear_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'flux_div_clear_band') then - if (allocated(radout%flux_div_clear_band)) then - loc = C_LOC(radout%flux_div_clear_band) - ndim = size(shape(radout%flux_div_clear_band)) - dims(1:ndim) = shape(radout%flux_div_clear_band) - lbounds(1:ndim) = lbound(radout%flux_div_clear_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'contrib_funci_band') then - if (allocated(radout%contrib_funci_band)) then - loc = C_LOC(radout%contrib_funci_band) - ndim = size(shape(radout%contrib_funci_band)) - dims(1:ndim) = shape(radout%contrib_funci_band) - lbounds(1:ndim) = lbound(radout%contrib_funci_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'contrib_funcf_band') then - if (allocated(radout%contrib_funcf_band)) then - loc = C_LOC(radout%contrib_funcf_band) - ndim = size(shape(radout%contrib_funcf_band)) - dims(1:ndim) = shape(radout%contrib_funcf_band) - lbounds(1:ndim) = lbound(radout%contrib_funcf_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'actinic_flux') then - if (allocated(radout%actinic_flux)) then - loc = C_LOC(radout%actinic_flux) - ndim = size(shape(radout%actinic_flux)) - dims(1:ndim) = shape(radout%actinic_flux) - lbounds(1:ndim) = lbound(radout%actinic_flux) - else - loc = C_NULL_PTR - end if - - else if (field == 'actinic_flux_clear') then - if (allocated(radout%actinic_flux_clear)) then - loc = C_LOC(radout%actinic_flux_clear) - ndim = size(shape(radout%actinic_flux_clear)) - dims(1:ndim) = shape(radout%actinic_flux_clear) - lbounds(1:ndim) = lbound(radout%actinic_flux_clear) - else - loc = C_NULL_PTR - end if - - else if (field == 'actinic_flux_band') then - if (allocated(radout%actinic_flux_band)) then - loc = C_LOC(radout%actinic_flux_band) - ndim = size(shape(radout%actinic_flux_band)) - dims(1:ndim) = shape(radout%actinic_flux_band) - lbounds(1:ndim) = lbound(radout%actinic_flux_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'actinic_flux_clear_band') then - if (allocated(radout%actinic_flux_clear_band)) then - loc = C_LOC(radout%actinic_flux_clear_band) - ndim = size(shape(radout%actinic_flux_clear_band)) - dims(1:ndim) = shape(radout%actinic_flux_clear_band) - lbounds(1:ndim) = lbound(radout%actinic_flux_clear_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'photolysis_rate') then - if (allocated(radout%photolysis_rate)) then - loc = C_LOC(radout%photolysis_rate) - ndim = size(shape(radout%photolysis_rate)) - dims(1:ndim) = shape(radout%photolysis_rate) - lbounds(1:ndim) = lbound(radout%photolysis_rate) - else - loc = C_NULL_PTR - end if - - else if (field == 'photolysis_rate_clear') then - if (allocated(radout%photolysis_rate_clear)) then - loc = C_LOC(radout%photolysis_rate_clear) - ndim = size(shape(radout%photolysis_rate_clear)) - dims(1:ndim) = shape(radout%photolysis_rate_clear) - lbounds(1:ndim) = lbound(radout%photolysis_rate_clear) - else - loc = C_NULL_PTR - end if - - else if (field == 'photolysis_div') then - if (allocated(radout%photolysis_div)) then - loc = C_LOC(radout%photolysis_div) - ndim = size(shape(radout%photolysis_div)) - dims(1:ndim) = shape(radout%photolysis_div) - lbounds(1:ndim) = lbound(radout%photolysis_div) - else - loc = C_NULL_PTR - end if - - else if (field == 'photolysis_div_clear') then - if (allocated(radout%photolysis_div_clear)) then - loc = C_LOC(radout%photolysis_div_clear) - ndim = size(shape(radout%photolysis_div_clear)) - dims(1:ndim) = shape(radout%photolysis_div_clear) - lbounds(1:ndim) = lbound(radout%photolysis_div_clear) - else - loc = C_NULL_PTR - end if - - else if (field == 'tot_cloud_cover') then - if (allocated(radout%tot_cloud_cover)) then - loc = C_LOC(radout%tot_cloud_cover) - ndim = size(shape(radout%tot_cloud_cover)) - dims(1:ndim) = shape(radout%tot_cloud_cover) - lbounds(1:ndim) = lbound(radout%tot_cloud_cover) - else - loc = C_NULL_PTR - end if - - else if (field == 'cloud_absorptivity') then - if (allocated(radout%cloud_absorptivity)) then - loc = C_LOC(radout%cloud_absorptivity) - ndim = size(shape(radout%cloud_absorptivity)) - dims(1:ndim) = shape(radout%cloud_absorptivity) - lbounds(1:ndim) = lbound(radout%cloud_absorptivity) - else - loc = C_NULL_PTR - end if - - else if (field == 'cloud_weight_absorptivity') then - if (allocated(radout%cloud_weight_absorptivity)) then - loc = C_LOC(radout%cloud_weight_absorptivity) - ndim = size(shape(radout%cloud_weight_absorptivity)) - dims(1:ndim) = shape(radout%cloud_weight_absorptivity) - lbounds(1:ndim) = lbound(radout%cloud_weight_absorptivity) - else - loc = C_NULL_PTR - end if - - else if (field == 'ls_cloud_absorptivity') then - if (allocated(radout%ls_cloud_absorptivity)) then - loc = C_LOC(radout%ls_cloud_absorptivity) - ndim = size(shape(radout%ls_cloud_absorptivity)) - dims(1:ndim) = shape(radout%ls_cloud_absorptivity) - lbounds(1:ndim) = lbound(radout%ls_cloud_absorptivity) - else - loc = C_NULL_PTR - end if - - else if (field == 'ls_cloud_weight_absorptivity') then - if (allocated(radout%ls_cloud_weight_absorptivity)) then - loc = C_LOC(radout%ls_cloud_weight_absorptivity) - ndim = size(shape(radout%ls_cloud_weight_absorptivity)) - dims(1:ndim) = shape(radout%ls_cloud_weight_absorptivity) - lbounds(1:ndim) = lbound(radout%ls_cloud_weight_absorptivity) - else - loc = C_NULL_PTR - end if - - else if (field == 'cnv_cloud_absorptivity') then - if (allocated(radout%cnv_cloud_absorptivity)) then - loc = C_LOC(radout%cnv_cloud_absorptivity) - ndim = size(shape(radout%cnv_cloud_absorptivity)) - dims(1:ndim) = shape(radout%cnv_cloud_absorptivity) - lbounds(1:ndim) = lbound(radout%cnv_cloud_absorptivity) - else - loc = C_NULL_PTR - end if - - else if (field == 'cnv_cloud_weight_absorptivity') then - if (allocated(radout%cnv_cloud_weight_absorptivity)) then - loc = C_LOC(radout%cnv_cloud_weight_absorptivity) - ndim = size(shape(radout%cnv_cloud_weight_absorptivity)) - dims(1:ndim) = shape(radout%cnv_cloud_weight_absorptivity) - lbounds(1:ndim) = lbound(radout%cnv_cloud_weight_absorptivity) - else - loc = C_NULL_PTR - end if - - else if (field == 'cloud_extinction') then - if (allocated(radout%cloud_extinction)) then - loc = C_LOC(radout%cloud_extinction) - ndim = size(shape(radout%cloud_extinction)) - dims(1:ndim) = shape(radout%cloud_extinction) - lbounds(1:ndim) = lbound(radout%cloud_extinction) - else - loc = C_NULL_PTR - end if - - else if (field == 'cloud_weight_extinction') then - if (allocated(radout%cloud_weight_extinction)) then - loc = C_LOC(radout%cloud_weight_extinction) - ndim = size(shape(radout%cloud_weight_extinction)) - dims(1:ndim) = shape(radout%cloud_weight_extinction) - lbounds(1:ndim) = lbound(radout%cloud_weight_extinction) - else - loc = C_NULL_PTR - end if - - else if (field == 'ls_cloud_extinction') then - if (allocated(radout%ls_cloud_extinction)) then - loc = C_LOC(radout%ls_cloud_extinction) - ndim = size(shape(radout%ls_cloud_extinction)) - dims(1:ndim) = shape(radout%ls_cloud_extinction) - lbounds(1:ndim) = lbound(radout%ls_cloud_extinction) - else - loc = C_NULL_PTR - end if - - else if (field == 'ls_cloud_weight_extinction') then - if (allocated(radout%ls_cloud_weight_extinction)) then - loc = C_LOC(radout%ls_cloud_weight_extinction) - ndim = size(shape(radout%ls_cloud_weight_extinction)) - dims(1:ndim) = shape(radout%ls_cloud_weight_extinction) - lbounds(1:ndim) = lbound(radout%ls_cloud_weight_extinction) - else - loc = C_NULL_PTR - end if - - else if (field == 'cnv_cloud_extinction') then - if (allocated(radout%cnv_cloud_extinction)) then - loc = C_LOC(radout%cnv_cloud_extinction) - ndim = size(shape(radout%cnv_cloud_extinction)) - dims(1:ndim) = shape(radout%cnv_cloud_extinction) - lbounds(1:ndim) = lbound(radout%cnv_cloud_extinction) - else - loc = C_NULL_PTR - end if - - else if (field == 'cnv_cloud_weight_extinction') then - if (allocated(radout%cnv_cloud_weight_extinction)) then - loc = C_LOC(radout%cnv_cloud_weight_extinction) - ndim = size(shape(radout%cnv_cloud_weight_extinction)) - dims(1:ndim) = shape(radout%cnv_cloud_weight_extinction) - lbounds(1:ndim) = lbound(radout%cnv_cloud_weight_extinction) - else - loc = C_NULL_PTR - end if - - else if (field == 'aerosol_absorption_band') then - if (allocated(radout%aerosol_absorption_band)) then - loc = C_LOC(radout%aerosol_absorption_band) - ndim = size(shape(radout%aerosol_absorption_band)) - dims(1:ndim) = shape(radout%aerosol_absorption_band) - lbounds(1:ndim) = lbound(radout%aerosol_absorption_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'aerosol_scattering_band') then - if (allocated(radout%aerosol_scattering_band)) then - loc = C_LOC(radout%aerosol_scattering_band) - ndim = size(shape(radout%aerosol_scattering_band)) - dims(1:ndim) = shape(radout%aerosol_scattering_band) - lbounds(1:ndim) = lbound(radout%aerosol_scattering_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'aerosol_asymmetry_band') then - if (allocated(radout%aerosol_asymmetry_band)) then - loc = C_LOC(radout%aerosol_asymmetry_band) - ndim = size(shape(radout%aerosol_asymmetry_band)) - dims(1:ndim) = shape(radout%aerosol_asymmetry_band) - lbounds(1:ndim) = lbound(radout%aerosol_asymmetry_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'spherical_path') then - if (allocated(radout%spherical_path)) then - loc = C_LOC(radout%spherical_path) - ndim = size(shape(radout%spherical_path)) - dims(1:ndim) = shape(radout%spherical_path) - lbounds(1:ndim) = lbound(radout%spherical_path) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrOut_get_real_array - -end module StrOut_C diff --git a/julia/gen/StrOut_JL.jl b/julia/gen/StrOut_JL.jl deleted file mode 100644 index a054fc8..0000000 --- a/julia/gen/StrOut_JL.jl +++ /dev/null @@ -1,209 +0,0 @@ -# Autogenerated from src/radiance_core/def_out.F90 -# svn revision 1226 - - - mutable struct StrOut - cptr::Ptr{Cvoid} - - function StrOut() - handle = new(ccall((:PS_create_StrOut, libSOCRATES_C), Ptr{Cvoid}, ())) - finalizer(delete_StrOut, handle) - return handle - end - end - - function delete_StrOut(handle::StrOut) - if getfield(handle, :cptr) == Ptr{Cvoid}() - ccall(:jl_safe_printf, Cvoid, (Cstring, ), "error: delete_StrOut attempt to delete null pointer") - else - ccall((:PS_delete_StrOut, libSOCRATES_C), Cvoid, (Ptr{Cvoid},), getfield(handle, :cptr)) - setfield!(handle, :cptr, Ptr{Cvoid}()) - end - return nothing - end - - - # this is used to show values in the REPL and when using IJulia - function Base.show(io::IO, m::MIME"text/plain", handle::StrOut) - println(io, handle) - dump_properties(io, handle) - end - - - function Base.propertynames(handle::StrOut, private::Bool=false) - names = [ - :flux_direct, - :flux_down, - :flux_up, - :flux_div, - :flux_direct_clear, - :flux_down_clear, - :flux_up_clear, - :flux_div_clear, - :flux_direct_div, - :flux_direct_sph, - :flux_direct_clear_div, - :flux_direct_clear_sph, - :radiance, - :photolysis, - :solar_tail_flux, - :contrib_funci, - :contrib_funcf, - :flux_up_tile, - :flux_up_blue_tile, - :flux_direct_blue_surf, - :flux_down_blue_surf, - :flux_up_blue_surf, - :flux_direct_band, - :flux_direct_div_band, - :flux_direct_sph_band, - :flux_down_band, - :flux_up_band, - :flux_div_band, - :flux_direct_clear_band, - :flux_direct_clear_div_band, - :flux_direct_clear_sph_band, - :flux_down_clear_band, - :flux_up_clear_band, - :flux_div_clear_band, - :contrib_funci_band, - :contrib_funcf_band, - :actinic_flux, - :actinic_flux_clear, - :actinic_flux_band, - :actinic_flux_clear_band, - :photolysis_rate, - :photolysis_rate_clear, - :photolysis_div, - :photolysis_div_clear, - :tot_cloud_cover, - :cloud_absorptivity, - :cloud_weight_absorptivity, - :ls_cloud_absorptivity, - :ls_cloud_weight_absorptivity, - :cnv_cloud_absorptivity, - :cnv_cloud_weight_absorptivity, - :cloud_extinction, - :cloud_weight_extinction, - :ls_cloud_extinction, - :ls_cloud_weight_extinction, - :cnv_cloud_extinction, - :cnv_cloud_weight_extinction, - :aerosol_absorption_band, - :aerosol_scattering_band, - :aerosol_asymmetry_band, - :spherical_path, - ] - - return names - end - - - function Base.getproperty(handle::StrOut, field::Symbol) - - - cptr = getfield(handle, :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - - if field == :cptr - return cptr - - elseif field in ( - :flux_direct, - :flux_down, - :flux_up, - :flux_div, - :flux_direct_clear, - :flux_down_clear, - :flux_up_clear, - :flux_div_clear, - :flux_direct_div, - :flux_direct_sph, - :flux_direct_clear_div, - :flux_direct_clear_sph, - :radiance, - :photolysis, - :solar_tail_flux, - :contrib_funci, - :contrib_funcf, - :flux_up_tile, - :flux_up_blue_tile, - :flux_direct_blue_surf, - :flux_down_blue_surf, - :flux_up_blue_surf, - :flux_direct_band, - :flux_direct_div_band, - :flux_direct_sph_band, - :flux_down_band, - :flux_up_band, - :flux_div_band, - :flux_direct_clear_band, - :flux_direct_clear_div_band, - :flux_direct_clear_sph_band, - :flux_down_clear_band, - :flux_up_clear_band, - :flux_div_clear_band, - :contrib_funci_band, - :contrib_funcf_band, - :actinic_flux, - :actinic_flux_clear, - :actinic_flux_band, - :actinic_flux_clear_band, - :photolysis_rate, - :photolysis_rate_clear, - :photolysis_div, - :photolysis_div_clear, - :tot_cloud_cover, - :cloud_absorptivity, - :cloud_weight_absorptivity, - :ls_cloud_absorptivity, - :ls_cloud_weight_absorptivity, - :cnv_cloud_absorptivity, - :cnv_cloud_weight_absorptivity, - :cloud_extinction, - :cloud_weight_extinction, - :ls_cloud_extinction, - :ls_cloud_weight_extinction, - :cnv_cloud_extinction, - :cnv_cloud_weight_extinction, - :aerosol_absorption_band, - :aerosol_scattering_band, - :aerosol_asymmetry_band, - :spherical_path, - ) - loc = Ref{Ptr{Cdouble}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrOut_get_real_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cdouble}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrOut Cdouble array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - else - return getfield(handle, field) - end - - end - - - function Base.setproperty!(handle::StrOut, field::Symbol, val) - - - cptr = getfield(handle, :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - error("type StrOut has no writeable field $field") - - end - diff --git a/julia/gen/StrSpecDataAerosol_C.f90 b/julia/gen/StrSpecDataAerosol_C.f90 deleted file mode 100644 index 169a27e..0000000 --- a/julia/gen/StrSpecDataAerosol_C.f90 +++ /dev/null @@ -1,302 +0,0 @@ -! Autogenerated from Fortran file src/radiance_core/def_spectrum.F90 -! svn revision 1226 - -module StrSpecDataAerosol_C - -use, intrinsic :: iso_c_binding - -use UTILITIES_CF -use def_spectrum - -implicit none - -private - -contains - - function StrSpecDataAerosol_get_integer(spectrum_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrSpecDataAerosol_get_integer') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), intent(out) :: val - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'n_aerosol') then - val = spectrum%Aerosol%n_aerosol - else if (field == 'n_aerosol_mr') then - val = spectrum%Aerosol%n_aerosol_mr - else if (field == 'n_aod_wavel') then - val = spectrum%Aerosol%n_aod_wavel - else - field_OK = .FALSE. - end if - - end function StrSpecDataAerosol_get_integer - - function StrSpecDataAerosol_set_integer(spectrum_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrSpecDataAerosol_set_integer') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), value, intent(in) :: val - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'n_aerosol') then - spectrum%Aerosol%n_aerosol = val - else if (field == 'n_aerosol_mr') then - spectrum%Aerosol%n_aerosol_mr = val - else if (field == 'n_aod_wavel') then - spectrum%Aerosol%n_aod_wavel = val - else - field_OK = .FALSE. - end if - - end function StrSpecDataAerosol_set_integer - - function StrSpecDataAerosol_get_logical_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataAerosol_get_logical_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'l_aero_spec') then - if (allocated(spectrum%Aerosol%l_aero_spec)) then - loc = C_LOC(spectrum%Aerosol%l_aero_spec) - ndim = size(shape(spectrum%Aerosol%l_aero_spec)) - dims(1:ndim) = shape(spectrum%Aerosol%l_aero_spec) - lbounds(1:ndim) = lbound(spectrum%Aerosol%l_aero_spec) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataAerosol_get_logical_array - - function StrSpecDataAerosol_get_integer_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataAerosol_get_integer_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'type_aerosol') then - if (allocated(spectrum%Aerosol%type_aerosol)) then - loc = C_LOC(spectrum%Aerosol%type_aerosol) - ndim = size(shape(spectrum%Aerosol%type_aerosol)) - dims(1:ndim) = shape(spectrum%Aerosol%type_aerosol) - lbounds(1:ndim) = lbound(spectrum%Aerosol%type_aerosol) - else - loc = C_NULL_PTR - end if - - else if (field == 'i_aerosol_parm') then - if (allocated(spectrum%Aerosol%i_aerosol_parm)) then - loc = C_LOC(spectrum%Aerosol%i_aerosol_parm) - ndim = size(shape(spectrum%Aerosol%i_aerosol_parm)) - dims(1:ndim) = shape(spectrum%Aerosol%i_aerosol_parm) - lbounds(1:ndim) = lbound(spectrum%Aerosol%i_aerosol_parm) - else - loc = C_NULL_PTR - end if - - else if (field == 'n_aerosol_phf_term') then - if (allocated(spectrum%Aerosol%n_aerosol_phf_term)) then - loc = C_LOC(spectrum%Aerosol%n_aerosol_phf_term) - ndim = size(shape(spectrum%Aerosol%n_aerosol_phf_term)) - dims(1:ndim) = shape(spectrum%Aerosol%n_aerosol_phf_term) - lbounds(1:ndim) = lbound(spectrum%Aerosol%n_aerosol_phf_term) - else - loc = C_NULL_PTR - end if - - else if (field == 'nhumidity') then - if (allocated(spectrum%Aerosol%nhumidity)) then - loc = C_LOC(spectrum%Aerosol%nhumidity) - ndim = size(shape(spectrum%Aerosol%nhumidity)) - dims(1:ndim) = shape(spectrum%Aerosol%nhumidity) - lbounds(1:ndim) = lbound(spectrum%Aerosol%nhumidity) - else - loc = C_NULL_PTR - end if - - else if (field == 'i_aod_type') then - if (allocated(spectrum%Aerosol%i_aod_type)) then - loc = C_LOC(spectrum%Aerosol%i_aod_type) - ndim = size(shape(spectrum%Aerosol%i_aod_type)) - dims(1:ndim) = shape(spectrum%Aerosol%i_aod_type) - lbounds(1:ndim) = lbound(spectrum%Aerosol%i_aod_type) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataAerosol_get_integer_array - - function StrSpecDataAerosol_get_real_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataAerosol_get_real_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'abs') then - if (allocated(spectrum%Aerosol%abs)) then - loc = C_LOC(spectrum%Aerosol%abs) - ndim = size(shape(spectrum%Aerosol%abs)) - dims(1:ndim) = shape(spectrum%Aerosol%abs) - lbounds(1:ndim) = lbound(spectrum%Aerosol%abs) - else - loc = C_NULL_PTR - end if - - else if (field == 'scat') then - if (allocated(spectrum%Aerosol%scat)) then - loc = C_LOC(spectrum%Aerosol%scat) - ndim = size(shape(spectrum%Aerosol%scat)) - dims(1:ndim) = shape(spectrum%Aerosol%scat) - lbounds(1:ndim) = lbound(spectrum%Aerosol%scat) - else - loc = C_NULL_PTR - end if - - else if (field == 'phf_fnc') then - if (allocated(spectrum%Aerosol%phf_fnc)) then - loc = C_LOC(spectrum%Aerosol%phf_fnc) - ndim = size(shape(spectrum%Aerosol%phf_fnc)) - dims(1:ndim) = shape(spectrum%Aerosol%phf_fnc) - lbounds(1:ndim) = lbound(spectrum%Aerosol%phf_fnc) - else - loc = C_NULL_PTR - end if - - else if (field == 'humidities') then - if (allocated(spectrum%Aerosol%humidities)) then - loc = C_LOC(spectrum%Aerosol%humidities) - ndim = size(shape(spectrum%Aerosol%humidities)) - dims(1:ndim) = shape(spectrum%Aerosol%humidities) - lbounds(1:ndim) = lbound(spectrum%Aerosol%humidities) - else - loc = C_NULL_PTR - end if - - else if (field == 'aod_wavel') then - if (allocated(spectrum%Aerosol%aod_wavel)) then - loc = C_LOC(spectrum%Aerosol%aod_wavel) - ndim = size(shape(spectrum%Aerosol%aod_wavel)) - dims(1:ndim) = shape(spectrum%Aerosol%aod_wavel) - lbounds(1:ndim) = lbound(spectrum%Aerosol%aod_wavel) - else - loc = C_NULL_PTR - end if - - else if (field == 'aod_abs') then - if (allocated(spectrum%Aerosol%aod_abs)) then - loc = C_LOC(spectrum%Aerosol%aod_abs) - ndim = size(shape(spectrum%Aerosol%aod_abs)) - dims(1:ndim) = shape(spectrum%Aerosol%aod_abs) - lbounds(1:ndim) = lbound(spectrum%Aerosol%aod_abs) - else - loc = C_NULL_PTR - end if - - else if (field == 'aod_scat') then - if (allocated(spectrum%Aerosol%aod_scat)) then - loc = C_LOC(spectrum%Aerosol%aod_scat) - ndim = size(shape(spectrum%Aerosol%aod_scat)) - dims(1:ndim) = shape(spectrum%Aerosol%aod_scat) - lbounds(1:ndim) = lbound(spectrum%Aerosol%aod_scat) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataAerosol_get_real_array - -end module StrSpecDataAerosol_C diff --git a/julia/gen/StrSpecDataAerosol_JL.jl b/julia/gen/StrSpecDataAerosol_JL.jl deleted file mode 100644 index 1168107..0000000 --- a/julia/gen/StrSpecDataAerosol_JL.jl +++ /dev/null @@ -1,166 +0,0 @@ -# Autogenerated from src/radiance_core/def_spectrum.F90 -# svn revision 1226 - - - mutable struct StrSpecDataAerosol{P} - parent_handle::P - end - - - # this is used to show values in the REPL and when using IJulia - function Base.show(io::IO, m::MIME"text/plain", handle::StrSpecDataAerosol) - println(io, handle) - dump_properties(io, handle) - end - - - function Base.propertynames(handle::StrSpecDataAerosol, private::Bool=false) - names = [ - :l_aero_spec, - :n_aerosol, - :n_aerosol_mr, - :type_aerosol, - :i_aerosol_parm, - :n_aerosol_phf_term, - :nhumidity, - :abs, - :scat, - :phf_fnc, - :humidities, - :n_aod_wavel, - :i_aod_type, - :aod_wavel, - :aod_abs, - :aod_scat, - ] - - return names - end - - - function Base.getproperty(handle::StrSpecDataAerosol, field::Symbol) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :n_aerosol, - :n_aerosol_mr, - :n_aod_wavel, - ) - val = Ref{Cint}() - field_ok = ccall( - (:PS_StrSpecDataAerosol_get_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Cint}), - cptr, String(field), val - ) - Bool(field_ok) || error("StrSpecDataAerosol integer field $field not present - coding error") - return val[] - elseif field in ( - :l_aero_spec, - ) - loc = Ref{Ptr{Cint}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataAerosol_get_logical_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cint}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataAerosol Cint array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - elseif field in ( - :type_aerosol, - :i_aerosol_parm, - :n_aerosol_phf_term, - :nhumidity, - :i_aod_type, - ) - loc = Ref{Ptr{Cint}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataAerosol_get_integer_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cint}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataAerosol Cint array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - elseif field in ( - :abs, - :scat, - :phf_fnc, - :humidities, - :aod_wavel, - :aod_abs, - :aod_scat, - ) - loc = Ref{Ptr{Cdouble}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataAerosol_get_real_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cdouble}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataAerosol Cdouble array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - else - return getfield(handle, field) - end - - end - - - function Base.setproperty!(handle::StrSpecDataAerosol, field::Symbol, val) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :n_aerosol, - :n_aerosol_mr, - :n_aod_wavel, - ) - - field_ok = ccall( - (:PS_StrSpecDataAerosol_set_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Cint), - cptr, String(field), val - ) - Bool(field_ok) || error("StrSpecDataAerosol integer field $field not present - coding error") - return val - else - error("type StrSpecDataAerosol has no writeable field $field") - end - - end - diff --git a/julia/gen/StrSpecDataBasic_C.f90 b/julia/gen/StrSpecDataBasic_C.f90 deleted file mode 100644 index bb48c94..0000000 --- a/julia/gen/StrSpecDataBasic_C.f90 +++ /dev/null @@ -1,214 +0,0 @@ -! Autogenerated from Fortran file src/radiance_core/def_spectrum.F90 -! svn revision 1226 - -module StrSpecDataBasic_C - -use, intrinsic :: iso_c_binding - -use UTILITIES_CF -use def_spectrum - -implicit none - -private - -contains - - function StrSpecDataBasic_get_integer(spectrum_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrSpecDataBasic_get_integer') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), intent(out) :: val - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'n_band') then - val = spectrum%Basic%n_band - else - field_OK = .FALSE. - end if - - end function StrSpecDataBasic_get_integer - - function StrSpecDataBasic_set_integer(spectrum_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrSpecDataBasic_set_integer') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), value, intent(in) :: val - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'n_band') then - spectrum%Basic%n_band = val - else - field_OK = .FALSE. - end if - - end function StrSpecDataBasic_set_integer - - function StrSpecDataBasic_get_logical_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataBasic_get_logical_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'l_present') then - if (allocated(spectrum%Basic%l_present)) then - loc = C_LOC(spectrum%Basic%l_present) - ndim = size(shape(spectrum%Basic%l_present)) - dims(1:ndim) = shape(spectrum%Basic%l_present) - lbounds(1:ndim) = lbound(spectrum%Basic%l_present) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataBasic_get_logical_array - - function StrSpecDataBasic_get_integer_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataBasic_get_integer_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'n_band_exclude') then - if (allocated(spectrum%Basic%n_band_exclude)) then - loc = C_LOC(spectrum%Basic%n_band_exclude) - ndim = size(shape(spectrum%Basic%n_band_exclude)) - dims(1:ndim) = shape(spectrum%Basic%n_band_exclude) - lbounds(1:ndim) = lbound(spectrum%Basic%n_band_exclude) - else - loc = C_NULL_PTR - end if - - else if (field == 'index_exclude') then - if (allocated(spectrum%Basic%index_exclude)) then - loc = C_LOC(spectrum%Basic%index_exclude) - ndim = size(shape(spectrum%Basic%index_exclude)) - dims(1:ndim) = shape(spectrum%Basic%index_exclude) - lbounds(1:ndim) = lbound(spectrum%Basic%index_exclude) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataBasic_get_integer_array - - function StrSpecDataBasic_get_real_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataBasic_get_real_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'wavelength_long') then - if (allocated(spectrum%Basic%wavelength_long)) then - loc = C_LOC(spectrum%Basic%wavelength_long) - ndim = size(shape(spectrum%Basic%wavelength_long)) - dims(1:ndim) = shape(spectrum%Basic%wavelength_long) - lbounds(1:ndim) = lbound(spectrum%Basic%wavelength_long) - else - loc = C_NULL_PTR - end if - - else if (field == 'wavelength_short') then - if (allocated(spectrum%Basic%wavelength_short)) then - loc = C_LOC(spectrum%Basic%wavelength_short) - ndim = size(shape(spectrum%Basic%wavelength_short)) - dims(1:ndim) = shape(spectrum%Basic%wavelength_short) - lbounds(1:ndim) = lbound(spectrum%Basic%wavelength_short) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataBasic_get_real_array - -end module StrSpecDataBasic_C diff --git a/julia/gen/StrSpecDataBasic_JL.jl b/julia/gen/StrSpecDataBasic_JL.jl deleted file mode 100644 index 77c7322..0000000 --- a/julia/gen/StrSpecDataBasic_JL.jl +++ /dev/null @@ -1,144 +0,0 @@ -# Autogenerated from src/radiance_core/def_spectrum.F90 -# svn revision 1226 - - - mutable struct StrSpecDataBasic{P} - parent_handle::P - end - - - # this is used to show values in the REPL and when using IJulia - function Base.show(io::IO, m::MIME"text/plain", handle::StrSpecDataBasic) - println(io, handle) - dump_properties(io, handle) - end - - - function Base.propertynames(handle::StrSpecDataBasic, private::Bool=false) - names = [ - :l_present, - :n_band, - :wavelength_long, - :wavelength_short, - :n_band_exclude, - :index_exclude, - ] - - return names - end - - - function Base.getproperty(handle::StrSpecDataBasic, field::Symbol) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :n_band, - ) - val = Ref{Cint}() - field_ok = ccall( - (:PS_StrSpecDataBasic_get_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Cint}), - cptr, String(field), val - ) - Bool(field_ok) || error("StrSpecDataBasic integer field $field not present - coding error") - return val[] - elseif field in ( - :l_present, - ) - loc = Ref{Ptr{Cint}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataBasic_get_logical_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cint}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataBasic Cint array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - elseif field in ( - :n_band_exclude, - :index_exclude, - ) - loc = Ref{Ptr{Cint}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataBasic_get_integer_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cint}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataBasic Cint array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - elseif field in ( - :wavelength_long, - :wavelength_short, - ) - loc = Ref{Ptr{Cdouble}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataBasic_get_real_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cdouble}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataBasic Cdouble array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - else - return getfield(handle, field) - end - - end - - - function Base.setproperty!(handle::StrSpecDataBasic, field::Symbol, val) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :n_band, - ) - - field_ok = ccall( - (:PS_StrSpecDataBasic_set_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Cint), - cptr, String(field), val - ) - Bool(field_ok) || error("StrSpecDataBasic integer field $field not present - coding error") - return val - else - error("type StrSpecDataBasic has no writeable field $field") - end - - end - diff --git a/julia/gen/StrSpecDataContGen_C.f90 b/julia/gen/StrSpecDataContGen_C.f90 deleted file mode 100644 index 33660b3..0000000 --- a/julia/gen/StrSpecDataContGen_C.f90 +++ /dev/null @@ -1,288 +0,0 @@ -! Autogenerated from Fortran file src/radiance_core/def_spectrum.F90 -! svn revision 1226 - -module StrSpecDataContGen_C - -use, intrinsic :: iso_c_binding - -use UTILITIES_CF -use def_spectrum - -implicit none - -private - -contains - - function StrSpecDataContGen_get_integer(spectrum_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrSpecDataContGen_get_integer') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), intent(out) :: val - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'n_cont') then - val = spectrum%ContGen%n_cont - else if (field == 'n_t_lookup_cont') then - val = spectrum%ContGen%n_t_lookup_cont - else - field_OK = .FALSE. - end if - - end function StrSpecDataContGen_get_integer - - function StrSpecDataContGen_set_integer(spectrum_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrSpecDataContGen_set_integer') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), value, intent(in) :: val - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'n_cont') then - spectrum%ContGen%n_cont = val - else if (field == 'n_t_lookup_cont') then - spectrum%ContGen%n_t_lookup_cont = val - else - field_OK = .FALSE. - end if - - end function StrSpecDataContGen_set_integer - - function StrSpecDataContGen_get_logical_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataContGen_get_logical_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'l_cont_major') then - if (allocated(spectrum%ContGen%l_cont_major)) then - loc = C_LOC(spectrum%ContGen%l_cont_major) - ndim = size(shape(spectrum%ContGen%l_cont_major)) - dims(1:ndim) = shape(spectrum%ContGen%l_cont_major) - lbounds(1:ndim) = lbound(spectrum%ContGen%l_cont_major) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataContGen_get_logical_array - - function StrSpecDataContGen_get_integer_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataContGen_get_integer_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'n_band_cont') then - if (allocated(spectrum%ContGen%n_band_cont)) then - loc = C_LOC(spectrum%ContGen%n_band_cont) - ndim = size(shape(spectrum%ContGen%n_band_cont)) - dims(1:ndim) = shape(spectrum%ContGen%n_band_cont) - lbounds(1:ndim) = lbound(spectrum%ContGen%n_band_cont) - else - loc = C_NULL_PTR - end if - - else if (field == 'index_cont') then - if (allocated(spectrum%ContGen%index_cont)) then - loc = C_LOC(spectrum%ContGen%index_cont) - ndim = size(shape(spectrum%ContGen%index_cont)) - dims(1:ndim) = shape(spectrum%ContGen%index_cont) - lbounds(1:ndim) = lbound(spectrum%ContGen%index_cont) - else - loc = C_NULL_PTR - end if - - else if (field == 'index_cont_gas_1') then - if (allocated(spectrum%ContGen%index_cont_gas_1)) then - loc = C_LOC(spectrum%ContGen%index_cont_gas_1) - ndim = size(shape(spectrum%ContGen%index_cont_gas_1)) - dims(1:ndim) = shape(spectrum%ContGen%index_cont_gas_1) - lbounds(1:ndim) = lbound(spectrum%ContGen%index_cont_gas_1) - else - loc = C_NULL_PTR - end if - - else if (field == 'index_cont_gas_2') then - if (allocated(spectrum%ContGen%index_cont_gas_2)) then - loc = C_LOC(spectrum%ContGen%index_cont_gas_2) - ndim = size(shape(spectrum%ContGen%index_cont_gas_2)) - dims(1:ndim) = shape(spectrum%ContGen%index_cont_gas_2) - lbounds(1:ndim) = lbound(spectrum%ContGen%index_cont_gas_2) - else - loc = C_NULL_PTR - end if - - else if (field == 'i_band_k_cont') then - if (allocated(spectrum%ContGen%i_band_k_cont)) then - loc = C_LOC(spectrum%ContGen%i_band_k_cont) - ndim = size(shape(spectrum%ContGen%i_band_k_cont)) - dims(1:ndim) = shape(spectrum%ContGen%i_band_k_cont) - lbounds(1:ndim) = lbound(spectrum%ContGen%i_band_k_cont) - else - loc = C_NULL_PTR - end if - - else if (field == 'i_cont_overlap_band') then - if (allocated(spectrum%ContGen%i_cont_overlap_band)) then - loc = C_LOC(spectrum%ContGen%i_cont_overlap_band) - ndim = size(shape(spectrum%ContGen%i_cont_overlap_band)) - dims(1:ndim) = shape(spectrum%ContGen%i_cont_overlap_band) - lbounds(1:ndim) = lbound(spectrum%ContGen%i_cont_overlap_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'i_scat_cont') then - if (allocated(spectrum%ContGen%i_scat_cont)) then - loc = C_LOC(spectrum%ContGen%i_scat_cont) - ndim = size(shape(spectrum%ContGen%i_scat_cont)) - dims(1:ndim) = shape(spectrum%ContGen%i_scat_cont) - lbounds(1:ndim) = lbound(spectrum%ContGen%i_scat_cont) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataContGen_get_integer_array - - function StrSpecDataContGen_get_real_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataContGen_get_real_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'k_cont') then - if (allocated(spectrum%ContGen%k_cont)) then - loc = C_LOC(spectrum%ContGen%k_cont) - ndim = size(shape(spectrum%ContGen%k_cont)) - dims(1:ndim) = shape(spectrum%ContGen%k_cont) - lbounds(1:ndim) = lbound(spectrum%ContGen%k_cont) - else - loc = C_NULL_PTR - end if - - else if (field == 'w_cont') then - if (allocated(spectrum%ContGen%w_cont)) then - loc = C_LOC(spectrum%ContGen%w_cont) - ndim = size(shape(spectrum%ContGen%w_cont)) - dims(1:ndim) = shape(spectrum%ContGen%w_cont) - lbounds(1:ndim) = lbound(spectrum%ContGen%w_cont) - else - loc = C_NULL_PTR - end if - - else if (field == 't_lookup_cont') then - if (allocated(spectrum%ContGen%t_lookup_cont)) then - loc = C_LOC(spectrum%ContGen%t_lookup_cont) - ndim = size(shape(spectrum%ContGen%t_lookup_cont)) - dims(1:ndim) = shape(spectrum%ContGen%t_lookup_cont) - lbounds(1:ndim) = lbound(spectrum%ContGen%t_lookup_cont) - else - loc = C_NULL_PTR - end if - - else if (field == 'k_lookup_cont') then - if (allocated(spectrum%ContGen%k_lookup_cont)) then - loc = C_LOC(spectrum%ContGen%k_lookup_cont) - ndim = size(shape(spectrum%ContGen%k_lookup_cont)) - dims(1:ndim) = shape(spectrum%ContGen%k_lookup_cont) - lbounds(1:ndim) = lbound(spectrum%ContGen%k_lookup_cont) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataContGen_get_real_array - -end module StrSpecDataContGen_C diff --git a/julia/gen/StrSpecDataContGen_JL.jl b/julia/gen/StrSpecDataContGen_JL.jl deleted file mode 100644 index ac29b19..0000000 --- a/julia/gen/StrSpecDataContGen_JL.jl +++ /dev/null @@ -1,161 +0,0 @@ -# Autogenerated from src/radiance_core/def_spectrum.F90 -# svn revision 1226 - - - mutable struct StrSpecDataContGen{P} - parent_handle::P - end - - - # this is used to show values in the REPL and when using IJulia - function Base.show(io::IO, m::MIME"text/plain", handle::StrSpecDataContGen) - println(io, handle) - dump_properties(io, handle) - end - - - function Base.propertynames(handle::StrSpecDataContGen, private::Bool=false) - names = [ - :n_cont, - :n_band_cont, - :index_cont, - :index_cont_gas_1, - :index_cont_gas_2, - :i_band_k_cont, - :i_cont_overlap_band, - :i_scat_cont, - :l_cont_major, - :k_cont, - :w_cont, - :n_t_lookup_cont, - :t_lookup_cont, - :k_lookup_cont, - ] - - return names - end - - - function Base.getproperty(handle::StrSpecDataContGen, field::Symbol) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :n_cont, - :n_t_lookup_cont, - ) - val = Ref{Cint}() - field_ok = ccall( - (:PS_StrSpecDataContGen_get_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Cint}), - cptr, String(field), val - ) - Bool(field_ok) || error("StrSpecDataContGen integer field $field not present - coding error") - return val[] - elseif field in ( - :l_cont_major, - ) - loc = Ref{Ptr{Cint}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataContGen_get_logical_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cint}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataContGen Cint array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - elseif field in ( - :n_band_cont, - :index_cont, - :index_cont_gas_1, - :index_cont_gas_2, - :i_band_k_cont, - :i_cont_overlap_band, - :i_scat_cont, - ) - loc = Ref{Ptr{Cint}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataContGen_get_integer_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cint}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataContGen Cint array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - elseif field in ( - :k_cont, - :w_cont, - :t_lookup_cont, - :k_lookup_cont, - ) - loc = Ref{Ptr{Cdouble}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataContGen_get_real_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cdouble}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataContGen Cdouble array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - else - return getfield(handle, field) - end - - end - - - function Base.setproperty!(handle::StrSpecDataContGen, field::Symbol, val) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :n_cont, - :n_t_lookup_cont, - ) - - field_ok = ccall( - (:PS_StrSpecDataContGen_set_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Cint), - cptr, String(field), val - ) - Bool(field_ok) || error("StrSpecDataContGen integer field $field not present - coding error") - return val - else - error("type StrSpecDataContGen has no writeable field $field") - end - - end - diff --git a/julia/gen/StrSpecDataCont_C.f90 b/julia/gen/StrSpecDataCont_C.f90 deleted file mode 100644 index cd7b001..0000000 --- a/julia/gen/StrSpecDataCont_C.f90 +++ /dev/null @@ -1,223 +0,0 @@ -! Autogenerated from Fortran file src/radiance_core/def_spectrum.F90 -! svn revision 1226 - -module StrSpecDataCont_C - -use, intrinsic :: iso_c_binding - -use UTILITIES_CF -use def_spectrum - -implicit none - -private - -contains - - function StrSpecDataCont_get_integer(spectrum_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrSpecDataCont_get_integer') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), intent(out) :: val - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'index_water') then - val = spectrum%Cont%index_water - else - field_OK = .FALSE. - end if - - end function StrSpecDataCont_get_integer - - function StrSpecDataCont_set_integer(spectrum_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrSpecDataCont_set_integer') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), value, intent(in) :: val - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'index_water') then - spectrum%Cont%index_water = val - else - field_OK = .FALSE. - end if - - end function StrSpecDataCont_set_integer - - function StrSpecDataCont_get_integer_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataCont_get_integer_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'n_band_continuum') then - if (allocated(spectrum%Cont%n_band_continuum)) then - loc = C_LOC(spectrum%Cont%n_band_continuum) - ndim = size(shape(spectrum%Cont%n_band_continuum)) - dims(1:ndim) = shape(spectrum%Cont%n_band_continuum) - lbounds(1:ndim) = lbound(spectrum%Cont%n_band_continuum) - else - loc = C_NULL_PTR - end if - - else if (field == 'index_continuum') then - if (allocated(spectrum%Cont%index_continuum)) then - loc = C_LOC(spectrum%Cont%index_continuum) - ndim = size(shape(spectrum%Cont%index_continuum)) - dims(1:ndim) = shape(spectrum%Cont%index_continuum) - lbounds(1:ndim) = lbound(spectrum%Cont%index_continuum) - else - loc = C_NULL_PTR - end if - - else if (field == 'i_scale_fnc_cont') then - if (allocated(spectrum%Cont%i_scale_fnc_cont)) then - loc = C_LOC(spectrum%Cont%i_scale_fnc_cont) - ndim = size(shape(spectrum%Cont%i_scale_fnc_cont)) - dims(1:ndim) = shape(spectrum%Cont%i_scale_fnc_cont) - lbounds(1:ndim) = lbound(spectrum%Cont%i_scale_fnc_cont) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataCont_get_integer_array - - function StrSpecDataCont_get_real_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataCont_get_real_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'k_cont') then - if (allocated(spectrum%Cont%k_cont)) then - loc = C_LOC(spectrum%Cont%k_cont) - ndim = size(shape(spectrum%Cont%k_cont)) - dims(1:ndim) = shape(spectrum%Cont%k_cont) - lbounds(1:ndim) = lbound(spectrum%Cont%k_cont) - else - loc = C_NULL_PTR - end if - - else if (field == 'scale_cont') then - if (allocated(spectrum%Cont%scale_cont)) then - loc = C_LOC(spectrum%Cont%scale_cont) - ndim = size(shape(spectrum%Cont%scale_cont)) - dims(1:ndim) = shape(spectrum%Cont%scale_cont) - lbounds(1:ndim) = lbound(spectrum%Cont%scale_cont) - else - loc = C_NULL_PTR - end if - - else if (field == 'p_ref_cont') then - if (allocated(spectrum%Cont%p_ref_cont)) then - loc = C_LOC(spectrum%Cont%p_ref_cont) - ndim = size(shape(spectrum%Cont%p_ref_cont)) - dims(1:ndim) = shape(spectrum%Cont%p_ref_cont) - lbounds(1:ndim) = lbound(spectrum%Cont%p_ref_cont) - else - loc = C_NULL_PTR - end if - - else if (field == 't_ref_cont') then - if (allocated(spectrum%Cont%t_ref_cont)) then - loc = C_LOC(spectrum%Cont%t_ref_cont) - ndim = size(shape(spectrum%Cont%t_ref_cont)) - dims(1:ndim) = shape(spectrum%Cont%t_ref_cont) - lbounds(1:ndim) = lbound(spectrum%Cont%t_ref_cont) - else - loc = C_NULL_PTR - end if - - else if (field == 'k_cont_ses') then - if (allocated(spectrum%Cont%k_cont_ses)) then - loc = C_LOC(spectrum%Cont%k_cont_ses) - ndim = size(shape(spectrum%Cont%k_cont_ses)) - dims(1:ndim) = shape(spectrum%Cont%k_cont_ses) - lbounds(1:ndim) = lbound(spectrum%Cont%k_cont_ses) - else - loc = C_NULL_PTR - end if - - else if (field == 'k_h2oc') then - if (allocated(spectrum%Cont%k_h2oc)) then - loc = C_LOC(spectrum%Cont%k_h2oc) - ndim = size(shape(spectrum%Cont%k_h2oc)) - dims(1:ndim) = shape(spectrum%Cont%k_h2oc) - lbounds(1:ndim) = lbound(spectrum%Cont%k_h2oc) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataCont_get_real_array - -end module StrSpecDataCont_C diff --git a/julia/gen/StrSpecDataCont_JL.jl b/julia/gen/StrSpecDataCont_JL.jl deleted file mode 100644 index 44cdfbe..0000000 --- a/julia/gen/StrSpecDataCont_JL.jl +++ /dev/null @@ -1,132 +0,0 @@ -# Autogenerated from src/radiance_core/def_spectrum.F90 -# svn revision 1226 - - - mutable struct StrSpecDataCont{P} - parent_handle::P - end - - - # this is used to show values in the REPL and when using IJulia - function Base.show(io::IO, m::MIME"text/plain", handle::StrSpecDataCont) - println(io, handle) - dump_properties(io, handle) - end - - - function Base.propertynames(handle::StrSpecDataCont, private::Bool=false) - names = [ - :n_band_continuum, - :index_continuum, - :index_water, - :i_scale_fnc_cont, - :k_cont, - :scale_cont, - :p_ref_cont, - :t_ref_cont, - :k_cont_ses, - :k_h2oc, - ] - - return names - end - - - function Base.getproperty(handle::StrSpecDataCont, field::Symbol) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :index_water, - ) - val = Ref{Cint}() - field_ok = ccall( - (:PS_StrSpecDataCont_get_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Cint}), - cptr, String(field), val - ) - Bool(field_ok) || error("StrSpecDataCont integer field $field not present - coding error") - return val[] - elseif field in ( - :n_band_continuum, - :index_continuum, - :i_scale_fnc_cont, - ) - loc = Ref{Ptr{Cint}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataCont_get_integer_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cint}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataCont Cint array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - elseif field in ( - :k_cont, - :scale_cont, - :p_ref_cont, - :t_ref_cont, - :k_cont_ses, - :k_h2oc, - ) - loc = Ref{Ptr{Cdouble}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataCont_get_real_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cdouble}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataCont Cdouble array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - else - return getfield(handle, field) - end - - end - - - function Base.setproperty!(handle::StrSpecDataCont, field::Symbol, val) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :index_water, - ) - - field_ok = ccall( - (:PS_StrSpecDataCont_set_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Cint), - cptr, String(field), val - ) - Bool(field_ok) || error("StrSpecDataCont integer field $field not present - coding error") - return val - else - error("type StrSpecDataCont has no writeable field $field") - end - - end - diff --git a/julia/gen/StrSpecDataDim_C.f90 b/julia/gen/StrSpecDataDim_C.f90 deleted file mode 100644 index 41db74a..0000000 --- a/julia/gen/StrSpecDataDim_C.f90 +++ /dev/null @@ -1,211 +0,0 @@ -! Autogenerated from Fortran file src/radiance_core/def_spectrum.F90 -! svn revision 1226 - -module StrSpecDataDim_C - -use, intrinsic :: iso_c_binding - -use UTILITIES_CF -use def_spectrum - -implicit none - -private - -contains - - function StrSpecDataDim_get_integer(spectrum_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrSpecDataDim_get_integer') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), intent(out) :: val - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'nd_alloc_int') then - val = spectrum%Dim%nd_alloc_int - else if (field == 'nd_alloc_real') then - val = spectrum%Dim%nd_alloc_real - else if (field == 'nd_alloc_log') then - val = spectrum%Dim%nd_alloc_log - else if (field == 'nd_type') then - val = spectrum%Dim%nd_type - else if (field == 'nd_band') then - val = spectrum%Dim%nd_band - else if (field == 'nd_exclude') then - val = spectrum%Dim%nd_exclude - else if (field == 'nd_k_term') then - val = spectrum%Dim%nd_k_term - else if (field == 'nd_species') then - val = spectrum%Dim%nd_species - else if (field == 'nd_scale_variable') then - val = spectrum%Dim%nd_scale_variable - else if (field == 'nd_continuum') then - val = spectrum%Dim%nd_continuum - else if (field == 'nd_drop_type') then - val = spectrum%Dim%nd_drop_type - else if (field == 'nd_ice_type') then - val = spectrum%Dim%nd_ice_type - else if (field == 'nd_aerosol_species') then - val = spectrum%Dim%nd_aerosol_species - else if (field == 'nd_aerosol_mr') then - val = spectrum%Dim%nd_aerosol_mr - else if (field == 'nd_thermal_coeff') then - val = spectrum%Dim%nd_thermal_coeff - else if (field == 'nd_cloud_parameter') then - val = spectrum%Dim%nd_cloud_parameter - else if (field == 'nd_humidity') then - val = spectrum%Dim%nd_humidity - else if (field == 'nd_aod_wavel') then - val = spectrum%Dim%nd_aod_wavel - else if (field == 'nd_phase_term') then - val = spectrum%Dim%nd_phase_term - else if (field == 'nd_tmp') then - val = spectrum%Dim%nd_tmp - else if (field == 'nd_pre') then - val = spectrum%Dim%nd_pre - else if (field == 'nd_mix') then - val = spectrum%Dim%nd_mix - else if (field == 'nd_band_mix_gas') then - val = spectrum%Dim%nd_band_mix_gas - else if (field == 'nd_sub_band_k') then - val = spectrum%Dim%nd_sub_band_k - else if (field == 'nd_k_sub_band') then - val = spectrum%Dim%nd_k_sub_band - else if (field == 'nd_sub_band_gas') then - val = spectrum%Dim%nd_sub_band_gas - else if (field == 'nd_sub_band') then - val = spectrum%Dim%nd_sub_band - else if (field == 'nd_times') then - val = spectrum%Dim%nd_times - else if (field == 'nd_cont') then - val = spectrum%Dim%nd_cont - else if (field == 'nd_t_lookup_cont') then - val = spectrum%Dim%nd_t_lookup_cont - else if (field == 'nd_k_term_cont') then - val = spectrum%Dim%nd_k_term_cont - else if (field == 'nd_species_sb') then - val = spectrum%Dim%nd_species_sb - else if (field == 'nd_gas_frac') then - val = spectrum%Dim%nd_gas_frac - else if (field == 'nd_pathway') then - val = spectrum%Dim%nd_pathway - else if (field == 'nd_t_lookup_photol') then - val = spectrum%Dim%nd_t_lookup_photol - else if (field == 'nd_wl_lookup_photol') then - val = spectrum%Dim%nd_wl_lookup_photol - else - field_OK = .FALSE. - end if - - end function StrSpecDataDim_get_integer - - function StrSpecDataDim_set_integer(spectrum_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrSpecDataDim_set_integer') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), value, intent(in) :: val - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'nd_alloc_int') then - spectrum%Dim%nd_alloc_int = val - else if (field == 'nd_alloc_real') then - spectrum%Dim%nd_alloc_real = val - else if (field == 'nd_alloc_log') then - spectrum%Dim%nd_alloc_log = val - else if (field == 'nd_type') then - spectrum%Dim%nd_type = val - else if (field == 'nd_band') then - spectrum%Dim%nd_band = val - else if (field == 'nd_exclude') then - spectrum%Dim%nd_exclude = val - else if (field == 'nd_k_term') then - spectrum%Dim%nd_k_term = val - else if (field == 'nd_species') then - spectrum%Dim%nd_species = val - else if (field == 'nd_scale_variable') then - spectrum%Dim%nd_scale_variable = val - else if (field == 'nd_continuum') then - spectrum%Dim%nd_continuum = val - else if (field == 'nd_drop_type') then - spectrum%Dim%nd_drop_type = val - else if (field == 'nd_ice_type') then - spectrum%Dim%nd_ice_type = val - else if (field == 'nd_aerosol_species') then - spectrum%Dim%nd_aerosol_species = val - else if (field == 'nd_aerosol_mr') then - spectrum%Dim%nd_aerosol_mr = val - else if (field == 'nd_thermal_coeff') then - spectrum%Dim%nd_thermal_coeff = val - else if (field == 'nd_cloud_parameter') then - spectrum%Dim%nd_cloud_parameter = val - else if (field == 'nd_humidity') then - spectrum%Dim%nd_humidity = val - else if (field == 'nd_aod_wavel') then - spectrum%Dim%nd_aod_wavel = val - else if (field == 'nd_phase_term') then - spectrum%Dim%nd_phase_term = val - else if (field == 'nd_tmp') then - spectrum%Dim%nd_tmp = val - else if (field == 'nd_pre') then - spectrum%Dim%nd_pre = val - else if (field == 'nd_mix') then - spectrum%Dim%nd_mix = val - else if (field == 'nd_band_mix_gas') then - spectrum%Dim%nd_band_mix_gas = val - else if (field == 'nd_sub_band_k') then - spectrum%Dim%nd_sub_band_k = val - else if (field == 'nd_k_sub_band') then - spectrum%Dim%nd_k_sub_band = val - else if (field == 'nd_sub_band_gas') then - spectrum%Dim%nd_sub_band_gas = val - else if (field == 'nd_sub_band') then - spectrum%Dim%nd_sub_band = val - else if (field == 'nd_times') then - spectrum%Dim%nd_times = val - else if (field == 'nd_cont') then - spectrum%Dim%nd_cont = val - else if (field == 'nd_t_lookup_cont') then - spectrum%Dim%nd_t_lookup_cont = val - else if (field == 'nd_k_term_cont') then - spectrum%Dim%nd_k_term_cont = val - else if (field == 'nd_species_sb') then - spectrum%Dim%nd_species_sb = val - else if (field == 'nd_gas_frac') then - spectrum%Dim%nd_gas_frac = val - else if (field == 'nd_pathway') then - spectrum%Dim%nd_pathway = val - else if (field == 'nd_t_lookup_photol') then - spectrum%Dim%nd_t_lookup_photol = val - else if (field == 'nd_wl_lookup_photol') then - spectrum%Dim%nd_wl_lookup_photol = val - else - field_OK = .FALSE. - end if - - end function StrSpecDataDim_set_integer - -end module StrSpecDataDim_C diff --git a/julia/gen/StrSpecDataDim_JL.jl b/julia/gen/StrSpecDataDim_JL.jl deleted file mode 100644 index 0b24bba..0000000 --- a/julia/gen/StrSpecDataDim_JL.jl +++ /dev/null @@ -1,179 +0,0 @@ -# Autogenerated from src/radiance_core/def_spectrum.F90 -# svn revision 1226 - - - mutable struct StrSpecDataDim{P} - parent_handle::P - end - - - # this is used to show values in the REPL and when using IJulia - function Base.show(io::IO, m::MIME"text/plain", handle::StrSpecDataDim) - println(io, handle) - dump_properties(io, handle) - end - - - function Base.propertynames(handle::StrSpecDataDim, private::Bool=false) - names = [ - :nd_alloc_int, - :nd_alloc_real, - :nd_alloc_log, - :nd_type, - :nd_band, - :nd_exclude, - :nd_k_term, - :nd_species, - :nd_scale_variable, - :nd_continuum, - :nd_drop_type, - :nd_ice_type, - :nd_aerosol_species, - :nd_aerosol_mr, - :nd_thermal_coeff, - :nd_cloud_parameter, - :nd_humidity, - :nd_aod_wavel, - :nd_phase_term, - :nd_tmp, - :nd_pre, - :nd_mix, - :nd_band_mix_gas, - :nd_sub_band_k, - :nd_k_sub_band, - :nd_sub_band_gas, - :nd_sub_band, - :nd_times, - :nd_cont, - :nd_t_lookup_cont, - :nd_k_term_cont, - :nd_species_sb, - :nd_gas_frac, - :nd_pathway, - :nd_t_lookup_photol, - :nd_wl_lookup_photol, - ] - - return names - end - - - function Base.getproperty(handle::StrSpecDataDim, field::Symbol) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :nd_alloc_int, - :nd_alloc_real, - :nd_alloc_log, - :nd_type, - :nd_band, - :nd_exclude, - :nd_k_term, - :nd_species, - :nd_scale_variable, - :nd_continuum, - :nd_drop_type, - :nd_ice_type, - :nd_aerosol_species, - :nd_aerosol_mr, - :nd_thermal_coeff, - :nd_cloud_parameter, - :nd_humidity, - :nd_aod_wavel, - :nd_phase_term, - :nd_tmp, - :nd_pre, - :nd_mix, - :nd_band_mix_gas, - :nd_sub_band_k, - :nd_k_sub_band, - :nd_sub_band_gas, - :nd_sub_band, - :nd_times, - :nd_cont, - :nd_t_lookup_cont, - :nd_k_term_cont, - :nd_species_sb, - :nd_gas_frac, - :nd_pathway, - :nd_t_lookup_photol, - :nd_wl_lookup_photol, - ) - val = Ref{Cint}() - field_ok = ccall( - (:PS_StrSpecDataDim_get_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Cint}), - cptr, String(field), val - ) - Bool(field_ok) || error("StrSpecDataDim integer field $field not present - coding error") - return val[] - else - return getfield(handle, field) - end - - end - - - function Base.setproperty!(handle::StrSpecDataDim, field::Symbol, val) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :nd_alloc_int, - :nd_alloc_real, - :nd_alloc_log, - :nd_type, - :nd_band, - :nd_exclude, - :nd_k_term, - :nd_species, - :nd_scale_variable, - :nd_continuum, - :nd_drop_type, - :nd_ice_type, - :nd_aerosol_species, - :nd_aerosol_mr, - :nd_thermal_coeff, - :nd_cloud_parameter, - :nd_humidity, - :nd_aod_wavel, - :nd_phase_term, - :nd_tmp, - :nd_pre, - :nd_mix, - :nd_band_mix_gas, - :nd_sub_band_k, - :nd_k_sub_band, - :nd_sub_band_gas, - :nd_sub_band, - :nd_times, - :nd_cont, - :nd_t_lookup_cont, - :nd_k_term_cont, - :nd_species_sb, - :nd_gas_frac, - :nd_pathway, - :nd_t_lookup_photol, - :nd_wl_lookup_photol, - ) - - field_ok = ccall( - (:PS_StrSpecDataDim_set_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Cint), - cptr, String(field), val - ) - Bool(field_ok) || error("StrSpecDataDim integer field $field not present - coding error") - return val - else - error("type StrSpecDataDim has no writeable field $field") - end - - end - diff --git a/julia/gen/StrSpecDataDrop_C.f90 b/julia/gen/StrSpecDataDrop_C.f90 deleted file mode 100644 index f71b4c2..0000000 --- a/julia/gen/StrSpecDataDrop_C.f90 +++ /dev/null @@ -1,170 +0,0 @@ -! Autogenerated from Fortran file src/radiance_core/def_spectrum.F90 -! svn revision 1226 - -module StrSpecDataDrop_C - -use, intrinsic :: iso_c_binding - -use UTILITIES_CF -use def_spectrum - -implicit none - -private - -contains - - function StrSpecDataDrop_get_logical_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataDrop_get_logical_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'l_drop_type') then - if (allocated(spectrum%Drop%l_drop_type)) then - loc = C_LOC(spectrum%Drop%l_drop_type) - ndim = size(shape(spectrum%Drop%l_drop_type)) - dims(1:ndim) = shape(spectrum%Drop%l_drop_type) - lbounds(1:ndim) = lbound(spectrum%Drop%l_drop_type) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataDrop_get_logical_array - - function StrSpecDataDrop_get_integer_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataDrop_get_integer_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'i_drop_parm') then - if (allocated(spectrum%Drop%i_drop_parm)) then - loc = C_LOC(spectrum%Drop%i_drop_parm) - ndim = size(shape(spectrum%Drop%i_drop_parm)) - dims(1:ndim) = shape(spectrum%Drop%i_drop_parm) - lbounds(1:ndim) = lbound(spectrum%Drop%i_drop_parm) - else - loc = C_NULL_PTR - end if - - else if (field == 'n_phf') then - if (allocated(spectrum%Drop%n_phf)) then - loc = C_LOC(spectrum%Drop%n_phf) - ndim = size(shape(spectrum%Drop%n_phf)) - dims(1:ndim) = shape(spectrum%Drop%n_phf) - lbounds(1:ndim) = lbound(spectrum%Drop%n_phf) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataDrop_get_integer_array - - function StrSpecDataDrop_get_real_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataDrop_get_real_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'parm_list') then - if (allocated(spectrum%Drop%parm_list)) then - loc = C_LOC(spectrum%Drop%parm_list) - ndim = size(shape(spectrum%Drop%parm_list)) - dims(1:ndim) = shape(spectrum%Drop%parm_list) - lbounds(1:ndim) = lbound(spectrum%Drop%parm_list) - else - loc = C_NULL_PTR - end if - - else if (field == 'parm_min_dim') then - if (allocated(spectrum%Drop%parm_min_dim)) then - loc = C_LOC(spectrum%Drop%parm_min_dim) - ndim = size(shape(spectrum%Drop%parm_min_dim)) - dims(1:ndim) = shape(spectrum%Drop%parm_min_dim) - lbounds(1:ndim) = lbound(spectrum%Drop%parm_min_dim) - else - loc = C_NULL_PTR - end if - - else if (field == 'parm_max_dim') then - if (allocated(spectrum%Drop%parm_max_dim)) then - loc = C_LOC(spectrum%Drop%parm_max_dim) - ndim = size(shape(spectrum%Drop%parm_max_dim)) - dims(1:ndim) = shape(spectrum%Drop%parm_max_dim) - lbounds(1:ndim) = lbound(spectrum%Drop%parm_max_dim) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataDrop_get_real_array - -end module StrSpecDataDrop_C diff --git a/julia/gen/StrSpecDataDrop_JL.jl b/julia/gen/StrSpecDataDrop_JL.jl deleted file mode 100644 index 32fb144..0000000 --- a/julia/gen/StrSpecDataDrop_JL.jl +++ /dev/null @@ -1,119 +0,0 @@ -# Autogenerated from src/radiance_core/def_spectrum.F90 -# svn revision 1226 - - - mutable struct StrSpecDataDrop{P} - parent_handle::P - end - - - # this is used to show values in the REPL and when using IJulia - function Base.show(io::IO, m::MIME"text/plain", handle::StrSpecDataDrop) - println(io, handle) - dump_properties(io, handle) - end - - - function Base.propertynames(handle::StrSpecDataDrop, private::Bool=false) - names = [ - :l_drop_type, - :i_drop_parm, - :n_phf, - :parm_list, - :parm_min_dim, - :parm_max_dim, - ] - - return names - end - - - function Base.getproperty(handle::StrSpecDataDrop, field::Symbol) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :l_drop_type, - ) - loc = Ref{Ptr{Cint}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataDrop_get_logical_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cint}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataDrop Cint array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - elseif field in ( - :i_drop_parm, - :n_phf, - ) - loc = Ref{Ptr{Cint}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataDrop_get_integer_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cint}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataDrop Cint array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - elseif field in ( - :parm_list, - :parm_min_dim, - :parm_max_dim, - ) - loc = Ref{Ptr{Cdouble}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataDrop_get_real_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cdouble}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataDrop Cdouble array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - else - return getfield(handle, field) - end - - end - - - function Base.setproperty!(handle::StrSpecDataDrop, field::Symbol, val) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - error("type StrSpecDataDrop has no writeable field $field") - - end - diff --git a/julia/gen/StrSpecDataGas_C.f90 b/julia/gen/StrSpecDataGas_C.f90 deleted file mode 100644 index f06dc22..0000000 --- a/julia/gen/StrSpecDataGas_C.f90 +++ /dev/null @@ -1,532 +0,0 @@ -! Autogenerated from Fortran file src/radiance_core/def_spectrum.F90 -! svn revision 1226 - -module StrSpecDataGas_C - -use, intrinsic :: iso_c_binding - -use UTILITIES_CF -use def_spectrum - -implicit none - -private - -contains - - function StrSpecDataGas_get_integer(spectrum_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrSpecDataGas_get_integer') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), intent(out) :: val - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'n_absorb') then - val = spectrum%Gas%n_absorb - else if (field == 'n_absorb_sb') then - val = spectrum%Gas%n_absorb_sb - else if (field == 'n_gas_frac') then - val = spectrum%Gas%n_gas_frac - else - field_OK = .FALSE. - end if - - end function StrSpecDataGas_get_integer - - function StrSpecDataGas_set_integer(spectrum_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrSpecDataGas_set_integer') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), value, intent(in) :: val - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'n_absorb') then - spectrum%Gas%n_absorb = val - else if (field == 'n_absorb_sb') then - spectrum%Gas%n_absorb_sb = val - else if (field == 'n_gas_frac') then - spectrum%Gas%n_gas_frac = val - else - field_OK = .FALSE. - end if - - end function StrSpecDataGas_set_integer - - function StrSpecDataGas_get_logical_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataGas_get_logical_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'l_self_broadening') then - if (allocated(spectrum%Gas%l_self_broadening)) then - loc = C_LOC(spectrum%Gas%l_self_broadening) - ndim = size(shape(spectrum%Gas%l_self_broadening)) - dims(1:ndim) = shape(spectrum%Gas%l_self_broadening) - lbounds(1:ndim) = lbound(spectrum%Gas%l_self_broadening) - else - loc = C_NULL_PTR - end if - - else if (field == 'l_doppler') then - if (allocated(spectrum%Gas%l_doppler)) then - loc = C_LOC(spectrum%Gas%l_doppler) - ndim = size(shape(spectrum%Gas%l_doppler)) - dims(1:ndim) = shape(spectrum%Gas%l_doppler) - lbounds(1:ndim) = lbound(spectrum%Gas%l_doppler) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataGas_get_logical_array - - function StrSpecDataGas_get_integer_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataGas_get_integer_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'n_band_absorb') then - if (allocated(spectrum%Gas%n_band_absorb)) then - loc = C_LOC(spectrum%Gas%n_band_absorb) - ndim = size(shape(spectrum%Gas%n_band_absorb)) - dims(1:ndim) = shape(spectrum%Gas%n_band_absorb) - lbounds(1:ndim) = lbound(spectrum%Gas%n_band_absorb) - else - loc = C_NULL_PTR - end if - - else if (field == 'index_absorb') then - if (allocated(spectrum%Gas%index_absorb)) then - loc = C_LOC(spectrum%Gas%index_absorb) - ndim = size(shape(spectrum%Gas%index_absorb)) - dims(1:ndim) = shape(spectrum%Gas%index_absorb) - lbounds(1:ndim) = lbound(spectrum%Gas%index_absorb) - else - loc = C_NULL_PTR - end if - - else if (field == 'index_sb') then - if (allocated(spectrum%Gas%index_sb)) then - loc = C_LOC(spectrum%Gas%index_sb) - ndim = size(shape(spectrum%Gas%index_sb)) - dims(1:ndim) = shape(spectrum%Gas%index_sb) - lbounds(1:ndim) = lbound(spectrum%Gas%index_sb) - else - loc = C_NULL_PTR - end if - - else if (field == 'type_absorb') then - if (allocated(spectrum%Gas%type_absorb)) then - loc = C_LOC(spectrum%Gas%type_absorb) - ndim = size(shape(spectrum%Gas%type_absorb)) - dims(1:ndim) = shape(spectrum%Gas%type_absorb) - lbounds(1:ndim) = lbound(spectrum%Gas%type_absorb) - else - loc = C_NULL_PTR - end if - - else if (field == 'n_mix_gas') then - if (allocated(spectrum%Gas%n_mix_gas)) then - loc = C_LOC(spectrum%Gas%n_mix_gas) - ndim = size(shape(spectrum%Gas%n_mix_gas)) - dims(1:ndim) = shape(spectrum%Gas%n_mix_gas) - lbounds(1:ndim) = lbound(spectrum%Gas%n_mix_gas) - else - loc = C_NULL_PTR - end if - - else if (field == 'index_mix_gas') then - if (allocated(spectrum%Gas%index_mix_gas)) then - loc = C_LOC(spectrum%Gas%index_mix_gas) - ndim = size(shape(spectrum%Gas%index_mix_gas)) - dims(1:ndim) = shape(spectrum%Gas%index_mix_gas) - lbounds(1:ndim) = lbound(spectrum%Gas%index_mix_gas) - else - loc = C_NULL_PTR - end if - - else if (field == 'num_mix') then - if (allocated(spectrum%Gas%num_mix)) then - loc = C_LOC(spectrum%Gas%num_mix) - ndim = size(shape(spectrum%Gas%num_mix)) - dims(1:ndim) = shape(spectrum%Gas%num_mix) - lbounds(1:ndim) = lbound(spectrum%Gas%num_mix) - else - loc = C_NULL_PTR - end if - - else if (field == 'mix_gas_band') then - if (allocated(spectrum%Gas%mix_gas_band)) then - loc = C_LOC(spectrum%Gas%mix_gas_band) - ndim = size(shape(spectrum%Gas%mix_gas_band)) - dims(1:ndim) = shape(spectrum%Gas%mix_gas_band) - lbounds(1:ndim) = lbound(spectrum%Gas%mix_gas_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'num_ref_p') then - if (allocated(spectrum%Gas%num_ref_p)) then - loc = C_LOC(spectrum%Gas%num_ref_p) - ndim = size(shape(spectrum%Gas%num_ref_p)) - dims(1:ndim) = shape(spectrum%Gas%num_ref_p) - lbounds(1:ndim) = lbound(spectrum%Gas%num_ref_p) - else - loc = C_NULL_PTR - end if - - else if (field == 'num_ref_t') then - if (allocated(spectrum%Gas%num_ref_t)) then - loc = C_LOC(spectrum%Gas%num_ref_t) - ndim = size(shape(spectrum%Gas%num_ref_t)) - dims(1:ndim) = shape(spectrum%Gas%num_ref_t) - lbounds(1:ndim) = lbound(spectrum%Gas%num_ref_t) - else - loc = C_NULL_PTR - end if - - else if (field == 'i_band_k') then - if (allocated(spectrum%Gas%i_band_k)) then - loc = C_LOC(spectrum%Gas%i_band_k) - ndim = size(shape(spectrum%Gas%i_band_k)) - dims(1:ndim) = shape(spectrum%Gas%i_band_k) - lbounds(1:ndim) = lbound(spectrum%Gas%i_band_k) - else - loc = C_NULL_PTR - end if - - else if (field == 'i_band_k_ses') then - if (allocated(spectrum%Gas%i_band_k_ses)) then - loc = C_LOC(spectrum%Gas%i_band_k_ses) - ndim = size(shape(spectrum%Gas%i_band_k_ses)) - dims(1:ndim) = shape(spectrum%Gas%i_band_k_ses) - lbounds(1:ndim) = lbound(spectrum%Gas%i_band_k_ses) - else - loc = C_NULL_PTR - end if - - else if (field == 'i_scale_k') then - if (allocated(spectrum%Gas%i_scale_k)) then - loc = C_LOC(spectrum%Gas%i_scale_k) - ndim = size(shape(spectrum%Gas%i_scale_k)) - dims(1:ndim) = shape(spectrum%Gas%i_scale_k) - lbounds(1:ndim) = lbound(spectrum%Gas%i_scale_k) - else - loc = C_NULL_PTR - end if - - else if (field == 'i_scale_fnc') then - if (allocated(spectrum%Gas%i_scale_fnc)) then - loc = C_LOC(spectrum%Gas%i_scale_fnc) - ndim = size(shape(spectrum%Gas%i_scale_fnc)) - dims(1:ndim) = shape(spectrum%Gas%i_scale_fnc) - lbounds(1:ndim) = lbound(spectrum%Gas%i_scale_fnc) - else - loc = C_NULL_PTR - end if - - else if (field == 'i_scat') then - if (allocated(spectrum%Gas%i_scat)) then - loc = C_LOC(spectrum%Gas%i_scat) - ndim = size(shape(spectrum%Gas%i_scat)) - dims(1:ndim) = shape(spectrum%Gas%i_scat) - lbounds(1:ndim) = lbound(spectrum%Gas%i_scat) - else - loc = C_NULL_PTR - end if - - else if (field == 'i_overlap') then - if (allocated(spectrum%Gas%i_overlap)) then - loc = C_LOC(spectrum%Gas%i_overlap) - ndim = size(shape(spectrum%Gas%i_overlap)) - dims(1:ndim) = shape(spectrum%Gas%i_overlap) - lbounds(1:ndim) = lbound(spectrum%Gas%i_overlap) - else - loc = C_NULL_PTR - end if - - else if (field == 'n_sub_band_gas') then - if (allocated(spectrum%Gas%n_sub_band_gas)) then - loc = C_LOC(spectrum%Gas%n_sub_band_gas) - ndim = size(shape(spectrum%Gas%n_sub_band_gas)) - dims(1:ndim) = shape(spectrum%Gas%n_sub_band_gas) - lbounds(1:ndim) = lbound(spectrum%Gas%n_sub_band_gas) - else - loc = C_NULL_PTR - end if - - else if (field == 'sub_band_k') then - if (allocated(spectrum%Gas%sub_band_k)) then - loc = C_LOC(spectrum%Gas%sub_band_k) - ndim = size(shape(spectrum%Gas%sub_band_k)) - dims(1:ndim) = shape(spectrum%Gas%sub_band_k) - lbounds(1:ndim) = lbound(spectrum%Gas%sub_band_k) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataGas_get_integer_array - - function StrSpecDataGas_get_real_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataGas_get_real_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'k') then - if (allocated(spectrum%Gas%k)) then - loc = C_LOC(spectrum%Gas%k) - ndim = size(shape(spectrum%Gas%k)) - dims(1:ndim) = shape(spectrum%Gas%k) - lbounds(1:ndim) = lbound(spectrum%Gas%k) - else - loc = C_NULL_PTR - end if - - else if (field == 'w') then - if (allocated(spectrum%Gas%w)) then - loc = C_LOC(spectrum%Gas%w) - ndim = size(shape(spectrum%Gas%w)) - dims(1:ndim) = shape(spectrum%Gas%w) - lbounds(1:ndim) = lbound(spectrum%Gas%w) - else - loc = C_NULL_PTR - end if - - else if (field == 'scale') then - if (allocated(spectrum%Gas%scale)) then - loc = C_LOC(spectrum%Gas%scale) - ndim = size(shape(spectrum%Gas%scale)) - dims(1:ndim) = shape(spectrum%Gas%scale) - lbounds(1:ndim) = lbound(spectrum%Gas%scale) - else - loc = C_NULL_PTR - end if - - else if (field == 'p_ref') then - if (allocated(spectrum%Gas%p_ref)) then - loc = C_LOC(spectrum%Gas%p_ref) - ndim = size(shape(spectrum%Gas%p_ref)) - dims(1:ndim) = shape(spectrum%Gas%p_ref) - lbounds(1:ndim) = lbound(spectrum%Gas%p_ref) - else - loc = C_NULL_PTR - end if - - else if (field == 't_ref') then - if (allocated(spectrum%Gas%t_ref)) then - loc = C_LOC(spectrum%Gas%t_ref) - ndim = size(shape(spectrum%Gas%t_ref)) - dims(1:ndim) = shape(spectrum%Gas%t_ref) - lbounds(1:ndim) = lbound(spectrum%Gas%t_ref) - else - loc = C_NULL_PTR - end if - - else if (field == 'p_lookup') then - if (allocated(spectrum%Gas%p_lookup)) then - loc = C_LOC(spectrum%Gas%p_lookup) - ndim = size(shape(spectrum%Gas%p_lookup)) - dims(1:ndim) = shape(spectrum%Gas%p_lookup) - lbounds(1:ndim) = lbound(spectrum%Gas%p_lookup) - else - loc = C_NULL_PTR - end if - - else if (field == 't_lookup') then - if (allocated(spectrum%Gas%t_lookup)) then - loc = C_LOC(spectrum%Gas%t_lookup) - ndim = size(shape(spectrum%Gas%t_lookup)) - dims(1:ndim) = shape(spectrum%Gas%t_lookup) - lbounds(1:ndim) = lbound(spectrum%Gas%t_lookup) - else - loc = C_NULL_PTR - end if - - else if (field == 'gf_lookup') then - if (allocated(spectrum%Gas%gf_lookup)) then - loc = C_LOC(spectrum%Gas%gf_lookup) - ndim = size(shape(spectrum%Gas%gf_lookup)) - dims(1:ndim) = shape(spectrum%Gas%gf_lookup) - lbounds(1:ndim) = lbound(spectrum%Gas%gf_lookup) - else - loc = C_NULL_PTR - end if - - else if (field == 'k_lookup') then - if (allocated(spectrum%Gas%k_lookup)) then - loc = C_LOC(spectrum%Gas%k_lookup) - ndim = size(shape(spectrum%Gas%k_lookup)) - dims(1:ndim) = shape(spectrum%Gas%k_lookup) - lbounds(1:ndim) = lbound(spectrum%Gas%k_lookup) - else - loc = C_NULL_PTR - end if - - else if (field == 'k_lookup_sb') then - if (allocated(spectrum%Gas%k_lookup_sb)) then - loc = C_LOC(spectrum%Gas%k_lookup_sb) - ndim = size(shape(spectrum%Gas%k_lookup_sb)) - dims(1:ndim) = shape(spectrum%Gas%k_lookup_sb) - lbounds(1:ndim) = lbound(spectrum%Gas%k_lookup_sb) - else - loc = C_NULL_PTR - end if - - else if (field == 'w_ses') then - if (allocated(spectrum%Gas%w_ses)) then - loc = C_LOC(spectrum%Gas%w_ses) - ndim = size(shape(spectrum%Gas%w_ses)) - dims(1:ndim) = shape(spectrum%Gas%w_ses) - lbounds(1:ndim) = lbound(spectrum%Gas%w_ses) - else - loc = C_NULL_PTR - end if - - else if (field == 'k_mix_gas') then - if (allocated(spectrum%Gas%k_mix_gas)) then - loc = C_LOC(spectrum%Gas%k_mix_gas) - ndim = size(shape(spectrum%Gas%k_mix_gas)) - dims(1:ndim) = shape(spectrum%Gas%k_mix_gas) - lbounds(1:ndim) = lbound(spectrum%Gas%k_mix_gas) - else - loc = C_NULL_PTR - end if - - else if (field == 'f_mix') then - if (allocated(spectrum%Gas%f_mix)) then - loc = C_LOC(spectrum%Gas%f_mix) - ndim = size(shape(spectrum%Gas%f_mix)) - dims(1:ndim) = shape(spectrum%Gas%f_mix) - lbounds(1:ndim) = lbound(spectrum%Gas%f_mix) - else - loc = C_NULL_PTR - end if - - else if (field == 'doppler_cor') then - if (allocated(spectrum%Gas%doppler_cor)) then - loc = C_LOC(spectrum%Gas%doppler_cor) - ndim = size(shape(spectrum%Gas%doppler_cor)) - dims(1:ndim) = shape(spectrum%Gas%doppler_cor) - lbounds(1:ndim) = lbound(spectrum%Gas%doppler_cor) - else - loc = C_NULL_PTR - end if - - else if (field == 'sub_band_w') then - if (allocated(spectrum%Gas%sub_band_w)) then - loc = C_LOC(spectrum%Gas%sub_band_w) - ndim = size(shape(spectrum%Gas%sub_band_w)) - dims(1:ndim) = shape(spectrum%Gas%sub_band_w) - lbounds(1:ndim) = lbound(spectrum%Gas%sub_band_w) - else - loc = C_NULL_PTR - end if - - else if (field == 'wavelength_sub_band') then - if (allocated(spectrum%Gas%wavelength_sub_band)) then - loc = C_LOC(spectrum%Gas%wavelength_sub_band) - ndim = size(shape(spectrum%Gas%wavelength_sub_band)) - dims(1:ndim) = shape(spectrum%Gas%wavelength_sub_band) - lbounds(1:ndim) = lbound(spectrum%Gas%wavelength_sub_band) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataGas_get_real_array - -end module StrSpecDataGas_C diff --git a/julia/gen/StrSpecDataGas_JL.jl b/julia/gen/StrSpecDataGas_JL.jl deleted file mode 100644 index 11ce1cc..0000000 --- a/julia/gen/StrSpecDataGas_JL.jl +++ /dev/null @@ -1,212 +0,0 @@ -# Autogenerated from src/radiance_core/def_spectrum.F90 -# svn revision 1226 - - - mutable struct StrSpecDataGas{P} - parent_handle::P - end - - - # this is used to show values in the REPL and when using IJulia - function Base.show(io::IO, m::MIME"text/plain", handle::StrSpecDataGas) - println(io, handle) - dump_properties(io, handle) - end - - - function Base.propertynames(handle::StrSpecDataGas, private::Bool=false) - names = [ - :n_absorb, - :n_absorb_sb, - :n_gas_frac, - :n_band_absorb, - :index_absorb, - :index_sb, - :type_absorb, - :n_mix_gas, - :index_mix_gas, - :num_mix, - :mix_gas_band, - :num_ref_p, - :num_ref_t, - :i_band_k, - :i_band_k_ses, - :i_scale_k, - :i_scale_fnc, - :i_scat, - :i_overlap, - :l_self_broadening, - :k, - :w, - :scale, - :p_ref, - :t_ref, - :p_lookup, - :t_lookup, - :gf_lookup, - :k_lookup, - :k_lookup_sb, - :w_ses, - :k_mix_gas, - :f_mix, - :l_doppler, - :doppler_cor, - :n_sub_band_gas, - :sub_band_k, - :sub_band_w, - :wavelength_sub_band, - ] - - return names - end - - - function Base.getproperty(handle::StrSpecDataGas, field::Symbol) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :n_absorb, - :n_absorb_sb, - :n_gas_frac, - ) - val = Ref{Cint}() - field_ok = ccall( - (:PS_StrSpecDataGas_get_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Cint}), - cptr, String(field), val - ) - Bool(field_ok) || error("StrSpecDataGas integer field $field not present - coding error") - return val[] - elseif field in ( - :l_self_broadening, - :l_doppler, - ) - loc = Ref{Ptr{Cint}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataGas_get_logical_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cint}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataGas Cint array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - elseif field in ( - :n_band_absorb, - :index_absorb, - :index_sb, - :type_absorb, - :n_mix_gas, - :index_mix_gas, - :num_mix, - :mix_gas_band, - :num_ref_p, - :num_ref_t, - :i_band_k, - :i_band_k_ses, - :i_scale_k, - :i_scale_fnc, - :i_scat, - :i_overlap, - :n_sub_band_gas, - :sub_band_k, - ) - loc = Ref{Ptr{Cint}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataGas_get_integer_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cint}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataGas Cint array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - elseif field in ( - :k, - :w, - :scale, - :p_ref, - :t_ref, - :p_lookup, - :t_lookup, - :gf_lookup, - :k_lookup, - :k_lookup_sb, - :w_ses, - :k_mix_gas, - :f_mix, - :doppler_cor, - :sub_band_w, - :wavelength_sub_band, - ) - loc = Ref{Ptr{Cdouble}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataGas_get_real_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cdouble}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataGas Cdouble array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - else - return getfield(handle, field) - end - - end - - - function Base.setproperty!(handle::StrSpecDataGas, field::Symbol, val) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :n_absorb, - :n_absorb_sb, - :n_gas_frac, - ) - - field_ok = ccall( - (:PS_StrSpecDataGas_set_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Cint), - cptr, String(field), val - ) - Bool(field_ok) || error("StrSpecDataGas integer field $field not present - coding error") - return val - else - error("type StrSpecDataGas has no writeable field $field") - end - - end - diff --git a/julia/gen/StrSpecDataIce_C.f90 b/julia/gen/StrSpecDataIce_C.f90 deleted file mode 100644 index 3554a8b..0000000 --- a/julia/gen/StrSpecDataIce_C.f90 +++ /dev/null @@ -1,170 +0,0 @@ -! Autogenerated from Fortran file src/radiance_core/def_spectrum.F90 -! svn revision 1226 - -module StrSpecDataIce_C - -use, intrinsic :: iso_c_binding - -use UTILITIES_CF -use def_spectrum - -implicit none - -private - -contains - - function StrSpecDataIce_get_logical_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataIce_get_logical_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'l_ice_type') then - if (allocated(spectrum%Ice%l_ice_type)) then - loc = C_LOC(spectrum%Ice%l_ice_type) - ndim = size(shape(spectrum%Ice%l_ice_type)) - dims(1:ndim) = shape(spectrum%Ice%l_ice_type) - lbounds(1:ndim) = lbound(spectrum%Ice%l_ice_type) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataIce_get_logical_array - - function StrSpecDataIce_get_integer_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataIce_get_integer_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'i_ice_parm') then - if (allocated(spectrum%Ice%i_ice_parm)) then - loc = C_LOC(spectrum%Ice%i_ice_parm) - ndim = size(shape(spectrum%Ice%i_ice_parm)) - dims(1:ndim) = shape(spectrum%Ice%i_ice_parm) - lbounds(1:ndim) = lbound(spectrum%Ice%i_ice_parm) - else - loc = C_NULL_PTR - end if - - else if (field == 'n_phf') then - if (allocated(spectrum%Ice%n_phf)) then - loc = C_LOC(spectrum%Ice%n_phf) - ndim = size(shape(spectrum%Ice%n_phf)) - dims(1:ndim) = shape(spectrum%Ice%n_phf) - lbounds(1:ndim) = lbound(spectrum%Ice%n_phf) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataIce_get_integer_array - - function StrSpecDataIce_get_real_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataIce_get_real_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'parm_list') then - if (allocated(spectrum%Ice%parm_list)) then - loc = C_LOC(spectrum%Ice%parm_list) - ndim = size(shape(spectrum%Ice%parm_list)) - dims(1:ndim) = shape(spectrum%Ice%parm_list) - lbounds(1:ndim) = lbound(spectrum%Ice%parm_list) - else - loc = C_NULL_PTR - end if - - else if (field == 'parm_min_dim') then - if (allocated(spectrum%Ice%parm_min_dim)) then - loc = C_LOC(spectrum%Ice%parm_min_dim) - ndim = size(shape(spectrum%Ice%parm_min_dim)) - dims(1:ndim) = shape(spectrum%Ice%parm_min_dim) - lbounds(1:ndim) = lbound(spectrum%Ice%parm_min_dim) - else - loc = C_NULL_PTR - end if - - else if (field == 'parm_max_dim') then - if (allocated(spectrum%Ice%parm_max_dim)) then - loc = C_LOC(spectrum%Ice%parm_max_dim) - ndim = size(shape(spectrum%Ice%parm_max_dim)) - dims(1:ndim) = shape(spectrum%Ice%parm_max_dim) - lbounds(1:ndim) = lbound(spectrum%Ice%parm_max_dim) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataIce_get_real_array - -end module StrSpecDataIce_C diff --git a/julia/gen/StrSpecDataIce_JL.jl b/julia/gen/StrSpecDataIce_JL.jl deleted file mode 100644 index 505502a..0000000 --- a/julia/gen/StrSpecDataIce_JL.jl +++ /dev/null @@ -1,119 +0,0 @@ -# Autogenerated from src/radiance_core/def_spectrum.F90 -# svn revision 1226 - - - mutable struct StrSpecDataIce{P} - parent_handle::P - end - - - # this is used to show values in the REPL and when using IJulia - function Base.show(io::IO, m::MIME"text/plain", handle::StrSpecDataIce) - println(io, handle) - dump_properties(io, handle) - end - - - function Base.propertynames(handle::StrSpecDataIce, private::Bool=false) - names = [ - :l_ice_type, - :i_ice_parm, - :n_phf, - :parm_list, - :parm_min_dim, - :parm_max_dim, - ] - - return names - end - - - function Base.getproperty(handle::StrSpecDataIce, field::Symbol) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :l_ice_type, - ) - loc = Ref{Ptr{Cint}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataIce_get_logical_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cint}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataIce Cint array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - elseif field in ( - :i_ice_parm, - :n_phf, - ) - loc = Ref{Ptr{Cint}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataIce_get_integer_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cint}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataIce Cint array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - elseif field in ( - :parm_list, - :parm_min_dim, - :parm_max_dim, - ) - loc = Ref{Ptr{Cdouble}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataIce_get_real_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cdouble}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataIce Cdouble array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - else - return getfield(handle, field) - end - - end - - - function Base.setproperty!(handle::StrSpecDataIce, field::Symbol, val) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - error("type StrSpecDataIce has no writeable field $field") - - end - diff --git a/julia/gen/StrSpecDataMap_C.f90 b/julia/gen/StrSpecDataMap_C.f90 deleted file mode 100644 index 415cc0f..0000000 --- a/julia/gen/StrSpecDataMap_C.f90 +++ /dev/null @@ -1,149 +0,0 @@ -! Autogenerated from Fortran file src/radiance_core/def_spectrum.F90 -! svn revision 1226 - -module StrSpecDataMap_C - -use, intrinsic :: iso_c_binding - -use UTILITIES_CF -use def_spectrum - -implicit none - -private - -contains - - function StrSpecDataMap_get_integer_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataMap_get_integer_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'n_sub_band_k') then - if (allocated(spectrum%Map%n_sub_band_k)) then - loc = C_LOC(spectrum%Map%n_sub_band_k) - ndim = size(shape(spectrum%Map%n_sub_band_k)) - dims(1:ndim) = shape(spectrum%Map%n_sub_band_k) - lbounds(1:ndim) = lbound(spectrum%Map%n_sub_band_k) - else - loc = C_NULL_PTR - end if - - else if (field == 'list_sub_band_k') then - if (allocated(spectrum%Map%list_sub_band_k)) then - loc = C_LOC(spectrum%Map%list_sub_band_k) - ndim = size(shape(spectrum%Map%list_sub_band_k)) - dims(1:ndim) = shape(spectrum%Map%list_sub_band_k) - lbounds(1:ndim) = lbound(spectrum%Map%list_sub_band_k) - else - loc = C_NULL_PTR - end if - - else if (field == 'n_k_sub_band') then - if (allocated(spectrum%Map%n_k_sub_band)) then - loc = C_LOC(spectrum%Map%n_k_sub_band) - ndim = size(shape(spectrum%Map%n_k_sub_band)) - dims(1:ndim) = shape(spectrum%Map%n_k_sub_band) - lbounds(1:ndim) = lbound(spectrum%Map%n_k_sub_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'list_k_sub_band') then - if (allocated(spectrum%Map%list_k_sub_band)) then - loc = C_LOC(spectrum%Map%list_k_sub_band) - ndim = size(shape(spectrum%Map%list_k_sub_band)) - dims(1:ndim) = shape(spectrum%Map%list_k_sub_band) - lbounds(1:ndim) = lbound(spectrum%Map%list_k_sub_band) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataMap_get_integer_array - - function StrSpecDataMap_get_real_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataMap_get_real_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'weight_sub_band_k') then - if (allocated(spectrum%Map%weight_sub_band_k)) then - loc = C_LOC(spectrum%Map%weight_sub_band_k) - ndim = size(shape(spectrum%Map%weight_sub_band_k)) - dims(1:ndim) = shape(spectrum%Map%weight_sub_band_k) - lbounds(1:ndim) = lbound(spectrum%Map%weight_sub_band_k) - else - loc = C_NULL_PTR - end if - - else if (field == 'weight_k_sub_band') then - if (allocated(spectrum%Map%weight_k_sub_band)) then - loc = C_LOC(spectrum%Map%weight_k_sub_band) - ndim = size(shape(spectrum%Map%weight_k_sub_band)) - dims(1:ndim) = shape(spectrum%Map%weight_k_sub_band) - lbounds(1:ndim) = lbound(spectrum%Map%weight_k_sub_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'weight_k_major') then - if (allocated(spectrum%Map%weight_k_major)) then - loc = C_LOC(spectrum%Map%weight_k_major) - ndim = size(shape(spectrum%Map%weight_k_major)) - dims(1:ndim) = shape(spectrum%Map%weight_k_major) - lbounds(1:ndim) = lbound(spectrum%Map%weight_k_major) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataMap_get_real_array - -end module StrSpecDataMap_C diff --git a/julia/gen/StrSpecDataMap_JL.jl b/julia/gen/StrSpecDataMap_JL.jl deleted file mode 100644 index 1b074f4..0000000 --- a/julia/gen/StrSpecDataMap_JL.jl +++ /dev/null @@ -1,101 +0,0 @@ -# Autogenerated from src/radiance_core/def_spectrum.F90 -# svn revision 1226 - - - mutable struct StrSpecDataMap{P} - parent_handle::P - end - - - # this is used to show values in the REPL and when using IJulia - function Base.show(io::IO, m::MIME"text/plain", handle::StrSpecDataMap) - println(io, handle) - dump_properties(io, handle) - end - - - function Base.propertynames(handle::StrSpecDataMap, private::Bool=false) - names = [ - :n_sub_band_k, - :list_sub_band_k, - :weight_sub_band_k, - :n_k_sub_band, - :list_k_sub_band, - :weight_k_sub_band, - :weight_k_major, - ] - - return names - end - - - function Base.getproperty(handle::StrSpecDataMap, field::Symbol) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :n_sub_band_k, - :list_sub_band_k, - :n_k_sub_band, - :list_k_sub_band, - ) - loc = Ref{Ptr{Cint}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataMap_get_integer_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cint}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataMap Cint array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - elseif field in ( - :weight_sub_band_k, - :weight_k_sub_band, - :weight_k_major, - ) - loc = Ref{Ptr{Cdouble}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataMap_get_real_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cdouble}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataMap Cdouble array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - else - return getfield(handle, field) - end - - end - - - function Base.setproperty!(handle::StrSpecDataMap, field::Symbol, val) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - error("type StrSpecDataMap has no writeable field $field") - - end - diff --git a/julia/gen/StrSpecDataPhotol_C.f90 b/julia/gen/StrSpecDataPhotol_C.f90 deleted file mode 100644 index a27c832..0000000 --- a/julia/gen/StrSpecDataPhotol_C.f90 +++ /dev/null @@ -1,264 +0,0 @@ -! Autogenerated from Fortran file src/radiance_core/def_spectrum.F90 -! svn revision 1226 - -module StrSpecDataPhotol_C - -use, intrinsic :: iso_c_binding - -use UTILITIES_CF -use def_spectrum - -implicit none - -private - -contains - - function StrSpecDataPhotol_get_integer(spectrum_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrSpecDataPhotol_get_integer') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), intent(out) :: val - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'n_pathway') then - val = spectrum%Photol%n_pathway - else - field_OK = .FALSE. - end if - - end function StrSpecDataPhotol_get_integer - - function StrSpecDataPhotol_set_integer(spectrum_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrSpecDataPhotol_set_integer') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), value, intent(in) :: val - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'n_pathway') then - spectrum%Photol%n_pathway = val - else - field_OK = .FALSE. - end if - - end function StrSpecDataPhotol_set_integer - - function StrSpecDataPhotol_get_logical_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataPhotol_get_logical_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'l_thermalise') then - if (allocated(spectrum%Photol%l_thermalise)) then - loc = C_LOC(spectrum%Photol%l_thermalise) - ndim = size(shape(spectrum%Photol%l_thermalise)) - dims(1:ndim) = shape(spectrum%Photol%l_thermalise) - lbounds(1:ndim) = lbound(spectrum%Photol%l_thermalise) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataPhotol_get_logical_array - - function StrSpecDataPhotol_get_integer_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataPhotol_get_integer_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'pathway_absorber') then - if (allocated(spectrum%Photol%pathway_absorber)) then - loc = C_LOC(spectrum%Photol%pathway_absorber) - ndim = size(shape(spectrum%Photol%pathway_absorber)) - dims(1:ndim) = shape(spectrum%Photol%pathway_absorber) - lbounds(1:ndim) = lbound(spectrum%Photol%pathway_absorber) - else - loc = C_NULL_PTR - end if - - else if (field == 'pathway_products') then - if (allocated(spectrum%Photol%pathway_products)) then - loc = C_LOC(spectrum%Photol%pathway_products) - ndim = size(shape(spectrum%Photol%pathway_products)) - dims(1:ndim) = shape(spectrum%Photol%pathway_products) - lbounds(1:ndim) = lbound(spectrum%Photol%pathway_products) - else - loc = C_NULL_PTR - end if - - else if (field == 'n_t_lookup_photol') then - if (allocated(spectrum%Photol%n_t_lookup_photol)) then - loc = C_LOC(spectrum%Photol%n_t_lookup_photol) - ndim = size(shape(spectrum%Photol%n_t_lookup_photol)) - dims(1:ndim) = shape(spectrum%Photol%n_t_lookup_photol) - lbounds(1:ndim) = lbound(spectrum%Photol%n_t_lookup_photol) - else - loc = C_NULL_PTR - end if - - else if (field == 'n_wl_lookup_photol') then - if (allocated(spectrum%Photol%n_wl_lookup_photol)) then - loc = C_LOC(spectrum%Photol%n_wl_lookup_photol) - ndim = size(shape(spectrum%Photol%n_wl_lookup_photol)) - dims(1:ndim) = shape(spectrum%Photol%n_wl_lookup_photol) - lbounds(1:ndim) = lbound(spectrum%Photol%n_wl_lookup_photol) - else - loc = C_NULL_PTR - end if - - else if (field == 'qy_sub') then - if (allocated(spectrum%Photol%qy_sub)) then - loc = C_LOC(spectrum%Photol%qy_sub) - ndim = size(shape(spectrum%Photol%qy_sub)) - dims(1:ndim) = shape(spectrum%Photol%qy_sub) - lbounds(1:ndim) = lbound(spectrum%Photol%qy_sub) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataPhotol_get_integer_array - - function StrSpecDataPhotol_get_real_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataPhotol_get_real_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 't_lookup_photol') then - if (allocated(spectrum%Photol%t_lookup_photol)) then - loc = C_LOC(spectrum%Photol%t_lookup_photol) - ndim = size(shape(spectrum%Photol%t_lookup_photol)) - dims(1:ndim) = shape(spectrum%Photol%t_lookup_photol) - lbounds(1:ndim) = lbound(spectrum%Photol%t_lookup_photol) - else - loc = C_NULL_PTR - end if - - else if (field == 'wl_lookup_photol') then - if (allocated(spectrum%Photol%wl_lookup_photol)) then - loc = C_LOC(spectrum%Photol%wl_lookup_photol) - ndim = size(shape(spectrum%Photol%wl_lookup_photol)) - dims(1:ndim) = shape(spectrum%Photol%wl_lookup_photol) - lbounds(1:ndim) = lbound(spectrum%Photol%wl_lookup_photol) - else - loc = C_NULL_PTR - end if - - else if (field == 'quantum_yield') then - if (allocated(spectrum%Photol%quantum_yield)) then - loc = C_LOC(spectrum%Photol%quantum_yield) - ndim = size(shape(spectrum%Photol%quantum_yield)) - dims(1:ndim) = shape(spectrum%Photol%quantum_yield) - lbounds(1:ndim) = lbound(spectrum%Photol%quantum_yield) - else - loc = C_NULL_PTR - end if - - else if (field == 'threshold_wavelength') then - if (allocated(spectrum%Photol%threshold_wavelength)) then - loc = C_LOC(spectrum%Photol%threshold_wavelength) - ndim = size(shape(spectrum%Photol%threshold_wavelength)) - dims(1:ndim) = shape(spectrum%Photol%threshold_wavelength) - lbounds(1:ndim) = lbound(spectrum%Photol%threshold_wavelength) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataPhotol_get_real_array - -end module StrSpecDataPhotol_C diff --git a/julia/gen/StrSpecDataPhotol_JL.jl b/julia/gen/StrSpecDataPhotol_JL.jl deleted file mode 100644 index cc94b0c..0000000 --- a/julia/gen/StrSpecDataPhotol_JL.jl +++ /dev/null @@ -1,154 +0,0 @@ -# Autogenerated from src/radiance_core/def_spectrum.F90 -# svn revision 1226 - - - mutable struct StrSpecDataPhotol{P} - parent_handle::P - end - - - # this is used to show values in the REPL and when using IJulia - function Base.show(io::IO, m::MIME"text/plain", handle::StrSpecDataPhotol) - println(io, handle) - dump_properties(io, handle) - end - - - function Base.propertynames(handle::StrSpecDataPhotol, private::Bool=false) - names = [ - :l_thermalise, - :n_pathway, - :pathway_absorber, - :pathway_products, - :n_t_lookup_photol, - :n_wl_lookup_photol, - :qy_sub, - :t_lookup_photol, - :wl_lookup_photol, - :quantum_yield, - :threshold_wavelength, - ] - - return names - end - - - function Base.getproperty(handle::StrSpecDataPhotol, field::Symbol) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :n_pathway, - ) - val = Ref{Cint}() - field_ok = ccall( - (:PS_StrSpecDataPhotol_get_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Cint}), - cptr, String(field), val - ) - Bool(field_ok) || error("StrSpecDataPhotol integer field $field not present - coding error") - return val[] - elseif field in ( - :l_thermalise, - ) - loc = Ref{Ptr{Cint}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataPhotol_get_logical_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cint}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataPhotol Cint array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - elseif field in ( - :pathway_absorber, - :pathway_products, - :n_t_lookup_photol, - :n_wl_lookup_photol, - :qy_sub, - ) - loc = Ref{Ptr{Cint}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataPhotol_get_integer_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cint}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataPhotol Cint array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - elseif field in ( - :t_lookup_photol, - :wl_lookup_photol, - :quantum_yield, - :threshold_wavelength, - ) - loc = Ref{Ptr{Cdouble}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataPhotol_get_real_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cdouble}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataPhotol Cdouble array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - else - return getfield(handle, field) - end - - end - - - function Base.setproperty!(handle::StrSpecDataPhotol, field::Symbol, val) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :n_pathway, - ) - - field_ok = ccall( - (:PS_StrSpecDataPhotol_set_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Cint), - cptr, String(field), val - ) - Bool(field_ok) || error("StrSpecDataPhotol integer field $field not present - coding error") - return val - else - error("type StrSpecDataPhotol has no writeable field $field") - end - - end - diff --git a/julia/gen/StrSpecDataPlanck_C.f90 b/julia/gen/StrSpecDataPlanck_C.f90 deleted file mode 100644 index fe0f492..0000000 --- a/julia/gen/StrSpecDataPlanck_C.f90 +++ /dev/null @@ -1,230 +0,0 @@ -! Autogenerated from Fortran file src/radiance_core/def_spectrum.F90 -! svn revision 1226 - -module StrSpecDataPlanck_C - -use, intrinsic :: iso_c_binding - -use UTILITIES_CF -use def_spectrum - -implicit none - -private - -contains - - function StrSpecDataPlanck_get_logical(spectrum_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrSpecDataPlanck_get_logical') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - logical(c_bool), intent(out) :: val - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'l_planck_tbl') then - val = spectrum%Planck%l_planck_tbl - else - field_OK = .FALSE. - end if - - end function StrSpecDataPlanck_get_logical - - function StrSpecDataPlanck_set_logical(spectrum_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrSpecDataPlanck_set_logical') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - logical(c_bool), value, intent(in) :: val - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'l_planck_tbl') then - spectrum%Planck%l_planck_tbl = val - else - field_OK = .FALSE. - end if - - end function StrSpecDataPlanck_set_logical - - function StrSpecDataPlanck_get_integer(spectrum_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrSpecDataPlanck_get_integer') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), intent(out) :: val - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'n_deg_fit') then - val = spectrum%Planck%n_deg_fit - else - field_OK = .FALSE. - end if - - end function StrSpecDataPlanck_get_integer - - function StrSpecDataPlanck_set_integer(spectrum_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrSpecDataPlanck_set_integer') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), value, intent(in) :: val - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'n_deg_fit') then - spectrum%Planck%n_deg_fit = val - else - field_OK = .FALSE. - end if - - end function StrSpecDataPlanck_set_integer - - function StrSpecDataPlanck_get_real(spectrum_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrSpecDataPlanck_get_real') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - real(c_double), intent(out) :: val - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 't_ref_planck') then - val = spectrum%Planck%t_ref_planck - else - field_OK = .FALSE. - end if - - end function StrSpecDataPlanck_get_real - - function StrSpecDataPlanck_set_real(spectrum_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrSpecDataPlanck_set_real') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - real(c_double), value, intent(in) :: val - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 't_ref_planck') then - spectrum%Planck%t_ref_planck = val - else - field_OK = .FALSE. - end if - - end function StrSpecDataPlanck_set_real - - function StrSpecDataPlanck_get_real_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataPlanck_get_real_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'thermal_coeff') then - if (allocated(spectrum%Planck%thermal_coeff)) then - loc = C_LOC(spectrum%Planck%thermal_coeff) - ndim = size(shape(spectrum%Planck%thermal_coeff)) - dims(1:ndim) = shape(spectrum%Planck%thermal_coeff) - lbounds(1:ndim) = lbound(spectrum%Planck%thermal_coeff) - else - loc = C_NULL_PTR - end if - - else if (field == 'theta_planck_tbl') then - if (allocated(spectrum%Planck%theta_planck_tbl)) then - loc = C_LOC(spectrum%Planck%theta_planck_tbl) - ndim = size(shape(spectrum%Planck%theta_planck_tbl)) - dims(1:ndim) = shape(spectrum%Planck%theta_planck_tbl) - lbounds(1:ndim) = lbound(spectrum%Planck%theta_planck_tbl) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataPlanck_get_real_array - -end module StrSpecDataPlanck_C diff --git a/julia/gen/StrSpecDataPlanck_JL.jl b/julia/gen/StrSpecDataPlanck_JL.jl deleted file mode 100644 index e557591..0000000 --- a/julia/gen/StrSpecDataPlanck_JL.jl +++ /dev/null @@ -1,149 +0,0 @@ -# Autogenerated from src/radiance_core/def_spectrum.F90 -# svn revision 1226 - - - mutable struct StrSpecDataPlanck{P} - parent_handle::P - end - - - # this is used to show values in the REPL and when using IJulia - function Base.show(io::IO, m::MIME"text/plain", handle::StrSpecDataPlanck) - println(io, handle) - dump_properties(io, handle) - end - - - function Base.propertynames(handle::StrSpecDataPlanck, private::Bool=false) - names = [ - :n_deg_fit, - :thermal_coeff, - :theta_planck_tbl, - :t_ref_planck, - :l_planck_tbl, - ] - - return names - end - - - function Base.getproperty(handle::StrSpecDataPlanck, field::Symbol) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :l_planck_tbl, - ) - - val = Ref{Cuchar}() - field_ok = ccall( - (:PS_StrSpecDataPlanck_get_logical, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Cuchar}), - cptr, String(field), val - ) - Bool(field_ok) || error("StrSpecDataPlanck logical field $field not present - coding error") - return Bool(val[]) - elseif field in ( - :n_deg_fit, - ) - val = Ref{Cint}() - field_ok = ccall( - (:PS_StrSpecDataPlanck_get_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Cint}), - cptr, String(field), val - ) - Bool(field_ok) || error("StrSpecDataPlanck integer field $field not present - coding error") - return val[] - elseif field in ( - :t_ref_planck, - ) - val = Ref{Cdouble}() - field_ok = ccall( - (:PS_StrSpecDataPlanck_get_real, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Cdouble}), - cptr, String(field), val - ) - Bool(field_ok) || error("StrSpecDataPlanck real field $field not present - coding error") - return val[] - elseif field in ( - :thermal_coeff, - :theta_planck_tbl, - ) - loc = Ref{Ptr{Cdouble}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataPlanck_get_real_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cdouble}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataPlanck Cdouble array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - else - return getfield(handle, field) - end - - end - - - function Base.setproperty!(handle::StrSpecDataPlanck, field::Symbol, val) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :l_planck_tbl, - ) - - field_ok = ccall( - (:PS_StrSpecDataPlanck_set_logical, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Cuchar), - cptr, String(field), val - ) - Bool(field_ok) || error("StrSpecDataPlanck logical field $field not present - coding error") - return val - elseif field in ( - :n_deg_fit, - ) - - field_ok = ccall( - (:PS_StrSpecDataPlanck_set_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Cint), - cptr, String(field), val - ) - Bool(field_ok) || error("StrSpecDataPlanck integer field $field not present - coding error") - return val - elseif field in ( - :t_ref_planck, - ) - - field_ok = ccall( - (:PS_StrSpecDataPlanck_set_real, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Cdouble), - cptr, String(field), val - ) - Bool(field_ok) || error("StrSpecDataPlanck real field $field not present - coding error") - return val - else - error("type StrSpecDataPlanck has no writeable field $field") - end - - end - diff --git a/julia/gen/StrSpecDataRayleigh_C.f90 b/julia/gen/StrSpecDataRayleigh_C.f90 deleted file mode 100644 index 59f9257..0000000 --- a/julia/gen/StrSpecDataRayleigh_C.f90 +++ /dev/null @@ -1,167 +0,0 @@ -! Autogenerated from Fortran file src/radiance_core/def_spectrum.F90 -! svn revision 1226 - -module StrSpecDataRayleigh_C - -use, intrinsic :: iso_c_binding - -use UTILITIES_CF -use def_spectrum - -implicit none - -private - -contains - - function StrSpecDataRayleigh_get_integer(spectrum_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrSpecDataRayleigh_get_integer') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), intent(out) :: val - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'i_rayleigh_scheme') then - val = spectrum%Rayleigh%i_rayleigh_scheme - else if (field == 'n_gas_rayleigh') then - val = spectrum%Rayleigh%n_gas_rayleigh - else - field_OK = .FALSE. - end if - - end function StrSpecDataRayleigh_get_integer - - function StrSpecDataRayleigh_set_integer(spectrum_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrSpecDataRayleigh_set_integer') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), value, intent(in) :: val - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'i_rayleigh_scheme') then - spectrum%Rayleigh%i_rayleigh_scheme = val - else if (field == 'n_gas_rayleigh') then - spectrum%Rayleigh%n_gas_rayleigh = val - else - field_OK = .FALSE. - end if - - end function StrSpecDataRayleigh_set_integer - - function StrSpecDataRayleigh_get_integer_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataRayleigh_get_integer_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'index_rayleigh') then - if (allocated(spectrum%Rayleigh%index_rayleigh)) then - loc = C_LOC(spectrum%Rayleigh%index_rayleigh) - ndim = size(shape(spectrum%Rayleigh%index_rayleigh)) - dims(1:ndim) = shape(spectrum%Rayleigh%index_rayleigh) - lbounds(1:ndim) = lbound(spectrum%Rayleigh%index_rayleigh) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataRayleigh_get_integer_array - - function StrSpecDataRayleigh_get_real_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataRayleigh_get_real_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'rayleigh_coeff') then - if (allocated(spectrum%Rayleigh%rayleigh_coeff)) then - loc = C_LOC(spectrum%Rayleigh%rayleigh_coeff) - ndim = size(shape(spectrum%Rayleigh%rayleigh_coeff)) - dims(1:ndim) = shape(spectrum%Rayleigh%rayleigh_coeff) - lbounds(1:ndim) = lbound(spectrum%Rayleigh%rayleigh_coeff) - else - loc = C_NULL_PTR - end if - - else if (field == 'rayleigh_coeff_gas') then - if (allocated(spectrum%Rayleigh%rayleigh_coeff_gas)) then - loc = C_LOC(spectrum%Rayleigh%rayleigh_coeff_gas) - ndim = size(shape(spectrum%Rayleigh%rayleigh_coeff_gas)) - dims(1:ndim) = shape(spectrum%Rayleigh%rayleigh_coeff_gas) - lbounds(1:ndim) = lbound(spectrum%Rayleigh%rayleigh_coeff_gas) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataRayleigh_get_real_array - -end module StrSpecDataRayleigh_C diff --git a/julia/gen/StrSpecDataRayleigh_JL.jl b/julia/gen/StrSpecDataRayleigh_JL.jl deleted file mode 100644 index 1ab9148..0000000 --- a/julia/gen/StrSpecDataRayleigh_JL.jl +++ /dev/null @@ -1,123 +0,0 @@ -# Autogenerated from src/radiance_core/def_spectrum.F90 -# svn revision 1226 - - - mutable struct StrSpecDataRayleigh{P} - parent_handle::P - end - - - # this is used to show values in the REPL and when using IJulia - function Base.show(io::IO, m::MIME"text/plain", handle::StrSpecDataRayleigh) - println(io, handle) - dump_properties(io, handle) - end - - - function Base.propertynames(handle::StrSpecDataRayleigh, private::Bool=false) - names = [ - :i_rayleigh_scheme, - :rayleigh_coeff, - :n_gas_rayleigh, - :index_rayleigh, - :rayleigh_coeff_gas, - ] - - return names - end - - - function Base.getproperty(handle::StrSpecDataRayleigh, field::Symbol) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :i_rayleigh_scheme, - :n_gas_rayleigh, - ) - val = Ref{Cint}() - field_ok = ccall( - (:PS_StrSpecDataRayleigh_get_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Cint}), - cptr, String(field), val - ) - Bool(field_ok) || error("StrSpecDataRayleigh integer field $field not present - coding error") - return val[] - elseif field in ( - :index_rayleigh, - ) - loc = Ref{Ptr{Cint}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataRayleigh_get_integer_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cint}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataRayleigh Cint array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - elseif field in ( - :rayleigh_coeff, - :rayleigh_coeff_gas, - ) - loc = Ref{Ptr{Cdouble}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataRayleigh_get_real_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cdouble}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataRayleigh Cdouble array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - else - return getfield(handle, field) - end - - end - - - function Base.setproperty!(handle::StrSpecDataRayleigh, field::Symbol, val) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :i_rayleigh_scheme, - :n_gas_rayleigh, - ) - - field_ok = ccall( - (:PS_StrSpecDataRayleigh_set_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Cint), - cptr, String(field), val - ) - Bool(field_ok) || error("StrSpecDataRayleigh integer field $field not present - coding error") - return val - else - error("type StrSpecDataRayleigh has no writeable field $field") - end - - end - diff --git a/julia/gen/StrSpecDataSolar_C.f90 b/julia/gen/StrSpecDataSolar_C.f90 deleted file mode 100644 index 19c82e9..0000000 --- a/julia/gen/StrSpecDataSolar_C.f90 +++ /dev/null @@ -1,78 +0,0 @@ -! Autogenerated from Fortran file src/radiance_core/def_spectrum.F90 -! svn revision 1226 - -module StrSpecDataSolar_C - -use, intrinsic :: iso_c_binding - -use UTILITIES_CF -use def_spectrum - -implicit none - -private - -contains - - function StrSpecDataSolar_get_real_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataSolar_get_real_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'solar_flux_band') then - if (allocated(spectrum%Solar%solar_flux_band)) then - loc = C_LOC(spectrum%Solar%solar_flux_band) - ndim = size(shape(spectrum%Solar%solar_flux_band)) - dims(1:ndim) = shape(spectrum%Solar%solar_flux_band) - lbounds(1:ndim) = lbound(spectrum%Solar%solar_flux_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'solar_flux_band_ses') then - if (allocated(spectrum%Solar%solar_flux_band_ses)) then - loc = C_LOC(spectrum%Solar%solar_flux_band_ses) - ndim = size(shape(spectrum%Solar%solar_flux_band_ses)) - dims(1:ndim) = shape(spectrum%Solar%solar_flux_band_ses) - lbounds(1:ndim) = lbound(spectrum%Solar%solar_flux_band_ses) - else - loc = C_NULL_PTR - end if - - else if (field == 'weight_blue') then - if (allocated(spectrum%Solar%weight_blue)) then - loc = C_LOC(spectrum%Solar%weight_blue) - ndim = size(shape(spectrum%Solar%weight_blue)) - dims(1:ndim) = shape(spectrum%Solar%weight_blue) - lbounds(1:ndim) = lbound(spectrum%Solar%weight_blue) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataSolar_get_real_array - -end module StrSpecDataSolar_C diff --git a/julia/gen/StrSpecDataSolar_JL.jl b/julia/gen/StrSpecDataSolar_JL.jl deleted file mode 100644 index 68a6276..0000000 --- a/julia/gen/StrSpecDataSolar_JL.jl +++ /dev/null @@ -1,73 +0,0 @@ -# Autogenerated from src/radiance_core/def_spectrum.F90 -# svn revision 1226 - - - mutable struct StrSpecDataSolar{P} - parent_handle::P - end - - - # this is used to show values in the REPL and when using IJulia - function Base.show(io::IO, m::MIME"text/plain", handle::StrSpecDataSolar) - println(io, handle) - dump_properties(io, handle) - end - - - function Base.propertynames(handle::StrSpecDataSolar, private::Bool=false) - names = [ - :solar_flux_band, - :solar_flux_band_ses, - :weight_blue, - ] - - return names - end - - - function Base.getproperty(handle::StrSpecDataSolar, field::Symbol) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :solar_flux_band, - :solar_flux_band_ses, - :weight_blue, - ) - loc = Ref{Ptr{Cdouble}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataSolar_get_real_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cdouble}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataSolar Cdouble array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - else - return getfield(handle, field) - end - - end - - - function Base.setproperty!(handle::StrSpecDataSolar, field::Symbol, val) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - error("type StrSpecDataSolar has no writeable field $field") - - end - diff --git a/julia/gen/StrSpecDataVar_C.f90 b/julia/gen/StrSpecDataVar_C.f90 deleted file mode 100644 index 4df290a..0000000 --- a/julia/gen/StrSpecDataVar_C.f90 +++ /dev/null @@ -1,205 +0,0 @@ -! Autogenerated from Fortran file src/radiance_core/def_spectrum.F90 -! svn revision 1226 - -module StrSpecDataVar_C - -use, intrinsic :: iso_c_binding - -use UTILITIES_CF -use def_spectrum - -implicit none - -private - -contains - - function StrSpecDataVar_get_integer(spectrum_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrSpecDataVar_get_integer') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), intent(out) :: val - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'n_sub_band') then - val = spectrum%Var%n_sub_band - else if (field == 'n_times') then - val = spectrum%Var%n_times - else if (field == 'n_repeat_times') then - val = spectrum%Var%n_repeat_times - else if (field == 'n_rayleigh_coeff') then - val = spectrum%Var%n_rayleigh_coeff - else - field_OK = .FALSE. - end if - - end function StrSpecDataVar_get_integer - - function StrSpecDataVar_set_integer(spectrum_Cptr, field_Cstr, val) result(field_OK) & - bind(C, NAME='PS_StrSpecDataVar_set_integer') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - integer(c_int), value, intent(in) :: val - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - - field_OK = .TRUE. - - if (field == 'n_sub_band') then - spectrum%Var%n_sub_band = val - else if (field == 'n_times') then - spectrum%Var%n_times = val - else if (field == 'n_repeat_times') then - spectrum%Var%n_repeat_times = val - else if (field == 'n_rayleigh_coeff') then - spectrum%Var%n_rayleigh_coeff = val - else - field_OK = .FALSE. - end if - - end function StrSpecDataVar_set_integer - - function StrSpecDataVar_get_integer_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataVar_get_integer_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'index_sub_band') then - if (allocated(spectrum%Var%index_sub_band)) then - loc = C_LOC(spectrum%Var%index_sub_band) - ndim = size(shape(spectrum%Var%index_sub_band)) - dims(1:ndim) = shape(spectrum%Var%index_sub_band) - lbounds(1:ndim) = lbound(spectrum%Var%index_sub_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'time') then - if (allocated(spectrum%Var%time)) then - loc = C_LOC(spectrum%Var%time) - ndim = size(shape(spectrum%Var%time)) - dims(1:ndim) = shape(spectrum%Var%time) - lbounds(1:ndim) = lbound(spectrum%Var%time) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataVar_get_integer_array - - function StrSpecDataVar_get_real_array(spectrum_Cptr, field_Cstr, loc, dims_C, ndim, lbounds_C) result(field_OK) & - bind(C, NAME='PS_StrSpecDataVar_get_real_array') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - type(c_ptr), value, intent(in) :: field_Cstr - logical(c_bool) :: field_OK - type(c_ptr), intent(out) :: loc - type(c_ptr), value, intent(in) :: dims_C - integer(c_int), intent(inout) :: ndim - type(c_ptr), value, intent(in) :: lbounds_C - - ! local variables - TYPE(StrSpecData), pointer :: spectrum - character(len=:), allocatable :: field - integer(c_int), pointer, dimension(:) :: dims, lbounds - - ! convert types - call C_F_POINTER(spectrum_Cptr, spectrum) - field = c_to_f_string(field_Cstr) - call C_F_POINTER(dims_C, dims, [ndim]) - call C_F_POINTER(lbounds_C, lbounds, [ndim]) - - field_OK = .TRUE. - - if (field == 'wavelength_sub_band') then - if (allocated(spectrum%Var%wavelength_sub_band)) then - loc = C_LOC(spectrum%Var%wavelength_sub_band) - ndim = size(shape(spectrum%Var%wavelength_sub_band)) - dims(1:ndim) = shape(spectrum%Var%wavelength_sub_band) - lbounds(1:ndim) = lbound(spectrum%Var%wavelength_sub_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'total_solar_flux') then - if (allocated(spectrum%Var%total_solar_flux)) then - loc = C_LOC(spectrum%Var%total_solar_flux) - ndim = size(shape(spectrum%Var%total_solar_flux)) - dims(1:ndim) = shape(spectrum%Var%total_solar_flux) - lbounds(1:ndim) = lbound(spectrum%Var%total_solar_flux) - else - loc = C_NULL_PTR - end if - - else if (field == 'solar_flux_sub_band') then - if (allocated(spectrum%Var%solar_flux_sub_band)) then - loc = C_LOC(spectrum%Var%solar_flux_sub_band) - ndim = size(shape(spectrum%Var%solar_flux_sub_band)) - dims(1:ndim) = shape(spectrum%Var%solar_flux_sub_band) - lbounds(1:ndim) = lbound(spectrum%Var%solar_flux_sub_band) - else - loc = C_NULL_PTR - end if - - else if (field == 'rayleigh_coeff') then - if (allocated(spectrum%Var%rayleigh_coeff)) then - loc = C_LOC(spectrum%Var%rayleigh_coeff) - ndim = size(shape(spectrum%Var%rayleigh_coeff)) - dims(1:ndim) = shape(spectrum%Var%rayleigh_coeff) - lbounds(1:ndim) = lbound(spectrum%Var%rayleigh_coeff) - else - loc = C_NULL_PTR - end if - - else - field_OK = .FALSE. - end if - - end function StrSpecDataVar_get_real_array - -end module StrSpecDataVar_C diff --git a/julia/gen/StrSpecDataVar_JL.jl b/julia/gen/StrSpecDataVar_JL.jl deleted file mode 100644 index cda20d8..0000000 --- a/julia/gen/StrSpecDataVar_JL.jl +++ /dev/null @@ -1,135 +0,0 @@ -# Autogenerated from src/radiance_core/def_spectrum.F90 -# svn revision 1226 - - - mutable struct StrSpecDataVar{P} - parent_handle::P - end - - - # this is used to show values in the REPL and when using IJulia - function Base.show(io::IO, m::MIME"text/plain", handle::StrSpecDataVar) - println(io, handle) - dump_properties(io, handle) - end - - - function Base.propertynames(handle::StrSpecDataVar, private::Bool=false) - names = [ - :n_sub_band, - :n_times, - :n_repeat_times, - :n_rayleigh_coeff, - :index_sub_band, - :wavelength_sub_band, - :time, - :total_solar_flux, - :solar_flux_sub_band, - :rayleigh_coeff, - ] - - return names - end - - - function Base.getproperty(handle::StrSpecDataVar, field::Symbol) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :n_sub_band, - :n_times, - :n_repeat_times, - :n_rayleigh_coeff, - ) - val = Ref{Cint}() - field_ok = ccall( - (:PS_StrSpecDataVar_get_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Cint}), - cptr, String(field), val - ) - Bool(field_ok) || error("StrSpecDataVar integer field $field not present - coding error") - return val[] - elseif field in ( - :index_sub_band, - :time, - ) - loc = Ref{Ptr{Cint}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataVar_get_integer_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cint}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataVar Cint array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - elseif field in ( - :wavelength_sub_band, - :total_solar_flux, - :solar_flux_sub_band, - :rayleigh_coeff, - ) - loc = Ref{Ptr{Cdouble}}() - ndim = Ref{Cint}(10) - dims = zeros(Cint, ndim[]) - lbounds = zeros(Cint, ndim[]) - field_ok = ccall( - (:PS_StrSpecDataVar_get_real_array, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Ref{Ptr{Cdouble}}, Ref{Cint}, Ref{Cint}, Ref{Cint}), - cptr, String(field), loc, dims, ndim, lbounds - ) - Bool(field_ok) || error("StrSpecDataVar Cdouble array field $field not present - coding error") - if loc[] == C_NULL - return nothing - else - a = unsafe_wrap(Array, loc[], Tuple(dims[1:ndim[]]), own=false) - oa = OffsetArray(a, (lbounds[1:ndim[]] .- 1)...) - return oa - end - else - return getfield(handle, field) - end - - end - - - function Base.setproperty!(handle::StrSpecDataVar, field::Symbol, val) - - - cptr = getfield(getfield(handle, :parent_handle), :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - if field in ( - :n_sub_band, - :n_times, - :n_repeat_times, - :n_rayleigh_coeff, - ) - - field_ok = ccall( - (:PS_StrSpecDataVar_set_integer, libSOCRATES_C), - Cuchar, - (Ptr{Cvoid}, Cstring, Cint), - cptr, String(field), val - ) - Bool(field_ok) || error("StrSpecDataVar integer field $field not present - coding error") - return val - else - error("type StrSpecDataVar has no writeable field $field") - end - - end - diff --git a/julia/gen/StrSpecData_C.f90 b/julia/gen/StrSpecData_C.f90 deleted file mode 100644 index 880c575..0000000 --- a/julia/gen/StrSpecData_C.f90 +++ /dev/null @@ -1,44 +0,0 @@ -! Autogenerated from Fortran file src/radiance_core/def_spectrum.F90 -! svn revision 1226 - -module StrSpecData_C - -use, intrinsic :: iso_c_binding - -use UTILITIES_CF -use def_spectrum - -implicit none - -private - -contains - - function create_StrSpecData() result(spectrum_Cptr) & - bind(C, NAME='PS_create_StrSpecData') - - implicit none - type(c_ptr) :: spectrum_Cptr - - TYPE(StrSpecData), pointer :: spectrum - - ALLOCATE(spectrum) - - spectrum_Cptr = c_loc(spectrum) - end function create_StrSpecData - - subroutine delete_StrSpecData(spectrum_Cptr) & - bind(C, NAME='PS_delete_StrSpecData') - - implicit none - type(c_ptr), value, intent(in) :: spectrum_Cptr - - TYPE(StrSpecData), pointer :: spectrum - - call C_F_POINTER(spectrum_Cptr, spectrum) - - DEALLOCATE(spectrum) - - end subroutine delete_StrSpecData - -end module StrSpecData_C diff --git a/julia/gen/StrSpecData_JL.jl b/julia/gen/StrSpecData_JL.jl deleted file mode 100644 index 43a07e6..0000000 --- a/julia/gen/StrSpecData_JL.jl +++ /dev/null @@ -1,137 +0,0 @@ -# Autogenerated from src/radiance_core/def_spectrum.F90 -# svn revision 1226 - - - mutable struct StrSpecData - cptr::Ptr{Cvoid} - - function StrSpecData() - handle = new(ccall((:PS_create_StrSpecData, libSOCRATES_C), Ptr{Cvoid}, ())) - finalizer(delete_StrSpecData, handle) - return handle - end - end - - function delete_StrSpecData(handle::StrSpecData) - if getfield(handle, :cptr) == Ptr{Cvoid}() - ccall(:jl_safe_printf, Cvoid, (Cstring, ), "error: delete_StrSpecData attempt to delete null pointer") - else - ccall((:PS_delete_StrSpecData, libSOCRATES_C), Cvoid, (Ptr{Cvoid},), getfield(handle, :cptr)) - setfield!(handle, :cptr, Ptr{Cvoid}()) - end - return nothing - end - - - # this is used to show values in the REPL and when using IJulia - function Base.show(io::IO, m::MIME"text/plain", handle::StrSpecData) - println(io, handle) - dump_properties(io, handle) - end - - - function Base.propertynames(handle::StrSpecData, private::Bool=false) - names = [ - :Dim, - :Basic, - :Solar, - :Rayleigh, - :Gas, - :Planck, - :Cont, - :ContGen, - :Drop, - :Aerosol, - :Ice, - :Var, - :Photol, - :Map, - ] - - return names - end - - - function Base.getproperty(handle::StrSpecData, field::Symbol) - - - cptr = getfield(handle, :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - - if field == :cptr - return cptr - - elseif field in ( - :Dim, - ) - return StrSpecDataDim(handle) - elseif field in ( - :Basic, - ) - return StrSpecDataBasic(handle) - elseif field in ( - :Solar, - ) - return StrSpecDataSolar(handle) - elseif field in ( - :Rayleigh, - ) - return StrSpecDataRayleigh(handle) - elseif field in ( - :Gas, - ) - return StrSpecDataGas(handle) - elseif field in ( - :Planck, - ) - return StrSpecDataPlanck(handle) - elseif field in ( - :Cont, - ) - return StrSpecDataCont(handle) - elseif field in ( - :ContGen, - ) - return StrSpecDataContGen(handle) - elseif field in ( - :Drop, - ) - return StrSpecDataDrop(handle) - elseif field in ( - :Aerosol, - ) - return StrSpecDataAerosol(handle) - elseif field in ( - :Ice, - ) - return StrSpecDataIce(handle) - elseif field in ( - :Var, - ) - return StrSpecDataVar(handle) - elseif field in ( - :Photol, - ) - return StrSpecDataPhotol(handle) - elseif field in ( - :Map, - ) - return StrSpecDataMap(handle) - else - return getfield(handle, field) - end - - end - - - function Base.setproperty!(handle::StrSpecData, field::Symbol, val) - - - cptr = getfield(handle, :cptr) - cptr != Ptr{Cvoid}() || error("invalid handle (null cptr)") - - error("type StrSpecData has no writeable field $field") - - end - diff --git a/julia/gen/gas_list_pcf.jl b/julia/gen/gas_list_pcf.jl deleted file mode 100644 index 0c71dfa..0000000 --- a/julia/gen/gas_list_pcf.jl +++ /dev/null @@ -1,358 +0,0 @@ -# Autogenerated from src/radiance_core/gas_list_pcf.F90 -# svn revision 1226 - -module gas_list_pcf - - - -const npd_gases = 55 - -const IP_h2o = 1 - -const IP_co2 = 2 - -const IP_o3 = 3 - -const IP_n2o = 4 - -const IP_co = 5 - -const IP_ch4 = 6 - -const IP_o2 = 7 - -const IP_no = 8 - -const IP_so2 = 9 - -const IP_no2 = 10 - -const IP_nh3 = 11 - -const IP_hno3 = 12 - -const IP_n2 = 13 - -const IP_cfc11 = 14 - -const IP_cfc12 = 15 - -const IP_cfc113 = 16 - -const IP_hcfc22 = 17 - -const IP_hfc125 = 18 - -const IP_hfc134a = 19 - -const IP_cfc114 = 20 - -const IP_tio = 21 - -const IP_vo = 22 - -const IP_h2 = 23 - -const IP_he = 24 - -const IP_ocs = 25 - -const IP_na = 26 - -const IP_k = 27 - -const IP_feh = 28 - -const IP_crh = 29 - -const IP_li = 30 - -const IP_rb = 31 - -const IP_cs = 32 - -const IP_ph3 = 33 - -const IP_c2h2 = 34 - -const IP_hcn = 35 - -const IP_h2s = 36 - -const IP_ar = 37 - -const IP_air = 38 - -const IP_o = 39 - -const IP_n = 40 - -const IP_no3 = 41 - -const IP_n2o5 = 42 - -const IP_hono = 43 - -const IP_ho2no2 = 44 - -const IP_h2o2 = 45 - -const IP_c2h6 = 46 - -const IP_ch3 = 47 - -const IP_h2co = 48 - -const IP_ho2 = 49 - -const IP_hdo = 50 - -const IP_hcl = 51 - -const IP_hf = 52 - -const IP_cosso = 53 - -const IP_tosso = 54 - -const IP_yosos = 55 - -const name_absorb = [ - "Water Vapour", - "Carbon Dioxide", - "Ozone", - "Dinitrogen Oxide", - "Carbon monoxide", - "Methane", - "Oxygen", - "Nitrogen monoxide", - "Sulphur dioxide", - "Nitrogen dioxide", - "Ammonia", - "Nitric acid", - "Nitrogen", - "CFC11", - "CFC12", - "CFC113", - "HCFC22", - "HFC125", - "HFC134A", - "CFC114", - "Titanium oxide", - "Vanadium oxide", - "Hydrogen", - "Helium", - "Carbonyl sulphide", - "Sodium", - "Potassium", - "Iron hydride", - "Chromium hydride", - "Lithium", - "Rubidium", - "Cesium", - "Phosphine", - "Acetylene", - "Hydrogen cyanide", - "Hydrogen sulphide", - "Argon", - "Dry air", - "Atomic oxygen", - "Atomic nitrogen", - "Nitrate radical", - "Dinitrogen pentoxid", - "Nitrous acid", - "Peroxynitric acid", - "Hydrogen peroxide", - "Ethane", - "Methyl radical", - "Formaldehyde", - "Hydroperoxy radical", - "Semiheavy water", - "Hydrogen chloride", - "Hydrogen fluoride", - "cis-OSSO", - "trans-OSSO", - "OSO-S", -] - -const molar_weight = [ - 18.0153, - 44.0100, - 47.9982, - 44.0128, - 28.0106, - 16.0430, - 31.9988, - 30.0061, - 64.0628, - 46.0055, - 17.0306, - 63.0129, - 28.0134, - 137.3686, - 120.9140, - 187.3765, - 86.46892, - 120.02227, - 102.03184, - 170.921, - 63.866, - 66.9409, - 2.01588, - 4.002602, - 60.075, - 22.98976928, - 39.0983, - 56.853, - 53.004, - 6.941, - 85.4678, - 132.9054519, - 33.99758, - 26.0373, - 27.0253, - 34.081, - 39.948, - 28.966, - 15.9994, - 14.00674, - 63.0128, - 108.0104, - 47.0134, - 79.0122, - 34.0147, - 30.0690, - 15.0345, - 30.0260, - 33.0067, - 19.0214, - 36.461, - 20.00689, - 96.129, - 96.129, - 96.129, -] - -const hitran_number = [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 22, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 45, - 0, - 19, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 28, - 26, - 23, - 31, - 0, - 0, - 34, - 0, - 0, - 0, - 0, - 0, - 25, - 27, - 0, - 20, - 33, - 1, - 15, - 14, - 0, - 0, - 0, -] - -const npd_isotopes = 3 - -const depolarization_factor = [ - 0.0, - 0.0922, - 0.0, - 0.1197, - 0.08, - 0.0, - 0.06, - 0.0218, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0305, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0221, - 0.025, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0006, - 0.0279, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, -] - -const npd_products = 9 - -const blank = "" - -end diff --git a/julia/gen/input_head_pcf.jl b/julia/gen/input_head_pcf.jl deleted file mode 100644 index 41ce364..0000000 --- a/julia/gen/input_head_pcf.jl +++ /dev/null @@ -1,766 +0,0 @@ -# Autogenerated from src/modules_gen/input_head_pcf.f90 -# svn revision 1226 - -module input_head_pcf - - - -const NP_max_length_line = 132 - -const NPD_in_profile = 9 - -const NPD_data_column = 35 - -const NPD_phys_type = 62 - -const NPD_unit = 20 - -const len_col_header = 10 - -const len_long_title = 30 - -const len_file_suffix = 12 - -const IP_physical_data = 1 - -const IP_gaseous_data = 2 - -const IP_aerosol_data = 3 - -const IP_pressure = 1 - -const IP_height = 2 - -const IP_temperature = 3 - -const IP_ozone_density = 4 - -const IP_water_vapour_density = 5 - -const IP_lwc = 6 - -const IP_re = 7 - -const IP_null_field = 8 - -const IP_temperature_ground = 9 - -const IP_cloud_fraction = 10 - -const IP_flux_up = 11 - -const IP_flux_down = 12 - -const IP_flux_direct = 13 - -const IP_flux_net = 14 - -const IP_heating_rate = 15 - -const IP_flux_total_down = 16 - -const IP_lwm = 17 - -const IP_t_dew = 18 - -const IP_spec_humidity = 19 - -const IP_hum_mix_ratio = 20 - -const IP_iwc = 21 - -const IP_iwm = 22 - -const IP_ire = 23 - -const IP_tau = 24 - -const IP_ssa = 25 - -const IP_gsc = 26 - -const IP_fsc = 27 - -const IP_planck = 28 - -const IP_cloud_fraction_cv = 29 - -const IP_lwccv = 30 - -const IP_lwmcv = 31 - -const IP_recv = 32 - -const IP_iwccv = 33 - -const IP_iwmcv = 34 - -const IP_irecv = 35 - -const IP_pressure_ground = 36 - -const IP_t_level = 37 - -const IP_rel_hum = 38 - -const IP_discard = 39 - -const IP_cloud_fraction_w = 40 - -const IP_cloud_fraction_i = 41 - -const IP_cloud_fraction_w_cv = 42 - -const IP_cloud_fraction_i_cv = 43 - -const IP_solar_zenith_angle = 44 - -const IP_solar_azimuth = 45 - -const IP_solar_toa = 46 - -const IP_surface_type = 47 - -const IP_view_polar = 48 - -const IP_view_azim = 49 - -const IP_radiance = 50 - -const IP_surface_char = 51 - -const IP_optical_water = 52 - -const IP_optical_ice = 53 - -const IP_optical_ss = 54 - -const IP_iso_inc = 55 - -const IP_view_geom = 56 - -const IP_photolysis = 57 - -const IP_p_level = 58 - -const IP_contrib_funci = 59 - -const IP_contrib_funcf = 60 - -const IP_actinic_flux = 61 - -const IP_photolysis_rate = 62 - -const header_phys = [ - "PRESS", - "HGT", - "TEMP", - "O3DEN", - "H2ODEN", - "LWC", - "RE", - "", - "TSTAR", - "CLFRAC", - "UFLX", - "DFLX", - "SFLX", - "NFLX", - "HRTS", - "VFLX", - "LWM", - "TDEW", - "SPH", - "HMR", - "IWC", - "IWM", - "IRE", - "TAU", - "SSA", - "ASYM", - "FRWSC", - "PLANCK", - "CVFRAC", - "LWCCV", - "LWMCV", - "RECV", - "IWCCV", - "IWMCV", - "IRECV", - "PSTAR", - "TLEV", - "RH", - "DISCRD", - "WCLFRC", - "ICLFRC", - "CWFRAC", - "CIFRAC", - "SZEN", - "SAZIM", - "STOA", - "SURF", - "POLAR", - "AZIM", - "RADN", - "SRFCHR", - "OPWT", - "OPICE", - "OPSS", - "ISOS", - "GEOM", - "PHOTOL", - "PLEV", - "CFI", - "CFF", - "AFLX", - "PHRATE", -] - -const phys_suffix = [ - "p", - "hgt", - "t", - "o3d", - "qd", - "lwc", - "re", - "null", - "tstar", - "clfr", - "uflx", - "dflx", - "sflx", - "nflx", - "hrts", - "vflx", - "lwm", - "tdw", - "q", - "hmr", - "iwc", - "iwm", - "ire", - "tau", - "ssa", - "gsc", - "fsc", - "plk", - "ccfr", - "lwccv", - "lwmcv", - "recv", - "iwccv", - "iwmcv", - "irecv", - "pstar", - "tl", - "rh", - "", - "wclfr", - "iclfr", - "wccfr", - "iccfr", - "szen", - "sazim", - "stoa", - "surf", - "vwpol", - "vwazim", - "radn", - "surf", - "op_water", - "op_ice", - "ss", - "isos", - "view", - "photol", - "pl", - "cfi", - "cff", - "aflx", - "ph_rate", -] - -const phys_title = [ - " Pressure", - " Height", - " Temperature", - " Ozone Mass Density", - " Water Vapour Mass Density", - " Liquid Water Content", - " Effective Radius", - " Null Grid", - " Temperature of surface", - " Cloud Fraction", - " Upward Flux", - " Downward Flux (diffuse)", - " Direct Flux", - " Net Downward Flux", - " Heating Rates (K, day)", - " Total Downward Flux", - " Liquid Water Mass Fraction", - " Dew point Temperature", - " Specific Humidity", - " Humidity Mixing Ratio", - " Ice Content", - " Ice Mass Fraction", - " Ice Effective Radius", - " Optical Depth", - " Albedo of Single Scattering", - " Asymmetry Factor", - " Forward Scattering Factor", - " Planck Function", - " Convective Cloud Fraction", - " Conv. Liquid Water Content", - " Conv. Liquid Water Mass Frac", - " Conv. Effective Radius", - " Convective Ice Content", - " Convective Ice Mass Fraction", - " Conv. Ice Effective Radius", - " Pressure at surface", - " Temperature on Levels", - " Relative Humidity", - "", - " Water Cloud Fraction", - " Ice Cloud Fraction", - " Conv. Water Cloud Fraction", - " Conv. Ice Cloud Fraction", - " Solar zenith angle", - " Solar azimuthal angle", - " Solar Irradiance at TOA", - " Type of surface", - " Polar viewing angle", - " Azimuthal viewing angle", - " Radiance", - " Surface characteristics", - " Optical data for droplets", - " Optical data for ice crystal", - " Single scattering properties", - " Isotropic source", - " Viewing Geometry", - " Rate of photolysis", - " Pressure on Levels", - " Contribution function (inty)", - " Contribution function (flux)", - " Actinic flux", - " Photolysis rate", -] - -const header_gas = [ - "H2O", - "CO2", - "O3", - "N2O", - "CO", - "CH4", - "O2", - "NO", - "SO2", - "NO2", - "NH3", - "HNO3", - "N2", - "CFC11", - "CFC12", - "CFC113", - "HCFC22", - "HFC125", - "HFC134A", - "CFC114", - "TiO", - "VO", - "H2", - "He", - "OCS", - "Na", - "K", - "FeH", - "CrH", - "Li", - "Rb", - "Cs", - "PH3", - "C2H2", - "HCN", - "H2S", - "Ar", - "AIR", - "O", - "N", - "NO3", - "N2O5", - "HONO", - "HO2NO2", - "H2O2", - "C2H6", - "CH3", - "H2CO", - "HO2", - "HDO", - "HCl", - "HF", - "cOSSO", - "tOSSO", - "yOSOS", -] - -const gas_suffix = [ - "q", - "co2", - "o3", - "n2o", - "co", - "ch4", - "o2", - "no", - "so2", - "no2", - "nh3", - "hno3", - "n2", - "cfc11", - "cfc12", - "cfc113", - "hcfc22", - "hfc125", - "hfc134a", - "cfc114", - "tio", - "vo", - "h2", - "he", - "ocs", - "na", - "k", - "feh", - "crh", - "li", - "rb", - "cs", - "ph3", - "c2h2", - "hcn", - "h2s", - "ar", - "air", - "o", - "n", - "no3", - "n2o5", - "hono", - "ho2no2", - "h2o2", - "c2h6", - "ch3", - "h2co", - "ho2", - "hdo", - "hcl", - "hf", - "cosso", - "tosso", - "yosos", -] - -const gas_title = [ - " Water Vapour", - " Carbon Dioxide", - " Ozone", - " Dinitrogen oxide", - " Carbon Monoxide", - " Methane", - " Oxygen", - " Nitrogen Monoxide", - " Sulphur Dioxide", - " Nitrogen Dioxide", - " Ammonia", - " Nitric acid", - " Nitrogen", - " CFC-11", - " CFC-12", - " CFC-113", - " HCFC-22", - " HFC-125", - " HFC-134a", - " CFC-114", - " Titanium oxide", - " Vanadium oxide", - " Hydrogen", - " Helium", - " Carbonyl sulphide", - " Sodium", - " Potassium", - " Iron hydride", - " Chromium hydride", - " Lithium", - " Rubidium", - " Cesium", - " Phosphine", - " Acetylene", - " Hydrogen cyanide", - " Hydrogen sulphide", - " Argon", - " Dry air", - " Atomic Oxygen", - " Atomic Nitrogen", - " Nitrate radical", - " Dinitrogen Pentoxide", - " Nitrous acid", - " Peroxynitric acid", - " Hydrogen peroxide", - " Ethane", - " Methyl radical", - " Formaldehyde", - " Hydroperoxy radical", - " Semiheavy water", - " Hydrogen chloride", - " Hydrogen fluoride", - " cis-OSSO", - " trans-OSSO", - " OSO-S", -] - -const header_aerosol = [ - "WTSOL", - "DUST", - "OCN", - "SOOT", - "ASH", - "SULPH", - "NH4SO4", - "AUNCH", - "SAHARA", - "ACCUM", - "AITKEN", - "FRSOOT", - "AGSOOT", - "NACL", - "NACLFLM", - "NACLJET", - "DUSTDIV1", - "DUSTDIV2", - "DUSTDIV3", - "DUSTDIV4", - "DUSTDIV5", - "DUSTDIV6", - "BIOMS1", - "BIOMS2", - "BIOGENIC", - "FROCFF", - "AGOCFF", - "DELTA", - "", - "NITRATE", - "DUST2BIN1", - "DUST2BIN2", -] - -const aerosol_suffix = [ - "wtsol", - "dust", - "ocn", - "soot", - "ash", - "sulph", - "nh4so4", - "aunch", - "sahara", - "accum", - "aitken", - "frsoot", - "agsoot", - "nacl", - "naclflm", - "nacljet", - "dustdiv1", - "dustdiv2", - "dustdiv3", - "dustdiv4", - "dustdiv5", - "dustdiv6", - "bioms1", - "bioms2", - "biogenic", - "frocff", - "agocff", - "delta", - "", - "nitrate", - "dust2bin1", - "dust2bin2", -] - -const aerosol_opt_suffix = [ - "op_wtsol", - "op_dust", - "op_ocn", - "op_soot", - "op_ash", - "op_sulph", - "op_nh4so4", - "op_aunch", - "op_sahara", - "op_accum", - "op_aitken", - "op_frsoot", - "op_agsoot", - "op_nacl", - "op_naclflm", - "op_nacljet", - "op_dustdiv1", - "op_dustdiv2", - "op_dustdiv3", - "op_dustdiv4", - "op_dustdiv5", - "op_dustdiv6", - "op_bioms1", - "op_bioms2", - "op_biogenic", - "op_frocff", - "op_agocff", - "op_delta", - "", - "op_nitrate", - "op_dust2bin", - "op_dust2bin", -] - -const aerosol_title = [ - " Water-soluble Aerosol", - " Dust-like Aerosol", - " Oceanic Aerosol", - " Soot Aerosol", - " Ash Aerosol", - " 75% Sulphuric acid Aerosol", - " Ammonium Sulphate Aerosol", - " Uncharacterized Aerosol", - " Saharan Dust Aerosol", - " Accumulation SO4 Aerosol", - " Aitken-mode SO4 Aerosol", - " Fresh Soot Aerosol", - " Aged Soot Aerosol", - " Generic Sodium Chloride", - " Sodium Chloride (Film mode)", - " Sodium Chloride (Jet mode)", - " Dust aerosol (division 1)", - " Dust aerosol (division 2)", - " Dust aerosol (division 3)", - " Dust aerosol (division 4)", - " Dust aerosol (division 5)", - " Dust aerosol (division 6)", - " Biomass aerosol (division 1)", - " Biomass aerosol (division 2)", - " Biogenic aerosol", - " Fresh fossil-fuel org. carbo", - " Aged fossil-fuel org. carbon", - " Unspecified (delta) aerosol", - "", - " Ammonium nitrate aerosol", - " Two-bin Dust aerosol (div 1)", - " Two-bin Dust aerosol (div 2)", -] - -const IP_unit_pa = 1 - -const IP_unit_mb = 2 - -const IP_unit_k = 3 - -const IP_unit_m = 4 - -const IP_unit_km = 5 - -const IP_unit_um = 6 - -const IP_unit_kgm_3 = 7 - -const IP_unit_gm_3 = 8 - -const IP_unit_kgm_2 = 9 - -const IP_unit_gm_2 = 10 - -const IP_unit_gkg = 11 - -const IP_unit_g_g = 12 - -const IP_unit_none = 13 - -const IP_unit_m_3 = 14 - -const IP_unit_cm_3 = 15 - -const IP_unit_wm_2 = 16 - -const IP_unit_c = 17 - -const name_unit = [ - "PA", - "MB", - "K", - "M", - "KM", - "UM", - "KGM-3", - "GM-3", - "KGM-2", - "GM-2", - "GKG-1", - "GG-1", - "NONE", - "M-3", - "CM-3", - "WM-2", - "C", - "PPMV", - "VOL-MARS", - "VOL-VENUS", -] - -const factor_unit = [ - 1.0, - 1.0E+02, - 1.0, - 1.0, - 1.0E+03, - 1.0E-06, - 1.0, - 1.0E-03, - 1.0, - 1.0E-03, - 1.0E-03, - 1.0, - 1.0, - 1.0, - 1.0E+06, - 1.0, - 1.0, - -1.0E-06, - -1.0, - -1.0, -] - -const offset_unit = [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 2.7315E+02, - 0.0, - 0.0, - 0.0, -] - -end diff --git a/julia/gen/rad_pcf.jl b/julia/gen/rad_pcf.jl deleted file mode 100644 index 4958e4e..0000000 --- a/julia/gen/rad_pcf.jl +++ /dev/null @@ -1,501 +0,0 @@ -# Autogenerated from src/radiance_core/rad_pcf.F90 -# svn revision 1226 - -module rad_pcf - - - -const ip_aerosol_param_dry = 1 - -const ip_aerosol_param_moist = 2 - -const ip_aerosol_unparametrized = 3 - -const ip_aerosol_param_phf_dry = 4 - -const ip_aerosol_param_phf_moist = 5 - -const npd_aerosol_component = 32 - -const ip_water_soluble = 1 - -const ip_dust_like = 2 - -const ip_oceanic = 3 - -const ip_soot = 4 - -const ip_ash = 5 - -const ip_sulphuric = 6 - -const ip_ammonium_sulphate = 7 - -const ip_aerosol_uncharacterized = 8 - -const ip_saharan_dust = 9 - -const ip_accum_sulphate = 10 - -const ip_aitken_sulphate = 11 - -const ip_fresh_soot = 12 - -const ip_aged_soot = 13 - -const ip_sodium_chloride = 14 - -const ip_seasalt_film = 15 - -const ip_seasalt_jet = 16 - -const ip_dust_div1 = 17 - -const ip_dust_div2 = 18 - -const ip_dust_div3 = 19 - -const ip_dust_div4 = 20 - -const ip_dust_div5 = 21 - -const ip_dust_div6 = 22 - -const ip_biomass_1 = 23 - -const ip_biomass_2 = 24 - -const ip_biogenic = 25 - -const ip_ocff_fresh = 26 - -const ip_ocff_aged = 27 - -const ip_delta = 28 - -const ip_murk = 29 - -const ip_nitrate = 30 - -const ip_twobindust_1 = 31 - -const ip_twobindust_2 = 32 - -const name_aerosol_component = [ - "Water soluble", - "Dust-like", - "Oceanic", - "Soot", - "Volcanic Ash", - "Sulphuric Acid", - "Ammonium Sulphate", - "Uncharacterized", - "Saharan Dust", - "Accum. Sulphate", - "Aitken Sulphate", - "Fresh Soot", - "Aged Soot", - "Generic NaCl", - "NaCl film mode", - "NaCl jet mode", - "Dust Division 1", - "Dust Division 2", - "Dust Division 3", - "Dust Division 4", - "Dust Division 5", - "Dust Division 6", - "Biomass Division 1", - "Biomass Division 2", - "Biogenic", - "Fresh fossil-fuel O", - "Aged fossil-fuel OC", - "Delta aerosol", - "Murk", - "Ammonium nitrate", - "Two-bin Dust Div 1", - "Two-bin Dust Div 2", -] - -const ip_aersrc_cusack_ron = 0 - -const ip_aersrc_cusack_roff = 10 - -const ip_aersrc_classic_ron = 1 - -const ip_aersrc_classic_roff = 11 - -const ip_aersrc_arcl_ron = 2 - -const ip_aersrc_arcl_roff = 12 - -const ip_two_stream = 1 - -const ip_ir_gauss = 2 - -const ip_spherical_harmonic = 3 - -const ip_clcmp_st_water = 1 - -const ip_clcmp_st_ice = 2 - -const ip_clcmp_cnv_water = 3 - -const ip_clcmp_cnv_ice = 4 - -const ip_slingo_schrecker = 1 - -const ip_ackerman_stephens = 2 - -const ip_drop_unparametrized = 3 - -const ip_drop_pade_2 = 5 - -const ip_slingo_schr_phf = 6 - -const IP_drop_Pade_2_PHF = 7 - -const IP_ps_size_PHF = 8 - -const ip_drop_sun_shine_vis = 10 - -const ip_drop_stamnes = 11 - -const ip_region_clear = 1 - -const ip_region_strat = 2 - -const ip_region_conv = 3 - -const ip_cloud_homogen = 1 - -const ip_cloud_ice_water = 2 - -const ip_cloud_conv_strat = 3 - -const ip_cloud_csiw = 4 - -const ip_cloud_off = 5 - -const ip_cloud_combine_homogen = 6 - -const ip_cloud_combine_ice_water = 7 - -const ip_cloud_split_homogen = 8 - -const ip_cloud_split_ice_water = 9 - -const ip_homogeneous = 0 - -const ip_scaling = 1 - -const ip_mcica = 2 - -const ip_cairns = 3 - -const ip_tripleclouds_2019 = 4 - -const ip_max_rand = 0 - -const ip_rand = 1 - -const ip_exponential = 2 - -const ip_exponential_rand = 3 - -const ip_cloud_mix_max = 2 - -const ip_cloud_mix_random = 4 - -const ip_cloud_column_max = 3 - -const ip_cloud_clear = 5 - -const ip_cloud_triple = 6 - -const ip_cloud_part_corr = 7 - -const ip_cloud_part_corr_cnv = 8 - -const ip_cloud_mcica = 10 - -const ip_cloud_type_homogen = 1 - -const ip_cloud_type_water = 1 - -const ip_cloud_type_ice = 2 - -const ip_cloud_type_strat = 1 - -const ip_cloud_type_conv = 2 - -const ip_cloud_type_sw = 1 - -const ip_cloud_type_si = 2 - -const ip_cloud_type_cw = 3 - -const ip_cloud_type_ci = 4 - -const ip_re_default = 1 - -const ip_re_external = 2 - -const ip_re_liu = 3 - -const ip_re_constant = 4 - -const ip_self_continuum = 1 - -const ip_frn_continuum = 2 - -const ip_n2_continuum = 3 - -const ip_cont_h2o = 1 - -const ip_cont_o4 = 2 - -const ip_cont_o2n2_1 = 3 - -const ip_cont_o2n2_2 = 4 - -const i_normal = 0 - -const i_err_fatal = 1 - -const i_abort_calculation = 2 - -const i_missing_data = 3 - -const i_err_io = 4 - -const i_err_range = 5 - -const i_err_exist = 6 - -const i_warning = -1 - -const ip_scale_null = 0 - -const ip_scale_band = 1 - -const ip_scale_term = 2 - -const ip_overlap_hybrid = 0 - -const ip_overlap_single = 1 - -const ip_overlap_random = 2 - -const ip_overlap_exact_major = 3 - -const ip_overlap_k_eqv_scl = 4 - -const ip_overlap_k_eqv = 5 - -const ip_overlap_k_eqv_mod = 6 - -const ip_overlap_mix_ses2 = 7 - -const ip_overlap_random_resort_rebin = 8 - -const ip_slingo_schrecker_ice = 1 - -const ip_ice_unparametrized = 3 - -const ip_sun_shine_vn2_vis = 4 - -const ip_sun_shine_vn2_ir = 5 - -const ip_ice_adt = 6 - -const ip_ice_adt_10 = 7 - -const ip_ice_fu_solar = 9 - -const ip_ice_fu_ir = 10 - -const ip_slingo_schr_ice_phf = 11 - -const ip_ice_agg_de = 12 - -const ip_ice_fu_phf = 12 - -const ip_ice_sun_fu = 14 - -const ip_ice_chou_vis = 15 - -const ip_ice_agg_de_sun = 16 - -const ip_ice_t_iwc = 17 - -const ip_ice_iwc_only = 18 - -const ip_ice_baran = 19 - -const ip_ice_pade_2_phf = 20 - -const ip_phase_water = 1 - -const ip_phase_ice = 2 - -const npd_scale_fnc = 10 - -const n_scale_variable = [ - 0, - 2, - 3, - 4, - 0, - 0, - 6, - 8, - 10, - 0, - 0, -] - -const ip_scale_fnc_null = 0 - -const ip_scale_power_law = 1 - -const ip_scale_power_quad = 2 - -const ip_scale_doppler_quad = 3 - -const ip_scale_wenyi = 4 - -const ip_scale_ses2 = 5 - -const ip_scale_dbl_pow_law = 6 - -const ip_scale_dbl_pow_quad = 7 - -const ip_scale_dbl_dop_quad = 8 - -const ip_scale_lookup = 9 - -const ip_scale_t_lookup = 10 - -const ip_scatter_full = 1 - -const ip_no_scatter_abs = 2 - -const ip_no_scatter_ext = 3 - -const ip_scatter_approx = 4 - -const ip_scatter_hybrid = 5 - -const ip_direct_noscaling = 0 - -const ip_direct_delta_scaling = 1 - -const ip_direct_csr_scaling = 2 - -const ip_solver_pentadiagonal = 1 - -const ip_solver_no_scat = 2 - -const ip_solver_mix_app_scat = 9 - -const ip_solver_mix_direct = 11 - -const ip_solver_homogen_direct = 13 - -const ip_solver_triple = 14 - -const ip_solver_triple_app_scat = 15 - -const ip_solver_mix_direct_hogan = 16 - -const ip_solver_triple_hogan = 17 - -const ip_scf_solar_up = 1 - -const ip_scf_solar_down = 2 - -const ip_scf_ir_1d = 1 - -const ip_scf_ir_2d = 2 - -const ip_solar = 1 - -const ip_infra_red = 2 - -const ip_sph_direct = 1 - -const ip_sph_reduced_iter = 2 - -const ip_sph_mode_rad = 1 - -const ip_sph_mode_flux = 2 - -const ip_sph_mode_j = 3 - -const ip_trunc_triangular = 1 - -const ip_trunc_rhombohedral = 2 - -const ip_trunc_azim_sym = 3 - -const ip_trunc_adaptive = 4 - -const ip_surface_specified = 1 - -const ip_surface_internal = 2 - -const ip_surface_polynomial = 3 - -const ip_surface_payne = 4 - -const ip_surface_lambertian = 5 - -const ip_surface_roujean = 6 - -const ip_surface_lommel_seeliger_axi = 7 - -const ip_surf_alb_diff = 1 - -const ip_surf_alb_dir = 2 - -const npd_tile_type = 4 - -const ip_ocean_tile = 1 - -const ip_seaice_tile = 2 - -const ip_land_tile = 3 - -const ip_landice_tile = 4 - -const ip_eddington = 2 - -const ip_discrete_ord = 4 - -const ip_ifm = 5 - -const ip_pifm85 = 6 - -const ip_zdk_flux = 7 - -const ip_krschg_flux = 8 - -const ip_coakley_chylek_1 = 9 - -const ip_coakley_chylek_2 = 10 - -const ip_meador_weaver = 11 - -const ip_elsasser = 12 - -const ip_2s_test = 14 - -const ip_hemi_mean = 15 - -const ip_pifm80 = 16 - -const ip_rayleigh_total = 1 - -const ip_rayleigh_custom = 2 - -end diff --git a/julia/gen/readme.txt b/julia/gen/readme.txt new file mode 100644 index 0000000..c6185e5 --- /dev/null +++ b/julia/gen/readme.txt @@ -0,0 +1 @@ +Wrappers will be automatically generated here. diff --git a/julia/src/GenFortranWrappers.jl b/julia/src/GenFortranWrappers.jl index 3595817..0ab2daf 100644 --- a/julia/src/GenFortranWrappers.jl +++ b/julia/src/GenFortranWrappers.jl @@ -21,10 +21,10 @@ function gen_wrappers( type_name, type_fields; member_name="", var_name=lowercase(type_name), - julia_filename="../gen/$(type_name)$(member_name)_JL.jl", + julia_filename=joinpath(ENV["RAD_DIR"],"julia/gen/$(type_name)$(member_name)_JL.jl"), lib_name="libSOCRATES_C", fortran_module_dependencies=[], - cfortran_filename="../gen/$(type_name)$(member_name)_C.f90", + cfortran_filename=joinpath(ENV["RAD_DIR"],"julia/gen/$(type_name)$(member_name)_C.f90"), fortran_module_name="$(type_name)$(member_name)_C", fortran_realtype="real(realk)", fortran_file, diff --git a/julia/src/generate_wrappers.jl b/julia/src/generate_wrappers.jl index 7cdaf89..185216c 100644 --- a/julia/src/generate_wrappers.jl +++ b/julia/src/generate_wrappers.jl @@ -2,7 +2,7 @@ include("ParseFortran.jl") include("GenFortranWrappers.jl") -SOCRATES_DIR = "../../" +SOCRATES_DIR = ENV["RAD_DIR"] SVN_REV=1226 ###################################################################### @@ -22,7 +22,7 @@ wrappers = [ ] for (strsuffix, modsuffix, var_name) in wrappers - local ffile = "src/radiance_core/def_$(modsuffix).F90" + local ffile = joinpath(SOCRATES_DIR,"src/radiance_core/def_$(modsuffix).F90") local strctrl = ParseFortran.parse_type(joinpath(SOCRATES_DIR, ffile), "Str"*strsuffix) GenFortranWrappers.gen_wrappers( "Str"*strsuffix, strctrl; @@ -68,7 +68,7 @@ for (srcdir, modname, fext) in mod_pars modname ) GenFortranWrappers.gen_pars( - "../gen/$modname.jl", modname, pars_pcf, + joinpath(SOCRATES_DIR,"julia/gen/$modname.jl"), modname, pars_pcf, fortran_file=ffile, svn_rev=SVN_REV) end diff --git a/make/Mk_cmd b/make/Mk_cmd index 82750dd..c117ea9 100644 --- a/make/Mk_cmd +++ b/make/Mk_cmd @@ -1,12 +1,12 @@ # Generated automatically -# System: Linux atmlxint6.atm.ox.ac.uk 5.4.0-170-generic #188-Ubuntu SMP Wed Jan 10 09:51:01 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux -# Date: Wed 29 May 20:05:59 BST 2024 +# System: Darwin hnmacbook 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 arm64 +# Date: Thu 30 May 2024 12:55:09 BST -FORTCOMP = /usr/bin/gfortran -O3 -fPIC -c -LINK = /usr/bin/gfortran -O3 -fPIC +FORTCOMP = /opt/homebrew/bin/gfortran -O3 -fPIC -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/ -c +LINK = /opt/homebrew/bin/gfortran -O3 -fPIC -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/ LIBLINK = /usr/bin/ar rvu -INCCDF_PATH = /usr/include -I/usr/include -LIBCDF_PATH = /usr/lib/x86_64-linux-gnu +INCCDF_PATH = /opt/homebrew/Cellar/netcdf-fortran/4.6.1/include -I/opt/homebrew/Cellar/netcdf-fortran/4.6.1/include -I/opt/homebrew/Cellar/netcdf-fortran/4.6.1/include +LIBCDF_PATH = /opt/homebrew/Cellar/netcdf-fortran/4.6.1/lib LIBCDF_NAME = netcdff OMPARG = -fopenmp