summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac>2001-12-09 23:34:55 +0000
committertradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac>2001-12-09 23:34:55 +0000
commit1a9e9c7522261b305f450f06112fbd59760f56eb (patch)
tree36698b355c2a6ad4483e0577c8482edc4696234a
parent4a1db9c3ea04f33adb2f0898f9eed3a1e986c473 (diff)
Fixed fortran wrappers for CCTK_SyncGroupXXX() and CCTK_Barrier()
which also takes an 'ierror' argument now returning the result of the corresponding C call. You will also need to update all thorns now which call these routines. See also separate mail to developers@cactuscode.org regarding this change. git-svn-id: http://svn.cactuscode.org/flesh/trunk@2489 17b73243-c579-4c4c-a9d2-2d5706c11dac
-rw-r--r--src/comm/CactusSync.c80
-rw-r--r--src/comm/OverloadComm.c87
-rw-r--r--src/include/cctk_Sync.h13
3 files changed, 96 insertions, 84 deletions
diff --git a/src/comm/CactusSync.c b/src/comm/CactusSync.c
index 9cb9d11b..b5d31ebe 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)
- (cGH *GH, const int *group);
+ (int *ierror, cGH *GH, const int *group);
void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroupWithVar)
- (cGH *GH, ONE_FORTSTRING_ARG);
+ (int *ierror, cGH *GH, ONE_FORTSTRING_ARG);
void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroupWithVarI)
- (cGH *GH, const int *var);
+ (int *ierror, cGH *GH, const int *var);
/*@@
@@ -58,27 +58,40 @@ void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroupWithVarI)
@vtype int
@vio in
@endvar
+
+ @returntype int
+ @returndesc
+ 0 for success, or<BR>
+ -1 if an invalid group was given,<BR>
+ -2 if driver returned an error on syncing the group
+ @endreturndesc
@@*/
-void CCTK_SyncGroupI (cGH *GH,
- int group)
+int CCTK_SyncGroupI (cGH *GH, int group)
{
+ int retval;
char *groupname;
+ retval = -1;
groupname = CCTK_GroupName (group);
-
if (groupname)
{
- CCTK_SyncGroup (GH, groupname);
-
+ retval = CCTK_SyncGroup (GH, groupname);
+ if (retval)
+ {
+ retval = -2;
+ }
free (groupname);
}
+
+ return (retval);
}
void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroupI)
- (cGH *GH, const int *group)
+ (int *ierror, cGH *GH, const int *group)
{
CCTK_SyncGroupI (GH, *group);
+ *ierror = 0;
}
@@ -104,18 +117,27 @@ void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroupI)
@vtype const char *
@vio in
@endvar
+
+ @returntype int
+ @returndesc
+ return code of @seeroutine CCTK_SyncGroupI
+ @endreturndesc
@@*/
-void CCTK_SyncGroupWithVar (cGH *GH,
- const char *varname)
+int CCTK_SyncGroupWithVar (cGH *GH, const char *varname)
{
- CCTK_SyncGroupI (GH, CCTK_GroupIndexFromVarI (CCTK_VarIndex (varname)));
+ int idx;
+
+
+ idx = CCTK_VarIndex (varname);
+ idx = CCTK_GroupIndexFromVarI (idx);
+ return (CCTK_SyncGroupI (GH, idx));
}
void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroupWithVar)
- (cGH *GH, ONE_FORTSTRING_ARG)
+ (int *ierror, cGH *GH, ONE_FORTSTRING_ARG)
{
ONE_FORTSTRING_CREATE (varname);
- CCTK_SyncGroupWithVar (GH, varname);
+ *ierror = CCTK_SyncGroupWithVar (GH, varname);
free (varname);
}
@@ -141,17 +163,25 @@ void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroupWithVar)
@vtype int
@vio in
@endvar
+
+ @returntype int
+ @returndesc
+ return code of @seeroutine CCTK_SyncGroupI
+ @endreturndesc
@@*/
-void CCTK_SyncGroupWithVarI (cGH *GH,
- int var)
+int CCTK_SyncGroupWithVarI (cGH *GH, int var)
{
- CCTK_SyncGroupI (GH, CCTK_GroupIndexFromVarI (var));
+ int idx;
+
+
+ idx = CCTK_GroupIndexFromVarI (var);
+ return (CCTK_SyncGroupI (GH, idx));
}
void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroupWithVarI)
- (cGH *GH, const int *var)
+ (int *ierror, cGH *GH, const int *var)
{
- CCTK_SyncGroupWithVarI (GH, *var);
+ *ierror = CCTK_SyncGroupWithVarI (GH, *var);
}
@@ -182,20 +212,24 @@ void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroupWithVarI)
@returntype int
@returndesc
- 0
+ the total number of groups synchronized
@endreturndesc
@@*/
int CCTK_SyncGroupsI (cGH *GH,
int n_groups,
const int *groups)
{
- int i;
+ int i, retval;
+ retval = 0;
for (i = 0; i < n_groups; i++)
{
- CCTK_SyncGroupI (GH, groups[i]);
+ if (CCTK_SyncGroupI (GH, groups[i]) == 0)
+ {
+ retval++;
+ }
}
- return (0);
+ return (retval);
}
diff --git a/src/comm/OverloadComm.c b/src/comm/OverloadComm.c
index 9eccc380..40b3a46a 100644
--- a/src/comm/OverloadComm.c
+++ b/src/comm/OverloadComm.c
@@ -98,6 +98,14 @@ int CCTKi_SetupCommFunctions(void)
return 0;
}
+/* Create the dummy function prototypes. */
+#define OVERLOADABLE(name) OVERLOADABLE_DUMMYPROTOTYPE(name)
+
+#include "CommOverloadables.h"
+
+#undef OVERLOADABLE
+
+
/* Create the dummy functions. */
#define OVERLOADABLE(name) OVERLOADABLE_DUMMY(name)
@@ -110,23 +118,15 @@ 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);
-#if 0
-void CCTK_FCALL CCTK_FNAME (CCTK_Barrier) (int *ierr, const cGH *GH);
-#else
-int CCTK_FCALL CCTK_FNAME(CCTK_Barrier)(const cGH *GH);
-#endif
-void CCTK_FCALL CCTK_FNAME (CCTK_Exit) (int *ierr, cGH *GH, const int *retval);
-void CCTK_FCALL CCTK_FNAME (CCTK_Abort) (int *ierr, cGH *GH, const int *retval);
-#if 0
-void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroup) (int *ierr, cGH *GH, ONE_FORTSTRING_ARG);
-#else
-int CCTK_FCALL CCTK_FNAME(CCTK_SyncGroup)(cGH *GH, ONE_FORTSTRING_ARG);
-#endif
-void CCTK_FCALL CCTK_FNAME (CCTK_EnableGroupComm) (int *ierr, cGH *GH, ONE_FORTSTRING_ARG);
-void CCTK_FCALL CCTK_FNAME (CCTK_DisableGroupComm) (int *ierr, cGH *GH, ONE_FORTSTRING_ARG);
-void CCTK_FCALL CCTK_FNAME (CCTK_EnableGroupStorage) (int *ierr, cGH *GH, ONE_FORTSTRING_ARG);
-void CCTK_FCALL CCTK_FNAME (CCTK_DisableGroupStorage) (int *ierr, cGH *GH, ONE_FORTSTRING_ARG);
-void CCTK_FCALL CCTK_FNAME (CCTK_QueryGroupStorage) (int *ierr, const cGH *GH, ONE_FORTSTRING_ARG);
+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, cGH *GH, ONE_FORTSTRING_ARG);
+void CCTK_FCALL CCTK_FNAME (CCTK_DisableGroupComm) (int *ierror, cGH *GH, ONE_FORTSTRING_ARG);
+void CCTK_FCALL CCTK_FNAME (CCTK_EnableGroupStorage) (int *ierror, cGH *GH, ONE_FORTSTRING_ARG);
+void CCTK_FCALL CCTK_FNAME (CCTK_DisableGroupStorage) (int *ierror, 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 */
@@ -140,77 +140,60 @@ int CCTK_FCALL CCTK_FNAME (CCTK_MyProc) (const cGH *GH)
return (CCTK_MyProc (GH));
}
-#if 0
-void CCTK_FCALL CCTK_FNAME (CCTK_Barrier) (int *ierr, const cGH *GH)
-{
- *ierr = CCTK_Barrier (GH);
-}
-#else
-int CCTK_FCALL CCTK_FNAME(CCTK_Barrier)(const cGH *GH)
+void CCTK_FCALL CCTK_FNAME (CCTK_Barrier) (int *ierror, const cGH *GH)
{
- return CCTK_Barrier(GH);
+ *ierror = CCTK_Barrier (GH);
}
-#endif
-void CCTK_FCALL CCTK_FNAME (CCTK_Exit) (int *ierr, cGH *GH, const int *retval)
+void CCTK_FCALL CCTK_FNAME (CCTK_Exit) (int *ierror, cGH *GH, const int *retval)
{
- *ierr = CCTK_Exit (GH, *retval);
+ *ierror = CCTK_Exit (GH, *retval);
}
-void CCTK_FCALL CCTK_FNAME (CCTK_Abort) (int *ierr, cGH *GH, const int *retval)
+void CCTK_FCALL CCTK_FNAME (CCTK_Abort) (int *ierror, cGH *GH, const int *retval)
{
- *ierr = CCTK_Abort (GH, *retval);
+ *ierror = CCTK_Abort (GH, *retval);
}
-#if 0
-void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroup) (int *ierr, cGH *GH, ONE_FORTSTRING_ARG)
+void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroup) (int *ierror, cGH *GH, ONE_FORTSTRING_ARG)
{
ONE_FORTSTRING_CREATE (group_name)
- *ierr = CCTK_SyncGroup (GH, group_name);
+ *ierror = CCTK_SyncGroup (GH, group_name);
free (group_name);
}
-#else
-int CCTK_FCALL CCTK_FNAME(CCTK_SyncGroup)(cGH *GH, ONE_FORTSTRING_ARG)
-{
- ONE_FORTSTRING_CREATE(group_name)
- CCTK_SyncGroup(GH,group_name);
- free(group_name);
- return 0;
-}
-#endif
-void CCTK_FCALL CCTK_FNAME (CCTK_EnableGroupComm) (int *ierr, cGH *GH, ONE_FORTSTRING_ARG)
+void CCTK_FCALL CCTK_FNAME (CCTK_EnableGroupComm) (int *ierror, cGH *GH, ONE_FORTSTRING_ARG)
{
ONE_FORTSTRING_CREATE (group_name)
- *ierr = CCTK_EnableGroupComm (GH, group_name);
+ *ierror = CCTK_EnableGroupComm (GH, group_name);
free (group_name);
}
-void CCTK_FCALL CCTK_FNAME (CCTK_DisableGroupComm) (int *ierr, cGH *GH, ONE_FORTSTRING_ARG)
+void CCTK_FCALL CCTK_FNAME (CCTK_DisableGroupComm) (int *ierror, cGH *GH, ONE_FORTSTRING_ARG)
{
ONE_FORTSTRING_CREATE (group_name)
- *ierr = CCTK_DisableGroupComm (GH, group_name);
+ *ierror = CCTK_DisableGroupComm (GH, group_name);
free (group_name);
}
-void CCTK_FCALL CCTK_FNAME (CCTK_EnableGroupStorage) (int *ierr, cGH *GH, ONE_FORTSTRING_ARG)
+void CCTK_FCALL CCTK_FNAME (CCTK_EnableGroupStorage) (int *ierror, cGH *GH, ONE_FORTSTRING_ARG)
{
ONE_FORTSTRING_CREATE (group_name)
- *ierr = CCTK_EnableGroupStorage (GH, group_name);
+ *ierror = CCTK_EnableGroupStorage (GH, group_name);
free (group_name);
}
-void CCTK_FCALL CCTK_FNAME (CCTK_DisableGroupStorage) (int *ierr, cGH *GH, ONE_FORTSTRING_ARG)
+void CCTK_FCALL CCTK_FNAME (CCTK_DisableGroupStorage) (int *ierror, cGH *GH, ONE_FORTSTRING_ARG)
{
ONE_FORTSTRING_CREATE (group_name)
- *ierr = CCTK_DisableGroupStorage (GH, group_name);
+ *ierror = CCTK_DisableGroupStorage (GH, group_name);
free (group_name);
}
-void CCTK_FCALL CCTK_FNAME (CCTK_QueryGroupStorage) (int *ierr, 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)
- *ierr = CCTK_QueryGroupStorage (GH, group_name);
+ *ierror = CCTK_QueryGroupStorage (GH, group_name);
free (group_name);
}
diff --git a/src/include/cctk_Sync.h b/src/include/cctk_Sync.h
index 876edb01..e6bcb5de 100644
--- a/src/include/cctk_Sync.h
+++ b/src/include/cctk_Sync.h
@@ -16,15 +16,10 @@ extern "C"
{
#endif
-void CCTK_SyncGroupI (cGH *GH,
- int group);
-void CCTK_SyncGroupWithVar (cGH *GH,
- const char *varname);
-void CCTK_SyncGroupWithVarI (cGH *GH,
- int var);
-int CCTK_SyncGroupsI (cGH *GH,
- int n_groups,
- const int *groups);
+int CCTK_SyncGroupI (cGH *GH, int group);
+int CCTK_SyncGroupWithVar (cGH *GH, const char *varname);
+int CCTK_SyncGroupWithVarI (cGH *GH, int var);
+int CCTK_SyncGroupsI (cGH *GH, int n_groups, const int *groups);
#ifdef __cplusplus
}