From 30541b48bdff2eb6b9f212b7ebf587b877d6efe6 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Keck <Jean-Baptiste.Keck@imag.fr> Date: Thu, 28 Feb 2019 12:07:00 +0100 Subject: [PATCH] fixed multiresolution test --- ci/scripts/test.sh | 1 + hysop/operator/spatial_filtering.py | 6 +++--- ...resolution_filter.py => test_lowpass_filter.py} | 14 +++++++------- hysop/operators.py | 1 - 4 files changed, 11 insertions(+), 11 deletions(-) rename hysop/operator/tests/{test_multiresolution_filter.py => test_lowpass_filter.py} (93%) diff --git a/ci/scripts/test.sh b/ci/scripts/test.sh index 840465dd9..d73406f8d 100755 --- a/ci/scripts/test.sh +++ b/ci/scripts/test.sh @@ -63,6 +63,7 @@ if [ "$DO_TESTS" = true ]; then python "$HYSOP_DIR/operator/tests/test_transpose.py" python "$HYSOP_DIR/operator/tests/test_fd_derivative.py" python "$HYSOP_DIR/operator/tests/test_absorption.py" + python "$HYSOP_DIR/operator/tests/test_lowpass_filter.py" python "$HYSOP_DIR/operator/tests/test_directional_advection.py" python "$HYSOP_DIR/operator/tests/test_directional_diffusion.py" python "$HYSOP_DIR/operator/tests/test_directional_stretching.py" diff --git a/hysop/operator/spatial_filtering.py b/hysop/operator/spatial_filtering.py index 02e51beea..3e567de06 100644 --- a/hysop/operator/spatial_filtering.py +++ b/hysop/operator/spatial_filtering.py @@ -94,7 +94,7 @@ class LowpassFilterFrontend(MultiComputationalGraphNodeFrontend): check_instance(input_topo, CartesianTopologyDescriptors) check_instance(output_topo, CartesianTopologyDescriptors) check_instance(base_kwds, dict, keys=str, allow_none=True) - #assert (input_topo != output_topo), "Same topology for input and output." + assert (input_topo != output_topo), "Same topology for input and output." super(LowpassFilterFrontend, self).__init__(input_field=input_field, input_topo=input_topo, output_field=output_field, output_topo=output_topo, @@ -179,8 +179,8 @@ class LowpassFilter(ComputationalGraphNodeGenerator): kwds = self._kwds.copy() # if source topology is destination topology there is nothing to be done - #if (ttopo == stopo): - #continue + if (ttopo == stopo): + continue # else we build a lowpass filter operator node = LowpassFilterFrontend(input_variable=(ifield,stopo), diff --git a/hysop/operator/tests/test_multiresolution_filter.py b/hysop/operator/tests/test_lowpass_filter.py similarity index 93% rename from hysop/operator/tests/test_multiresolution_filter.py rename to hysop/operator/tests/test_lowpass_filter.py index ccb006653..f5cd46c10 100755 --- a/hysop/operator/tests/test_multiresolution_filter.py +++ b/hysop/operator/tests/test_lowpass_filter.py @@ -5,7 +5,8 @@ from hysop.testsenv import __ENABLE_LONG_TESTS__ from hysop.tools.io_utils import IO from hysop.tools.numpywrappers import npw from hysop.tools.types import first_not_None -from hysop.operator.multiresolution_filter import MultiresolutionFilter +from hysop.operator.spatial_filtering import LowpassFilter +from hysop.methods import FilteringMethod from hysop.topology.cartesian_topology import CartesianTopology from hysop.constants import implementation_to_backend, Implementation, HYSOP_REAL from hysop.tools.parameters import CartesianDiscretization @@ -86,14 +87,13 @@ class TestMultiresolutionFilter(object): backend=implementation_to_backend(impl), discretization=CartesianDiscretization(shape_c, default_boundaries=True), mpi_params=mpi_params) - base_kwds = dict(variable=f, implementation=impl, - name='multiresolution_filter_{}'.format(str(impl).lower())) + base_kwds = dict(implementation=impl, + name='multiresolution_filter_{}'.format(str(impl).lower()), + filtering_method=FilteringMethod.SUBGRID) if impl is Implementation.PYTHON: msg=' *Python: ' print msg, - yield MultiresolutionFilter( - source_topo=topo_f, target_topo=topo_c, - **base_kwds) + yield LowpassFilter(input_variables={f: topo_f}, output_variables={f: topo_c}, **base_kwds) print else: msg='Unknown implementation to test {}.'.format(impl) @@ -109,7 +109,7 @@ class TestMultiresolutionFilter(object): dout.initialize(self.__f_init) Fref = tuple(data.get().handle.copy() for data in dout.data) dout.initialize(self.__random_init) - op.apply() + op.apply(simulation=None) Fout = tuple(data.get().handle.copy() for data in dout.data) msg0 = 'Reference field {} is not finite.' diff --git a/hysop/operators.py b/hysop/operators.py index 50cd5db0e..ba5e73ac9 100644 --- a/hysop/operators.py +++ b/hysop/operators.py @@ -26,7 +26,6 @@ from hysop.operator.vorticity_absorption import VorticityAbsorption from hysop.operator.dummy import Dummy from hysop.operator.custom import CustomOperator from hysop.operator.convergence import Convergence -from hysop.operator.multiresolution_filter import MultiresolutionFilter from hysop.operator.spatial_filtering import LowpassFilter from hysop.operator.derivative import SpaceDerivative, \ -- GitLab