35#ifndef NEKTAR_LIB_UTILITIES_COMMUNICATION_GSLIB_HPP
36#define NEKTAR_LIB_UTILITIES_COMMUNICATION_GSLIB_HPP
108 const unsigned int *map[2];
117 unsigned int size_sk,
size_s, size_total;
131 const unsigned int *map_to_buf[2], *map_from_buf[2];
136 gs_op op,
unsigned transpose,
const void *execdata,
137 const struct comm *
comm,
char *buf);
151 const unsigned int *map_local[2];
170 const struct comm *
comm,
int unique,
193 [[maybe_unused]]
bool verbose =
true)
196 if (pComm->IsSerial())
201 std::dynamic_pointer_cast<LibUtilities::CommMpi>(pComm);
202 ASSERTL1(vCommMpi,
"Failed to cast MPI Comm object.");
204 MPI_Comm_dup(vCommMpi->GetComm(), &vComm.
c);
205 vComm.
id = vCommMpi->GetRank();
206 vComm.
np = vCommMpi->GetSize();
209 MPI_Comm_free(&vComm.
c);
230 if (pComm->IsSerial())
235 std::dynamic_pointer_cast<LibUtilities::CommMpi>(pComm);
236 ASSERTL1(vCommMpi,
"Failed to cast MPI Comm object.");
238 vComm.
c = vCommMpi->GetComm();
239 vComm.
id = vCommMpi->GetRank();
240 vComm.
np = vCommMpi->GetSize();
252 MPI_Finalized(&finalized);
253 if (pGsh && !finalized)
279 [[maybe_unused]]
gs_op pOp,
280 [[maybe_unused]]
gs_data *pGsh,
289 if (pBuffer.size() == 0)
296 buf.ptr = &pBuffer[0];
297 buf.n = pBuffer.size();
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
gs_data * nektar_gs_setup(const long *id, unsigned int n, const struct comm *comm, int unique, gs_method method, int verbose)
static void Gather(Nektar::Array< OneD, NekDouble > pU, gs_op pOp, gs_data *pGsh, Nektar::Array< OneD, NekDouble > pBuffer=NullNekDouble1DArray)
Performs a gather-scatter operation of the provided values.
static gs_data * Init(const Nektar::Array< OneD, long > pId, const LibUtilities::CommSharedPtr &pComm, bool verbose=true)
Initialise Gather-Scatter map.
static void Finalise(gs_data *pGsh)
Deallocates the GSLib mapping data.
static void Free(gs_data *pGsh)
Deallocates GSLib mapping data without finalising MPI.
void nektar_gs_unique(const long *id, unsigned int n, const struct comm *comm)
void nektar_gs(void *u, gs_dom dom, gs_op op, unsigned transpose, gs_data *gsh, buffer *buf)
void exec_fun(void *data, gs_mode mode, unsigned vn, gs_dom dom, gs_op op, unsigned transpose, const void *execdata, const struct comm *comm, char *buf)
static void Unique(const Nektar::Array< OneD, long > pId, const LibUtilities::CommSharedPtr &pComm)
Updates pId to negate all-but-one references to each universal ID.
void nektar_gs_free(gs_data *gsh)
std::shared_ptr< CommMpi > CommMpiSharedPtr
Pointer to a Communicator object.
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
static Array< OneD, NekDouble > NullNekDouble1DArray
const unsigned int * gather_map
const unsigned int * flagged_primaries