15 #if !defined(KRATOS_LOGGER_MESSAGE_H_INCLUDED )
16 #define KRATOS_LOGGER_MESSAGE_H_INCLUDED
44 class DataCommunicator;
84 : mIsDistributed(rOther.mIsDistributed), mPrintFromAllRanks(rOther.mPrintFromAllRanks), mSourceRank(rOther.mSourceRank) {}
99 return mPrintFromAllRanks || Rank == mSourceRank;
103 return mIsDistributed;
112 : mIsDistributed(false), mPrintFromAllRanks(false), mSourceRank(0) {}
114 DistributedFilter(
bool IsDistributed,
bool PrintFromAllRanks,
int TheRank)
115 : mIsDistributed(IsDistributed), mPrintFromAllRanks(PrintFromAllRanks), mSourceRank(TheRank) {}
118 bool mPrintFromAllRanks;
146 : mLabel(Other.mLabel), mMessage(Other.mMessage), mLevel(Other.mLevel), mLocation(Other.mLocation), mSeverity(Other.mSeverity), mCategory(Other.mCategory), mMessageSource(Other.mMessageSource), mDistributedFilter(Other.mDistributedFilter) {}
157 mLabel = Other.mLabel;
158 mMessage = Other.mMessage;
159 mLevel = Other.mLevel;
161 mSeverity = Other.mSeverity;
162 mCategory = Other.mCategory;
163 mDistributedFilter = Other.mDistributedFilter;
186 mMessage = TheMessage;
202 mLocation = TheLocation;
210 mSeverity = TheSeverity;
218 mCategory = TheCategory;
226 return mDistributedFilter.IsDistributed();
230 return mDistributedFilter.WriteFromRank(mMessageSource.GetRank());
234 return mMessageSource.GetRank();
238 mTime = std::chrono::steady_clock::now();
254 virtual std::string
Info()
const;
257 virtual void PrintInfo(std::ostream& rOStream)
const;
260 virtual void PrintData(std::ostream& rOStream)
const;
264 template<
class StreamValueType>
267 std::stringstream buffer;
270 mMessage.append(buffer.str());
307 std::string mMessage;
312 MessageSource mMessageSource;
313 DistributedFilter mDistributedFilter;
326 const LoggerMessage& rThis);
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
Definition: code_location.h:31
Serial (do-nothing) version of a wrapper class for MPI communication.
Definition: data_communicator.h:318
Definition: logger_message.h:80
DistributedFilter(DistributedFilter const &rOther)
Definition: logger_message.h:83
bool IsDistributed() const
Definition: logger_message.h:102
static DistributedFilter FromRoot()
Definition: logger_message.h:86
static DistributedFilter FromAllRanks()
Definition: logger_message.h:94
static DistributedFilter FromRank(int TheRank)
Definition: logger_message.h:90
int GetRank() const
Definition: logger_message.h:106
bool WriteFromRank(int Rank) const
Definition: logger_message.h:98
Definition: logger_message.h:122
MessageSource(int TheRank)
Definition: logger_message.h:127
int GetRank() const
Definition: logger_message.h:130
LoggerMessage class holdes message and the properties of the message.
Definition: logger_message.h:53
LoggerMessage(LoggerMessage const &Other)
Definition: logger_message.h:145
CodeLocation GetLocation() const
Definition: logger_message.h:205
Severity
Definition: logger_message.h:64
virtual ~LoggerMessage()
Destructor.
Definition: logger_message.h:149
void SetCategory(Category const &TheCategory)
Definition: logger_message.h:217
void SetLocation(CodeLocation const &TheLocation)
Definition: logger_message.h:201
std::string const & GetLabel() const
Definition: logger_message.h:181
std::chrono::steady_clock::time_point TimePointType
Definition: logger_message.h:58
void SetLevel(std::size_t TheLevel)
Definition: logger_message.h:193
bool WriteInThisRank() const
Definition: logger_message.h:229
int GetSourceRank() const
Definition: logger_message.h:233
Category GetCategory() const
Definition: logger_message.h:221
void SetTime()
Definition: logger_message.h:237
Category
Definition: logger_message.h:72
LoggerMessage & operator=(LoggerMessage const &Other)
Definition: logger_message.h:156
bool IsDistributed() const
Definition: logger_message.h:225
TimePointType const & GetTime() const
Definition: logger_message.h:241
void SetLabel(std::string const &TheLabel)
Definition: logger_message.h:177
void SetSeverity(Severity const &TheSeverity)
Definition: logger_message.h:209
std::size_t GetLevel() const
Definition: logger_message.h:197
LoggerMessage(std::string const &TheLabel)
Definition: logger_message.h:142
void SetMessage(std::string const &TheMessage)
Definition: logger_message.h:185
Severity GetSeverity() const
Definition: logger_message.h:213
std::string const & GetMessage() const
Definition: logger_message.h:189
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432