From 83d35442ed8a3846a5f6384aa371bdcc05a199da Mon Sep 17 00:00:00 2001 From: Matthew Scroggs Date: Fri, 8 Nov 2024 17:59:28 +0000 Subject: [PATCH] update tests --- test/conftest.py | 22 +-- test/data/generate_fmm_data.py | 74 ++++----- test/data/generate_matrices.py | 150 +++++++++--------- test/unit/external/test_fenics.py | 12 +- test/unit/external/test_fenicsx.py | 6 +- test/unit/fmm/test_unit_fmm.py | 18 +-- test/unit/grid/test_grid.py | 32 ++-- test/unit/grid/test_grid_function.py | 42 ++--- test/unit/grid/test_grid_io.py | 8 +- test/unit/grid/test_shapes.py | 4 +- test/unit/integration/test_duffy.py | 2 +- test/unit/metadata/test_version_number.py | 4 +- test/unit/operators/test_blocked_operators.py | 18 +-- .../unit/operators/test_boundary_operators.py | 28 ++-- .../operators/test_far_field_operators.py | 14 +- .../operators/test_potential_operators.py | 18 +-- test/unit/space/test_barycentric.py | 10 +- test/unit/space/test_barycentric_rwg.py | 10 +- test/unit/space/test_bc_spaces.py | 14 +- test/unit/space/test_continuity.py | 20 +-- test/unit/space/test_function_io.py | 10 +- test/unit/space/test_local2global.py | 10 +- test/unit/space/test_segments.py | 76 ++++----- test/unit/space/test_space.py | 26 +-- test/unit/utils/test_interpolation.py | 2 +- .../test_mixed_neumann_dirichlet_.py | 56 +++---- test/validation/fmm/test_fmm.py | 150 +++++++++--------- .../boundary/test_helmholtz_boundary.py | 32 ++-- .../boundary/test_laplace_boundary.py | 36 ++--- .../boundary/test_maxwell_boundary.py | 32 ++-- .../boundary/test_modified_helmholtz.py | 16 +- .../operators/boundary/test_sparse.py | 28 ++-- .../far_field/test_helmholtz_far_field.py | 60 +++---- .../far_field/test_maxwell_far_field.py | 60 +++---- .../operators/potential/test_helmholtz.py | 50 +++--- .../operators/potential/test_laplace.py | 40 ++--- .../operators/potential/test_maxwell.py | 60 +++---- 37 files changed, 625 insertions(+), 625 deletions(-) diff --git a/test/conftest.py b/test/conftest.py index bc619c29..eb753a39 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -5,8 +5,8 @@ import numpy as np import pytest -import bempp.api -import bempp.core +import bempp_cl.api +import bempp_cl.core def pytest_addoption(parser): @@ -66,9 +66,9 @@ def set_default_device_interface(request): if value == "auto": return elif value == "numba": - bempp.api.DEFAULT_DEVICE_INTERFACE = "numba" + bempp_cl.api.DEFAULT_DEVICE_INTERFACE = "numba" elif value == "opencl": - bempp.api.DEFAULT_DEVICE_INTERFACE = "opencl" + bempp_cl.api.DEFAULT_DEVICE_INTERFACE = "opencl" else: raise ValueError("device must be one of: 'numba', 'opencl'") @@ -79,7 +79,7 @@ def set_device_options(request): vec_mode = request.config.getoption("--vec") if vec_mode not in ["auto", "novec", "vec4", "vec8", "vec16"]: raise ValueError("vec must be one of: 'auto', 'novec', 'vec4', 'vec8', 'vec16'") - bempp.api.VECTORIZATION_MODE = vec_mode + bempp_cl.api.VECTORIZATION_MODE = vec_mode @pytest.fixture() @@ -94,7 +94,7 @@ def precision(request): @pytest.fixture def two_element_grid(): """Simple grid consisting of two elements.""" - from bempp.api.grid import Grid + from bempp_cl.api.grid import Grid vertices = np.array([[0, 1, 1, 0], [0, 0, 1, 1], [0, 0, 0, 0]]) @@ -106,7 +106,7 @@ def two_element_grid(): @pytest.fixture def default_parameters(): """Return a default parameters object.""" - from bempp.api.utils.parameters import DefaultParameters + from bempp_cl.api.utils.parameters import DefaultParameters parameters = DefaultParameters() parameters.quadrature.regular = 4 @@ -118,13 +118,13 @@ def default_parameters(): @pytest.fixture def small_piecewise_const_space(small_sphere): """A simple piecewise constant space on a small sphere.""" - return bempp.api.function_space(small_sphere, "DP", 0) + return bempp_cl.api.function_space(small_sphere, "DP", 0) @pytest.fixture def laplace_slp_small_sphere(small_piecewise_const_space, default_parameters): """The Laplace single layer operator on a small sphere.""" - from bempp.api.operators.boundary.laplace import single_layer + from bempp_cl.api.operators.boundary.laplace import single_layer return single_layer( small_piecewise_const_space, @@ -158,11 +158,11 @@ def load_npz_data(name): def load_grid(name): """Load grid stored as msh file (give name without ending)""" grid_name = os.path.join(Helpers.test_path(), "data/" + name + ".msh") - return bempp.api.import_grid(grid_name) + return bempp_cl.api.import_grid(grid_name) @staticmethod def test_path(): - """Return path of the bempp module.""" + """Return path of the bempp_cl module.""" return os.path.abspath(os.path.dirname(__file__)) @staticmethod diff --git a/test/data/generate_fmm_data.py b/test/data/generate_fmm_data.py index bd540ba3..9c2c1781 100644 --- a/test/data/generate_fmm_data.py +++ b/test/data/generate_fmm_data.py @@ -1,6 +1,6 @@ # Script to be run with legacy Bempp to generate the comparison data. -import bempp.api +import bempp_cl.api import numpy as np import os.path @@ -53,52 +53,52 @@ def save_matvec_result(operator, space1, space2, space3, vec, filename, *args): def save_potential_eval_result(operator, space, vec, points, filename, *args): if REGENERATE or not os.path.exists(filename + ".npy"): print("Generating " + filename) - grid_fun = bempp.api.GridFunction(space, coefficients=vec) + grid_fun = bempp_cl.api.GridFunction(space, coefficients=vec) result = operator(space, points, *args, assembler="dense").evaluate(grid_fun) np.save(filename, result) else: print("Skipping " + filename + " (already generated)") -grid = bempp.api.shapes.ellipsoid(1, 0.5, 0.3, h=0.1) -bempp.api.export("fmm_grid.msh", grid=grid) -space = bempp.api.function_space(grid, "P", 1) +grid = bempp_cl.api.shapes.ellipsoid(1, 0.5, 0.3, h=0.1) +bempp_cl.api.export("fmm_grid.msh", grid=grid) +space = bempp_cl.api.function_space(grid, "P", 1) vec = generate_vector(space.global_dof_count, "fmm_p1_vec") points = generate_points(30, "fmm_potential_points.npy") # Generate P1 boundary operator results for filename, operator in [ - ("fmm_laplace_single", bempp.api.operators.boundary.laplace.single_layer), - ("fmm_laplace_double", bempp.api.operators.boundary.laplace.double_layer), - ("fmm_laplace_adjoint", bempp.api.operators.boundary.laplace.adjoint_double_layer), - ("fmm_laplace_hyper", bempp.api.operators.boundary.laplace.hypersingular), + ("fmm_laplace_single", bempp_cl.api.operators.boundary.laplace.single_layer), + ("fmm_laplace_double", bempp_cl.api.operators.boundary.laplace.double_layer), + ("fmm_laplace_adjoint", bempp_cl.api.operators.boundary.laplace.adjoint_double_layer), + ("fmm_laplace_hyper", bempp_cl.api.operators.boundary.laplace.hypersingular), ]: save_matvec_result(operator, space, space, space, vec, filename) for filename, operator in [ - ("fmm_helmholtz_single", bempp.api.operators.boundary.helmholtz.single_layer), - ("fmm_helmholtz_double", bempp.api.operators.boundary.helmholtz.double_layer), + ("fmm_helmholtz_single", bempp_cl.api.operators.boundary.helmholtz.single_layer), + ("fmm_helmholtz_double", bempp_cl.api.operators.boundary.helmholtz.double_layer), ( "fmm_helmholtz_adjoint", - bempp.api.operators.boundary.helmholtz.adjoint_double_layer, + bempp_cl.api.operators.boundary.helmholtz.adjoint_double_layer, ), - ("fmm_helmholtz_hyper", bempp.api.operators.boundary.helmholtz.hypersingular), + ("fmm_helmholtz_hyper", bempp_cl.api.operators.boundary.helmholtz.hypersingular), ( "fmm_modified_helmholtz_single", - bempp.api.operators.boundary.modified_helmholtz.single_layer, + bempp_cl.api.operators.boundary.modified_helmholtz.single_layer, ), ( "fmm_modified_helmholtz_double", - bempp.api.operators.boundary.modified_helmholtz.double_layer, + bempp_cl.api.operators.boundary.modified_helmholtz.double_layer, ), ( "fmm_modified_helmholtz_adjoint", - bempp.api.operators.boundary.modified_helmholtz.adjoint_double_layer, + bempp_cl.api.operators.boundary.modified_helmholtz.adjoint_double_layer, ), ( "fmm_modified_helmholtz_hyper", - bempp.api.operators.boundary.modified_helmholtz.hypersingular, + bempp_cl.api.operators.boundary.modified_helmholtz.hypersingular, ), ]: save_matvec_result(operator, space, space, space, vec, filename, 1.5) @@ -107,11 +107,11 @@ def save_potential_eval_result(operator, space, vec, points, filename, *args): for filename, operator in [ ( "fmm_laplace_potential_single", - bempp.api.operators.potential.laplace.single_layer, + bempp_cl.api.operators.potential.laplace.single_layer, ), ( "fmm_laplace_potential_double", - bempp.api.operators.potential.laplace.double_layer, + bempp_cl.api.operators.potential.laplace.double_layer, ), ]: save_potential_eval_result(operator, space, vec, points, filename) @@ -119,33 +119,33 @@ def save_potential_eval_result(operator, space, vec, points, filename, *args): for filename, operator in [ ( "fmm_helmholtz_potential_single", - bempp.api.operators.potential.helmholtz.single_layer, + bempp_cl.api.operators.potential.helmholtz.single_layer, ), ( "fmm_helmholtz_potential_double", - bempp.api.operators.potential.helmholtz.double_layer, + bempp_cl.api.operators.potential.helmholtz.double_layer, ), ( "fmm_modified_potential_helmholtz_single", - bempp.api.operators.potential.modified_helmholtz.single_layer, + bempp_cl.api.operators.potential.modified_helmholtz.single_layer, ), ( "fmm_modified_potential_helmholtz_double", - bempp.api.operators.potential.modified_helmholtz.double_layer, + bempp_cl.api.operators.potential.modified_helmholtz.double_layer, ), ]: save_potential_eval_result(operator, space, vec, points, filename, 1.5) -rwg = bempp.api.function_space(grid, "RWG", 0) -snc = bempp.api.function_space(grid, "SNC", 0) +rwg = bempp_cl.api.function_space(grid, "RWG", 0) +snc = bempp_cl.api.function_space(grid, "SNC", 0) vec2 = generate_vector(rwg.global_dof_count, "fmm_rwg_vec") # Generate Maxwell boundary operator results for filename, operator in [ - ("fmm_maxwell_electric", bempp.api.operators.boundary.maxwell.electric_field), - ("fmm_maxwell_magnetic", bempp.api.operators.boundary.maxwell.magnetic_field), + ("fmm_maxwell_electric", bempp_cl.api.operators.boundary.maxwell.electric_field), + ("fmm_maxwell_magnetic", bempp_cl.api.operators.boundary.maxwell.magnetic_field), ]: save_matvec_result(operator, rwg, rwg, snc, vec2, filename, 1.5) @@ -153,29 +153,29 @@ def save_potential_eval_result(operator, space, vec, points, filename, *args): for filename, operator in [ ( "fmm_maxwell_potential_electric", - bempp.api.operators.potential.maxwell.electric_field, + bempp_cl.api.operators.potential.maxwell.electric_field, ), ( "fmm_maxwell_potential_magnetic", - bempp.api.operators.potential.maxwell.magnetic_field, + bempp_cl.api.operators.potential.maxwell.magnetic_field, ), ]: save_potential_eval_result(operator, rwg, vec2, points, filename, 1.5) # Generate two grid data -grid1 = bempp.api.shapes.ellipsoid(0.5, 0.5, 0.3, h=0.1) -grid2 = bempp.api.shapes.sphere(r=1.5, h=0.1) -bempp.api.export("fmm_grid1.msh", grid=grid1) -bempp.api.export("fmm_grid2.msh", grid=grid2) +grid1 = bempp_cl.api.shapes.ellipsoid(0.5, 0.5, 0.3, h=0.1) +grid2 = bempp_cl.api.shapes.sphere(r=1.5, h=0.1) +bempp_cl.api.export("fmm_grid1.msh", grid=grid1) +bempp_cl.api.export("fmm_grid2.msh", grid=grid2) -p1_space1 = bempp.api.function_space(grid1, "P", 1) -p1_space2 = bempp.api.function_space(grid2, "P", 1) +p1_space1 = bempp_cl.api.function_space(grid1, "P", 1) +p1_space2 = bempp_cl.api.function_space(grid2, "P", 1) vec = generate_vector(p1_space1.global_dof_count, "fmm_two_mesh_vec") for filename, operator in [ - ("fmm_two_mesh_laplace_single", bempp.api.operators.boundary.laplace.single_layer), - ("fmm_two_mesh_laplace_hyper", bempp.api.operators.boundary.laplace.hypersingular), + ("fmm_two_mesh_laplace_single", bempp_cl.api.operators.boundary.laplace.single_layer), + ("fmm_two_mesh_laplace_hyper", bempp_cl.api.operators.boundary.laplace.hypersingular), ]: save_matvec_result(operator, p1_space1, p1_space2, p1_space2, vec, filename) diff --git a/test/data/generate_matrices.py b/test/data/generate_matrices.py index 0ef0584e..96f49f3f 100644 --- a/test/data/generate_matrices.py +++ b/test/data/generate_matrices.py @@ -1,6 +1,6 @@ # Script to be run with legacy Bempp to generate the comparison data. -import bempp.api +import bempp_cl.api import numpy as np import os.path @@ -9,7 +9,7 @@ # run `python generate_matrices.py REGENERATE` to regenerate everything REGENERATE = "REGENERATE" in sys.argv -bempp.api.enable_console_logging() +bempp_cl.api.enable_console_logging() def generate_bem_matrix(dual_to_range, domain, fname, operator, wavenumber=None): @@ -53,7 +53,7 @@ def generate_potential(domain, fname, operator, wavenumber=None): points = 2.5 * np.ones((3, 1), dtype="float64") + rand.rand(3, npoints) vec = np.random.rand(domain.global_dof_count) - fun = bempp.api.GridFunction(domain, coefficients=vec) + fun = bempp_cl.api.GridFunction(domain, coefficients=vec) if wavenumber is None: pot = operator(domain, points) @@ -76,7 +76,7 @@ def generate_far_field(domain, fname, operator, wavenumber=None): points /= np.linalg.norm(points, axis=0) vec = np.random.rand(domain.global_dof_count) - fun = bempp.api.GridFunction(domain, coefficients=vec) + fun = bempp_cl.api.GridFunction(domain, coefficients=vec) if wavenumber is None: pot = operator(domain, points) @@ -89,7 +89,7 @@ def generate_far_field(domain, fname, operator, wavenumber=None): np.savez(fname, result=result, points=points, vec=vec) -parameters = bempp.api.global_parameters +parameters = bempp_cl.api.global_parameters parameters.assembly.boundary_operator_assembly_type = "dense" parameters.assembly.potential_operator_assembly_type = "dense" @@ -108,29 +108,29 @@ def generate_far_field(domain, fname, operator, wavenumber=None): parameters.quadrature.double_singular = singular_order -grid_structured = bempp.api.import_grid("structured_grid.msh") -rwg_structured = bempp.api.function_space(grid_structured, "RWG", 0) -snc_structured = bempp.api.function_space(grid_structured, "SNC", 0) +grid_structured = bempp_cl.api.import_grid("structured_grid.msh") +rwg_structured = bempp_cl.api.function_space(grid_structured, "RWG", 0) +snc_structured = bempp_cl.api.function_space(grid_structured, "SNC", 0) generate_bem_matrix( snc_structured, rwg_structured, "maxwell_electric_field_structured_boundary", - bempp.api.operators.boundary.maxwell.electric_field, + bempp_cl.api.operators.boundary.maxwell.electric_field, wavenumber, ) -grid = bempp.api.import_grid("sphere.msh") +grid = bempp_cl.api.import_grid("sphere.msh") -p0 = bempp.api.function_space(grid, "DP", 0) -dp1 = bempp.api.function_space(grid, "DP", 1) -p1 = bempp.api.function_space(grid, "P", 1) -rwg = bempp.api.function_space(grid, "RWG", 0) -brwg = bempp.api.function_space(grid, "B-RWG", 0) -snc = bempp.api.function_space(grid, "SNC", 0) -bsnc = bempp.api.function_space(grid, "B-SNC", 0) -bc = bempp.api.function_space(grid, "BC", 0) -rbc = bempp.api.function_space(grid, "RBC", 0) +p0 = bempp_cl.api.function_space(grid, "DP", 0) +dp1 = bempp_cl.api.function_space(grid, "DP", 1) +p1 = bempp_cl.api.function_space(grid, "P", 1) +rwg = bempp_cl.api.function_space(grid, "RWG", 0) +brwg = bempp_cl.api.function_space(grid, "B-RWG", 0) +snc = bempp_cl.api.function_space(grid, "SNC", 0) +bsnc = bempp_cl.api.function_space(grid, "B-SNC", 0) +bc = bempp_cl.api.function_space(grid, "BC", 0) +rbc = bempp_cl.api.function_space(grid, "RBC", 0) print("Generating Laplace BEM matrices.") @@ -138,54 +138,54 @@ def generate_far_field(domain, fname, operator, wavenumber=None): p0, p0, "laplace_single_layer_boundary_p0_p0", - bempp.api.operators.boundary.laplace.single_layer, + bempp_cl.api.operators.boundary.laplace.single_layer, ) generate_bem_matrix( p0, dp1, "laplace_single_layer_boundary_p0_dp1", - bempp.api.operators.boundary.laplace.single_layer, + bempp_cl.api.operators.boundary.laplace.single_layer, ) generate_bem_matrix( dp1, p0, "laplace_single_layer_boundary_dp1_p0", - bempp.api.operators.boundary.laplace.single_layer, + bempp_cl.api.operators.boundary.laplace.single_layer, ) generate_bem_matrix( dp1, dp1, "laplace_single_layer_boundary_dp1_dp1", - bempp.api.operators.boundary.laplace.single_layer, + bempp_cl.api.operators.boundary.laplace.single_layer, ) generate_bem_matrix( p1, p1, "laplace_single_layer_boundary_p1_p1", - bempp.api.operators.boundary.laplace.single_layer, + bempp_cl.api.operators.boundary.laplace.single_layer, ) generate_bem_matrix( p1, p1, "laplace_double_layer_boundary", - bempp.api.operators.boundary.laplace.double_layer, + bempp_cl.api.operators.boundary.laplace.double_layer, ) generate_bem_matrix( p1, p1, "laplace_adj_double_layer_boundary", - bempp.api.operators.boundary.laplace.adjoint_double_layer, + bempp_cl.api.operators.boundary.laplace.adjoint_double_layer, ) generate_bem_matrix( p1, p1, "laplace_hypersingular_boundary", - bempp.api.operators.boundary.laplace.hypersingular, + bempp_cl.api.operators.boundary.laplace.hypersingular, ) ################################ @@ -196,7 +196,7 @@ def generate_far_field(domain, fname, operator, wavenumber=None): p0, p0, "helmholtz_single_layer_boundary_p0_p0", - bempp.api.operators.boundary.helmholtz.single_layer, + bempp_cl.api.operators.boundary.helmholtz.single_layer, wavenumber, ) @@ -204,7 +204,7 @@ def generate_far_field(domain, fname, operator, wavenumber=None): p0, dp1, "helmholtz_single_layer_boundary_p0_dp1", - bempp.api.operators.boundary.helmholtz.single_layer, + bempp_cl.api.operators.boundary.helmholtz.single_layer, wavenumber, ) @@ -212,21 +212,21 @@ def generate_far_field(domain, fname, operator, wavenumber=None): dp1, p0, "helmholtz_single_layer_boundary_dp1_p0", - bempp.api.operators.boundary.helmholtz.single_layer, + bempp_cl.api.operators.boundary.helmholtz.single_layer, wavenumber, ) generate_bem_matrix( dp1, dp1, "helmholtz_single_layer_boundary_dp1_dp1", - bempp.api.operators.boundary.helmholtz.single_layer, + bempp_cl.api.operators.boundary.helmholtz.single_layer, wavenumber, ) generate_bem_matrix( p1, p1, "helmholtz_single_layer_boundary_p1_p1", - bempp.api.operators.boundary.helmholtz.single_layer, + bempp_cl.api.operators.boundary.helmholtz.single_layer, wavenumber, ) @@ -234,7 +234,7 @@ def generate_far_field(domain, fname, operator, wavenumber=None): p1, p1, "helmholtz_double_layer_boundary", - bempp.api.operators.boundary.helmholtz.double_layer, + bempp_cl.api.operators.boundary.helmholtz.double_layer, wavenumber, ) @@ -242,7 +242,7 @@ def generate_far_field(domain, fname, operator, wavenumber=None): p1, p1, "helmholtz_adj_double_layer_boundary", - bempp.api.operators.boundary.helmholtz.adjoint_double_layer, + bempp_cl.api.operators.boundary.helmholtz.adjoint_double_layer, wavenumber, ) @@ -250,7 +250,7 @@ def generate_far_field(domain, fname, operator, wavenumber=None): p1, p1, "helmholtz_hypersingular_boundary", - bempp.api.operators.boundary.helmholtz.hypersingular, + bempp_cl.api.operators.boundary.helmholtz.hypersingular, wavenumber, ) @@ -258,7 +258,7 @@ def generate_far_field(domain, fname, operator, wavenumber=None): p1, p1, "helmholtz_complex_single_layer_boundary", - bempp.api.operators.boundary.helmholtz.single_layer, + bempp_cl.api.operators.boundary.helmholtz.single_layer, wavenumber_complex, ) @@ -266,14 +266,14 @@ def generate_far_field(domain, fname, operator, wavenumber=None): p1, p1, "helmholtz_complex_double_layer_boundary", - bempp.api.operators.boundary.helmholtz.double_layer, + bempp_cl.api.operators.boundary.helmholtz.double_layer, wavenumber_complex, ) generate_bem_matrix( p1, p1, "helmholtz_complex_adj_double_layer_boundary", - bempp.api.operators.boundary.helmholtz.adjoint_double_layer, + bempp_cl.api.operators.boundary.helmholtz.adjoint_double_layer, wavenumber_complex, ) @@ -281,7 +281,7 @@ def generate_far_field(domain, fname, operator, wavenumber=None): p1, p1, "helmholtz_complex_hypersingular_boundary", - bempp.api.operators.boundary.helmholtz.hypersingular, + bempp_cl.api.operators.boundary.helmholtz.hypersingular, wavenumber_complex, ) @@ -295,7 +295,7 @@ def generate_far_field(domain, fname, operator, wavenumber=None): p1, p1, "modified_helmholtz_single_layer_boundary", - bempp.api.operators.boundary.modified_helmholtz.single_layer, + bempp_cl.api.operators.boundary.modified_helmholtz.single_layer, omega, ) @@ -303,14 +303,14 @@ def generate_far_field(domain, fname, operator, wavenumber=None): p1, p1, "modified_helmholtz_double_layer_boundary", - bempp.api.operators.boundary.modified_helmholtz.double_layer, + bempp_cl.api.operators.boundary.modified_helmholtz.double_layer, omega, ) generate_bem_matrix( p1, p1, "modified_helmholtz_adj_double_layer_boundary", - bempp.api.operators.boundary.modified_helmholtz.adjoint_double_layer, + bempp_cl.api.operators.boundary.modified_helmholtz.adjoint_double_layer, omega, ) @@ -318,7 +318,7 @@ def generate_far_field(domain, fname, operator, wavenumber=None): p1, p1, "modified_helmholtz_hypersingular_boundary", - bempp.api.operators.boundary.modified_helmholtz.hypersingular, + bempp_cl.api.operators.boundary.modified_helmholtz.hypersingular, omega, ) @@ -330,7 +330,7 @@ def generate_far_field(domain, fname, operator, wavenumber=None): snc, rwg, "maxwell_electric_field_boundary", - bempp.api.operators.boundary.maxwell.electric_field, + bempp_cl.api.operators.boundary.maxwell.electric_field, wavenumber, ) @@ -338,7 +338,7 @@ def generate_far_field(domain, fname, operator, wavenumber=None): bsnc, bc, "maxwell_electric_field_boundary_bc", - bempp.api.operators.boundary.maxwell.electric_field, + bempp_cl.api.operators.boundary.maxwell.electric_field, wavenumber, ) @@ -346,7 +346,7 @@ def generate_far_field(domain, fname, operator, wavenumber=None): rbc, bc, "maxwell_electric_field_boundary_rbc_bc", - bempp.api.operators.boundary.maxwell.electric_field, + bempp_cl.api.operators.boundary.maxwell.electric_field, wavenumber, ) @@ -354,7 +354,7 @@ def generate_far_field(domain, fname, operator, wavenumber=None): snc, rwg, "maxwell_magnetic_field_boundary", - bempp.api.operators.boundary.maxwell.magnetic_field, + bempp_cl.api.operators.boundary.maxwell.magnetic_field, wavenumber, ) @@ -362,7 +362,7 @@ def generate_far_field(domain, fname, operator, wavenumber=None): snc, rwg, "maxwell_electric_field_complex_boundary", - bempp.api.operators.boundary.maxwell.electric_field, + bempp_cl.api.operators.boundary.maxwell.electric_field, wavenumber_complex, ) @@ -370,107 +370,107 @@ def generate_far_field(domain, fname, operator, wavenumber=None): snc, rwg, "maxwell_magnetic_field_complex_boundary", - bempp.api.operators.boundary.maxwell.magnetic_field, + bempp_cl.api.operators.boundary.maxwell.magnetic_field, wavenumber_complex, ) generate_sparse_bem_matrix( - p0, p0, "sparse_identity_p0_p0", bempp.api.operators.boundary.sparse.identity + p0, p0, "sparse_identity_p0_p0", bempp_cl.api.operators.boundary.sparse.identity ) generate_sparse_bem_matrix( - p1, p1, "sparse_identity_p1_p1", bempp.api.operators.boundary.sparse.identity + p1, p1, "sparse_identity_p1_p1", bempp_cl.api.operators.boundary.sparse.identity ) generate_sparse_bem_matrix( - p0, p1, "sparse_identity_p0_p1", bempp.api.operators.boundary.sparse.identity + p0, p1, "sparse_identity_p0_p1", bempp_cl.api.operators.boundary.sparse.identity ) generate_sparse_bem_matrix( - p1, p0, "sparse_identity_p1_p0", bempp.api.operators.boundary.sparse.identity + p1, p0, "sparse_identity_p1_p0", bempp_cl.api.operators.boundary.sparse.identity ) generate_sparse_bem_matrix( - snc, rwg, "sparse_identity_snc_rwg", bempp.api.operators.boundary.sparse.identity + snc, rwg, "sparse_identity_snc_rwg", bempp_cl.api.operators.boundary.sparse.identity ) generate_sparse_bem_matrix( - bsnc, bc, "sparse_identity_snc_bc", bempp.api.operators.boundary.sparse.identity + bsnc, bc, "sparse_identity_snc_bc", bempp_cl.api.operators.boundary.sparse.identity ) generate_potential( p0, "laplace_single_layer_potential_p0", - bempp.api.operators.potential.laplace.single_layer, + bempp_cl.api.operators.potential.laplace.single_layer, ) generate_potential( p1, "laplace_single_layer_potential_p1", - bempp.api.operators.potential.laplace.single_layer, + bempp_cl.api.operators.potential.laplace.single_layer, ) generate_potential( p1, "laplace_double_layer_potential_p1", - bempp.api.operators.potential.laplace.double_layer, + bempp_cl.api.operators.potential.laplace.double_layer, ) generate_potential( p1, "helmholtz_single_layer_potential_p1", - bempp.api.operators.potential.helmholtz.single_layer, + bempp_cl.api.operators.potential.helmholtz.single_layer, wavenumber, ) generate_potential( p1, "helmholtz_double_layer_potential_p1", - bempp.api.operators.potential.helmholtz.double_layer, + bempp_cl.api.operators.potential.helmholtz.double_layer, wavenumber, ) generate_potential( p1, "helmholtz_single_layer_potential_complex_p1", - bempp.api.operators.potential.helmholtz.single_layer, + bempp_cl.api.operators.potential.helmholtz.single_layer, wavenumber_complex, ) generate_potential( p1, "helmholtz_double_layer_potential_complex_p1", - bempp.api.operators.potential.helmholtz.double_layer, + bempp_cl.api.operators.potential.helmholtz.double_layer, wavenumber_complex, ) generate_potential( rwg, "maxwell_electric_field_potential", - bempp.api.operators.potential.maxwell.electric_field, + bempp_cl.api.operators.potential.maxwell.electric_field, wavenumber, ) generate_potential( bc, "maxwell_electric_field_potential_bc", - bempp.api.operators.potential.maxwell.electric_field, + bempp_cl.api.operators.potential.maxwell.electric_field, wavenumber, ) generate_potential( rwg, "maxwell_electric_field_potential_complex", - bempp.api.operators.potential.maxwell.electric_field, + bempp_cl.api.operators.potential.maxwell.electric_field, wavenumber_complex, ) generate_potential( rwg, "maxwell_magnetic_field_potential", - bempp.api.operators.potential.maxwell.magnetic_field, + bempp_cl.api.operators.potential.maxwell.magnetic_field, wavenumber, ) generate_potential( rwg, "maxwell_magnetic_field_potential_complex", - bempp.api.operators.potential.maxwell.magnetic_field, + bempp_cl.api.operators.potential.maxwell.magnetic_field, wavenumber_complex, ) @@ -479,53 +479,53 @@ def generate_far_field(domain, fname, operator, wavenumber=None): generate_far_field( p1, "helmholtz_single_layer_far_field_p1", - bempp.api.operators.far_field.helmholtz.single_layer, + bempp_cl.api.operators.far_field.helmholtz.single_layer, wavenumber, ) generate_far_field( p1, "helmholtz_double_layer_far_field_p1", - bempp.api.operators.far_field.helmholtz.double_layer, + bempp_cl.api.operators.far_field.helmholtz.double_layer, wavenumber, ) generate_far_field( p1, "helmholtz_single_layer_far_field_complex_p1", - bempp.api.operators.far_field.helmholtz.single_layer, + bempp_cl.api.operators.far_field.helmholtz.single_layer, wavenumber_complex, ) generate_far_field( p1, "helmholtz_double_layer_far_field_complex_p1", - bempp.api.operators.far_field.helmholtz.double_layer, + bempp_cl.api.operators.far_field.helmholtz.double_layer, wavenumber_complex, ) generate_far_field( rwg, "maxwell_electric_far_field", - bempp.api.operators.far_field.maxwell.electric_field, + bempp_cl.api.operators.far_field.maxwell.electric_field, wavenumber, ) generate_far_field( rwg, "maxwell_electric_far_field_complex", - bempp.api.operators.far_field.maxwell.electric_field, + bempp_cl.api.operators.far_field.maxwell.electric_field, wavenumber_complex, ) generate_far_field( rwg, "maxwell_magnetic_far_field", - bempp.api.operators.far_field.maxwell.magnetic_field, + bempp_cl.api.operators.far_field.maxwell.magnetic_field, wavenumber, ) generate_far_field( rwg, "maxwell_magnetic_far_field_complex", - bempp.api.operators.far_field.maxwell.magnetic_field, + bempp_cl.api.operators.far_field.maxwell.magnetic_field, wavenumber_complex, ) diff --git a/test/unit/external/test_fenics.py b/test/unit/external/test_fenics.py index 1f0ed1f4..8215b73e 100644 --- a/test/unit/external/test_fenics.py +++ b/test/unit/external/test_fenics.py @@ -13,8 +13,8 @@ def test_p1_trace(has_dolfin): import dolfin except ImportError: pytest.skip("DOLFIN must be installed to run this test") - import bempp.api - from bempp.api.external.fenics import fenics_to_bempp_trace_data + import bempp_cl.api + from bempp_cl.api.external.fenics import fenics_to_bempp_trace_data fenics_mesh = dolfin.UnitCubeMesh(2, 2, 2) fenics_space = dolfin.FunctionSpace(fenics_mesh, "CG", 1) @@ -26,7 +26,7 @@ def test_p1_trace(has_dolfin): fenics_fun = dolfin.Function(fenics_space) fenics_fun.vector()[:] = fenics_coeffs - bempp_fun = bempp.api.GridFunction(bempp_space, coefficients=bempp_coeffs) + bempp_fun = bempp_cl.api.GridFunction(bempp_space, coefficients=bempp_coeffs) for cell in bempp_space.grid.entity_iterator(0): mid = cell.geometry.centroid @@ -47,8 +47,8 @@ def test_nc1_trace(has_dolfin): import dolfin except ImportError: pytest.skip("DOLFIN must be installed to run this test") - import bempp.api - from bempp.api.external.fenics import fenics_to_bempp_trace_data + import bempp_cl.api + from bempp_cl.api.external.fenics import fenics_to_bempp_trace_data fenics_mesh = dolfin.UnitCubeMesh(2, 2, 2) fenics_space = dolfin.FunctionSpace(fenics_mesh, "N1curl", 1) @@ -60,7 +60,7 @@ def test_nc1_trace(has_dolfin): fenics_fun = dolfin.Function(fenics_space) fenics_fun.vector()[:] = fenics_coeffs - bempp_fun = bempp.api.GridFunction(bempp_space, coefficients=bempp_coeffs) + bempp_fun = bempp_cl.api.GridFunction(bempp_space, coefficients=bempp_coeffs) for cell in bempp_space.grid.entity_iterator(0): mid = cell.geometry.centroid diff --git a/test/unit/external/test_fenicsx.py b/test/unit/external/test_fenicsx.py index 530dc499..3fceb2cc 100644 --- a/test/unit/external/test_fenicsx.py +++ b/test/unit/external/test_fenicsx.py @@ -2,8 +2,8 @@ import pytest import numpy as np -import bempp.api -from bempp.api.external.fenicsx import fenics_to_bempp_trace_data, FenicsOperator +import bempp_cl.api +from bempp_cl.api.external.fenicsx import fenics_to_bempp_trace_data, FenicsOperator def test_p1_trace(has_dolfinx): @@ -26,7 +26,7 @@ def test_p1_trace(has_dolfinx): fenics_fun = dolfinx.fem.Function(fenics_space) fenics_fun.x.array[:] = fenics_coeffs - bempp_fun = bempp.api.GridFunction(bempp_space, coefficients=bempp_coeffs) + bempp_fun = bempp_cl.api.GridFunction(bempp_space, coefficients=bempp_coeffs) try: tree = dolfinx.geometry.bb_tree(fenics_mesh, 3) diff --git a/test/unit/fmm/test_unit_fmm.py b/test/unit/fmm/test_unit_fmm.py index c835069d..9f3a2691 100644 --- a/test/unit/fmm/test_unit_fmm.py +++ b/test/unit/fmm/test_unit_fmm.py @@ -2,9 +2,9 @@ import numpy as np import pytest -import bempp.api -from bempp.api import function_space, check_for_fmm -from bempp.api.operators.boundary import laplace, helmholtz +import bempp_cl.api +from bempp_cl.api import function_space, check_for_fmm +from bempp_cl.api.operators.boundary import laplace, helmholtz def test_laplace_single_layer(has_exafmm): @@ -12,19 +12,19 @@ def test_laplace_single_layer(has_exafmm): if not has_exafmm and not check_for_fmm(): pytest.skip("ExaFMM must be installed to run this test.") - grid = bempp.api.shapes.regular_sphere(2) + grid = bempp_cl.api.shapes.regular_sphere(2) space = function_space(grid, "DP", 0) op1 = laplace.single_layer(space, space, space, assembler="dense") op2 = laplace.single_layer(space, space, space, assembler="fmm") - fun = bempp.api.GridFunction( + fun = bempp_cl.api.GridFunction( space, coefficients=np.random.rand(space.global_dof_count) ) assert np.allclose((op1 * fun).coefficients, (op2 * fun).coefficients) - bempp.api.clear_fmm_cache() + bempp_cl.api.clear_fmm_cache() @pytest.mark.parametrize("wavenumber", [2.5]) # , 2.5 + 1j]) @@ -33,16 +33,16 @@ def test_helmholtz_single_layer(has_exafmm, wavenumber): if not has_exafmm and not check_for_fmm(): pytest.skip("ExaFMM must be installed to run this test.") - grid = bempp.api.shapes.regular_sphere(2) + grid = bempp_cl.api.shapes.regular_sphere(2) space = function_space(grid, "DP", 0) op1 = helmholtz.single_layer(space, space, space, wavenumber, assembler="dense") op2 = helmholtz.single_layer(space, space, space, wavenumber, assembler="fmm") - fun = bempp.api.GridFunction( + fun = bempp_cl.api.GridFunction( space, coefficients=np.random.rand(space.global_dof_count) ) assert np.allclose((op1 * fun).coefficients, (op2 * fun).coefficients) - bempp.api.clear_fmm_cache() + bempp_cl.api.clear_fmm_cache() diff --git a/test/unit/grid/test_grid.py b/test/unit/grid/test_grid.py index fdfca8de..f7f18508 100644 --- a/test/unit/grid/test_grid.py +++ b/test/unit/grid/test_grid.py @@ -3,7 +3,7 @@ # pylint: disable=redefined-outer-name import numpy as np -import bempp.api +import bempp_cl.api import pytest @@ -45,9 +45,9 @@ def test_as_array(two_element_grid): def test_edge_adjacency(): """Check edge connectivity information for a small sphere.""" # pylint: disable=too-many-locals - from bempp.api.grid.grid import get_element_to_element_matrix + from bempp_cl.api.grid.grid import get_element_to_element_matrix - small_sphere = bempp.api.shapes.regular_sphere(3) + small_sphere = bempp_cl.api.shapes.regular_sphere(3) edge_adjacency = small_sphere.edge_adjacency @@ -78,9 +78,9 @@ def test_edge_adjacency(): def test_vertex_adjacency(): """Check vertex connectivity information for a small sphere.""" # pylint: disable=too-many-locals - from bempp.api.grid.grid import get_element_to_element_matrix + from bempp_cl.api.grid.grid import get_element_to_element_matrix - small_sphere = bempp.api.shapes.regular_sphere(3) + small_sphere = bempp_cl.api.shapes.regular_sphere(3) vertex_adjacency = small_sphere.vertex_adjacency @@ -123,40 +123,40 @@ def test_integration_element(two_element_geometries): def test_union_two_grids_one_domain_each(two_element_grid): """Test union of two grids, each with one domain.""" - two_element_grid_2 = bempp.api.grid.Grid(two_element_grid.vertices, two_element_grid.elements) + two_element_grid_2 = bempp_cl.api.grid.Grid(two_element_grid.vertices, two_element_grid.elements) np.testing.assert_array_equal( - bempp.api.grid.union([two_element_grid, two_element_grid_2]).domain_indices, + bempp_cl.api.grid.union([two_element_grid, two_element_grid_2]).domain_indices, np.array([0 , 0, 1, 1], dtype="uint32")) def test_union_two_grids_two_domains_each(two_element_grid): """Test union of two grids, each with two domains.""" - two_element_grid = bempp.api.grid.Grid(two_element_grid.vertices, two_element_grid.elements, domain_indices=[0, 1]) - two_element_grid_2 = bempp.api.grid.Grid( + two_element_grid = bempp_cl.api.grid.Grid(two_element_grid.vertices, two_element_grid.elements, domain_indices=[0, 1]) + two_element_grid_2 = bempp_cl.api.grid.Grid( two_element_grid.vertices, two_element_grid.elements, domain_indices=[0, 1]) np.testing.assert_array_equal( - bempp.api.grid.union([two_element_grid, two_element_grid_2]).domain_indices, + bempp_cl.api.grid.union([two_element_grid, two_element_grid_2]).domain_indices, np.array([0, 1, 2, 3], dtype="uint32")) def test_union_two_grids_two_domains_each_unnormalized(two_element_grid): """Test union of two grids, each with two domains, and without domain index normalization.""" - two_element_grid = bempp.api.grid.Grid(two_element_grid.vertices, two_element_grid.elements, domain_indices=[0, 2]) - two_element_grid_2 = bempp.api.grid.Grid( + two_element_grid = bempp_cl.api.grid.Grid(two_element_grid.vertices, two_element_grid.elements, domain_indices=[0, 2]) + two_element_grid_2 = bempp_cl.api.grid.Grid( two_element_grid.vertices, two_element_grid.elements, domain_indices=[0, 3]) np.testing.assert_array_equal( - bempp.api.grid.union([two_element_grid, two_element_grid_2], normalize_domain_indices=False).domain_indices, + bempp_cl.api.grid.union([two_element_grid, two_element_grid_2], normalize_domain_indices=False).domain_indices, np.array([0, 2, 3, 6], dtype="uint32")) def test_union_two_grids_two_domains_each_normalized(two_element_grid): """Test union of two grids, each with two domains, and with domain index normalization.""" - two_element_grid = bempp.api.grid.Grid(two_element_grid.vertices, two_element_grid.elements, domain_indices=[0, 2]) - two_element_grid_2 = bempp.api.grid.Grid( + two_element_grid = bempp_cl.api.grid.Grid(two_element_grid.vertices, two_element_grid.elements, domain_indices=[0, 2]) + two_element_grid_2 = bempp_cl.api.grid.Grid( two_element_grid.vertices, two_element_grid.elements, domain_indices=[0, 3]) np.testing.assert_array_equal( - bempp.api.grid.union([two_element_grid, two_element_grid_2], normalize_domain_indices=True).domain_indices, + bempp_cl.api.grid.union([two_element_grid, two_element_grid_2], normalize_domain_indices=True).domain_indices, np.array([0, 1, 2, 3], dtype="uint32")) diff --git a/test/unit/grid/test_grid_function.py b/test/unit/grid/test_grid_function.py index e3d91a18..c63de964 100644 --- a/test/unit/grid/test_grid_function.py +++ b/test/unit/grid/test_grid_function.py @@ -1,29 +1,29 @@ import numpy as np from math import sqrt -import bempp.api +import bempp_cl.api def test_interpolation_real_callable(): - @bempp.api.real_callable + @bempp_cl.api.real_callable def f(x, n, d, r): r[:] = x[0] - grid = bempp.api.shapes.cube(h=0.5) - space = bempp.api.function_space(grid, "P", 1) - fun = bempp.api.GridFunction(space, fun=f) + grid = bempp_cl.api.shapes.cube(h=0.5) + space = bempp_cl.api.function_space(grid, "P", 1) + fun = bempp_cl.api.GridFunction(space, fun=f) assert np.isclose(fun.l2_norm(), sqrt(7 / 3)) def test_interpolation_complex_callable(): - @bempp.api.complex_callable + @bempp_cl.api.complex_callable def f(x, n, d, r): r[:] = x[0] + 1j * x[0] - grid = bempp.api.shapes.cube(h=0.5) - space = bempp.api.function_space(grid, "P", 1) - fun = bempp.api.GridFunction(space, fun=f) + grid = bempp_cl.api.shapes.cube(h=0.5) + space = bempp_cl.api.function_space(grid, "P", 1) + fun = bempp_cl.api.GridFunction(space, fun=f) assert np.isclose(fun.l2_norm(), sqrt(14 / 3)) @@ -32,25 +32,25 @@ def test_interpolation_python_callable(): # This array can't be assembled by Numba, so jit cannot be used parameters = [1, None, 1.0] - @bempp.api.complex_callable(jit=False) + @bempp_cl.api.complex_callable(jit=False) def f(x, n, d, r): r[:] = x[0] * parameters[0] + 1j * x[1] * parameters[2] - grid = bempp.api.shapes.cube(h=0.5) - space = bempp.api.function_space(grid, "P", 1) - fun = bempp.api.GridFunction(space, fun=f) + grid = bempp_cl.api.shapes.cube(h=0.5) + space = bempp_cl.api.function_space(grid, "P", 1) + fun = bempp_cl.api.GridFunction(space, fun=f) assert np.isclose(fun.l2_norm(), sqrt(14 / 3)) def test_vectorized_assembly(): """Test vectorized assembly of grid functions.""" - from bempp.api.integration.triangle_gauss import rule - from bempp.api.assembly.grid_function import get_function_quadrature_information + from bempp_cl.api.integration.triangle_gauss import rule + from bempp_cl.api.assembly.grid_function import get_function_quadrature_information - grid = bempp.api.shapes.cube() + grid = bempp_cl.api.shapes.cube() - p1_space = bempp.api.function_space( + p1_space = bempp_cl.api.function_space( grid, "P", 1, segments=[1, 2], swapped_normals=[1] ) @@ -87,18 +87,18 @@ def test_vectorized_assembly(): == grid_data.domain_indices[element] ) - @bempp.api.callable(complex=True) + @bempp_cl.api.callable(complex=True) def fun_non_vec(x, n, d, res): res[0] = np.dot(n, direction) * 1j * k * np.exp(1j * k * np.dot(x, direction)) - @bempp.api.callable(complex=True, vectorized=True) + @bempp_cl.api.callable(complex=True, vectorized=True) def fun_vec(x, n, d, res): res[0, :] = ( np.dot(direction, n) * 1j * k * np.exp(1j * k * np.dot(direction, x)) ) - grid_fun_non_vec = bempp.api.GridFunction(p1_space, fun=fun_non_vec) - grid_fun_vec = bempp.api.GridFunction(p1_space, fun=fun_vec) + grid_fun_non_vec = bempp_cl.api.GridFunction(p1_space, fun=fun_non_vec) + grid_fun_vec = bempp_cl.api.GridFunction(p1_space, fun=fun_vec) rel_diff = np.abs( grid_fun_non_vec.projections() - grid_fun_vec.projections() diff --git a/test/unit/grid/test_grid_io.py b/test/unit/grid/test_grid_io.py index e733ff0d..030c4e3e 100644 --- a/test/unit/grid/test_grid_io.py +++ b/test/unit/grid/test_grid_io.py @@ -2,7 +2,7 @@ import os import pytest -import bempp.api +import bempp_cl.api @pytest.fixture @@ -13,11 +13,11 @@ def folder(): @pytest.mark.parametrize("filename", ["sphere.msh"]) def test_import(filename, folder): """Return geometries of two element grid.""" - bempp.api.grid.io.import_grid(os.path.join(folder, filename)) + bempp_cl.api.grid.io.import_grid(os.path.join(folder, filename)) @pytest.mark.parametrize("filename", ["testoutput_cube.msh", "testoutput_cube.vtk"]) def test_export(filename, folder): """Return geometries of two element grid.""" - grid = bempp.api.shapes.cube(h=0.5) - bempp.api.export(os.path.join(folder, filename), grid=grid) + grid = bempp_cl.api.shapes.cube(h=0.5) + bempp_cl.api.export(os.path.join(folder, filename), grid=grid) diff --git a/test/unit/grid/test_shapes.py b/test/unit/grid/test_shapes.py index dfe65a24..0040b143 100644 --- a/test/unit/grid/test_shapes.py +++ b/test/unit/grid/test_shapes.py @@ -1,6 +1,6 @@ import pytest import numpy as np -import bempp.api +import bempp_cl.api @pytest.mark.parametrize( @@ -21,4 +21,4 @@ ], ) def test_shape(gridname, args, kwargs): - getattr(bempp.api.shapes, gridname)(*args, **kwargs) + getattr(bempp_cl.api.shapes, gridname)(*args, **kwargs) diff --git a/test/unit/integration/test_duffy.py b/test/unit/integration/test_duffy.py index d107582b..1945b317 100644 --- a/test/unit/integration/test_duffy.py +++ b/test/unit/integration/test_duffy.py @@ -1,5 +1,5 @@ """Test routines related to duffy rules.""" -from bempp.api.integration import duffy_galerkin as _duffy +from bempp_cl.api.integration import duffy_galerkin as _duffy _order = 6 diff --git a/test/unit/metadata/test_version_number.py b/test/unit/metadata/test_version_number.py index b2008031..2294fbb0 100644 --- a/test/unit/metadata/test_version_number.py +++ b/test/unit/metadata/test_version_number.py @@ -1,7 +1,7 @@ import pytest import os import json -import bempp +import bempp_cl def joinall(*ls): @@ -25,6 +25,6 @@ def test_version_number_consistency(): if v2.startswith("v"): v2 = v2[1:] - v3 = bempp.__version__ + v3 = bempp_cl.__version__ assert v1 == v2 == v3 diff --git a/test/unit/operators/test_blocked_operators.py b/test/unit/operators/test_blocked_operators.py index fb52fab4..e18d6eab 100644 --- a/test/unit/operators/test_blocked_operators.py +++ b/test/unit/operators/test_blocked_operators.py @@ -1,15 +1,15 @@ import pytest -import bempp.api +import bempp_cl.api import numpy as np -from bempp.api.operators.boundary import laplace -from bempp.api.assembly.blocked_operator import BlockedOperator, BlockedDiscreteOperator +from bempp_cl.api.operators.boundary import laplace +from bempp_cl.api.assembly.blocked_operator import BlockedOperator, BlockedDiscreteOperator from scipy.sparse.linalg.interface import LinearOperator @pytest.mark.parametrize("cols", range(4)) def test_blocked_matvec(cols): - grid = bempp.api.shapes.sphere(h=1) - space = bempp.api.function_space(grid, "P", 1) + grid = bempp_cl.api.shapes.sphere(h=1) + space = bempp_cl.api.function_space(grid, "P", 1) ndofs = space.global_dof_count @@ -36,8 +36,8 @@ def test_blocked_matvec(cols): @pytest.mark.parametrize("cols", range(4)) def test_blocked_matvec_linear_operator(cols): - grid = bempp.api.shapes.sphere(h=1) - space = bempp.api.function_space(grid, "P", 1) + grid = bempp_cl.api.shapes.sphere(h=1) + space = bempp_cl.api.function_space(grid, "P", 1) ndofs = space.global_dof_count @@ -62,8 +62,8 @@ def test_blocked_matvec_linear_operator(cols): def test_blocked_matvec_only_linear_operator(): - grid = bempp.api.shapes.sphere(h=1) - space = bempp.api.function_space(grid, "P", 1) + grid = bempp_cl.api.shapes.sphere(h=1) + space = bempp_cl.api.function_space(grid, "P", 1) ndofs = space.global_dof_count diff --git a/test/unit/operators/test_boundary_operators.py b/test/unit/operators/test_boundary_operators.py index f68d8adf..b52ab1ad 100644 --- a/test/unit/operators/test_boundary_operators.py +++ b/test/unit/operators/test_boundary_operators.py @@ -1,9 +1,9 @@ """Unit tests for the dense assembler.""" import pytest -import bempp.api -from bempp.api import function_space -from bempp.api.operators.boundary import ( +import bempp_cl.api +from bempp_cl.api import function_space +from bempp_cl.api.operators.boundary import ( laplace, helmholtz, modified_helmholtz, @@ -21,7 +21,7 @@ @pytest.mark.parametrize("type1", scalar_spaces) def test_sparse_operators(operator, type0, type1): """Test dense assembler for the Laplace operators.""" - grid = bempp.api.shapes.regular_sphere(0) + grid = bempp_cl.api.shapes.regular_sphere(0) space0 = function_space(grid, *type0) space1 = function_space(grid, *type1) @@ -34,7 +34,7 @@ def test_sparse_operators(operator, type0, type1): @pytest.mark.parametrize("type1", curl_spaces) def test_maxwell_sparse_operators(operator, type0, type1): """Test dense assembler for the Laplace operators.""" - grid = bempp.api.shapes.regular_sphere(0) + grid = bempp_cl.api.shapes.regular_sphere(0) space0 = function_space(grid, *type0) space1 = function_space(grid, *type1) @@ -50,7 +50,7 @@ def test_maxwell_sparse_operators(operator, type0, type1): @pytest.mark.parametrize("type1", scalar_spaces) def test_laplace_operators(operator, type0, type1): """Test dense assembler for the Laplace operators.""" - grid = bempp.api.shapes.regular_sphere(0) + grid = bempp_cl.api.shapes.regular_sphere(0) space0 = function_space(grid, *type0) space1 = function_space(grid, *type1) @@ -67,7 +67,7 @@ def test_laplace_operators(operator, type0, type1): @pytest.mark.parametrize("type1", scalar_spaces) def test_helmholtz_operators(operator, wavenumber, type0, type1): """Test dense assembler for the Helmholtz operators.""" - grid = bempp.api.shapes.regular_sphere(0) + grid = bempp_cl.api.shapes.regular_sphere(0) space0 = function_space(grid, *type0) space1 = function_space(grid, *type1) @@ -88,7 +88,7 @@ def test_helmholtz_operators(operator, wavenumber, type0, type1): @pytest.mark.parametrize("type1", scalar_spaces) def test_modified_helmholtz_operators(operator, wavenumber, type0, type1): """Test dense assembler for the modified Helmholtz operators.""" - grid = bempp.api.shapes.regular_sphere(0) + grid = bempp_cl.api.shapes.regular_sphere(0) space0 = function_space(grid, *type0) space1 = function_space(grid, *type1) @@ -99,17 +99,17 @@ def test_modified_helmholtz_operators(operator, wavenumber, type0, type1): def test_hypersingular_operators(): """Test the hypersingular operators.""" - grid = bempp.api.shapes.regular_sphere(0) + grid = bempp_cl.api.shapes.regular_sphere(0) space = function_space(grid, "P", 1) - bempp.api.operators.boundary.laplace.hypersingular( + bempp_cl.api.operators.boundary.laplace.hypersingular( space, space, space, assembler="dense" ).weak_form() - bempp.api.operators.boundary.helmholtz.hypersingular( + bempp_cl.api.operators.boundary.helmholtz.hypersingular( space, space, space, 1.5, assembler="dense" ).weak_form() - bempp.api.operators.boundary.modified_helmholtz.hypersingular( + bempp_cl.api.operators.boundary.modified_helmholtz.hypersingular( space, space, space, 1.5, assembler="dense" ).weak_form() @@ -120,7 +120,7 @@ def test_hypersingular_operators(): ) def test_hypersingular_fails_for_wrong_space(type0, type1): """Expected failure for wrong spaces.""" - grid = bempp.api.shapes.regular_sphere(0) + grid = bempp_cl.api.shapes.regular_sphere(0) space0 = function_space(grid, *type0) space1 = function_space(grid, *type1) @@ -142,7 +142,7 @@ def test_hypersingular_fails_for_wrong_space(type0, type1): @pytest.mark.parametrize("type1", curl_spaces) def test_maxwell_operators(operator, wavenumber, type0, type1): """Test dense assembler for the Maxwell operators.""" - grid = bempp.api.shapes.regular_sphere(0) + grid = bempp_cl.api.shapes.regular_sphere(0) space0 = function_space(grid, *type0) space1 = function_space(grid, *type1) diff --git a/test/unit/operators/test_far_field_operators.py b/test/unit/operators/test_far_field_operators.py index 81373019..eb11a4ac 100644 --- a/test/unit/operators/test_far_field_operators.py +++ b/test/unit/operators/test_far_field_operators.py @@ -1,10 +1,10 @@ """Unit tests for the dense assembler.""" import pytest -import bempp.api +import bempp_cl.api import numpy as np -from bempp.api import function_space -from bempp.api.operators.far_field import helmholtz, maxwell +from bempp_cl.api import function_space +from bempp_cl.api.operators.far_field import helmholtz, maxwell scalar_spaces = [("DP", 0), ("DP", 1), ("P", 1)] div_spaces = [("RWG", 0)] @@ -21,9 +21,9 @@ def points(): @pytest.mark.parametrize("wavenumber", [2.5, 2.5 + 1j]) def test_helmholtz_operators(points, operator, wavenumber, space_type): """Test dense assembler for the Helmholtz operators.""" - grid = bempp.api.shapes.regular_sphere(0) + grid = bempp_cl.api.shapes.regular_sphere(0) space = function_space(grid, *space_type) - fun = bempp.api.GridFunction( + fun = bempp_cl.api.GridFunction( space, coefficients=np.random.rand(space.global_dof_count) ) @@ -35,9 +35,9 @@ def test_helmholtz_operators(points, operator, wavenumber, space_type): @pytest.mark.parametrize("wavenumber", [2.5, 2.5 + 1j]) def test_maxwell_operators(points, operator, wavenumber, space_type): """Test dense assembler for the Helmholtz operators.""" - grid = bempp.api.shapes.regular_sphere(0) + grid = bempp_cl.api.shapes.regular_sphere(0) space = function_space(grid, *space_type) - fun = bempp.api.GridFunction( + fun = bempp_cl.api.GridFunction( space, coefficients=np.random.rand(space.global_dof_count) ) diff --git a/test/unit/operators/test_potential_operators.py b/test/unit/operators/test_potential_operators.py index de43d5ae..84fe8eb7 100644 --- a/test/unit/operators/test_potential_operators.py +++ b/test/unit/operators/test_potential_operators.py @@ -1,10 +1,10 @@ """Unit tests for the dense assembler.""" import pytest -import bempp.api +import bempp_cl.api import numpy as np -from bempp.api import function_space -from bempp.api.operators.potential import laplace, helmholtz, maxwell +from bempp_cl.api import function_space +from bempp_cl.api.operators.potential import laplace, helmholtz, maxwell scalar_spaces = [("DP", 0), ("DP", 1), ("P", 1)] div_spaces = [("RWG", 0)] @@ -20,9 +20,9 @@ def points(): @pytest.mark.parametrize("space_type", scalar_spaces) def test_laplace_operators(points, operator, space_type): """Test dense assembler for the Laplace operators.""" - grid = bempp.api.shapes.regular_sphere(0) + grid = bempp_cl.api.shapes.regular_sphere(0) space = function_space(grid, *space_type) - fun = bempp.api.GridFunction( + fun = bempp_cl.api.GridFunction( space, coefficients=np.random.rand(space.global_dof_count) ) @@ -34,9 +34,9 @@ def test_laplace_operators(points, operator, space_type): @pytest.mark.parametrize("wavenumber", [2.5, 2.5 + 1j]) def test_helmholtz_operators(points, operator, wavenumber, space_type): """Test dense assembler for the Helmholtz operators.""" - grid = bempp.api.shapes.regular_sphere(0) + grid = bempp_cl.api.shapes.regular_sphere(0) space = function_space(grid, *space_type) - fun = bempp.api.GridFunction( + fun = bempp_cl.api.GridFunction( space, coefficients=np.random.rand(space.global_dof_count) ) @@ -48,9 +48,9 @@ def test_helmholtz_operators(points, operator, wavenumber, space_type): @pytest.mark.parametrize("wavenumber", [2.5, 2.5 + 1j]) def test_maxwell_operators(points, operator, wavenumber, space_type): """Test dense assembler for the Helmholtz operators.""" - grid = bempp.api.shapes.regular_sphere(0) + grid = bempp_cl.api.shapes.regular_sphere(0) space = function_space(grid, *space_type) - fun = bempp.api.GridFunction( + fun = bempp_cl.api.GridFunction( space, coefficients=np.random.rand(space.global_dof_count) ) diff --git a/test/unit/space/test_barycentric.py b/test/unit/space/test_barycentric.py index 765af085..46898f11 100644 --- a/test/unit/space/test_barycentric.py +++ b/test/unit/space/test_barycentric.py @@ -10,11 +10,11 @@ @pytest.mark.parametrize("space_info", [("RWG", 0), ("DP", 0), ("P", 1)]) def test_barycentric(space_info, helpers, precision): """Test barycentric space.""" - import bempp.api + import bempp_cl.api import math - grid = bempp.api.shapes.regular_sphere(2) - space = bempp.api.function_space(grid, space_info[0], space_info[1]) + grid = bempp_cl.api.shapes.regular_sphere(2) + space = bempp_cl.api.function_space(grid, space_info[0], space_info[1]) space_bary = space.barycentric_representation() # Define a function on this space @@ -22,8 +22,8 @@ def test_barycentric(space_info, helpers, precision): rand = _np.random.RandomState(0) coeffs = rand.randn(space.global_dof_count) - fun = bempp.api.GridFunction(space, coefficients=coeffs) - fun_bary = bempp.api.GridFunction(space_bary, coefficients=coeffs) + fun = bempp_cl.api.GridFunction(space, coefficients=coeffs) + fun_bary = bempp_cl.api.GridFunction(space_bary, coefficients=coeffs) assert math.isclose( fun.l2_norm(), fun_bary.l2_norm(), rel_tol=helpers.default_tolerance(precision) diff --git a/test/unit/space/test_barycentric_rwg.py b/test/unit/space/test_barycentric_rwg.py index c61329fb..198c3c25 100644 --- a/test/unit/space/test_barycentric_rwg.py +++ b/test/unit/space/test_barycentric_rwg.py @@ -9,11 +9,11 @@ def test_rwg_barycentric(helpers, precision): """Test B-RWG space.""" - import bempp.api + import bempp_cl.api import math - grid = bempp.api.shapes.regular_sphere(0) - space = bempp.api.function_space(grid, "RWG", 0, include_boundary_dofs=True) + grid = bempp_cl.api.shapes.regular_sphere(0) + space = bempp_cl.api.function_space(grid, "RWG", 0, include_boundary_dofs=True) space_bary = space.barycentric_representation() # Define a function on this space @@ -21,8 +21,8 @@ def test_rwg_barycentric(helpers, precision): rand = _np.random.RandomState(0) coeffs = rand.randn(space.global_dof_count) - fun = bempp.api.GridFunction(space, coefficients=coeffs) - fun_bary = bempp.api.GridFunction(space_bary, coefficients=coeffs) + fun = bempp_cl.api.GridFunction(space, coefficients=coeffs) + fun_bary = bempp_cl.api.GridFunction(space_bary, coefficients=coeffs) assert math.isclose( fun.l2_norm(), fun_bary.l2_norm(), rel_tol=helpers.default_tolerance(precision) diff --git a/test/unit/space/test_bc_spaces.py b/test/unit/space/test_bc_spaces.py index 30c6bc93..9eafff73 100644 --- a/test/unit/space/test_bc_spaces.py +++ b/test/unit/space/test_bc_spaces.py @@ -1,21 +1,21 @@ """Unit tests for Buffa-Christansen spaces.""" -import bempp.api +import bempp_cl.api import pytest @pytest.mark.parametrize("space_type", ["BC", "RBC"]) def test_segments(space_type): """Test creation of BC space on multitrace cube.""" - grid = bempp.api.shapes.multitrace_cube(h=1) - bempp.api.function_space(grid, space_type, 0, segments=[1, 2, 3, 4, 5, 6]) + grid = bempp_cl.api.shapes.multitrace_cube(h=1) + bempp_cl.api.function_space(grid, space_type, 0, segments=[1, 2, 3, 4, 5, 6]) @pytest.mark.parametrize("space_type", ["BC", "RBC"]) def test_swapped_normals(space_type): """Test creation of BC space on multitrace cube with swapped normals.""" - grid = bempp.api.shapes.multitrace_cube(h=1) - bempp.api.function_space( + grid = bempp_cl.api.shapes.multitrace_cube(h=1) + bempp_cl.api.function_space( grid, space_type, 0, segments=[6, 7, 8, 9, 10, 11], swapped_normals=[6] ) @@ -23,7 +23,7 @@ def test_swapped_normals(space_type): @pytest.mark.parametrize("space_type", ["BC", "RBC"]) def test_segments_6_7(space_type): """Test creation of BC space on multitrace cube.""" - grid = bempp.api.shapes.multitrace_cube(h=1) - bempp.api.function_space( + grid = bempp_cl.api.shapes.multitrace_cube(h=1) + bempp_cl.api.function_space( grid, space_type, 0, segments=[6, 7, 8, 9, 10, 11], swapped_normals=[6] ) diff --git a/test/unit/space/test_continuity.py b/test/unit/space/test_continuity.py index 28a17433..e61b2426 100644 --- a/test/unit/space/test_continuity.py +++ b/test/unit/space/test_continuity.py @@ -1,6 +1,6 @@ """Unit tests for Buffa-Christansen spaces.""" -import bempp.api +import bempp_cl.api import pytest import numpy as np @@ -10,9 +10,9 @@ @pytest.mark.parametrize("space_type,degree", [("P", 1)]) def test_H1_continuity(space_type, degree): """Test that BC spaces have continuous normal components.""" - grid = bempp.api.shapes.sphere(h=0.2) - space = bempp.api.function_space(grid, space_type, degree) - f = bempp.api.GridFunction(space, coefficients=range(space.global_dof_count)) + grid = bempp_cl.api.shapes.sphere(h=0.2) + space = bempp_cl.api.function_space(grid, space_type, degree) + f = bempp_cl.api.GridFunction(space, coefficients=range(space.global_dof_count)) for e, (vertices, neighbors) in enumerate(zip(grid.edges.T, grid.edge_neighbors)): v0 = [local_vertices[list(grid.elements[:, neighbors[0]]).index(v)] for v in vertices] @@ -29,9 +29,9 @@ def test_H1_continuity(space_type, degree): @pytest.mark.parametrize("space_type", ["RT", "BC"]) def test_Hdiv_continuity(space_type): """Test that BC spaces have continuous normal components.""" - grid = bempp.api.shapes.sphere(h=0.2) - space = bempp.api.function_space(grid, space_type, 0) - f = bempp.api.GridFunction(space, coefficients=range(space.global_dof_count)) + grid = bempp_cl.api.shapes.sphere(h=0.2) + space = bempp_cl.api.function_space(grid, space_type, 0) + f = bempp_cl.api.GridFunction(space, coefficients=range(space.global_dof_count)) if space_type == "BC": grid = grid.barycentric_refinement @@ -62,9 +62,9 @@ def test_Hdiv_continuity(space_type): @pytest.mark.parametrize("space_type", ["NC", "RBC"]) def test_Hcurl_continuity(space_type): """Test that BC spaces have continuous normal components.""" - grid = bempp.api.shapes.sphere(h=0.2) - space = bempp.api.function_space(grid, space_type, 0) - f = bempp.api.GridFunction(space, coefficients=range(space.global_dof_count)) + grid = bempp_cl.api.shapes.sphere(h=0.2) + space = bempp_cl.api.function_space(grid, space_type, 0) + f = bempp_cl.api.GridFunction(space, coefficients=range(space.global_dof_count)) if space_type == "RBC": grid = grid.barycentric_refinement diff --git a/test/unit/space/test_function_io.py b/test/unit/space/test_function_io.py index 26972320..3f51480e 100644 --- a/test/unit/space/test_function_io.py +++ b/test/unit/space/test_function_io.py @@ -2,7 +2,7 @@ import os import pytest -import bempp.api +import bempp_cl.api import numpy as np @@ -28,9 +28,9 @@ def folder(): ) def test_export(filename, folder, space_type): """Return geometries of two element grid.""" - grid = bempp.api.shapes.cube(h=0.5) - space = bempp.api.function_space(grid, *space_type) - function = bempp.api.GridFunction( + grid = bempp_cl.api.shapes.cube(h=0.5) + space = bempp_cl.api.function_space(grid, *space_type) + function = bempp_cl.api.GridFunction( space, coefficients=np.random.rand(space.global_dof_count) ) - bempp.api.export(os.path.join(folder, filename), grid_function=function) + bempp_cl.api.export(os.path.join(folder, filename), grid_function=function) diff --git a/test/unit/space/test_local2global.py b/test/unit/space/test_local2global.py index 9f664469..1472ac98 100644 --- a/test/unit/space/test_local2global.py +++ b/test/unit/space/test_local2global.py @@ -5,15 +5,15 @@ import numpy as _np import pytest -import bempp.api +import bempp_cl.api @pytest.mark.parametrize( "grid", [ - bempp.api.shapes.sphere(h=0.5), - bempp.api.shapes.cube(h=0.5), - bempp.api.shapes.shapes.screen( + bempp_cl.api.shapes.sphere(h=0.5), + bempp_cl.api.shapes.cube(h=0.5), + bempp_cl.api.shapes.shapes.screen( _np.array([(1, 1, 0), (0, 1, 0), (0, 0, 0), (1, 0, 0)]), h=0.5 ), ], @@ -44,7 +44,7 @@ def test_local2global( print("BC spaces not yet supported on screens") return - space = bempp.api.function_space( + space = bempp_cl.api.function_space( grid, *space_type, include_boundary_dofs=include_boundary_dofs, diff --git a/test/unit/space/test_segments.py b/test/unit/space/test_segments.py index 03a698ef..54530363 100644 --- a/test/unit/space/test_segments.py +++ b/test/unit/space/test_segments.py @@ -23,34 +23,34 @@ ) def test_segment_space(space_info, helpers, precision): """Test that a space on a face of a cube has fewer DOFs.""" - import bempp.api + import bempp_cl.api import math - grid = bempp.api.shapes.cube(h=0.4) + grid = bempp_cl.api.shapes.cube(h=0.4) - space0 = bempp.api.function_space(grid, space_info[0], space_info[1]) - fun0 = bempp.api.GridFunction( + space0 = bempp_cl.api.function_space(grid, space_info[0], space_info[1]) + fun0 = bempp_cl.api.GridFunction( space0, coefficients=_np.ones(space0.global_dof_count) ) - space1 = bempp.api.function_space( + space1 = bempp_cl.api.function_space( grid, space_info[0], space_info[1], segments=[1], include_boundary_dofs=False, ) - fun1 = bempp.api.GridFunction( + fun1 = bempp_cl.api.GridFunction( space1, coefficients=_np.ones(space1.global_dof_count) ) assert space0.global_dof_count > space1.global_dof_count assert fun0.l2_norm() > fun1.l2_norm() - space2 = bempp.api.function_space( + space2 = bempp_cl.api.function_space( grid, space_info[0], space_info[1], segments=[1], truncate_at_segment_edge=True ) - fun2 = bempp.api.GridFunction( + fun2 = bempp_cl.api.GridFunction( space2, coefficients=_np.ones(space2.global_dof_count) ) @@ -75,11 +75,11 @@ def test_segment_space(space_info, helpers, precision): ) def test_segments_space_with_boundary_dofs(space_info): """Test that space with boundary DOFs have more DOFs if these are included.""" - import bempp.api + import bempp_cl.api - grid = bempp.api.shapes.cube(h=0.4) + grid = bempp_cl.api.shapes.cube(h=0.4) - space0 = bempp.api.function_space( + space0 = bempp_cl.api.function_space( grid, space_info[0], space_info[1], @@ -87,11 +87,11 @@ def test_segments_space_with_boundary_dofs(space_info): include_boundary_dofs=False, truncate_at_segment_edge=False, ) - fun0 = bempp.api.GridFunction( + fun0 = bempp_cl.api.GridFunction( space0, coefficients=_np.ones(space0.global_dof_count) ) - space1 = bempp.api.function_space( + space1 = bempp_cl.api.function_space( grid, space_info[0], space_info[1], @@ -99,7 +99,7 @@ def test_segments_space_with_boundary_dofs(space_info): include_boundary_dofs=True, truncate_at_segment_edge=False, ) - fun1 = bempp.api.GridFunction( + fun1 = bempp_cl.api.GridFunction( space1, coefficients=_np.ones(space1.global_dof_count) ) @@ -110,12 +110,12 @@ def test_segments_space_with_boundary_dofs(space_info): @pytest.mark.parametrize("space_info", [("DP", 0), ("DP", 1), ("DUAL", 1)]) def test_segments_space_without_boundary_dofs(space_info, helpers, precision): """Test that including boundary DOFs has no effect on these spaces.""" - import bempp.api + import bempp_cl.api import math - grid = bempp.api.shapes.cube(h=0.4) + grid = bempp_cl.api.shapes.cube(h=0.4) - space0 = bempp.api.function_space( + space0 = bempp_cl.api.function_space( grid, space_info[0], space_info[1], @@ -123,11 +123,11 @@ def test_segments_space_without_boundary_dofs(space_info, helpers, precision): include_boundary_dofs=False, truncate_at_segment_edge=False, ) - fun0 = bempp.api.GridFunction( + fun0 = bempp_cl.api.GridFunction( space0, coefficients=_np.ones(space0.global_dof_count) ) - space1 = bempp.api.function_space( + space1 = bempp_cl.api.function_space( grid, space_info[0], space_info[1], @@ -135,11 +135,11 @@ def test_segments_space_without_boundary_dofs(space_info, helpers, precision): include_boundary_dofs=True, truncate_at_segment_edge=False, ) - fun1 = bempp.api.GridFunction( + fun1 = bempp_cl.api.GridFunction( space1, coefficients=_np.ones(space1.global_dof_count) ) - space2 = bempp.api.function_space( + space2 = bempp_cl.api.function_space( grid, space_info[0], space_info[1], @@ -147,7 +147,7 @@ def test_segments_space_without_boundary_dofs(space_info, helpers, precision): include_boundary_dofs=True, truncate_at_segment_edge=False, ) - fun2 = bempp.api.GridFunction( + fun2 = bempp_cl.api.GridFunction( space2, coefficients=_np.ones(space2.global_dof_count) ) @@ -166,11 +166,11 @@ def test_segments_space_without_boundary_dofs(space_info, helpers, precision): ) def test_truncating(space_info): """Test that truncating these spaces at the boundary is correct.""" - import bempp.api + import bempp_cl.api - grid = bempp.api.shapes.cube(h=0.4) + grid = bempp_cl.api.shapes.cube(h=0.4) - space0 = bempp.api.function_space( + space0 = bempp_cl.api.function_space( grid, space_info[0], space_info[1], @@ -178,11 +178,11 @@ def test_truncating(space_info): include_boundary_dofs=True, truncate_at_segment_edge=False, ) - fun0 = bempp.api.GridFunction( + fun0 = bempp_cl.api.GridFunction( space0, coefficients=_np.ones(space0.global_dof_count) ) - space1 = bempp.api.function_space( + space1 = bempp_cl.api.function_space( grid, space_info[0], space_info[1], @@ -190,7 +190,7 @@ def test_truncating(space_info): include_boundary_dofs=True, truncate_at_segment_edge=True, ) - fun1 = bempp.api.GridFunction( + fun1 = bempp_cl.api.GridFunction( space1, coefficients=_np.ones(space1.global_dof_count) ) @@ -201,12 +201,12 @@ def test_truncating(space_info): @pytest.mark.parametrize("space_info", [("DUAL", 0)]) def test_truncating_node_dual_spaces(space_info, helpers, precision): """Test spaces on segments.""" - import bempp.api + import bempp_cl.api import math - grid = bempp.api.shapes.cube(h=0.4) + grid = bempp_cl.api.shapes.cube(h=0.4) - space0 = bempp.api.function_space( + space0 = bempp_cl.api.function_space( grid, space_info[0], space_info[1], @@ -214,11 +214,11 @@ def test_truncating_node_dual_spaces(space_info, helpers, precision): include_boundary_dofs=False, truncate_at_segment_edge=True, ) - fun0 = bempp.api.GridFunction( + fun0 = bempp_cl.api.GridFunction( space0, coefficients=_np.ones(space0.global_dof_count) ) - space1 = bempp.api.function_space( + space1 = bempp_cl.api.function_space( grid, space_info[0], space_info[1], @@ -226,7 +226,7 @@ def test_truncating_node_dual_spaces(space_info, helpers, precision): include_boundary_dofs=False, truncate_at_segment_edge=False, ) - fun1 = bempp.api.GridFunction( + fun1 = bempp_cl.api.GridFunction( space1, coefficients=_np.ones(space1.global_dof_count) ) @@ -239,11 +239,11 @@ def test_truncating_node_dual_spaces(space_info, helpers, precision): @pytest.mark.parametrize("space_info", [("BC", 0), ("RBC", 0), ("DUAL", 1)]) def test_truncating_edge_and_face_dual_spaces(space_info): """Test spaces on segments.""" - import bempp.api + import bempp_cl.api - grid = bempp.api.shapes.cube(h=0.4) + grid = bempp_cl.api.shapes.cube(h=0.4) - space0 = bempp.api.function_space( + space0 = bempp_cl.api.function_space( grid, space_info[0], space_info[1], @@ -252,7 +252,7 @@ def test_truncating_edge_and_face_dual_spaces(space_info): truncate_at_segment_edge=True, ) - space1 = bempp.api.function_space( + space1 = bempp_cl.api.function_space( grid, space_info[0], space_info[1], diff --git a/test/unit/space/test_space.py b/test/unit/space/test_space.py index e7ff71a0..197bac0e 100644 --- a/test/unit/space/test_space.py +++ b/test/unit/space/test_space.py @@ -5,15 +5,15 @@ import numpy as _np import pytest -import bempp.api +import bempp_cl.api pytestmark = pytest.mark.usefixtures("default_parameters", "helpers") grids = pytest.mark.parametrize( "grid", [ - bempp.api.shapes.cube(), - bempp.api.shapes.screen( + bempp_cl.api.shapes.cube(), + bempp_cl.api.shapes.screen( _np.array([[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]]), h=0.2 ), ], @@ -23,7 +23,7 @@ @grids def test_p1_color_map(grid): """Test if the color map for p1 spaces is correct.""" - space = bempp.api.function_space(grid, "P", 1) + space = bempp_cl.api.function_space(grid, "P", 1) colors_unique = True @@ -38,7 +38,7 @@ def test_p1_color_map(grid): @grids def test_rwg_color_map(grid): """Test if the color map for RWG spaces is correct.""" - space = bempp.api.function_space(grid, "RWG", 0) + space = bempp_cl.api.function_space(grid, "RWG", 0) colors_unique = True @@ -53,7 +53,7 @@ def test_rwg_color_map(grid): @grids def test_p1_open_segment(grid): """Check a P1 open segment.""" - space = bempp.api.function_space(grid, "P", 1, segments=[1]) + space = bempp_cl.api.function_space(grid, "P", 1, segments=[1]) dofs_empty = True boundary_dofs_empty = True @@ -92,7 +92,7 @@ def test_p1_open_segment(grid): @grids def test_p1_extended_segment(grid): """Check a P1 extended segment.""" - space = bempp.api.function_space( + space = bempp_cl.api.function_space( grid, "P", 1, @@ -125,7 +125,7 @@ def test_p1_extended_segment(grid): @grids def test_p1_closed_segment(grid): """Check a P1 closed segment.""" - space = bempp.api.function_space( + space = bempp_cl.api.function_space( grid, "P", 1, segments=[1], include_boundary_dofs=True ) @@ -158,7 +158,7 @@ def test_p1_closed_segment(grid): @grids def test_rwg_open_segment(grid): """Check an RWG open segment.""" - space = bempp.api.function_space(grid, "RWG", 0, segments=[1]) + space = bempp_cl.api.function_space(grid, "RWG", 0, segments=[1]) dofs_empty = True boundary_dofs_empty = True @@ -193,7 +193,7 @@ def test_rwg_open_segment(grid): @grids def test_rwg_closed_segment(grid): """Check an RWG closed segment.""" - space = bempp.api.function_space( + space = bempp_cl.api.function_space( grid, "RWG", 0, segments=[1], include_boundary_dofs=True ) @@ -207,7 +207,7 @@ def test_rwg_closed_segment(grid): @grids def test_snc_closed_segment(grid): """Check an SNC closed segment.""" - space = bempp.api.function_space( + space = bempp_cl.api.function_space( grid, "SNC", 0, segments=[1], include_boundary_dofs=True ) @@ -221,7 +221,7 @@ def test_snc_closed_segment(grid): @grids def test_snc_open_segment(grid): """Check an SNC open segment.""" - space = bempp.api.function_space(grid, "SNC", 0, segments=[1]) + space = bempp_cl.api.function_space(grid, "SNC", 0, segments=[1]) dofs_empty = True boundary_dofs_empty = True @@ -256,7 +256,7 @@ def test_snc_open_segment(grid): @grids def test_dp1_closed_segment(grid): """Check an DP1 closed segment.""" - space = bempp.api.function_space(grid, "DP", 1, segments=[1]) + space = bempp_cl.api.function_space(grid, "DP", 1, segments=[1]) for elem_index in range(grid.number_of_elements): if space.support[elem_index]: diff --git a/test/unit/utils/test_interpolation.py b/test/unit/utils/test_interpolation.py index a13b544c..0273efa5 100644 --- a/test/unit/utils/test_interpolation.py +++ b/test/unit/utils/test_interpolation.py @@ -2,7 +2,7 @@ import numpy as np -from bempp.api.utils import interpolation +from bempp_cl.api.utils import interpolation def test_evaluation_of_laplace_kernel_on_interp_points(): diff --git a/test/validation/computations/test_mixed_neumann_dirichlet_.py b/test/validation/computations/test_mixed_neumann_dirichlet_.py index 16c87de0..1328a37c 100644 --- a/test/validation/computations/test_mixed_neumann_dirichlet_.py +++ b/test/validation/computations/test_mixed_neumann_dirichlet_.py @@ -1,4 +1,4 @@ -import bempp.api +import bempp_cl.api import numpy as np import pytest @@ -12,18 +12,18 @@ def test_laplace_mixed_neumann_dirichlet(helpers, precision): dirichlet_segments = [1, 3] neumann_segments = [2, 4, 5, 6] - global_neumann_space = bempp.api.function_space(grid, "DP", 0) - global_dirichlet_space = bempp.api.function_space(grid, "P", 1) + global_neumann_space = bempp_cl.api.function_space(grid, "DP", 0) + global_dirichlet_space = bempp_cl.api.function_space(grid, "P", 1) - neumann_space_dirichlet_segment = bempp.api.function_space( + neumann_space_dirichlet_segment = bempp_cl.api.function_space( grid, "DP", 0, segments=dirichlet_segments ) - neumann_space_neumann_segment = bempp.api.function_space( + neumann_space_neumann_segment = bempp_cl.api.function_space( grid, "DP", 0, segments=neumann_segments ) - dirichlet_space_dirichlet_segment = bempp.api.function_space( + dirichlet_space_dirichlet_segment = bempp_cl.api.function_space( grid, "P", 1, @@ -32,96 +32,96 @@ def test_laplace_mixed_neumann_dirichlet(helpers, precision): truncate_at_segment_edge=False, ) - dirichlet_space_neumann_segment = bempp.api.function_space( + dirichlet_space_neumann_segment = bempp_cl.api.function_space( grid, "P", 1, segments=neumann_segments ) - dual_dirichlet_space = bempp.api.function_space( + dual_dirichlet_space = bempp_cl.api.function_space( grid, "P", 1, segments=dirichlet_segments, include_boundary_dofs=True ) - slp_DD = bempp.api.operators.boundary.laplace.single_layer( + slp_DD = bempp_cl.api.operators.boundary.laplace.single_layer( neumann_space_dirichlet_segment, dirichlet_space_dirichlet_segment, neumann_space_dirichlet_segment, ) - dlp_DN = bempp.api.operators.boundary.laplace.double_layer( + dlp_DN = bempp_cl.api.operators.boundary.laplace.double_layer( dirichlet_space_neumann_segment, dirichlet_space_dirichlet_segment, neumann_space_dirichlet_segment, ) - adlp_ND = bempp.api.operators.boundary.laplace.adjoint_double_layer( + adlp_ND = bempp_cl.api.operators.boundary.laplace.adjoint_double_layer( neumann_space_dirichlet_segment, neumann_space_neumann_segment, dirichlet_space_neumann_segment, ) - hyp_NN = bempp.api.operators.boundary.laplace.hypersingular( + hyp_NN = bempp_cl.api.operators.boundary.laplace.hypersingular( dirichlet_space_neumann_segment, neumann_space_neumann_segment, dirichlet_space_neumann_segment, ) - slp_DN = bempp.api.operators.boundary.laplace.single_layer( + slp_DN = bempp_cl.api.operators.boundary.laplace.single_layer( neumann_space_neumann_segment, dirichlet_space_dirichlet_segment, neumann_space_dirichlet_segment, ) - dlp_DD = bempp.api.operators.boundary.laplace.double_layer( + dlp_DD = bempp_cl.api.operators.boundary.laplace.double_layer( dirichlet_space_dirichlet_segment, dirichlet_space_dirichlet_segment, neumann_space_dirichlet_segment, ) - id_DD = bempp.api.operators.boundary.sparse.identity( + id_DD = bempp_cl.api.operators.boundary.sparse.identity( dirichlet_space_dirichlet_segment, dirichlet_space_dirichlet_segment, neumann_space_dirichlet_segment, ) - adlp_NN = bempp.api.operators.boundary.laplace.adjoint_double_layer( + adlp_NN = bempp_cl.api.operators.boundary.laplace.adjoint_double_layer( neumann_space_neumann_segment, neumann_space_neumann_segment, dirichlet_space_neumann_segment, ) - id_NN = bempp.api.operators.boundary.sparse.identity( + id_NN = bempp_cl.api.operators.boundary.sparse.identity( neumann_space_neumann_segment, neumann_space_neumann_segment, dirichlet_space_neumann_segment, ) - hyp_ND = bempp.api.operators.boundary.laplace.hypersingular( + hyp_ND = bempp_cl.api.operators.boundary.laplace.hypersingular( dirichlet_space_dirichlet_segment, neumann_space_neumann_segment, dirichlet_space_neumann_segment, ) - blocked = bempp.api.BlockedOperator(2, 2) + blocked = bempp_cl.api.BlockedOperator(2, 2) blocked[0, 0] = slp_DD blocked[0, 1] = -dlp_DN blocked[1, 0] = adlp_ND blocked[1, 1] = hyp_NN - @bempp.api.real_callable + @bempp_cl.api.real_callable def dirichlet_data(x, n, domain_index, res): res[0] = 1 - @bempp.api.real_callable + @bempp_cl.api.real_callable def neumann_data(x, n, domain_index, res): res[0] = 1 - dirichlet_grid_fun = bempp.api.GridFunction( + dirichlet_grid_fun = bempp_cl.api.GridFunction( dirichlet_space_dirichlet_segment, fun=dirichlet_data, dual_space=dual_dirichlet_space, ) - neumann_grid_fun = bempp.api.GridFunction( + neumann_grid_fun = bempp_cl.api.GridFunction( neumann_space_neumann_segment, fun=neumann_data, dual_space=dirichlet_space_neumann_segment, @@ -130,27 +130,27 @@ def neumann_data(x, n, domain_index, res): rhs_fun1 = (0.5 * id_DD + dlp_DD) * dirichlet_grid_fun - slp_DN * neumann_grid_fun rhs_fun2 = -hyp_ND * dirichlet_grid_fun + (0.5 * id_NN - adlp_NN) * neumann_grid_fun - (neumann_solution, dirichlet_solution), _ = bempp.api.linalg.gmres( + (neumann_solution, dirichlet_solution), _ = bempp_cl.api.linalg.gmres( blocked, [rhs_fun1, rhs_fun2] ) - neumann_imbedding_dirichlet_segment = bempp.api.operators.boundary.sparse.identity( + neumann_imbedding_dirichlet_segment = bempp_cl.api.operators.boundary.sparse.identity( neumann_space_dirichlet_segment, global_neumann_space, global_neumann_space ) - neumann_imbedding_neumann_segment = bempp.api.operators.boundary.sparse.identity( + neumann_imbedding_neumann_segment = bempp_cl.api.operators.boundary.sparse.identity( neumann_space_neumann_segment, global_neumann_space, global_neumann_space ) dirichlet_imbedding_dirichlet_segment = ( - bempp.api.operators.boundary.sparse.identity( + bempp_cl.api.operators.boundary.sparse.identity( dirichlet_space_dirichlet_segment, global_dirichlet_space, global_dirichlet_space, ) ) - dirichlet_imbedding_neumann_segment = bempp.api.operators.boundary.sparse.identity( + dirichlet_imbedding_neumann_segment = bempp_cl.api.operators.boundary.sparse.identity( dirichlet_space_neumann_segment, global_dirichlet_space, global_dirichlet_space ) diff --git a/test/validation/fmm/test_fmm.py b/test/validation/fmm/test_fmm.py index 55cf2152..f6721908 100644 --- a/test/validation/fmm/test_fmm.py +++ b/test/validation/fmm/test_fmm.py @@ -5,13 +5,13 @@ import pytest import numpy as np -import bempp.api +import bempp_cl.api pytestmark = pytest.mark.usefixtures("default_parameters", "helpers") TOL = 2e-3 -bempp.api.GLOBAL_PARAMETERS.fmm.expansion_order = 10 -# bempp.api.GLOBAL_PARAMETERS.fmm.ncrit = 100 +bempp_cl.api.GLOBAL_PARAMETERS.fmm.expansion_order = 10 +# bempp_cl.api.GLOBAL_PARAMETERS.fmm.ncrit = 100 @pytest.fixture @@ -31,71 +31,71 @@ def grid2(helpers): def test_laplace_boundary_fmm(helpers, grid): """Test Laplace boundary operators.""" - space = bempp.api.function_space(grid, "P", 1) + space = bempp_cl.api.function_space(grid, "P", 1) vec = helpers.load_npy_data("fmm_p1_vec") for filename, operator in [ - ("fmm_laplace_single", bempp.api.operators.boundary.laplace.single_layer), - ("fmm_laplace_double", bempp.api.operators.boundary.laplace.double_layer), + ("fmm_laplace_single", bempp_cl.api.operators.boundary.laplace.single_layer), + ("fmm_laplace_double", bempp_cl.api.operators.boundary.laplace.double_layer), ( "fmm_laplace_adjoint", - bempp.api.operators.boundary.laplace.adjoint_double_layer, + bempp_cl.api.operators.boundary.laplace.adjoint_double_layer, ), - ("fmm_laplace_hyper", bempp.api.operators.boundary.laplace.hypersingular), + ("fmm_laplace_hyper", bempp_cl.api.operators.boundary.laplace.hypersingular), ]: fmm = operator(space, space, space, assembler="fmm").weak_form() dense = helpers.load_npy_data(filename) np.testing.assert_allclose(dense, fmm @ vec, rtol=TOL) - bempp.api.clear_fmm_cache() + bempp_cl.api.clear_fmm_cache() def test_laplace_potential_fmm(helpers, grid): """Test Laplace potential operators.""" - space = bempp.api.function_space(grid, "P", 1) + space = bempp_cl.api.function_space(grid, "P", 1) vec = helpers.load_npy_data("fmm_p1_vec") - grid_fun = bempp.api.GridFunction(space, coefficients=vec) + grid_fun = bempp_cl.api.GridFunction(space, coefficients=vec) points = helpers.load_npy_data("fmm_potential_points") for filename, operator in [ ( "fmm_laplace_potential_single", - bempp.api.operators.potential.laplace.single_layer, + bempp_cl.api.operators.potential.laplace.single_layer, ), ( "fmm_laplace_potential_double", - bempp.api.operators.potential.laplace.double_layer, + bempp_cl.api.operators.potential.laplace.double_layer, ), ]: fmm = operator(space, points, assembler="fmm").evaluate(grid_fun) dense = helpers.load_npy_data(filename) np.testing.assert_allclose(dense, fmm, rtol=TOL) - bempp.api.clear_fmm_cache() + bempp_cl.api.clear_fmm_cache() def test_helmholtz_boundary_fmm(helpers, grid, skip): """Test Helmholtz boundary operators.""" if skip == "ci": pytest.skip() - space = bempp.api.function_space(grid, "P", 1) + space = bempp_cl.api.function_space(grid, "P", 1) vec = helpers.load_npy_data("fmm_p1_vec") wavenumber = 1.5 for filename, operator in [ - ("fmm_helmholtz_single", bempp.api.operators.boundary.helmholtz.single_layer), - ("fmm_helmholtz_double", bempp.api.operators.boundary.helmholtz.double_layer), + ("fmm_helmholtz_single", bempp_cl.api.operators.boundary.helmholtz.single_layer), + ("fmm_helmholtz_double", bempp_cl.api.operators.boundary.helmholtz.double_layer), ( "fmm_helmholtz_adjoint", - bempp.api.operators.boundary.helmholtz.adjoint_double_layer, + bempp_cl.api.operators.boundary.helmholtz.adjoint_double_layer, ), - ("fmm_helmholtz_hyper", bempp.api.operators.boundary.helmholtz.hypersingular), + ("fmm_helmholtz_hyper", bempp_cl.api.operators.boundary.helmholtz.hypersingular), ]: fmm = operator(space, space, space, wavenumber, assembler="fmm").weak_form() dense = helpers.load_npy_data(filename) np.testing.assert_allclose(dense, fmm @ vec, rtol=TOL) - bempp.api.clear_fmm_cache() + bempp_cl.api.clear_fmm_cache() def test_helmholtz_boundary_fmm_complex(helpers, skip): @@ -103,49 +103,49 @@ def test_helmholtz_boundary_fmm_complex(helpers, skip): if skip == "ci": pytest.skip() rand = np.random.RandomState(0) - grid = bempp.api.shapes.regular_sphere(2) - space = bempp.api.function_space(grid, "P", 1) + grid = bempp_cl.api.shapes.regular_sphere(2) + space = bempp_cl.api.function_space(grid, "P", 1) vec = rand.rand(space.global_dof_count) wavenumber = 1.5 + 0.5j for operator in [ - bempp.api.operators.boundary.helmholtz.single_layer, - bempp.api.operators.boundary.helmholtz.double_layer, - bempp.api.operators.boundary.helmholtz.hypersingular, + bempp_cl.api.operators.boundary.helmholtz.single_layer, + bempp_cl.api.operators.boundary.helmholtz.double_layer, + bempp_cl.api.operators.boundary.helmholtz.hypersingular, ]: fmm = operator(space, space, space, wavenumber, assembler="fmm").weak_form() dense = operator(space, space, space, wavenumber, assembler="dense").weak_form() np.testing.assert_allclose(dense @ vec, fmm @ vec, rtol=TOL) - bempp.api.clear_fmm_cache() + bempp_cl.api.clear_fmm_cache() def test_helmholtz_potential_fmm(helpers, grid, skip): """Test Helmholtz potential operators.""" if skip == "ci": pytest.skip() - space = bempp.api.function_space(grid, "P", 1) + space = bempp_cl.api.function_space(grid, "P", 1) vec = helpers.load_npy_data("fmm_p1_vec") - grid_fun = bempp.api.GridFunction(space, coefficients=vec) + grid_fun = bempp_cl.api.GridFunction(space, coefficients=vec) points = helpers.load_npy_data("fmm_potential_points") wavenumber = 1.5 for filename, operator in [ ( "fmm_helmholtz_potential_single", - bempp.api.operators.potential.helmholtz.single_layer, + bempp_cl.api.operators.potential.helmholtz.single_layer, ), ( "fmm_helmholtz_potential_double", - bempp.api.operators.potential.helmholtz.double_layer, + bempp_cl.api.operators.potential.helmholtz.double_layer, ), ]: fmm = operator(space, points, wavenumber, assembler="fmm").evaluate(grid_fun) dense = helpers.load_npy_data(filename) np.testing.assert_allclose(dense, fmm, rtol=TOL) - bempp.api.clear_fmm_cache() + bempp_cl.api.clear_fmm_cache() def test_helmholtz_potential_fmm_complex(helpers, skip): @@ -153,17 +153,17 @@ def test_helmholtz_potential_fmm_complex(helpers, skip): if skip == "ci": pytest.skip() rand = np.random.RandomState(0) - grid = bempp.api.shapes.regular_sphere(2) - space = bempp.api.function_space(grid, "P", 1) + grid = bempp_cl.api.shapes.regular_sphere(2) + space = bempp_cl.api.function_space(grid, "P", 1) vec = rand.rand(space.global_dof_count) - grid_fun = bempp.api.GridFunction(space, coefficients=vec) + grid_fun = bempp_cl.api.GridFunction(space, coefficients=vec) wavenumber = 1.5 + 0.5j points = np.array([2.0, 1.0, 0.0]).reshape(3, 1) for operator in [ - bempp.api.operators.potential.helmholtz.single_layer, - bempp.api.operators.potential.helmholtz.double_layer, + bempp_cl.api.operators.potential.helmholtz.single_layer, + bempp_cl.api.operators.potential.helmholtz.double_layer, ]: fmm = operator(space, points, wavenumber, assembler="fmm") dense = operator(space, points, wavenumber, assembler="dense") @@ -172,7 +172,7 @@ def test_helmholtz_potential_fmm_complex(helpers, skip): dense.evaluate(grid_fun), fmm.evaluate(grid_fun), rtol=TOL ) - bempp.api.clear_fmm_cache() + bempp_cl.api.clear_fmm_cache() def test_modified_helmholtz_boundary_fmm(helpers, grid, skip): @@ -180,33 +180,33 @@ def test_modified_helmholtz_boundary_fmm(helpers, grid, skip): if skip == "ci": pytest.skip() - space = bempp.api.function_space(grid, "P", 1) + space = bempp_cl.api.function_space(grid, "P", 1) vec = helpers.load_npy_data("fmm_p1_vec") wavenumber = 1.5 for filename, operator in [ ( "fmm_modified_helmholtz_single", - bempp.api.operators.boundary.modified_helmholtz.single_layer, + bempp_cl.api.operators.boundary.modified_helmholtz.single_layer, ), ( "fmm_modified_helmholtz_double", - bempp.api.operators.boundary.modified_helmholtz.double_layer, + bempp_cl.api.operators.boundary.modified_helmholtz.double_layer, ), ( "fmm_modified_helmholtz_adjoint", - bempp.api.operators.boundary.modified_helmholtz.adjoint_double_layer, + bempp_cl.api.operators.boundary.modified_helmholtz.adjoint_double_layer, ), ( "fmm_modified_helmholtz_hyper", - bempp.api.operators.boundary.modified_helmholtz.hypersingular, + bempp_cl.api.operators.boundary.modified_helmholtz.hypersingular, ), ]: fmm = operator(space, space, space, wavenumber, assembler="fmm").weak_form() dense = helpers.load_npy_data(filename) np.testing.assert_allclose(dense, fmm @ vec, rtol=TOL) - bempp.api.clear_fmm_cache() + bempp_cl.api.clear_fmm_cache() def test_modified_helmholtz_potential_fmm(helpers, grid, skip): @@ -214,111 +214,111 @@ def test_modified_helmholtz_potential_fmm(helpers, grid, skip): if skip == "ci": pytest.skip() - space = bempp.api.function_space(grid, "P", 1) + space = bempp_cl.api.function_space(grid, "P", 1) vec = helpers.load_npy_data("fmm_p1_vec") - grid_fun = bempp.api.GridFunction(space, coefficients=vec) + grid_fun = bempp_cl.api.GridFunction(space, coefficients=vec) points = helpers.load_npy_data("fmm_potential_points") wavenumber = 1.5 for filename, operator in [ ( "fmm_modified_potential_helmholtz_single", - bempp.api.operators.potential.modified_helmholtz.single_layer, + bempp_cl.api.operators.potential.modified_helmholtz.single_layer, ), ( "fmm_modified_potential_helmholtz_double", - bempp.api.operators.potential.modified_helmholtz.double_layer, + bempp_cl.api.operators.potential.modified_helmholtz.double_layer, ), ]: fmm = operator(space, points, wavenumber, assembler="fmm").evaluate(grid_fun) dense = helpers.load_npy_data(filename) np.testing.assert_allclose(dense, fmm, rtol=TOL) - bempp.api.clear_fmm_cache() + bempp_cl.api.clear_fmm_cache() def test_maxwell_boundary_fmm(helpers, grid, skip): """Test Maxwell boundary operators.""" if skip == "ci": pytest.skip() - rwg = bempp.api.function_space(grid, "RWG", 0) - snc = bempp.api.function_space(grid, "SNC", 0) + rwg = bempp_cl.api.function_space(grid, "RWG", 0) + snc = bempp_cl.api.function_space(grid, "SNC", 0) vec = helpers.load_npy_data("fmm_rwg_vec") wavenumber = 1.5 for filename, operator in [ - ("fmm_maxwell_electric", bempp.api.operators.boundary.maxwell.electric_field), - ("fmm_maxwell_magnetic", bempp.api.operators.boundary.maxwell.magnetic_field), + ("fmm_maxwell_electric", bempp_cl.api.operators.boundary.maxwell.electric_field), + ("fmm_maxwell_magnetic", bempp_cl.api.operators.boundary.maxwell.magnetic_field), ]: fmm = operator(rwg, rwg, snc, wavenumber, assembler="fmm").weak_form() dense = helpers.load_npy_data(filename) np.testing.assert_allclose(dense, fmm @ vec, rtol=TOL) - bempp.api.clear_fmm_cache() + bempp_cl.api.clear_fmm_cache() def test_maxwell_potential_fmm(helpers, grid, skip): """Test Maxwell potential operators.""" if skip == "ci": pytest.skip() - rwg = bempp.api.function_space(grid, "RWG", 0) + rwg = bempp_cl.api.function_space(grid, "RWG", 0) vec = helpers.load_npy_data("fmm_rwg_vec") - grid_fun = bempp.api.GridFunction(rwg, coefficients=vec) + grid_fun = bempp_cl.api.GridFunction(rwg, coefficients=vec) points = helpers.load_npy_data("fmm_potential_points") wavenumber = 1.5 for filename, operator in [ ( "fmm_maxwell_potential_electric", - bempp.api.operators.potential.maxwell.electric_field, + bempp_cl.api.operators.potential.maxwell.electric_field, ), ( "fmm_maxwell_potential_magnetic", - bempp.api.operators.potential.maxwell.magnetic_field, + bempp_cl.api.operators.potential.maxwell.magnetic_field, ), ]: fmm = operator(rwg, points, wavenumber, assembler="fmm").evaluate(grid_fun) dense = helpers.load_npy_data(filename) np.testing.assert_allclose(dense, fmm, rtol=TOL) - bempp.api.clear_fmm_cache() + bempp_cl.api.clear_fmm_cache() def test_fmm_two_grids_laplace(helpers, grid1, grid2): """Test the FMM for Laplace between two different grids.""" - p1_space1 = bempp.api.function_space(grid1, "P", 1) - p1_space2 = bempp.api.function_space(grid2, "P", 1) + p1_space1 = bempp_cl.api.function_space(grid1, "P", 1) + p1_space2 = bempp_cl.api.function_space(grid2, "P", 1) vec = helpers.load_npy_data("fmm_two_mesh_vec") for filename, operator in [ ( "fmm_two_mesh_laplace_single", - bempp.api.operators.boundary.laplace.single_layer, + bempp_cl.api.operators.boundary.laplace.single_layer, ), ( "fmm_two_mesh_laplace_hyper", - bempp.api.operators.boundary.laplace.hypersingular, + bempp_cl.api.operators.boundary.laplace.hypersingular, ), ]: fmm = operator(p1_space1, p1_space2, p1_space2, assembler="fmm").weak_form() dense = helpers.load_npy_data(filename) np.testing.assert_allclose(dense, fmm @ vec, rtol=TOL) - bempp.api.clear_fmm_cache() + bempp_cl.api.clear_fmm_cache() def test_maxwell_boundary_fmm_complex(helpers): """Test Maxwell boundary operators with complex wavenumber.""" rand = np.random.RandomState(0) - grid = bempp.api.shapes.regular_sphere(2) - space = bempp.api.function_space(grid, "RWG", 0) - dual_space = bempp.api.function_space(grid, "SNC", 0) + grid = bempp_cl.api.shapes.regular_sphere(2) + space = bempp_cl.api.function_space(grid, "RWG", 0) + dual_space = bempp_cl.api.function_space(grid, "SNC", 0) vec = rand.rand(space.global_dof_count) wavenumber = 1.5 + 0.5j for operator in [ - bempp.api.operators.boundary.maxwell.electric_field, - bempp.api.operators.boundary.maxwell.magnetic_field, + bempp_cl.api.operators.boundary.maxwell.electric_field, + bempp_cl.api.operators.boundary.maxwell.magnetic_field, ]: fmm = operator( space, space, dual_space, wavenumber, assembler="fmm" @@ -329,23 +329,23 @@ def test_maxwell_boundary_fmm_complex(helpers): np.testing.assert_allclose(dense @ vec, fmm @ vec, rtol=TOL) - bempp.api.clear_fmm_cache() + bempp_cl.api.clear_fmm_cache() def test_maxwell_potential_fmm_complex(helpers): """Test Maxwell boundary operators with complex wavenumber.""" rand = np.random.RandomState(0) - grid = bempp.api.shapes.regular_sphere(2) - space = bempp.api.function_space(grid, "RWG", 0) + grid = bempp_cl.api.shapes.regular_sphere(2) + space = bempp_cl.api.function_space(grid, "RWG", 0) vec = rand.rand(space.global_dof_count) - grid_fun = bempp.api.GridFunction(space, coefficients=vec) + grid_fun = bempp_cl.api.GridFunction(space, coefficients=vec) wavenumber = 1.5 + 0.5j points = np.array([2.0, 1.0, 0.0]).reshape(3, 1) for operator in [ - bempp.api.operators.potential.maxwell.electric_field, - bempp.api.operators.potential.maxwell.magnetic_field, + bempp_cl.api.operators.potential.maxwell.electric_field, + bempp_cl.api.operators.potential.maxwell.magnetic_field, ]: fmm = operator(space, points, wavenumber, assembler="fmm") dense = operator(space, points, wavenumber, assembler="dense") @@ -354,4 +354,4 @@ def test_maxwell_potential_fmm_complex(helpers): dense.evaluate(grid_fun), fmm.evaluate(grid_fun), rtol=TOL ) - bempp.api.clear_fmm_cache() + bempp_cl.api.clear_fmm_cache() diff --git a/test/validation/operators/boundary/test_helmholtz_boundary.py b/test/validation/operators/boundary/test_helmholtz_boundary.py index dc771fe8..96f1731d 100644 --- a/test/validation/operators/boundary/test_helmholtz_boundary.py +++ b/test/validation/operators/boundary/test_helmholtz_boundary.py @@ -16,8 +16,8 @@ def test_helmholtz_single_layer_p0( default_parameters, helpers, precision, device_interface ): """Test dense assembler for the Helmholtz slp with p0 basis.""" - from bempp.api import function_space - from bempp.api.operators.boundary.helmholtz import single_layer + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.helmholtz import single_layer grid = helpers.load_grid("sphere") @@ -44,8 +44,8 @@ def test_helmholtz_single_layer_p1_disc( default_parameters, helpers, precision, device_interface ): """Test dense assembler for the Helmholtz slp with disc. p1 basis.""" - from bempp.api.operators.boundary.helmholtz import single_layer - from bempp.api import function_space + from bempp_cl.api.operators.boundary.helmholtz import single_layer + from bempp_cl.api import function_space grid = helpers.load_grid("sphere") space = function_space(grid, "DP", 1) @@ -71,8 +71,8 @@ def test_helmholtz_single_layer_p1_p0( default_parameters, helpers, precision, device_interface ): """Test dense assembler for the slp with disc. p1/p0 basis.""" - from bempp.api.operators.boundary.helmholtz import single_layer - from bempp.api import function_space + from bempp_cl.api.operators.boundary.helmholtz import single_layer + from bempp_cl.api import function_space grid = helpers.load_grid("sphere") @@ -100,8 +100,8 @@ def test_helmholtz_single_layer_p0_p1( default_parameters, helpers, precision, device_interface ): """Test dense assembler for the slp with disc. p0/p1 basis.""" - from bempp.api.operators.boundary.helmholtz import single_layer - from bempp.api import function_space + from bempp_cl.api.operators.boundary.helmholtz import single_layer + from bempp_cl.api import function_space grid = helpers.load_grid("sphere") @@ -129,8 +129,8 @@ def test_helmholtz_single_layer_p1_cont( default_parameters, helpers, precision, device_interface ): """Test dense assembler for the Helmholtz slp with p1 basis.""" - from bempp.api import function_space - from bempp.api.operators.boundary.helmholtz import single_layer + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.helmholtz import single_layer grid = helpers.load_grid("sphere") @@ -157,8 +157,8 @@ def test_helmholtz_double_layer_p1_cont( default_parameters, helpers, precision, device_interface ): """Test dense assembler for the Helmholtz dlp with p1 basis.""" - from bempp.api import function_space - from bempp.api.operators.boundary.helmholtz import double_layer + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.helmholtz import double_layer grid = helpers.load_grid("sphere") @@ -185,8 +185,8 @@ def test_helmholtz_adjoint_double_layer_p1_cont( default_parameters, helpers, precision, device_interface ): """Test dense assembler for the Helmholtz adjoint dlp with p1 basis.""" - from bempp.api import function_space - from bempp.api.operators.boundary.helmholtz import adjoint_double_layer + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.helmholtz import adjoint_double_layer grid = helpers.load_grid("sphere") @@ -213,8 +213,8 @@ def test_helmholtz_hypersingular( default_parameters, helpers, precision, device_interface ): """Test dense assembler for the Helmholtz hypersingular operator.""" - from bempp.api import function_space - from bempp.api.operators.boundary.helmholtz import hypersingular + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.helmholtz import hypersingular grid = helpers.load_grid("sphere") diff --git a/test/validation/operators/boundary/test_laplace_boundary.py b/test/validation/operators/boundary/test_laplace_boundary.py index 6fd18c39..37feda18 100644 --- a/test/validation/operators/boundary/test_laplace_boundary.py +++ b/test/validation/operators/boundary/test_laplace_boundary.py @@ -13,8 +13,8 @@ def test_laplace_single_layer_p0( default_parameters, helpers, precision, device_interface ): """Test dense assembler for the Laplace slp with p0 basis.""" - from bempp.api import function_space - from bempp.api.operators.boundary.laplace import single_layer + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.laplace import single_layer grid = helpers.load_grid("sphere") @@ -40,8 +40,8 @@ def test_laplace_single_layer_p1_disc( default_parameters, helpers, precision, device_interface ): """Test dense assembler for the Laplace slp with disc. p1 basis.""" - from bempp.api.operators.boundary.laplace import single_layer - from bempp.api import function_space + from bempp_cl.api.operators.boundary.laplace import single_layer + from bempp_cl.api import function_space grid = helpers.load_grid("sphere") space = function_space(grid, "DP", 1) @@ -66,8 +66,8 @@ def test_laplace_single_layer_p1_p0( default_parameters, helpers, precision, device_interface ): """Test dense assembler for the slp with disc. p1/p0 basis.""" - from bempp.api.operators.boundary.laplace import single_layer - from bempp.api import function_space + from bempp_cl.api.operators.boundary.laplace import single_layer + from bempp_cl.api import function_space grid = helpers.load_grid("sphere") @@ -94,8 +94,8 @@ def test_laplace_single_layer_p0_p1( default_parameters, helpers, precision, device_interface ): """Test dense assembler for the slp with disc. p0/p1 basis.""" - from bempp.api.operators.boundary.laplace import single_layer - from bempp.api import function_space + from bempp_cl.api.operators.boundary.laplace import single_layer + from bempp_cl.api import function_space grid = helpers.load_grid("sphere") @@ -122,8 +122,8 @@ def test_laplace_single_layer_p1_cont( default_parameters, helpers, precision, device_interface ): """Test dense assembler for the Laplace slp with p1 basis.""" - from bempp.api import function_space - from bempp.api.operators.boundary.laplace import single_layer + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.laplace import single_layer grid = helpers.load_grid("sphere") @@ -149,8 +149,8 @@ def test_laplace_double_layer_p1_cont( default_parameters, helpers, precision, device_interface ): """Test dense assembler for the Laplace dlp with p1 basis.""" - from bempp.api import function_space - from bempp.api.operators.boundary.laplace import double_layer + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.laplace import double_layer grid = helpers.load_grid("sphere") @@ -176,8 +176,8 @@ def test_laplace_adjoint_double_layer_p1_cont( default_parameters, helpers, precision, device_interface ): """Test dense assembler for the Laplace adjoint dlp with p1 basis.""" - from bempp.api import function_space - from bempp.api.operators.boundary.laplace import adjoint_double_layer + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.laplace import adjoint_double_layer grid = helpers.load_grid("sphere") @@ -203,8 +203,8 @@ def test_laplace_hypersingular( default_parameters, helpers, precision, device_interface ): """Test dense assembler for the Laplace hypersingular operator.""" - from bempp.api import function_space - from bempp.api.operators.boundary.laplace import hypersingular + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.laplace import hypersingular grid = helpers.load_grid("sphere") @@ -231,8 +231,8 @@ def test_laplace_single_element_p0( default_parameters, helpers, precision, device_interface ): """Test dense assembler for the Laplace slp with p0 basis on the unit triangle.""" - from bempp.api import Grid, function_space - from bempp.api.operators.boundary.laplace import single_layer + from bempp_cl.api import Grid, function_space + from bempp_cl.api.operators.boundary.laplace import single_layer vertices = _np.array([[0, 0, 0], [1, 0, 0], [0, 1, 0]], dtype=_np.float64).T elements = _np.array([[0, 1, 2]]).T diff --git a/test/validation/operators/boundary/test_maxwell_boundary.py b/test/validation/operators/boundary/test_maxwell_boundary.py index 1c52774a..9bd9ff8f 100644 --- a/test/validation/operators/boundary/test_maxwell_boundary.py +++ b/test/validation/operators/boundary/test_maxwell_boundary.py @@ -13,8 +13,8 @@ def test_maxwell_electric_field_sphere( default_parameters, helpers, device_interface, precision ): """Test Maxwell electric field on sphere.""" - from bempp.api import function_space - from bempp.api.operators.boundary.maxwell import electric_field + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.maxwell import electric_field grid = helpers.load_grid("sphere") @@ -50,9 +50,9 @@ def test_maxwell_electric_field_rbc_bc_sphere( if skip == "ci": pytest.skip() - import bempp.api - from bempp.api import function_space - from bempp.api.operators.boundary.maxwell import electric_field + import bempp_cl.api + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.maxwell import electric_field grid = helpers.load_grid("sphere") @@ -62,7 +62,7 @@ def test_maxwell_electric_field_rbc_bc_sphere( rand = _np.random.RandomState(0) vec = rand.rand(space1.global_dof_count) - bempp.api.GLOBAL_PARAMETERS.fmm.dense_evaluation = True + bempp_cl.api.GLOBAL_PARAMETERS.fmm.dense_evaluation = True discrete_op = electric_field( space1, @@ -77,7 +77,7 @@ def test_maxwell_electric_field_rbc_bc_sphere( actual = discrete_op @ vec - bempp.api.GLOBAL_PARAMETERS.fmm.dense_evaluation = False + bempp_cl.api.GLOBAL_PARAMETERS.fmm.dense_evaluation = False if precision == "single": rtol = 5e-5 @@ -92,7 +92,7 @@ def test_maxwell_electric_field_rbc_bc_sphere( _np.testing.assert_allclose(actual, expected, rtol=rtol, atol=atol) - bempp.api.clear_fmm_cache() + bempp_cl.api.clear_fmm_cache() def test_maxwell_electric_field_bc_sphere( @@ -102,9 +102,9 @@ def test_maxwell_electric_field_bc_sphere( if skip == "ci": pytest.skip() - import bempp.api - from bempp.api import function_space - from bempp.api.operators.boundary.maxwell import electric_field + import bempp_cl.api + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.maxwell import electric_field grid = helpers.load_grid("sphere") @@ -114,7 +114,7 @@ def test_maxwell_electric_field_bc_sphere( rand = _np.random.RandomState(0) vec = rand.rand(space1.global_dof_count) - bempp.api.GLOBAL_PARAMETERS.fmm.dense_evaluation = True + bempp_cl.api.GLOBAL_PARAMETERS.fmm.dense_evaluation = True discrete_op = electric_field( space1, @@ -129,7 +129,7 @@ def test_maxwell_electric_field_bc_sphere( actual = discrete_op @ vec - bempp.api.GLOBAL_PARAMETERS.fmm.dense_evaluation = False + bempp_cl.api.GLOBAL_PARAMETERS.fmm.dense_evaluation = False if precision == "single": rtol = 1e-4 @@ -142,15 +142,15 @@ def test_maxwell_electric_field_bc_sphere( expected = mat @ vec _np.testing.assert_allclose(actual, expected, rtol=rtol, atol=atol) - bempp.api.clear_fmm_cache() + bempp_cl.api.clear_fmm_cache() def test_maxwell_magnetic_field_sphere( default_parameters, helpers, device_interface, precision ): """Test Maxwell magnetic field on sphere.""" - from bempp.api import function_space - from bempp.api.operators.boundary.maxwell import magnetic_field + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.maxwell import magnetic_field grid = helpers.load_grid("sphere") diff --git a/test/validation/operators/boundary/test_modified_helmholtz.py b/test/validation/operators/boundary/test_modified_helmholtz.py index 0c9806d1..6db59ae7 100644 --- a/test/validation/operators/boundary/test_modified_helmholtz.py +++ b/test/validation/operators/boundary/test_modified_helmholtz.py @@ -15,8 +15,8 @@ def test_modified_helmholtz_single_layer( default_parameters, helpers, precision, device_interface ): """Test dense assembler for modified Helmholtz.""" - from bempp.api import function_space - from bempp.api.operators.boundary.modified_helmholtz import single_layer + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.modified_helmholtz import single_layer grid = helpers.load_grid("sphere") @@ -46,8 +46,8 @@ def test_modified_helmholtz_double_layer_p1_cont( default_parameters, helpers, precision, device_interface ): """Test dense assembler for the modified Helmholtz dlp.""" - from bempp.api import function_space - from bempp.api.operators.boundary.modified_helmholtz import double_layer + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.modified_helmholtz import double_layer grid = helpers.load_grid("sphere") @@ -76,8 +76,8 @@ def test_modified_helmholtz_adjoint_double_layer( default_parameters, helpers, precision, device_interface ): """Test dense assembler for the Helmholtz adjoint dlp.""" - from bempp.api import function_space - from bempp.api.operators.boundary.modified_helmholtz import adjoint_double_layer + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.modified_helmholtz import adjoint_double_layer grid = helpers.load_grid("sphere") @@ -106,8 +106,8 @@ def test_modified_helmholtz_hypersingular( default_parameters, helpers, precision, device_interface ): """Test dense assembler for the modified Helmholtz hypersingular operator.""" - from bempp.api import function_space - from bempp.api.operators.boundary.modified_helmholtz import hypersingular + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.modified_helmholtz import hypersingular grid = helpers.load_grid("sphere") diff --git a/test/validation/operators/boundary/test_sparse.py b/test/validation/operators/boundary/test_sparse.py index 7db5b9a5..e75e6eb1 100644 --- a/test/validation/operators/boundary/test_sparse.py +++ b/test/validation/operators/boundary/test_sparse.py @@ -13,8 +13,8 @@ def test_sparse_identity_p0_p0( default_parameters, helpers, device_interface, precision ): """Test singular assembler for the sparse L^2 identity with p0/p0 basis.""" - from bempp.api import function_space - from bempp.api.operators.boundary.sparse import identity + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.sparse import identity grid = helpers.load_grid("sphere") expected = helpers.load_npy_data("sparse_identity_p0_p0") @@ -41,8 +41,8 @@ def test_sparse_identity_p0_p1( default_parameters, helpers, device_interface, precision ): """Test singular assembler for the sparse L^2 identity with p0/p1 basis.""" - from bempp.api import function_space - from bempp.api.operators.boundary.sparse import identity + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.sparse import identity grid = helpers.load_grid("sphere") expected = helpers.load_npy_data("sparse_identity_p0_p1") @@ -70,8 +70,8 @@ def test_sparse_identity_p1_p0( default_parameters, helpers, device_interface, precision ): """Test singular assembler for the sparse L^2 identity with p1/p0 basis.""" - from bempp.api import function_space - from bempp.api.operators.boundary.sparse import identity + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.sparse import identity grid = helpers.load_grid("sphere") expected = helpers.load_npy_data("sparse_identity_p1_p0") @@ -99,8 +99,8 @@ def test_sparse_identity_p1_p1( default_parameters, helpers, device_interface, precision ): """Test singular assembler for the sparse L^2 identity with p1/p1 basis.""" - from bempp.api import function_space - from bempp.api.operators.boundary.sparse import identity + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.sparse import identity grid = helpers.load_grid("sphere") expected = helpers.load_npy_data("sparse_identity_p1_p1") @@ -127,8 +127,8 @@ def test_sparse_identity_snc_rwg( default_parameters, helpers, device_interface, precision ): """Test singular assembler for the sparse L^2 identity with snc/rwg basis.""" - from bempp.api import function_space - from bempp.api.operators.boundary.sparse import identity + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.sparse import identity grid = helpers.load_grid("sphere") expected = helpers.load_npy_data("sparse_identity_snc_rwg") @@ -161,8 +161,8 @@ def test_sparse_identity_snc_bc( default_parameters, helpers, device_interface, precision ): """Test singular assembler for the sparse L^2 identity with snc/bc basis.""" - from bempp.api import function_space - from bempp.api.operators.boundary.sparse import identity + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.sparse import identity grid = helpers.load_grid("sphere") expected = helpers.load_npy_data("sparse_identity_snc_bc") @@ -195,8 +195,8 @@ def test_sparse_identity_bc_bc_on_screen( default_parameters, helpers, device_interface, precision ): """Test singular assembler for the sparse L^2 identity with p0/p0 basis.""" - from bempp.api import function_space - from bempp.api.operators.boundary.sparse import identity + from bempp_cl.api import function_space + from bempp_cl.api.operators.boundary.sparse import identity grid = helpers.load_grid("screen") expected = helpers.load_npy_data("sparse_identity_bc_bc_screen") diff --git a/test/validation/operators/far_field/test_helmholtz_far_field.py b/test/validation/operators/far_field/test_helmholtz_far_field.py index 7bddc8f8..86eeef54 100644 --- a/test/validation/operators/far_field/test_helmholtz_far_field.py +++ b/test/validation/operators/far_field/test_helmholtz_far_field.py @@ -15,9 +15,9 @@ def test_helmholtz_single_layer_far_field( default_parameters, helpers, device_interface, precision ): """Test Helmholtz slp far-field with p1 basis.""" - from bempp.api import function_space - from bempp.api import GridFunction - from bempp.api.operators.far_field.helmholtz import single_layer + from bempp_cl.api import function_space + from bempp_cl.api import GridFunction + from bempp_cl.api.operators.far_field.helmholtz import single_layer grid = helpers.load_grid("sphere") space = function_space(grid, "P", 1) @@ -48,9 +48,9 @@ def test_helmholtz_double_layer_potential_p1( default_parameters, helpers, device_interface, precision ): """Test Helmholtz dlp far field with p1 basis.""" - from bempp.api import function_space - from bempp.api import GridFunction - from bempp.api.operators.far_field.helmholtz import double_layer + from bempp_cl.api import function_space + from bempp_cl.api import GridFunction + from bempp_cl.api.operators.far_field.helmholtz import double_layer grid = helpers.load_grid("sphere") space = function_space(grid, "P", 1) @@ -81,13 +81,13 @@ def test_helmholtz_far_field_segments( default_parameters, helpers, device_interface, precision ): """Test Helmholtz far field on segments.""" - import bempp.api - from bempp.api import function_space - from bempp.api.operators.far_field.helmholtz import single_layer - from bempp.api.operators.far_field.helmholtz import double_layer - from bempp.api.grid.grid import grid_from_segments + import bempp_cl.api + from bempp_cl.api import function_space + from bempp_cl.api.operators.far_field.helmholtz import single_layer + from bempp_cl.api.operators.far_field.helmholtz import double_layer + from bempp_cl.api.grid.grid import grid_from_segments - grid = bempp.api.shapes.multitrace_cube() + grid = bempp_cl.api.shapes.multitrace_cube() seglists = [[1, 2, 3, 4, 5, 6], [6, 7, 8, 9, 10, 11]] swapped_normal_lists = [{}, {6}] @@ -112,8 +112,8 @@ def test_helmholtz_far_field_segments( ) space2 = function_space(new_grid, "P", 1, swapped_normals=swapped_normals) - fun1 = bempp.api.GridFunction(space1, coefficients=coeffs) - fun2 = bempp.api.GridFunction(space2, coefficients=coeffs) + fun1 = bempp_cl.api.GridFunction(space1, coefficients=coeffs) + fun2 = bempp_cl.api.GridFunction(space2, coefficients=coeffs) actual = ( op( @@ -145,13 +145,13 @@ def test_helmholtz_far_field_complex_coeffs( default_parameters, helpers, device_interface, precision ): """Test Helmholtz far field ops with complex coefficients.""" - import bempp.api - from bempp.api.operators.far_field.helmholtz import single_layer - from bempp.api.operators.far_field.helmholtz import double_layer + import bempp_cl.api + from bempp_cl.api.operators.far_field.helmholtz import single_layer + from bempp_cl.api.operators.far_field.helmholtz import double_layer - grid = bempp.api.shapes.regular_sphere(3) + grid = bempp_cl.api.shapes.regular_sphere(3) - space = bempp.api.function_space(grid, "P", 1) + space = bempp_cl.api.function_space(grid, "P", 1) random = _np.random.RandomState(0) @@ -162,9 +162,9 @@ def test_helmholtz_far_field_complex_coeffs( coeffs_imag = random.rand(grid.number_of_vertices) coeffs = coeffs_real + 1j * coeffs_imag - fun_real = bempp.api.GridFunction(space, coefficients=coeffs_real) - fun_imag = bempp.api.GridFunction(space, coefficients=coeffs_imag) - fun = bempp.api.GridFunction(space, coefficients=coeffs) + fun_real = bempp_cl.api.GridFunction(space, coefficients=coeffs_real) + fun_imag = bempp_cl.api.GridFunction(space, coefficients=coeffs_imag) + fun = bempp_cl.api.GridFunction(space, coefficients=coeffs) for op in [single_layer, double_layer]: far_field_op = op( @@ -187,13 +187,13 @@ def test_helmholtz_far_field_segments_complex_coeffs( default_parameters, helpers, device_interface, precision ): """Test Maxwell potentials on segments with complex coeffs.""" - import bempp.api - from bempp.api import function_space - from bempp.api.operators.far_field.helmholtz import single_layer - from bempp.api.operators.far_field.helmholtz import double_layer - from bempp.api.grid.grid import grid_from_segments + import bempp_cl.api + from bempp_cl.api import function_space + from bempp_cl.api.operators.far_field.helmholtz import single_layer + from bempp_cl.api.operators.far_field.helmholtz import double_layer + from bempp_cl.api.grid.grid import grid_from_segments - grid = bempp.api.shapes.multitrace_cube() + grid = bempp_cl.api.shapes.multitrace_cube() seglists = [[1, 2, 3, 4, 5, 6], [6, 7, 8, 9, 10, 11]] swapped_normal_lists = [{}, {6}] @@ -220,8 +220,8 @@ def test_helmholtz_far_field_segments_complex_coeffs( ) space2 = function_space(new_grid, "P", 1, swapped_normals=swapped_normals) - fun1 = bempp.api.GridFunction(space1, coefficients=coeffs) - fun2 = bempp.api.GridFunction(space2, coefficients=coeffs) + fun1 = bempp_cl.api.GridFunction(space1, coefficients=coeffs) + fun2 = bempp_cl.api.GridFunction(space2, coefficients=coeffs) actual = ( op( diff --git a/test/validation/operators/far_field/test_maxwell_far_field.py b/test/validation/operators/far_field/test_maxwell_far_field.py index 52fa69b7..0cee44f0 100644 --- a/test/validation/operators/far_field/test_maxwell_far_field.py +++ b/test/validation/operators/far_field/test_maxwell_far_field.py @@ -15,9 +15,9 @@ def test_maxwell_electric_far_field( default_parameters, helpers, device_interface, precision ): """Test Maxwell electric far field.""" - from bempp.api import function_space - from bempp.api import GridFunction - from bempp.api.operators.far_field.maxwell import electric_field + from bempp_cl.api import function_space + from bempp_cl.api import GridFunction + from bempp_cl.api.operators.far_field.maxwell import electric_field grid = helpers.load_grid("sphere") space = function_space(grid, "RWG", 0) @@ -48,9 +48,9 @@ def test_maxwell_magnetic_far_field( default_parameters, helpers, device_interface, precision ): """Test Maxwell magnetic far field.""" - from bempp.api import function_space - from bempp.api import GridFunction - from bempp.api.operators.far_field.maxwell import magnetic_field + from bempp_cl.api import function_space + from bempp_cl.api import GridFunction + from bempp_cl.api.operators.far_field.maxwell import magnetic_field grid = helpers.load_grid("sphere") space = function_space(grid, "RWG", 0) @@ -81,13 +81,13 @@ def test_maxwell_far_field_segments( default_parameters, helpers, device_interface, precision ): """Test Maxwell far field on segments.""" - import bempp.api - from bempp.api import function_space - from bempp.api.operators.far_field.maxwell import electric_field - from bempp.api.operators.far_field.maxwell import magnetic_field - from bempp.api.grid.grid import grid_from_segments + import bempp_cl.api + from bempp_cl.api import function_space + from bempp_cl.api.operators.far_field.maxwell import electric_field + from bempp_cl.api.operators.far_field.maxwell import magnetic_field + from bempp_cl.api.grid.grid import grid_from_segments - grid = bempp.api.shapes.multitrace_cube() + grid = bempp_cl.api.shapes.multitrace_cube() seglists = [[1, 2, 3, 4, 5, 6], [6, 7, 8, 9, 10, 11]] swapped_normal_lists = [{}, {6}] @@ -112,8 +112,8 @@ def test_maxwell_far_field_segments( ) space2 = function_space(new_grid, "RWG", 0, swapped_normals=swapped_normals) - fun1 = bempp.api.GridFunction(space1, coefficients=coeffs) - fun2 = bempp.api.GridFunction(space2, coefficients=coeffs) + fun1 = bempp_cl.api.GridFunction(space1, coefficients=coeffs) + fun2 = bempp_cl.api.GridFunction(space2, coefficients=coeffs) actual = ( op( @@ -147,13 +147,13 @@ def test_maxwell_far_field_complex_coeffs( default_parameters, helpers, device_interface, precision ): """Test Maxwell far field ops with complex coefficients.""" - import bempp.api - from bempp.api.operators.far_field.maxwell import electric_field - from bempp.api.operators.far_field.maxwell import magnetic_field + import bempp_cl.api + from bempp_cl.api.operators.far_field.maxwell import electric_field + from bempp_cl.api.operators.far_field.maxwell import magnetic_field - grid = bempp.api.shapes.regular_sphere(2) + grid = bempp_cl.api.shapes.regular_sphere(2) - space = bempp.api.function_space(grid, "RWG", 0) + space = bempp_cl.api.function_space(grid, "RWG", 0) random = _np.random.RandomState(0) @@ -164,9 +164,9 @@ def test_maxwell_far_field_complex_coeffs( coeffs_imag = random.rand(grid.number_of_edges) coeffs = coeffs_real + 1j * coeffs_imag - fun_real = bempp.api.GridFunction(space, coefficients=coeffs_real) - fun_imag = bempp.api.GridFunction(space, coefficients=coeffs_imag) - fun = bempp.api.GridFunction(space, coefficients=coeffs) + fun_real = bempp_cl.api.GridFunction(space, coefficients=coeffs_real) + fun_imag = bempp_cl.api.GridFunction(space, coefficients=coeffs_imag) + fun = bempp_cl.api.GridFunction(space, coefficients=coeffs) for op in [electric_field, magnetic_field]: far_field_op = op( @@ -190,13 +190,13 @@ def test_maxwell_far_field_segments_complex_coeffs( default_parameters, helpers, device_interface, precision ): """Test Maxwell potentials on segments with complex coeffs.""" - import bempp.api - from bempp.api import function_space - from bempp.api.operators.far_field.maxwell import electric_field - from bempp.api.operators.far_field.maxwell import magnetic_field - from bempp.api.grid.grid import grid_from_segments + import bempp_cl.api + from bempp_cl.api import function_space + from bempp_cl.api.operators.far_field.maxwell import electric_field + from bempp_cl.api.operators.far_field.maxwell import magnetic_field + from bempp_cl.api.grid.grid import grid_from_segments - grid = bempp.api.shapes.multitrace_cube() + grid = bempp_cl.api.shapes.multitrace_cube() seglists = [[1, 2, 3, 4, 5, 6], [6, 7, 8, 9, 10, 11]] swapped_normal_lists = [{}, {6}] @@ -224,8 +224,8 @@ def test_maxwell_far_field_segments_complex_coeffs( ) space2 = function_space(new_grid, "RWG", 0, swapped_normals=swapped_normals) - fun1 = bempp.api.GridFunction(space1, coefficients=coeffs) - fun2 = bempp.api.GridFunction(space2, coefficients=coeffs) + fun1 = bempp_cl.api.GridFunction(space1, coefficients=coeffs) + fun2 = bempp_cl.api.GridFunction(space2, coefficients=coeffs) actual = ( op( diff --git a/test/validation/operators/potential/test_helmholtz.py b/test/validation/operators/potential/test_helmholtz.py index fef38579..b3dfd96d 100644 --- a/test/validation/operators/potential/test_helmholtz.py +++ b/test/validation/operators/potential/test_helmholtz.py @@ -15,9 +15,9 @@ def test_helmholtz_single_layer_potential_p1( default_parameters, helpers, device_interface, precision ): """Test Helmholtz slp potential with p1 basis.""" - from bempp.api import function_space - from bempp.api import GridFunction - from bempp.api.operators.potential.helmholtz import single_layer + from bempp_cl.api import function_space + from bempp_cl.api import GridFunction + from bempp_cl.api.operators.potential.helmholtz import single_layer grid = helpers.load_grid("sphere") space = function_space(grid, "P", 1) @@ -48,9 +48,9 @@ def test_helmholtz_double_layer_potential_p1( default_parameters, helpers, device_interface, precision ): """Test Helmholtz dlp potential with p1 basis.""" - from bempp.api import function_space - from bempp.api import GridFunction - from bempp.api.operators.potential.helmholtz import double_layer + from bempp_cl.api import function_space + from bempp_cl.api import GridFunction + from bempp_cl.api.operators.potential.helmholtz import double_layer grid = helpers.load_grid("sphere") space = function_space(grid, "P", 1) @@ -81,9 +81,9 @@ def test_helmholtz_single_layer_potential_p1_complex_coeffs( default_parameters, helpers, device_interface, precision ): """Test Helmholtz slp potential with p1 basis and complex coeffs.""" - from bempp.api import function_space - from bempp.api import GridFunction - from bempp.api.operators.potential.helmholtz import single_layer + from bempp_cl.api import function_space + from bempp_cl.api import GridFunction + from bempp_cl.api.operators.potential.helmholtz import single_layer grid = helpers.load_grid("sphere") space = function_space(grid, "P", 1) @@ -120,13 +120,13 @@ def test_helmholtz_potentials_segments( default_parameters, helpers, device_interface, precision ): """Test Helmholtz potentials on segments.""" - import bempp.api - from bempp.api import function_space - from bempp.api.operators.potential.helmholtz import single_layer - from bempp.api.operators.potential.helmholtz import double_layer - from bempp.api.grid.grid import grid_from_segments + import bempp_cl.api + from bempp_cl.api import function_space + from bempp_cl.api.operators.potential.helmholtz import single_layer + from bempp_cl.api.operators.potential.helmholtz import double_layer + from bempp_cl.api.grid.grid import grid_from_segments - grid = bempp.api.shapes.multitrace_cube() + grid = bempp_cl.api.shapes.multitrace_cube() seglists = [[1, 2, 3, 4, 5, 6], [6, 7, 8, 9, 10, 11]] swapped_normal_lists = [{}, {6}] @@ -150,8 +150,8 @@ def test_helmholtz_potentials_segments( space2 = function_space(new_grid, "P", 1, swapped_normals=swapped_normals) points = _np.array([2.3, 1.3, 1.5]).reshape(3, 1) + rand.rand(3, 5) - fun1 = bempp.api.GridFunction(space1, coefficients=coeffs) - fun2 = bempp.api.GridFunction(space2, coefficients=coeffs) + fun1 = bempp_cl.api.GridFunction(space1, coefficients=coeffs) + fun2 = bempp_cl.api.GridFunction(space2, coefficients=coeffs) actual = op(space1, points, 2.5) * fun1 expected = op(space2, points, 2.5) * fun2 @@ -165,13 +165,13 @@ def test_helmholtz_potentials_segments_complex_coeffs( default_parameters, helpers, device_interface, precision ): """Test Helmholtz potentials on segments with complex coeffs.""" - import bempp.api - from bempp.api import function_space - from bempp.api.operators.potential.helmholtz import single_layer - from bempp.api.operators.potential.helmholtz import double_layer - from bempp.api.grid.grid import grid_from_segments + import bempp_cl.api + from bempp_cl.api import function_space + from bempp_cl.api.operators.potential.helmholtz import single_layer + from bempp_cl.api.operators.potential.helmholtz import double_layer + from bempp_cl.api.grid.grid import grid_from_segments - grid = bempp.api.shapes.multitrace_cube() + grid = bempp_cl.api.shapes.multitrace_cube() seglists = [[1, 2, 3, 4, 5, 6], [6, 7, 8, 9, 10, 11]] swapped_normal_lists = [{}, {6}] @@ -197,8 +197,8 @@ def test_helmholtz_potentials_segments_complex_coeffs( space2 = function_space(new_grid, "P", 1, swapped_normals=swapped_normals) points = _np.array([2.3, 1.3, 1.5]).reshape(3, 1) + rand.rand(3, 5) - fun1 = bempp.api.GridFunction(space1, coefficients=coeffs) - fun2 = bempp.api.GridFunction(space2, coefficients=coeffs) + fun1 = bempp_cl.api.GridFunction(space1, coefficients=coeffs) + fun2 = bempp_cl.api.GridFunction(space2, coefficients=coeffs) actual = op(space1, points, 2.5) * fun1 expected = op(space2, points, 2.5) * fun2 diff --git a/test/validation/operators/potential/test_laplace.py b/test/validation/operators/potential/test_laplace.py index 19bdf27c..f015948e 100644 --- a/test/validation/operators/potential/test_laplace.py +++ b/test/validation/operators/potential/test_laplace.py @@ -13,9 +13,9 @@ def test_laplace_single_layer_potential_p0( default_parameters, helpers, device_interface, precision ): """Test Laplace slp potential with p0 basis.""" - from bempp.api import function_space - from bempp.api import GridFunction - from bempp.api.operators.potential.laplace import single_layer + from bempp_cl.api import function_space + from bempp_cl.api import GridFunction + from bempp_cl.api.operators.potential.laplace import single_layer grid = helpers.load_grid("sphere") space = function_space(grid, "DP", 0) @@ -45,9 +45,9 @@ def test_laplace_single_layer_potential_p1( default_parameters, helpers, device_interface, precision ): """Test Laplace slp potential with p1 basis.""" - from bempp.api import function_space - from bempp.api import GridFunction - from bempp.api.operators.potential.laplace import single_layer + from bempp_cl.api import function_space + from bempp_cl.api import GridFunction + from bempp_cl.api.operators.potential.laplace import single_layer grid = helpers.load_grid("sphere") space = function_space(grid, "P", 1) @@ -77,9 +77,9 @@ def test_laplace_double_layer_potential_p1( default_parameters, helpers, device_interface, precision ): """Test Laplace dlp potential with p1 basis.""" - from bempp.api import function_space - from bempp.api import GridFunction - from bempp.api.operators.potential.laplace import double_layer + from bempp_cl.api import function_space + from bempp_cl.api import GridFunction + from bempp_cl.api.operators.potential.laplace import double_layer grid = helpers.load_grid("sphere") space = function_space(grid, "P", 1) @@ -109,9 +109,9 @@ def test_laplace_single_layer_potential_p1_complex( default_parameters, helpers, device_interface, precision ): """Test Laplace slp potential with p1 basis and complex coeffs.""" - from bempp.api import function_space - from bempp.api import GridFunction - from bempp.api.operators.potential.laplace import single_layer + from bempp_cl.api import function_space + from bempp_cl.api import GridFunction + from bempp_cl.api.operators.potential.laplace import single_layer grid = helpers.load_grid("sphere") space = function_space(grid, "P", 1) @@ -146,10 +146,10 @@ def test_laplace_single_layer_potential_p1_complex( def test_laplace_p1_segments(default_parameters, helpers, device_interface, precision): """Test P1 potential evaluation on segments.""" - from bempp.api.shapes import cube - from bempp.api import function_space - from bempp.api import GridFunction - from bempp.api.operators.potential.laplace import single_layer + from bempp_cl.api.shapes import cube + from bempp_cl.api import function_space + from bempp_cl.api import GridFunction + from bempp_cl.api.operators.potential.laplace import single_layer grid = cube() seg1 = function_space(grid, "P", 1, segments=[1, 2, 3], include_boundary_dofs=False) @@ -212,10 +212,10 @@ def test_laplace_p1_segments_complex_coeffs( ): """Test P1 potential evaluation on segments with complex coeffs.""" - from bempp.api.shapes import cube - from bempp.api import function_space - from bempp.api import GridFunction - from bempp.api.operators.potential.laplace import single_layer + from bempp_cl.api.shapes import cube + from bempp_cl.api import function_space + from bempp_cl.api import GridFunction + from bempp_cl.api.operators.potential.laplace import single_layer grid = cube() seg1 = function_space(grid, "P", 1, segments=[1, 2, 3], include_boundary_dofs=False) diff --git a/test/validation/operators/potential/test_maxwell.py b/test/validation/operators/potential/test_maxwell.py index cf010a6d..348ea596 100644 --- a/test/validation/operators/potential/test_maxwell.py +++ b/test/validation/operators/potential/test_maxwell.py @@ -16,9 +16,9 @@ def test_maxwell_electric_field_potential_complex( default_parameters, helpers, device_interface, precision ): """Test Maxwell efield potential with complex wavenumber.""" - from bempp.api import function_space - from bempp.api import GridFunction - from bempp.api.operators.potential.maxwell import electric_field + from bempp_cl.api import function_space + from bempp_cl.api import GridFunction + from bempp_cl.api.operators.potential.maxwell import electric_field grid = helpers.load_grid("sphere") space = function_space(grid, "RWG", 0) @@ -49,9 +49,9 @@ def test_maxwell_electric_field_potential_rwg( default_parameters, helpers, device_interface, precision ): """Test Maxwell efield potential.""" - from bempp.api import function_space - from bempp.api import GridFunction - from bempp.api.operators.potential.maxwell import electric_field + from bempp_cl.api import function_space + from bempp_cl.api import GridFunction + from bempp_cl.api.operators.potential.maxwell import electric_field grid = helpers.load_grid("sphere") space = function_space(grid, "RWG", 0) @@ -82,9 +82,9 @@ def test_maxwell_magnetic_field_potential_rwg( default_parameters, helpers, device_interface, precision ): """Test Maxwell magnetic potential.""" - from bempp.api import function_space - from bempp.api import GridFunction - from bempp.api.operators.potential.maxwell import magnetic_field + from bempp_cl.api import function_space + from bempp_cl.api import GridFunction + from bempp_cl.api.operators.potential.maxwell import magnetic_field grid = helpers.load_grid("sphere") space = function_space(grid, "RWG", 0) @@ -115,9 +115,9 @@ def test_maxwell_magnetic_field_potential_complex( default_parameters, helpers, device_interface, precision ): """Test Maxwell magnetic potential with complex wavenumber.""" - from bempp.api import function_space - from bempp.api import GridFunction - from bempp.api.operators.potential.maxwell import magnetic_field + from bempp_cl.api import function_space + from bempp_cl.api import GridFunction + from bempp_cl.api.operators.potential.maxwell import magnetic_field grid = helpers.load_grid("sphere") space = function_space(grid, "RWG", 0) @@ -147,14 +147,14 @@ def test_maxwell_magnetic_field_potential_complex( # def test_maxwell_potentials_segments( # default_parameters, helpers, device_interface, precision): # """Test Maxwell potentials on segments.""" -# import bempp.api -# from bempp.api import function_space -# from bempp.api import GridFunction -# from bempp.api.operators.potential.maxwell import electric_field -# from bempp.api.operators.potential.maxwell import magnetic_field -# from bempp.api.grid.grid import grid_from_segments +# import bempp_cl.api +# from bempp_cl.api import function_space +# from bempp_cl.api import GridFunction +# from bempp_cl.api.operators.potential.maxwell import electric_field +# from bempp_cl.api.operators.potential.maxwell import magnetic_field +# from bempp_cl.api.grid.grid import grid_from_segments -# grid = bempp.api.shapes.multitrace_cube() +# grid = bempp_cl.api.shapes.multitrace_cube() # seglists = [[1, 2, 3, 4, 5, 6], [6, 7, 8, 9, 10, 11]] # swapped_normal_lists = [{}, {6}] @@ -172,8 +172,8 @@ def test_maxwell_magnetic_field_potential_complex( # space2 = function_space(new_grid, "RWG", 0, swapped_normals=swapped_normals) # points = _np.array([2.3, 1.3, 1.5]).reshape(3, 1) + rand.rand(3, 5) -# fun1 = bempp.api.GridFunction(space1, coefficients=coeffs) -# fun2 = bempp.api.GridFunction(space2, coefficients=coeffs) +# fun1 = bempp_cl.api.GridFunction(space1, coefficients=coeffs) +# fun2 = bempp_cl.api.GridFunction(space2, coefficients=coeffs) # actual = op(space1, points, 2.5) * fun1 # expected = op(space2, points, 2.5) * fun2 @@ -185,14 +185,14 @@ def test_maxwell_magnetic_field_potential_complex( # def test_maxwell_potentials_segments_complex_coeffs( # default_parameters, helpers, device_interface, precision): # """Test Maxwell potentials on segments with complex coeffs.""" -# import bempp.api -# from bempp.api import function_space -# from bempp.api import GridFunction -# from bempp.api.operators.potential.maxwell import electric_field -# from bempp.api.operators.potential.maxwell import magnetic_field -# from bempp.api.grid.grid import grid_from_segments +# import bempp_cl.api +# from bempp_cl.api import function_space +# from bempp_cl.api import GridFunction +# from bempp_cl.api.operators.potential.maxwell import electric_field +# from bempp_cl.api.operators.potential.maxwell import magnetic_field +# from bempp_cl.api.grid.grid import grid_from_segments -# grid = bempp.api.shapes.multitrace_cube() +# grid = bempp_cl.api.shapes.multitrace_cube() # seglists = [[1, 2, 3, 4, 5, 6], [6, 7, 8, 9, 10, 11]] # swapped_normal_lists = [{}, {6}] @@ -210,8 +210,8 @@ def test_maxwell_magnetic_field_potential_complex( # space2 = function_space(new_grid, "RWG", 0, swapped_normals=swapped_normals) # points = _np.array([2.3, 1.3, 1.5]).reshape(3, 1) + rand.rand(3, 5) -# fun1 = bempp.api.GridFunction(space1, coefficients=coeffs) -# fun2 = bempp.api.GridFunction(space2, coefficients=coeffs) +# fun1 = bempp_cl.api.GridFunction(space1, coefficients=coeffs) +# fun2 = bempp_cl.api.GridFunction(space2, coefficients=coeffs) # actual = op(space1, points, 2.5) * fun1 # expected = op(space2, points, 2.5) * fun2