aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2002-09-11 12:06:29 +0000
committerjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2002-09-11 12:06:29 +0000
commit320d8973fd4fcba42db2c7e9e1c09a68ec49293f (patch)
tree7a0dfd59158730023382c0ca1b047a3bfaefbf9e
parentee047cd45b13344b3304f2faf3a135cc4ed9ec3c (diff)
add #define HAVE_DENSE_JACOBIAN for dense Jacobians
-- in the future there will be such a #define for each Jacobian type, so we can easily disable ones we don't want to avoid having to link against the corresponding linear-solver libraries git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@712 f88db872-0e4f-0410-b76b-b9085cfa78c5
-rw-r--r--src/elliptic/Jacobian.cc39
-rw-r--r--src/elliptic/Jacobian.hh8
-rw-r--r--src/include/config.hh7
3 files changed, 46 insertions, 8 deletions
diff --git a/src/elliptic/Jacobian.cc b/src/elliptic/Jacobian.cc
index 654b847..4a70b9e 100644
--- a/src/elliptic/Jacobian.cc
+++ b/src/elliptic/Jacobian.cc
@@ -7,11 +7,13 @@
//
// Jacobian::Jacobian
//
+#ifdef HAVE_DENSE_JACOBIAN
// dense_Jacobian::dense_Jacobian
// dense_Jacobian::~dense_Jacobian
// dense_Jacobian::zero_matrix
// dense_Jacobian::zero_row
// dense_Jacobian::solve_linear_system
+#endif
//
#include <stdio.h>
@@ -57,7 +59,7 @@ using jtutil::error_exit;
/*
* prerequisites:
* "cctk.h"
- * "config.hh" // for "integer" = Fortran integer
+ * "config.hh"
*/
#ifdef __cplusplus
@@ -122,7 +124,18 @@ 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;
+ then {
+ #ifdef HAVE_DENSE_JACOBIAN
+ return Jacobian_type__dense_matrix;
+ #else
+ error_exit(ERROR_EXIT,
+"\n"
+" decode_Jacobian_type():\n"
+" Jacobian type \"dense matrix\" is not configured in this binary;\n"
+" see \"src/include/config.hh\" for details on what Jacobian types\n"
+" are configured and how to change this\n"); /*NOTREACHED*/
+ #endif
+ }
else error_exit(ERROR_EXIT,
"decode_Jacobian_type(): unknown Jacobian_type_string=\"%s\"!\n",
Jacobian_type_string); /*NOTREACHED*/
@@ -142,9 +155,11 @@ Jacobian& new_Jacobian(patch_system& ps, enum Jacobian_type Jac_type)
{
switch (Jac_type)
{
-case Jacobian_type__dense_matrix:
+#ifdef HAVE_DENSE_JACOBIAN
+ case Jacobian_type__dense_matrix:
return *new dense_Jacobian(ps);
-default:
+#endif
+ default:
error_exit(ERROR_EXIT,
"new_Jacobian(): unknown Jacobian_type=(int)%d!\n",
Jac_type); /*NOTREACHED*/
@@ -167,6 +182,7 @@ Jacobian::Jacobian(patch_system& ps)
//******************************************************************************
//******************************************************************************
+#ifdef HAVE_DENSE_JACOBIAN
//
// This function constructs a dense_Jacobian object.
//
@@ -177,9 +193,11 @@ dense_Jacobian::dense_Jacobian(patch_system& ps)
iwork_(new integer[NN()]),
rwork_(new fp[4*NN()]) // no comma
{ }
+#endif
//******************************************************************************
+#ifdef HAVE_DENSE_JACOBIAN
//
// THis function destroys a dense_Jacobian object.
//
@@ -189,9 +207,11 @@ delete[] iwork_;
delete[] rwork_;
delete[] pivot_;
}
+#endif
//******************************************************************************
+#ifdef HAVE_DENSE_JACOBIAN
//
// This function zeros a dense_Jacobian object.
//
@@ -205,9 +225,11 @@ void dense_Jacobian::zero_matrix()
}
}
}
+#endif
//******************************************************************************
+#ifdef HAVE_DENSE_JACOBIAN
//
// This function zeros a single row of a dense_Jacobian object.
//
@@ -218,14 +240,16 @@ void dense_Jacobian::zero_row(int II)
operator()(II,JJ) = 0.0;
}
}
+#endif
//******************************************************************************
+#ifdef HAVE_DENSE_JACOBIAN
//
// This function solves the linear system J.x = rhs, with rhs and x
-// being nominal-grid gridfns, using LU decomposition. It returns the
-// estimated infinity-norm condition number of the linear system, or
-// 0.0 if the matrix is numerically singular
+// being nominal-grid gridfns, using LAPACK LU-decomposition routines.
+// It returns the estimated infinity-norm condition number of the linear
+// system, or 0.0 if the matrix is numerically singular
//
fp dense_Jacobian::solve_linear_system(int rhs_gfn, int x_gfn)
{
@@ -299,3 +323,4 @@ if (rcond == 0.0)
// *** (singular matrix)
return 1.0/rcond;
}
+#endif
diff --git a/src/elliptic/Jacobian.hh b/src/elliptic/Jacobian.hh
index ce9faf5..a62387c 100644
--- a/src/elliptic/Jacobian.hh
+++ b/src/elliptic/Jacobian.hh
@@ -3,7 +3,9 @@
//
// Jacobian -- abstract base class to describe a Jacobian matrix
+#ifdef HAVE_DENSE_JACOBIAN
// dense_Jacobian -- Jacobian stored as a dense matrix
+#endif
//
// decode_Jacobian_type - decode string into internal enum
// new_Jacobian - factory method
@@ -100,6 +102,7 @@ protected:
//******************************************************************************
+#ifdef HAVE_DENSE_JACOBIAN
//
// This class stores the Jacobian as a dense matrix in Fortran (column)
// order.
@@ -144,12 +147,15 @@ private:
integer *iwork_;
fp *rwork_;
};
+#endif
//******************************************************************************
enum Jacobian_type
{
- Jacobian_type__dense_matrix // no comma
+#ifdef HAVE_DENSE_JACOBIAN
+ Jacobian_type__dense_matrix // no comma on last entry in enum
+#endif
};
// decode string into internal enum
diff --git a/src/include/config.hh b/src/include/config.hh
index 2729a62..7afbc32 100644
--- a/src/include/config.hh
+++ b/src/include/config.hh
@@ -33,3 +33,10 @@ typedef CCTK_INT integer;
#else
#define FINITE_DIFF_ORDER 4
#endif
+
+//
+// What types of Jacobian matrix storage do we want to compile in
+// support for? N.b. each of these requires linking with the corresponding
+// linear-solver library; see ../make.configuration.defn for details.
+//
+#define HAVE_DENSE_JACOBIAN