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();
|
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 )
|
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() )
|
if ( m_cells[gcIdx].isInvalid() )
|
||||||
{
|
{
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t neighborReservoirCellIdx;
|
size_t neighborReservoirCellIdx;
|
||||||
@ -461,7 +493,7 @@ void RigMainGrid::calculateFaults( const RigActiveCellInfo* activeCellInfo )
|
|||||||
size_t j = 0;
|
size_t j = 0;
|
||||||
size_t k = 0;
|
size_t k = 0;
|
||||||
|
|
||||||
RigGridBase* hostGrid = nullptr;
|
const RigGridBase* hostGrid = nullptr;
|
||||||
bool firstNO_FAULTFaceForCell = true;
|
bool firstNO_FAULTFaceForCell = true;
|
||||||
bool isCellActive = true;
|
bool isCellActive = true;
|
||||||
|
|
||||||
@ -527,10 +559,8 @@ void RigMainGrid::calculateFaults( const RigActiveCellInfo* activeCellInfo )
|
|||||||
int faultIdx = unNamedFaultIdx;
|
int faultIdx = unNamedFaultIdx;
|
||||||
if ( !( isCellActive && isNeighborCellActive ) ) faultIdx = unNamedFaultWithInactiveIdx;
|
if ( !( isCellActive && isNeighborCellActive ) ) faultIdx = unNamedFaultWithInactiveIdx;
|
||||||
|
|
||||||
m_faultsPrCellAcc->setFaultIdx( gcIdx, face, faultIdx );
|
faultsPrCellAcc->setFaultIdx( gcIdx, face, faultIdx );
|
||||||
m_faultsPrCellAcc->setFaultIdx( neighborReservoirCellIdx,
|
faultsPrCellAcc->setFaultIdx( neighborReservoirCellIdx, StructGridInterface::oppositeFace( face ), faultIdx );
|
||||||
StructGridInterface::oppositeFace( face ),
|
|
||||||
faultIdx );
|
|
||||||
|
|
||||||
// Add as fault face only if the grid index is less than the neighbors
|
// Add as fault face only if the grid index is less than the neighbors
|
||||||
|
|
||||||
@ -539,24 +569,24 @@ void RigMainGrid::calculateFaults( const RigActiveCellInfo* activeCellInfo )
|
|||||||
RigFault::FaultFace ff( gcIdx, cvf::StructGridInterface::FaceType( faceIdx ), neighborReservoirCellIdx );
|
RigFault::FaultFace ff( gcIdx, cvf::StructGridInterface::FaceType( faceIdx ), neighborReservoirCellIdx );
|
||||||
if ( isCellActive && isNeighborCellActive )
|
if ( isCellActive && isNeighborCellActive )
|
||||||
{
|
{
|
||||||
unNamedFault->faultFaces().push_back( ff );
|
unNamedFaultFaces.push_back( ff );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unNamedFaultWithInactive->faultFaces().push_back( ff );
|
unNamedFaultFacesInactive.push_back( ff );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CVF_FAIL_MSG(
|
CVF_FAIL_MSG( "Found fault with global neighbor index less than the native index. " ); // Should never
|
||||||
"Found fault with global neighbor index less than the native index. " ); // Should never occur.
|
// occur. because
|
||||||
// because we flag the
|
// we flag the
|
||||||
// opposite face in the
|
// opposite face
|
||||||
|
// in the
|
||||||
// faultsPrCellAcc
|
// faultsPrCellAcc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -73,6 +73,15 @@ public:
|
|||||||
cvf::Collection<RigFault>& faults();
|
cvf::Collection<RigFault>& faults();
|
||||||
void calculateFaults( const RigActiveCellInfo* activeCellInfo );
|
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();
|
void distributeNNCsToFaults();
|
||||||
|
|
||||||
const RigFault* findFaultFromCellIndexAndCellFace( size_t reservoirCellIndex,
|
const RigFault* findFaultFromCellIndexAndCellFace( size_t reservoirCellIndex,
|
||||||
|
Loading…
Reference in New Issue
Block a user