atrstm

Load and structure a combustion gas mixture
git clone git://git.meso-star.fr/atrstm.git
Log | Files | Refs | README | LICENSE

commit 99695f0dfddef2187f5c78db6d80539aff4ecaca
parent 08c2a914e1d5d1298fb91dc4cb828efa98cbc553
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed, 20 Jan 2021 17:21:56 +0100

Make configurable the #parts managed by a pool

Diffstat:
Msrc/atrstm_partition.c | 11++++++-----
Msrc/atrstm_partition.h | 4+---
2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/atrstm_partition.c b/src/atrstm_partition.c @@ -24,13 +24,14 @@ * Local functions ******************************************************************************/ res_T -pool_init(struct mem_allocator* mem_allocator, struct pool* pool) +pool_init + (struct mem_allocator* mem_allocator, + const size_t nparts, + struct pool* pool) { - STATIC_ASSERT(POOL_MAX_NPARTITIONS > 0, - Unexpected_value_of_POOL_MAX_NPARTITIONS); size_t ipart; res_T res = RES_OK; - ASSERT(pool); + ASSERT(pool && nparts); memset(pool, 0, sizeof(*pool)); @@ -45,7 +46,7 @@ pool_init(struct mem_allocator* mem_allocator, struct pool* pool) pool->cond_fetch = cond_create(); if(!pool->cond_fetch) { res = RES_UNKNOWN_ERR; goto error; } - FOR_EACH(ipart, 0, POOL_MAX_NPARTITIONS) { + FOR_EACH(ipart, 0, nparts) { struct part* part = MEM_ALLOC_ALIGNED(pool->allocator, sizeof(*part), 64); if(!part) { res = RES_MEM_ERR; diff --git a/src/atrstm_partition.h b/src/atrstm_partition.h @@ -28,9 +28,6 @@ * PARTITION_DEFINITION \ * PARTITION_DEFINITION) -/* Max #partitions stored into the partition pool */ -#define POOL_MAX_NPARTITIONS 16 - /* Forward declarations */ struct cond; struct mem_allocator; @@ -96,6 +93,7 @@ part_clear_voxels(struct part* part) extern LOCAL_SYM res_T pool_init (struct mem_allocator* allocator, /* May be NULL <=> default allocator */ + const size_t npartitions, /* #partitions managed by the pool */ struct pool* pool); extern LOCAL_SYM void