#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) void RigMainGrid::calculateFaults(const RigActiveCellInfo* activeCellInfo)
{ {
{
m_faultsPrCellAcc = new RigFaultsPrCellAccumulator(m_cells.size()); m_faultsPrCellAcc = new RigFaultsPrCellAccumulator(m_cells.size());
// Spread fault idx'es on the cells from the faults // 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. // 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 // 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();
@ -316,18 +319,15 @@ void RigMainGrid::calculateFaults(const RigActiveCellInfo* activeCellInfo)
if (static_cast<size_t>(gcIdx) < neighborReservoirCellIdx) if (static_cast<size_t>(gcIdx) < neighborReservoirCellIdx)
{ {
RigFault::FaultFace ff(gcIdx, cvf::StructGridInterface::FaceType(faceIdx), neighborReservoirCellIdx);
if(isCellActive && isNeighborCellActive)
{ {
RigFault::FaultFace ff(gcIdx, cvf::StructGridInterface::FaceType(faceIdx), neighborReservoirCellIdx); unNamedFault->faultFaces().push_back(ff);
if(isCellActive && isNeighborCellActive) }
{ else
unNamedFault->faultFaces().push_back(ff); {
} unNamedFaultWithInactive->faultFaces().push_back(ff);
else
{
unNamedFaultWithInactive->faultFaces().push_back(ff);
}
} }
} }
else else
{ {
@ -337,27 +337,21 @@ void RigMainGrid::calculateFaults(const RigActiveCellInfo* activeCellInfo)
} }
} }
if (unNamedFault->faultFaces().size()) distributeNNCsToFaults();
{ }
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
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigMainGrid::distributeNNCsToFaults()
{
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)
{ {
// Find the fault for each side of the nnc // Find the fault for each side of the nnc
const RigConnection& conn = nncs[nncIdx]; const RigConnection& conn = nncs[nncIdx];
int fIdx1 = RigFaultsPrCellAccumulator::NO_FAULT; int fIdx1 = RigFaultsPrCellAccumulator::NO_FAULT;
int fIdx2 = RigFaultsPrCellAccumulator::NO_FAULT; int fIdx2 = RigFaultsPrCellAccumulator::NO_FAULT;
if (conn.m_c1Face != StructGridInterface::NO_FACE) if (conn.m_c1Face != StructGridInterface::NO_FACE)
{ {
@ -367,13 +361,13 @@ void RigMainGrid::calculateFaults(const RigActiveCellInfo* activeCellInfo)
if (fIdx1 < 0 && fIdx2 < 0) if (fIdx1 < 0 && fIdx2 < 0)
{ {
cvf::String lgrString ("Same Grid"); cvf::String lgrString("Same Grid");
if (m_cells[conn.m_c1GlobIdx].hostGrid() != m_cells[conn.m_c2GlobIdx].hostGrid() ) if (m_cells[conn.m_c1GlobIdx].hostGrid() != m_cells[conn.m_c2GlobIdx].hostGrid())
{ {
lgrString = "Different Grid"; lgrString = "Different Grid";
} }
//cvf::Trace::show("NNC: No Fault for NNC C1: " + cvf::String((int)conn.m_c1GlobIdx) + " C2: " + cvf::String((int)conn.m_c2GlobIdx) + " Grid: " + lgrString); //cvf::Trace::show("NNC: No Fault for NNC C1: " + cvf::String((int)conn.m_c1GlobIdx) + " C2: " + cvf::String((int)conn.m_c2GlobIdx) + " Grid: " + lgrString);
} }
if (fIdx1 >= 0) if (fIdx1 >= 0)

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;