PetscScalar matrix_scalar_product (const Vector &u,
const Vector &v) const;
- /**
- * Return the partitioning of the domain space of this matrix, i.e., the
- * partitioning of the vectors this matrix has to be multiplied with.
- */
- IndexSet locally_owned_domain_indices() const;
-
- /**
- * Return the partitioning of the range space of this matrix, i.e., the
- * partitioning of the vectors that are result from matrix-vector
- * products.
- */
- IndexSet locally_owned_range_indices() const;
-
+ /**
+ * Return the partitioning of the domain space of this matrix, i.e., the
+ * partitioning of the vectors this matrix has to be multiplied with.
+ */
+ IndexSet locally_owned_domain_indices() const;
+
+ /**
+ * Return the partitioning of the range space of this matrix, i.e., the
+ * partitioning of the vectors that are result from matrix-vector
+ * products.
+ */
+ IndexSet locally_owned_range_indices() const;
+
private:
/**
PetscScalar matrix_scalar_product (const VectorBase &u,
const VectorBase &v) const;
- /**
- * Return the number of rows of this matrix.
- */
- size_t m() const;
-
- /**
- * Return the number of coloumns of this matrix.
- */
- size_t n() const;
+ /**
+ * Return the number of rows of this matrix.
+ */
+ size_t m() const;
+
+ /**
+ * Return the number of coloumns of this matrix.
+ */
+ size_t n() const;
private:
{
PetscInt n_rows, n_cols, min, max;
PetscErrorCode ierr;
- IS* rows = nullptr;
- IS* cols = nullptr;
-
+ IS *rows = nullptr;
+ IS *cols = nullptr;
+
ierr = MatGetSize (matrix, &n_rows, &n_cols);
ierr = MatGetOwnershipIS(matrix, rows, cols);
ierr = ISGetMinMax(*rows, &min, &max);
IndexSet locally_owned_domain_indices(n_rows);
locally_owned_domain_indices.add_range(min, max);
-
+
return locally_owned_domain_indices;
}
{
PetscInt n_rows, n_cols, min, max;
PetscErrorCode ierr;
- IS* rows = nullptr;
- IS* cols = nullptr;
-
+ IS *rows = nullptr;
+ IS *cols = nullptr;
+
ierr = MatGetSize (matrix, &n_rows, &n_cols);
ierr = MatGetOwnershipIS(matrix, rows, cols);
ierr = ISGetMinMax(*cols, &min, &max);
-
+
IndexSet locally_owned_range_indices(n_cols);
locally_owned_range_indices.add_range(min, max);
-
+
return locally_owned_range_indices;
}
-
+
}
}
SparseMatrix::m () const
{
PetscInt m,n;
- PetscErrorCode ierr = MatGetSize(matrix, &m, &n);
-
+ PetscErrorCode ierr = MatGetSize(matrix, &m, &n);
+
return m;
}
SparseMatrix::n () const
{
PetscInt m,n;
- PetscErrorCode ierr = MatGetSize(matrix, &m, &n);
-
+ PetscErrorCode ierr = MatGetSize(matrix, &m, &n);
+
return n;
}
-
+
// Explicit instantiations
//
template
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2015 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+// Test that it is possible to instantiate a LinearOperator object for all
+// different kinds of Trilinos matrices and vectors
+// TODO: A bit more tests...
+
+#include "../tests.h"
+
+
+#include <deal.II/lac/linear_operator.h>
+
+#include <deal.II/lac/petsc_vector.h>
+#include <deal.II/lac/petsc_sparse_matrix.h>
+
+#include <deal.II/lac/petsc_parallel_vector.h>
+#include <deal.II/lac/petsc_parallel_sparse_matrix.h>
+
+using namespace dealii;
+
+int main(int argc, char *argv[])
+{
+ Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv, 1);
+
+ initlog();
+ deallog << std::setprecision(10);
+
+ {
+ PETScWrappers::SparseMatrix a;
+ auto op_a = linear_operator<PETScWrappers::Vector>(a);
+ }
+
+ {
+ PETScWrappers::MPI::SparseMatrix a;
+ auto op_a = linear_operator<PETScWrappers::MPI::Vector>(a);
+ }
+
+
+ deallog << "OK" << std::endl;
+
+ return 0;
+}
+
+
--- /dev/null
+
+DEAL::OK