Commit c1f07405 authored by Chris Cantwell's avatar Chris Cantwell

Added StateAdd and StateGet functions for NekDouble value.

parent 697541fc
...@@ -149,8 +149,10 @@ public: ...@@ -149,8 +149,10 @@ public:
LIB_UTILITIES_EXPORT inline bool IsRecovering(); LIB_UTILITIES_EXPORT inline bool IsRecovering();
LIB_UTILITIES_EXPORT inline void StateAdd(const std::string& name, const int& data); LIB_UTILITIES_EXPORT inline void StateAdd(const std::string& name, const int& data);
LIB_UTILITIES_EXPORT inline void StateAdd(const std::string& name, const NekDouble& data);
LIB_UTILITIES_EXPORT inline void StateAdd(const std::string& name, const NekDouble* data, const int n); LIB_UTILITIES_EXPORT inline void StateAdd(const std::string& name, const NekDouble* data, const int n);
LIB_UTILITIES_EXPORT inline void StateGet(const std::string& name, int& data); LIB_UTILITIES_EXPORT inline void StateGet(const std::string& name, int& data);
LIB_UTILITIES_EXPORT inline void StateGet(const std::string& name, NekDouble& data);
LIB_UTILITIES_EXPORT inline void StateGet(const std::string& name, NekDouble* data, const int n); LIB_UTILITIES_EXPORT inline void StateGet(const std::string& name, NekDouble* data, const int n);
LIB_UTILITIES_EXPORT inline void StateCommit(); LIB_UTILITIES_EXPORT inline void StateCommit();
LIB_UTILITIES_EXPORT inline void StateRestore(); LIB_UTILITIES_EXPORT inline void StateRestore();
...@@ -219,8 +221,10 @@ protected: ...@@ -219,8 +221,10 @@ protected:
virtual bool v_IsRecovering() { return false; } virtual bool v_IsRecovering() { return false; }
virtual void v_StateAdd(const std::string& name, const int& data) {} virtual void v_StateAdd(const std::string& name, const int& data) {}
virtual void v_StateAdd(const std::string& name, const NekDouble& data) {}
virtual void v_StateAdd(const std::string& name, const NekDouble* data, const int n) {} virtual void v_StateAdd(const std::string& name, const NekDouble* data, const int n) {}
virtual void v_StateGet(const std::string& name, int& data) {} virtual void v_StateGet(const std::string& name, int& data) {}
virtual void v_StateGet(const std::string& name, NekDouble& data) {}
virtual void v_StateGet(const std::string& name, NekDouble* data, const int n) {} virtual void v_StateGet(const std::string& name, NekDouble* data, const int n) {}
virtual void v_StateCommit() {} virtual void v_StateCommit() {}
virtual void v_StateRestore() {} virtual void v_StateRestore() {}
...@@ -562,6 +566,11 @@ inline void Comm::StateAdd(const std::string& name, const int& data) ...@@ -562,6 +566,11 @@ inline void Comm::StateAdd(const std::string& name, const int& data)
v_StateAdd(name, data); v_StateAdd(name, data);
} }
inline void Comm::StateAdd(const std::string& name, const NekDouble& data)
{
v_StateAdd(name, data);
}
inline void Comm::StateAdd(const std::string& name, const NekDouble* data, const int n) inline void Comm::StateAdd(const std::string& name, const NekDouble* data, const int n)
{ {
v_StateAdd(name, data, n); v_StateAdd(name, data, n);
...@@ -572,6 +581,11 @@ inline void Comm::StateGet(const std::string& name, int& data) ...@@ -572,6 +581,11 @@ inline void Comm::StateGet(const std::string& name, int& data)
v_StateGet(name, data); v_StateGet(name, data);
} }
inline void Comm::StateGet(const std::string& name, NekDouble& data)
{
v_StateGet(name, data);
}
inline void Comm::StateGet(const std::string& name, NekDouble* data, const int n) inline void Comm::StateGet(const std::string& name, NekDouble* data, const int n)
{ {
v_StateGet(name, data, n); v_StateGet(name, data, n);
......
...@@ -596,7 +596,6 @@ cout << "GsGather: Recover " << count << " values." << endl; ...@@ -596,7 +596,6 @@ cout << "GsGather: Recover " << count << " values." << endl;
} }
else else
{ {
cout << "Performing GS Gather operation." << endl;
Gs::Gather(pU, pOp, m_gsHandles[pGsh], pBuffer); Gs::Gather(pU, pOp, m_gsHandles[pGsh], pBuffer);
if (m_isLogging) if (m_isLogging)
...@@ -1114,6 +1113,14 @@ void CommMpi::v_StateAdd(const std::string& name, const int& data) ...@@ -1114,6 +1113,14 @@ void CommMpi::v_StateAdd(const std::string& name, const int& data)
m_stateData[name] = x; m_stateData[name] = x;
} }
void CommMpi::v_StateAdd(const std::string& name, const NekDouble& data)
{
std::vector<char> x;
int dtsize = sizeof(NekDouble);
x.assign((char*)(&data), (char*)(&data)+dtsize);
m_stateData[name] = x;
}
void CommMpi::v_StateAdd(const std::string& name, const NekDouble* data, const int n) void CommMpi::v_StateAdd(const std::string& name, const NekDouble* data, const int n)
{ {
std::vector<char> x; std::vector<char> x;
...@@ -1131,6 +1138,15 @@ void CommMpi::v_StateGet(const std::string& name, int& data) ...@@ -1131,6 +1138,15 @@ void CommMpi::v_StateGet(const std::string& name, int& data)
memcpy(&data, &x[0], sizeof(int)); memcpy(&data, &x[0], sizeof(int));
} }
void CommMpi::v_StateGet(const std::string& name, NekDouble& data)
{
ASSERTL0(m_stateData.count(name), "STATE ITEM DOES NOT EXIST!!");
std::vector<char> x = m_stateData[name];
memcpy(&data, &x[0], sizeof(NekDouble));
}
void CommMpi::v_StateGet(const std::string& name, NekDouble* data, const int n) void CommMpi::v_StateGet(const std::string& name, NekDouble* data, const int n)
{ {
ASSERTL0(m_stateData.count(name), "STATE ITEM DOES NOT EXIST!!"); ASSERTL0(m_stateData.count(name), "STATE ITEM DOES NOT EXIST!!");
......
...@@ -151,8 +151,10 @@ protected: ...@@ -151,8 +151,10 @@ protected:
virtual bool v_IsRecovering(); virtual bool v_IsRecovering();
virtual void v_StateAdd(const std::string& name, const int& data); virtual void v_StateAdd(const std::string& name, const int& data);
virtual void v_StateAdd(const std::string& name, const NekDouble& data);
virtual void v_StateAdd(const std::string& name, const NekDouble* data, const int n); virtual void v_StateAdd(const std::string& name, const NekDouble* data, const int n);
virtual void v_StateGet(const std::string& name, int& data); virtual void v_StateGet(const std::string& name, int& data);
virtual void v_StateGet(const std::string& name, NekDouble& data);
virtual void v_StateGet(const std::string& name, NekDouble* data, const int n); virtual void v_StateGet(const std::string& name, NekDouble* data, const int n);
virtual void v_StateCommit(); virtual void v_StateCommit();
virtual void v_StateRestore(); virtual void v_StateRestore();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment