-
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
Srinath Kailasa
committed
Jan 12, 2024
1 parent
d7d52e2
commit baf6e53
Showing
1 changed file
with
60 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
use std::time::Instant; | ||
|
||
use itertools::Itertools; | ||
|
||
use rlst_dense::rlst_array_from_slice2; | ||
Check failure on line 5 in fmm/examples/single_node.rs GitHub Actions / Run Rust tests (stable, mpich, --features "mpi,strict")
|
||
use rlst_dense::traits::RawAccess; | ||
|
||
use bempp_field::types::{FftFieldTranslationKiFmm, SvdFieldTranslationKiFmm}; | ||
Check failure on line 8 in fmm/examples/single_node.rs GitHub Actions / Run Rust tests (stable, mpich, --features "mpi,strict")
|
||
use bempp_kernel::laplace_3d::Laplace3dKernel; | ||
use bempp_tree::implementations::helpers::{points_fixture, points_fixture_sphere}; | ||
Check failure on line 10 in fmm/examples/single_node.rs GitHub Actions / Run Rust tests (stable, mpich, --features "mpi,strict")
|
||
use bempp_tree::{constants::ROOT, types::single_node::SingleNodeTree}; | ||
Check failure on line 11 in fmm/examples/single_node.rs GitHub Actions / Run Rust tests (stable, mpich, --features "mpi,strict")
|
||
use bempp_fmm::{types::{KiFmmLinear, FmmDataUniform}, charge::build_charge_dict}; | ||
use bempp_traits::{ | ||
field::{FieldTranslation, FieldTranslationData}, | ||
Check failure on line 14 in fmm/examples/single_node.rs GitHub Actions / Run Rust tests (stable, mpich, --features "mpi,strict")
Check failure on line 14 in fmm/examples/single_node.rs GitHub Actions / Run Rust tests (stable, openmpi, --features "mpi,strict")
|
||
fmm::{Fmm, FmmLoop, KiFmm as KiFmmTrait, SourceTranslation, TargetTranslation, TimeDict}, | ||
kernel::{Kernel, ScaleInvariantKernel}, | ||
tree::Tree, | ||
types::EvalType, | ||
}; | ||
|
||
|
||
fn main () { | ||
|
||
let npoints = 1000000; | ||
|
||
let points = points_fixture::<f64>(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 = 4; | ||
|
||
let tree = SingleNodeTree::new(points.data(), false, None, Some(depth), &global_idxs, true); | ||
|
||
let kernel = Laplace3dKernel::default(); | ||
let m2l_data: FftFieldTranslationKiFmm<f64, Laplace3dKernel<f64>> = | ||
FftFieldTranslationKiFmm::new(kernel.clone(), order, *tree.get_domain(), alpha_inner); | ||
// let m2l_data = SvdFieldTranslationKiFmm::new( | ||
// kernel.clone(), | ||
// Some(50), | ||
// 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); | ||
|
||
} |