Merge pull request #368 from stefoss23/RemoveMessageContainer

Removed MessageContainer. OpmLog used instead.
This commit is contained in:
Joakim Hove
2018-03-26 13:04:23 +02:00
committed by GitHub
36 changed files with 102 additions and 610 deletions

View File

@@ -30,7 +30,6 @@
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
#include <opm/parser/eclipse/Parser/MessageContainer.hpp>
#ifdef OPM_PARSER_DECK_API_WARNING
#ifndef OPM_PARSER_DECK_API
@@ -136,7 +135,6 @@ namespace Opm {
void addKeyword( const DeckKeyword& keyword );
DeckKeyword& getKeyword( size_t );
MessageContainer& getMessageContainer() const;
const UnitSystem& getDefaultUnitSystem() const;
const UnitSystem& getActiveUnitSystem() const;
@@ -154,7 +152,6 @@ namespace Opm {
Deck( std::vector< DeckKeyword >&& );
std::vector< DeckKeyword > keywordList;
mutable MessageContainer m_messageContainer;
UnitSystem defaultUnits;
UnitSystem activeUnits;

View File

@@ -66,7 +66,6 @@ namespace Opm {
bool hasDeckIntGridProperty(const std::string& keyword) const;
bool hasDeckDoubleGridProperty(const std::string& keyword) const;
bool supportsGridProperty(const std::string& keyword) const;
MessageContainer getMessageContainer();
private:
const GridProperty<int>& getRegion(const DeckItem& regionItem) const;

View File

@@ -31,7 +31,6 @@
#include <opm/parser/eclipse/EclipseState/Grid/TransMult.hpp>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
#include <opm/parser/eclipse/Parser/MessageContainer.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
@@ -97,9 +96,6 @@ namespace Opm {
const UnitSystem& getDeckUnitSystem() const;
const UnitSystem& getUnits() const;
const MessageContainer& getMessageContainer() const;
MessageContainer& getMessageContainer();
std::string getTitle() const;
void applyModifierDeck(const Deck& deck);
@@ -130,8 +126,6 @@ namespace Opm {
FaultCollection m_faults;
std::string m_title;
MessageContainer m_messageContainer;
};
}

View File

@@ -27,8 +27,6 @@
#include <opm/parser/eclipse/EclipseState/Grid/PinchMode.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/GridDims.hpp>
#include <opm/parser/eclipse/Parser/MessageContainer.hpp>
#include <ert/ecl/ecl_grid.h>
#include <ert/util/ert_unique_ptr.hpp>
@@ -176,11 +174,8 @@ namespace Opm {
void resetACTNUM( const int * actnum);
bool equal(const EclipseGrid& other) const;
const ecl_grid_type * c_ptr() const;
const MessageContainer& getMessageContainer() const;
MessageContainer& getMessageContainer();
private:
MessageContainer m_messages;
private:
double m_minpvValue;
MinpvMode::ModeEnum m_minpvMode;
Value<double> m_pinch;

View File

@@ -31,7 +31,6 @@
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/GridProperty.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/BoxManager.hpp>
#include <opm/parser/eclipse/Parser/MessageContainer.hpp>
#include <opm/parser/eclipse/Units/Dimension.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
@@ -113,10 +112,6 @@ namespace Opm {
const Box& inputBox);
const MessageContainer& getMessageContainer() const;
MessageContainer& getMessageContainer();
template <class Keyword>
bool hasKeyword() const {
return hasKeyword( Keyword::keywordName );
@@ -199,7 +194,6 @@ namespace Opm {
size_t ny = 0;
size_t nz = 0;
const UnitSystem * m_deckUnitSystem = nullptr;
MessageContainer m_messages;
mutable std::unordered_map<std::string, SupportedKeywordInfo> m_supportedKeywords;
mutable storage m_properties;

View File

@@ -36,7 +36,6 @@
#include <opm/parser/eclipse/EclipseState/Util/OrderedMap.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MessageLimits.hpp>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/Parser/MessageContainer.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
namespace Opm
@@ -108,8 +107,6 @@ namespace Opm
const Events& getEvents() const;
const Deck& getModifierDeck(size_t timeStep) const;
bool hasOilVaporizationProperties() const;
const MessageContainer& getMessageContainer() const;
MessageContainer& getMessageContainer();
/*
Will remove all completions which are connected to cell which is not
@@ -129,7 +126,6 @@ namespace Opm
MessageLimits m_messageLimits;
Phases m_phases;
MessageContainer m_messages;
WellProducer::ControlModeEnum m_controlModeWHISTCTL;
std::vector< Well* > getWells(const std::string& wellNamePattern);

View File

@@ -35,7 +35,6 @@
#include <opm/parser/eclipse/EclipseState/Schedule/WellProductionProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/SegmentSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/Parser/MessageContainer.hpp>
namespace Opm {
@@ -161,7 +160,6 @@ namespace Opm {
void addSegmentSet(size_t time_step, SegmentSet new_segmentset);
const MessageContainer& getMessageContainer() const;
const Events& getEvents() const;
void addEvent(ScheduleEvents::Events event, size_t reportStep);
bool hasEvent(uint64_t eventMask, size_t reportStep) const;
@@ -202,7 +200,6 @@ namespace Opm {
WellCompletion::CompletionOrderEnum m_comporder;
bool m_allowCrossFlow;
bool m_automaticShutIn;
MessageContainer m_messages;
// WELSEGS DATA - for mutli-segment wells
// flag indicating if the well is a multi-segment well
DynamicState< SegmentSet > m_segmentset;

View File

@@ -23,6 +23,9 @@
#include <set>
#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/common/OpmLog/LogUtil.hpp>
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
@@ -46,7 +49,6 @@
#include <opm/parser/eclipse/EclipseState/Tables/VFPInjTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/VFPProdTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/Aqudims.hpp>
#include <opm/parser/eclipse/Parser/MessageContainer.hpp>
namespace Opm {
@@ -138,9 +140,6 @@ namespace Opm {
/// deck has keyword "JFUNC" --- Use Leverett's J Function for capillary pressure
bool useJFunc() const;
const MessageContainer& getMessageContainer() const;
MessageContainer& getMessageContainer();
double rtemp() const;
private:
TableContainer& forceGetTables( const std::string& tableName , size_t numTables);
@@ -260,7 +259,7 @@ namespace Opm {
// should be copied...
if (tableIdx == 0) {
std::string msg = "The first table for keyword "+keywordName+" must be explicitly defined! Ignoring keyword";
m_messages.warning(tableKeyword.getFileName() + std::to_string(tableKeyword.getLineNumber()) + msg);
OpmLog::warning(Log::fileMessage(tableKeyword.getFileName(), tableKeyword.getLineNumber(), msg));
return;
}
tableVector.push_back(tableVector.back());
@@ -316,7 +315,6 @@ namespace Opm {
const JFunc m_jfunc;
MessageContainer m_messages;
double m_rtemp;
};
}

View File

@@ -23,8 +23,6 @@
#include <boost/multi_array.hpp>
#include <opm/parser/eclipse/Parser/MessageContainer.hpp>
namespace Opm {
class DeckItem;
@@ -230,8 +228,6 @@ public:
return m_data;
}
const MessageContainer& getMessageContainer() const;
private:
//"Header" variables
@@ -252,7 +248,6 @@ private:
//The data itself, using the data ordering m_data[thp][wfr][gfr][alq][flo]
array_type m_data;
MessageContainer m_messages;
/**
* Debug function that runs a series of asserts to check for sanity of inputs.
* Called after init to check that everything looks ok.

View File

@@ -1,108 +0,0 @@
/*
Copyright 2016 Statoil ASA.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MESSAGECONTAINER_H
#define MESSAGECONTAINER_H
#include <string>
#include <vector>
#include <memory>
namespace Opm {
struct Location {
Location() = default;
Location( const std::string&, size_t );
std::string filename;
size_t lineno = 0;
explicit operator bool() const {
return lineno != 0;
}
};
struct Message {
enum type {
Debug = 1,
Note = 2,
Info = 3,
Warning = 4,
Error = 5,
Problem = 6,
Bug = 7
};
Message( type mt, const std::string& msg, Location&& loc ) :
mtype( mt ), message( msg ), location( std::move( loc ) ) {}
Message( type mt, const std::string& msg ) :
mtype( mt ), message( msg ) {}
type mtype;
std::string message;
Location location;
};
///Message container is used to replace OpmLog functionalities.
class MessageContainer {
public:
using const_iterator = std::vector< Message >::const_iterator;
void error(const std::string& msg, const std::string& filename, const size_t lineno);
void error(const std::string& msg);
void bug(const std::string& msg, const std::string& filename, const size_t lineno);
void bug(const std::string& msg);
void warning(const std::string& msg, const std::string& filename, const size_t lineno);
void warning(const std::string& msg);
void info(const std::string& msg, const std::string& filename, const size_t lineno);
void info(const std::string& msg);
void debug(const std::string& msg, const std::string& filename, const size_t lineno);
void debug(const std::string& msg);
void problem(const std::string& msg, const std::string& filename, const size_t lineno);
void problem(const std::string& msg);
void note(const std::string& msg, const std::string& filename, const size_t lineno);
void note(const std::string& msg);
void add( const Message& );
void add( Message&& );
void appendMessages(const MessageContainer& other);
const_iterator begin() const;
const_iterator end() const;
std::size_t size() const;
private:
std::vector<Message> m_messages;
};
} // namespace Opm
#endif // OPM_MESSAGECONTAINER_HEADER_INCLUDED

View File

@@ -25,8 +25,9 @@
#include <map>
#include <vector>
#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/parser/eclipse/Parser/InputErrorAction.hpp>
#include <opm/parser/eclipse/Parser/MessageContainer.hpp>
namespace Opm {
@@ -82,7 +83,7 @@ namespace Opm {
explicit ParseContext(InputError::Action default_action);
explicit ParseContext(const std::vector<std::pair<std::string , InputError::Action>>& initial);
Message::type handleError( const std::string& errorKey, MessageContainer& msgContainer, const std::string& msg ) const;
void handleError( const std::string& errorKey, const std::string& msg ) const;
bool hasKey(const std::string& key) const;
ParseContext withKey(const std::string& key, InputError::Action action = InputError::WARN) const;
ParseContext& withKey(const std::string& key, InputError::Action action = InputError::WARN);

View File

@@ -40,7 +40,6 @@ namespace Opm {
class ParserDoubleItem;
class RawKeyword;
class string_view;
class MessageContainer;
/*
Small helper struct to assemble the information needed to infer the size
@@ -123,7 +122,7 @@ namespace Opm {
SectionNameSet::const_iterator validSectionNamesBegin() const;
SectionNameSet::const_iterator validSectionNamesEnd() const;
DeckKeyword parse(const ParseContext& parseContext , MessageContainer& msgContainer, std::shared_ptr< RawKeyword > rawKeyword) const;
DeckKeyword parse(const ParseContext& parseContext , std::shared_ptr< RawKeyword > rawKeyword) const;
enum ParserKeywordSizeEnum getSizeType() const;
const KeywordSize& getKeywordSize() const;
bool isDataKeyword() const;

View File

@@ -33,7 +33,6 @@ namespace Opm {
class ParseContext;
class ParserItem;
class RawRecord;
class MessageContainer;
class ParserRecord {
public:
@@ -43,7 +42,7 @@ namespace Opm {
void addDataItem( ParserItem item );
const ParserItem& get(size_t index) const;
const ParserItem& get(const std::string& itemName) const;
DeckRecord parse( const ParseContext&, MessageContainer&, RawRecord& ) const;
DeckRecord parse( const ParseContext&, RawRecord& ) const;
bool isDataRecord() const;
bool equal(const ParserRecord& other) const;
bool hasDimension() const;