first rule : dimers random walk in 1D space

This commit is contained in:
Jean Sirmai 2021-06-23 15:06:33 +02:00
parent 29e43c2f18
commit 160d514213
Signed by untrusted user who does not match committer: jean
GPG Key ID: FB3115C340E057E3
2 changed files with 33 additions and 5 deletions

View File

@ -33,7 +33,7 @@ void WorkerInit(Worker_t *worker)
worker->id = (pthread_t*) calloc(1, sizeof(pthread_t));
if (pthread_create(worker->id, NULL, workerMain, worker)) {
printLog("Worker #%lu can't be initialized!\n", *(worker->id));
return NULL;
return;
}
}
@ -48,9 +48,37 @@ static void *workerMain(void *worker)
args = (Worker_t*) worker;
printLog("Worker #%lu online\n", *args->id);
for (int i = 0; i < 45000; i++) {
for (int j = i; j < 45000; j++) {
a = (a + (long)args->id) * i * j;
int size = args->globalDrawingSpace->size;
/* In each cell: the West (left) site is 0, the East (right) site is 1 */
for (int orig=0; orig < size; orig++){
int nxt1 = (orig + 1) % size,
nxt2 = (orig + 2) % size,
prv1 = (orig - 1 + size) % size;
if(
args->globalDrawingSpace->space[orig].sites[1].nArrow == 1
&& args->globalDrawingSpace->space[nxt2].sites[0].nArrow == 0
) {
args->globalDrawingSpace->space[orig].sites[1].nArrow = 0;
args->globalDrawingSpace->space[nxt1].sites[0].nArrow = 0;
args->globalDrawingSpace->space[nxt1].sites[1].nArrow = 1;
args->globalDrawingSpace->space[nxt2].sites[0].nArrow = 1;
/* TODO args->arrowArray->array[1].siteId = 0;*/
}
else if(
args->globalDrawingSpace->space[orig].sites[1].nArrow == 1
&& args->globalDrawingSpace->space[prv1].sites[0].nArrow == 0
) {
args->globalDrawingSpace->space[orig].sites[1].nArrow = 0;
args->globalDrawingSpace->space[nxt1].sites[0].nArrow = 0;
args->globalDrawingSpace->space[orig].sites[0].nArrow = 1;
args->globalDrawingSpace->space[prv1].sites[1].nArrow = 1;
/* TODO args->arrowArray->array[1].siteId = 0;*/
}
}

View File

@ -90,7 +90,7 @@ static void *schedulerMain(void *scheduler)
args = (Scheduler_t*) scheduler;
printLog("Scheduler #%lu online\n", *args->id);
if (!args->nmaxThread) { // nmaxthread = 0 => no minimum
if (!args->nMaxThread) { // nmaxthread = 0 => no minimum
ncpu = get_nprocs(); // allocating all the cpus available
} else { // n thread = min(cpu, nmaxthread)
ncpu = MIN(get_nprocs(), args->nMaxThread);