aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlanfer <lanfer@57bc7290-fb3d-4efd-a9b1-28e84cce6043>1999-11-01 13:55:29 +0000
committerlanfer <lanfer@57bc7290-fb3d-4efd-a9b1-28e84cce6043>1999-11-01 13:55:29 +0000
commit9a891f99d59d52b1a9df80568b80df2c834964f7 (patch)
tree2721b8068d0b25f0a028af54d23646c1b1e4baeb
parent3b4e6a75421928a47066b3db873c5f18f15462bf (diff)
infrastructure, some fixes, database...
git-svn-id: http://svn.cactuscode.org/arrangements/CactusElliptic/EllBase/trunk@20 57bc7290-fb3d-4efd-a9b1-28e84cce6043
-rw-r--r--src/Ell_DBstructure.c78
-rw-r--r--src/Startup.c15
2 files changed, 69 insertions, 24 deletions
diff --git a/src/Ell_DBstructure.c b/src/Ell_DBstructure.c
index 39d2485..c6f574d 100644
--- a/src/Ell_DBstructure.c
+++ b/src/Ell_DBstructure.c
@@ -43,6 +43,7 @@ int Ell_CreateKey(int vartype, const char *keychain) {
new->vals.i = 0;
new->vals.s = NULL;
+ printf("Created %s %d \n",keychain,vartype);
retval = StoreNamedData(&EllInfoDB, keychain, new);
if (retval!=0) retval = ELLCREATE_FAILED;
}
@@ -51,11 +52,12 @@ int Ell_CreateKey(int vartype, const char *keychain) {
}
int Ell_IsKey(const char *keychain) {
- int retval;
+ int retval=ELL_ISNOKEY;
if ((struct t_ellthingy*)GetNamedData(EllInfoDB, keychain)) {
retval = 0;
- }
- retval = ELL_ISNOKEY;
+ } else
+ retval = ELL_ISNOKEY;
+ return(retval);
}
void FMODIFIER FORTRAN_NAME(Ell_IsKey)(int *ierr, ONE_FORTSTRING_ARG) {
@@ -79,12 +81,14 @@ int Ell_UnsetKey(const char *keychain) {
getme->been_set = ELL_NO;
retval = 0;
}
+ return(retval);
}
int Ell_DeleteKey(const char *keychain) {
int retval;
printf("NO IMPLEMENTED YET!");
retval = 1;
+ return(retval);
}
void FMODIFIER FORTRAN_NAME(Ell_DeleteKey)(int *ierr, ONE_FORTSTRING_ARG){
@@ -105,11 +109,12 @@ int Ell_SetRealKey(CCTK_REAL value, const char *keychain) {
retval = ELLSET_FAILED;
}
else {
- setme->type = CCTK_VARIABLE_INT;
+ setme->type = CCTK_VARIABLE_REAL;
setme->vals.r = value;
setme->been_set = ELL_YES;
retval=0;
}
+
return(retval);
}
@@ -138,7 +143,7 @@ int Ell_SetIntKey(CCTK_INT value, const char *keychain) {
}
void FMODIFIER FORTRAN_NAME(Ell_SetIntKey)
- (int *ierr, CCTK_REAL *value, ONE_FORTSTRING_ARG) {
+ (int *ierr, CCTK_INT *value, ONE_FORTSTRING_ARG) {
ONE_FORTSTRING_CREATE(key)
*ierr = Ell_SetIntKey(*value, key);
free(key);
@@ -190,21 +195,26 @@ int Ell_GetRealKey(CCTK_REAL *value, const char *keychain) {
retval = ELLGET_NOKEY;
}
else if (getme->type!=CCTK_VARIABLE_REAL) {
- printf("You are not getting a CCTK_REAL value off this key: >%s< type: %d\n",
- keychain,getme->type);
+ printf("Ell_GetRealKey: You are not getting a CCTK_REAL value off this key: >%s< type: %d (need %d)\n",
+ keychain,getme->type,CCTK_VARIABLE_REAL);
retval = ELLGET_BADTYPE;
}
+ else if (getme->been_set==ELL_NO) {
+ printf("Ell_GetRealKey: This key has not been set to any value: >%s< \n",keychain);
+ retval = ELLGET_NOTSET;
+ }
else {
*value=getme->vals.r;
retval=0;
}
+ printf("GetReal: %f %f\n",*value,getme->vals.r);
return(retval);
}
void FMODIFIER FORTRAN_NAME(Ell_GetRealKey)
(int *ierr, CCTK_REAL *value, ONE_FORTSTRING_ARG) {
ONE_FORTSTRING_CREATE(key)
- *ierr = Ell_GetRealKey(value, key);
+ *ierr = Ell_GetRealKey(value, key);
free(key);
}
@@ -216,22 +226,23 @@ int Ell_GetIntKey(CCTK_INT *value,const char *keychain) {
getme = (struct t_ellthingy*)GetNamedData(EllInfoDB, keychain);
if (!(getme)) {
- printf("Ell_GetRealKey: Cannot get structure with key >%s< \n",keychain);
- printf("Ell_GetRealKey: Create first!\n");
+ printf("Ell_GetIntKey: Cannot get structure with key >%s< \n",keychain);
+ printf("Ell_GetIntKey: Create first!\n");
retval = ELLGET_NOKEY;
}
- else if (getme->type!=CCTK_VARIABLE_REAL) {
- printf("You are not getting a CCTK_REAL value off this key: >%s< type: %d\n",
+ else if (getme->type!=CCTK_VARIABLE_INT) {
+ printf("Ell_GetIntKey: You are not getting a CCTK_INT value off this key: >%s< type: %d\n",
keychain,getme->type);
retval = ELLGET_BADTYPE;
}
else if (getme->been_set==ELL_NO) {
- printf("Key has not been set");
+ printf("Ell_GetIntKey: Key has not been set to any value: >%s< type %d",keychain,getme->type);
retval = ELLGET_NOTSET;
} else {
- *value=getme->vals.r;
+ *value=getme->vals.i;
retval=0;
- }
+ }
+
return(retval);
}
@@ -254,7 +265,7 @@ int Ell_GetStrKey(char *value, const char *keychain) {
printf("Ell_GetRealKey: Create first!\n");
retval = ELLGET_NOKEY;
}
- else if (getme->type!=CCTK_VARIABLE_REAL) {
+ else if (getme->type!=CCTK_VARIABLE_STRING) {
printf("You are not getting a CCTK_REAL value off this key: >%s< type: %d\n",
keychain,getme->type);
retval = ELLGET_BADTYPE;
@@ -270,11 +281,36 @@ int Ell_GetStrKey(char *value, const char *keychain) {
}
void FMODIFIER FORTRAN_NAME(Ell_GetStrKey)
- (int *ierr, TWO_FORTSTRINGS_ARGS) {
- TWO_FORTSTRINGS_CREATE(value,key)
- *ierr = Ell_GetStrKey(value, key);
- free(key);
- free(value);
+ (int *nchar, char **cstring,ONE_FORTSTRING_ARG)
+{
+ int i;
+ ONE_FORTSTRING_CREATE(fstring)
+ ONE_FORTSTRING_PTR(fptr)
+
+ if (strlen(*cstring) > cctk_strlen1)
+ {
+ char *message;
+ message = (char *)malloc( (200+strlen(*cstring))*sizeof(char) );
+ sprintf(message,"Cannot output %s to char* of length %d",
+ *cstring,cctk_strlen1);
+ CCTK_Warn (1,__LINE__,__FILE__,"Cactus",message);
+ free(message);
+ *nchar = -1;
+ }
+
+ for (i=0;i<strlen(*cstring);i++)
+ {
+ fptr[i] = (*cstring)[i];
+ }
+
+ for (i=strlen(*cstring);i<cctk_strlen1;i++)
+ {
+ fptr[i] = ' ';
+ }
+
+ fptr[strlen(*cstring)] = '\0';
+
+ *nchar = strlen(*cstring);
}
diff --git a/src/Startup.c b/src/Startup.c
index 9b0caf7..fad462d 100644
--- a/src/Startup.c
+++ b/src/Startup.c
@@ -41,13 +41,22 @@ void Ell_RegisterBaseEqTypes(cGH *GH) {
err = Ell_CreateKey(CCTK_VARIABLE_STRING,"EllLinFlat::Bnd");
err = Ell_CreateKey(CCTK_VARIABLE_STRING,"EllLinConfMetric::Bnd");
err = Ell_CreateKey(CCTK_VARIABLE_STRING,"EllLinMetric::Bnd");
-
+
/* Register the variables needed to use these boundaries */
err = Ell_CreateKey(CCTK_VARIABLE_REAL, "EllLinConfMetric::Bnd::Robin::V0");
- err = Ell_CreateKey(CCTK_VARIABLE_REAL, "EllLinConfMetric::Bnd::Robin::V1");
- err = Ell_CreateKey(CCTK_VARIABLE_REAL, "EllLinConfMetric::BND::Const::V0");
+ err = Ell_CreateKey(CCTK_VARIABLE_INT, "EllLinConfMetric::Bnd::Robin::V1");
+ err = Ell_CreateKey(CCTK_VARIABLE_REAL, "EllLinConfMetric::Bnd::Const::V0");
+ /* Register the variables needed to use these boundaries */
+ err = Ell_CreateKey(CCTK_VARIABLE_REAL, "EllLinMetric::Bnd::Robin::V0");
+ err = Ell_CreateKey(CCTK_VARIABLE_INT, "EllLinMetric::Bnd::Robin::V1");
+ err = Ell_CreateKey(CCTK_VARIABLE_REAL, "EllLinMetric::Bnd::Const::V0");
+ /* Register the variables needed to use these boundaries */
+ err = Ell_CreateKey(CCTK_VARIABLE_REAL, "EllLinFlat::Bnd::Robin::V0");
+ err = Ell_CreateKey(CCTK_VARIABLE_INT, "EllLinFlat::Bnd::Robin::V1");
+ err = Ell_CreateKey(CCTK_VARIABLE_REAL, "EllLinFlat::Bnd::Const::V0");
+
}