#2509 Fracture : Remove obsolete unit conversion code

This commit is contained in:
Magne Sjaastad
2018-02-21 08:18:55 +01:00
parent 4e737885e4
commit b0be540977
9 changed files with 22 additions and 118 deletions

View File

@@ -664,7 +664,7 @@ cvf::ref<cvf::Part> RivWellFracturePartMgr::createStimPlanElementColorSurfacePar
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::Part> RivWellFracturePartMgr::createContainmentMaskPart(const RimEclipseView& activeView)
{
std::vector<cvf::Vec3f> borderPolygonLocalCS = m_rimFracture->fractureTemplate()->fractureBorderPolygon(m_rimFracture->fractureUnit());
std::vector<cvf::Vec3f> borderPolygonLocalCS = m_rimFracture->fractureTemplate()->fractureBorderPolygon();
cvf::Mat4d frMx = m_rimFracture->transformMatrix();
cvf::BoundingBox frBBox;

View File

@@ -112,38 +112,12 @@ void RimEllipseFractureTemplate::fieldChangedByUi(const caf::PdmFieldHandle* cha
///
//--------------------------------------------------------------------------------------------------
void RimEllipseFractureTemplate::fractureTriangleGeometry(std::vector<cvf::Vec3f>* nodeCoords,
std::vector<cvf::uint>* triangleIndices,
RiaEclipseUnitTools::UnitSystem neededUnit)
std::vector<cvf::uint>* triangleIndices)
{
RigEllipsisTesselator tesselator(20);
float a = cvf::UNDEFINED_FLOAT;
float b = cvf::UNDEFINED_FLOAT;
if (neededUnit == fractureTemplateUnit())
{
a = m_halfLength;
b = m_height / 2.0f;
}
else if (fractureTemplateUnit() == RiaEclipseUnitTools::UNITS_METRIC && neededUnit == RiaEclipseUnitTools::UNITS_FIELD)
{
RiaLogging::info(QString("Converting fracture template geometry from metric to field"));
a = RiaEclipseUnitTools::meterToFeet(m_halfLength);
b = RiaEclipseUnitTools::meterToFeet(m_height / 2.0f);
}
else if (fractureTemplateUnit() == RiaEclipseUnitTools::UNITS_FIELD && neededUnit == RiaEclipseUnitTools::UNITS_METRIC)
{
RiaLogging::info(QString("Converting fracture template geometry from field to metric"));
a = RiaEclipseUnitTools::feetToMeter(m_halfLength);
b = RiaEclipseUnitTools::feetToMeter(m_height / 2.0f);
}
else
{
//Should never get here...
RiaLogging::error(QString("Error: Could not convert units for fracture / fracture template"));
return;
}
float a = m_halfLength;
float b = m_height / 2.0f;
tesselator.tesselateEllipsis(a, b, triangleIndices, nodeCoords);
}
@@ -151,14 +125,14 @@ void RimEllipseFractureTemplate::fractureTriangleGeometry(std::vector<cvf::Vec3f
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<cvf::Vec3f> RimEllipseFractureTemplate::fractureBorderPolygon(RiaEclipseUnitTools::UnitSystem neededUnit)
std::vector<cvf::Vec3f> RimEllipseFractureTemplate::fractureBorderPolygon()
{
std::vector<cvf::Vec3f> polygon;
std::vector<cvf::Vec3f> nodeCoords;
std::vector<cvf::uint> triangleIndices;
fractureTriangleGeometry(&nodeCoords, &triangleIndices, neededUnit);
fractureTriangleGeometry(&nodeCoords, &triangleIndices);
for (size_t i = 1; i < nodeCoords.size(); i++)
{
@@ -221,7 +195,7 @@ void RimEllipseFractureTemplate::setupFractureGridCells()
double cond = conductivity();
std::vector<cvf::Vec3f> ellipseFracPolygon = fractureBorderPolygon(fractureTemplateUnit());
std::vector<cvf::Vec3f> ellipseFracPolygon = fractureBorderPolygon();
std::vector<cvf::Vec3d> ellipseFracPolygonDouble;
for (auto v : ellipseFracPolygon) ellipseFracPolygonDouble.push_back(static_cast<cvf::Vec3d>(v));
std::vector<std::vector<cvf::Vec3d> >clippedFracturePolygons = RigCellGeometryTools::intersectPolygons(cellPolygon, ellipseFracPolygonDouble);

View File

@@ -49,9 +49,8 @@ public:
void loadDataAndUpdate();
void fractureTriangleGeometry(std::vector<cvf::Vec3f>* nodeCoords,
std::vector<cvf::uint>* polygonIndices,
RiaEclipseUnitTools::UnitSystem neededUnit);
std::vector<cvf::Vec3f> fractureBorderPolygon(RiaEclipseUnitTools::UnitSystem neededUnit);
std::vector<cvf::uint>* polygonIndices);
std::vector<cvf::Vec3f> fractureBorderPolygon();
void changeUnits();
const RigFractureGrid* fractureGrid() const;

View File

@@ -361,7 +361,7 @@ void RimFracture::triangleGeometry(std::vector<cvf::uint>* triangleIndices, std:
RimFractureTemplate* fractureDef = fractureTemplate();
if (fractureDef)
{
fractureDef->fractureTriangleGeometry(nodeCoords, triangleIndices, fractureUnit());
fractureDef->fractureTriangleGeometry(nodeCoords, triangleIndices);
}
cvf::Mat4d m = transformMatrix();

View File

@@ -119,10 +119,9 @@ public:
double perforationLengthInFractureUnit(RiaEclipseUnitTools::UnitSystemType fractureUnit);
virtual void fractureTriangleGeometry(std::vector<cvf::Vec3f>* nodeCoords,
std::vector<cvf::uint>* triangleIndices,
RiaEclipseUnitTools::UnitSystem neededUnit) = 0;
std::vector<cvf::uint>* triangleIndices) = 0;
virtual std::vector<cvf::Vec3f> fractureBorderPolygon(RiaEclipseUnitTools::UnitSystem neededUnit) = 0;
virtual std::vector<cvf::Vec3f> fractureBorderPolygon() = 0;
virtual const RigFractureGrid* fractureGrid() const = 0;
const RimFractureContainment* fractureContainment();

View File

@@ -634,9 +634,11 @@ void RimStimPlanFractureTemplate::updateFractureGrid()
if (m_stimPlanFractureDefinitionData.notNull())
{
QString condUnit = RiaDefines::unitStringConductivity(fractureTemplateUnit());
m_fractureGrid = m_stimPlanFractureDefinitionData->createFractureGrid(m_conductivityResultNameOnFile,
m_activeTimeStepIndex,
fractureTemplateUnit(),
condUnit,
m_wellPathDepthAtFracture);
}
}
@@ -647,8 +649,7 @@ void RimStimPlanFractureTemplate::updateFractureGrid()
///
//--------------------------------------------------------------------------------------------------
void RimStimPlanFractureTemplate::fractureTriangleGeometry(std::vector<cvf::Vec3f>* nodeCoords,
std::vector<cvf::uint>* triangleIndices,
RiaEclipseUnitTools::UnitSystem neededUnit)
std::vector<cvf::uint>* triangleIndices)
{
if (m_stimPlanFractureDefinitionData.isNull())
@@ -658,7 +659,6 @@ void RimStimPlanFractureTemplate::fractureTriangleGeometry(std::vector<cvf::Vec3
else
{
m_stimPlanFractureDefinitionData->createFractureTriangleGeometry(m_wellPathDepthAtFracture,
neededUnit,
name(),
nodeCoords,
triangleIndices);
@@ -668,7 +668,7 @@ void RimStimPlanFractureTemplate::fractureTriangleGeometry(std::vector<cvf::Vec3
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<cvf::Vec3f> RimStimPlanFractureTemplate::fractureBorderPolygon(RiaEclipseUnitTools::UnitSystem neededUnit)
std::vector<cvf::Vec3f> RimStimPlanFractureTemplate::fractureBorderPolygon()
{
if (m_stimPlanFractureDefinitionData.isNull()) return std::vector<cvf::Vec3f>();
@@ -681,7 +681,6 @@ std::vector<cvf::Vec3f> RimStimPlanFractureTemplate::fractureBorderPolygon(RiaEc
parameterUnit,
m_activeTimeStepIndex,
m_wellPathDepthAtFracture,
neededUnit,
name());
}

View File

@@ -69,9 +69,8 @@ public:
const RigFractureGrid* fractureGrid() const override;
void updateFractureGrid();
void fractureTriangleGeometry(std::vector<cvf::Vec3f>* nodeCoords,
std::vector<cvf::uint>* triangleIndices,
RiaEclipseUnitTools::UnitSystem neededUnit) override;
std::vector<cvf::Vec3f> fractureBorderPolygon(RiaEclipseUnitTools::UnitSystem neededUnit) override;
std::vector<cvf::uint>* triangleIndices) override;
std::vector<cvf::Vec3f> fractureBorderPolygon() override;
// Result Access

View File

@@ -256,7 +256,7 @@ std::vector<std::pair<QString, QString> > RigStimPlanFractureDefinition::getStim
//--------------------------------------------------------------------------------------------------
cvf::ref<RigFractureGrid> RigStimPlanFractureDefinition::createFractureGrid(const QString& resultName,
int activeTimeStepIndex,
RiaEclipseUnitTools::UnitSystemType fractureTemplateUnit,
const QString& conductivityUnitText,
double wellPathIntersectionAtFractureDepth)
{
std::vector<RigFractureCell> stimPlanCells;
@@ -264,10 +264,8 @@ cvf::ref<RigFractureGrid> RigStimPlanFractureDefinition::createFractureGrid(cons
bool wellCenterStimPlanCellFound = false;
QString condUnit = RiaDefines::unitStringConductivity(fractureTemplateUnit);
std::vector<std::vector<double>> conductivityValuesAtTimeStep = this->getDataAtTimeIndex(resultName,
condUnit,
conductivityUnitText,
activeTimeStepIndex);
std::vector<double> yCoordsAtNodes = this->adjustedYCoordsAroundWellPathPosition(wellPathIntersectionAtFractureDepth);
@@ -365,7 +363,6 @@ std::vector<double> RigStimPlanFractureDefinition::fractureGridResults(const QSt
///
//--------------------------------------------------------------------------------------------------
void RigStimPlanFractureDefinition::createFractureTriangleGeometry(double wellPathIntersectionAtFractureDepth,
RiaEclipseUnitTools::UnitSystem neededUnit,
const QString& fractureUserName,
std::vector<cvf::Vec3f>* vertices,
std::vector<cvf::uint>* triangleIndices)
@@ -375,30 +372,6 @@ void RigStimPlanFractureDefinition::createFractureTriangleGeometry(double wellPa
std::vector<double> adjustedYs = this->adjustedYCoordsAroundWellPathPosition(wellPathIntersectionAtFractureDepth);
if ( neededUnit == m_unitSet )
{
RiaLogging::debug(QString("No conversion necessary for %1").arg(fractureUserName));
}
else if ( m_unitSet == RiaEclipseUnitTools::UNITS_METRIC && neededUnit == RiaEclipseUnitTools::UNITS_FIELD )
{
RiaLogging::info(QString("Converting StimPlan geometry from metric to field for fracture template %1").arg(fractureUserName));
for ( double& value : adjustedYs ) value = RiaEclipseUnitTools::meterToFeet(value);
for ( double& value : xCoords ) value = RiaEclipseUnitTools::meterToFeet(value);
}
else if ( m_unitSet == RiaEclipseUnitTools::UNITS_FIELD && neededUnit == RiaEclipseUnitTools::UNITS_METRIC )
{
RiaLogging::info(QString("Converting StimPlan geometry from field to metric for fracture template %1").arg(fractureUserName));
for ( double& value : adjustedYs ) value = RiaEclipseUnitTools::feetToMeter(value);
for ( double& value : xCoords ) value = RiaEclipseUnitTools::feetToMeter(value);
}
else
{
//Should never get here...
RiaLogging::error(QString("Error: Could not convert units for fracture template %1").arg(fractureUserName));
return;
}
for ( cvf::uint k = 0; k < adjustedYs.size(); k++ )
{
for ( cvf::uint i = 0; i < lenXcoords; i++ )
@@ -431,7 +404,6 @@ void RigStimPlanFractureDefinition::createFractureTriangleGeometry(double wellPa
triangleIndices->push_back((i + 1) + (k + 1)*lenXcoords);
triangleIndices->push_back((i)+ (k + 1)*lenXcoords);
}
}
}
}
@@ -474,7 +446,6 @@ std::vector<cvf::Vec3f> RigStimPlanFractureDefinition::createFractureBorderPolyg
const QString& resultUnit,
int activeTimeStepIndex,
double wellPathIntersectionAtFractureDepth,
RiaEclipseUnitTools::UnitSystem neededUnit,
const QString& fractureUserName)
{
std::vector<cvf::Vec3f> polygon;
@@ -526,41 +497,6 @@ std::vector<cvf::Vec3f> RigStimPlanFractureDefinition::createFractureBorderPolyg
//Adding first point last - to close the polygon
if ( polygon.size()>0 ) polygon.push_back(polygon[0]);
if ( neededUnit == m_unitSet )
{
RiaLogging::debug(QString("No conversion necessary for %1").arg(fractureUserName));
}
else if ( m_unitSet == RiaEclipseUnitTools::UNITS_METRIC && neededUnit == RiaEclipseUnitTools::UNITS_FIELD )
{
RiaLogging::info(QString("Converting StimPlan geometry from metric to field for fracture template %1").arg(fractureUserName));
for ( cvf::Vec3f& node : polygon )
{
float x = RiaEclipseUnitTools::meterToFeet(node.x());
float y = RiaEclipseUnitTools::meterToFeet(node.y());
float z = RiaEclipseUnitTools::meterToFeet(node.z());
node = cvf::Vec3f(x, y, z);
}
}
else if ( m_unitSet == RiaEclipseUnitTools::UNITS_FIELD && neededUnit == RiaEclipseUnitTools::UNITS_METRIC )
{
RiaLogging::info(QString("Converting StimPlan geometry from field to metric for fracture template %1").arg(fractureUserName));
for ( cvf::Vec3f& node : polygon )
{
float x = RiaEclipseUnitTools::feetToMeter(node.x());
float y = RiaEclipseUnitTools::feetToMeter(node.y());
float z = RiaEclipseUnitTools::feetToMeter(node.z());
node = cvf::Vec3f(x, y, z);
}
}
else
{
//Should never get here...
RiaLogging::error(QString("Error: Could not convert units for fracture template %1").arg(fractureUserName));
}
return polygon;
}

View File

@@ -73,11 +73,10 @@ public:
cvf::ref<RigFractureGrid> createFractureGrid(const QString& resultName,
int activeTimeStepIndex,
RiaEclipseUnitTools::UnitSystemType fractureTemplateUnit,
const QString& conductivityUnitText,
double wellPathIntersectionAtFractureDepth);
void createFractureTriangleGeometry(double wellPathIntersectionAtFractureDepth,
RiaEclipseUnitTools::UnitSystem neededUnit,
const QString& fractureUserName,
std::vector<cvf::Vec3f>* vertices,
std::vector<cvf::uint>* triangleIndices);
@@ -86,7 +85,6 @@ public:
const QString& resultUnit,
int activeTimeStepIndex,
double wellPathIntersectionAtFractureDepth,
RiaEclipseUnitTools::UnitSystem neededUnit,
const QString& fractureUserName);
const std::vector<double>& timeSteps() const;