*
* @author Wolfgang Bangerth, 2004
*/
-class SparseDirectUMFPACK : public Subscriptor
+class SparseDirectUMFPACK : public virtual Subscriptor
{
-#ifdef HAVE_UMFPACK
-
public:
/**
* Constructor. See the
* routines.
*/
std::vector<double> control;
+};
-#endif
+
+/**
+ * Wrapper for SparseDirectUMFPACK, implementing the usual
+ * preconditioner interface with functions initialize() and vmult().
+ */
+class PreconditionUMFPACK : public virtual Subscriptor,
+ private SparseDirectUMFPACK
+{
+ public:
+ /**
+ * Dummy class needed for the
+ * usual initalization interface
+ * of preconditioners.
+ */
+ class AdditionalData
+ {};
+
+
+ /**
+ * Initialize memory and call
+ * SparseDirectUMFPACK::factorize.
+ */
+ void initialize(const SparseMatrix<double> &matrix,
+ const AdditionalData = AdditionalData());
+
+ /**
+ * Preconditioner interface
+ * function. Given the source
+ * vector, returns the
+ * approximated solution of <i>Ax
+ * = b</i>.
+ */
+ void vmult (Vector<double>&, const Vector<double>&) const;
+
+ /**
+ * Not implemented but necessary
+ * for compiling.
+ */
+ void Tvmult (Vector<double>&, const Vector<double>&) const;
+
+ /**
+ * Same as vmult(), but adding to
+ * the previous solution. Not
+ * implemented yet.
+ */
+ void vmult_add (Vector<double>&, const Vector<double>&) const;
+
+ /**
+ * Not implemented but necessary
+ * for compiling.
+ */
+ void Tvmult_add (Vector<double>&, const Vector<double>&) const;
};
+
+
/*@}*/
+
#endif
+SparseDirectUMFPACK::~SparseDirectUMFPACK ()
+{
+ clear ();
+}
+
+
+void
+SparseDirectUMFPACK::
+initialize (const SparsityPattern &)
+{}
+
+
#ifdef HAVE_UMFPACK
SparseDirectUMFPACK::SparseDirectUMFPACK ()
-SparseDirectUMFPACK::~SparseDirectUMFPACK ()
-{
- clear ();
-}
-
-
void
SparseDirectUMFPACK::clear ()
{
-void
-SparseDirectUMFPACK::
-initialize (const SparsityPattern &)
-{}
-
-
-
void
SparseDirectUMFPACK::
factorize (const SparseMatrix<double> &matrix)
solve (rhs_and_solution);
}
+
+#else
+
+
+SparseDirectUMFPACK::SparseDirectUMFPACK ()
+ :
+ symbolic_decomposition (0),
+ numeric_decomposition (0),
+ control (UMFPACK_CONTROL)
+{
+ Assert(false, ExcNeedsUMFPack());
+}
+
+
+void
+SparseDirectUMFPACK::clear ()
+{
+ Assert(false, ExcNeedsUMFPack());
+}
+
+void SparseDirectUMFPACK::factorize (const SparseMatrix<double> &)
+{
+ Assert(false, ExcNeedsUMFPack());
+}
+
+void
+SparseDirectUMFPACK::solve (Vector<double> &) const
+{
+ Assert(false, ExcNeedsUMFPack());
+}
+
+void
+SparseDirectUMFPACK::solve (const SparseMatrix<double> &,
+ Vector<double> &)
+{
+ Assert(false, ExcNeedsUMFPack());
+}
+
+
#endif
+void
+PreconditionUMFPACK::initialize (const SparseMatrix<double>& M,
+ const AdditionalData)
+{
+ this->factorize(M);
+}
+
+
+void
+PreconditionUMFPACK::vmult (
+ Vector<double>& dst,
+ const Vector<double>& src) const
+{
+ dst = src;
+ this->solve(dst);
+}
+
+
+void
+PreconditionUMFPACK::Tvmult (
+ Vector<double>&,
+ const Vector<double>&) const
+{
+ Assert(false, ExcNotImplemented());
+}
+
+
+void
+PreconditionUMFPACK::vmult_add (
+ Vector<double>&,
+ const Vector<double>&) const
+{
+ Assert(false, ExcNotImplemented());
+}
+
+
+void
+PreconditionUMFPACK::Tvmult_add (
+ Vector<double>&,
+ const Vector<double>&) const
+{
+ Assert(false, ExcNotImplemented());
+}
+
+
// explicit instantiations
template
void