mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #2787 from akva2/fix_optional_deserialization
Fix optional deserialization
This commit is contained in:
@@ -617,9 +617,11 @@ void unpack(std::optional<T>&data, std::vector<char>& buffer, int& position,
|
|||||||
{
|
{
|
||||||
bool has_value;
|
bool has_value;
|
||||||
unpack(has_value, buffer, position, comm);
|
unpack(has_value, buffer, position, comm);
|
||||||
if (has_value)
|
if (has_value) {
|
||||||
unpack(*data, buffer, position, comm);
|
T val;
|
||||||
else
|
unpack(val, buffer, position, comm);
|
||||||
|
data = std::optional<T>(val);
|
||||||
|
} else
|
||||||
data.reset();
|
data.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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) {
|
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);
|
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)}};
|
msgLimits.getBugPrintLimit(0)}};
|
||||||
stream_log->setMessageLimiter(std::make_shared<Opm::MessageLimiter>(10, limits));
|
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,
|
void readDeck(int rank, std::string& deckFilename, std::unique_ptr<Opm::Deck>& deck, std::unique_ptr<Opm::EclipseState>& eclipseState,
|
||||||
|
|||||||
@@ -50,9 +50,6 @@ enum class FileOutputMode {
|
|||||||
// Setup the OpmLog backends
|
// 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);
|
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
|
/// \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.
|
/// If pointers already contains objects then they are used otherwise they are created and can be used outside later.
|
||||||
|
|||||||
@@ -64,6 +64,7 @@
|
|||||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/icd.hpp>
|
#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/SICD.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.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/OilVaporizationProperties.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||||
@@ -487,6 +488,7 @@ TEST_FOR_TYPE(MessageLimits)
|
|||||||
TEST_FOR_TYPE(MLimits)
|
TEST_FOR_TYPE(MLimits)
|
||||||
TEST_FOR_TYPE(MULTREGTScanner)
|
TEST_FOR_TYPE(MULTREGTScanner)
|
||||||
TEST_FOR_TYPE(NNC)
|
TEST_FOR_TYPE(NNC)
|
||||||
|
TEST_FOR_TYPE2(Network, Node)
|
||||||
TEST_FOR_TYPE(OilVaporizationProperties)
|
TEST_FOR_TYPE(OilVaporizationProperties)
|
||||||
TEST_FOR_TYPE(Phases)
|
TEST_FOR_TYPE(Phases)
|
||||||
TEST_FOR_TYPE(PlymwinjTable)
|
TEST_FOR_TYPE(PlymwinjTable)
|
||||||
|
|||||||
Reference in New Issue
Block a user