//=-------------------------------------------------------------------------=// // Main // // // // Copyright © 2021 The Gem-graph Project // // // // This file is part of gem-graph. // // // // This program is free software: you can redistribute it and/or modify // // it under the terms of the GNU Affero General Public License as // // published by the Free Software Foundation, either version 3 of the // // License, or (at your option) any later version. // // // // This program is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY; without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // GNU Affero General Public License for more details. // // // // You should have received a copy of the GNU Affero General Public License // // along with this program. If not, see . // //=-------------------------------------------------------------------------=// #include "../include/base.h" #include "../include/server.h" #include "../include/scheduler.h" #define ARROW_NUMBER 150 #define MAX_CYCLES 15 #define MAX_THREAD 0 #define XMAX 1000 #define YMAX 1000 #define ZMAX 0 #define SPACE_SIZE (XMAX+1) * (YMAX+1) * (ZMAX+1) int main(int argc, char **argv) { time_t t; Scheduler_t *scheduler0; // Go! printLog("Starting gem-graph-server...\n"); // // random generator // t = time(&t); srand((unsigned) t); // // Creating structure for the Scheduler // scheduler0 = (Scheduler_t*) calloc(1, sizeof(Scheduler_t)); scheduler0->globalDrawingSpace = (Space_t*) calloc(1, sizeof(Space_t)); scheduler0->globalDrawingSpace->space = (SpaceUnit_t*) calloc(SPACE_SIZE, sizeof(SpaceUnit_t)); scheduler0->globalDrawingSpace->size = SPACE_SIZE; scheduler0->globalDrawingSpace->xmax = SPACE_SIZE; scheduler0->globalDrawingSpace->ymax = SPACE_SIZE; scheduler0->globalDrawingSpace->zmax = SPACE_SIZE; scheduler0->arrowList = (ArrowArray_t*) calloc(1, sizeof(ArrowArray_t)); scheduler0->arrowList->array = (Arrow_t*) calloc(ARROW_NUMBER, sizeof(Arrow_t)); scheduler0->arrowList->size = ARROW_NUMBER; printLog("Populating a random arrow list...\n"); for (int i = 0; i < ARROW_NUMBER; i++) { if (scheduler0->globalDrawingSpace->xmax) scheduler0->arrowList->array[i].x = rand() % (scheduler0->globalDrawingSpace->xmax + 1); if (scheduler0->globalDrawingSpace->ymax) scheduler0->arrowList->array[i].y = rand() % (scheduler0->globalDrawingSpace->ymax + 1); if (scheduler0->globalDrawingSpace->zmax) scheduler0->arrowList->array[i].z = rand() % (scheduler0->globalDrawingSpace->zmax + 1); } scheduler0->nmaxThread = MAX_THREAD; scheduler0->nmaxCycles = MAX_CYCLES; // // Creating the Scheduler thread // SchedInit(scheduler0); SchedWait(scheduler0); SchedDestroy(scheduler0); free(scheduler0); return 0; }