1363 - pre-proto - Creating class StimPlanCell and using this class when displaying stimPlan mesh on fracture

This commit is contained in:
astridkbjorke
2017-03-27 14:19:21 +02:00
parent c789b968f6
commit 520ab45649
6 changed files with 157 additions and 11 deletions

View File

@@ -100,6 +100,7 @@ ${CEE_CURRENT_LIST_DIR}RimFractureTemplate.h
${CEE_CURRENT_LIST_DIR}RimStimPlanFractureTemplate.h
${CEE_CURRENT_LIST_DIR}RimStimPlanLegendConfig.h
${CEE_CURRENT_LIST_DIR}RimStimPlanColors.h
${CEE_CURRENT_LIST_DIR}RimStimPlanCell.h
)
set (SOURCE_GROUP_SOURCE_FILES
@@ -198,6 +199,8 @@ ${CEE_CURRENT_LIST_DIR}RimFractureTemplate.cpp
${CEE_CURRENT_LIST_DIR}RimStimPlanFractureTemplate.cpp
${CEE_CURRENT_LIST_DIR}RimStimPlanLegendConfig.cpp
${CEE_CURRENT_LIST_DIR}RimStimPlanColors.cpp
${CEE_CURRENT_LIST_DIR}RimStimPlanCell.cpp
)

View File

@@ -0,0 +1,50 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 - 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 "RimStimPlanCell.h"
CAF_PDM_SOURCE_INIT(RimStimPlanCell, "RimStimPlanCell");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimStimPlanCell::RimStimPlanCell()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimStimPlanCell::RimStimPlanCell(std::vector<cvf::Vec3d> polygon, double value, size_t i, size_t j)
{
m_polygon = polygon;
m_value = value;
m_i = i;
m_j = j;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimStimPlanCell::~RimStimPlanCell()
{
}

View File

@@ -0,0 +1,56 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 - 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 "cafPdmObject.h"
#include "cvfBase.h"
#include "cvfVector3.h"
#include <vector>
//==================================================================================================
///
///
//==================================================================================================
class RimStimPlanCell : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimStimPlanCell();
RimStimPlanCell(std::vector<cvf::Vec3d> polygon, double value, size_t i, size_t j);
virtual ~RimStimPlanCell();
std::vector<cvf::Vec3d> getPolygon() { return m_polygon; }
double getValue() { return m_value; }
size_t i() { return m_i; }
size_t j() { return m_j; }
private:
std::vector<cvf::Vec3d> m_polygon;
double m_value;
size_t m_i;
size_t m_j;
};

View File

@@ -26,9 +26,12 @@
#include "RimEclipseView.h"
#include "RimFracture.h"
#include "RimProject.h"
#include "RimStimPlanCell.h"
#include "RimStimPlanColors.h"
#include "RimStimPlanLegendConfig.h"
#include "RivWellFracturePartMgr.h"
#include "cafPdmObject.h"
#include "cafPdmUiDoubleSliderEditor.h"
#include "cafPdmUiFilePathEditor.h"
@@ -40,7 +43,6 @@
#include <algorithm>
#include <vector>
#include "RivWellFracturePartMgr.h"
@@ -768,6 +770,40 @@ void RimStimPlanFractureTemplate::getStimPlanDataAsPolygonsAndValues(std::vector
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimStimPlanCell*> RimStimPlanFractureTemplate::getStimPlanCells(const QString& resultName, const QString& unitName, size_t timeStepIndex)
{
std::vector<RimStimPlanCell*> stimPlanCells;
std::vector<std::vector<double>> propertyValuesAtTimeStep = getMirroredDataAtTimeIndex(resultName, unitName, timeStepIndex);
std::vector<double> depthCoordsAtNodes = adjustedDepthCoordsAroundWellPathPosition();
std::vector<double> xCoordsAtNodes = getNegAndPosXcoords();
std::vector<double> xCoords;
for (int i = 0; i < xCoordsAtNodes.size() - 1; i++) xCoords.push_back((xCoordsAtNodes[i] + xCoordsAtNodes[i + 1]) / 2);
std::vector<double> depthCoords;
for (int i = 0; i < depthCoordsAtNodes.size() - 1; i++) depthCoords.push_back((depthCoordsAtNodes[i] + depthCoordsAtNodes[i + 1]) / 2);
for (int i = 0; i < xCoords.size() - 1; i++)
{
for (int j = 0; j < depthCoords.size() - 1; j++)
{
std::vector<cvf::Vec3d> cellPolygon;
cellPolygon.push_back(cvf::Vec3d(static_cast<float>(xCoords[i]), static_cast<float>(depthCoords[j]), 0.0));
cellPolygon.push_back(cvf::Vec3d(static_cast<float>(xCoords[i + 1]), static_cast<float>(depthCoords[j]), 0.0));
cellPolygon.push_back(cvf::Vec3d(static_cast<float>(xCoords[i + 1]), static_cast<float>(depthCoords[j + 1]), 0.0));
cellPolygon.push_back(cvf::Vec3d(static_cast<float>(xCoords[i]), static_cast<float>(depthCoords[j + 1]), 0.0));
RimStimPlanCell* stimPlanCell = new RimStimPlanCell(cellPolygon, propertyValuesAtTimeStep[j + 1][i + 1], i, j);
stimPlanCells.push_back(stimPlanCell);
}
}
return stimPlanCells;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -35,6 +35,7 @@
class RigStimPlanFractureDefinition;
class RimStimPlanLegendConfig;
class RimStimPlanCell;
//==================================================================================================
///
@@ -69,7 +70,9 @@ public:
std::vector<double> getStimPlanTimeValues();
std::vector<std::pair<QString, QString> > getStimPlanPropertyNamesUnits() const;
void computeMinMax(const QString& resultName, const QString& unitName, double* minValue, double* maxValue) const;
void getStimPlanDataAsPolygonsAndValues(std::vector<std::vector<cvf::Vec3d> > &cellsAsPolygons, std::vector<double> &parameterValue, const QString& resultName, const QString& unitName, size_t timeStepIndex);
std::vector<RimStimPlanCell*> getStimPlanCells(const QString& resultName, const QString& unitName, size_t timeStepIndex);
void loadDataAndUpdate();
void setDefaultsBasedOnXMLfile();