diff --git a/ApplicationCode/FileInterface/CMakeLists_files.cmake b/ApplicationCode/FileInterface/CMakeLists_files.cmake index e6355302d4..182297dde3 100644 --- a/ApplicationCode/FileInterface/CMakeLists_files.cmake +++ b/ApplicationCode/FileInterface/CMakeLists_files.cmake @@ -39,7 +39,8 @@ ${CEE_CURRENT_LIST_DIR}RifDataSourceForRftPltQMetaType.h ${CEE_CURRENT_LIST_DIR}RifEclipseUserDataKeywordTools.h ${CEE_CURRENT_LIST_DIR}RifCsvUserData.h ${CEE_CURRENT_LIST_DIR}RifCsvUserDataParser.h -${CEE_CURRENT_LIST_DIR}RifWellFormationReader.h +${CEE_CURRENT_LIST_DIR}RifWellPathFormationReader.h +${CEE_CURRENT_LIST_DIR}RifWellPathFormationsImporter.h # HDF5 file reader is directly included in ResInsight main CmakeList.txt #${CEE_CURRENT_LIST_DIR}RifHdf5Reader.h ) @@ -83,7 +84,8 @@ ${CEE_CURRENT_LIST_DIR}RifDataSourceForRftPlt.cpp ${CEE_CURRENT_LIST_DIR}RifEclipseUserDataKeywordTools.cpp ${CEE_CURRENT_LIST_DIR}RifCsvUserData.cpp ${CEE_CURRENT_LIST_DIR}RifCsvUserDataParser.cpp -${CEE_CURRENT_LIST_DIR}RifWellFormationReader.cpp +${CEE_CURRENT_LIST_DIR}RifWellPathFormationReader.cpp +${CEE_CURRENT_LIST_DIR}RifWellPathFormationsImporter.cpp # HDF5 file reader is directly included in ResInsight main CmakeList.txt #${CEE_CURRENT_LIST_DIR}RifHdf5Reader.cpp diff --git a/ApplicationCode/FileInterface/RifWellFormationReader.cpp b/ApplicationCode/FileInterface/RifWellPathFormationReader.cpp similarity index 53% rename from ApplicationCode/FileInterface/RifWellFormationReader.cpp rename to ApplicationCode/FileInterface/RifWellPathFormationReader.cpp index 6042f758d6..f7aaee50c8 100644 --- a/ApplicationCode/FileInterface/RifWellFormationReader.cpp +++ b/ApplicationCode/FileInterface/RifWellPathFormationReader.cpp @@ -1,46 +1,32 @@ ///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2017- Statoil 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 +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// -#include "RifWellFormationReader.h" +#include "RifWellPathFormationReader.h" #include +#include //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -std::map > RifWellFormationReader::readWellFormations(const QStringList& filePaths) +std::map>> RifWellPathFormationReader::readWellFormations(const QString& filePath) { - std::map> formations; - - foreach (QString filePath, filePaths) - { - readFileIntoMap(filePath, &formations); - } - - return formations; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::map > RifWellFormationReader::readWellFormations(const QString& filePath) -{ - std::map > formations; + std::map>> formations; readFileIntoMap(filePath, &formations); @@ -48,9 +34,31 @@ std::map > RifWellFormationReader::readWe } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RifWellFormationReader::readFileIntoMap(const QString& filePath, std::map>* formations) +std::map> RifWellPathFormationReader::readWellFormationsToGeometry(const QString& filePath) +{ + std::map> result; + + std::map>> formations; + + readFileIntoMap(filePath, &formations); + + std::map>>::iterator it; + + for (it = formations.begin(); it != formations.end(); it++) + { + cvf::ref wellPathFormations = new RigWellPathFormations(it->second); + result[it->first] = wellPathFormations; + } + return result; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifWellPathFormationReader::readFileIntoMap(const QString& filePath, + std::map>>* formations) { QFile data(filePath); @@ -62,18 +70,18 @@ void RifWellFormationReader::readFileIntoMap(const QString& filePath, std::map #include +#include -#include +#include "cvfBase.h" +#include "cvfObject.h" -struct RifWellFormation -{ - RifWellFormation(QString wellName, QString surfaceName, double measuredDepth) - :wellName(wellName), surfaceName(surfaceName), measuredDepth(measuredDepth) {}; - - QString wellName; - QString surfaceName; - double measuredDepth; -}; +#include //================================================================================================== /// //================================================================================================== -class RifWellFormationReader +class RifWellPathFormationReader { public: - static std::map > readWellFormations(const QStringList& filePaths); - static std::map > readWellFormations(const QString& filePath); + static std::map> > readWellFormations(const QString& filePath); + static std::map > readWellFormationsToGeometry(const QString& filePath); private: - static void readFileIntoMap(const QString& filePath, std::map >* formations); + static void readFileIntoMap(const QString& filePath, std::map> >* formations); }; diff --git a/ApplicationCode/FileInterface/RifWellPathFormationsImporter.cpp b/ApplicationCode/FileInterface/RifWellPathFormationsImporter.cpp new file mode 100644 index 0000000000..5f97a84bd6 --- /dev/null +++ b/ApplicationCode/FileInterface/RifWellPathFormationsImporter.cpp @@ -0,0 +1,47 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017- Statoil 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 "RifWellPathFormationsImporter.h" +#include "RifWellPathFormationReader.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::ref RifWellPathFormationsImporter::readWellPathFormations(const QString& formationFilePath, + const QString& wellName) +{ + readAllWellPathFormations(formationFilePath); + return m_fileNameToWellPathFormationMap[formationFilePath][wellName]; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifWellPathFormationsImporter::readAllWellPathFormations(const QString& filePath) +{ + // If we have the file in the map, assume it is already read. + if (m_fileNameToWellPathFormationMap.find(filePath) != m_fileNameToWellPathFormationMap.end()) + { + return; + } + + std::map> wellPathToFormationMap = + RifWellPathFormationReader::readWellFormationsToGeometry(filePath); + + m_fileNameToWellPathFormationMap[filePath] = wellPathToFormationMap; +} diff --git a/ApplicationCode/FileInterface/RifWellPathFormationsImporter.h b/ApplicationCode/FileInterface/RifWellPathFormationsImporter.h new file mode 100644 index 0000000000..be13150615 --- /dev/null +++ b/ApplicationCode/FileInterface/RifWellPathFormationsImporter.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017- Statoil 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 "RigWellPathFormations.h" + +#include "cvfBase.h" +#include "cvfObject.h" + +#include +#include + +#include +#include + +//================================================================================================== +/// +/// +//================================================================================================== +class RifWellPathFormationsImporter +{ +public: + cvf::ref readWellPathFormations(const QString& formationFilePath, const QString& wellName); + +private: + void readAllWellPathFormations(const QString& filePath); + + std::map>> + m_fileNameToWellPathFormationMap; +}; diff --git a/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake b/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake index d3da9952ff..fbf1f44934 100644 --- a/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake +++ b/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake @@ -65,6 +65,7 @@ ${CEE_CURRENT_LIST_DIR}RigTransmissibilityEquations.h ${CEE_CURRENT_LIST_DIR}RigNumberOfFloodedPoreVolumesCalculator.h ${CEE_CURRENT_LIST_DIR}RigWeightedMeanCalc.h ${CEE_CURRENT_LIST_DIR}RigTimeHistoryCurveMerger.h +${CEE_CURRENT_LIST_DIR}RigWellPathFormations.h ) if (RESINSIGHT_ENABLE_PROTOTYPE_FEATURE_FRACTURES) @@ -136,6 +137,7 @@ ${CEE_CURRENT_LIST_DIR}RigTransmissibilityEquations.cpp ${CEE_CURRENT_LIST_DIR}RigNumberOfFloodedPoreVolumesCalculator.cpp ${CEE_CURRENT_LIST_DIR}RigWeightedMeanCalc.cpp ${CEE_CURRENT_LIST_DIR}RigTimeHistoryCurveMerger.cpp +${CEE_CURRENT_LIST_DIR}RigWellPathFormations.cpp ) if (RESINSIGHT_ENABLE_PROTOTYPE_FEATURE_FRACTURES) diff --git a/ApplicationCode/ReservoirDataModel/RigWellPathFormations.cpp b/ApplicationCode/ReservoirDataModel/RigWellPathFormations.cpp new file mode 100644 index 0000000000..85569e5180 --- /dev/null +++ b/ApplicationCode/ReservoirDataModel/RigWellPathFormations.cpp @@ -0,0 +1,37 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017- Statoil 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 "RigWellPathFormations.h" + +#include "RifWellPathFormationReader.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigWellPathFormations::RigWellPathFormations(std::vector> measuredDepthAndFormationNames) +{ + m_measuredDepthAndFormationNames = measuredDepthAndFormationNames; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RigWellPathFormations::wellName() const +{ + return m_wellName; +} diff --git a/ApplicationCode/ReservoirDataModel/RigWellPathFormations.h b/ApplicationCode/ReservoirDataModel/RigWellPathFormations.h new file mode 100644 index 0000000000..6aadc9ae4d --- /dev/null +++ b/ApplicationCode/ReservoirDataModel/RigWellPathFormations.h @@ -0,0 +1,41 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017- Statoil 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 "cvfBase.h" +#include "cvfObject.h" + +#include +#include + +#include +#include + +class RigWellPathFormations : public cvf::Object +{ +public: + RigWellPathFormations(std::vector> measuredDepthAndFormationNames); + + QString wellName() const; + +private: + QString m_wellName; + + std::vector> m_measuredDepthAndFormationNames; +};