#1873: Changed naming scheme when exporting laterals. Make sure fishbone name is exported and be more explicit in the enumeration of the subs and laterals.

Refactored RimFishbonesMultipleSubs so that it is clear that the fishbone instances only have auto generated names based on their current index.
This commit is contained in:
sigurdp 2017-12-19 11:00:26 +01:00
parent 8c8970cec0
commit dbd1265f31
9 changed files with 68 additions and 33 deletions

View File

@ -57,10 +57,9 @@ void RicExportFishbonesLateralsFeature::onActionTriggered(bool isChecked)
QString completeFilename = QFileDialog::getSaveFileName(nullptr, "Select File for Well Path Data Export", defaultFileName, "Well Path Text File(*.dev);;All files(*.*)");
if (completeFilename.isEmpty()) return;
QFile exportFile(completeFilename);
RiaLogging::info("Starting export of Fishbones well path laterals to : " + completeFilename);
QFile exportFile(completeFilename);
if (!exportFile.open(QIODevice::WriteOnly))
{
RiaLogging::error("Could not open the file :\n" + completeFilename);
@ -73,7 +72,7 @@ void RicExportFishbonesLateralsFeature::onActionTriggered(bool isChecked)
// http://resinsight.org/docs/wellpaths/
// Export format
//
// wellname : <well name>__<sub lateral name>_<sub index>_<lateral index>
// WELLNAME: <well name>_<fishbone name>_Sub<sub index>_Lat<lateral index>
//
// for each coordinate along lateral, export
// x y TVD MD
@ -82,7 +81,9 @@ void RicExportFishbonesLateralsFeature::onActionTriggered(bool isChecked)
QTextStream stream(&exportFile);
for (RimFishbonesMultipleSubs* fishbone : fishbonesCollection->fishbonesSubs())
{
if (!fishbone->isChecked()) continue;
if (!fishbone->isActive()) continue;
const QString fishboneName = fishbone->generatedName();
for (auto& sub : fishbone->installedLateralIndices())
{
@ -93,8 +94,7 @@ void RicExportFishbonesLateralsFeature::onActionTriggered(bool isChecked)
// Pad with "0" to get a total of two characters defining the sub index text
QString subIndexText = QString("%1").arg(sub.subIndex, 2, 10, QChar('0'));
QString lateralNameCandidate = QString("%1_%2_%3_%4").arg(wellPath->name()).arg("fishbone").arg(subIndexText).arg(lateralIndex);
QString lateralNameCandidate = QString("%1_%2_Sub%3_Lat%4").arg(wellPath->name()).arg(fishboneName).arg(subIndexText).arg(lateralIndex);
QString lateralName = caf::Utils::makeValidFileBasename(lateralNameCandidate);
stream << "WELLNAME: " << lateralName << endl;

View File

@ -288,7 +288,7 @@ void RicExportFishbonesWellSegmentsFeature::generateWelsegsTable(RifEclipseDataT
for (const WellSegmentLateral& lateral : location.laterals)
{
formatter.comment(QString("%1 : Sub index %2 - Lateral %3").arg(location.fishbonesSubs->name()).arg(location.subIndex).arg(lateral.lateralIndex));
formatter.comment(QString("%1 : Sub index %2 - Lateral %3").arg(location.fishbonesSubs->generatedName()).arg(location.subIndex).arg(lateral.lateralIndex));
double depth = 0;
double length = 0;

View File

@ -56,7 +56,7 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneLateralsWell
for (const WellSegmentLateralIntersection& intersection : lateral.intersections)
{
double diameter = location.fishbonesSubs->holeDiameter(unitSystem);
QString completionMetaData = (location.fishbonesSubs->name() + QString(": Sub: %1 Lateral: %2").arg(location.subIndex).arg(lateral.lateralIndex));
QString completionMetaData = (location.fishbonesSubs->generatedName() + QString(": Sub: %1 Lateral: %2").arg(location.subIndex).arg(lateral.lateralIndex));
WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc(intersection.lengthsInCell,
diameter / 2,
location.fishbonesSubs->skinFactor(),

View File

@ -52,9 +52,7 @@ void RicNewFishbonesSubsAtMeasuredDepthFeature::onActionTriggered(bool isChecked
RimFishbonesMultipleSubs* obj = new RimFishbonesMultipleSubs;
wellPath->fishbonesCollection()->appendFishbonesSubs(obj);
obj->setName(QString("Fishbones Subs (%1)").arg(wellPath->fishbonesCollection()->fishbonesSubs.size()));
int integerValue = wellPathSelItem->m_measuredDepth;
obj->setMeasuredDepthAndCount(integerValue, 24, 1);
obj->setMeasuredDepthAndCount(wellPathSelItem->m_measuredDepth, 24, 1);
RicNewFishbonesSubsFeature::askUserToSetUsefulScaling(wellPath->fishbonesCollection());

View File

@ -54,7 +54,6 @@ void RicNewFishbonesSubsFeature::onActionTriggered(bool isChecked)
if (!RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem(wellPath)) return;
RimFishbonesMultipleSubs* obj = new RimFishbonesMultipleSubs;
obj->setName(QString("Fishbones Subs (%1)").arg(fishbonesCollection->fishbonesSubs.size()));
fishbonesCollection->appendFishbonesSubs(obj);
RicNewFishbonesSubsFeature::askUserToSetUsefulScaling(fishbonesCollection);

View File

@ -58,7 +58,7 @@ void RivFishbonesSubsPartMgr::appendGeometryPartsToModel(cvf::ModelBasicList* mo
{
clearGeometryCache();
if (!m_rimFishbonesSubs->isChecked()) return;
if (!m_rimFishbonesSubs->isActive()) return;
if (m_parts.size() == 0)
{

View File

@ -104,7 +104,7 @@ void RimCompletionCellIntersectionCalc::calculateWellPathIntersections(const Rim
{
for (const RimFishbonesMultipleSubs* fishbones : wellPath->fishbonesCollection()->fishbonesSubs)
{
if (fishbones->isChecked())
if (fishbones->isActive())
{
calculateFishbonesIntersections(fishbones, grid, values);
}

View File

@ -61,6 +61,14 @@ RimFishbonesMultipleSubs::RimFishbonesMultipleSubs()
{
CAF_PDM_InitObject("FishbonesMultipleSubs", ":/FishBoneGroup16x16.png", "", "");
CAF_PDM_InitField(&m_isActive, "Active", true, "Active", "", "", "");
m_isActive.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_name, "Name", "Name", "", "", "");
m_name.registerGetMethod(this, &RimFishbonesMultipleSubs::generatedName);
m_name.uiCapability()->setUiReadOnly(true);
m_name.xmlCapability()->setIOWritable(false);
CAF_PDM_InitField(&fishbonesColor, "Color", cvf::Color3f(0.999f, 0.333f, 0.999f), "Fishbones Color", "", "", "");
CAF_PDM_InitField(&m_lateralCountPerSub, "LateralCountPerSub", 3, "Laterals Per Sub", "", "", "");
@ -101,8 +109,6 @@ RimFishbonesMultipleSubs::RimFishbonesMultipleSubs()
m_pipeProperties = new RimFishbonesPipeProperties;
nameField()->uiCapability()->setUiReadOnly(true);
m_rigFishbonesGeometry = std::unique_ptr<RigFisbonesGeometry>(new RigFisbonesGeometry(this));
}
@ -114,6 +120,27 @@ RimFishbonesMultipleSubs::~RimFishbonesMultipleSubs()
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimFishbonesMultipleSubs::isActive() const
{
return m_isActive;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFishbonesMultipleSubs::generatedName() const
{
caf::PdmChildArrayField<RimFishbonesMultipleSubs*>* container = dynamic_cast<caf::PdmChildArrayField<RimFishbonesMultipleSubs*>*>(this->parentField());
CVF_ASSERT(container);
size_t index = container->index(this);
return QString("Fishbone %1").arg(index);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -414,6 +441,22 @@ void RimFishbonesMultipleSubs::fieldChangedByUi(const caf::PdmFieldHandle* chang
proj->reloadCompletionTypeResultsInAllViews();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimFishbonesMultipleSubs::userDescriptionField()
{
return &m_name;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimFishbonesMultipleSubs::objectToggleField()
{
return &m_isActive;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -624,18 +667,6 @@ void RimFishbonesMultipleSubs::initAfterRead()
computeSubLateralIndices();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishbonesMultipleSubs::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
{
caf::PdmChildArrayField<RimFishbonesMultipleSubs*>* container = dynamic_cast<caf::PdmChildArrayField<RimFishbonesMultipleSubs*>*>(this->parentField());
CVF_ASSERT(container);
size_t index = container->index(this);
this->setName(QString("Fishbone %1").arg(index));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -31,6 +31,7 @@
// Include to make Pdm work for cvf::Color
#include "cafPdmFieldCvfColor.h"
#include "cafPdmChildField.h"
#include "cafPdmProxyValueField.h"
#include <algorithm>
#include <memory>
@ -50,7 +51,7 @@ struct SubLateralIndex {
///
///
//==================================================================================================
class RimFishbonesMultipleSubs : public RimCheckableNamedObject, public Rim3dPropertiesInterface
class RimFishbonesMultipleSubs : public caf::PdmObject, public Rim3dPropertiesInterface
{
CAF_PDM_HEADER_INIT;
@ -72,6 +73,8 @@ public:
RimFishbonesMultipleSubs();
virtual ~RimFishbonesMultipleSubs();
bool isActive() const;
QString generatedName() const;
void setMeasuredDepthAndCount(double measuredDepth, double spacing, int subCount);
@ -104,11 +107,12 @@ public:
caf::PdmField<cvf::Color3f> fishbonesColor;
protected:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
virtual caf::PdmFieldHandle* userDescriptionField() override;
virtual caf::PdmFieldHandle* objectToggleField() override;
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
virtual void initAfterRead() override;
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
virtual void initAfterRead() override;
private:
void computeRangesAndLocations();
@ -119,6 +123,9 @@ private:
static int randomValueFromRange(int min, int max);
private:
caf::PdmField<bool> m_isActive;
caf::PdmProxyValueField<QString> m_name;
caf::PdmField<int> m_lateralCountPerSub;
caf::PdmField<QString> m_lateralLength;