stardis-solver

Solve coupled heat transfers
git clone git://git.meso-star.fr/stardis-solver.git
Log | Files | Refs | README | LICENSE

commit 9b67e3265924368982ef4f99e100f8c03db2c83c
parent 1f6e57c8243eef10c5d28eaba662169b69cd4b0c
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Mon, 29 Nov 2021 14:29:53 +0100

Add the sdis_device_get_mpi_rank function

Diffstat:
Msrc/sdis.h | 5+++++
Msrc/sdis_device.c | 15+++++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/src/sdis.h b/src/sdis.h @@ -643,6 +643,11 @@ SDIS_API res_T sdis_device_ref_put (struct sdis_device* dev); +SDIS_API res_T +sdis_device_get_mpi_rank + (struct sdis_device* dev, + int* rank); + /******************************************************************************* * A data stores in the Stardis memory space a set of user defined data. It can * be seen as a ref counted memory space allocated by Stardis. It is used to diff --git a/src/sdis_device.c b/src/sdis_device.c @@ -369,6 +369,21 @@ sdis_device_ref_put(struct sdis_device* dev) return RES_OK; } +res_T +sdis_device_get_mpi_rank(struct sdis_device* dev, int* rank) +{ +#ifndef SDIS_ENABLE_MPI + (void)dev, (void)rank; + return RES_BAD_OP; +#else + if(!dev || !rank) return RES_BAD_ARG; + if(!dev->use_mpi) return RES_BAD_OP; + ASSERT(dev->mpi_rank >= 0); + *rank = dev->mpi_rank; + return RES_OK; +#endif +} + /******************************************************************************* * Local functions ******************************************************************************/