space is now Space_t
This commit is contained in:
parent
93adea1fa8
commit
2531db992a
|
@ -36,13 +36,29 @@ struct {
|
||||||
int z;
|
int z;
|
||||||
} typedef Arrow_t;
|
} typedef Arrow_t;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
size_t size;
|
||||||
|
Arrow_t *array;
|
||||||
|
} typedef ArrowArray_t;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
char *label;
|
||||||
|
int narrow;
|
||||||
|
} typedef Site_t;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
int nsite;
|
||||||
|
char *label;
|
||||||
|
Site_t *sites;
|
||||||
|
} typedef SpaceUnit_t;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
int xmax;
|
int xmax;
|
||||||
int ymax;
|
int ymax;
|
||||||
int zmax;
|
int zmax;
|
||||||
size_t size;
|
size_t size;
|
||||||
Arrow_t *space;
|
SpaceUnit_t *space;
|
||||||
} typedef ArrowArray_t; //XXX
|
} typedef Space_t;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
size_t size;
|
size_t size;
|
||||||
|
@ -59,7 +75,7 @@ struct {
|
||||||
//
|
//
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
ArrowArray_t *globalDrawingSpace;
|
Space_t *globalDrawingSpace;
|
||||||
IntArray_t *transitionsTree;
|
IntArray_t *transitionsTree;
|
||||||
ArrowArray_t *arrowList;
|
ArrowArray_t *arrowList;
|
||||||
int nmaxThread;
|
int nmaxThread;
|
||||||
|
|
12
src/main.c
12
src/main.c
|
@ -49,23 +49,23 @@ int main(int argc, char **argv)
|
||||||
scheduler0 = (Scheduler_t*) calloc(1, sizeof(Scheduler_t));
|
scheduler0 = (Scheduler_t*) calloc(1, sizeof(Scheduler_t));
|
||||||
|
|
||||||
scheduler0->globalDrawingSpace =
|
scheduler0->globalDrawingSpace =
|
||||||
(ArrowArray_t*) calloc(1, sizeof(ArrowArray_t));
|
(Space_t*) calloc(1, sizeof(Space_t));
|
||||||
scheduler0->globalDrawingSpace->space =
|
scheduler0->globalDrawingSpace->space =
|
||||||
(Arrow_t*) calloc(SPACE_SIZE, sizeof(Arrow_t));
|
(SpaceUnit_t*) calloc(SPACE_SIZE, sizeof(SpaceUnit_t));
|
||||||
scheduler0->globalDrawingSpace->size = SPACE_SIZE;
|
scheduler0->globalDrawingSpace->size = SPACE_SIZE;
|
||||||
|
|
||||||
scheduler0->arrowList = (ArrowArray_t*) calloc(1, sizeof(ArrowArray_t));
|
scheduler0->arrowList = (ArrowArray_t*) calloc(1, sizeof(ArrowArray_t));
|
||||||
scheduler0->arrowList->space =
|
scheduler0->arrowList->array =
|
||||||
(Arrow_t*) calloc(ARROW_NUMBER, sizeof(Arrow_t));
|
(Arrow_t*) calloc(ARROW_NUMBER, sizeof(Arrow_t));
|
||||||
scheduler0->arrowList->size = ARROW_NUMBER;
|
scheduler0->arrowList->size = ARROW_NUMBER;
|
||||||
|
|
||||||
printLog("Populating a random arrow list...\n");
|
printLog("Populating a random arrow list...\n");
|
||||||
for (int i = 0; i < ARROW_NUMBER; i++) {
|
for (int i = 0; i < ARROW_NUMBER; i++) {
|
||||||
scheduler0->arrowList->space[i].x =
|
scheduler0->arrowList->array[i].x =
|
||||||
rand() % scheduler0->globalDrawingSpace->xmax;
|
rand() % scheduler0->globalDrawingSpace->xmax;
|
||||||
scheduler0->arrowList->space[i].y =
|
scheduler0->arrowList->array[i].y =
|
||||||
rand() % scheduler0->globalDrawingSpace->ymax;
|
rand() % scheduler0->globalDrawingSpace->ymax;
|
||||||
scheduler0->arrowList->space[i].z =
|
scheduler0->arrowList->array[i].z =
|
||||||
rand() % scheduler0->globalDrawingSpace->zmax;
|
rand() % scheduler0->globalDrawingSpace->zmax;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,14 +116,14 @@ static void *schedulerMain(void *scheduler)
|
||||||
if (nworker < ncpu) {
|
if (nworker < ncpu) {
|
||||||
// Random choice of an arrow
|
// Random choice of an arrow
|
||||||
electedArrow =
|
electedArrow =
|
||||||
&args->arrowList->space[rand() % args->arrowList->size];
|
&args->arrowList->array[rand() % args->arrowList->size];
|
||||||
|
|
||||||
// Find a local area
|
// Find a local area
|
||||||
workArea = findWorkArea(centersList, electedArrow, args->ruleRadius,
|
workArea = findWorkArea(centersList, electedArrow, args->ruleRadius,
|
||||||
args->globalDrawingSpace->size,
|
args->globalDrawingSpace->size,
|
||||||
args->arrowList->xmax,
|
args->globalDrawingSpace->xmax,
|
||||||
args->arrowList->ymax,
|
args->globalDrawingSpace->ymax,
|
||||||
args->arrowList->zmax
|
args->globalDrawingSpace->zmax
|
||||||
);
|
);
|
||||||
|
|
||||||
// If a free area exists,
|
// If a free area exists,
|
||||||
|
|
Loading…
Reference in New Issue