#993 Fixed use of wrong index for unnamed inactive fault

This commit is contained in:
Magne Sjaastad 2016-11-18 14:40:42 +01:00
parent e89b73d64c
commit 4ed6076750
2 changed files with 29 additions and 32 deletions

View File

@ -220,7 +220,6 @@ void RigMainGrid::setFaults(const cvf::Collection<RigFault>& faults)
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigMainGrid::calculateFaults(const RigActiveCellInfo* activeCellInfo) void RigMainGrid::calculateFaults(const RigActiveCellInfo* activeCellInfo)
{
{ {
m_faultsPrCellAcc = new RigFaultsPrCellAccumulator(m_cells.size()); m_faultsPrCellAcc = new RigFaultsPrCellAccumulator(m_cells.size());
@ -234,10 +233,14 @@ void RigMainGrid::calculateFaults(const RigActiveCellInfo* activeCellInfo)
// Separate the grid faults that has an inactive cell as member // Separate the grid faults that has an inactive cell as member
RigFault* unNamedFault = new RigFault; RigFault* unNamedFault = new RigFault;
unNamedFault->setName(RimDefines::undefinedGridFaultName());
int unNamedFaultIdx = static_cast<int>(m_faults.size()); int unNamedFaultIdx = static_cast<int>(m_faults.size());
m_faults.push_back(unNamedFault);
RigFault* unNamedFaultWithInactive = new RigFault; RigFault* unNamedFaultWithInactive = new RigFault;
unNamedFaultWithInactive->setName(RimDefines::undefinedGridFaultWithInactiveName());
int unNamedFaultWithInactiveIdx = static_cast<int>(m_faults.size()); int unNamedFaultWithInactiveIdx = static_cast<int>(m_faults.size());
m_faults.push_back(unNamedFaultWithInactive);
const std::vector<cvf::Vec3d>& vxs = m_mainGrid->nodes(); const std::vector<cvf::Vec3d>& vxs = m_mainGrid->nodes();
@ -315,7 +318,6 @@ void RigMainGrid::calculateFaults(const RigActiveCellInfo* activeCellInfo)
// 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
if (static_cast<size_t>(gcIdx) < neighborReservoirCellIdx) if (static_cast<size_t>(gcIdx) < neighborReservoirCellIdx)
{
{ {
RigFault::FaultFace ff(gcIdx, cvf::StructGridInterface::FaceType(faceIdx), neighborReservoirCellIdx); RigFault::FaultFace ff(gcIdx, cvf::StructGridInterface::FaceType(faceIdx), neighborReservoirCellIdx);
if(isCellActive && isNeighborCellActive) if(isCellActive && isNeighborCellActive)
@ -327,8 +329,6 @@ void RigMainGrid::calculateFaults(const RigActiveCellInfo* activeCellInfo)
unNamedFaultWithInactive->faultFaces().push_back(ff); unNamedFaultWithInactive->faultFaces().push_back(ff);
} }
} }
}
else 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 faultsPrCellAcc 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
@ -337,20 +337,14 @@ void RigMainGrid::calculateFaults(const RigActiveCellInfo* activeCellInfo)
} }
} }
if (unNamedFault->faultFaces().size()) distributeNNCsToFaults();
{
unNamedFault->setName(RimDefines::undefinedGridFaultName());
m_faults.push_back(unNamedFault);
} }
if(unNamedFaultWithInactive->faultFaces().size()) //--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigMainGrid::distributeNNCsToFaults()
{ {
unNamedFaultWithInactive->setName(RimDefines::undefinedGridFaultWithInactiveName());
m_faults.push_back(unNamedFaultWithInactive);
}
}
// Distribute nnc's to the faults
const std::vector<RigConnection>& nncs = this->nncData()->connections(); const std::vector<RigConnection>& nncs = this->nncData()->connections();
for (size_t nncIdx = 0; nncIdx < nncs.size(); ++nncIdx) for (size_t nncIdx = 0; nncIdx < nncs.size(); ++nncIdx)
{ {

View File

@ -61,6 +61,9 @@ public:
void setFaults(const cvf::Collection<RigFault>& faults); void setFaults(const cvf::Collection<RigFault>& faults);
const cvf::Collection<RigFault>& faults() { return m_faults; } const cvf::Collection<RigFault>& faults() { return m_faults; }
void calculateFaults(const RigActiveCellInfo* activeCellInfo); void calculateFaults(const RigActiveCellInfo* activeCellInfo);
void distributeNNCsToFaults();
const RigFault* findFaultFromCellIndexAndCellFace(size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face) const; const RigFault* findFaultFromCellIndexAndCellFace(size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face) const;
bool isFaceNormalsOutwards() const; bool isFaceNormalsOutwards() const;