Skip to content

Commit 604610d

Browse files
mlee03mlee03
authored andcommitted
update test
1 parent d23b1e9 commit 604610d

3 files changed

Lines changed: 112 additions & 4 deletions

File tree

pyfms/py_mpp/py_mpp_domains.py

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,101 @@ def get_compute_domain(
398398
shalo_c,
399399
)
400400

401+
402+
def get_compute_domain2(self,
403+
domain_id: Optional[int] = None,
404+
position: Optional[int] = None,
405+
tile_count: Optional[int] = None,
406+
whalo: Optional[int] = None,
407+
shalo: Optional[int] = None) -> dict():
408+
409+
_cfms_get_compute_domain = self.cFMS.cFMS_get_compute_domain
410+
411+
default_i = 0
412+
default_b = False
413+
414+
domain_id_t = ctypes.c_int
415+
xbegin_t = ctypes.c_int
416+
xend_t = ctypes.c_int
417+
ybegin_t = ctypes.c_int
418+
yend_t = ctypes.c_int
419+
xsize_t = ctypes.c_int
420+
xmax_size_t = ctypes.c_int
421+
ysize_t = ctypes.c_int
422+
ymax_size_t = ctypes.c_int
423+
x_is_global_t = ctypes.c_bool
424+
y_is_global_t = ctypes.c_bool
425+
tile_count_t = ctypes.c_int
426+
position_t = ctypes.c_int
427+
whalo_t = ctypes.c_int
428+
shalo_t = ctypes.c_int
429+
430+
xbegin = xbegin_t(default_i)
431+
xend = xend_t(default_i)
432+
ybegin = ybegin_t(default_i)
433+
yend = yend_t(default_i)
434+
xsize = xsize_t(default_i)
435+
xmax_size = xmax_size_t(default_i)
436+
ysize = ysize_t(default_i)
437+
ymax_size = ymax_size_t(default_i)
438+
x_is_global = x_is_global_t(default_b)
439+
y_is_global = y_is_global_t(default_b)
440+
if domain_id is not None: domain_id = domain_id_t(domain_id)
441+
if tile_count is not None: tile_count = tile_count_t(tile_count)
442+
if position is not None: position = position_t(position)
443+
if whalo is not None: whalo = whalo_t(whalo)
444+
if shalo is not None: shalo = shalo_t(shalo)
445+
446+
447+
_cfms_get_compute_domain.argtypes = [ctypes.POINTER(domain_id_t),
448+
ctypes.POINTER(xbegin_t),
449+
ctypes.POINTER(xend_t),
450+
ctypes.POINTER(ybegin_t),
451+
ctypes.POINTER(yend_t),
452+
ctypes.POINTER(xsize_t),
453+
ctypes.POINTER(xmax_size_t),
454+
ctypes.POINTER(ysize_t),
455+
ctypes.POINTER(ymax_size_t),
456+
ctypes.POINTER(x_is_global_t),
457+
ctypes.POINTER(y_is_global_t),
458+
ctypes.POINTER(tile_count_t),
459+
ctypes.POINTER(position_t),
460+
ctypes.POINTER(whalo_t),
461+
ctypes.POINTER(shalo_t)]
462+
463+
_cfms_get_compute_domain.restype = None
464+
465+
_cfms_get_compute_domain(domain_id,
466+
xbegin,
467+
xend,
468+
ybegin,
469+
yend,
470+
xsize,
471+
xmax_size,
472+
ysize,
473+
ymax_size,
474+
x_is_global,
475+
y_is_global,
476+
tile_count,
477+
position,
478+
whalo,
479+
shalo,
480+
)
481+
482+
return dict(domain_id=domain_id.value,
483+
xbegin=xbegin.value,
484+
ybegin=ybegin.value,
485+
xend=xend.value,
486+
yend=yend.value,
487+
xsize=xsize.value,
488+
ysize=ysize.value,
489+
xmax_size=xmax_size.value,
490+
ymax_size=ymax_size.value,
491+
x_is_global=x_is_global.value,
492+
y_is_global=y_is_global.value)
493+
494+
495+
401496
"""
402497
Subroutine: get_data_domain
403498

run_tests.sh

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/bash
22

3+
set -x
4+
5+
36
pytest tests/test_build.py
47
if [ $? -ne 0 ] ; then
58
echo "test_build error" ;
@@ -12,9 +15,15 @@ if [ $? -ne 0 ] ; then
1215
exit 1
1316
fi
1417

15-
mpirun -n 8 python -m pytest tests/py_mpp
18+
mpirun -n 8 python -m pytest tests/py_mpp/test_define_domains.py
19+
if [ $? -ne 0 ] ; then
20+
echo "test_pympp/test_define_domains error" ;
21+
exit 1
22+
fi
23+
24+
mpirun -n 4 python -m pytest tests/py_mpp/test_getset_domains.py
1625
if [ $? -ne 0 ] ; then
17-
echo "test_pympp error" ;
26+
echo "test_pympp/test_getset_domains error" ;
1827
exit 1
1928
fi
2029

@@ -23,3 +32,9 @@ if [ $? -ne 0 ] ; then
2332
echo "test_horiz_interp error" ;
2433
exit 1
2534
fi
35+
36+
mpirun -n 6 python -m pytest tests/py_data_override
37+
if [ $? -ne 0 ] ; then
38+
echo "test_data_override error" ;
39+
exit 1
40+
fi

tests/py_data_override/test_data_override.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,3 @@ def test_data_override():
3838

3939
pyfms.pyfms_end()
4040

41-
42-
test_data_override()

0 commit comments

Comments
 (0)