aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2002-04-06 14:22:46 +0000
committerjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2002-04-06 14:22:46 +0000
commit5650bb039de1a0ee3dbb91743587dc89afb62bcf (patch)
treee4f860ee77f8426bab8c817b07b87c31886651ef /src
parentfef39d8c121deaa8fc4039ccda2cf315cf11ba9b (diff)
add patch_system::type_of_name()
rename "octant" --> "+xyz octant" in patch_system::name_of_type() git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@441 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src')
-rw-r--r--src/patch/patch_system.cc30
-rw-r--r--src/patch/patch_system.hh6
2 files changed, 32 insertions, 4 deletions
diff --git a/src/patch/patch_system.cc b/src/patch/patch_system.cc
index ff296df..499f578 100644
--- a/src/patch/patch_system.cc
+++ b/src/patch/patch_system.cc
@@ -16,6 +16,7 @@
//
// patch_system::N_patches_of_type
// patch_system::name_of_type
+// patch_system::type_of_name
// patch_system::patch_number_of_name
// patch_system::synchronize_ghost_zones
// patch_system::print_gridfn
@@ -24,6 +25,7 @@
#include <stdio.h>
#include <assert.h>
#include <math.h>
+#include <string.h>
#include "jt/stdc.h"
#include "jt/util.hh"
@@ -772,7 +774,7 @@ default:
// type name (a C string).
//
//static
- const char *patch_system::name_of_type(enum patch_system_type type_in)
+ const char* patch_system::name_of_type(enum patch_system_type type_in)
{
switch (type_in)
{
@@ -780,7 +782,7 @@ case full_sphere_patch_system: return "full sphere";
case plus_z_hemisphere_patch_system: return "+z hemisphere";
case plus_xy_quadrant_patch_system: return "+xy quadrant";
case plus_xz_quadrant_patch_system: return "+xz quadrant";
-case octant_patch_system: return "octant";
+case plus_xyz_octant_patch_system: return "+xyz octant";
default:
error_exit(PANIC_EXIT,
"***** patch_system::name_of_type(): bad type=(int)%d!\n"
@@ -792,6 +794,30 @@ default:
//******************************************************************************
//
+// This function encodes a human-readable type name (a C string) into
+// a patch system's type into.
+//
+//static
+ enum patch_system_type patch_system::type_of_name(const char* name_in)
+{
+if (STRING_EQUAL(name_in, "full_sphere"))
+ then return full_sphere_patch_system;
+else if (STRING_EQUAL(name_in, "+z hemisphere"))
+ then return plus_z_hemisphere_patch_system;
+else if (STRING_EQUAL(name_in, "+xy quadrant"))
+ then return plus_xy_quadrant_patch_system;
+else if (STRING_EQUAL(name_in, "+xz quadrant"))
+ then return plus_xz_quadrant_patch_system;
+else if (STRING_EQUAL(name_in, "+xyz octant"))
+ then return plus_xyz_octant_patch_system;
+else error_exit(PANIC_EXIT,
+"***** patch_system::type_of_name(): unknown name=\"%s\"!",
+ name_in); /*NOTREACHED*/
+}
+
+//******************************************************************************
+
+//
// This function finds a patch from its human-readable name, and returns
// the patch number, or does an error_exit() if no patch is found with
// the specified name.
diff --git a/src/patch/patch_system.hh b/src/patch/patch_system.hh
index 86799be..ffecf15 100644
--- a/src/patch/patch_system.hh
+++ b/src/patch/patch_system.hh
@@ -49,9 +49,11 @@ public:
static
int N_patches_of_type(enum patch_system_type type_in);
- // decode patch system type into human-readable character-string name
+ // patch system type <--> human-readable character-string name
static
- const char *name_of_type(enum patch_system_type type_in);
+ const char* name_of_type(enum patch_system_type type_in);
+ static
+ enum patch_system_type type_of_name(const char* name_in);
//