summaryrefslogtreecommitdiff
path: root/src/main/Coord.c
diff options
context:
space:
mode:
authorallen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac>1999-07-18 10:31:57 +0000
committerallen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac>1999-07-18 10:31:57 +0000
commit4bee018bb8e69479422b1b535e4bc86d7b57b9cf (patch)
tree86bf43b594b040d52d6f9713148f11dcc499fe29 /src/main/Coord.c
parent23eb19a4596621d8846605b64a43e7fbe50724de (diff)
Added routine for registering and getting back the coordinate origin.
Not quite finished since at the moment it always tells you that the origin is at zero. This is because I haven't decided whether you should register the coordiante and the origin separately or at the same time. git-svn-id: http://svn.cactuscode.org/flesh/trunk@724 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/main/Coord.c')
-rw-r--r--src/main/Coord.c43
1 files changed, 36 insertions, 7 deletions
diff --git a/src/main/Coord.c b/src/main/Coord.c
index 73c5fb22..5fcb7637 100644
--- a/src/main/Coord.c
+++ b/src/main/Coord.c
@@ -66,7 +66,7 @@ static int num_coords = 0;
@@*/
-int CCTK_RegisterCoord_ByIndex(const char *name, int index, int dir)
+int CCTK_RegisterCoordI(const char *name, int index, int dir)
{
int handle;
@@ -89,12 +89,13 @@ int CCTK_RegisterCoord_ByIndex(const char *name, int index, int dir)
new_coord->name = (char *)name;
new_coord->index = index;
new_coord->direction = dir;
+ new_coord->origin = 0;
/* Remember how many methods there are */
num_coords++;
#ifdef DEBUG_COORD
- printf(" In CCTK_RegisterCoord_ByIndex\n");
+ printf(" In CCTK_RegisterCoordI\n");
printf(" -----------------------------\n");
printf(" handle %d, name %s,\n",handle,name);
printf(" index %d, direction %d\n",index,dir);
@@ -130,7 +131,7 @@ int CCTK_RegisterCoord_ByIndex(const char *name, int index, int dir)
Register a GF as a coordinate with a name and
a direction.
@enddesc
- @calls CCTK_RegisterCoord_ByIndex, CCTK_VarIndex
+ @calls CCTK_RegisterCoordI, CCTK_VarIndex
@var name
@vdesc Name coordinate is registered as
@@ -175,7 +176,7 @@ int CCTK_RegisterCoord(const char *coordname,
if (index >= 0)
{
- retval = CCTK_RegisterCoord_ByIndex(coordname,index,dir);
+ retval = CCTK_RegisterCoordI(coordname,index,dir);
}
else
{
@@ -188,7 +189,7 @@ int CCTK_RegisterCoord(const char *coordname,
}
-int CCTK_GetCoordIndex(const char *name)
+int CCTK_CoordIndex(const char *name)
{
int handle;
struct Coordprops *coord;
@@ -214,9 +215,37 @@ int CCTK_GetCoordIndex(const char *name)
}
}
-void FMODIFIER FORTRAN_NAME(CCTK_GetCoordIndex)(int *handle, ONE_FORTSTRING_ARG)
+void FMODIFIER FORTRAN_NAME(CCTK_CoordIndex)(int *handle, ONE_FORTSTRING_ARG)
{
ONE_FORTSTRING_CREATE(name)
- *handle = CCTK_GetCoordIndex (name);
+ *handle = CCTK_CoordIndex (name);
free(name);
}
+
+
+CCTK_REAL CCTK_CoordOrigin(const char *name)
+{
+ int handle;
+ struct Coordprops *coord;
+
+ for (handle = 0;;handle++)
+ {
+ coord = (struct Coordprops *)CCTK_GetHandledData(coordinates, handle);
+ if (coord)
+ {
+ if (CCTK_Equals(name,(const char *)coord->name))
+ return coord->origin;
+ }
+ else
+ {
+ char *msg;
+ msg = (char *)malloc( 100*sizeof(char)+sizeof(name) );
+ sprintf(msg,"Could not find registered coordinate %s",name);
+ CCTK_WARN(2,msg);
+ if (msg) free(msg);
+ return ERROR_COORDNOTFOUND;
+ }
+
+ }
+
+}