ResInsight/ApplicationCode/ProjectDataModel/RimWellPath.h
Magne Sjaastad 1841379e64 #2127 Sim Well Branches : Major refactor of sim well branch computation
Remove local branch geometry caches
Add checkbox to control if branch detection should be used
Add RiaSimWllBranchTools and move helper functions from RimProject
2017-12-08 10:24:14 +01:00

184 lines
7.6 KiB
C++

/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron AS
//
// 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 "RiaEclipseUnitTools.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
#include "cafPdmChildField.h"
#include "cafAppEnum.h"
// Include to make Pdm work for cvf::Color
#include "cafPdmFieldCvfColor.h"
#include "cafPdmChildArrayField.h"
#include "cvfObject.h"
#include <functional>
class RifWellPathImporter;
class RifWellPathFormationsImporter;
class RigWellPath;
class RimProject;
class RimWellLogFile;
class RimFishboneWellPathCollection;
class RivWellPathPartMgr;
class RimFishbonesCollection;
class RimPerforationCollection;
class RimWellPathCompletions;
class RigWellPathFormations;
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
class RimWellPathFractureCollection;
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
//==================================================================================================
///
///
//==================================================================================================
class RimWellPath : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
static const char SIM_WELL_NONE_UI_TEXT[];
public:
RimWellPath();
virtual ~RimWellPath();
void addWellLogFile(RimWellLogFile* logFileInfo);
void deleteWellLogFile(RimWellLogFile* logFileInfo);
void detachWellLogFile(RimWellLogFile* logFileInfo);
void setFormationsGeometry(cvf::ref<RigWellPathFormations> wellPathFormations);
bool readWellPathFormationsFile(QString* errorMessage, RifWellPathFormationsImporter* wellPathFormationsImporter);
bool reloadWellPathFormationsFile(QString* errorMessage, RifWellPathFormationsImporter* wellPathFormationsImporter);
bool hasFormations() const;
const RigWellPathFormations* formationsGeometry() const;
virtual caf::PdmFieldHandle* userDescriptionField() override;
virtual caf::PdmFieldHandle* objectToggleField() override;
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
virtual void initAfterRead() override;
QString name() const;
void setName(const QString& name);
std::vector<RimWellLogFile*> wellLogFiles() const;
caf::PdmField<QString> filepath;
caf::PdmField<int> wellPathIndexInFile; // -1 means none.
caf::PdmField<QString> m_simWellName;
caf::PdmField<int> m_branchIndex;
caf::PdmField<bool> showWellPathLabel;
caf::PdmField<bool> showWellPath;
caf::PdmField<cvf::Color3f> wellPathColor;
caf::PdmField<double> wellPathRadiusScaleFactor;
RimFishbonesCollection* fishbonesCollection();
const RimFishbonesCollection* fishbonesCollection() const;
RimPerforationCollection* perforationIntervalCollection();
const RimPerforationCollection* perforationIntervalCollection() const;
const RimWellPathCompletions* completions() const;
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
RimWellPathFractureCollection* fractureCollection();
const RimWellPathFractureCollection* fractureCollection() const;
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
RigWellPath* wellPathGeometry();
const RigWellPath* wellPathGeometry() const;
RivWellPathPartMgr* partMgr();
bool readWellPathFile(QString * errorMessage, RifWellPathImporter* wellPathImporter);
void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath);
double combinedScaleFactor() const;
void setUnitSystem(RiaEclipseUnitTools::UnitSystem unitSystem);
RiaEclipseUnitTools::UnitSystem unitSystem() const;
static RimWellPath* fromFilePath(QString filePath);
const QString associatedSimulationWellName() const;
int associatedSimulationWellBranch() const;
bool tryAssociateWithSimulationWell();
bool isAssociatedWithSimulationWell() const;
bool tryMatchName(QString wellPathName,
const std::vector<QString>& simWellNames,
std::function<QString(QString)> stringFormatter = nullptr);
private:
void setWellPathGeometry(RigWellPath* wellPathModel);
QString surveyType() { return m_surveyType; }
void setSurveyType(QString surveyType);
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override;
bool isStoredInCache();
QString getCacheFileName();
QString getCacheDirectoryPath();
virtual void setupBeforeSave() override;
static size_t simulationWellBranchCount(const QString& simWellName);
private:
caf::PdmField<QString> id;
caf::PdmField<QString> sourceSystem;
caf::PdmField<QString> utmZone;
caf::PdmField<QString> updateDate;
caf::PdmField<QString> updateUser;
caf::PdmField<QString> m_surveyType;
caf::PdmField<double> m_datumElevation;
caf::PdmField<RiaEclipseUnitTools::UnitSystemType> m_unitSystem;
caf::PdmChildField<RimWellPathCompletions*> m_completions;
cvf::ref<RigWellPath> m_wellPath;
cvf::ref<RigWellPathFormations> m_wellPathFormations;
cvf::ref<RivWellPathPartMgr> m_wellPathPartMgr;
caf::PdmField<QString> m_name;
caf::PdmField<QString> m_wellPathFormationFilePath;
caf::PdmField<QString> m_formationKeyInFile;
caf::PdmChildArrayField<RimWellLogFile*> m_wellLogFiles;
caf::PdmChildField<RimWellLogFile*> m_wellLogFile_OBSOLETE;
};