blob: 71ff4db56369753dd9e0c7a5d1bbde7afd4b8d9b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
/*@@
@file Startup.c
@date Sun Jul 04 1999
@author Thomas Radke
@desc
Startup routines for PUGHInterp
@enddesc
@version $Id$
@@*/
#include <stdlib.h>
#include "cctk.h"
#include "util_Table.h"
#include "cctk_Interp.h"
#include "pughInterpGH.h"
/* the rcs ID and its dummy function to use it */
static const char *rcsid = "$Header$";
CCTK_FILEVERSION(CactusPUGH_PUGHInterp_Startup_c)
/********************************************************************
******************** External Routines ************************
********************************************************************/
int PUGHInterp_Startup (void);
/********************************************************************
******************** Internal Routines ************************
********************************************************************/
#ifdef CCTK_MPI
static void *SetupGH (tFleshConfig *config, int convergence_level, cGH *GH);
#endif
/*@@
@routine PUGHInterp_Startup
@date Sun Jul 04 1999
@author Thomas Radke
@desc
The startup registration routine for PUGHInterp.
Registers the PUGHInterp GH extensions setup routine with the
flesh and overloads the CCTK_InterpGridArrays() routine.
@enddesc
@calls CCTK_OverloadInterpGridArrays
CCTK_RegisterGHExtensionSetupGH
@@*/
int PUGHInterp_Startup (void)
{
CCTK_OverloadInterpGridArrays (PUGHInterp_InterpGridArrays);
#ifdef CCTK_MPI
CCTK_RegisterGHExtensionSetupGH (CCTK_RegisterGHExtension ("PUGHInterp"),
SetupGH);
#endif
return 0;
}
/********************************************************************
******************** Internal Routines ************************
********************************************************************/
#ifdef CCTK_MPI
/*@@
@routine SetupGH
@date Sun Jul 04 1999
@author Thomas Radke
@desc
Allocates the GH extension structure and - for the MPI case -
the count/displacement buffers used in MPI_Alltoall()
and MPI_Alltoallv()
@enddesc
@calls CCTK_nProcs
@returntype void *
@returndesc
pointer to the allocated GH extension structure
@endreturndesc
@@*/
static void *SetupGH (tFleshConfig *config, int convergence_level, cGH *GH)
{
int nprocs;
pughInterpGH *myGH;
/* suppress compiler warnings about unused variables */
(void) (config + 0);
(void) (convergence_level + 0);
myGH = malloc (sizeof (pughInterpGH));
/* allocate once for all fields of same type */
nprocs = CCTK_nProcs (GH);
myGH->sendcnt = malloc (4 * nprocs * sizeof (int));
myGH->senddispl = myGH->sendcnt + nprocs;
myGH->recvcnt = myGH->senddispl + nprocs;
myGH->recvdispl = myGH->recvcnt + nprocs;
myGH->N_points_from = malloc (2 * nprocs * sizeof (CCTK_INT));
myGH->N_points_to = myGH->N_points_from + nprocs;
return (myGH);
}
#endif /* CCTK_MPI */
|