Skip to content
Snippets Groups Projects
Commit cb4c4b4c authored by Tobias Leibner's avatar Tobias Leibner
Browse files

[common.matrix.dense] improve performance of add_to_entry if no mutex is available

parent 87e861c2
No related branches found
No related tags found
No related merge requests found
...@@ -416,10 +416,21 @@ public: ...@@ -416,10 +416,21 @@ public:
{ {
assert(ii < rows()); assert(ii < rows());
assert(jj < cols()); assert(jj < cols());
internal::LockGuard DUNE_UNUSED(lock)(*mutexes_, ii, rows()); if (mutexes_->size()) {
backend_->get_entry_ref(ii, jj) += value; internal::LockGuard DUNE_UNUSED(lock)(*mutexes_, ii, rows());
backend_->get_entry_ref(ii, jj) += value;
} else {
backend_->get_entry_ref(ii, jj) += value;
}
} // ... add_to_entry(...) } // ... add_to_entry(...)
void unsafe_add_to_entry(const size_t ii, const size_t jj, const ScalarType& value)
{
assert(ii < rows());
assert(jj < cols());
backend_->get_entry_ref(ii, jj) += value;
} // ... unsafe_add_to_entry(...)
void set_entry(const size_t ii, const size_t jj, const ScalarType& value) void set_entry(const size_t ii, const size_t jj, const ScalarType& value)
{ {
assert(ii < rows()); assert(ii < rows());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment