Performance: Use OpenMP for fault calculations

This commit is contained in:
Magne Sjaastad 2014-04-24 09:53:40 +02:00
parent 366c3cd2e8
commit d3456ffcc9

View File

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