aboutsummaryrefslogtreecommitdiff
path: root/src/SetupPGV.c
diff options
context:
space:
mode:
authorallen <allen@b61c5cb5-eaca-4651-9a7a-d64986f99364>2000-03-23 15:18:57 +0000
committerallen <allen@b61c5cb5-eaca-4651-9a7a-d64986f99364>2000-03-23 15:18:57 +0000
commit3641f4c7513fffd1f0d026f1a859ecaa78712682 (patch)
tree322b86eeaf723d4940ffaff81d5b02819146d39c /src/SetupPGV.c
parenta5844c641aa3c1b179d0176acf16fcd3607d439c (diff)
Major changes to PUGH as the dearly loved pGF is removed, and a grid function
is lowered to being simply a special case of a grid array, pGA. Grid arrays can all have different sizes, which means that now the size of a GA is moved from the GH to a structure on the GA, along with a lot of other connectivity and additional information which was formerly on the GH. If you need to care about these changes, take a look at the files in src/include/pGH.h and src/include/pGA.h, to see the new structures (I'll leave the old files pGF.h and SetupPGF.c around for a while to compare with). Also, look at a PUGH dependent file which has already been converted, such as CactusPUGHIO/IOASCII/src/Write1D.c. Warning: This commit breaks the development versions of IOHDF5 and IsoSurfacer, these will be fixed real quick. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGH/trunk@182 b61c5cb5-eaca-4651-9a7a-d64986f99364
Diffstat (limited to 'src/SetupPGV.c')
-rw-r--r--src/SetupPGV.c100
1 files changed, 64 insertions, 36 deletions
diff --git a/src/SetupPGV.c b/src/SetupPGV.c
index 9e943a1..b77bdd2 100644
--- a/src/SetupPGV.c
+++ b/src/SetupPGV.c
@@ -24,7 +24,7 @@ static char *rcsid = "$Header$";
/* Prototypes */
pGExtras *pugh_SetupPGExtras(int dim,
- int periodic,
+ int *perme,
int stagger,
int *sh,
int *nghosts,
@@ -35,11 +35,15 @@ pGExtras *pugh_SetupPGExtras(int dim,
pConnectivity *pugh_SetupConnectivity(int dim,
int total_procs,
int *nprocs,
- int periodic);
+ int *perme);
int pugh_GenerateTopology(int dim, int total_procs, int *nprocs);
-int pugh_GenerateNeighbours(int dim, int total_procs, int *nprocs, int **neighbours, int periodic);
+int pugh_GenerateNeighbours(int dim,
+ int total_procs,
+ int *nprocs,
+ int **neighbours,
+ int *perme);
int pugh_DecomposeIJK(int dim, int ijk, int *nprocs, int *pos);
@@ -53,7 +57,7 @@ int pugh_SetupPGExtrasMemory(int dim,
pGExtras *this);
int pugh_SetupPGExtrasSizes(int dim,
- int periodic,
+ int *perme,
int stagger,
int *sh,
int *nghosts,
@@ -63,7 +67,7 @@ int pugh_SetupPGExtrasSizes(int dim,
pGExtras *this);
int pugh_SetupPGExtrasOwnership(int dim,
- int periodic,
+ int *perme,
int stagger,
int *sh,
int *nghosts,
@@ -73,7 +77,7 @@ int pugh_SetupPGExtrasOwnership(int dim,
pGExtras *this);
int pugh_SetupBoundingBox(int dim,
- int periodic,
+ int *perme,
int stagger,
int *sh,
int *nghosts,
@@ -82,7 +86,7 @@ int pugh_SetupBoundingBox(int dim,
pGExtras *this);
int pugh_SetupRemoteSizes(int dim,
- int periodic,
+ int *perme,
int stagger,
int *sh,
int *nghosts,
@@ -125,7 +129,7 @@ int pugh_DisableGADataStorage(pGA *GA);
@@*/
pGExtras *pugh_SetupPGExtras(int dim,
- int periodic,
+ int *perme,
int stagger,
int *sh,
int *nghosts,
@@ -151,9 +155,9 @@ pGExtras *pugh_SetupPGExtras(int dim,
this->dim = dim;
- pugh_SetupPGExtrasSizes (dim, periodic, stagger, sh, nghosts,
+ pugh_SetupPGExtrasSizes (dim, perme, stagger, sh, nghosts,
total_procs, nprocs, this_proc,this);
- pugh_SetupPGExtrasOwnership(dim, periodic, stagger, sh, nghosts,
+ pugh_SetupPGExtrasOwnership(dim, perme, stagger, sh, nghosts,
total_procs, nprocs, this_proc, this);
}
@@ -229,7 +233,7 @@ void pugh_DestroyPGExtras(pGExtras **PGExtras)
pConnectivity *pugh_SetupConnectivity(int dim,
int total_procs,
int *nprocs,
- int periodic)
+ int *perme)
{
pConnectivity *this;
@@ -254,7 +258,9 @@ pConnectivity *pugh_SetupConnectivity(int dim,
this->neighbours[i] = this->neighbours[0]+(2*dim*i);
}
- this->periodic = periodic;
+ this->perme = (int *)malloc(dim*sizeof(int));
+ this->perme = perme;
+
}
else
{
@@ -283,7 +289,7 @@ pConnectivity *pugh_SetupConnectivity(int dim,
pugh_GenerateTopology(dim, total_procs, this->nprocs);
- pugh_GenerateNeighbours(dim, total_procs, this->nprocs, this->neighbours, this->periodic);
+ pugh_GenerateNeighbours(dim, total_procs, this->nprocs, this->neighbours, this->perme);
}
@@ -424,7 +430,7 @@ int pugh_GenerateNeighbours(int dim,
int total_procs,
int *nprocs,
int **neighbours,
- int periodic)
+ int *perme)
{
int retval;
int i;
@@ -450,7 +456,7 @@ int pugh_GenerateNeighbours(int dim,
{
neighbours[i][idim*2] = pugh_ComposeIJK(dim, nprocs, pos);
}
- else if(periodic)
+ else if(perme[idim])
{
temp = pos[idim];
pos[idim] = nprocs[idim]-1;
@@ -471,7 +477,7 @@ int pugh_GenerateNeighbours(int dim,
{
neighbours[i][idim*2+1] = pugh_ComposeIJK(dim, nprocs, pos);
}
- else if(periodic)
+ else if(perme[idim])
{
temp = pos[idim];
pos[idim] = 0;
@@ -833,7 +839,7 @@ int pugh_SetupPGExtrasMemory(int dim,
@@*/
int pugh_SetupPGExtrasSizes(int dim,
- int periodic,
+ int *perme,
int stagger,
int *sh,
int *nghosts,
@@ -874,7 +880,7 @@ int pugh_SetupPGExtrasSizes(int dim,
/* Setup the bounding box stuff */
pugh_SetupBoundingBox(dim,
- periodic,
+ perme,
stagger,
sh,
nghosts,
@@ -885,7 +891,7 @@ int pugh_SetupPGExtrasSizes(int dim,
/* Set the remote sizes */
pugh_SetupRemoteSizes(dim,
- periodic,
+ perme,
stagger,
sh,
nghosts,
@@ -924,7 +930,7 @@ int pugh_SetupPGExtrasSizes(int dim,
@@*/
int pugh_SetupPGExtrasOwnership(int dim,
- int periodic,
+ int *perme,
int stagger,
int *sh,
int *nghosts,
@@ -954,14 +960,14 @@ int pugh_SetupPGExtrasOwnership(int dim,
}
/* correct for periodic identification : Tue Jun 17 08:40:15 CDT 1997 */
- if(periodic)
+ for (dir = 0; dir < dim; dir++)
{
- for (dir = 0; dir < dim; dir++)
+ if(perme[dir])
{
- this->ownership[PUGH_VERTEXCTR][0][dir] =
- this->nghostzones[dir];
- this->ownership[PUGH_VERTEXCTR][1][dir] =
- this->lnsize[dir] - this->nghostzones[dir];
+ this->ownership[PUGH_VERTEXCTR][0][dir] =
+ this->nghostzones[dir];
+ this->ownership[PUGH_VERTEXCTR][1][dir] =
+ this->lnsize[dir] - this->nghostzones[dir];
}
}
@@ -1167,7 +1173,7 @@ int pugh_SetupPGExtrasOwnership(int dim,
@@*/
int pugh_SetupBoundingBox(int dim,
- int periodic,
+ int *perme,
int stagger,
int *sh,
int *nghosts,
@@ -1232,12 +1238,15 @@ int pugh_SetupBoundingBox(int dim,
free(pos);
#ifdef DEBUG_PUGH
- for(i=0; i<total_procs; i++) {
- printf(" setup_Bounding_Box (%d):", i);
- for (dir = 0 ; dir < dim; dir++)
- printf(" (%d,%d)",
- this->lb[i][dir], this->ub[i][dir]);
- printf(" \n");
+ {
+ int i;
+ for(i=0; i<total_procs; i++) {
+ printf(" setup_Bounding_Box (%d):", i);
+ for (dir = 0 ; dir < dim; dir++)
+ printf(" (%d,%d)",
+ this->lb[i][dir], this->ub[i][dir]);
+ printf(" \n");
+ }
}
#endif
@@ -1260,7 +1269,7 @@ int pugh_SetupBoundingBox(int dim,
@@*/
int pugh_SetupRemoteSizes(int dim,
- int periodic,
+ int *perme,
int stagger,
int *sh,
int *nghosts,
@@ -1439,6 +1448,7 @@ int pugh_EnablePGAStorage(pGA *GA,
int sz;
int ldir;
int special_pad, cache_size;
+ char *temp_byte;
long start;
retval = 0;
@@ -1512,6 +1522,8 @@ int pugh_EnablePGAStorage(pGA *GA,
}
else
{
+
+#ifdef 0
if(zero_memory)
{
GA->padddata = calloc(GA->extras->npoints + padding_size, GA->varsize);
@@ -1530,7 +1542,6 @@ int pugh_EnablePGAStorage(pGA *GA,
start = ((long) (GA->padddata) / GA->varsize)%cache_size;
special_pad = ((GA->id) * padding_address_spacing + cache_size - start)%cache_size;
-
GA->data = (char *) GA->padddata + special_pad*GA->varsize;
if (special_pad > padding_size)
@@ -1542,6 +1553,24 @@ int pugh_EnablePGAStorage(pGA *GA,
}
retval = 0;
+#endif
+
+ /* Use the Cactus Cache alignment function */
+ GA->data = Util_CacheMalloc(GA->id,
+ GA->extras->npoints * GA->varsize,
+ &(GA->padddata));
+
+ /* Zero the memory if desired. */
+ if(GA->data && zero_memory)
+ {
+ for(temp_byte = (char *)GA->data;
+ temp_byte < ((char *)GA->data)+GA->extras->npoints * GA->varsize;
+ temp_byte++)
+ {
+ *temp_byte = 0;
+ }
+ }
+
}
}
}
@@ -1601,7 +1630,6 @@ int pugh_DisableGADataStorage(pGA *GA)
GA->data = GA->padddata;
GA->storage = PUGH_NOSTORAGE;
-
retval = 0;
}
else