#811, #812 WIP, Formation names coloring of cells. First shot. Works but needs refinment.

This commit is contained in:
Jacob Støren committed 2016-09-06 10:27:30 +02:00
1 parent ca6e650a72
commit c903e87dfd
28 files changed
+373 -50

No files matched your search

@@ -19,6 +19,7 @@ ${CEE_CURRENT_LIST_DIR}RigCombTransResultAccessor.h
${CEE_CURRENT_LIST_DIR}RigCombMultResultAccessor.h
${CEE_CURRENT_LIST_DIR}RigResultModifier.h
${CEE_CURRENT_LIST_DIR}RigResultModifierFactory.h
${CEE_CURRENT_LIST_DIR}RigFormationNames.h
${CEE_CURRENT_LIST_DIR}RigWellLogExtractor.h
${CEE_CURRENT_LIST_DIR}RigEclipseWellLogExtractor.h
${CEE_CURRENT_LIST_DIR}RigLocalGrid.h
@@ -56,6 +57,7 @@ ${CEE_CURRENT_LIST_DIR}RigCellEdgeResultAccessor.cpp
${CEE_CURRENT_LIST_DIR}RigCombTransResultAccessor.cpp
${CEE_CURRENT_LIST_DIR}RigCombMultResultAccessor.cpp
${CEE_CURRENT_LIST_DIR}RigResultModifierFactory.cpp
${CEE_CURRENT_LIST_DIR}RigFormationNames.cpp
${CEE_CURRENT_LIST_DIR}RigWellLogExtractor.cpp
${CEE_CURRENT_LIST_DIR}RigEclipseWellLogExtractor.cpp
${CEE_CURRENT_LIST_DIR}RigLocalGrid.cpp
@@ -247,6 +247,11 @@ size_t RigCaseCellResultsData::findScalarResultIndex(const QString& resultName)
scalarResultIndex = this->findScalarResultIndex(RimDefines::INPUT_PROPERTY, resultName);
}
if(scalarResultIndex == cvf::UNDEFINED_SIZE_T)
{
scalarResultIndex = this->findScalarResultIndex(RimDefines::FORMATION_NAMES, resultName);
}
return scalarResultIndex;
}
@@ -22,6 +22,7 @@
#include "RigMainGrid.h"
#include "RigCaseCellResultsData.h"
#include "RigResultAccessorFactory.h"
#include "RigFormationNames.h"
//--------------------------------------------------------------------------------------------------
///
@@ -468,6 +469,56 @@ void RigCaseData::computeActiveCellsGeometryBoundingBox()
m_mainGrid->setDisplayModelOffset(bb.min());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigCaseData::setActiveFormationNames(RigFormationNames* activeFormationNames)
{
m_activeFormationNamesData = activeFormationNames;
if (!activeFormationNames) return;
size_t totalGlobCellCount = m_mainGrid->globalCellArray().size();
size_t resIndex = m_matrixModelResults->addStaticScalarResult(RimDefines::FORMATION_NAMES,
"Active Formation Names",
false,
totalGlobCellCount);
std::vector<double>& fnData = m_matrixModelResults->cellScalarResults(resIndex,0);
size_t localCellCount = m_mainGrid->cellCount();
for (size_t cIdx = 0; cIdx < localCellCount; ++cIdx)
{
size_t i (cvf::UNDEFINED_SIZE_T), j(cvf::UNDEFINED_SIZE_T), k(cvf::UNDEFINED_SIZE_T);
if(!m_mainGrid->ijkFromCellIndex(cIdx, &i, &j, &k)) continue;
int formNameIdx = activeFormationNames->formationIndexFromKLayerIdx(k);
fnData[cIdx] = formNameIdx;
}
for (size_t cIdx = localCellCount; cIdx < totalGlobCellCount; ++cIdx)
{
size_t mgrdCellIdx = m_mainGrid->globalCellArray()[cIdx].mainGridCellIndex();
size_t i (cvf::UNDEFINED_SIZE_T), j(cvf::UNDEFINED_SIZE_T), k(cvf::UNDEFINED_SIZE_T);
if(!m_mainGrid->ijkFromCellIndex(mgrdCellIdx, &i, &j, &k)) continue;
int formNameIdx = activeFormationNames->formationIndexFromKLayerIdx(k);
fnData[cIdx] = formNameIdx;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFormationNames* RigCaseData::activeFormationNames()
{
return m_activeFormationNamesData.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -30,7 +30,7 @@
#include "RigActiveCellInfo.h"
class RigCaseCellResultsData;
class RigFormationNames;
class RigCaseData : public cvf::Object
{
@@ -62,7 +62,10 @@ public:
RigActiveCellInfo* activeCellInfo(RifReaderInterface::PorosityModelResultType porosityModel);
const RigActiveCellInfo* activeCellInfo(RifReaderInterface::PorosityModelResultType porosityModel) const;
void setActiveCellInfo(RifReaderInterface::PorosityModelResultType porosityModel, RigActiveCellInfo* activeCellInfo);
void setActiveFormationNames(RigFormationNames* activeFormationNames);
RigFormationNames* activeFormationNames();
void setWellResults(const cvf::Collection<RigSingleWellResultsData>& data);
const cvf::Collection<RigSingleWellResultsData>& wellResults() { return m_wellResults; }
@@ -90,9 +93,12 @@ private:
cvf::ref<RigCaseCellResultsData> m_matrixModelResults;
cvf::ref<RigCaseCellResultsData> m_fractureModelResults;
cvf::ref<RigFormationNames> m_activeFormationNamesData;
cvf::Collection<RigSingleWellResultsData> m_wellResults; //< A WellResults object for each well in the reservoir
cvf::Collection<cvf::UByteArray> m_wellCellsInGrid; //< A bool array pr grid with one bool pr cell telling wether the cell is a well cell or not
cvf::Collection<cvf::UIntArray> m_gridCellToResultWellIndex; //< Array pr grid with index to well pr cell telling which well a cell is in
UnitsType m_unitsType;
};
@@ -0,0 +1,64 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Statoil ASA
//
// 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 "RigFormationNames.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFormationNames::RigFormationNames()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFormationNames::~RigFormationNames()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RigFormationNames::formationNameFromKLayerIdx(size_t Kidx)
{
int idx = formationIndexFromKLayerIdx(Kidx);
if(idx >= m_formationNames.size()) return "";
if(idx == -1) return "";
return m_formationNames[idx];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFormationNames::appendFormationRange(const QString& name, int kStartIdx, int kEndIdx)
{
CVF_ASSERT(kStartIdx <= kEndIdx);
int nameIdx = static_cast<int>(m_formationNames.size());
m_formationNames.push_back(name);
if(kEndIdx >= static_cast<int>(m_nameIndexPrKLayer.size())) m_nameIndexPrKLayer.resize(kEndIdx + 1, -1);
for(int kIdx = kStartIdx; kIdx <= kEndIdx; ++kIdx)
{
m_nameIndexPrKLayer[kIdx] = nameIdx;
}
}
@@ -0,0 +1,51 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Statoil ASA
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cvfBase.h"
#include "cvfObject.h"
#include <QString>
#include <vector>
class RigFormationNames: public cvf::Object
{
public:
RigFormationNames();
~RigFormationNames();
int formationIndexFromKLayerIdx(size_t Kidx)
{
if(Kidx >= m_nameIndexPrKLayer.size()) return -1;
return m_nameIndexPrKLayer[Kidx];
}
QString formationNameFromKLayerIdx(size_t Kidx);
const std::vector<QString>& formationNames() const { return m_formationNames;}
void appendFormationRange(const QString& name, int kStartIdx, int kEndIdx);
private:
std::vector<int> m_nameIndexPrKLayer;
std::vector<QString> m_formationNames;
};