#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

@ -221,7 +221,6 @@ void RigMainGrid::setFaults(const cvf::Collection<RigFault>& faults)
//--------------------------------------------------------------------------------------------------
void RigMainGrid::calculateFaults(const RigActiveCellInfo* activeCellInfo)
{
{
m_faultsPrCellAcc = new RigFaultsPrCellAccumulator(m_cells.size());
// Spread fault idx'es on the cells from the faults
@ -233,11 +232,15 @@ void RigMainGrid::calculateFaults(const RigActiveCellInfo* activeCellInfo)
// Find the geometrical faults that is in addition: Has no user defined (eclipse) fault assigned.
// 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());
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());
m_faults.push_back(unNamedFaultWithInactive);
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
if (static_cast<size_t>(gcIdx) < neighborReservoirCellIdx)
{
{
RigFault::FaultFace ff(gcIdx, cvf::StructGridInterface::FaceType(faceIdx), neighborReservoirCellIdx);
if(isCellActive && isNeighborCellActive)
@ -327,8 +329,6 @@ void RigMainGrid::calculateFaults(const RigActiveCellInfo* activeCellInfo)
unNamedFaultWithInactive->faultFaces().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 faultsPrCellAcc
@ -337,20 +337,14 @@ void RigMainGrid::calculateFaults(const RigActiveCellInfo* activeCellInfo)
}
}
if (unNamedFault->faultFaces().size())
{
unNamedFault->setName(RimDefines::undefinedGridFaultName());
m_faults.push_back(unNamedFault);
}
if(unNamedFaultWithInactive->faultFaces().size())
{
unNamedFaultWithInactive->setName(RimDefines::undefinedGridFaultWithInactiveName());
m_faults.push_back(unNamedFaultWithInactive);
}
}
// Distribute nnc's to the faults
distributeNNCsToFaults();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigMainGrid::distributeNNCsToFaults()
{
const std::vector<RigConnection>& nncs = this->nncData()->connections();
for (size_t nncIdx = 0; nncIdx < nncs.size(); ++nncIdx)
{
@ -367,8 +361,8 @@ void RigMainGrid::calculateFaults(const RigActiveCellInfo* activeCellInfo)
if (fIdx1 < 0 && fIdx2 < 0)
{
cvf::String lgrString ("Same Grid");
if (m_cells[conn.m_c1GlobIdx].hostGrid() != m_cells[conn.m_c2GlobIdx].hostGrid() )
cvf::String lgrString("Same Grid");
if (m_cells[conn.m_c1GlobIdx].hostGrid() != m_cells[conn.m_c2GlobIdx].hostGrid())
{
lgrString = "Different Grid";
}

View File

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