diff --git a/flow/src/wNewton.cpp b/flow/src/wNewton.cpp index 0408374d7260c89a8346b3981d95e1f557d3feee..52eb88dfe8eed7cbc2609e225ece0fe0c6271dd2 100644 --- a/flow/src/wNewton.cpp +++ b/flow/src/wNewton.cpp @@ -348,13 +348,13 @@ void Newton::buildJac(Eigen::SparseMatrix<double, Eigen::RowMajor> &J) // first grab upper row values... std::vector<Eigen::Triplet<double>> tUp; tUp.reserve(pbl->msh->nodes.size() / 10); + tbb::spin_mutex::scoped_lock lock(mutex); for (Eigen::SparseMatrix<double, Eigen::RowMajor>::InnerIterator it(J, idxUp); it; ++it) { tUp.push_back(Eigen::Triplet<double>(it.row(), it.col(), it.value())); it.valueRef() = 0.; } // ...then add them to lower row values - tbb::spin_mutex::scoped_lock lock(mutex); for (auto t : tUp) J.coeffRef(idxLw, t.col()) += t.value(); });