2013-12-10 00:56:58 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) Statoil ASA, Ceetron Solutions AS
|
|
|
|
//
|
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RivReservoirFaultsPartMgr.h"
|
|
|
|
|
|
|
|
#include "cvfPart.h"
|
|
|
|
#include "cvfModelBasicList.h"
|
|
|
|
#include "cvfColor3.h"
|
|
|
|
#include "cvfTransform.h"
|
|
|
|
|
|
|
|
#include "cafPdmFieldCvfColor.h"
|
|
|
|
|
|
|
|
#include "RimFaultCollection.h"
|
2013-12-18 02:26:06 -06:00
|
|
|
#include "RigMainGrid.h"
|
2013-12-10 00:56:58 -06:00
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-12-18 02:26:06 -06:00
|
|
|
RivReservoirFaultsPartMgr::RivReservoirFaultsPartMgr(const RigMainGrid* grid, const RimFaultCollection* faultCollection)
|
|
|
|
: m_faultCollection(faultCollection)
|
2013-12-10 00:56:58 -06:00
|
|
|
{
|
|
|
|
CVF_ASSERT(grid);
|
|
|
|
|
|
|
|
if (faultCollection)
|
|
|
|
{
|
|
|
|
for (size_t i = 0; i < faultCollection->faults.size(); i++)
|
|
|
|
{
|
2013-12-18 02:13:13 -06:00
|
|
|
m_faultParts.push_back(new RivFaultPartMgr(grid, faultCollection, faultCollection->faults[i]));
|
2013-12-10 00:56:58 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RivReservoirFaultsPartMgr::~RivReservoirFaultsPartMgr()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RivReservoirFaultsPartMgr::setTransform(cvf::Transform* scaleTransform)
|
|
|
|
{
|
|
|
|
m_scaleTransform = scaleTransform;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RivReservoirFaultsPartMgr::setCellVisibility(cvf::UByteArray* cellVisibilities)
|
|
|
|
{
|
|
|
|
CVF_ASSERT(cellVisibilities);
|
|
|
|
|
|
|
|
for (size_t i = 0; i < m_faultParts.size(); i++)
|
|
|
|
{
|
|
|
|
m_faultParts.at(i)->setCellVisibility(cellVisibilities);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RivReservoirFaultsPartMgr::appendPartsToModel(cvf::ModelBasicList* model)
|
|
|
|
{
|
|
|
|
CVF_ASSERT(model != NULL);
|
|
|
|
|
|
|
|
if (!m_faultCollection) return;
|
|
|
|
|
2013-12-18 02:26:06 -06:00
|
|
|
bool isShowingGrid = m_faultCollection->isGridVisualizationMode();
|
|
|
|
if (!m_faultCollection->showFaultCollection() && !isShowingGrid) return;
|
2013-12-10 00:56:58 -06:00
|
|
|
|
|
|
|
// Check match between model fault count and fault parts
|
|
|
|
CVF_ASSERT(m_faultCollection->faults.size() == m_faultParts.size());
|
|
|
|
|
|
|
|
cvf::ModelBasicList parts;
|
|
|
|
|
|
|
|
for (size_t i = 0; i < m_faultCollection->faults.size(); i++)
|
|
|
|
{
|
|
|
|
const RimFault* rimFault = m_faultCollection->faults[i];
|
|
|
|
|
2013-12-18 02:26:06 -06:00
|
|
|
cvf::ref<RivFaultPartMgr> rivFaultPart = m_faultParts[i];
|
|
|
|
CVF_ASSERT(rivFaultPart.notNull());
|
|
|
|
|
|
|
|
// Parts that is overridden by the grid settings
|
2013-12-10 00:56:58 -06:00
|
|
|
|
2013-12-18 02:26:06 -06:00
|
|
|
if (rimFault->showFault() || isShowingGrid)
|
|
|
|
{
|
|
|
|
if (m_faultCollection->showFaultFaces() || isShowingGrid)
|
2013-12-10 00:56:58 -06:00
|
|
|
{
|
|
|
|
rivFaultPart->appendNativeFaultFacesToModel(&parts);
|
|
|
|
}
|
|
|
|
|
2013-12-18 02:26:06 -06:00
|
|
|
if (m_faultCollection->showOppositeFaultFaces() || isShowingGrid)
|
2013-12-10 00:56:58 -06:00
|
|
|
{
|
|
|
|
rivFaultPart->appendOppositeFaultFacesToModel(&parts);
|
|
|
|
}
|
|
|
|
|
2013-12-18 02:26:06 -06:00
|
|
|
if (m_faultCollection->showFaultFaces() || m_faultCollection->showOppositeFaultFaces() || m_faultCollection->showNNCs() || isShowingGrid)
|
2013-12-10 00:56:58 -06:00
|
|
|
{
|
2013-12-18 02:26:06 -06:00
|
|
|
rivFaultPart->appendMeshLinePartsToModel(&parts);
|
2013-12-10 00:56:58 -06:00
|
|
|
}
|
2013-12-18 02:26:06 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// Parts that is not overridden by the grid settings
|
2013-12-10 00:56:58 -06:00
|
|
|
|
2013-12-18 02:26:06 -06:00
|
|
|
if (rimFault->showFault() && m_faultCollection->showFaultCollection())
|
|
|
|
{
|
2013-12-16 04:29:48 -06:00
|
|
|
if (m_faultCollection->showNNCs())
|
|
|
|
{
|
|
|
|
rivFaultPart->appendNNCFacesToModel(&parts);
|
|
|
|
}
|
2013-12-10 00:56:58 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (size_t i = 0; i < parts.partCount(); i++)
|
|
|
|
{
|
|
|
|
cvf::Part* part = parts.part(i);
|
|
|
|
part->setTransform(m_scaleTransform.p());
|
|
|
|
|
|
|
|
model->addPart(part);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2014-01-02 04:21:35 -06:00
|
|
|
void RivReservoirFaultsPartMgr::applySingleColorEffect()
|
2013-12-10 00:56:58 -06:00
|
|
|
{
|
|
|
|
for (size_t i = 0; i < m_faultParts.size(); i++)
|
|
|
|
{
|
|
|
|
m_faultParts[i]->applySingleColorEffect();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RivReservoirFaultsPartMgr::updateCellResultColor(size_t timeStepIndex, RimResultSlot* cellResultSlot)
|
|
|
|
{
|
2014-01-02 08:20:08 -06:00
|
|
|
if (m_faultCollection->showResultsOnFaults())
|
2014-01-02 04:21:35 -06:00
|
|
|
{
|
|
|
|
for (size_t i = 0; i < m_faultParts.size(); i++)
|
|
|
|
{
|
|
|
|
m_faultParts[i]->updateCellResultColor(timeStepIndex, cellResultSlot);
|
|
|
|
}
|
2013-12-10 00:56:58 -06:00
|
|
|
}
|
2014-01-02 08:20:08 -06:00
|
|
|
else
|
|
|
|
{
|
|
|
|
applySingleColorEffect();
|
|
|
|
}
|
2013-12-10 00:56:58 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RivReservoirFaultsPartMgr::updateCellEdgeResultColor(size_t timeStepIndex, RimResultSlot* cellResultSlot, RimCellEdgeResultSlot* cellEdgeResultSlot)
|
|
|
|
{
|
|
|
|
for (size_t i = 0; i < m_faultParts.size(); i++)
|
|
|
|
{
|
|
|
|
m_faultParts[i]->updateCellEdgeResultColor(timeStepIndex, cellResultSlot, cellEdgeResultSlot);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-18 05:18:15 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RivReservoirFaultsPartMgr::appendLabelPartsToModel(cvf::ModelBasicList* model)
|
|
|
|
{
|
|
|
|
CVF_ASSERT(model != NULL);
|
|
|
|
|
|
|
|
if (!m_faultCollection) return;
|
|
|
|
|
2013-12-19 03:37:16 -06:00
|
|
|
if (!m_faultCollection->showFaultCollection()) return;
|
2013-12-18 05:18:15 -06:00
|
|
|
|
|
|
|
if (!m_faultCollection->showFaultLabel() ) return;
|
|
|
|
|
|
|
|
// Check match between model fault count and fault parts
|
|
|
|
CVF_ASSERT(m_faultCollection->faults.size() == m_faultParts.size());
|
|
|
|
|
|
|
|
cvf::ModelBasicList parts;
|
|
|
|
|
|
|
|
for (size_t i = 0; i < m_faultCollection->faults.size(); i++)
|
|
|
|
{
|
|
|
|
const RimFault* rimFault = m_faultCollection->faults[i];
|
|
|
|
|
|
|
|
cvf::ref<RivFaultPartMgr> rivFaultPart = m_faultParts[i];
|
|
|
|
CVF_ASSERT(rivFaultPart.notNull());
|
|
|
|
|
|
|
|
if (rimFault->showFault())
|
|
|
|
{
|
|
|
|
rivFaultPart->appendLabelPartsToModel(&parts);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (size_t i = 0; i < parts.partCount(); i++)
|
|
|
|
{
|
|
|
|
cvf::Part* part = parts.part(i);
|
|
|
|
part->setTransform(m_scaleTransform.p());
|
|
|
|
|
|
|
|
model->addPart(part);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|