Skip to content

Commit

Permalink
replace usage of fm_path_name_len
Browse files Browse the repository at this point in the history
  • Loading branch information
rem1776 authored and rem1776 committed Aug 1, 2024
1 parent 43def16 commit 13b068d
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 43 deletions.
8 changes: 4 additions & 4 deletions coupler/atmos_ocean_fluxes.F90
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module atmos_ocean_fluxes_mod
use coupler_types_mod, only: ind_runoff
use coupler_types_mod, only: ind_flux, ind_deltap, ind_kw, ind_flux0

use field_manager_mod, only: fm_path_name_len, fm_string_len, fm_exists, fm_get_index
use field_manager_mod, only: fm_string_len, fm_exists, fm_get_index
use field_manager_mod, only: fm_new_list, fm_get_current_list, fm_change_list
use field_manager_mod, only: fm_field_name_len, fm_type_name_len, fm_dump_list
use field_manager_mod, only: fm_loop_over_list
Expand All @@ -63,7 +63,7 @@ module atmos_ocean_fluxes_mod
use fm_util_mod, only: fm_util_get_real_array, fm_util_get_real, fm_util_get_integer
use fm_util_mod, only: fm_util_get_logical, fm_util_get_logical_array
use fms_io_utils_mod, only: get_data_type_string
use platform_mod, only: r4_kind, r8_kind
use platform_mod, only: r4_kind, r8_kind, FMS_PATH_LEN

