-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
135 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
//! Single Node FMM using an FFT based M2L translation operator | ||
use std::time::Instant; | ||
|
||
use itertools::Itertools; | ||
|
||
use rlst_dense::traits::RawAccess; | ||
|
||
use bempp_field::types::FftFieldTranslationKiFmm; | ||
use bempp_fmm::{ | ||
charge::build_charge_dict, | ||
types::{FmmDataUniform, KiFmmLinear}, | ||
}; | ||
use bempp_kernel::laplace_3d::Laplace3dKernel; | ||
use bempp_traits::{fmm::FmmLoop, tree::Tree}; | ||
use bempp_tree::implementations::helpers::points_fixture; | ||
use bempp_tree::types::single_node::SingleNodeTree; | ||
|
||
fn main() { | ||
let npoints = 10000; | ||
|
||
let points = points_fixture::<f32>(npoints, None, None); | ||
|
||
let global_idxs = (0..npoints).collect_vec(); | ||
let charges = vec![1.0; npoints]; | ||
|
||
let order = 6; | ||
let alpha_inner = 1.05; | ||
let alpha_outer = 2.95; | ||
let depth = 3; | ||
|
||
let tree = SingleNodeTree::new(points.data(), false, None, Some(depth), &global_idxs, true); | ||
|
||
let kernel = Laplace3dKernel::default(); | ||
let m2l_data: FftFieldTranslationKiFmm<f32, Laplace3dKernel<f32>> = | ||
FftFieldTranslationKiFmm::new(kernel.clone(), order, *tree.get_domain(), alpha_inner); | ||
|
||
let fmm = KiFmmLinear::new(order, alpha_inner, alpha_outer, kernel, tree, m2l_data); | ||
|
||
// Form charge dict, matching charges with their associated global indices | ||
let charge_dict = build_charge_dict(&global_idxs, &charges); | ||
|
||
let datatree = FmmDataUniform::new(fmm, &charge_dict).unwrap(); | ||
|
||
let s = Instant::now(); | ||
let times = datatree.run(true); | ||
println!("runtime {:?} operators {:?}", s.elapsed(), times); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
//! Single Node FMM using an SVD based M2L translation operator | ||
use std::time::Instant; | ||
|
||
use itertools::Itertools; | ||
|
||
use rlst_dense::traits::RawAccess; | ||
|
||
use bempp_field::types::SvdFieldTranslationKiFmm; | ||
use bempp_fmm::{ | ||
charge::build_charge_dict, | ||
types::{FmmDataUniform, KiFmmLinear}, | ||
}; | ||
use bempp_kernel::laplace_3d::Laplace3dKernel; | ||
use bempp_traits::{fmm::FmmLoop, tree::Tree}; | ||
use bempp_tree::implementations::helpers::points_fixture; | ||
use bempp_tree::types::single_node::SingleNodeTree; | ||
|
||
fn main() { | ||
let npoints = 10000; | ||
|
||
let points = points_fixture::<f32>(npoints, None, None); | ||
|
||
let global_idxs = (0..npoints).collect_vec(); | ||
let charges = vec![1.0; npoints]; | ||
|
||
let order = 6; | ||
let alpha_inner = 1.05; | ||
let alpha_outer = 2.95; | ||
let depth = 3; | ||
|
||
let tree = SingleNodeTree::new(points.data(), false, None, Some(depth), &global_idxs, true); | ||
|
||
let kernel = Laplace3dKernel::default(); | ||
|
||
let m2l_data = | ||
SvdFieldTranslationKiFmm::new(kernel.clone(), None, order, *tree.get_domain(), alpha_inner); | ||
|
||
let fmm = KiFmmLinear::new(order, alpha_inner, alpha_outer, kernel, tree, m2l_data); | ||
|
||
// Form charge dict, matching charges with their associated global indices | ||
let charge_dict = build_charge_dict(&global_idxs, &charges); | ||
|
||
let datatree = FmmDataUniform::new(fmm, &charge_dict).unwrap(); | ||
|
||
let s = Instant::now(); | ||
let times = datatree.run(true); | ||
println!("runtime {:?} operators {:?}", s.elapsed(), times); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters