Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Nektar::LibUtilities::Comm Class Reference

Base communications class. More...

#include <Comm.h>

Inheritance diagram for Nektar::LibUtilities::Comm:
Inheritance graph
[legend]
Collaboration diagram for Nektar::LibUtilities::Comm:
Collaboration graph
[legend]

Public Member Functions

 Comm (int narg, char *arg[])
virtual ~Comm ()
void Finalise ()
int GetSize ()
 Returns number of processes.
int GetRank ()
const std::string & GetType () const
void Block ()
 Block execution until all processes reach this point.
void Send (int pProc, Array< OneD, NekDouble > &pData)
void Send (int pProc, Array< OneD, int > &pData)
void Send (int pProc, std::vector< unsigned int > &pData)
void Recv (int pProc, Array< OneD, NekDouble > &pData)
void Recv (int pProc, Array< OneD, int > &pData)
void Recv (int pProc, std::vector< unsigned int > &pData)
void SendRecv (int pSendProc, Array< OneD, NekDouble > &pSendData, int pRecvProc, Array< OneD, NekDouble > &pRecvData)
void SendRecv (int pSendProc, Array< OneD, int > &pSendData, int pRecvProc, Array< OneD, int > &pRecvData)
void SendRecvReplace (int pSendProc, int pRecvProc, Array< OneD, NekDouble > &pSendData)
void SendRecvReplace (int pSendProc, int pRecvProc, Array< OneD, int > &pSendData)
void AllReduce (NekDouble &pData, enum ReduceOperator pOp)
void AllReduce (int &pData, enum ReduceOperator pOp)
void AllReduce (Array< OneD, NekDouble > &pData, enum ReduceOperator pOp)
void AllReduce (Array< OneD, int > &pData, enum ReduceOperator pOp)
void AllReduce (std::vector< unsigned int > &pData, enum ReduceOperator pOp)
void AlltoAll (Array< OneD, NekDouble > &pSendData, Array< OneD, NekDouble > &pRecvData)
void AlltoAll (Array< OneD, int > &pSendData, Array< OneD, int > &pRecvData)
void AlltoAllv (Array< OneD, NekDouble > &pSendData, Array< OneD, int > &pSendDataSizeMap, Array< OneD, int > &pSendDataOffsetMap, Array< OneD, NekDouble > &pRecvData, Array< OneD, int > &pRecvDataSizeMap, Array< OneD, int > &pRecvDataOffsetMap)
void AlltoAllv (Array< OneD, int > &pSendData, Array< OneD, int > &pSendDataSizeMap, Array< OneD, int > &pSendDataOffsetMap, Array< OneD, int > &pRecvData, Array< OneD, int > &pRecvDataSizeMap, Array< OneD, int > &pRecvDataOffsetMap)
void SplitComm (int pRows, int pColumns)
 Splits this communicator into a grid of size pRows*pColumns and creates row and column communicators. By default the communicator is a single row.
CommSharedPtr GetRowComm ()
 Retrieve the row communicator to which this process belongs.
CommSharedPtr GetColumnComm ()
 Retrieve the column communicator to which this process belongs.
bool TreatAsRankZero (void)
bool RemoveExistingFiles (void)

Protected Member Functions

 Comm ()
virtual void v_Finalise ()=0
virtual int v_GetRank ()=0
virtual void v_Block ()=0
virtual void v_Send (int pProc, Array< OneD, NekDouble > &pData)=0
virtual void v_Send (int pProc, Array< OneD, int > &pData)=0
virtual void v_Send (int pProc, std::vector< unsigned int > &pData)=0
virtual void v_Recv (int pProc, Array< OneD, NekDouble > &pData)=0
virtual void v_Recv (int pProc, Array< OneD, int > &pData)=0
virtual void v_Recv (int pProc, std::vector< unsigned int > &pData)=0
virtual void v_SendRecv (int pSendProc, Array< OneD, NekDouble > &pSendData, int pRecvProc, Array< OneD, NekDouble > &pRecvData)=0
virtual void v_SendRecv (int pSendProc, Array< OneD, int > &pSendData, int pRecvProc, Array< OneD, int > &pRecvData)=0
virtual void v_SendRecvReplace (int pSendProc, int pRecvProc, Array< OneD, NekDouble > &pSendData)=0
virtual void v_SendRecvReplace (int pSendProc, int pRecvProc, Array< OneD, int > &pSendData)=0
virtual void v_AllReduce (NekDouble &pData, enum ReduceOperator pOp)=0
virtual void v_AllReduce (int &pData, enum ReduceOperator pOp)=0
virtual void v_AllReduce (Array< OneD, NekDouble > &pData, enum ReduceOperator pOp)=0
virtual void v_AllReduce (Array< OneD, int > &pData, enum ReduceOperator pOp)=0
virtual void v_AllReduce (std::vector< unsigned int > &pData, enum ReduceOperator pOp)=0
virtual void v_AlltoAll (Array< OneD, NekDouble > &pSendData, Array< OneD, NekDouble > &pRecvData)=0
virtual void v_AlltoAll (Array< OneD, int > &pSendData, Array< OneD, int > &pRecvData)=0
virtual void v_AlltoAllv (Array< OneD, NekDouble > &pSendData, Array< OneD, int > &pSendDataSizeMap, Array< OneD, int > &pSendDataOffsetMap, Array< OneD, NekDouble > &pRecvData, Array< OneD, int > &pRecvDataSizeMap, Array< OneD, int > &pRecvDataOffsetMap)=0
virtual void v_AlltoAllv (Array< OneD, int > &pSendData, Array< OneD, int > &pSendDataSizeMap, Array< OneD, int > &pSendDataOffsetMap, Array< OneD, int > &pRecvData, Array< OneD, int > &pRecvDataSizeMap, Array< OneD, int > &pRecvDataOffsetMap)=0
virtual void v_SplitComm (int pRows, int pColumns)=0
virtual bool v_TreatAsRankZero (void)=0
virtual bool v_RemoveExistingFiles (void)

Protected Attributes

int m_size
 Number of processes.
std::string m_type
 Type of communication.
CommSharedPtr m_commRow
 Row communicator.
CommSharedPtr m_commColumn
 Column communicator.

Detailed Description

Base communications class.

Definition at line 73 of file Comm.h.

Constructor & Destructor Documentation

Nektar::LibUtilities::Comm::Comm ( int  narg,
char *  arg[] 
)

Definition at line 43 of file Comm.cpp.

{
}
Nektar::LibUtilities::Comm::~Comm ( )
virtual

Definition at line 53 of file Comm.cpp.

{
}
Nektar::LibUtilities::Comm::Comm ( )
protected

Definition at line 48 of file Comm.cpp.

{
}

Member Function Documentation

void Nektar::LibUtilities::Comm::AllReduce ( NekDouble pData,
enum ReduceOperator  pOp 
)
inline

Definition at line 341 of file Comm.h.

References v_AllReduce().

{
v_AllReduce(pData, pOp);
}
void Nektar::LibUtilities::Comm::AllReduce ( int &  pData,
enum ReduceOperator  pOp 
)
inline

Definition at line 350 of file Comm.h.

References v_AllReduce().

{
v_AllReduce(pData, pOp);
}
void Nektar::LibUtilities::Comm::AllReduce ( Array< OneD, NekDouble > &  pData,
enum ReduceOperator  pOp 
)
inline

Definition at line 359 of file Comm.h.

References v_AllReduce().

{
v_AllReduce(pData, pOp);
}
void Nektar::LibUtilities::Comm::AllReduce ( Array< OneD, int > &  pData,
enum ReduceOperator  pOp 
)
inline

Definition at line 368 of file Comm.h.

References v_AllReduce().

{
v_AllReduce(pData, pOp);
}
void Nektar::LibUtilities::Comm::AllReduce ( std::vector< unsigned int > &  pData,
enum ReduceOperator  pOp 
)
inline

Definition at line 377 of file Comm.h.

References v_AllReduce().

{
v_AllReduce(pData, pOp);
}
void Nektar::LibUtilities::Comm::AlltoAll ( Array< OneD, NekDouble > &  pSendData,
Array< OneD, NekDouble > &  pRecvData 
)
inline

Definition at line 386 of file Comm.h.

References v_AlltoAll().

{
v_AlltoAll(pSendData,pRecvData);
}
void Nektar::LibUtilities::Comm::AlltoAll ( Array< OneD, int > &  pSendData,
Array< OneD, int > &  pRecvData 
)
inline

Definition at line 395 of file Comm.h.

References v_AlltoAll().

{
v_AlltoAll(pSendData,pRecvData);
}
void Nektar::LibUtilities::Comm::AlltoAllv ( Array< OneD, NekDouble > &  pSendData,
Array< OneD, int > &  pSendDataSizeMap,
Array< OneD, int > &  pSendDataOffsetMap,
Array< OneD, NekDouble > &  pRecvData,
Array< OneD, int > &  pRecvDataSizeMap,
Array< OneD, int > &  pRecvDataOffsetMap 
)
inline

Definition at line 404 of file Comm.h.

References v_AlltoAllv().

{
v_AlltoAllv(pSendData,pSendDataSizeMap,pSendDataOffsetMap,pRecvData,pRecvDataSizeMap,pRecvDataOffsetMap);
}
void Nektar::LibUtilities::Comm::AlltoAllv ( Array< OneD, int > &  pSendData,
Array< OneD, int > &  pSendDataSizeMap,
Array< OneD, int > &  pSendDataOffsetMap,
Array< OneD, int > &  pRecvData,
Array< OneD, int > &  pRecvDataSizeMap,
Array< OneD, int > &  pRecvDataOffsetMap 
)
inline

