diff options
Diffstat (limited to 'src/elliptic/Jacobian.cc')
-rw-r--r-- | src/elliptic/Jacobian.cc | 114 |
1 files changed, 39 insertions, 75 deletions
diff --git a/src/elliptic/Jacobian.cc b/src/elliptic/Jacobian.cc index 048c6ac..08d8ecc 100644 --- a/src/elliptic/Jacobian.cc +++ b/src/elliptic/Jacobian.cc @@ -4,9 +4,8 @@ // // <<<literal contents of "lapack.hh">>> // -// decode_Jacobian_type -// new_Jacobian_sparsity -// new_Jacobian_matrix +// decode_Jacobian_store_solve_method -- decode string into internal enum +// new_Jacobian -- object factory for Jacobian objects // #include <stdio.h> @@ -44,111 +43,76 @@ using jtutil::error_exit; //****************************************************************************** // -// This function decodes a character string specifying a type (derived class) -// of Jacobian, into an internal enum. +// This function decodes a character string specifying a specific type +// (derived class) of Jacobian, into an internal enum. // -enum Jacobian_type - decode_Jacobian_type(const char Jacobian_type_string[]) +enum Jacobian_store_solve_method + decode_Jacobian_store_solve_method + (const char Jacobian_store_solve_method_string[]) { -if (STRING_EQUAL(Jacobian_type_string, "dense matrix")) +if (STRING_EQUAL(Jacobian_store_solve_method_string, + "dense matrix/LAPACK")) then { - #ifdef HAVE_DENSE_JACOBIAN - return Jacobian_type__dense_matrix; + #ifdef HAVE_DENSE_JACOBIAN__LAPACK + return Jacobian__dense_matrix__LAPACK; #endif } -else if (STRING_EQUAL(Jacobian_type_string, "row-oriented sparse matrix")) +else if (STRING_EQUAL(Jacobian_store_solve_method_string, + "row-oriented sparse matrix/ILUCG")) then { - #ifdef HAVE_ROW_SPARSE_JACOBIAN - return Jacobian_type__row_sparse_matrix; + #ifdef HAVE_ROW_SPARSE_JACOBIAN__ILUCG + return Jacobian__row_sparse_matrix__ILUCG; #endif } else error_exit(ERROR_EXIT, -"decode_Jacobian_type(): unknown Jacobian_type_string=\"%s\"!\n", - Jacobian_type_string); /*NOTREACHED*/ +"decode_Jacobian_store_solve_method():\n" +" unknown Jacobian_store_solve_method_string=\"%s\"!\n", + Jacobian_store_solve_method_string); /*NOTREACHED*/ -// fall through to here ==> we recognize the matrix type, +// fall through to here ==> we recognize the matrix store_solve_method, // but it's not configured error_exit(ERROR_EXIT, "\n" -" decode_Jacobian_type():\n" -" Jacobian type \"%s\" 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" +" decode_Jacobian_store_solve_method():\n" +" Jacobian store_solve_method=\"%s\"\n" +" is not configured in this binary see \"src/include/config.hh\"\n" +" for details on what methods are configured and how to change this\n" , - Jacobian_type_string); /*NOTREACHED*/ + Jacobian_store_solve_method_string); /*NOTREACHED*/ } //****************************************************************************** // -// This function is an "object factory" for Jacobian_sparsity objects: -// it constructs and returns a pointer to a new-allocated Jacobian_sparsity -// object of the specified derived type. +// This function is an "object factory" for Jacobian objects: it constructs +// and returns a pointer to a new-allocated Jacobian object of the +// specified derived 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_sparsity* new_Jacobian_sparsity(enum Jacobian_type Jac_type, - patch_system& ps, - bool print_msg_flag /* = false */) +Jacobian* new_Jacobian(enum Jacobian_store_solve_method Jac_method, + patch_system& ps, + bool print_msg_flag /* = false */) { -switch (Jac_type) +switch (Jac_method) { -#ifdef HAVE_DENSE_JACOBIAN - case Jacobian_type__dense_matrix: - return new dense_Jacobian_sparsity(ps, print_msg_flag); +#ifdef HAVE_DENSE_JACOBIAN__LAPACK + case Jacobian__dense_matrix__LAPACK: + return new dense_Jacobian__LAPACK(ps, print_msg_flag); #endif -#ifdef HAVE_ROW_SPARSE_JACOBIAN - case Jacobian_type__row_sparse_matrix: - return new row_sparse_Jacobian_sparsity(ps, print_msg_flag); +#ifdef HAVE_ROW_SPARSE_JACOBIAN__ILUCG + case Jacobian__row_sparse_matrix__ILUCG: + return new row_sparse_Jacobian__ILUCG(ps, print_msg_flag); #endif default: error_exit(ERROR_EXIT, -"new_Jacobian_sparsity(): unknown Jacobian_type=(int)%d!\n", - Jac_type); /*NOTREACHED*/ - } -} - -//****************************************************************************** - -// -// This function is an "object factory" for Jacobian_matrix objects: -// it constructs and returns a pointer to a new-allocated Jacobian_matrix -// object of the specified derived 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_matrix* new_Jacobian_matrix(enum Jacobian_type Jac_type, - patch_system& ps, - Jacobian_sparsity& JS, - bool print_msg_flag /* = false */) -{ -switch (Jac_type) - { -#ifdef HAVE_DENSE_JACOBIAN - case Jacobian_type__dense_matrix: - return new dense_Jacobian_matrix - (ps, static_cast<dense_Jacobian_sparsity&>(JS), - print_msg_flag); -#endif - -#ifdef HAVE_ROW_SPARSE_JACOBIAN - case Jacobian_type__row_sparse_matrix: - return new row_sparse_Jacobian_matrix - (ps, static_cast<row_sparse_Jacobian_sparsity&>(JS), - print_msg_flag); -#endif - - default: - error_exit(ERROR_EXIT, -"new_Jacobian_matrix(): unknown Jacobian_type=(int)%d!\n", - Jac_type); /*NOTREACHED*/ + "new_Jacobian(): unknown method=(int)%d!\n", + int(Jac_method)); /*NOTREACHED*/ } } |