Skip to content
Snippets Groups Projects
Commit 58229b01 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Add messenger instance access

Also add commRank and commSize access functions
parent c0f6a01e
No related branches found
No related tags found
1 merge request!11Feature/mpi
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define MESSENGER_HPP #define MESSENGER_HPP
#include <PastisMacros.hpp> #include <PastisMacros.hpp>
#include <PastisAssert.hpp>
class Messenger class Messenger
{ {
...@@ -15,6 +16,13 @@ class Messenger ...@@ -15,6 +16,13 @@ class Messenger
static void create(int& argc, char* argv[]); static void create(int& argc, char* argv[]);
static void destroy(); static void destroy();
PASTIS_INLINE
static Messenger& getInstance()
{
Assert(m_instance != nullptr);
return *m_instance;
}
PASTIS_INLINE PASTIS_INLINE
const int& rank() const const int& rank() const
{ {
...@@ -31,4 +39,25 @@ class Messenger ...@@ -31,4 +39,25 @@ class Messenger
~Messenger(); ~Messenger();
}; };
PASTIS_INLINE
const Messenger& messenger()
{
return Messenger::getInstance();
}
[[deprecated("use better name")]]
PASTIS_INLINE
const int& commRank()
{
return messenger().rank();
}
[[deprecated("use better name")]]
PASTIS_INLINE
const int& commSize()
{
return messenger().size();
}
#endif // MESSENGER_HPP #endif // MESSENGER_HPP
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment