mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
bugfixes
This commit is contained in:
@@ -26,10 +26,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace Opm {
|
|
||||||
class DeferredLogger;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
/** This class implements a deferred logger:
|
/** This class implements a deferred logger:
|
||||||
|
|||||||
@@ -38,10 +38,14 @@ namespace
|
|||||||
MPI_Pack(&lm.flag, 1, MPI_INT64_T, buf.data(), buf.size(), &offset, MPI_COMM_WORLD);
|
MPI_Pack(&lm.flag, 1, MPI_INT64_T, buf.data(), buf.size(), &offset, MPI_COMM_WORLD);
|
||||||
int tagsize = lm.tag.size();
|
int tagsize = lm.tag.size();
|
||||||
MPI_Pack(&tagsize, 1, MPI_UNSIGNED, buf.data(), buf.size(), &offset, MPI_COMM_WORLD);
|
MPI_Pack(&tagsize, 1, MPI_UNSIGNED, buf.data(), buf.size(), &offset, MPI_COMM_WORLD);
|
||||||
MPI_Pack(lm.tag.c_str(), lm.tag.size(), MPI_CHAR, buf.data(), buf.size(), &offset, MPI_COMM_WORLD);
|
if (tagsize>0) {
|
||||||
|
MPI_Pack(lm.tag.c_str(), lm.tag.size(), MPI_CHAR, buf.data(), buf.size(), &offset, MPI_COMM_WORLD);
|
||||||
|
}
|
||||||
int textsize = lm.text.size();
|
int textsize = lm.text.size();
|
||||||
MPI_Pack(&textsize, 1, MPI_UNSIGNED, buf.data(), buf.size(), &offset, MPI_COMM_WORLD);
|
MPI_Pack(&textsize, 1, MPI_UNSIGNED, buf.data(), buf.size(), &offset, MPI_COMM_WORLD);
|
||||||
MPI_Pack(lm.text.c_str(), lm.text.size(), MPI_CHAR, buf.data(), buf.size(), &offset, MPI_COMM_WORLD);
|
if (textsize>0) {
|
||||||
|
MPI_Pack(lm.text.c_str(), lm.text.size(), MPI_CHAR, buf.data(), buf.size(), &offset, MPI_COMM_WORLD);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,22 +56,22 @@ namespace
|
|||||||
MPI_Unpack(data, recv_buffer.size(), &offset, &flag, 1, MPI_INT64_T, MPI_COMM_WORLD);
|
MPI_Unpack(data, recv_buffer.size(), &offset, &flag, 1, MPI_INT64_T, MPI_COMM_WORLD);
|
||||||
|
|
||||||
// unpack tag
|
// unpack tag
|
||||||
unsigned int tag_length;
|
unsigned int tagsize;
|
||||||
MPI_Unpack(data, recv_buffer.size(), &offset, &tag_length, 1, MPI_UNSIGNED, MPI_COMM_WORLD);
|
MPI_Unpack(data, recv_buffer.size(), &offset, &tagsize, 1, MPI_UNSIGNED, MPI_COMM_WORLD);
|
||||||
std::string tag;
|
std::string tag;
|
||||||
if (tag_length>0) {
|
if (tagsize>0) {
|
||||||
std::vector<char> tagchars(tag_length);
|
std::vector<char> tagchars(tagsize);
|
||||||
MPI_Unpack(data, recv_buffer.size(), &offset, tagchars.data(), tag_length, MPI_CHAR, MPI_COMM_WORLD);
|
MPI_Unpack(data, recv_buffer.size(), &offset, tagchars.data(), tagsize, MPI_CHAR, MPI_COMM_WORLD);
|
||||||
tag = std::string(tagchars.data());
|
tag = std::string(tagchars.data(), tagsize);
|
||||||
}
|
}
|
||||||
// unpack text
|
// unpack text
|
||||||
unsigned int text_length;
|
unsigned int textsize;
|
||||||
MPI_Unpack(data, recv_buffer.size(), &offset, &text_length, 1, MPI_UNSIGNED, MPI_COMM_WORLD);
|
MPI_Unpack(data, recv_buffer.size(), &offset, &textsize, 1, MPI_UNSIGNED, MPI_COMM_WORLD);
|
||||||
std::string text;
|
std::string text;
|
||||||
if (text_length>0) {
|
if (textsize>0) {
|
||||||
std::vector<char> textchars(text_length);
|
std::vector<char> textchars(textsize);
|
||||||
MPI_Unpack(data, recv_buffer.size(), &offset, textchars.data(), text_length, MPI_CHAR, MPI_COMM_WORLD);
|
MPI_Unpack(data, recv_buffer.size(), &offset, textchars.data(), textsize, MPI_CHAR, MPI_COMM_WORLD);
|
||||||
text = std::string (textchars.data());
|
text = std::string (textchars.data(), textsize);
|
||||||
}
|
}
|
||||||
return Opm::DeferredLogger::Message({flag, tag, text});
|
return Opm::DeferredLogger::Message({flag, tag, text});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,8 +23,6 @@
|
|||||||
|
|
||||||
#include <opm/simulators/DeferredLogger.hpp>
|
#include <opm/simulators/DeferredLogger.hpp>
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user