From cd8e2671e25b7d9152e78e9a69e8180082ae4fe9 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 24 Aug 2001 13:34:09 +0000 Subject: [PATCH] Fix a rather rare race condition in MT mode: we checked that we did not yet visit a face by looking at a value that is written when visiting this face. We double checked later when writing into it. In some rare conditions, it could happen that another process was working on it, but only wrote between the two checks, making the latter fail. git-svn-id: https://svn.dealii.org/trunk@4908 0785d39b-7218-0410-832d-ea1e28bc413d --- .../source/numerics/error_estimator.cc | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/deal.II/deal.II/source/numerics/error_estimator.cc b/deal.II/deal.II/source/numerics/error_estimator.cc index 65f5602e62..c9efeaa25d 100644 --- a/deal.II/deal.II/source/numerics/error_estimator.cc +++ b/deal.II/deal.II/source/numerics/error_estimator.cc @@ -475,6 +475,26 @@ void KellyErrorEstimator::estimate_some (Data &data, // loop over all faces of this cell for (unsigned int face_no=0; face_no::faces_per_cell; ++face_no) { + // make sure we do work + // only once: this face + // may either be regular + // or irregular. if it is + // regular and has a + // neighbor, then we + // visit the face twice, + // once from every + // side. let the one with + // the lower index do the + // work. if it is at the + // boundary, or if the + // face is irregular, + // then do the work below + if ((cell->face(face_no)->has_children() == false) && + !cell->at_boundary(face_no) && + (cell->neighbor(face_no)->level() == cell->level()) && + (cell->neighbor(face_no)->index() < cell->index())) + continue; + // if we already visited // this face: do // nothing. only check -- 2.39.5