From 9384d5ead61eeb13ff4be9f182d328081e3af018 Mon Sep 17 00:00:00 2001 From: schnetter Date: Tue, 28 Oct 2003 13:48:26 +0000 Subject: Change the way in which pointers are passed to and from Fortran. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3446 17b73243-c579-4c4c-a9d2-2d5706c11dac --- src/comm/CactusDefaultComm.c | 2 ++ src/comm/CactusSync.c | 18 ++++++------ src/comm/Interp.c | 18 ++++++------ src/comm/OverloadComm.c | 66 ++++++++++++++++++++++---------------------- src/comm/Reduction.c | 48 ++++++++++++++++---------------- 5 files changed, 77 insertions(+), 75 deletions(-) (limited to 'src/comm') diff --git a/src/comm/CactusDefaultComm.c b/src/comm/CactusDefaultComm.c index b8afeecf..ce2c1c83 100644 --- a/src/comm/CactusDefaultComm.c +++ b/src/comm/CactusDefaultComm.c @@ -152,6 +152,8 @@ cGH *CactusDefaultSetupGH(tFleshConfig *config, int convergence_level) thisGH = malloc(sizeof(cGH)); if(thisGH) { + thisGH->self = thisGH; + thisGH->cctk_dim = CCTK_MaxDim(); /* Need this to be at least one otherwise the memory allocation will fail */ diff --git a/src/comm/CactusSync.c b/src/comm/CactusSync.c index 7afb0e19..102d91d1 100644 --- a/src/comm/CactusSync.c +++ b/src/comm/CactusSync.c @@ -31,11 +31,11 @@ CCTK_FILEVERSION(comm_CactusSync_c); /* prototypes for external C routines are declared in header cctk_Groups.h here only follow the fortran wrapper prototypes */ void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroupI) - (int *ierror, const cGH *GH, const int *group); + (int *ierror, const cGH **GH, const int *group); void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroupWithVar) - (int *ierror, const cGH *GH, ONE_FORTSTRING_ARG); + (int *ierror, const cGH **GH, ONE_FORTSTRING_ARG); void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroupWithVarI) - (int *ierror, const cGH *GH, const int *var); + (int *ierror, const cGH **GH, const int *var); /*@@ @@ -88,9 +88,9 @@ int CCTK_SyncGroupI (const cGH *GH, int group) } void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroupI) - (int *ierror, const cGH *GH, const int *group) + (int *ierror, const cGH **GH, const int *group) { - CCTK_SyncGroupI (GH, *group); + CCTK_SyncGroupI (*GH, *group); *ierror = 0; } @@ -134,10 +134,10 @@ int CCTK_SyncGroupWithVar (const cGH *GH, const char *varname) } void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroupWithVar) - (int *ierror, const cGH *GH, ONE_FORTSTRING_ARG) + (int *ierror, const cGH **GH, ONE_FORTSTRING_ARG) { ONE_FORTSTRING_CREATE (varname); - *ierror = CCTK_SyncGroupWithVar (GH, varname); + *ierror = CCTK_SyncGroupWithVar (*GH, varname); free (varname); } @@ -179,9 +179,9 @@ int CCTK_SyncGroupWithVarI (const cGH *GH, int var) } void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroupWithVarI) - (int *ierror, const cGH *GH, const int *var) + (int *ierror, const cGH **GH, const int *var) { - *ierror = CCTK_SyncGroupWithVarI (GH, *var); + *ierror = CCTK_SyncGroupWithVarI (*GH, *var); } diff --git a/src/comm/Interp.c b/src/comm/Interp.c index a31cbfb3..53c9001a 100644 --- a/src/comm/Interp.c +++ b/src/comm/Interp.c @@ -58,7 +58,7 @@ void CCTK_FCALL CCTK_FNAME (CCTK_InterpHandle) ONE_FORTSTRING_ARG); void CCTK_FCALL CCTK_FNAME (CCTK_InterpGV) (int *fortranreturn, - cGH *GH, + cGH **GH, const int *operator_handle, const int *coord_system_handle, const int *num_points, @@ -67,7 +67,7 @@ void CCTK_FCALL CCTK_FNAME (CCTK_InterpGV) ...); void CCTK_FCALL CCTK_FNAME (CCTK_InterpLocal) (int *fortranreturn, - cGH *GH, + cGH **GH, const int *operator_handle, const int *num_points, const int *num_dims, @@ -76,7 +76,7 @@ void CCTK_FCALL CCTK_FNAME (CCTK_InterpLocal) ...); void CCTK_FCALL CCTK_FNAME (CCTK_InterpGridArrays) (int *ierror, - const cGH *GH, + const cGH **GH, const int *N_dims, const int *local_interp_handle, const int *param_table_handle, @@ -757,7 +757,7 @@ int CCTK_InterpGV (cGH *GH, void CCTK_FCALL CCTK_FNAME (CCTK_InterpGV) (int *fortranreturn, - cGH *GH, + cGH **GH, const int *operator_handle, const int *coord_system_handle, const int *num_points, @@ -815,7 +815,7 @@ void CCTK_FCALL CCTK_FNAME (CCTK_InterpGV) VARARGS_TO_ARRAY (out_array_types, int *, *, *num_out_arrays, indices); va_end (indices); - retcode = operator->interp_operator_GV (GH, coord_system, *num_points, + retcode = operator->interp_operator_GV (*GH, coord_system, *num_points, *num_in_array_indices, *num_out_arrays, interp_coord_arrays, @@ -1014,7 +1014,7 @@ int CCTK_InterpLocal (cGH *GH, void CCTK_FCALL CCTK_FNAME (CCTK_InterpLocal) (int *fortranreturn, - cGH *GH, + cGH **GH, const int *operator_handle, const int *num_points, const int *num_dims, @@ -1072,7 +1072,7 @@ void CCTK_FCALL CCTK_FNAME (CCTK_InterpLocal) VARARGS_TO_ARRAY (out_array_types, int *, *, *num_out_arrays, indices); va_end (indices); - retcode = operator->interp_operator_local (GH, *num_points, *num_dims, + retcode = operator->interp_operator_local (*GH, *num_points, *num_dims, *num_in_arrays, *num_out_arrays, coord_dims, coord_arrays, coord_array_types, @@ -1189,7 +1189,7 @@ void CCTK_FCALL CCTK_FNAME (CCTK_InterpLocal) @@*/ void CCTK_FCALL CCTK_FNAME (CCTK_InterpGridArrays) (int *ierror, - const cGH *GH, + const cGH **GH, const int *N_dims, const int *local_interp_handle, const int *param_table_handle, @@ -1203,7 +1203,7 @@ void CCTK_FCALL CCTK_FNAME (CCTK_InterpGridArrays) const CCTK_INT output_array_types[], void *const output_arrays[]) { - *ierror = CCTK_InterpGridArrays (GH, *N_dims, *local_interp_handle, + *ierror = CCTK_InterpGridArrays (*GH, *N_dims, *local_interp_handle, *param_table_handle, *coord_system_handle, *N_interp_points, *interp_coords_type, interp_coords, diff --git a/src/comm/OverloadComm.c b/src/comm/OverloadComm.c index 1b4aa34d..eeb1c253 100644 --- a/src/comm/OverloadComm.c +++ b/src/comm/OverloadComm.c @@ -145,84 +145,84 @@ int CCTKi_SetupCommFunctions(void) /* Fortran bindings prototypes for the comm functions */ -int CCTK_FCALL CCTK_FNAME (CCTK_nProcs) (const cGH *GH); -int CCTK_FCALL CCTK_FNAME (CCTK_MyProc) (const cGH *GH); -void CCTK_FCALL CCTK_FNAME (CCTK_Barrier) (int *ierror, const cGH *GH); -void CCTK_FCALL CCTK_FNAME (CCTK_Exit) (int *ierror, cGH *GH, const int *retval); -void CCTK_FCALL CCTK_FNAME (CCTK_Abort) (int *ierror, cGH *GH, const int *retval); -void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroup) (int *ierror, cGH *GH, ONE_FORTSTRING_ARG); -void CCTK_FCALL CCTK_FNAME (CCTK_EnableGroupComm) (int *ierror, const cGH *GH, ONE_FORTSTRING_ARG); -void CCTK_FCALL CCTK_FNAME (CCTK_DisableGroupComm) (int *ierror, const cGH *GH, ONE_FORTSTRING_ARG); -void CCTK_FCALL CCTK_FNAME (CCTK_EnableGroupStorage) (int *ierror, const cGH *GH, ONE_FORTSTRING_ARG); -void CCTK_FCALL CCTK_FNAME (CCTK_DisableGroupStorage) (int *ierror, const cGH *GH, ONE_FORTSTRING_ARG); -void CCTK_FCALL CCTK_FNAME (CCTK_QueryGroupStorage) (int *ierror, const cGH *GH, ONE_FORTSTRING_ARG); +int CCTK_FCALL CCTK_FNAME (CCTK_nProcs) (const cGH **GH); +int CCTK_FCALL CCTK_FNAME (CCTK_MyProc) (const cGH **GH); +void CCTK_FCALL CCTK_FNAME (CCTK_Barrier) (int *ierror, const cGH **GH); +void CCTK_FCALL CCTK_FNAME (CCTK_Exit) (int *ierror, cGH **GH, const int *retval); +void CCTK_FCALL CCTK_FNAME (CCTK_Abort) (int *ierror, cGH **GH, const int *retval); +void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroup) (int *ierror, cGH **GH, ONE_FORTSTRING_ARG); +void CCTK_FCALL CCTK_FNAME (CCTK_EnableGroupComm) (int *ierror, const cGH **GH, ONE_FORTSTRING_ARG); +void CCTK_FCALL CCTK_FNAME (CCTK_DisableGroupComm) (int *ierror, const cGH **GH, ONE_FORTSTRING_ARG); +void CCTK_FCALL CCTK_FNAME (CCTK_EnableGroupStorage) (int *ierror, const cGH **GH, ONE_FORTSTRING_ARG); +void CCTK_FCALL CCTK_FNAME (CCTK_DisableGroupStorage) (int *ierror, const cGH **GH, ONE_FORTSTRING_ARG); +void CCTK_FCALL CCTK_FNAME (CCTK_QueryGroupStorage) (int *ierror, const cGH **GH, ONE_FORTSTRING_ARG); /* Fortran bindings definitions for the comm functions */ -int CCTK_FCALL CCTK_FNAME (CCTK_nProcs) (const cGH *GH) +int CCTK_FCALL CCTK_FNAME (CCTK_nProcs) (const cGH **GH) { - return (CCTK_nProcs (GH)); + return (CCTK_nProcs (*GH)); } -int CCTK_FCALL CCTK_FNAME (CCTK_MyProc) (const cGH *GH) +int CCTK_FCALL CCTK_FNAME (CCTK_MyProc) (const cGH **GH) { - return (CCTK_MyProc (GH)); + return (CCTK_MyProc (*GH)); } -void CCTK_FCALL CCTK_FNAME (CCTK_Barrier) (int *ierror, const cGH *GH) +void CCTK_FCALL CCTK_FNAME (CCTK_Barrier) (int *ierror, const cGH **GH) { - *ierror = CCTK_Barrier (GH); + *ierror = CCTK_Barrier (*GH); } -void CCTK_FCALL CCTK_FNAME (CCTK_Exit) (int *ierror, cGH *GH, const int *retval) +void CCTK_FCALL CCTK_FNAME (CCTK_Exit) (int *ierror, cGH **GH, const int *retval) { - *ierror = CCTK_Exit (GH, *retval); + *ierror = CCTK_Exit (*GH, *retval); } -void CCTK_FCALL CCTK_FNAME (CCTK_Abort) (int *ierror, cGH *GH, const int *retval) +void CCTK_FCALL CCTK_FNAME (CCTK_Abort) (int *ierror, cGH **GH, const int *retval) { - *ierror = CCTK_Abort (GH, *retval); + *ierror = CCTK_Abort (*GH, *retval); } -void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroup) (int *ierror, cGH *GH, ONE_FORTSTRING_ARG) +void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroup) (int *ierror, cGH **GH, ONE_FORTSTRING_ARG) { ONE_FORTSTRING_CREATE (group_name) - *ierror = CCTK_SyncGroup (GH, group_name); + *ierror = CCTK_SyncGroup (*GH, group_name); free (group_name); } -void CCTK_FCALL CCTK_FNAME (CCTK_EnableGroupComm) (int *ierror, const cGH *GH, ONE_FORTSTRING_ARG) +void CCTK_FCALL CCTK_FNAME (CCTK_EnableGroupComm) (int *ierror, const cGH **GH, ONE_FORTSTRING_ARG) { ONE_FORTSTRING_CREATE (group_name) - *ierror = CCTK_EnableGroupComm (GH, group_name); + *ierror = CCTK_EnableGroupComm (*GH, group_name); free (group_name); } -void CCTK_FCALL CCTK_FNAME (CCTK_DisableGroupComm) (int *ierror, const cGH *GH, ONE_FORTSTRING_ARG) +void CCTK_FCALL CCTK_FNAME (CCTK_DisableGroupComm) (int *ierror, const cGH **GH, ONE_FORTSTRING_ARG) { ONE_FORTSTRING_CREATE (group_name) - *ierror = CCTK_DisableGroupComm (GH, group_name); + *ierror = CCTK_DisableGroupComm (*GH, group_name); free (group_name); } -void CCTK_FCALL CCTK_FNAME (CCTK_EnableGroupStorage) (int *ierror, const cGH *GH, ONE_FORTSTRING_ARG) +void CCTK_FCALL CCTK_FNAME (CCTK_EnableGroupStorage) (int *ierror, const cGH **GH, ONE_FORTSTRING_ARG) { ONE_FORTSTRING_CREATE (group_name) - *ierror = CCTK_EnableGroupStorage (GH, group_name); + *ierror = CCTK_EnableGroupStorage (*GH, group_name); free (group_name); } -void CCTK_FCALL CCTK_FNAME (CCTK_DisableGroupStorage) (int *ierror, const cGH *GH, ONE_FORTSTRING_ARG) +void CCTK_FCALL CCTK_FNAME (CCTK_DisableGroupStorage) (int *ierror, const cGH **GH, ONE_FORTSTRING_ARG) { ONE_FORTSTRING_CREATE (group_name) - *ierror = CCTK_DisableGroupStorage (GH, group_name); + *ierror = CCTK_DisableGroupStorage (*GH, group_name); free (group_name); } -void CCTK_FCALL CCTK_FNAME (CCTK_QueryGroupStorage) (int *ierror, const cGH *GH, ONE_FORTSTRING_ARG) +void CCTK_FCALL CCTK_FNAME (CCTK_QueryGroupStorage) (int *ierror, const cGH **GH, ONE_FORTSTRING_ARG) { extern int CCTK_QueryGroupStorage (const cGH *, const char *); ONE_FORTSTRING_CREATE (group_name) - *ierror = CCTK_QueryGroupStorage (GH, group_name); + *ierror = CCTK_QueryGroupStorage (*GH, group_name); free (group_name); } diff --git a/src/comm/Reduction.c b/src/comm/Reduction.c index 8d68ad3b..186fc9f5 100644 --- a/src/comm/Reduction.c +++ b/src/comm/Reduction.c @@ -39,7 +39,7 @@ void CCTK_FCALL CCTK_FNAME(CCTK_ReductionArrayHandle) (int *operation_handle, ONE_FORTSTRING_ARG); void CCTK_FCALL CCTK_FNAME(CCTK_Reduce) (int *fortranreturn, - const cGH *GH, + const cGH **GH, const int *proc, const int *operation_handle, const int *num_out_vals, @@ -49,7 +49,7 @@ void CCTK_FCALL CCTK_FNAME(CCTK_Reduce) ... ); void CCTK_FCALL CCTK_FNAME(CCTK_ReduceArray) (int *fortran_return, - const cGH *GH, + const cGH **GH, const int *proc, const int *operation_handle, const int *num_out_vals, @@ -63,7 +63,7 @@ void CCTK_FCALL CCTK_FNAME(CCTK_ReduceArray) /* FIXME: OLD INTERFACE */ void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocalScalar) (int *fortran_return, - const cGH *GH, + const cGH **GH, const int *proc, const int *operation_handle, const void *in_scalar, @@ -71,7 +71,7 @@ void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocalScalar) const int *data_type); void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocScalar) (int *fortran_return, - const cGH *GH, + const cGH **GH, const int *proc, const int *operation_handle, const void *in_scalar, @@ -79,7 +79,7 @@ void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocScalar) const int *data_type); void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocalArray1D) (int *fortran_return, - const cGH *GH, + const cGH **GH, const int *proc, const int *operation_handle, const void *in_array1d, @@ -88,7 +88,7 @@ void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocalArray1D) const int *data_type); void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocArrayToArray1D) (int *fortran_return, - const cGH *GH, + const cGH **GH, const int *proc, const int *operation_handle, const void *in_array1d, @@ -96,7 +96,7 @@ void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocArrayToArray1D) const int *num_in_array1d, const int *data_type); void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocArrayToArray2D) - (int *fortran_return, const cGH *GH, + (int *fortran_return, const cGH **GH, const int *proc, const int *operation_handle, const void *in_array2d, @@ -104,7 +104,7 @@ void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocArrayToArray2D) const int *xsize, const int *ysize, const int *data_type); void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocArrayToArray3D) - (int *fortran_return, const cGH *GH, + (int *fortran_return, const cGH **GH, const int *proc, const int *operation_handle, const void *in_array3d, @@ -340,7 +340,7 @@ int CCTK_Reduce(const cGH *GH, void CCTK_FCALL CCTK_FNAME(CCTK_Reduce) (int *fortranreturn, - const cGH *GH, + const cGH **GH, const int *proc, const int *operation_handle, const int *num_out_vals, @@ -389,7 +389,7 @@ void CCTK_FCALL CCTK_FNAME(CCTK_Reduce) } va_end(indices); - retval = operator->reduce_operator (GH, *proc, *num_out_vals, + retval = operator->reduce_operator (*GH, *proc, *num_out_vals, *type_out_vals, out_vals, *num_in_fields,in_fields); @@ -624,7 +624,7 @@ int CCTK_ReduceArray(const cGH *GH, void CCTK_FCALL CCTK_FNAME(CCTK_ReduceArray) (int *fortran_return, - const cGH *GH, + const cGH **GH, const int *proc, const int *operation_handle, const int *num_out_vals, @@ -683,7 +683,7 @@ void CCTK_FCALL CCTK_FNAME(CCTK_ReduceArray) va_end (varargs); - *fortran_return = data->function (GH, *proc, *num_dims, dims, + *fortran_return = data->function (*GH, *proc, *num_dims, dims, *num_in_arrays, in_arrays, *type_in_arrays, *num_out_vals, out_vals, *type_out_vals); free (in_arrays); @@ -742,14 +742,14 @@ int CCTK_ReduceLocalScalar (const cGH *GH, int proc, int operation_handle, /*** FIXME: OLD INTERFACE gerd ***/ void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocalScalar) (int *fortran_return, - const cGH *GH, + const cGH **GH, const int *proc, const int *operation_handle, const void *in_scalar, void *out_scalar, const int *data_type) { - *fortran_return = CCTK_ReduceArray (GH, *proc, *operation_handle, + *fortran_return = CCTK_ReduceArray (*GH, *proc, *operation_handle, 1, *data_type, out_scalar, 1, 1, *data_type, 1, in_scalar); } @@ -765,14 +765,14 @@ int CCTK_ReduceLocScalar (const cGH *GH, int proc, int operation_handle, void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocScalar) (int *fortran_return, - const cGH *GH, + const cGH **GH, const int *proc, const int *operation_handle, const void *in_scalar, void *out_scalar, const int *data_type) { - *fortran_return = CCTK_ReduceArray (GH, *proc, *operation_handle, + *fortran_return = CCTK_ReduceArray (*GH, *proc, *operation_handle, 1, *data_type, out_scalar, 1, 1, *data_type, 1, in_scalar); } @@ -813,7 +813,7 @@ int CCTK_ReduceLocArrayToArray1D(const cGH *GH, int proc, int operation_handle, /*** FIXME: OLD INTERFACE gerd ***/ void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocalArray1D) (int *fortran_return, - const cGH *GH, + const cGH **GH, const int *proc, const int *operation_handle, const void *in_array1d, @@ -821,7 +821,7 @@ void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocalArray1D) const int *num_in_array1d, const int *data_type) { - *fortran_return = CCTK_ReduceArray (GH, *proc, *operation_handle, + *fortran_return = CCTK_ReduceArray (*GH, *proc, *operation_handle, *num_in_array1d, *data_type, out_array1d, 1, 1, *data_type, *num_in_array1d, in_array1d); @@ -841,7 +841,7 @@ void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocalArray1D) void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocArrayToArray1D) (int *fortran_return, - const cGH *GH, + const cGH **GH, const int *proc, const int *operation_handle, const void *in_array1d, @@ -849,7 +849,7 @@ void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocArrayToArray1D) const int *num_in_array1d, const int *data_type) { - *fortran_return = CCTK_ReduceArray (GH, *proc, *operation_handle, + *fortran_return = CCTK_ReduceArray (*GH, *proc, *operation_handle, *num_in_array1d, *data_type, out_array1d, 1, 1, *data_type, *num_in_array1d, in_array1d); @@ -881,7 +881,7 @@ int CCTK_ReduceLocArrayToArray2D(const cGH *GH, int proc, int operation_handle, } void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocArrayToArray2D) - (int *fortran_return, const cGH *GH, + (int *fortran_return, const cGH **GH, const int *proc, const int *operation_handle, const void *in_array2d, @@ -890,7 +890,7 @@ void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocArrayToArray2D) const int *data_type) { int lin_size = (*xsize)*(*ysize); - *fortran_return = CCTK_ReduceArray (GH, *proc, *operation_handle, + *fortran_return = CCTK_ReduceArray (*GH, *proc, *operation_handle, lin_size, *data_type, out_array2d, 2, 1, *data_type, @@ -924,7 +924,7 @@ int CCTK_ReduceLocArrayToArray3D(const cGH *GH, int proc, int operation_handle, } void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocArrayToArray3D) - (int *fortran_return, const cGH *GH, + (int *fortran_return, const cGH **GH, const int *proc, const int *operation_handle, const void *in_array3d, @@ -933,7 +933,7 @@ void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocArrayToArray3D) const int *data_type) { int lin_size = (*xsize)*(*ysize)*(*zsize); - *fortran_return = CCTK_ReduceArray (GH, *proc, *operation_handle, + *fortran_return = CCTK_ReduceArray (*GH, *proc, *operation_handle, lin_size, *data_type, out_array3d, 3, 1, *data_type, -- cgit v1.2.3