Skip to content

Commit

Permalink
Merge branch 'mscroggs/refactor-assembly2' into mscroggs/more-refacto…
Browse files Browse the repository at this point in the history
…r-maybe and finish
  • Loading branch information
mscroggs committed Aug 21, 2024
2 parents 1e3146d + 745de17 commit 7d69224
Show file tree
Hide file tree
Showing 11 changed files with 220 additions and 215 deletions.
2 changes: 1 addition & 1 deletion benches/assembly_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub fn assembly_parts_benchmark(c: &mut Criterion) {
let mut matrix = rlst_dynamic_array2!(f64, [space.global_size(), space.global_size()]);

let colouring = space.cell_colouring();
let mut a = boundary::SingleLayerAssembler::<f64, _>::new_laplace();
let mut a = BoundaryAssembler::<f64, _, _>::new_laplace_single_layer();
a.quadrature_degree(ReferenceCellType::Triangle, 16);
a.singular_quadrature_degree(
(ReferenceCellType::Triangle, ReferenceCellType::Triangle),
Expand Down
4 changes: 2 additions & 2 deletions examples/assembly.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bempp::assembly::{boundary, boundary::BoundaryAssembler};
use bempp::assembly::boundary::BoundaryAssembler;
use bempp::function::SerialFunctionSpace;
use bempp::traits::{BoundaryAssembly, FunctionSpace};
use ndelement::ciarlet::LagrangeElementFamily;
Expand All @@ -17,7 +17,7 @@ fn main() {
let mut matrix = rlst_dynamic_array2!(f64, [ndofs, ndofs]);

// Create an assembler for the Laplace single layer operator
let mut a = boundary::SingleLayerAssembler::<f64, _>::new_laplace();
let mut a = BoundaryAssembler::<f64, _, _>::new_laplace_single_layer();

// Adjust the quadrature degree for non-singular integrals on a triangle.
// This makes the integrals use a quadrature rule with 16 points
Expand Down
2 changes: 1 addition & 1 deletion examples/test_parallel_assembly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ fn test_parallel_assembly_single_element_grid<C: Communicator>(
let element = LagrangeElementFamily::<f64>::new(degree, cont);
let space = ParallelFunctionSpace::new(&grid, &element);

let a = boundary::SingleLayerAssembler::<f64, _>::new_laplace();
let a = BoundaryAssembler::<f64, _, _>::new_laplace_single_layer();

let matrix = a.parallel_assemble_singular_into_csr(&space, &space);

Expand Down
156 changes: 73 additions & 83 deletions src/assembly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,24 +121,14 @@ mod test {
//};
}
macro_rules! create_assembler {
(Laplace, Hypersingular, $dtype:ident) => {
paste! {
boundary::HypersingularAssembler::<[<$dtype>], _, _>::new_laplace()
}
};
(Helmholtz, Hypersingular, $dtype:ident) => {
paste! {
boundary::HypersingularAssembler::<[<$dtype>], _, _>::new_helmholtz(3.0)
}
};
(Laplace, $operator:ident, $dtype:ident) => {
paste! {
boundary::[<$operator Assembler>]::<[<$dtype>], _>::new_laplace()
boundary::BoundaryAssembler::<[<$dtype>], _, _>::[<new_laplace_ $operator>]()
}
};
(Helmholtz, $operator:ident, $dtype:ident) => {
paste! {
boundary::[<$operator Assembler>]::<[<$dtype>], _>::new_helmholtz(3.0)
boundary::BoundaryAssembler::<[<$dtype>], _, _>::[<new_helmholtz_ $operator>](3.0)
}
};
}
Expand Down Expand Up @@ -169,76 +159,76 @@ mod test {
}

test_assembly!(
(f64, Laplace, SingleLayer, Triangle),
(f32, Laplace, SingleLayer, Triangle),
//(c64, Laplace, SingleLayer, Triangle),
//(c32, Laplace, SingleLayer, Triangle),
(f64, Laplace, DoubleLayer, Triangle),
(f32, Laplace, DoubleLayer, Triangle),
//(c64, Laplace, DoubleLayer, Triangle),
//(c32, Laplace, DoubleLayer, Triangle),
(f64, Laplace, AdjointDoubleLayer, Triangle),
(f32, Laplace, AdjointDoubleLayer, Triangle),
//(c64, Laplace, AdjointDoubleLayer, Triangle),
//(c32, Laplace, AdjointDoubleLayer, Triangle),
(f64, Laplace, Hypersingular, Triangle),
(f32, Laplace, Hypersingular, Triangle),
//(c64, Laplace, Hypersingular, Triangle),
//(c32, Laplace, Hypersingular, Triangle),
(c64, Helmholtz, SingleLayer, Triangle),
(c32, Helmholtz, SingleLayer, Triangle),
(c64, Helmholtz, DoubleLayer, Triangle),
(c32, Helmholtz, DoubleLayer, Triangle),
(c64, Helmholtz, AdjointDoubleLayer, Triangle),
(c32, Helmholtz, AdjointDoubleLayer, Triangle),
(c64, Helmholtz, Hypersingular, Triangle),
(c32, Helmholtz, Hypersingular, Triangle),
(f64, Laplace, SingleLayer, Quadrilateral),
(f32, Laplace, SingleLayer, Quadrilateral),
//(c64, Laplace, SingleLayer, Quadrilateral),
//(c32, Laplace, SingleLayer, Quadrilateral),
(f64, Laplace, DoubleLayer, Quadrilateral),
(f32, Laplace, DoubleLayer, Quadrilateral),
//(c64, Laplace, DoubleLayer, Quadrilateral),
//(c32, Laplace, DoubleLayer, Quadrilateral),
(f64, Laplace, AdjointDoubleLayer, Quadrilateral),
(f32, Laplace, AdjointDoubleLayer, Quadrilateral),
//(c64, Laplace, AdjointDoubleLayer, Quadrilateral),
//(c32, Laplace, AdjointDoubleLayer, Quadrilateral),
(f64, Laplace, Hypersingular, Quadrilateral),
(f32, Laplace, Hypersingular, Quadrilateral),
//(c64, Laplace, Hypersingular, Quadrilateral),
//(c32, Laplace, Hypersingular, Quadrilateral),
(c64, Helmholtz, SingleLayer, Quadrilateral),
(c32, Helmholtz, SingleLayer, Quadrilateral),
(c64, Helmholtz, DoubleLayer, Quadrilateral),
(c32, Helmholtz, DoubleLayer, Quadrilateral),
(c64, Helmholtz, AdjointDoubleLayer, Quadrilateral),
(c32, Helmholtz, AdjointDoubleLayer, Quadrilateral),
(c64, Helmholtz, Hypersingular, Quadrilateral),
(c32, Helmholtz, Hypersingular, Quadrilateral) //(f64, Laplace, SingleLayer, Mixed),
//(f32, Laplace, SingleLayer, Mixed),
//(c64, Laplace, SingleLayer, Mixed),
//(c32, Laplace, SingleLayer, Mixed),
//(f64, Laplace, DoubleLayer, Mixed),
//(f32, Laplace, DoubleLayer, Mixed),
//(c64, Laplace, DoubleLayer, Mixed),
//(c32, Laplace, DoubleLayer, Mixed),
//(f64, Laplace, AdjointDoubleLayer, Mixed),
//(f32, Laplace, AdjointDoubleLayer, Mixed),
//(c64, Laplace, AdjointDoubleLayer, Mixed),
//(c32, Laplace, AdjointDoubleLayer, Mixed),
//(f64, Laplace, Hypersingular, Mixed),
//(f32, Laplace, Hypersingular, Mixed),
//(c64, Laplace, Hypersingular, Mixed),
//(c32, Laplace, Hypersingular, Mixed),
//(c64, Helmholtz, SingleLayer, Mixed),
//(c32, Helmholtz, SingleLayer, Mixed),
//(c64, Helmholtz, DoubleLayer, Mixed),
//(c32, Helmholtz, DoubleLayer, Mixed),
//(c64, Helmholtz, AdjointDoubleLayer, Mixed),
//(c32, Helmholtz, AdjointDoubleLayer, Mixed),
//(c64, Helmholtz, Hypersingular, Mixed),
//(c32, Helmholtz, Hypersingular, Mixed)
(f64, Laplace, single_layer, Triangle),
(f32, Laplace, single_layer, Triangle),
//(c64, Laplace, single_layer, Triangle),
//(c32, Laplace, single_layer, Triangle),
(f64, Laplace, double_layer, Triangle),
(f32, Laplace, double_layer, Triangle),
//(c64, Laplace, double_layer, Triangle),
//(c32, Laplace, double_layer, Triangle),
(f64, Laplace, adjoint_double_layer, Triangle),
(f32, Laplace, adjoint_double_layer, Triangle),
//(c64, Laplace, adjoint_double_layer, Triangle),
//(c32, Laplace, adjoint_double_layer, Triangle),
(f64, Laplace, hypersingular, Triangle),
(f32, Laplace, hypersingular, Triangle),
//(c64, Laplace, hypersingular, Triangle),
//(c32, Laplace, hypersingular, Triangle),
(c64, Helmholtz, single_layer, Triangle),
(c32, Helmholtz, single_layer, Triangle),
(c64, Helmholtz, double_layer, Triangle),
(c32, Helmholtz, double_layer, Triangle),
(c64, Helmholtz, adjoint_double_layer, Triangle),
(c32, Helmholtz, adjoint_double_layer, Triangle),
(c64, Helmholtz, hypersingular, Triangle),
(c32, Helmholtz, hypersingular, Triangle),
(f64, Laplace, single_layer, Quadrilateral),
(f32, Laplace, single_layer, Quadrilateral),
//(c64, Laplace, single_layer, Quadrilateral),
//(c32, Laplace, single_layer, Quadrilateral),
(f64, Laplace, double_layer, Quadrilateral),
(f32, Laplace, double_layer, Quadrilateral),
//(c64, Laplace, double_layer, Quadrilateral),
//(c32, Laplace, double_layer, Quadrilateral),
(f64, Laplace, adjoint_double_layer, Quadrilateral),
(f32, Laplace, adjoint_double_layer, Quadrilateral),
//(c64, Laplace, adjoint_double_layer, Quadrilateral),
//(c32, Laplace, adjoint_double_layer, Quadrilateral),
(f64, Laplace, hypersingular, Quadrilateral),
(f32, Laplace, hypersingular, Quadrilateral),
//(c64, Laplace, hypersingular, Quadrilateral),
//(c32, Laplace, hypersingular, Quadrilateral),
(c64, Helmholtz, single_layer, Quadrilateral),
(c32, Helmholtz, single_layer, Quadrilateral),
(c64, Helmholtz, double_layer, Quadrilateral),
(c32, Helmholtz, double_layer, Quadrilateral),
(c64, Helmholtz, adjoint_double_layer, Quadrilateral),
(c32, Helmholtz, adjoint_double_layer, Quadrilateral),
(c64, Helmholtz, hypersingular, Quadrilateral),
(c32, Helmholtz, hypersingular, Quadrilateral) //(f64, Laplace, single_layer, Mixed),
//(f32, Laplace, single_layer, Mixed),
//(c64, Laplace, single_layer, Mixed),
//(c32, Laplace, single_layer, Mixed),
//(f64, Laplace, double_layer, Mixed),
//(f32, Laplace, double_layer, Mixed),
//(c64, Laplace, double_layer, Mixed),
//(c32, Laplace, double_layer, Mixed),
//(f64, Laplace, adjoint_double_layer, Mixed),
//(f32, Laplace, adjoint_double_layer, Mixed),
//(c64, Laplace, adjoint_double_layer, Mixed),
//(c32, Laplace, adjoint_double_layer, Mixed),
//(f64, Laplace, hypersingular, Mixed),
//(f32, Laplace, hypersingular, Mixed),
//(c64, Laplace, hypersingular, Mixed),
//(c32, Laplace, hypersingular, Mixed),
//(c64, Helmholtz, single_layer, Mixed),
//(c32, Helmholtz, single_layer, Mixed),
//(c64, Helmholtz, double_layer, Mixed),
//(c32, Helmholtz, double_layer, Mixed),
//(c64, Helmholtz, adjoint_double_layer, Mixed),
//(c32, Helmholtz, adjoint_double_layer, Mixed),
//(c64, Helmholtz, hypersingular, Mixed),
//(c32, Helmholtz, hypersingular, Mixed)
);
}
6 changes: 3 additions & 3 deletions src/assembly/boundary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ mod test {
let ndofs = space.global_size();

let mut matrix = rlst_dynamic_array2!(f64, [ndofs, ndofs]);
let assembler = SingleLayerAssembler::<f64, _>::new_laplace();
let assembler = BoundaryAssembler::<f64, _, _>::new_laplace_single_layer();
assembler.assemble_singular_into_dense(&mut matrix, &space, &space);
let csr = assembler.assemble_singular_into_csr(&space, &space);

Expand All @@ -52,7 +52,7 @@ mod test {
let ndofs = space.global_size();

let mut matrix = rlst_dynamic_array2!(f64, [ndofs, ndofs]);
let assembler = SingleLayerAssembler::<f64, _>::new_laplace();
let assembler = BoundaryAssembler::<f64, _, _>::new_laplace_single_layer();
assembler.assemble_singular_into_dense(&mut matrix, &space, &space);
let csr = assembler.assemble_singular_into_csr(&space, &space);

Expand Down Expand Up @@ -81,7 +81,7 @@ mod test {
let ndofs1 = space1.global_size();

let mut matrix = rlst_dynamic_array2!(f64, [ndofs1, ndofs0]);
let assembler = SingleLayerAssembler::<f64, _>::new_laplace();
let assembler = BoundaryAssembler::<f64, _, _>::new_laplace_single_layer();
assembler.assemble_singular_into_dense(&mut matrix, &space0, &space1);
let csr = assembler.assemble_singular_into_csr(&space0, &space1);
let indptr = csr.indptr();
Expand Down
Loading

0 comments on commit 7d69224

Please sign in to comment.