aboutsummaryrefslogtreecommitdiff
path: root/src/elliptic/Jacobian.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/elliptic/Jacobian.cc')
-rw-r--r--src/elliptic/Jacobian.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/elliptic/Jacobian.cc b/src/elliptic/Jacobian.cc
index 58009ec..603abac 100644
--- a/src/elliptic/Jacobian.cc
+++ b/src/elliptic/Jacobian.cc
@@ -10,6 +10,8 @@
// dense_Jacobian::zero_row
// dense_Jacobian::solve_linear_system
//
+// new_Jacobian
+//
#include <stdio.h>
using std::fopen;
@@ -180,3 +182,25 @@ if (info != 0)
rhs_gfn, x_gfn,
int(info)); /*NOTREACHED*/
}
+
+//******************************************************************************
+//******************************************************************************
+//******************************************************************************
+
+//
+// This function is an "object factory" for Jacobians: it constructs
+// and returns a new-allocated Jacobian object of a specified type.
+//
+// FIXME: the patch system shouldn't really have to be non-const, but
+// 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[])
+{
+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*/
+}