Introduction
Introduction Statistics Contact Development Disclaimer Help
tpacking.c: fix particle count - granular - granular dynamics simulation
git clone git://src.adamsgaard.dk/granular
Log
Files
Refs
README
LICENSE
---
commit 500ff9f09f7696dfd10e1ac9dcb3d52ed232546b
parent 2c6179516d7ec6b2bf3cb18b7c962c884270e2d4
Author: Anders Damsgaard <[email protected]>
Date: Fri, 19 Mar 2021 13:05:07 +0100
packing.c: fix particle count
Diffstat:
M packing.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/packing.c b/packing.c
t@@ -5,8 +5,6 @@
#include "grain.h"
#include "arrays.h"
-#define VERBOSE
-
size_t
rectangular_packing(struct grain *grains[],
size_t n[3],
t@@ -15,7 +13,7 @@ rectangular_packing(struct grain *grains[],
double padding_factor,
double origo[3])
{
- size_t i, j, k, l, np = 0;
+ size_t i, j, k, l, np, N = 0;
double dx_padding = radius_max * 2.0 * padding_factor;
double dx = radius_max * 2.0 + dx_padding;
t@@ -23,13 +21,13 @@ rectangular_packing(struct grain *grains[],
errx(1, "%s: radius_max (%g) is smaller than radius_min (%g)",
__func__, radius_max, radius_min);
- printf("sizeof(*grains) = %ld\n", sizeof(struct grain));
if (!(*grains = calloc(n[0] * n[1] * n[2], sizeof(struct grain))))
err(1, "%s: grains calloc", __func__);
for (k = 0; k < n[2]; k++)
for (j = 0; j < n[1]; j++)
for (i = 0; i < n[0]; i++) {
+ N++;
np = idx3(i, j, k, n[0], n[1]);
grain_defaults(&(*grains)[np]);
(*grains)[np].radius = gsd(radius_min, radius_…
t@@ -45,5 +43,5 @@ rectangular_packing(struct grain *grains[],
#endif
}
- return np;
+ return N;
}
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.