diff --git a/src/soft_body.cpp b/src/soft_body.cpp index 2b75d38..4adf313 100644 --- a/src/soft_body.cpp +++ b/src/soft_body.cpp @@ -183,26 +183,26 @@ void SoftBody::splitConstraints() { Graph graph; - auto setNeighbors = [&pointToConstraints, &graph](const Constraint * constraint, const vector &vIDs){ + auto findAdjacent = [&pointToConstraints, &graph](const Constraint * constraint, const vector &vIDs){ unordered_set neighbors; for (uint32_t vID : vIDs) neighbors.insert(pointToConstraints[vID].begin(), pointToConstraints[vID].end()); neighbors.erase(constraint); #pragma omp critical - graph[constraint].insert(graph[constraint].end(), neighbors.begin(), neighbors.end()); + graph[constraint].assign(neighbors.begin(), neighbors.end()); }; - #pragma omp parallel for default(none) shared(setNeighbors, lengthConstraints) + #pragma omp parallel for default(none) shared(findAdjacent, lengthConstraints) for (const DistanceConstraint &distanceConstraint : lengthConstraints){ - setNeighbors(&distanceConstraint, { + findAdjacent(&distanceConstraint, { distanceConstraint.a, distanceConstraint.b }); } - #pragma omp parallel for default(none) shared(setNeighbors, volumeConstraints) + #pragma omp parallel for default(none) shared(findAdjacent, volumeConstraints) for (const VolumeConstraint &volumeConstraint : volumeConstraints){ - setNeighbors(&volumeConstraint, { + findAdjacent(&volumeConstraint, { volumeConstraint.a, volumeConstraint.b, volumeConstraint.c,