From 4b2d5307ef20d762b48e22779e26457e36436f23 Mon Sep 17 00:00:00 2001 From: Chichi Lalescu <Cristian.Lalescu@ds.mpg.de> Date: Sat, 26 Dec 2015 23:21:00 +0100 Subject: [PATCH] fix interpolation comparison --- done.txt | 1 + tests/test_interpolation.py | 52 +++++++++++++++++++++---------------- todo.txt | 1 - tox_interpolation.ini | 21 --------------- 4 files changed, 31 insertions(+), 44 deletions(-) delete mode 100644 tox_interpolation.ini diff --git a/done.txt b/done.txt index 344832ae..e1765211 100644 --- a/done.txt +++ b/done.txt @@ -3,3 +3,4 @@ x 2015-12-23 decide on versioning system x 2015-12-24 move get_grid coords to interpolator @optimization +v1.0 x 2015-12-25 get rid of temporal interpolation @optimization +v1.0 x 2015-12-26 call interpolation only when needed @optimization +v1.0 +x 2015-12-26 clean up tox files, make sure all tests run @tests +v1.0 diff --git a/tests/test_interpolation.py b/tests/test_interpolation.py index 928ae115..29755bd6 100644 --- a/tests/test_interpolation.py +++ b/tests/test_interpolation.py @@ -1,4 +1,3 @@ -#! /usr/bin/env python2 ####################################################################### # # # Copyright 2015 Max Planck Institute # @@ -26,35 +25,44 @@ import numpy as np -from test_base import * +from base import * import matplotlib.pyplot as plt -class test_interpolation(bfps.NavierStokes): - def __init__( - self, - name = 'test_interpolation', - work_dir = './', - simname = 'test'): - super(test_interpolation, self).__init__( - work_dir = work_dir, - simname = simname, - name = name, - frozen_fields = True) - return None - if __name__ == '__main__': - opt = parser.parse_args() - c = test_interpolation(work_dir = opt.work_dir + '/io') + opt = parser.parse_args( + ['-n', '32', + '--run', + '--ncpu', '2', + '--initialize', + '--neighbours', '4', + '--smoothness', '1', + '--nparticles', '4225', + '--niter_todo', '1', + '--niter_stat', '1', + '--niter_part', '1', + '--niter_out', '1', + '--wd', 'interp'] + + sys.argv[1:]) + c = bfps.NavierStokes( + name = 'test_interpolation', + use_fftw_wisdom = False, + frozen_fields = True) c.pars_from_namespace(opt) + c.fill_up_fluid_code() + c.add_particle_fields( + name = 'n{0}m{1}'.format(opt.neighbours, opt.smoothness), + neighbours = opt.neighbours, + smoothness = opt.smoothness) + c.add_particle_fields( + name = 'n{0}'.format(opt.neighbours), + neighbours = opt.neighbours, + interp_type = 'Lagrange') c.add_particles( integration_steps = 1, - neighbours = 4, - smoothness = 1) + fields_name = 'n{0}m{1}'.format(opt.neighbours, opt.smoothness)) c.add_particles( integration_steps = 1, - neighbours = 4, - interp_type = 'Lagrange') - c.fill_up_fluid_code() + fields_name = 'n{0}'.format(opt.neighbours)) c.finalize_code() c.write_src() c.write_par() diff --git a/todo.txt b/todo.txt index 2356510f..a5a346cf 100644 --- a/todo.txt +++ b/todo.txt @@ -1,5 +1,4 @@ (B) FFTW interpolator doesn't need its own field @optimization +v1.0 -(B) clean up tox files, make sure all tests run @tests +v1.0 (B) compute z polynomials only when needed @optimization +v1.0 (B) use less memory @optimization (B) split library into core and extra @optimization +v1.0 diff --git a/tox_interpolation.ini b/tox_interpolation.ini deleted file mode 100644 index 71b94b22..00000000 --- a/tox_interpolation.ini +++ /dev/null @@ -1,21 +0,0 @@ -[tox] -envlist = py27 -[testenv] -whitelist_externals = - echo - cp -passenv = LD_LIBRARY_PATH -changedir = - {envtmpdir} -commands = - cp -r {toxinidir}/tests {envtmpdir} - python tests/test_interpolation.py \ - -n 32 --ncpu 2 \ - --initialize \ - --nparticles 4225 \ - --niter_todo 1 \ - --niter_stat 1 \ - --niter_part 1 \ - --niter_out 1 \ - --run - -- GitLab