///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2018- Equinor 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 // for more details. // ///////////////////////////////////////////////////////////////////////////////// #include "RiaExtractionTools.h" #include "RiaSimWellBranchTools.h" #include "Well/RigWellPath.h" #include "RimEclipseCase.h" #include "RimMainPlotCollection.h" #include "RimSimWellInView.h" #include "RimTools.h" #include "RimWellLogPlotCollection.h" #include "RimWellPathCollection.h" //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RigEclipseWellLogExtractor* RiaExtractionTools::findOrCreateWellLogExtractor( RimWellPath* wellPath, RimEclipseCase* eclipseCase ) { if ( !( wellPath && eclipseCase ) ) return nullptr; auto wlPlotCollection = wellLogPlotCollection(); if ( !wlPlotCollection ) return nullptr; return wlPlotCollection->findOrCreateExtractor( wellPath, eclipseCase ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RigEclipseWellLogExtractor* RiaExtractionTools::findOrCreateWellLogExtractor( const QString& wellName, RimEclipseCase* eclipseCase ) { if ( !eclipseCase ) return nullptr; if ( auto wellPathCollection = RimTools::wellPathCollection() ) { auto wellPath = wellPathCollection->tryFindMatchingWellPath( wellName ); return RiaExtractionTools::findOrCreateWellLogExtractor( wellPath, eclipseCase ); } return nullptr; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RigGeoMechWellLogExtractor* RiaExtractionTools::findOrCreateWellLogExtractor( RimWellPath* wellPath, RimGeoMechCase* geomCase, int partId ) { if ( !( wellPath && geomCase ) ) return nullptr; auto wlPlotCollection = wellLogPlotCollection(); if ( !wlPlotCollection ) return nullptr; return wlPlotCollection->findOrCreateExtractor( wellPath, geomCase, partId ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RigEclipseWellLogExtractor* RiaExtractionTools::findOrCreateSimWellExtractor( const RimSimWellInView* simWell, const RigWellPath* wellPathGeom ) { if ( !( simWell && wellPathGeom ) ) return nullptr; auto wlPlotCollection = wellLogPlotCollection(); if ( !wlPlotCollection ) return nullptr; auto eclipseCase = simWell->firstAncestorOrThisOfType(); if ( !( eclipseCase && eclipseCase->eclipseCaseData() ) ) { return nullptr; } QString caseUserDescription = eclipseCase->caseUserDescription(); return wlPlotCollection->findOrCreateSimWellExtractor( simWell->name, caseUserDescription, wellPathGeom, eclipseCase->eclipseCaseData() ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RigEclipseWellLogExtractor* RiaExtractionTools::findOrCreateSimWellExtractor( RimEclipseCase* eclipseCase, const QString& simWellName, bool useBranchDetection, int branchIndex ) { if ( !eclipseCase ) return nullptr; auto wlPlotCollection = wellLogPlotCollection(); if ( !wlPlotCollection ) return nullptr; std::vector wellPaths = RiaSimWellBranchTools::simulationWellBranches( simWellName, useBranchDetection ); if ( wellPaths.empty() ) return nullptr; branchIndex = RiaSimWellBranchTools::clampBranchIndex( simWellName, branchIndex, useBranchDetection ); if ( branchIndex >= static_cast( wellPaths.size() ) ) return nullptr; auto wellPathBranch = wellPaths[branchIndex]; return wlPlotCollection->findOrCreateSimWellExtractor( simWellName, QString( "Find or create sim well extractor" ), wellPathBranch, eclipseCase->eclipseCaseData() ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RimWellLogPlotCollection* RiaExtractionTools::wellLogPlotCollection() { return RimMainPlotCollection::current()->wellLogPlotCollection(); }