Skip to content

Commit

Permalink
Fault Reactivation Export: handle steps selection in export.
Browse files Browse the repository at this point in the history
  • Loading branch information
kriben committed Sep 27, 2023
1 parent afa0573 commit 6a54626
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ std::pair<bool, std::string> 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 )
Expand Down Expand Up @@ -377,16 +377,19 @@ std::pair<bool, std::string>
//--------------------------------------------------------------------------------------------------
std::pair<bool, std::string>
RifFaultReactivationModelExporter::printSteps( std::ostream& stream,
const std::map<RigFaultReactivationModel::GridPart, std::string>& partNames )
const std::map<RigFaultReactivationModel::GridPart, std::string>& partNames,
const std::vector<QDateTime>& 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<int>( 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" );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ class RifFaultReactivationModelExporter
static std::pair<bool, std::string> printPredefinedFields( std::ostream& stream,
const std::map<RigFaultReactivationModel::GridPart, std::string>& partNames );
static std::pair<bool, std::string> printSteps( std::ostream& stream,
const std::map<RigFaultReactivationModel::GridPart, std::string>& partNames );
const std::map<RigFaultReactivationModel::GridPart, std::string>& partNames,
const std::vector<QDateTime>& timeSteps );

static std::pair<bool, std::string> printInteractions( std::ostream& stream,
const std::map<RigFaultReactivationModel::GridPart, std::string>& partNames,
const std::vector<std::pair<RigGriddedPart3d::BorderSurface, std::string>>& borders );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,16 @@ std::vector<QDateTime> RimFaultReactivationModel::selectedTimeSteps() const
return m_selectedTimeSteps();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimFaultReactivationModel::isFirstTimeStepsSelected() const
{
if ( m_availableTimeSteps.empty() || selectedTimeSteps().empty() ) return false;

return m_availableTimeSteps.front() == selectedTimeSteps().front();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class RimFaultReactivationModel : public RimCheckableNamedObject, public RimPoly
void setBaseDir( QString path );

std::vector<QDateTime> selectedTimeSteps() const;
bool isFirstTimeStepsSelected() const;

QStringList commandParameters() const;

Expand Down

0 comments on commit 6a54626

Please sign in to comment.