Definition at line 417 of file Comm.h.

References v_AlltoAllv().

{
v_AlltoAllv(pSendData,pSendDataSizeMap,pSendDataOffsetMap,pRecvData,pRecvDataSizeMap,pRecvDataOffsetMap);
}
void Nektar::LibUtilities::Comm::Block ( )
inline

Block execution until all processes reach this point.

Definition at line 239 of file Comm.h.

References v_Block().

{
}
void Nektar::LibUtilities::Comm::Finalise ( )
inline

Definition at line 207 of file Comm.h.

References v_Finalise().

{
}
CommSharedPtr Nektar::LibUtilities::Comm::GetColumnComm ( )
inline

Retrieve the column communicator to which this process belongs.

Definition at line 459 of file Comm.h.

References m_commColumn.

{
if (!m_commColumn.get())
{
return shared_from_this();
}
else
{
return m_commColumn;
}
}
int Nektar::LibUtilities::Comm::GetRank ( )
inline

Definition at line 223 of file Comm.h.

References v_GetRank().

{
return v_GetRank();
}
CommSharedPtr Nektar::LibUtilities::Comm::GetRowComm ( )
inline

Retrieve the row communicator to which this process belongs.

Definition at line 442 of file Comm.h.

References m_commRow.

{
if (!m_commRow.get())
{
return shared_from_this();
}
else
{
return m_commRow;
}
}
int Nektar::LibUtilities::Comm::GetSize ( )
inline

Returns number of processes.

Definition at line 215 of file Comm.h.

References m_size.

Referenced by Nektar::LibUtilities::CommMpi::v_AllReduce(), and Nektar::LibUtilities::CommMpi::v_AlltoAll().

{
return m_size;
}
const std::string & Nektar::LibUtilities::Comm::GetType ( ) const
inline

Definition at line 231 of file Comm.h.

References m_type.

{
return m_type;
}
void Nektar::LibUtilities::Comm::Recv ( int  pProc,
Array< OneD, NekDouble > &  pData 
)
inline

Definition at line 255 of file Comm.h.

References v_Recv().

{
v_Recv(pProc, pData);
}
void Nektar::LibUtilities::Comm::Recv ( int  pProc,
Array< OneD, int > &  pData 
)
inline

Definition at line 272 of file Comm.h.

References v_Recv().

{
v_Recv(pProc, pData);
}
void Nektar::LibUtilities::Comm::Recv ( int  pProc,
std::vector< unsigned int > &  pData 
)
inline

Definition at line 288 of file Comm.h.

References v_Recv().

{
v_Recv(pProc, pData);
}
bool Nektar::LibUtilities::Comm::RemoveExistingFiles ( void  )
inline

Definition at line 476 of file Comm.h.

References v_RemoveExistingFiles().

{
}
void Nektar::LibUtilities::Comm::Send ( int  pProc,
Array< OneD, NekDouble > &  pData 
)
inline

Definition at line 247 of file Comm.h.

References v_Send().

{
v_Send(pProc, pData);
}
void Nektar::LibUtilities::Comm::Send ( int  pProc,
Array< OneD, int > &  pData 
)
inline

Definition at line 264 of file Comm.h.

References v_Send().

{
v_Send(pProc, pData);
}
void Nektar::LibUtilities::Comm::Send ( int  pProc,
std::vector< unsigned int > &  pData 
)
inline

Definition at line 280 of file Comm.h.

References v_Send().

{
v_Send(pProc, pData);
}
void Nektar::LibUtilities::Comm::SendRecv ( int  pSendProc,
Array< OneD, NekDouble > &  pSendData,
int  pRecvProc,
Array< OneD, NekDouble > &  pRecvData 
)
inline

Definition at line 296 of file Comm.h.

References v_SendRecv().

{
v_SendRecv(pSendProc, pSendData, pRecvProc, pRecvData);
}
void Nektar::LibUtilities::Comm::SendRecv ( int  pSendProc,
Array< OneD, int > &  pSendData,
int  pRecvProc,
Array< OneD, int > &  pRecvData 
)
inline

Definition at line 308 of file Comm.h.

References v_SendRecv().

{
v_SendRecv(pSendProc, pSendData, pRecvProc, pRecvData);
}
void Nektar::LibUtilities::Comm::SendRecvReplace ( int  pSendProc,
int  pRecvProc,
Array< OneD, NekDouble > &  pSendData 
)
inline

Definition at line 319 of file Comm.h.

References v_SendRecvReplace().

{
v_SendRecvReplace(pSendProc,pRecvProc,pSendData);
}
void Nektar::LibUtilities::Comm::SendRecvReplace ( int  pSendProc,
int  pRecvProc,
Array< OneD, int > &  pSendData 
)
inline

