Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
15fdb29
first version of pointer to array subroutines
Mar 17, 2025
00d0ec5
maybe working c_diag_manager
Mar 17, 2025
41c1d16
Merge remote-tracking branch 'origin/main' into diag_manager_2
Mar 17, 2025
6add3bb
add 2d test
Mar 18, 2025
2f825b6
add with-yaml to fms build
Mar 18, 2025
725a631
add untracked file
Mar 18, 2025
cf3246e
add TODO comments to tests
Mar 18, 2025
03d0805
combine 2d and 3d test
Mar 18, 2025
a2b22ae
data_override_init
Mar 18, 2025
b3a53a5
Merge remote-tracking branch 'origin/main' into data_override
Mar 18, 2025
da9b9ab
fix merge error
Mar 18, 2025
14d5db5
make optional arguments null pointers
Mar 19, 2025
f3db270
woking version before merge
Mar 19, 2025
fe176e4
Merge remote-tracking branch 'origin/data_override' into data_override
Mar 19, 2025
a86c92d
add scalar
Mar 19, 2025
4f12959
Merge remote-tracking branch 'origin/main' into data_override_0d
Mar 19, 2025
b2383fe
fix comment in test_data_override_ongrid
Mar 19, 2025
0ed947f
commit files that were not commited previously?
Mar 19, 2025
8b765dc
add untracked files
Mar 19, 2025
10acfa0
add array_t_pointer
Mar 20, 2025
1e00b0e
add other flavors
Mar 20, 2025
a831d05
change test from int to double
Mar 20, 2025
b2d2936
override 2d in the works
Mar 24, 2025
5790f64
Merge remote-tracking branch 'origin/array_to_pointer' into data_over…
Mar 24, 2025
d788384
working test
Mar 24, 2025
e87ad3b
cleanup
Mar 24, 2025
d2fa608
add include
Mar 24, 2025
33c95d6
Merge remote-tracking branch 'origin/main' into data_override_2d
Mar 24, 2025
1c4b364
fix missed cleanups in test
Mar 24, 2025
8372ee4
add 3d data_override cleanup fortran code to generate input files
Mar 24, 2025
e1e6154
fix unit test with abs
Mar 24, 2025
5b37688
add 3d unit tests
Mar 24, 2025
11fb402
lower tolerance
Mar 24, 2025
0c86cc5
ci is failing
Mar 24, 2025
77616eb
add print to test
Mar 24, 2025
27fe3d0
fix test script for data overrid 2d
Mar 24, 2025
6bf0974
remove blank line
Mar 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions c_data_override/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ noinst_LTLIBRARIES = lib_c_data_override.la

# Each convenience library depends on its source.
lib_c_data_override_la_SOURCES = c_data_override.F90 \
include/c_data_override_0d.fh \
include/c_data_override_0d.fh \
include/c_data_override_0d.inc \
include/c_data_override_2d.fh \
include/c_data_override_2d.inc
include/c_data_override_2d.fh \
include/c_data_override_2d.inc \
include/c_data_override_3d.fh \
include/c_data_override_3d.inc

c_data_override_mod.mod : c_data_override.F90

Expand Down
3 changes: 3 additions & 0 deletions c_data_override/c_data_override.F90
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ module c_data_override_mod
public :: cFMS_data_override_0d_cdouble
public :: cFMS_data_override_2d_cfloat
public :: cFMS_data_override_2d_cdouble
public :: cFMS_data_override_3d_cfloat
public :: cFMS_data_override_3d_cdouble
public :: cFMS_data_override_init
public :: cFMS_data_override_set_time

Expand Down Expand Up @@ -98,5 +100,6 @@ end subroutine cFMS_data_override_set_time

#include "c_data_override_0d.fh"
#include "c_data_override_2d.fh"
#include "c_data_override_3d.fh"

