#2881 Continue exporting other completions if one has a unit mismatch.

* Report an error and continue rather than abort.
This commit is contained in:
Gaute Lindkvist 2018-05-09 13:05:50 +02:00
parent 5310d28433
commit b9cbd7c503

View File

@ -63,8 +63,8 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::vector<RimWellPath*>& usedWellPaths, void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::vector<RimWellPath*>& wellPaths,
const std::vector<RimSimWellInView*>& usedSimWells, const std::vector<RimSimWellInView*>& simWells,
const RicExportCompletionDataSettingsUi& exportSettings) const RicExportCompletionDataSettingsUi& exportSettings)
{ {
if (exportSettings.caseToApply() == nullptr) if (exportSettings.caseToApply() == nullptr)
@ -74,31 +74,19 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::ve
} }
std::vector<RimWellPath*> usedWellPaths;
for (RimWellPath* wellPath : wellPaths)
{ {
bool unitSystemMismatch = false; if (wellPath->unitSystem() == exportSettings.caseToApply->eclipseCaseData()->unitsType())
for (const RimWellPath* wellPath : usedWellPaths)
{ {
if (wellPath->unitSystem() != exportSettings.caseToApply->eclipseCaseData()->unitsType()) usedWellPaths.push_back(wellPath);
{
unitSystemMismatch = true;
break;
} }
} else
for (const RimSimWellInView* simWell : usedSimWells)
{ {
RimEclipseCase* eclipseCase; int caseId = exportSettings.caseToApply->caseId();
simWell->firstAncestorOrThisOfType(eclipseCase); QString format = QString("Unit systems for well path \"%1\" must match unit system of chosen eclipse case \"%2\"");
if (exportSettings.caseToApply->eclipseCaseData()->unitsType() != eclipseCase->eclipseCaseData()->unitsType()) QString errMsg = format.arg(wellPath->name()).arg(caseId);
{ RiaLogging::error(errMsg);
unitSystemMismatch = true;
break;
}
}
if (unitSystemMismatch)
{
RiaLogging::error("Well path unit systems must match unit system of chosen eclipse case.");
return;
} }
} }
@ -129,13 +117,13 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::ve
} }
} }
size_t maxProgress = usedWellPaths.size() * 3 + usedSimWells.size() + size_t maxProgress = usedWellPaths.size() * 3 + simWells.size() +
(exportSettings.fileSplit == RicExportCompletionDataSettingsUi::SPLIT_ON_WELL (exportSettings.fileSplit == RicExportCompletionDataSettingsUi::SPLIT_ON_WELL
? usedWellPaths.size() ? usedWellPaths.size()
: exportSettings.fileSplit == RicExportCompletionDataSettingsUi::SPLIT_ON_WELL_AND_COMPLETION_TYPE : exportSettings.fileSplit == RicExportCompletionDataSettingsUi::SPLIT_ON_WELL_AND_COMPLETION_TYPE
? usedWellPaths.size() * 3 ? usedWellPaths.size() * 3
: 1) + : 1) +
usedSimWells.size(); simWells.size();
caf::ProgressInfo progress(maxProgress, "Export Completions"); caf::ProgressInfo progress(maxProgress, "Export Completions");
@ -211,7 +199,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::ve
progress.incrementProgress(); progress.incrementProgress();
} }
for (auto simWell : usedSimWells) for (auto simWell : simWells)
{ {
std::map<RigCompletionDataGridCell, std::vector<RigCompletionData>> completionsPerEclipseCell; std::map<RigCompletionDataGridCell, std::vector<RigCompletionData>> completionsPerEclipseCell;
@ -299,7 +287,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::ve
if (exportSettings.fileSplit == RicExportCompletionDataSettingsUi::SPLIT_ON_WELL || if (exportSettings.fileSplit == RicExportCompletionDataSettingsUi::SPLIT_ON_WELL ||
exportSettings.fileSplit == RicExportCompletionDataSettingsUi::SPLIT_ON_WELL_AND_COMPLETION_TYPE) exportSettings.fileSplit == RicExportCompletionDataSettingsUi::SPLIT_ON_WELL_AND_COMPLETION_TYPE)
{ {
for (auto simWell : usedSimWells) for (auto simWell : simWells)
{ {
std::vector<RigCompletionData> wellCompletions; std::vector<RigCompletionData> wellCompletions;
for (const auto& completion : completions) for (const auto& completion : completions)