Whitespace

This commit is contained in:
Magne Sjaastad 2019-03-11 11:45:35 +01:00
parent 79a7dfd0c6
commit 70c3b4df71

View File

@ -1,17 +1,17 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2017- Statoil ASA // Copyright (C) 2017- Statoil ASA
// //
// ResInsight is free software: you can redistribute it and/or modify // ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or // WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. // FITNESS FOR A PARTICULAR PURPOSE.
// //
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html> // See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details. // for more details.
// //
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
@ -20,11 +20,10 @@
#include "RimEnsembleStatisticsCase.h" #include "RimEnsembleStatisticsCase.h"
static const std::vector<time_t> EMPTY_TIME_STEPS_VECTOR; static const std::vector<time_t> EMPTY_TIME_STEPS_VECTOR;
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RifEnsembleStatisticsReader::RifEnsembleStatisticsReader(RimEnsembleStatisticsCase* ensStatCase) RifEnsembleStatisticsReader::RifEnsembleStatisticsReader(RimEnsembleStatisticsCase* ensStatCase)
{ {
@ -33,16 +32,14 @@ RifEnsembleStatisticsReader::RifEnsembleStatisticsReader(RimEnsembleStatisticsCa
m_ensembleStatCase = ensStatCase; m_ensembleStatCase = ensStatCase;
m_allResultAddresses = std::set<RifEclipseSummaryAddress>( m_allResultAddresses = std::set<RifEclipseSummaryAddress>(
{ {RifEclipseSummaryAddress::ensembleStatisticsAddress(ENSEMBLE_STAT_P10_QUANTITY_NAME, ""),
RifEclipseSummaryAddress::ensembleStatisticsAddress(ENSEMBLE_STAT_P10_QUANTITY_NAME, ""), RifEclipseSummaryAddress::ensembleStatisticsAddress(ENSEMBLE_STAT_P50_QUANTITY_NAME, ""),
RifEclipseSummaryAddress::ensembleStatisticsAddress(ENSEMBLE_STAT_P50_QUANTITY_NAME, ""), RifEclipseSummaryAddress::ensembleStatisticsAddress(ENSEMBLE_STAT_P90_QUANTITY_NAME, ""),
RifEclipseSummaryAddress::ensembleStatisticsAddress(ENSEMBLE_STAT_P90_QUANTITY_NAME, ""), RifEclipseSummaryAddress::ensembleStatisticsAddress(ENSEMBLE_STAT_MEAN_QUANTITY_NAME, "")});
RifEclipseSummaryAddress::ensembleStatisticsAddress(ENSEMBLE_STAT_MEAN_QUANTITY_NAME, "")
});
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const std::vector<time_t>& RifEnsembleStatisticsReader::timeSteps(const RifEclipseSummaryAddress& resultAddress) const const std::vector<time_t>& RifEnsembleStatisticsReader::timeSteps(const RifEclipseSummaryAddress& resultAddress) const
{ {
@ -51,30 +48,35 @@ const std::vector<time_t>& RifEnsembleStatisticsReader::timeSteps(const RifEclip
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RifEnsembleStatisticsReader::values(const RifEclipseSummaryAddress& resultAddress, std::vector<double>* values) const bool RifEnsembleStatisticsReader::values(const RifEclipseSummaryAddress& resultAddress, std::vector<double>* values) const
{ {
if (!validateAddress(resultAddress)) return false; if (!validateAddress(resultAddress)) return false;
const std::vector<double>* sourceData = nullptr; const std::vector<double>* sourceData = nullptr;
auto quantityName = resultAddress.ensembleStatisticsQuantityName(); auto quantityName = resultAddress.ensembleStatisticsQuantityName();
if (quantityName == ENSEMBLE_STAT_P10_QUANTITY_NAME) sourceData = &m_ensembleStatCase->p10(); if (quantityName == ENSEMBLE_STAT_P10_QUANTITY_NAME)
else if (quantityName == ENSEMBLE_STAT_P50_QUANTITY_NAME) sourceData = &m_ensembleStatCase->p50(); sourceData = &m_ensembleStatCase->p10();
else if (quantityName == ENSEMBLE_STAT_P90_QUANTITY_NAME) sourceData = &m_ensembleStatCase->p90(); else if (quantityName == ENSEMBLE_STAT_P50_QUANTITY_NAME)
else if (quantityName == ENSEMBLE_STAT_MEAN_QUANTITY_NAME) sourceData = &m_ensembleStatCase->mean(); sourceData = &m_ensembleStatCase->p50();
else if (quantityName == ENSEMBLE_STAT_P90_QUANTITY_NAME)
sourceData = &m_ensembleStatCase->p90();
else if (quantityName == ENSEMBLE_STAT_MEAN_QUANTITY_NAME)
sourceData = &m_ensembleStatCase->mean();
if (!sourceData) return false; if (!sourceData) return false;
values->clear(); values->clear();
values->reserve(sourceData->size()); values->reserve(sourceData->size());
for (auto val : *sourceData) values->push_back(val); for (auto val : *sourceData)
values->push_back(val);
return true; return true;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::string RifEnsembleStatisticsReader::unitName(const RifEclipseSummaryAddress& resultAddress) const std::string RifEnsembleStatisticsReader::unitName(const RifEclipseSummaryAddress& resultAddress) const
{ {
@ -82,10 +84,9 @@ std::string RifEnsembleStatisticsReader::unitName(const RifEclipseSummaryAddress
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RifEnsembleStatisticsReader::validateAddress(const RifEclipseSummaryAddress& address) const bool RifEnsembleStatisticsReader::validateAddress(const RifEclipseSummaryAddress& address) const
{ {
return address.category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS && return address.category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS && !address.quantityName().empty();
!address.quantityName().empty();
} }