///////////////////////////////////////////////////////////////////////////////// // // 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. // ///////////////////////////////////////////////////////////////////////////////// #pragma once #include "RicMswExportInfo.h" #include "RigCompletionData.h" class RicExportCompletionDataSettingsUi; class RifEclipseDataTableFormatter; class RimEclipseCase; class RimFishbonesMultipleSubs; class RimPerforationInterval; class RimWellPath; class RimWellPathValve; class RimWellPathFracture; class SubSegmentIntersectionInfo; class QFile; class RicWellPathExportMswCompletionsImpl { public: static void exportWellSegmentsForAllCompletions(const RicExportCompletionDataSettingsUi& exportSettings, const std::vector& wellPaths); static void exportWellSegmentsForFractures(RimEclipseCase* eclipseCase, std::shared_ptr exportFile, const RimWellPath* wellPath, const std::vector& fractures); static void exportWellSegmentsForFishbones(RimEclipseCase* eclipseCase, std::shared_ptr exportFile, const RimWellPath* wellPath, const std::vector& fishbonesSubs); static void exportWellSegmentsForPerforations(RimEclipseCase* eclipseCase, std::shared_ptr exportFile, const RimWellPath* wellPath, int timeStep, const std::vector& perforationIntervals); static RicMswExportInfo generateFishbonesMswExportInfo(const RimEclipseCase* caseToApply, const RimWellPath* wellPath, bool enableSegmentSplitting); private: static RicMswExportInfo generateFishbonesMswExportInfo(const RimEclipseCase* caseToApply, const RimWellPath* wellPath, const std::vector& fishbonesSubs, bool enableSegmentSplitting); static RicMswExportInfo generateFracturesMswExportInfo(RimEclipseCase* caseToApply, const RimWellPath* wellPath); static RicMswExportInfo generateFracturesMswExportInfo(RimEclipseCase* caseToApply, const RimWellPath* wellPath, const std::vector& fractures); static RicMswExportInfo generatePerforationsMswExportInfo(RimEclipseCase* eclipseCase, const RimWellPath* wellPath, int timeStep, const std::vector& perforationIntervals); static void generateWelsegsTable(RifEclipseDataTableFormatter& formatter, const RicMswExportInfo& exportInfo); static void generateWelsegsSegments(RifEclipseDataTableFormatter& formatter, const RicMswExportInfo& exportInfo, const std::set& exportCompletionTypes); static void generateWelsegsCompletionCommentHeader(RifEclipseDataTableFormatter& formatter, RigCompletionData::CompletionType completionType); static void generateCompsegTables(RifEclipseDataTableFormatter& formatter, const RicMswExportInfo& exportInfo); static void generateCompsegTable(RifEclipseDataTableFormatter& formatter, const RicMswExportInfo& exportInfo, bool exportSubGridIntersections, const std::set& exportCompletionTypes); static void generateCompsegHeader(RifEclipseDataTableFormatter& formatter, const RicMswExportInfo& exportInfo, RigCompletionData::CompletionType completionType, bool exportSubGridIntersections); static void generateWsegvalvTable(RifEclipseDataTableFormatter& formatter, const RicMswExportInfo& exportInfo); static void generateWsegAicdTable(RifEclipseDataTableFormatter& formatter, const RicMswExportInfo& exportInfo); private: typedef std::vector> MainBoreSegments; typedef std::map, std::set>> ValveContributionMap; static MainBoreSegments createMainBoreSegmentsForPerforations(const std::vector& subSegIntersections, const std::vector& perforationIntervals, const RimWellPath* wellPath, int timeStep, RimEclipseCase* eclipseCase, bool* foundSubGridIntersections); static void createValveCompletions(std::vector>& mainBoreSegments, const std::vector& perforationIntervals, RiaEclipseUnitTools::UnitSystem unitSystem); static void assignValveContributionsToSuperICDsOrAICDs(const std::vector>& mainBoreSegments, const std::vector& perforationIntervals, RiaEclipseUnitTools::UnitSystem unitSystem); static void moveIntersectionsToICVs(const std::vector>& mainBoreSegments, const std::vector& perforationIntervals, RiaEclipseUnitTools::UnitSystem unitSystem); static void moveIntersectionsToSuperICDsOrAICDs(MainBoreSegments mainBoreSegments); static void assignFishbonesLateralIntersections(const RimEclipseCase* caseToApply, const RimFishbonesMultipleSubs* fishbonesSubs, std::shared_ptr location, bool* foundSubGridIntersections, double maxSegmentLength); static void assignFractureIntersections(const RimEclipseCase* caseToApply, const RimWellPathFracture* fracture, const std::vector& completionData, std::shared_ptr location, bool* foundSubGridIntersections); static std::vector generatePerforationIntersections(const RimWellPath* wellPath, const RimPerforationInterval* perforationInterval, int timeStep, RimEclipseCase* eclipseCase); static void assignPerforationIntersections(const std::vector& completionData, std::shared_ptr perforationCompletion, const SubSegmentIntersectionInfo& cellIntInfo, double overlapStart, double overlapEnd, bool* foundSubGridIntersections); static void assignBranchAndSegmentNumbers(const RimEclipseCase* caseToApply, std::shared_ptr location, int* branchNum, int* segmentNum); static void assignBranchAndSegmentNumbers(const RimEclipseCase* caseToApply, RicMswExportInfo* exportInfo); };