diff --git a/ci/scripts/test.sh b/ci/scripts/test.sh index 840465dd9a5bcd9c7016066fd5578d0ae60af82d..d73406f8d7397a2a9d9c8dc6c1c777387fdc9bcf 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 02e51beea9fe3a1a83e6f4f89858ff9327d4ddf0..3e567de066ffec29bbd46ac4b9a89039bfe55c29 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 ccb006653cd5190d425c24fe8dd0a1e2b57f2e54..f5cd46c10a4733944da4adae80369a63962d128f 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 50cd5db0e1d7edec5cc3c0797396a432ae6e0ac4..ba5e73ac9ec96e027a8b63fc1196ea6226a507d1 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, \