#1138 - pre-proto - Showing data from stimPlan-file on fracture

This commit is contained in:
astridkbjorke 2017-02-15 15:14:16 +01:00
parent 1cf6d073fe
commit bcd3009066
6 changed files with 138 additions and 28 deletions

View File

@ -31,6 +31,7 @@
#include "cvfPrimitiveSet.h"
#include "cvfPrimitiveSetIndexedUInt.h"
#include "cvfScalarMapperContinuousLinear.h"
#include "RimStimPlanFractureTemplate.h"
//--------------------------------------------------------------------------------------------------
@ -136,18 +137,68 @@ void RivWellFracturePartMgr::updatePartGeometryTexture(caf::DisplayCoordTransfor
scalarMapper->setLevelCount(4, true);
}
cvf::ref<cvf::Vec2fArray> textureCoords = new cvf::Vec2fArray;
textureCoords->resize(nodeCoords.size());
for (size_t i = 0; i < textureCoords->size(); i++)
//double scalarValue = i % 4;
RimFractureTemplate * fracTemplate = m_rimFracture->attachedFractureDefinition();
RimStimPlanFractureTemplate* stimPlanFracTemplate;
if (dynamic_cast<RimStimPlanFractureTemplate*>(fracTemplate))
{
//double scalarValue = i % 4;
double scalarValue = 0;
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(scalarValue);
textureCoords->set(i, texCoord);
stimPlanFracTemplate = dynamic_cast<RimStimPlanFractureTemplate*>(fracTemplate);
}
else
{
return;
}
int timeStepIndex = m_rimFracture->stimPlanTimeIndexToPlot;
std::vector<std::vector<double> > dataToPlot;
if (m_rimFracture->stimPlanParameterToPlot == RimFracture::CONDUCTIVITY)
{
dataToPlot = stimPlanFracTemplate->getConductivitiesAtTimeStep(timeStepIndex);
}
else if (m_rimFracture->stimPlanParameterToPlot == RimFracture::PERMEABILITY)
{
dataToPlot = stimPlanFracTemplate->getPermeabilitiesAtTimeStep(timeStepIndex);
}
else if (m_rimFracture->stimPlanParameterToPlot == RimFracture::WIDTH)
{
dataToPlot = stimPlanFracTemplate->getWidthsAtTimeStep(timeStepIndex);
}
if (dataToPlot.empty())
{
return;
}
cvf::ref<cvf::Vec2fArray> textureCoords = new cvf::Vec2fArray;
textureCoords->resize(nodeCoords.size());
// for (size_t i = 0; i < textureCoords->size(); i++)
// {
//
// double scalarValue = 0;
//
// cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(scalarValue);
//
// textureCoords->set(i, texCoord);
// }
int i = 0;
for (std::vector<double> depthData : dataToPlot)
{
std::vector<double> mirroredValuesAtDepth = mirrorDataAtSingleDepth(depthData);
for (double gridXdata : mirroredValuesAtDepth)
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(gridXdata);
textureCoords->set(i, texCoord);
i++;
}
}
geo->setTextureCoordArray(textureCoords.p());
caf::ScalarMapperEffectGenerator nncEffgen(scalarMapper.p(), caf::PO_NEG_LARGE);
@ -157,6 +208,25 @@ void RivWellFracturePartMgr::updatePartGeometryTexture(caf::DisplayCoordTransfor
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RivWellFracturePartMgr::mirrorDataAtSingleDepth(std::vector<double> depthData)
{
std::vector<double> mirroredValuesAtGivenDepth;
mirroredValuesAtGivenDepth.push_back(depthData[0]);
for (int i = 1; i < (depthData.size()); i++) //starting at 1 since we don't want center value twice
{
double valueAtGivenX = depthData[i];
mirroredValuesAtGivenDepth.insert(mirroredValuesAtGivenDepth.begin(), valueAtGivenX);
mirroredValuesAtGivenDepth.push_back(valueAtGivenX);
}
return mirroredValuesAtGivenDepth;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -164,8 +234,17 @@ void RivWellFracturePartMgr::appendGeometryPartsToModel(cvf::ModelBasicList* mod
{
if (m_part.isNull())
{
updatePartGeometry(displayCoordTransform);
//updatePartGeometryTexture(displayCoordTransform);
if (m_rimFracture->attachedFractureDefinition())
{
if (dynamic_cast<RimStimPlanFractureTemplate*>(m_rimFracture->attachedFractureDefinition()))
{
updatePartGeometryTexture(displayCoordTransform);
}
else
{
updatePartGeometry(displayCoordTransform);
}
}
}
if (m_part.notNull())

View File

@ -58,8 +58,9 @@ private:
void updatePartGeometry(caf::DisplayCoordTransform* displayCoordTransform);
void updatePartGeometryTexture(caf::DisplayCoordTransform* displayCoordTransform);
static cvf::ref<cvf::DrawableGeo> createGeo(const std::vector<cvf::uint>& triangleIndices, const std::vector<cvf::Vec3f>& nodeCoords);
std::vector<double> mirrorDataAtSingleDepth(std::vector<double> depthData);
static cvf::ref<cvf::DrawableGeo> createGeo(const std::vector<cvf::uint>& triangleIndices, const std::vector<cvf::Vec3f>& nodeCoords);
private:
caf::PdmPointer<RimFracture> m_rimFracture;
cvf::ref<cvf::Part> m_part;

View File

@ -117,11 +117,11 @@ RimFracture::RimFracture(void)
m_displayIJK.registerGetMethod(this, &RimFracture::createOneBasedIJK);
m_displayIJK.uiCapability()->setUiReadOnly(true);
CAF_PDM_InitFieldNoDefault(&m_legendConfigPerm, "LegendConfigPerm", "LegendConfigPerm", "", "", "");
m_legendConfigPerm = new RimLegendConfig;
CAF_PDM_InitFieldNoDefault(&m_legendConfigPermeability, "LegendConfigPerm", "LegendConfigPerm", "", "", "");
m_legendConfigPermeability = new RimLegendConfig;
CAF_PDM_InitFieldNoDefault(&m_legendConfigCond, "LegendConfigCond", "LegendConfigCond", "", "", "");
m_legendConfigCond = new RimLegendConfig;
CAF_PDM_InitFieldNoDefault(&m_legendConfigConductivity, "LegendConfigCond", "LegendConfigCond", "", "", "");
m_legendConfigConductivity = new RimLegendConfig;
CAF_PDM_InitFieldNoDefault(&m_legendConfigWidth, "LegendConfigWidth", "LegendConfigWidth", "", "", "");
m_legendConfigWidth = new RimLegendConfig;
@ -137,12 +137,12 @@ RimFracture::RimFracture(void)
//--------------------------------------------------------------------------------------------------
RimFracture::~RimFracture()
{
delete m_legendConfigCond;
delete m_legendConfigPerm;
delete m_legendConfigConductivity;
delete m_legendConfigPermeability;
delete m_legendConfigWidth;
m_legendConfigCond = nullptr;
m_legendConfigPerm = nullptr;
m_legendConfigConductivity = nullptr;
m_legendConfigPermeability = nullptr;
m_legendConfigWidth = nullptr;
}
@ -704,9 +704,9 @@ void RimFracture::defineEditorAttribute(const caf::PdmFieldHandle* field, QStrin
void RimFracture::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
{
// TODO: Based on selected result, show correct legend
uiTreeOrdering.add(m_legendConfigCond);
uiTreeOrdering.add(m_legendConfigPerm);
uiTreeOrdering.add(m_legendConfigWidth);
if (RimFracture::CONDUCTIVITY) uiTreeOrdering.add(m_legendConfigConductivity);
if (RimFracture::PERMEABILITY) uiTreeOrdering.add(m_legendConfigPermeability);
if (RimFracture::WIDTH) uiTreeOrdering.add(m_legendConfigWidth);
uiTreeOrdering.setForgetRemainingFields(true);
}

View File

@ -78,7 +78,6 @@ public:
void setFractureTemplate(RimFractureTemplate* fractureTemplate);
RimFractureTemplate* attachedFractureDefinition() const;
//TODO: Skal dette være ellipseTemplate som før?
RivWellFracturePartMgr* fracturePartManager();
@ -129,7 +128,7 @@ private:
cvf::ref<RivWellFracturePartMgr> m_rivFracture;
caf::PdmChildField<RimLegendConfig*> m_legendConfigPerm;
caf::PdmChildField<RimLegendConfig*> m_legendConfigCond;
caf::PdmChildField<RimLegendConfig*> m_legendConfigPermeability;
caf::PdmChildField<RimLegendConfig*> m_legendConfigConductivity;
caf::PdmChildField<RimLegendConfig*> m_legendConfigWidth;
};

View File

@ -405,6 +405,7 @@ void RimStimPlanFractureTemplate::fractureGeometry(std::vector<cvf::Vec3f>* node
std::vector<double> xCoords = getNegAndPosXcoords();
//std::vector<double> xCoords = m_stimPlanFractureDefinitionData->gridXs;
cvf::uint lenXcoords = static_cast<cvf::uint>(xCoords.size());
std::vector<double> adjustedDepths = adjustedDepthCoordsAroundWellPathPosition();
@ -477,6 +478,30 @@ std::vector<double> RimStimPlanFractureTemplate::getStimPlanTimeValues()
return m_stimPlanFractureDefinitionData->timeSteps;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::vector<double>> RimStimPlanFractureTemplate::getConductivitiesAtTimeStep(size_t timStep)
{
return m_stimPlanFractureDefinitionData->conductivities[timStep];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::vector<double>> RimStimPlanFractureTemplate::getPermeabilitiesAtTimeStep(size_t timStep)
{
return m_stimPlanFractureDefinitionData->permeabilities[timStep];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::vector<double>> RimStimPlanFractureTemplate::getWidthsAtTimeStep(size_t timStep)
{
return m_stimPlanFractureDefinitionData->widths[timStep];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -46,6 +46,8 @@ public:
RimStimPlanFractureTemplate(void);
virtual ~RimStimPlanFractureTemplate(void);
caf::PdmField<double> wellPathDepthAtFracture;
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
void setFileName(const QString& fileName);
@ -59,7 +61,11 @@ public:
std::vector<double> adjustedDepthCoordsAroundWellPathPosition();
std::vector<double> getStimPlanTimeValues();
caf::PdmField<double> wellPathDepthAtFracture;
std::vector<std::vector<double>> getConductivitiesAtTimeStep(size_t timStep);
std::vector<std::vector<double>> getPermeabilitiesAtTimeStep(size_t timStep);
std::vector<std::vector<double>> getWidthsAtTimeStep(size_t timStep);
protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);