diff --git a/ApplicationCode/ReservoirDataModel/RigMainGrid.cpp b/ApplicationCode/ReservoirDataModel/RigMainGrid.cpp index 0c93dbf975..bef2c7c9c5 100644 --- a/ApplicationCode/ReservoirDataModel/RigMainGrid.cpp +++ b/ApplicationCode/ReservoirDataModel/RigMainGrid.cpp @@ -227,7 +227,8 @@ void RigMainGrid::calculateFaults() RigFault * unNamedFault = new RigFault; int unNamedFaultIdx = static_cast(m_faults.size()); - for (size_t gcIdx = 0 ; gcIdx < m_cells.size(); ++gcIdx) +#pragma omp parallel for + for (int gcIdx = 0 ; gcIdx < static_cast(m_cells.size()); ++gcIdx) { if ( m_cells[gcIdx].isInvalid()) { @@ -298,8 +299,12 @@ void RigMainGrid::calculateFaults() if (gcIdx < neighborGlobalCellIdx) { - RigFault::FaultFace ff(gcIdx, cvf::StructGridInterface::FaceType(faceIdx), neighborGlobalCellIdx); - unNamedFault->faultFaces().push_back(ff); + #pragma omp critical + { + RigFault::FaultFace ff(gcIdx, cvf::StructGridInterface::FaceType(faceIdx), neighborGlobalCellIdx); + unNamedFault->faultFaces().push_back(ff); + } + } else {