implicit none
private
Expand Down Expand Up @@ -135,8 +135,8 @@ function aof_set_coupler_flux(name, flux_type, implementation, atm_tr_index, par
integer :: length
integer :: num_parameters
integer :: outunit
character(len=fm_path_name_len) :: coupler_list
character(len=fm_path_name_len) :: current_list
character(len=FMS_PATH_LEN) :: coupler_list
character(len=FMS_PATH_LEN) :: current_list
character(len=fm_string_len) :: flux_type_test
character(len=fm_string_len) :: implementation_test
character(len=256) :: error_header
Expand Down
38 changes: 20 additions & 18 deletions field_manager/field_manager.F90
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ module field_manager_mod
write_version_number, &
check_nml_error
use fms2_io_mod, only: file_exists
use platform_mod, only: r4_kind, r8_kind
use platform_mod, only: r4_kind, r8_kind, FMS_PATH_LEN
#ifdef use_yaml
use fm_yaml_mod
#endif
Expand Down Expand Up @@ -258,8 +258,10 @@ module field_manager_mod

!> The length of a character string representing the field name.
integer, parameter, public :: fm_field_name_len = 48
!! TODO this should be removed in favor of the global FMS_PATH_LEN
!! when possible, currently used in ocean_BGC and land_lad2
!> The length of a character string representing the field path.
integer, parameter, public :: fm_path_name_len = 512
integer, parameter, public :: fm_path_name_len = FMS_PATH_LEN
!> The length of a character string representing character values for the field.
integer, parameter, public :: fm_string_len = 1024
!> The length of a character string representing the various types that the values of the field can take.
Expand Down Expand Up @@ -509,7 +511,7 @@ module field_manager_mod

type(field_mgr_type), dimension(:), allocatable, private :: fields !< fields of field_mgr_type

character(len=fm_path_name_len) :: loop_list
character(len=FMS_PATH_LEN) :: loop_list
character(len=fm_type_name_len) :: field_type_name(num_types)
character(len=fm_field_name_len) :: save_root_name
! The string set is the set of characters.
Expand Down Expand Up @@ -595,7 +597,7 @@ subroutine read_field_table_yaml(nfields, table_name)
integer :: h, i, j, k, l, m !< dummy integer buffer
type (fmTable_t) :: my_table !< the field table
integer :: model !< model assocaited with the current field
character(len=fm_path_name_len) :: list_name !< field_manager list name
character(len=FMS_PATH_LEN) :: list_name !< field_manager list name
character(len=fm_string_len) :: subparamvalue !< subparam value to be used when defining new name
character(len=fm_string_len) :: fm_yaml_null !< useful hack when OG subparam does not contain an equals sign
integer :: current_field !< field index within loop
Expand Down Expand Up @@ -857,7 +859,7 @@ subroutine read_field_table_legacy(nfields, table_name)

character(len=1024) :: record
character(len=fm_string_len) :: control_str
character(len=fm_path_name_len) :: list_name
character(len=FMS_PATH_LEN) :: list_name
character(len=fm_string_len) :: method_name
character(len=fm_string_len) :: name_str
character(len=fm_string_len) :: type_str
Expand Down Expand Up @@ -1905,8 +1907,8 @@ function find_list(path, relative_p, create) &
type (field_def), pointer :: relative_p !< pointer to the list to which "path" is relative to
logical, intent(in) :: create !< If the list does not exist, it will be created if set to true

character(len=fm_path_name_len) :: working_path
character(len=fm_path_name_len) :: rest
character(len=FMS_PATH_LEN) :: working_path
character(len=FMS_PATH_LEN) :: rest
character(len=fm_field_name_len) :: this_list
integer :: i, out_unit
type (field_def), pointer, save :: working_path_p
Expand Down Expand Up @@ -2172,7 +2174,7 @@ end function fm_get_index
!> @returns The path corresponding to the current list
function fm_get_current_list() &
result (path)
character(len=fm_path_name_len) :: path
character(len=FMS_PATH_LEN) :: path

type (field_def), pointer, save :: temp_list_p
! Initialize the field manager if needed
Expand Down Expand Up @@ -2582,7 +2584,7 @@ function fm_new_list(name, create, keep) &

logical :: create_t
logical :: keep_t
character(len=fm_path_name_len) :: path
character(len=FMS_PATH_LEN) :: path
character(len=fm_field_name_len) :: base
type (field_def), pointer, save :: temp_list_p
integer :: out_unit
Expand Down Expand Up @@ -2652,7 +2654,7 @@ function fm_new_value_integer(name, new_ival, create, index, append) &
integer :: i
integer :: index_t
integer, pointer, dimension(:) :: temp_i_value
character(len=fm_path_name_len) :: path
character(len=FMS_PATH_LEN) :: path
character(len=fm_field_name_len) :: base
type (field_def), pointer, save :: temp_list_p
type (field_def), pointer, save :: temp_field_p
Expand Down Expand Up @@ -2788,7 +2790,7 @@ function fm_new_value_logical(name, new_lval, create, index, append) &
logical, intent(in), optional :: append !< If present and .true., then append the value to
!! an array of the present values. If present and .true., then index cannot be greater than 0.

character(len=fm_path_name_len) :: path
character(len=FMS_PATH_LEN) :: path
character(len=fm_field_name_len) :: base
integer :: i
integer :: index_t
Expand Down Expand Up @@ -2922,7 +2924,7 @@ function fm_new_value_string(name, new_sval, create, index, append) &
logical, intent(in), optional :: append !< If present and .true., then append the value to

character(len=fm_string_len), dimension(:), pointer :: temp_s_value
character(len=fm_path_name_len) :: path
character(len=FMS_PATH_LEN) :: path
character(len=fm_field_name_len) :: base
integer :: i
integer :: index_t
Expand Down Expand Up @@ -3086,7 +3088,7 @@ function get_field(name, this_list_p) &
type (field_def), pointer :: this_list_p !< A pointer to a list that serves as the base point
!! for searching for name

character(len=fm_path_name_len) :: path
character(len=FMS_PATH_LEN) :: path
character(len=fm_field_name_len) :: base
type (field_def), pointer, save :: temp_p

Expand Down Expand Up @@ -3122,7 +3124,7 @@ function fm_modify_name(oldname, newname)
character(len=*), intent(in) :: newname !< The name that the user wishes to change the name of
!! the field to.

character(len=fm_path_name_len) :: path
character(len=FMS_PATH_LEN) :: path
character(len=fm_field_name_len) :: base
type (field_def), pointer, save :: list_p
type (field_def), pointer, save :: temp_p
Expand Down Expand Up @@ -3263,9 +3265,9 @@ function fm_query_method(name, method_name, method_control) &
character(len=*), intent(out) :: method_name !< name of a parameter associated with the named field
character(len=*), intent(out) :: method_control !< value of parameters associated with the named field

character(len=fm_path_name_len) :: path
character(len=fm_path_name_len) :: base
character(len=fm_path_name_len) :: name_loc
character(len=FMS_PATH_LEN) :: path
character(len=FMS_PATH_LEN) :: base
character(len=FMS_PATH_LEN) :: name_loc
logical :: recursive_t
type (field_def), pointer, save :: temp_list_p
type (field_def), pointer, save :: temp_value_p
Expand Down Expand Up @@ -3571,7 +3573,7 @@ recursive function find_method(list_p, recursive, num_meth, method, control) &
character(len=*), intent(out), dimension(:) :: method !< The methods associated with the field pointed to by list_p
character(len=*), intent(out), dimension(:) :: control !< The control parameters for the methods found

character(len=fm_path_name_len) :: scratch
character(len=FMS_PATH_LEN) :: scratch
integer :: i
integer :: n
type (field_def), pointer, save :: this_field_p
Expand Down
32 changes: 16 additions & 16 deletions field_manager/fm_util.F90
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
!> @{
module fm_util_mod !{

use field_manager_mod, only: fm_string_len, fm_path_name_len, fm_field_name_len, fm_type_name_len
use field_manager_mod, only: fm_string_len, fm_field_name_len, fm_type_name_len
use field_manager_mod, only: fm_get_type, fm_get_index, fm_get_length
use field_manager_mod, only: fm_get_current_list, fm_new_list, fm_change_list, fm_loop_over_list
use field_manager_mod, only: fm_new_value, fm_get_value
use field_manager_mod, only: fm_exists, fm_dump_list
use fms_mod, only: FATAL, stdout
use mpp_mod, only: mpp_error
use platform_mod, only: r4_kind, r8_kind
use platform_mod, only: r4_kind, r8_kind, FMS_PATH_LEN

implicit none

Expand Down Expand Up @@ -93,9 +93,9 @@ module fm_util_mod !{
character(len=128) :: save_default_good_name_list = ' '
logical :: default_no_overwrite = .false.
logical :: save_default_no_overwrite = .false.
character(len=fm_path_name_len) :: save_current_list
character(len=fm_path_name_len) :: save_path
character(len=fm_path_name_len) :: save_name
character(len=FMS_PATH_LEN) :: save_current_list
character(len=FMS_PATH_LEN) :: save_path
character(len=FMS_PATH_LEN) :: save_name
! Include variable "version" to be written to log file.
#include<file_version.h>

Expand Down Expand Up @@ -1602,7 +1602,7 @@ subroutine fm_util_set_value_integer_array(name, ival, length, caller, no_overwr
integer, intent(in) :: ival(length)
character(len=*), intent(in), optional :: caller
logical, intent(in), optional :: no_overwrite
character(len=fm_path_name_len), intent(in), optional :: good_name_list
character(len=FMS_PATH_LEN), intent(in), optional :: good_name_list

!
! Local parameters
Expand All @@ -1623,7 +1623,7 @@ subroutine fm_util_set_value_integer_array(name, ival, length, caller, no_overwr
integer :: field_length
integer :: n
logical :: no_overwrite_use
character(len=fm_path_name_len) :: good_name_list_use
character(len=FMS_PATH_LEN) :: good_name_list_use
logical :: add_name

!
Expand Down Expand Up @@ -1759,7 +1759,7 @@ subroutine fm_util_set_value_logical_array(name, lval, length, caller, no_overwr
logical, intent(in) :: lval(length)
character(len=*), intent(in), optional :: caller
logical, intent(in), optional :: no_overwrite
character(len=fm_path_name_len), intent(in), optional :: good_name_list
character(len=FMS_PATH_LEN), intent(in), optional :: good_name_list

!
! Local parameters
Expand All @@ -1780,7 +1780,7 @@ subroutine fm_util_set_value_logical_array(name, lval, length, caller, no_overwr
integer :: field_length
integer :: n
logical :: no_overwrite_use
character(len=fm_path_name_len) :: good_name_list_use
character(len=FMS_PATH_LEN) :: good_name_list_use
logical :: add_name

!
Expand Down Expand Up @@ -1916,7 +1916,7 @@ subroutine fm_util_set_value_string_array(name, sval, length, caller, no_overwri
character(len=*), intent(in) :: sval(length)
character(len=*), intent(in), optional :: caller
logical, intent(in), optional :: no_overwrite
character(len=fm_path_name_len), intent(in), optional :: good_name_list
character(len=FMS_PATH_LEN), intent(in), optional :: good_name_list

!
! Local parameters
Expand All @@ -1937,7 +1937,7 @@ subroutine fm_util_set_value_string_array(name, sval, length, caller, no_overwri
integer :: field_length
integer :: n
logical :: no_overwrite_use
character(len=fm_path_name_len) :: good_name_list_use
character(len=FMS_PATH_LEN) :: good_name_list_use
logical :: add_name

!
Expand Down Expand Up @@ -2096,7 +2096,7 @@ subroutine fm_util_set_value_integer(name, ival, caller, index, append, no_creat
integer :: field_index
logical :: no_overwrite_use
integer :: field_length
character(len=fm_path_name_len) :: good_name_list_use
character(len=FMS_PATH_LEN) :: good_name_list_use
logical :: create
logical :: add_name

Expand Down Expand Up @@ -2268,7 +2268,7 @@ subroutine fm_util_set_value_logical(name, lval, caller, index, append, no_creat
integer :: field_index
logical :: no_overwrite_use
integer :: field_length
character(len=fm_path_name_len) :: good_name_list_use
character(len=FMS_PATH_LEN) :: good_name_list_use
logical :: create
logical :: add_name

Expand Down Expand Up @@ -2439,7 +2439,7 @@ subroutine fm_util_set_value_string(name, sval, caller, index, append, no_create
integer :: field_index
logical :: no_overwrite_use
integer :: field_length
character(len=fm_path_name_len) :: good_name_list_use
character(len=FMS_PATH_LEN) :: good_name_list_use
logical :: create
logical :: add_name

Expand Down Expand Up @@ -2600,7 +2600,7 @@ subroutine fm_util_start_namelist(path, name, caller, no_overwrite, check) !{
!

integer :: namelist_index
character(len=fm_path_name_len) :: path_name
character(len=FMS_PATH_LEN) :: path_name
character(len=256) :: error_header
character(len=256) :: warn_header
character(len=256) :: note_header
Expand Down Expand Up @@ -2764,7 +2764,7 @@ subroutine fm_util_end_namelist(path, name, caller, check) !{
!

character(len=fm_string_len), pointer, dimension(:) :: good_list => NULL()
character(len=fm_path_name_len) :: path_name
character(len=FMS_PATH_LEN) :: path_name
character(len=256) :: error_header
character(len=256) :: warn_header
character(len=256) :: note_header
Expand Down
2 changes: 1 addition & 1 deletion field_manager/include/field_manager.inc
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ logical :: create_t
integer :: i
integer :: index_t
real(r8_kind), allocatable, dimension(:) :: temp_r_value
character(len=fm_path_name_len) :: path
character(len=FMS_PATH_LEN) :: path
character(len=fm_field_name_len) :: base
type (field_def), pointer, save :: temp_list_p
type (field_def), pointer, save :: temp_field_p
Expand Down
6 changes: 3 additions & 3 deletions field_manager/include/fm_util.inc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ integer, intent(in) :: length
real(FMS_FM_KIND_), intent(in) :: rval(length)
character(len=*), intent(in), optional :: caller
logical, intent(in), optional :: no_overwrite
character(len=fm_path_name_len), intent(in), optional :: good_name_list
character(len=FMS_PATH_LEN), intent(in), optional :: good_name_list

!
! Local parameters
Expand All @@ -57,7 +57,7 @@ integer :: field_index
integer :: field_length
integer :: n
logical :: no_overwrite_use
character(len=fm_path_name_len) :: good_name_list_use
character(len=FMS_PATH_LEN) :: good_name_list_use
logical :: add_name

integer, parameter :: lkind=FMS_FM_KIND_
Expand Down Expand Up @@ -218,7 +218,7 @@ character(len=32) :: str_error
integer :: field_index
logical :: no_overwrite_use
integer :: field_length
character(len=fm_path_name_len) :: good_name_list_use
character(len=FMS_PATH_LEN) :: good_name_list_use
logical :: create
logical :: add_name

Expand Down
7 changes: 7 additions & 0 deletions include/fms_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,12 @@ use,intrinsic :: iso_c_binding, only: c_double,c_float,c_int64_t, &
#define QUAD_KIND DOUBLE_KIND
#endif

!Max string sizes for paths and files
#ifndef FMS_MAX_PATH_LEN
#define FMS_MAX_PATH_LEN 1024
#endif
#ifndef FMS_MAX_FILE_LEN
#define FMS_MAX_FILE_LEN 255
#endif

#endif
2 changes: 1 addition & 1 deletion mpp/include/mpp_util.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,7 @@ end function rarray_to_char
integer, dimension(2) :: lines_and_length
logical :: file_exist
character(len=len(peset(current_peset_num)%name)) :: pelist_name
character(len=128) :: filename
character(len=FMS_PATH_LEN) :: filename
! check the status of input_nml_file
if ( allocated(input_nml_file) ) then
Expand Down
2 changes: 2 additions & 0 deletions platform/platform.F90
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ module platform_mod
l8_kind=LONG_KIND, l4_kind=INT_KIND, &
i8_kind=LONG_KIND, i4_kind=INT_KIND, i2_kind=SHORT_KIND, &
ptr_kind=POINTER_KIND
integer, parameter :: FMS_PATH_LEN = FMS_MAX_PATH_LEN
integer, parameter :: FMS_FILE_LEN = FMS_MAX_FILE_LEN
!could additionally define things like OS, compiler...: useful?
end module platform_mod
!> @}
Expand Down

0 comments on commit 13b068d

Please sign in to comment.