diff --git a/ApplicationLibCode/FileInterface/RifFaultReactivationModelExporter.cpp b/ApplicationLibCode/FileInterface/RifFaultReactivationModelExporter.cpp index e5ca9b025c..7d9f161587 100644 --- a/ApplicationLibCode/FileInterface/RifFaultReactivationModelExporter.cpp +++ b/ApplicationLibCode/FileInterface/RifFaultReactivationModelExporter.cpp @@ -76,7 +76,7 @@ std::pair RifFaultReactivationModelExporter::exportToStream( [&]() { return printBoundaryConditions( stream, *model, partNames, boundaries ); }, [&]() { return printPredefinedFields( stream, partNames ); }, [&]() { return printInteractions( stream, partNames, borders ); }, - [&]() { return printSteps( stream, partNames ); }, + [&]() { return printSteps( stream, partNames, rimModel.selectedTimeSteps() ); }, }; for ( auto method : methods ) @@ -377,16 +377,19 @@ std::pair //-------------------------------------------------------------------------------------------------- std::pair RifFaultReactivationModelExporter::printSteps( std::ostream& stream, - const std::map& partNames ) + const std::map& partNames, + const std::vector& timeSteps ) { - int numSteps = 2; + // First time step has to be selected in order to export currently + if ( timeSteps.size() < 2 ) return { false, "Failed to export fault reactivation INP: needs at least two time steps." }; - for ( int i = 0; i < numSteps; i++ ) + for ( int i = 0; i < static_cast( timeSteps.size() ); i++ ) { std::string stepNum = std::to_string( i + 1 ); std::string stepName = "Step-" + stepNum; RifInpExportTools::printComment( stream, "----------------------------------------------------------------" ); RifInpExportTools::printSectionComment( stream, "STEP: " + stepName ); + RifInpExportTools::printComment( stream, "Time step: " + timeSteps[i].toString().toStdString() ); RifInpExportTools::printHeading( stream, "Step, name=" + stepName + ", nlgeom=NO" ); diff --git a/ApplicationLibCode/FileInterface/RifFaultReactivationModelExporter.h b/ApplicationLibCode/FileInterface/RifFaultReactivationModelExporter.h index ad33af1267..8e292164b2 100644 --- a/ApplicationLibCode/FileInterface/RifFaultReactivationModelExporter.h +++ b/ApplicationLibCode/FileInterface/RifFaultReactivationModelExporter.h @@ -62,7 +62,9 @@ class RifFaultReactivationModelExporter static std::pair printPredefinedFields( std::ostream& stream, const std::map& partNames ); static std::pair printSteps( std::ostream& stream, - const std::map& partNames ); + const std::map& partNames, + const std::vector& timeSteps ); + static std::pair printInteractions( std::ostream& stream, const std::map& partNames, const std::vector>& borders ); diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationModel.cpp b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationModel.cpp index 90fd538760..b46a18dd9d 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationModel.cpp +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationModel.cpp @@ -530,6 +530,16 @@ std::vector RimFaultReactivationModel::selectedTimeSteps() const return m_selectedTimeSteps(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimFaultReactivationModel::isFirstTimeStepsSelected() const +{ + if ( m_availableTimeSteps.empty() || selectedTimeSteps().empty() ) return false; + + return m_availableTimeSteps.front() == selectedTimeSteps().front(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationModel.h b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationModel.h index ed3195b909..20ffa696cd 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationModel.h +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultReactivationModel.h @@ -100,6 +100,7 @@ class RimFaultReactivationModel : public RimCheckableNamedObject, public RimPoly void setBaseDir( QString path ); std::vector selectedTimeSteps() const; + bool isFirstTimeStepsSelected() const; QStringList commandParameters() const;