end module c_data_override_mod
6 changes: 6 additions & 0 deletions c_data_override/c_data_override.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ extern void cFMS_data_override_2d_cfloat(char *gridname, char *fieldname, int *d
extern void cFMS_data_override_2d_cdouble(char *gridname, char *fieldname, int *data_shape, double *data,
bool *override, int *is, int *ie, int *js, int *je);

extern void cFMS_data_override_3d_cfloat(char *gridname, char *fieldname, int *data_shape, float *data,
bool *override, int *data_index, int *is, int *ie, int *js, int *je);

extern void cFMS_data_override_3d_cdouble(char *gridname, char *fieldname, int *data_shape, double *data,
bool *override, int *data_index, int *is, int *ie, int *js, int *je);

extern void cFMS_data_override_init(int *atm_domain_id, int *ocn_domain_id, int *ice_domain_id, int *land_domain_id,
int *land_domainUG_id, int *mode);

Expand Down
1 change: 0 additions & 1 deletion c_data_override/include/c_data_override_2d.inc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ subroutine CFMS_DATA_OVERRIDE_2D_(gridname, fieldname, data_shape, data, overrid
logical :: override_f

CFMS_DATA_OVERRIDE_2D_TYPE_, allocatable :: data_f(:,:)
integer :: i, j

gridname_f = fms_string_utils_c2f_string(gridname)
fieldname_f = fms_string_utils_c2f_string(fieldname)
Expand Down
16 changes: 16 additions & 0 deletions c_data_override/include/c_data_override_3d.fh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#undef CFMS_DATA_OVERRIDE_3D_
#undef CFMS_DATA_OVERRIDE_3D_BINDC_
#undef CFMS_DATA_OVERRIDE_3D_TYPE_
#define CFMS_DATA_OVERRIDE_3D_ cFMS_data_override_3d_cfloat
#define CFMS_DATA_OVERRIDE_3D_BINDC_ "cFMS_data_override_3d_cfloat"
#define CFMS_DATA_OVERRIDE_3D_TYPE_ real(c_float)
#include "c_data_override_3d.inc"

#undef CFMS_DATA_OVERRIDE_3D_
#undef CFMS_DATA_OVERRIDE_3D_BINDC_
#undef CFMS_DATA_OVERRIDE_3D_TYPE_
#define CFMS_DATA_OVERRIDE_3D_ cFMS_data_override_3d_cdouble
#define CFMS_DATA_OVERRIDE_3D_BINDC_ "cFMS_data_override_3d_cdouble"
#define CFMS_DATA_OVERRIDE_3D_TYPE_ real(c_double)
#include "c_data_override_3d.inc"

43 changes: 43 additions & 0 deletions c_data_override/include/c_data_override_3d.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
subroutine CFMS_DATA_OVERRIDE_3D_(gridname, fieldname, data_shape, data, override, data_index, is, ie, js, je) &
bind(C, name=CFMS_DATA_OVERRIDE_3D_BINDC_)

implicit none
character(c_char), intent(in) :: gridname(NAME_LENGTH)
character(c_char), intent(in) :: fieldname(NAME_LENGTH)
integer, intent(in) :: data_shape(3)
type(c_ptr), value,intent(in) :: data
logical(c_bool), intent(out), optional :: override
integer, intent(in), optional :: data_index
integer, intent(in), optional :: is
integer, intent(in), optional :: ie
integer, intent(in), optional :: js
integer, intent(in), optional :: je

character(len=NAME_LENGTH-1) :: gridname_f
character(len=NAME_LENGTH-1) :: fieldname_f
logical :: override_f

CFMS_DATA_OVERRIDE_2D_TYPE_, allocatable :: data_f(:,:,:)

gridname_f = fms_string_utils_c2f_string(gridname)
fieldname_f = fms_string_utils_c2f_string(fieldname)

allocate(data_f(data_shape(1),data_shape(2),data_shape(3)))

call fms_data_override(gridname = gridname_f, &
fieldname_code = fieldname_f, &
return_data = data_f, &
time = data_override_time, &
override = override_f, &
data_index = data_index, &
is_in = is, &
js_in = js, &
ie_in = ie, &
je_in = je)

call cfms_array_to_pointer(data_f, data_shape, data)
deallocate(data_f)

if(present(override)) override = logical(override, c_bool)

end subroutine CFMS_DATA_OVERRIDE_3D_
13 changes: 7 additions & 6 deletions test_cfms/c_data_override/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,27 @@ AM_CPPFLAGS = -I. -I$(MODDIR) -I${top_builddir}/c_data_override \
LDADD = ${top_builddir}/libcFMS/libcFMS.la

check_PROGRAMS = test_data_override_scalar \
test_data_override_2d
test_data_override_2d \
test_data_override_3d

TESTS = test_data_override_scalar.sh \
test_data_override_2d.sh
test_data_override_2d.sh \
test_data_override_3d.sh

test_data_override_scalar_SOURCES = ../c_fms/c_mpp_domains_helper.c test_data_override_scalar.c
test_data_override_2d_SOURCES = ../c_fms/c_mpp_domains_helper.c test_data_override_2d.c
test_data_override_3d_SOURCES = ../c_fms/c_mpp_domains_helper.c test_data_override_3d.c

test_data_override_ongrid : test_data_override_ongrid.F90
$(FC) $(FCFLAGS) $(LDFLAGS) -I./include test_data_override_ongrid.F90 -o test_data_override_ongrid
$(FC) $(FCFLAGS) $(LDFLAGS) test_data_override_ongrid.F90 -o test_data_override_ongrid

test_data_override_ongrid : test_data_override_ongrid.F90
$(FC) $(FCFLAGS) $(LDFLAGS) -I./include test_data_override_ongrid.F90 -o test_data_override_ongrid

TEST_EXTENSIONS = .sh
SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
$(abs_top_srcdir)/test_cfms/tap-driver.sh

# Include these files with the distribution.
EXTRA_DIST = test_data_override_scalar.sh test_data_override_2d.sh
EXTRA_DIST = test_data_override_scalar.sh test_data_override_2d.sh test_data_override_3d.sh

# Clean up
CLEANFILES = *.nml* *.out *.dpi *.spi *.dyn *.spl *_table* input* *trs *.nc*
224 changes: 0 additions & 224 deletions test_cfms/c_data_override/include/test_data_override_ongrid.inc

This file was deleted.

Loading