mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Enable INP support without ODB libraries (#10990)
Enable INP support without ODB libraries
This commit is contained in:
parent
31d11f56f5
commit
50a766591b
@ -277,7 +277,7 @@ if(RESINSIGHT_ENABLE_GRPC)
|
||||
list(APPEND LINK_LIBRARIES GrpcInterface)
|
||||
endif()
|
||||
|
||||
list(APPEND LINK_LIBRARIES RigGeoMechDataModel)
|
||||
list(APPEND LINK_LIBRARIES RigGeoMechDataModel RifGeoMechFileInterface)
|
||||
|
||||
if(RESINSIGHT_USE_ODB_API)
|
||||
add_definitions(-DUSE_ODB_API)
|
||||
|
@ -441,6 +441,7 @@ target_include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/UserInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/GeoMech/GeoMechDataModel
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/GeoMech/GeoMechVisualization
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/GeoMech/GeoMechFileInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/GeoMech/OdbReader
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Measurement
|
||||
${ResInsight_SOURCE_DIR}/ThirdParty
|
||||
|
@ -50,10 +50,15 @@ void RicGeoMechCopyCaseFeature::onActionTriggered( bool isChecked )
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString defaultDir = app->lastUsedDialogDirectory( "GEOMECH_MODEL" );
|
||||
|
||||
QString filterStr;
|
||||
#if USE_ODB_API
|
||||
filterStr += "Abaqus results (*.odb);;";
|
||||
#endif
|
||||
filterStr += "Abaqus input file (*.inp)";
|
||||
|
||||
for ( RimGeoMechCase* gmc : cases )
|
||||
{
|
||||
QString fileName =
|
||||
RiuFileDialogTools::getOpenFileName( nullptr, "Import Geo-Mechanical Model", defaultDir, "Abaqus results (*.odb)" );
|
||||
QString fileName = RiuFileDialogTools::getOpenFileName( nullptr, "Import Geo-Mechanical Model", defaultDir, filterStr );
|
||||
if ( fileName.isEmpty() ) break;
|
||||
|
||||
defaultDir = QFileInfo( fileName ).absolutePath();
|
||||
|
@ -34,11 +34,14 @@ void RicImportGeoMechCaseFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
QString filterStr;
|
||||
#if USE_ODB_API
|
||||
filterStr += "Abaqus results (*.odb);;";
|
||||
#endif
|
||||
filterStr += "Abaqus input file (*.inp)";
|
||||
|
||||
QString defaultDir = app->lastUsedDialogDirectory( "GEOMECH_MODEL" );
|
||||
QStringList fileNames = RiuFileDialogTools::getOpenFileNames( nullptr,
|
||||
"Import Geo-Mechanical Model",
|
||||
defaultDir,
|
||||
"Abaqus results (*.odb);;Abaqus input file (*.inp)" );
|
||||
QStringList fileNames = RiuFileDialogTools::getOpenFileNames( nullptr, "Import Geo-Mechanical Model", defaultDir, filterStr );
|
||||
if ( !fileNames.empty() ) defaultDir = QFileInfo( fileNames.last() ).absolutePath();
|
||||
app->setLastUsedDialogDirectory( "GEOMECH_MODEL", defaultDir );
|
||||
|
||||
|
@ -36,9 +36,14 @@ void RicImportGeoMechCaseTimeStepFilterFeature::onActionTriggered( bool isChecke
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
QString filterStr;
|
||||
#if USE_ODB_API
|
||||
filterStr += "Abaqus results (*.odb);;";
|
||||
#endif
|
||||
filterStr += "Abaqus input file (*.inp)";
|
||||
|
||||
QString defaultDir = app->lastUsedDialogDirectory( "GEOMECH_MODEL" );
|
||||
QStringList fileNames =
|
||||
RiuFileDialogTools::getOpenFileNames( nullptr, "Import Geo-Mechanical Model", defaultDir, "Abaqus results (*.odb)" );
|
||||
QStringList fileNames = RiuFileDialogTools::getOpenFileNames( nullptr, "Import Geo-Mechanical Model", defaultDir, filterStr );
|
||||
if ( !fileNames.empty() ) defaultDir = QFileInfo( fileNames.last() ).absolutePath();
|
||||
for ( QString fileName : fileNames )
|
||||
{
|
||||
|
@ -73,10 +73,6 @@
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#ifdef USE_ODB_API
|
||||
#include "RifOdbReader.h"
|
||||
#endif
|
||||
|
||||
#include "cafProgressInfo.h"
|
||||
#include "cafTensor3.h"
|
||||
|
||||
@ -159,6 +155,11 @@ RigFemPartResultsCollection::RigFemPartResultsCollection( RifGeoMechReaderInterf
|
||||
|
||||
m_waterDensityShearSlipIndicator = 1.03;
|
||||
|
||||
m_fractureGradientCalculationTypeMudWeightWindow = RimMudWeightWindowParameters::FractureGradientCalculationType::DERIVED_FROM_K0FG;
|
||||
m_lowerLimitParameterMudWeightWindow = RimMudWeightWindowParameters::LowerLimitType::PORE_PRESSURE;
|
||||
m_upperLimitParameterMudWeightWindow = RimMudWeightWindowParameters::UpperLimitType::FG;
|
||||
m_nonReservoirPorePressureTypeMudWeightWindow = RimMudWeightWindowParameters::NonReservoirPorePressureType::PER_ELEMENT;
|
||||
|
||||
m_resultCalculators.push_back( std::unique_ptr<RigFemPartResultCalculator>( new RigFemPartResultCalculatorTimeLapse( *this ) ) );
|
||||
m_resultCalculators.push_back( std::unique_ptr<RigFemPartResultCalculator>( new RigFemPartResultCalculatorSurfaceAngles( *this ) ) );
|
||||
m_resultCalculators.push_back( std::unique_ptr<RigFemPartResultCalculator>( new RigFemPartResultCalculatorSurfaceAlignedStress( *this ) ) );
|
||||
|
@ -25,8 +25,8 @@
|
||||
#include "RigFemPartResultsCollection.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
|
||||
#ifdef USE_ODB_API
|
||||
#include "RifInpReader.h"
|
||||
#ifdef USE_ODB_API
|
||||
#include "RifOdbReader.h"
|
||||
#endif
|
||||
|
||||
@ -86,19 +86,23 @@ RigFemPartResultsCollection* RigGeoMechCaseData::femPartResults()
|
||||
return m_femPartResultsColl.p();
|
||||
}
|
||||
|
||||
#include "RiaStdStringTools.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigGeoMechCaseData::open( std::string* errorMessage )
|
||||
{
|
||||
#ifdef USE_ODB_API
|
||||
if ( m_geoMechCaseFileName.ends_with( ".odb" ) )
|
||||
auto filename = RiaStdStringTools::toUpper( m_geoMechCaseFileName );
|
||||
|
||||
if ( filename.ends_with( ".INP" ) )
|
||||
{
|
||||
m_readerInterface = new RifOdbReader;
|
||||
m_readerInterface = new RifInpReader();
|
||||
}
|
||||
else
|
||||
#ifdef USE_ODB_API
|
||||
else if ( filename.ends_with( ".ODB" ) )
|
||||
{
|
||||
m_readerInterface = new RifInpReader;
|
||||
m_readerInterface = new RifOdbReader();
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -111,13 +115,11 @@ bool RigGeoMechCaseData::open( std::string* errorMessage )
|
||||
bool RigGeoMechCaseData::readTimeSteps( std::string* errorMessage, std::vector<std::string>* stepNames )
|
||||
{
|
||||
CVF_ASSERT( stepNames );
|
||||
#ifdef USE_ODB_API
|
||||
if ( m_readerInterface.notNull() && m_readerInterface->isOpen() )
|
||||
{
|
||||
*stepNames = m_readerInterface->allStepNames();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
*errorMessage = std::string( "Could not read time steps" );
|
||||
return false;
|
||||
}
|
||||
@ -128,7 +130,7 @@ bool RigGeoMechCaseData::readTimeSteps( std::string* errorMessage, std::vector<s
|
||||
bool RigGeoMechCaseData::readFemParts( std::string* errorMessage, const std::vector<size_t>& timeStepFilter, bool readOnlyLastFrame )
|
||||
{
|
||||
CVF_ASSERT( errorMessage );
|
||||
#ifdef USE_ODB_API
|
||||
|
||||
if ( m_readerInterface.notNull() && m_readerInterface->isOpen() )
|
||||
{
|
||||
m_readerInterface->setTimeStepFilter( timeStepFilter, readOnlyLastFrame );
|
||||
@ -154,7 +156,7 @@ bool RigGeoMechCaseData::readFemParts( std::string* errorMessage, const std::vec
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
*errorMessage = std::string( "Could not read FEM parts" );
|
||||
return false;
|
||||
}
|
||||
@ -165,14 +167,13 @@ bool RigGeoMechCaseData::readFemParts( std::string* errorMessage, const std::vec
|
||||
bool RigGeoMechCaseData::readDisplacements( std::string* errorMessage, int partId, int timeStep, int frameIndex, std::vector<cvf::Vec3f>* displacements )
|
||||
{
|
||||
CVF_ASSERT( errorMessage );
|
||||
#ifdef USE_ODB_API
|
||||
|
||||
if ( m_readerInterface.notNull() && m_readerInterface->isOpen() )
|
||||
{
|
||||
m_readerInterface->readDisplacements( partId, timeStep, frameIndex, displacements );
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
*errorMessage = std::string( "Could not read displacements." );
|
||||
return false;
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
project(RifGeoMechFileInterface)
|
||||
|
||||
# Unity Build
|
||||
if(RESINSIGHT_ENABLE_UNITY_BUILD)
|
||||
message("Cmake Unity build is enabled on : ${PROJECT_NAME}")
|
||||
set(CMAKE_UNITY_BUILD true)
|
||||
endif()
|
||||
|
||||
add_library(
|
||||
${PROJECT_NAME}
|
||||
RifInpReader.h RifInpReader.cpp RifGeoMechReaderInterface.h
|
||||
RifGeoMechReaderInterface.cpp RifInpIncludeReader.h RifInpIncludeReader.cpp
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
set(LINK_LIBRARIES RigGeoMechDataModel LibCore)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} ${LINK_LIBRARIES})
|
||||
|
||||
source_group("" FILES ${PROJECT_FILES})
|
@ -114,7 +114,7 @@ bool RifInpReader::readFemParts( RigFemPartCollection* femParts )
|
||||
|
||||
auto elementType = read( m_stream, parts, nodes, elements, elementSets, m_stepNames, m_enableIncludes, m_includeEntries );
|
||||
|
||||
for ( int i = 0; i < m_includeEntries.size(); i++ )
|
||||
for ( int i = 0; i < (int)m_includeEntries.size(); i++ )
|
||||
{
|
||||
m_includeEntries[i].fileName = ( m_inputPath / m_includeEntries[i].fileName ).string();
|
||||
}
|
||||
@ -590,7 +590,7 @@ int RifInpReader::frameCount( int stepIndex ) const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::string> RifInpReader::elementSetNames( int partIndex, std::string partName )
|
||||
{
|
||||
if ( partIndex >= m_partElementSetNames.size() ) return {};
|
||||
if ( partIndex >= (int)m_partElementSetNames.size() ) return {};
|
||||
return m_partElementSetNames.at( partIndex );
|
||||
}
|
||||
|
@ -32,18 +32,7 @@ else()
|
||||
add_definitions(-DABQ_MPI_PMPI)
|
||||
endif(MSVC)
|
||||
|
||||
add_library(
|
||||
${PROJECT_NAME}
|
||||
RifOdbReader.h
|
||||
RifOdbReader.cpp
|
||||
RifInpReader.h
|
||||
RifInpReader.cpp
|
||||
RifGeoMechReaderInterface.h
|
||||
RifGeoMechReaderInterface.cpp
|
||||
RifInpIncludeReader.h
|
||||
RifInpIncludeReader.cpp
|
||||
OdbSetup.cmake
|
||||
)
|
||||
add_library(${PROJECT_NAME} RifOdbReader.h RifOdbReader.cpp OdbSetup.cmake)
|
||||
|
||||
target_include_directories(
|
||||
${PROJECT_NAME} PRIVATE ${RESINSIGHT_ODB_API_DIR}/include
|
||||
@ -88,7 +77,8 @@ endif(MSVC)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME} ${RI_ODB_LIBS} RigGeoMechDataModel LibCore
|
||||
${PROJECT_NAME} ${RI_ODB_LIBS} RigGeoMechDataModel RifGeoMechFileInterface
|
||||
LibCore
|
||||
)
|
||||
|
||||
source_group("" FILES ${PROJECT_FILES})
|
||||
|
@ -1,5 +1,3 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
project(OdbReader_UnitTests)
|
||||
|
||||
set(RI_VIZ_FWK_ROOT
|
||||
@ -21,12 +19,14 @@ add_subdirectory(${RI_VIZ_FWK_ROOT}/LibCore buildVizFwk)
|
||||
add_subdirectory(../../ResultStatisticsCache buildResultStatisticsCache)
|
||||
add_subdirectory(../OdbReader buildOdbReader)
|
||||
add_subdirectory(../GeoMechDataModel buildGeoMechDataModel)
|
||||
add_subdirectory(../GeoMechFileInterface buildGeoMechFileInterface)
|
||||
|
||||
add_definitions(-DTEST_FILE="${RI_TEST_FILE}")
|
||||
|
||||
include_directories(${RI_VIZ_FWK_ROOT}/LibCore)
|
||||
include_directories(../../ResultStatisticsCache)
|
||||
include_directories(../../ReservoirDataModel)
|
||||
include_directories(../GeoMechFileInterface)
|
||||
include_directories(../OdbReader)
|
||||
include_directories(../GeoMechDataModel)
|
||||
include_directories(${RI_GTEST_ROOT})
|
||||
@ -36,6 +36,6 @@ set(UNIT_TEST_CPP_SOURCES main.cpp RifOdbReader-Test.cpp
|
||||
)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${UNIT_TEST_CPP_SOURCES})
|
||||
target_link_libraries(${PROJECT_NAME} RifOdbReader)
|
||||
target_link_libraries(${PROJECT_NAME} RifOdbReader RifGeoMechFileInterface)
|
||||
|
||||
include(../OdbReader/OdbSetup.cmake)
|
||||
|
@ -571,15 +571,14 @@ void RiuMainWindow::createToolBars()
|
||||
toolbar->addAction( cmdFeatureMgr->action( "RicImportEnsembleFeature" ) );
|
||||
toolbar->hide();
|
||||
}
|
||||
|
||||
{
|
||||
#ifdef USE_ODB_API
|
||||
QToolBar* toolbar = addToolBar( tr( "Import GeoMech" ) );
|
||||
toolbar->setObjectName( toolbar->windowTitle() );
|
||||
toolbar->addAction( cmdFeatureMgr->action( "RicImportGeoMechCaseFeature" ) );
|
||||
toolbar->addAction( cmdFeatureMgr->action( "RicImportGeoMechCaseTimeStepFilterFeature" ) );
|
||||
toolbar->addAction( cmdFeatureMgr->action( "RicImportElementPropertyFeature" ) );
|
||||
toolbar->hide();
|
||||
#endif
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -129,13 +129,11 @@ void RiuMenuBarBuildTools::addImportMenuWithActions( QObject* parent, QMenu* men
|
||||
importSummaryMenu->addAction( cmdFeatureMgr->action( "RicImportSummaryGroupFeature" ) );
|
||||
importSummaryMenu->addAction( cmdFeatureMgr->action( "RicImportEnsembleFeature" ) );
|
||||
|
||||
#ifdef USE_ODB_API
|
||||
importMenu->addSeparator();
|
||||
QMenu* importGeoMechMenu = importMenu->addMenu( QIcon( ":/GeoMechCase24x24.png" ), "Geo Mechanical Cases" );
|
||||
importGeoMechMenu->addAction( cmdFeatureMgr->action( "RicImportGeoMechCaseFeature" ) );
|
||||
importGeoMechMenu->addAction( cmdFeatureMgr->action( "RicImportGeoMechCaseTimeStepFilterFeature" ) );
|
||||
importGeoMechMenu->addAction( cmdFeatureMgr->action( "RicImportElementPropertyFeature" ) );
|
||||
#endif
|
||||
|
||||
importMenu->addSeparator();
|
||||
QMenu* importWellMenu = importMenu->addMenu( QIcon( ":/Well.svg" ), "Well Data" );
|
||||
|
@ -907,6 +907,7 @@ add_subdirectory(ApplicationLibCode)
|
||||
add_subdirectory(ApplicationLibCode/Commands)
|
||||
add_subdirectory(ApplicationLibCode/ResultStatisticsCache)
|
||||
add_subdirectory(ApplicationLibCode/GeoMech/GeoMechDataModel)
|
||||
add_subdirectory(ApplicationLibCode/GeoMech/GeoMechFileInterface)
|
||||
if(RESINSIGHT_USE_ODB_API)
|
||||
add_subdirectory(ApplicationLibCode/GeoMech/OdbReader)
|
||||
endif()
|
||||
@ -941,8 +942,13 @@ if(MSVC AND RESINSIGHT_ENABLE_STATIC_ANALYSIS)
|
||||
)
|
||||
|
||||
set(TARGETS_FOR_STATIC_ANALYSIS
|
||||
${APP_FWK_LIBRARIES} ${APP_FWK_TEST_PROJECTS} ApplicationLibCode Commands
|
||||
ResultStatisticsCache RigGeoMechDataModel
|
||||
${APP_FWK_LIBRARIES}
|
||||
${APP_FWK_TEST_PROJECTS}
|
||||
ApplicationLibCode
|
||||
Commands
|
||||
ResultStatisticsCache
|
||||
RigGeoMechDataModel
|
||||
RifGeoMechFileInterface
|
||||
)
|
||||
|
||||
foreach(TARGET_PROJECT ${TARGETS_FOR_STATIC_ANALYSIS})
|
||||
|
Loading…
Reference in New Issue
Block a user