mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Refactored some code to make it possible to parallelise
This commit is contained in:
parent
de824f2543
commit
c7851f0001
@ -448,11 +448,43 @@ void RigMainGrid::calculateFaults( const RigActiveCellInfo* activeCellInfo )
|
||||
|
||||
const std::vector<cvf::Vec3d>& vxs = m_mainGrid->nodes();
|
||||
|
||||
std::vector<RigFault::FaultFace>& unNamedFaultFaces = unNamedFault->faultFaces();
|
||||
std::vector<RigFault::FaultFace>& unNamedFaultFacesInactive = unNamedFaultWithInactive->faultFaces();
|
||||
for ( int gcIdx = 0; gcIdx < static_cast<int>( m_cells.size() ); ++gcIdx )
|
||||
{
|
||||
addUnNamedFaultFaces( gcIdx,
|
||||
activeCellInfo,
|
||||
vxs,
|
||||
unNamedFaultIdx,
|
||||
unNamedFaultWithInactiveIdx,
|
||||
unNamedFaultFaces,
|
||||
unNamedFaultFacesInactive,
|
||||
m_faultsPrCellAcc.p() );
|
||||
}
|
||||
|
||||
if ( computeNncs )
|
||||
{
|
||||
this->nncData()->computeCompleteSetOfNncs( this, activeCellInfo, includeInactiveCells );
|
||||
}
|
||||
|
||||
distributeNNCsToFaults();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigMainGrid::addUnNamedFaultFaces( int gcIdx,
|
||||
const RigActiveCellInfo* activeCellInfo,
|
||||
const std::vector<cvf::Vec3d>& vxs,
|
||||
int unNamedFaultIdx,
|
||||
int unNamedFaultWithInactiveIdx,
|
||||
std::vector<RigFault::FaultFace>& unNamedFaultFaces,
|
||||
std::vector<RigFault::FaultFace>& unNamedFaultFacesInactive,
|
||||
RigFaultsPrCellAccumulator* faultsPrCellAcc ) const
|
||||
{
|
||||
if ( m_cells[gcIdx].isInvalid() )
|
||||
{
|
||||
continue;
|
||||
return;
|
||||
}
|
||||
|
||||
size_t neighborReservoirCellIdx;
|
||||
@ -461,7 +493,7 @@ void RigMainGrid::calculateFaults( const RigActiveCellInfo* activeCellInfo )
|
||||
size_t j = 0;
|
||||
size_t k = 0;
|
||||
|
||||
RigGridBase* hostGrid = nullptr;
|
||||
const RigGridBase* hostGrid = nullptr;
|
||||
bool firstNO_FAULTFaceForCell = true;
|
||||
bool isCellActive = true;
|
||||
|
||||
@ -527,10 +559,8 @@ void RigMainGrid::calculateFaults( const RigActiveCellInfo* activeCellInfo )
|
||||
int faultIdx = unNamedFaultIdx;
|
||||
if ( !( isCellActive && isNeighborCellActive ) ) faultIdx = unNamedFaultWithInactiveIdx;
|
||||
|
||||
m_faultsPrCellAcc->setFaultIdx( gcIdx, face, faultIdx );
|
||||
m_faultsPrCellAcc->setFaultIdx( neighborReservoirCellIdx,
|
||||
StructGridInterface::oppositeFace( face ),
|
||||
faultIdx );
|
||||
faultsPrCellAcc->setFaultIdx( gcIdx, face, faultIdx );
|
||||
faultsPrCellAcc->setFaultIdx( neighborReservoirCellIdx, StructGridInterface::oppositeFace( face ), faultIdx );
|
||||
|
||||
// Add as fault face only if the grid index is less than the neighbors
|
||||
|
||||
@ -539,25 +569,25 @@ void RigMainGrid::calculateFaults( const RigActiveCellInfo* activeCellInfo )
|
||||
RigFault::FaultFace ff( gcIdx, cvf::StructGridInterface::FaceType( faceIdx ), neighborReservoirCellIdx );
|
||||
if ( isCellActive && isNeighborCellActive )
|
||||
{
|
||||
unNamedFault->faultFaces().push_back( ff );
|
||||
unNamedFaultFaces.push_back( ff );
|
||||
}
|
||||
else
|
||||
{
|
||||
unNamedFaultWithInactive->faultFaces().push_back( ff );
|
||||
unNamedFaultFacesInactive.push_back( ff );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CVF_FAIL_MSG(
|
||||
"Found fault with global neighbor index less than the native index. " ); // Should never occur.
|
||||
// because we flag the
|
||||
// opposite face in the
|
||||
CVF_FAIL_MSG( "Found fault with global neighbor index less than the native index. " ); // Should never
|
||||
// occur. because
|
||||
// we flag the
|
||||
// opposite face
|
||||
// in the
|
||||
// faultsPrCellAcc
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
@ -73,6 +73,15 @@ public:
|
||||
cvf::Collection<RigFault>& faults();
|
||||
void calculateFaults( const RigActiveCellInfo* activeCellInfo );
|
||||
|
||||
void addUnNamedFaultFaces( int gcIdx,
|
||||
const RigActiveCellInfo* activeCellInfo,
|
||||
const std::vector<cvf::Vec3d>& vxs,
|
||||
int unNamedFaultIdx,
|
||||
int unNamedFaultWithInactiveIdx,
|
||||
std::vector<RigFault::FaultFace>& unNamedFaultFaces,
|
||||
std::vector<RigFault::FaultFace>& unNamedFaultFacesInactive,
|
||||
RigFaultsPrCellAccumulator* faultsPrCellAcc ) const;
|
||||
|
||||
void distributeNNCsToFaults();
|
||||
|
||||
const RigFault* findFaultFromCellIndexAndCellFace( size_t reservoirCellIndex,
|
||||
|
Loading…
Reference in New Issue
Block a user