Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Makeing changes to tests to try to get them incorporated into the cib…
Browse files Browse the repository at this point in the history
…uildwheel system
  • Loading branch information
MintoDA1 authored and MintoDA1 committed Aug 17, 2023
1 parent 0cb5674 commit fac14c1
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 43 deletions.
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ SET(LIB ${CMAKE_SOURCE_DIR}/lib)
SET(BIN ${CMAKE_SOURCE_DIR}/bin)
SET(MOD ${CMAKE_SOURCE_DIR}/include)
SET(PY ${CMAKE_SOURCE_DIR}/swiftest)
#SET(TEST ${CMAKE_SOURCE_DIR}/tests)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIB})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIB})
Expand All @@ -73,9 +72,6 @@ SET(CMAKE_Fortran_MODULE_DIRECTORY ${MOD})
ADD_SUBDIRECTORY(${SRC} ${BIN})

ADD_SUBDIRECTORY(${PY})
# # Set up test directory
# ENABLE_TESTING()
# ADD_SUBDIRECTORY(${TEST})

# Add a distclean target to the Makefile
ADD_CUSTOM_TARGET(distclean
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ requires = [
]
build-backend = "setuptools.build_meta"

[tool.cibuildwheel]
dependency-versions = "latest"

[tool.cibuildwheel.linux]
environment = {SKBUILD_CONFIGURE_OPTIONS="-DBUILD_SHARED_LIBS=OFF", FFLAGS="${FFLAGS} -fPIC", CFLAGS="${CFLAGS} -fPIC", LDFLAGS="${LDFLAGS} -fPIE", LIBS="-lgomp"}
before-all = [
Expand Down
2 changes: 1 addition & 1 deletion src/base/base_module.f90
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ subroutine base_util_exit(code,unit)
case default
write(iu, FAIL_MSG) VERSION
write(iu, BAR)
error stop
stop
end select

stop
Expand Down
8 changes: 4 additions & 4 deletions src/misc/lambda_function_module.f90
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ module lambda_function
!! if (allocated(self%lastarg)) deallocate(self%lastarg)
!! allocate(self%lastarg, source=x)
!! else
!! error stop "Lambda function was not initialized"
!! stop "Lambda function was not initialized"
!! end if
!! end function lambda_ri_args_eval
!!
Expand Down Expand Up @@ -238,7 +238,7 @@ function lambda_eval_0(self, x) result(y)
if (allocated(self%lastarg)) deallocate(self%lastarg)
allocate(self%lastarg, source=x)
else
error stop "Lambda function was not initialized"
stop "Lambda function was not initialized"
end if
end function lambda_eval_0

Expand All @@ -255,7 +255,7 @@ function lambda_eval_0_err(self, x) result(y)
if (allocated(self%lastarg)) deallocate(self%lastarg)
allocate(self%lastarg, source=x)
else
error stop "Lambda function was not initialized"
stop "Lambda function was not initialized"
end if
end function lambda_eval_0_err

Expand All @@ -270,7 +270,7 @@ function lambda_eval_tvar(self, x, t) result(y)
if (associated(self%lambdaptr_tvar)) then
y = self%lambdaptr_tvar(x,t)
else
error stop "Lambda function was not initialized"
stop "Lambda function was not initialized"
end if
end function lambda_eval_tvar

Expand Down
2 changes: 1 addition & 1 deletion src/tides/tides_spin_step.f90
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ module function tides_derivs_eval(self, x, t) result(y)
if (associated(self%lambdaptr_tides_deriv)) then
y = self%lambdaptr_tides_deriv(x, t, self%dt, self%rbeg, self%rend)
else
error stop "Lambda function was not initialized"
stop "Lambda function was not initialized"
end if

return
Expand Down
8 changes: 6 additions & 2 deletions swiftest/_bindings.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ def driver(integrator, param_file_name, display_style):
char* c_param_file_name = b_param_file_name
char* c_display_style = b_display_style

with nogil:
bindings_c_driver(c_integrator, c_param_file_name, c_display_style)
try:
with nogil:
bindings_c_driver(c_integrator, c_param_file_name, c_display_style)
except:
raise Warning("The Swiftest driver did not terminate normally")

return
17 changes: 0 additions & 17 deletions swiftest/tests/CMakeLists.txt

This file was deleted.

29 changes: 15 additions & 14 deletions swiftest/tests/test_input_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ def test01_gen_ic(self):
for f in file_list:
self.assertTrue(os.path.exists(f))

def test02_read_ic(self):
"""
Tests that Swiftest is able to read a set of pre-existing initial conditions files and that they contain the correct data
"""
print("\ntest_read_ic: Test whether we can read back initial conditions files created by test_gen_ic")
sim = swiftest.Simulation(read_param=True)
# Check if all names in Dataset read in from file match the expected list of names
Expand All @@ -72,12 +68,21 @@ def test02_read_ic(self):
# Check to see if all parameter values read in from file match the expected parameters saved when generating the file
self.assertTrue(all([v == param[k] for k,v in sim.param.items() if k in param]))

def test03_integrators(self):
def test02_integrators(self):
"""
Tests that Swiftest is able to integrate a collection of massive bodies and test particles with all available integrators
"""
print("\ntest_integrators: Tests that Swiftest is able to integrate a collection of massive bodies and test particles with all available integrators")
sim = swiftest.Simulation(read_param=True)
sim = swiftest.Simulation()
sim.clean()

# Add the modern planets and the Sun using the JPL Horizons Database.
# Add the modern planets and the Sun using the JPL Horizons Database.
sim.add_solar_system_body(major_bodies)

# Display the run configuration parameters.
param = sim.get_parameter(verbose=False)
sim.save()

# Add 10 user-defined test particles.
ntp = 10
Expand All @@ -90,18 +95,14 @@ def test03_integrators(self):
omega_tp = rng.uniform(0.0, 360.0, ntp)
capm_tp = rng.uniform(0.0, 360.0, ntp)

integrators= ["whm","helio","rmvs","symba"]
integrators= ["helio","whm","rmvs","symba"]
sim.add_body(name=name_tp, a=a_tp, e=e_tp, inc=inc_tp, capom=capom_tp, omega=omega_tp, capm=capm_tp)
sim.set_parameter(tstart=0.0, tstop=0.02, dt=0.01, istep_out=1, dump_cadence=0)
integrators= ["whm","helio","rmvs","symba"]
sim.set_parameter(tstart=0.0, tstop=0.10, dt=0.01, istep_out=1, dump_cadence=0)
for i in integrators:
try:
sim.run(integrator=i)
except:
self.fail(f"Failed with integrator {i}")
sim.run(integrator=i)


def test04_conservation(self):
def test03_conservation(self):
"""
Tests that Swiftest conserves mass, energy, and momentum to within acceptable tolerances.
"""
Expand Down

0 comments on commit fac14c1

Please sign in to comment.