31 const std::vector<Eigen::Vector3d> &reference_positions,
32 const std::vector<Eigen::Vector3d> &previous_values,
33 std::vector<Eigen::Vector3d> &next_values,
35 const ForEachNeighborFunc &for_each_neighbor,
36 const ComputeWeightFunc &compute_weight) {
37 const int n_values =
static_cast<int>(previous_values.size());
38 next_values.resize(previous_values.size());
41 tbb::blocked_range<int>(0, n_values,
43 [&](
const tbb::blocked_range<int> &range) {
44 for (
int index = range.begin(); index < range.end(); ++index) {
45 Eigen::Vector3d weighted_sum = Eigen::Vector3d::Zero();
46 double total_weight = 0.0;
47 for_each_neighbor(index, [&](
int neighbor_index) {
48 const double weight = compute_weight(
49 index, neighbor_index, reference_positions);
52 weight * previous_values[neighbor_index];
55 if (total_weight > 0.0) {
57 previous_values[index] +
58 factor * (weighted_sum / total_weight -
59 previous_values[index]);
61 next_values[index] = previous_values[index];