mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Faults: Reading from Eclipse text files and basic visualization
Added reading of faults directly from Eclipse text files Added named faults in project tree Added fault geompetry parts Added test data
This commit is contained in:
140
ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp
Normal file
140
ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp
Normal file
@@ -0,0 +1,140 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron 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 "RivFaultPartMgr.h"
|
||||
|
||||
#include "cvfPart.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
#include "cvfColor3.h"
|
||||
#include "cvfTransform.h"
|
||||
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
|
||||
#include "RimFaultCollection.h"
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivFaultPartMgr::RivFaultPartMgr(const RigGridBase* grid, size_t gridIdx, const RimFaultCollection* faultCollection)
|
||||
: m_gridIdx(gridIdx),
|
||||
m_grid(grid),
|
||||
m_faultCollection(faultCollection)
|
||||
{
|
||||
CVF_ASSERT(grid);
|
||||
|
||||
if (faultCollection)
|
||||
{
|
||||
for (size_t i = 0; i < faultCollection->faults.size(); i++)
|
||||
{
|
||||
m_faultParts.push_back(new RivFaultPart(grid, faultCollection->faults[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivFaultPartMgr::~RivFaultPartMgr()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFaultPartMgr::setTransform(cvf::Transform* scaleTransform)
|
||||
{
|
||||
m_scaleTransform = scaleTransform;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFaultPartMgr::setCellVisibility(cvf::UByteArray* cellVisibilities)
|
||||
{
|
||||
CVF_ASSERT(cellVisibilities);
|
||||
|
||||
for (size_t i = 0; i < m_faultParts.size(); i++)
|
||||
{
|
||||
m_faultParts.at(i)->setCellVisibility(cellVisibilities);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFaultPartMgr::appendPartsToModel(cvf::ModelBasicList* model)
|
||||
{
|
||||
CVF_ASSERT(model != NULL);
|
||||
|
||||
// Faults are only present for main grid
|
||||
if (!m_grid->isMainGrid()) return;
|
||||
|
||||
if (!m_faultCollection->showFaultCollection()) return;
|
||||
|
||||
cvf::ModelBasicList parts;
|
||||
|
||||
for (size_t i = 0; i < m_faultParts.size(); i++)
|
||||
{
|
||||
m_faultParts[i]->appendPartsToModel(&parts);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < parts.partCount(); i++)
|
||||
{
|
||||
cvf::Part* part = parts.part(i);
|
||||
part->setTransform(m_scaleTransform.p());
|
||||
|
||||
model->addPart(part);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFaultPartMgr::updateCellColor(cvf::Color4f color)
|
||||
{
|
||||
for (size_t i = 0; i < m_faultParts.size(); i++)
|
||||
{
|
||||
m_faultParts[i]->updateCellColor(color);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFaultPartMgr::updateCellResultColor(size_t timeStepIndex, RimResultSlot* cellResultSlot)
|
||||
{
|
||||
for (size_t i = 0; i < m_faultParts.size(); i++)
|
||||
{
|
||||
m_faultParts[i]->updateCellResultColor(timeStepIndex, cellResultSlot);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFaultPartMgr::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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user