Skip to content

Commit

Permalink
fit copy_data argument intent, add tests, update TUV-x commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mattldawson committed Nov 6, 2024
1 parent 9993aa3 commit e54548b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ if (MUSICA_ENABLE_TUVX AND MUSICA_BUILD_C_CXX_INTERFACE)
set(TUVX_INSTALL_INCLUDE_DIR ${MUSICA_INSTALL_INCLUDE_DIR} CACHE STRING "" FORCE)

set_git_default(TUVX_GIT_REPOSITORY https://github.com/NCAR/tuv-x.git)
set_git_default(TUVX_GIT_TAG v0.10.0)
set_git_default(TUVX_GIT_TAG fbe0f8aa73f6630d230c6463b603d6ba64c65dcf)

FetchContent_Declare(tuvx
GIT_REPOSITORY ${TUVX_GIT_REPOSITORY}
Expand Down
16 changes: 8 additions & 8 deletions fortran/test/unit/util.F90
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ subroutine build_and_check_index_mapping_t(config)
type(mappings_t), pointer :: source_map, target_map
type(index_mappings_t), pointer :: index_mappings
type(error_t) :: error
real(dk), allocatable :: source_data(:), target_data(:)
real(dk) :: source_data(2,5), target_data(3,4)

allocate( f_map( 2 ) )
map => mapping_t( "Test", 2 )
Expand All @@ -302,14 +302,14 @@ subroutine build_and_check_index_mapping_t(config)
index_mappings => index_mappings_t( config, source_map, target_map, error )
ASSERT( error%is_success() )

source_data = (/ 1.0_dk, 2.0_dk, 3.0_dk, 4.0_dk, 5.0_dk /)
target_data = (/ 10.0_dk, 20.0_dk, 30.0_dk, 40.0_dk /)
source_data(2,:) = (/ 1.0_dk, 2.0_dk, 3.0_dk, 4.0_dk, 5.0_dk /)
target_data(2,:) = (/ 10.0_dk, 20.0_dk, 30.0_dk, 40.0_dk /)

call index_mappings%copy_data( source_data, target_data )
ASSERT_EQ( target_data( 1 ), 5.0_dk * 0.82_dk )
ASSERT_EQ( target_data( 2 ), 20.0_dk )
ASSERT_EQ( target_data( 3 ), 2.0_dk )
ASSERT_EQ( target_data( 4 ), 40.0_dk )
call index_mappings%copy_data( source_data(2,:), target_data(2,:) )
ASSERT_EQ( target_data( 2, 1 ), 5.0_dk * 0.82_dk )
ASSERT_EQ( target_data( 2, 2 ), 20.0_dk )
ASSERT_EQ( target_data( 2, 3 ), 2.0_dk )
ASSERT_EQ( target_data( 2, 4 ), 40.0_dk )
deallocate( index_mappings )
deallocate( source_map )
deallocate( target_map )
Expand Down
2 changes: 1 addition & 1 deletion fortran/util.F90
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ subroutine copy_data( this, source, target )

class(index_mappings_t), intent(inout) :: this
real(kind=musica_dk), target, contiguous, intent(in) :: source(:)
real(kind=musica_dk), target, contiguous, intent(in) :: target(:)
real(kind=musica_dk), target, contiguous, intent(inout) :: target(:)

call copy_data_c( this%mappings_c_, c_loc( source ), c_loc( target ) )

Expand Down

0 comments on commit e54548b

Please sign in to comment.