Merge pull request #2787 from akva2/fix_optional_deserialization

Fix optional deserialization
This commit is contained in:
Atgeirr Flø Rasmussen 2020-09-16 09:41:53 +02:00 committed by GitHub
commit 0816e21846
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 6 deletions

View File

@ -617,9 +617,11 @@ void unpack(std::optional<T>&data, std::vector<char>& buffer, int& position,
{
bool has_value;
unpack(has_value, buffer, position, comm);
if (has_value)
unpack(*data, buffer, position, comm);
else
if (has_value) {
T val;
unpack(val, buffer, position, comm);
data = std::optional<T>(val);
} else
data.reset();
}

View File

@ -143,6 +143,7 @@ FileOutputMode setupLogging(int mpi_rank_, const std::string& deck_filename, con
}
namespace {
void setupMessageLimiter(const Opm::MessageLimits msgLimits, const std::string& stdout_log_id) {
std::shared_ptr<Opm::StreamLog> stream_log = Opm::OpmLog::getBackend<Opm::StreamLog>(stdout_log_id);
@ -160,6 +161,7 @@ void setupMessageLimiter(const Opm::MessageLimits msgLimits, const std::string&
msgLimits.getBugPrintLimit(0)}};
stream_log->setMessageLimiter(std::make_shared<Opm::MessageLimiter>(10, limits));
}
}
void readDeck(int rank, std::string& deckFilename, std::unique_ptr<Opm::Deck>& deck, std::unique_ptr<Opm::EclipseState>& eclipseState,

View File

@ -50,9 +50,6 @@ enum class FileOutputMode {
// Setup the OpmLog backends
FileOutputMode setupLogging(int mpi_rank_, const std::string& deck_filename, const std::string& cmdline_output_dir, const std::string& cmdline_output, bool output_cout_, const std::string& stdout_log_id);
void setupMessageLimiter(const Opm::MessageLimits msgLimits, const std::string& stdout_log_id);
/// \brief Reads the deck and creates all necessary objects if needed
///
/// If pointers already contains objects then they are used otherwise they are created and can be used outside later.

View File

@ -64,6 +64,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/icd.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/SICD.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Network/Node.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
@ -487,6 +488,7 @@ TEST_FOR_TYPE(MessageLimits)
TEST_FOR_TYPE(MLimits)
TEST_FOR_TYPE(MULTREGTScanner)
TEST_FOR_TYPE(NNC)
TEST_FOR_TYPE2(Network, Node)
TEST_FOR_TYPE(OilVaporizationProperties)
TEST_FOR_TYPE(Phases)
TEST_FOR_TYPE(PlymwinjTable)