diff options
author | goodale <goodale@b61c5cb5-eaca-4651-9a7a-d64986f99364> | 2000-05-11 13:47:23 +0000 |
---|---|---|
committer | goodale <goodale@b61c5cb5-eaca-4651-9a7a-d64986f99364> | 2000-05-11 13:47:23 +0000 |
commit | 3fc109a28403d2adcb97c254bb3ad690c2b27e40 (patch) | |
tree | 0ec763dbc572f9d97799d04ded13b2f7fca5cd48 /src | |
parent | 6fd35711d7af4787717f94c8467dfd2f14b4254f (diff) |
Fixing a strange assignment. A few rearrangements. Free some more memory
on destruction of connectivity structure.
Tom
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGH/trunk@217 b61c5cb5-eaca-4651-9a7a-d64986f99364
Diffstat (limited to 'src')
-rw-r--r-- | src/SetupPGV.c | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/src/SetupPGV.c b/src/SetupPGV.c index 36ba702..171aa7c 100644 --- a/src/SetupPGV.c +++ b/src/SetupPGV.c @@ -161,33 +161,33 @@ pConnectivity *PUGH_SetupConnectivity(int dim, if(this) { this->nprocs = (int *)malloc(dim*sizeof(int)); + this->perme = (int *)malloc(dim*sizeof(int)); this->neighbours = (int **)malloc(total_procs*sizeof(int *)); - if(this->nprocs && this->neighbours) + if(this->neighbours) { this->neighbours[0] = (int *)malloc(total_procs*2*dim*sizeof(int)); + } + else + { + free(this->neighbours); + this->neighbours = NULL; + } - if(this->neighbours[0]) - { - for(i = 1; i < total_procs; i++) - { - this->neighbours[i] = this->neighbours[0]+(2*dim*i); - } - - this->perme = (int *)malloc(dim*sizeof(int)); - this->perme = perme; - } - else + if(!this->nprocs || + !this->perme || + !this->neighbours) + { + if(this->neighbours) { - free(this->nprocs); - free(this->neighbours); - free(this); - this = NULL; + free(this->neighbours[0]); } - } - else - { + + free(this->neighbours); + free(this->perme); + free(this->nprocs); + free(this); this = NULL; } @@ -201,6 +201,12 @@ pConnectivity *PUGH_SetupConnectivity(int dim, for(i = 0 ; i < dim; i++) { this->nprocs[i] = nprocs[i]; + this->perme[i] = perme[i]; + } + + for(i = 1; i < total_procs; i++) + { + this->neighbours[i] = this->neighbours[0]+(2*dim*i); } PUGH_GenerateTopology(dim, total_procs, this->nprocs); @@ -232,6 +238,7 @@ void PUGH_DestroyConnectivity(pConnectivity **conn) { if (conn && *conn) { + free((*conn)->perme); free((*conn)->neighbours[0]); free((*conn)->neighbours); free((*conn)->nprocs); |