aboutsummaryrefslogtreecommitdiff
path: root/src/elliptic
diff options
context:
space:
mode:
authorjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2002-09-03 15:06:48 +0000
committerjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2002-09-03 15:06:48 +0000
commit5f02fdb219dd3f5383ccf27551edd065548f1558 (patch)
treeb5a9d61176edd729c44f7d9e9b55740add077117 /src/elliptic
parentb1492906195293b3c7de84536af286433d755fba (diff)
move decoding of the Jacobian type into this directory (used to be in ../driver)
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@702 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src/elliptic')
-rw-r--r--src/elliptic/Jacobian.cc42
-rw-r--r--src/elliptic/Jacobian.hh14
2 files changed, 42 insertions, 14 deletions
diff --git a/src/elliptic/Jacobian.cc b/src/elliptic/Jacobian.cc
index 651170d..654b847 100644
--- a/src/elliptic/Jacobian.cc
+++ b/src/elliptic/Jacobian.cc
@@ -2,6 +2,7 @@
// $Id$
//
+// decode_Jacobian_type
// new_Jacobian
//
// Jacobian::Jacobian
@@ -45,13 +46,11 @@ using jtutil::error_exit;
#include "../util/patch_system.hh"
#include "Jacobian.hh"
-//
// FIXME: Cactus's CCTK_FCALL() isn't expanded in .h files (this is a bug),
// so we include the contents of "lapack.h" inline here.
-//
//#include "lapack.h"
-//
-//**************************************
+
+//***** begin "lapack.h" contents ******
/* lapack.h -- C/C++ prototypes for (some) BLAS+LAPACK+wrapper routines */
/* $Id$ */
@@ -109,13 +108,29 @@ void CCTK_FCALL
#ifdef __cplusplus
}; /* extern "C" */
#endif
-//**************************************
+//***** end "lapack.h" contents ********
//******************************************************************************
//******************************************************************************
//******************************************************************************
//
+// This function decodes a character string specifying a type (derived class)
+// of Jacobian, into an internal enum.
+//
+enum Jacobian_type
+ decode_Jacobian_type(const char Jacobian_type_string[])
+{
+if (STRING_EQUAL(Jacobian_type_string, "dense matrix"))
+ then return Jacobian_type__dense_matrix;
+else error_exit(ERROR_EXIT,
+"decode_Jacobian_type(): unknown Jacobian_type_string=\"%s\"!\n",
+ Jacobian_type_string); /*NOTREACHED*/
+}
+
+//******************************************************************************
+
+//
// This function is an "object factory" for Jacobians: it constructs
// and returns a new-allocated Jacobian object of a specified type.
//
@@ -123,14 +138,17 @@ void CCTK_FCALL
// the Jacobian constructors all require this to allow the
// linear solvers to directly update gridfns
//
-Jacobian& new_Jacobian(patch_system& ps,
- const char Jacobian_type[])
+Jacobian& new_Jacobian(patch_system& ps, enum Jacobian_type Jac_type)
{
-if (STRING_EQUAL(Jacobian_type, "dense matrix"))
- then return *new dense_Jacobian(ps);
-else CCTK_VWarn(-1, __LINE__, __FILE__, CCTK_THORNSTRING,
- "unknown Jacobian_type=\"%s\"!",
- Jacobian_type); /*NOTREACHED*/
+switch (Jac_type)
+ {
+case Jacobian_type__dense_matrix:
+ return *new dense_Jacobian(ps);
+default:
+ error_exit(ERROR_EXIT,
+"new_Jacobian(): unknown Jacobian_type=(int)%d!\n",
+ Jac_type); /*NOTREACHED*/
+ }
}
//******************************************************************************
diff --git a/src/elliptic/Jacobian.hh b/src/elliptic/Jacobian.hh
index d5c2e1d..ce9faf5 100644
--- a/src/elliptic/Jacobian.hh
+++ b/src/elliptic/Jacobian.hh
@@ -4,6 +4,8 @@
//
// Jacobian -- abstract base class to describe a Jacobian matrix
// dense_Jacobian -- Jacobian stored as a dense matrix
+//
+// decode_Jacobian_type - decode string into internal enum
// new_Jacobian - factory method
//
@@ -145,6 +147,14 @@ private:
//******************************************************************************
+enum Jacobian_type
+ {
+ Jacobian_type__dense_matrix // no comma
+ };
+
+// decode string into internal enum
+enum Jacobian_type
+ decode_Jacobian_type(const char Jacobian_type_string[]);
+
// construct and return new-allocated Jacobian object of specified type
-Jacobian& new_Jacobian(patch_system& ps,
- const char Jacobian_type[]);
+Jacobian& new_Jacobian(patch_system& ps, enum Jacobian_type Jac_type);