Skip to content
Snippets Groups Projects
Verified Commit 3e1ae396 authored by raphael.bach's avatar raphael.bach
Browse files

Change `data` member of `struct fmpi_domain` to a pointer

parent fe5f2420
No related branches found
No related tags found
No related merge requests found
...@@ -42,7 +42,7 @@ struct fmpi_ctx; ...@@ -42,7 +42,7 @@ struct fmpi_ctx;
* TODO * TODO
*/ */
typedef struct fmpi_domain { typedef struct fmpi_domain {
struct fmpi_data data; //!< Data composing the domain. const struct fmpi_data * data; //!< Data composing the domain.
struct fmpi_data * parts; //!< Partitions of the domain after decomposition. struct fmpi_data * parts; //!< Partitions of the domain after decomposition.
size_t part_cnt; //!< Number of partitions. size_t part_cnt; //!< Number of partitions.
} fmpi_domain; } fmpi_domain;
...@@ -52,7 +52,9 @@ typedef struct fmpi_domain { ...@@ -52,7 +52,9 @@ typedef struct fmpi_domain {
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
fmpi_new_domain() fmpi_new_domain()
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
struct fmpi_domain fmpi_new_domain(const struct fmpi_ctx * ctx, struct fmpi_data data); struct fmpi_domain fmpi_new_domain(
const struct fmpi_ctx * ctx, const struct fmpi_data * data
);
/*============================================================================== /*==============================================================================
GUARD GUARD
==============================================================================*/ ==============================================================================*/
......
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
#include "fmpi_domain.h" #include "fmpi_domain.h"
// C Standard Library // C Standard Library
#include <assert.h> #include <assert.h>
#include <stdlib.h> // size_t, NULL, malloc() #include <stdlib.h> // size_t, NULL, malloc(), free()
#include <string.h> // memcpy()
// Internal // Internal
#include "fmpi_data.h" #include "fmpi_data.h"
#include "internal/fmpi_ctx.h" #include "internal/fmpi_ctx.h"
...@@ -51,7 +52,7 @@ static struct fmpi_data * fmpi_partition_block_1d( ...@@ -51,7 +52,7 @@ static struct fmpi_data * fmpi_partition_block_1d(
fmpi_new_domain() fmpi_new_domain()
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
struct fmpi_domain fmpi_new_domain( struct fmpi_domain fmpi_new_domain(
const struct fmpi_ctx * const ctx, const struct fmpi_data data) const struct fmpi_ctx * const ctx, const struct fmpi_data * const data)
{ {
assert(ctx != NULL); assert(ctx != NULL);
const size_t proc_cnt = (size_t)ctx->mpi->size; const size_t proc_cnt = (size_t)ctx->mpi->size;
...@@ -60,7 +61,7 @@ struct fmpi_domain fmpi_new_domain( ...@@ -60,7 +61,7 @@ struct fmpi_domain fmpi_new_domain(
.parts = NULL, .parts = NULL,
.part_cnt = proc_cnt .part_cnt = proc_cnt
}; };
domain.parts = fmpi_partition_block_1d(ctx, &data); domain.parts = fmpi_partition_block_1d(ctx, data);
if(domain.parts == NULL) { if(domain.parts == NULL) {
FMPI_RAISE_ERROR(ctx->err_handler, "FMPI", "fmpi_partition_block_1d() failed!"); FMPI_RAISE_ERROR(ctx->err_handler, "FMPI", "fmpi_partition_block_1d() failed!");
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment