Skip to content

Commit

Permalink
Merge branch 'main' into mscroggs/unsafe-trait
Browse files Browse the repository at this point in the history
  • Loading branch information
mscroggs committed Aug 29, 2024
2 parents b97f0dc + a2c30dd commit 6f7a733
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 50 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ mpi = { version = "0.8.*", optional = true }
num = "0.4"
lazy_static = "1.4"
ndelement = "0.1.0"
ndgrid = "0.1.0"
# ndgrid = "0.1.0"
ndgrid = { git = "https://github.com/bempp/ndgrid.git" }
rayon = "1.9"
rlst = "0.2"
green-kernels = "0.2.0"
Expand Down
93 changes: 44 additions & 49 deletions src/assembly/boundary/cell_pair_assemblers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,9 @@ impl<
&self.k,
&test_geometry,
&trial_geometry,
) * num::cast::<T::Real, T>(unsafe {
*wt * *self.test_jdet.get_unchecked(index)
* *self.trial_jdet.get_unchecked(index)
})
) * num::cast::<T::Real, T>(
*wt * self.test_jdet[index] * self.trial_jdet[index],
)
.unwrap();
}
}
Expand Down Expand Up @@ -290,24 +289,23 @@ impl<
for (test_i, entry) in col.iter_mut().enumerate() {
*entry = T::zero();
for (test_index, test_wt) in self.test_weights.iter().enumerate() {
let test_integrand =
num::cast::<T::Real, T>(*test_wt * self.test_jdet[test_index]).unwrap();
for (trial_index, trial_wt) in self.trial_weights.iter().enumerate() {
*entry += self.integrand.evaluate_nonsingular(
self.test_table,
self.trial_table,
test_index,
trial_index,
test_i,
trial_i,
&self.k,
&test_geometry,
&trial_geometry,
) * num::cast::<T::Real, T>(
*test_wt
* self.test_jdet[test_index]
* *trial_wt
* self.trial_jdet[trial_index],
)
.unwrap();
*entry +=
self.integrand.evaluate_nonsingular(
self.test_table,
self.trial_table,
test_index,
trial_index,
test_i,
trial_i,
&self.k,
&test_geometry,
&trial_geometry,
) * num::cast::<T::Real, T>(*trial_wt * self.trial_jdet[trial_index])
.unwrap()
* test_integrand;
}
}
}
Expand Down Expand Up @@ -470,26 +468,24 @@ impl<
for (test_i, entry) in col.iter_mut().enumerate() {
*entry = T::zero();
for (test_index, test_wt) in self.test_weights.iter().enumerate() {
let test_integrand =
num::cast::<T::Real, T>(*test_wt * self.test_jdet[test_index]).unwrap();
for (trial_index, trial_wt) in self.trial_weights.iter().enumerate() {
*entry += unsafe {
self.integrand.evaluate_nonsingular(
self.test_table,
self.trial_table,
test_index,
trial_index,
test_i,
trial_i,
&self.k,
&test_geometry,
&trial_geometry,
) * num::cast::<T::Real, T>(
*test_wt
* self.test_jdet[test_index]
* *trial_wt
* self.trial_jdet[self.trial_cell][trial_index],
)
.unwrap()
};
*entry += self.integrand.evaluate_nonsingular(
self.test_table,
self.trial_table,
test_index,
trial_index,
test_i,
trial_i,
&self.k,
&test_geometry,
&trial_geometry,
) * num::cast::<T::Real, T>(
*trial_wt * self.trial_jdet[self.trial_cell][trial_index],
)
.unwrap()
* test_integrand;
}
}
}
Expand Down Expand Up @@ -650,8 +646,12 @@ impl<
for (test_i, entry) in col.iter_mut().enumerate() {
*entry = T::zero();
for (test_index, test_wt) in self.test_weights.iter().enumerate() {
let test_integrand = num::cast::<T::Real, T>(
*test_wt * self.test_jdet[self.test_cell][test_index],
)
.unwrap();
for (trial_index, trial_wt) in self.trial_weights.iter().enumerate() {
*entry += unsafe {
*entry +=
self.integrand.evaluate_nonsingular(
self.test_table,
self.trial_table,
Expand All @@ -662,14 +662,9 @@ impl<
&self.k,
&test_geometry,
&trial_geometry,
) * num::cast::<T::Real, T>(
*test_wt
* self.test_jdet[self.test_cell][test_index]
* *trial_wt
* self.trial_jdet[trial_index],
)
.unwrap()
};
) * num::cast::<T::Real, T>(*trial_wt * self.trial_jdet[trial_index])
.unwrap()
* test_integrand;
}
}
}
Expand Down

0 comments on commit 6f7a733

Please sign in to comment.