def test_helmholtz_single_layer(has_exafmm, wavenumber): """Test dense assembler for the Laplace operators.""" 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) 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(space, coefficients=np.random.rand( space.global_dof_count)) assert np.allclose((op1 * fun).coefficients, (op2 * fun).coefficients) bempp.api.clear_fmm_cache()
def test_helmholtz_single_layer(wavenumber): """Test dense assembler for the Laplace operators.""" grid = bempp.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( space, coefficients=np.random.rand(space.global_dof_count) ) assert np.allclose((op1 * fun).coefficients, (op2 * fun).coefficients) bempp.api.clear_fmm_cache()
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 grid = helpers.load_grid("sphere") space0 = function_space(grid, "DP", 0) space1 = function_space(grid, "DP", 1) discrete_op = single_layer( space1, space1, space0, WAVENUMBER, assembler="dense", precision=precision, device_interface=device_interface, parameters=default_parameters, ).weak_form() expected = helpers.load_npy_data("helmholtz_single_layer_boundary_p0_dp1") _np.testing.assert_allclose(discrete_op.to_dense(), expected, rtol=helpers.default_tolerance(precision))