Introduction
Introduction Statistics Contact Development Disclaimer Help
tgranularpacking: add options for padding and grain size, fix n types - granula…
git clone git://src.adamsgaard.dk/granular
Log
Files
Refs
README
LICENSE
---
commit b24ca7409f3bc811c3a2240d3d8261e2c060d557
parent 7d7ae93157bd64531fa0ad995af60b9cd11556c5
Author: Anders Damsgaard <[email protected]>
Date: Thu, 25 Mar 2021 14:25:40 +0100
granularpacking: add options for padding and grain size, fix n types
Diffstat:
M granularpacking.1 | 9 +++++++++
M granularpacking.c | 27 ++++++++++++++++++++-------
2 files changed, 29 insertions(+), 7 deletions(-)
---
diff --git a/granularpacking.1 b/granularpacking.1
t@@ -7,6 +7,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl h
+.Op Fl t
.Op Fl X Ar x-offset
.Op Fl x Ar nx
.Op Fl Y Ar y-offset
t@@ -25,6 +26,14 @@ The options are as wollows:
.Bl -tag -width Ds
.It Fl h
Show help text.
+.It Fl t
+Generate triangular packing (default: rectangular).
+.It Fl p Ar padding-factor
+Add padding between grains and add corresponding random variation to placement…
+.It Fl R Ar max-radius
+Specify maximum radius of generated grains (default 1.0).
+.It Fl r Ar min-radius
+Specify minimum radius of generated grains (default 1.0).
.It Fl X Ar x-offset
Add the specified offset to all output x positions (default 0.0).
.It Fl x Ar nx
diff --git a/granularpacking.c b/granularpacking.c
t@@ -14,6 +14,8 @@ static void
usage(void)
{
errx(1, "usage: %s [-ht] "
+ "[-R max-radius] "
+ "[-r min-radius] "
"[-X x-offset] "
"[-x nx] "
"[-Y y-offset] "
t@@ -28,6 +30,8 @@ main(int argc, char *argv[])
size_t n[3], np = 0;
n[0] = 10; n[1] = 10; n[2] = 1;
double *origo = zeros(3);
+ double padding = 0.0;
+ double r_max = 1.0, r_min = 1.0;
struct simulation sim = sim_new();
int packing = 0;
t@@ -38,23 +42,32 @@ main(int argc, char *argv[])
case 't':
packing = 1;
break;
+ case 'p':
+ padding = atof(EARGF(usage()));
+ break;
+ case 'R':
+ r_max = atof(EARGF(usage()));
+ break;
+ case 'r':
+ r_min = atof(EARGF(usage()));
+ break;
case 'X':
origo[0] = atof(EARGF(usage()));
break;
case 'x':
- n[0] = atof(EARGF(usage()));
+ n[0] = atoi(EARGF(usage()));
break;
case 'Y':
origo[1] = atof(EARGF(usage()));
break;
case 'y':
- n[1] = atof(EARGF(usage()));
+ n[1] = atoi(EARGF(usage()));
break;
case 'Z':
origo[2] = atof(EARGF(usage()));
break;
case 'z':
- n[2] = atof(EARGF(usage()));
+ n[2] = atoi(EARGF(usage()));
break;
default:
usage();
t@@ -65,12 +78,12 @@ main(int argc, char *argv[])
switch (packing) {
case 0:
- np = rectangular_packing(&sim.grains, n, 1.0, 1.0,
- random_value_uniform, 0.0, &origo);
+ np = rectangular_packing(&sim.grains, n, r_min, r_max,
+ random_value_uniform, padding, &origo…
break;
case 1:
- np = triangular_packing(&sim.grains, n, 1.0, 1.0,
- random_value_uniform, 0.0, &origo);
+ np = triangular_packing(&sim.grains, n, r_min, r_max,
+ random_value_uniform, padding, &origo);
break;
default:
errx(1, "unknown packing mode");
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.