Definition at line 330 of file Comm.h.

References v_SendRecvReplace().

{
v_SendRecvReplace(pSendProc,pRecvProc,pSendData);
}
void Nektar::LibUtilities::Comm::SplitComm ( int  pRows,
int  pColumns 
)
inline

Splits this communicator into a grid of size pRows*pColumns and creates row and column communicators. By default the communicator is a single row.

Definition at line 433 of file Comm.h.

References v_SplitComm().

{
v_SplitComm(pRows, pColumns);
}
bool Nektar::LibUtilities::Comm::TreatAsRankZero ( void  )
inline

Definition at line 471 of file Comm.h.

References v_TreatAsRankZero().

{
}
virtual void Nektar::LibUtilities::Comm::v_AllReduce ( NekDouble pData,
enum ReduceOperator  pOp 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_AllReduce ( int &  pData,
enum ReduceOperator  pOp 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_AllReduce ( Array< OneD, NekDouble > &  pData,
enum ReduceOperator  pOp 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_AllReduce ( Array< OneD, int > &  pData,
enum ReduceOperator  pOp 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_AllReduce ( std::vector< unsigned int > &  pData,
enum ReduceOperator  pOp 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_AlltoAll ( Array< OneD, NekDouble > &  pSendData,
Array< OneD, NekDouble > &  pRecvData 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_AlltoAll ( Array< OneD, int > &  pSendData,
Array< OneD, int > &  pRecvData 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_AlltoAllv ( Array< OneD, NekDouble > &  pSendData,
Array< OneD, int > &  pSendDataSizeMap,
Array< OneD, int > &  pSendDataOffsetMap,
Array< OneD, NekDouble > &  pRecvData,
Array< OneD, int > &  pRecvDataSizeMap,
Array< OneD, int > &  pRecvDataOffsetMap 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_AlltoAllv ( Array< OneD, int > &  pSendData,
Array< OneD, int > &  pSendDataSizeMap,
Array< OneD, int > &  pSendDataOffsetMap,
Array< OneD, int > &  pRecvData,
Array< OneD, int > &  pRecvDataSizeMap,
Array< OneD, int > &  pRecvDataOffsetMap 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_Block ( )
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_Finalise ( )
protectedpure virtual
virtual int Nektar::LibUtilities::Comm::v_GetRank ( )
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_Recv ( int  pProc,
Array< OneD, NekDouble > &  pData 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_Recv ( int  pProc,
Array< OneD, int > &  pData 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_Recv ( int  pProc,
std::vector< unsigned int > &  pData 
)
protectedpure virtual
bool Nektar::LibUtilities::Comm::v_RemoveExistingFiles ( void  )
protectedvirtual

Reimplemented in Nektar::Utilities::FieldConvertComm.

Definition at line 59 of file Comm.cpp.

Referenced by RemoveExistingFiles().

{
return true;
}
virtual void Nektar::LibUtilities::Comm::v_Send ( int  pProc,
Array< OneD, NekDouble > &  pData 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_Send ( int  pProc,
Array< OneD, int > &  pData 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_Send ( int  pProc,
std::vector< unsigned int > &  pData 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_SendRecv ( int  pSendProc,
Array< OneD, NekDouble > &  pSendData,
int  pRecvProc,
Array< OneD, NekDouble > &  pRecvData 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_SendRecv ( int  pSendProc,
Array< OneD, int > &  pSendData,
int  pRecvProc,
Array< OneD, int > &  pRecvData 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_SendRecvReplace ( int  pSendProc,
int  pRecvProc,
Array< OneD, NekDouble > &  pSendData 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_SendRecvReplace ( int  pSendProc,
int  pRecvProc,
Array< OneD, int > &  pSendData 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_SplitComm ( int  pRows,
int  pColumns 
)
protectedpure virtual
virtual bool Nektar::LibUtilities::Comm::v_TreatAsRankZero ( void  )
protectedpure virtual

Member Data Documentation

CommSharedPtr Nektar::LibUtilities::Comm::m_commColumn
protected

Column communicator.

Definition at line 145 of file Comm.h.

Referenced by GetColumnComm(), and Nektar::LibUtilities::CommMpi::v_SplitComm().

CommSharedPtr Nektar::LibUtilities::Comm::m_commRow
protected

Row communicator.

Definition at line 144 of file Comm.h.

Referenced by GetRowComm(), and Nektar::LibUtilities::CommMpi::v_SplitComm().

int Nektar::LibUtilities::Comm::m_size
protected
std::string Nektar::LibUtilities::Comm::m_type
protected

Type of communication.

Definition at line 143 of file Comm.h.

Referenced by Nektar::LibUtilities::CommMpi::CommMpi(), Nektar::LibUtilities::CommSerial::CommSerial(), and GetType().