Skip to content

Commit

Permalink
Revert "feat: add assignment override in fms2_io for interpolator_typ…
Browse files Browse the repository at this point in the history
…e_eq (#1287)"

This reverts commit 4b9e0e8.
  • Loading branch information
rem1776 authored Aug 31, 2023
1 parent 4b9e0e8 commit 2b38193
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 96 deletions.
1 change: 0 additions & 1 deletion fms2_io/fms2_io.F90
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ module fms2_io_mod
public :: get_instance_filename
public :: nullify_filename_appendix
public :: flush_file
public :: assignment(=)
!> @}

!> @brief Opens a given netcdf or domain file.
Expand Down
93 changes: 0 additions & 93 deletions fms2_io/netcdf_io.F90
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ module netcdf_io_mod
public :: write_restart_bc
public :: read_restart_bc
public :: flush_file
public :: assignment(=)

!> @ingroup netcdf_io_mod
interface netcdf_add_restart_variable
Expand Down Expand Up @@ -332,12 +331,6 @@ module netcdf_io_mod
module procedure is_valid_r4
end interface is_valid

!> @brief "=" operator for FmsNetcdfFile_t type
interface assignment(=)
module procedure FmsNetcdfFile_t_eq
end interface assignment(=)


!> @addtogroup netcdf_io_mod
!> @{

Expand Down Expand Up @@ -2364,92 +2357,6 @@ subroutine flush_file(fileobj)
endif
end subroutine flush_file

!> @brief "=" operator for FmsNetcdfFile_t type
subroutine FmsNetcdfFile_t_eq(FmsNetcdfFile_out, FmsNetcdfFile_in)

type(FmsNetcdfFile_t), intent(out) :: FmsNetcdfFile_out
type(FmsNetcdfFile_t), intent(in) :: FmsNetcdfFile_in

FmsNetcdfFile_out%path = FmsNetcdfFile_in%path
FmsNetcdfFile_out%is_readonly = FmsNetcdfFile_in%is_readonly
FmsNetcdfFile_out%ncid = FmsNetcdfFile_in%ncid
FmsNetcdfFile_out%nc_format = FmsNetcdfFile_in%nc_format
FmsNetcdfFile_out%is_netcdf4 = FmsNetcdfFile_in%is_netcdf4
if(allocated(FmsNetcdfFile_in%pelist)) FmsNetcdfFile_out%pelist = FmsNetcdfFile_in%pelist
FmsNetcdfFile_out%io_root = FmsNetcdfFile_in%io_root
FmsNetcdfFile_out%is_root = FmsNetcdfFile_in%is_root
FmsNetcdfFile_out%is_restart = FmsNetcdfFile_in%is_restart
FmsNetcdfFile_out%mode_is_append = FmsNetcdfFile_out%mode_is_append
if(allocated(FmsNetcdfFile_in%is_open)) FmsNetcdfFile_out%is_open = FmsNetcdfFile_in%is_open
FmsNetcdfFile_out%num_restart_vars = FmsNetcdfFile_in%num_restart_vars
FmsNetcdfFile_out%num_compressed_dims = FmsNetcdfFile_in%num_compressed_dims
FmsNetcdfFile_out%is_diskless = FmsNetcdfFile_in%is_diskless
FmsNetcdfFile_out%time_name = FmsNetcdfFile_in%time_name

FmsNetcdfFile_out%bc_dimensions = dimension_information_copy(FmsNetcdfFile_in%bc_dimensions)

if(allocated(FmsNetcdfFile_in%compressed_dims)) &
FmsNetcdfFile_out%compressed_dims = CompressedDimension_copy(FmsNetcdfFile_in%compressed_dims)

if(allocated(FmsNetcdfFile_in%restart_vars)) then
allocate(FmsNetcdfFile_out%restart_vars(size(FmsNetcdfFile_in%restart_vars)))
call RestartVariable_copy(FmsNetcdfFile_in%restart_vars,FmsNetcdfFile_out%restart_vars)
end if


end subroutine FmsNetcdfFile_t_eq

!> @brief copies the type RestartVariable_t
!! Note, RestartVariable_copy cannot be declared as an elemental function
!! due to pointer assignments
subroutine RestartVariable_copy(RestartVariable_in,RestartVariable_out)

implicit none
type(RestartVariable_t), intent(in), dimension(:) :: RestartVariable_in
type(RestartVariable_t), intent(out), dimension(:) :: RestartVariable_out

integer :: i

do i=1, size(RestartVariable_in)
RestartVariable_out(i)%varname = RestartVariable_in(i)%varname
if(associated(RestartVariable_in(i)%data1d)) RestartVariable_out(i)%data1d => RestartVariable_in(i)%data1d
if(associated(RestartVariable_in(i)%data2d)) RestartVariable_out(i)%data2d => RestartVariable_in(i)%data2d
if(associated(RestartVariable_in(i)%data3d)) RestartVariable_out(i)%data3d => RestartVariable_in(i)%data3d
if(associated(RestartVariable_in(i)%data4d)) RestartVariable_out(i)%data4d => RestartVariable_in(i)%data4d
if(associated(RestartVariable_in(i)%data5d)) RestartVariable_out(i)%data5d => RestartVariable_in(i)%data5d
end do

end subroutine RestartVariable_copy

!> @brief copies the type CompressedDimension_t
elemental function CompressedDimension_copy(CompressedDimension_in)

implicit none
type(CompressedDimension_t), intent(in) :: CompressedDimension_in
type(CompressedDimension_t) :: CompressedDimension_copy

CompressedDimension_copy%dimname = CompressedDimension_in%dimname
if(allocated(CompressedDimension_copy%npes_corner)) &
CompressedDimension_copy%npes_corner = CompressedDimension_in%npes_corner
if(allocated(CompressedDimension_in%npes_nelems)) &
CompressedDimension_copy%npes_nelems = CompressedDimension_in%npes_nelems

end function CompressedDimension_copy

!> @brief copies the type dimension information
elemental function dimension_information_copy(dimension_information_in)

implicit none
type(dimension_information), intent(in) :: dimension_information_in
type(dimension_information) :: dimension_information_copy

dimension_information_copy%xlen = dimension_information_in%xlen
dimension_information_copy%ylen = dimension_information_in%ylen
dimension_information_copy%zlen = dimension_information_in%zlen
dimension_information_copy%cur_dim_len = dimension_information_in%cur_dim_len

end function dimension_information_copy

end module netcdf_io_mod
!> @}
! close documentation grouping
3 changes: 1 addition & 2 deletions interpolator/interpolator.F90
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ module interpolator_mod
get_num_variables, get_dimension_size, &
get_variable_units, get_variable_names, &
get_time_calendar, close_file, &
get_variable_dimension_names, get_variable_sense, assignment(=)
get_variable_dimension_names, get_variable_sense

use horiz_interp_mod, only : horiz_interp_type, &
horiz_interp_new, &
Expand Down Expand Up @@ -346,7 +346,6 @@ subroutine interpolate_type_eq (Out, In)

Out%interph = In%interph
if (allocated(In%time_slice)) Out%time_slice = In%time_slice
Out%fileobj = In%fileobj
Out%file_name = In%file_name
Out%time_flag = In%time_flag
Out%level_type = In%level_type
Expand Down

0 comments on commit 2b38193

Please sign in to comment.