#include <lac/exceptions.h>
#include <lac/petsc_matrix_base.h>
-#include <lac/block_sparsity_pattern.h>
#include <vector>
* get memory allocation right from
* the start.
*/
+ template <typename SparsityType>
SparseMatrix (const MPI_Comm &communicator,
- const CompressedSparsityPattern &sparsity_pattern,
+ const SparsityType &sparsity_pattern,
const std::vector<unsigned int> &local_rows_per_process,
const std::vector<unsigned int> &local_columns_per_process,
const unsigned int this_process,
* get memory allocation right from
* the start.
*/
- void reinit (const MPI_Comm &communicator,
- const CompressedSparsityPattern &sparsity_pattern,
+ template <typename SparsityType>
+ void reinit (const MPI_Comm &communicator,
+ const SparsityType &sparsity_pattern,
const std::vector<unsigned int> &local_rows_per_process,
const std::vector<unsigned int> &local_columns_per_process,
const unsigned int this_process,
/**
* Same as previous functions.
*/
- void do_reinit (const CompressedSparsityPattern &sparsity_pattern,
+ template <typename SparsityType>
+ void do_reinit (const SparsityType &sparsity_pattern,
const std::vector<unsigned int> &local_rows_per_process,
const std::vector<unsigned int> &local_columns_per_process,
const unsigned int this_process,
#include <base/config.h>
#include <lac/exceptions.h>
#include <lac/petsc_matrix_base.h>
-#include <lac/compressed_sparsity_pattern.h>
#include <vector>
* flag has a default value equal to
* @p false.
*/
- SparseMatrix (const CompressedSparsityPattern &sparsity_pattern,
- const bool preset_nonzero_locations = false);
+ template <typename SparsityType>
+ SparseMatrix (const SparsityType &sparsity_pattern,
+ const bool preset_nonzero_locations = false);
/**
* This operator assigns a scalar to
* flag has a default value equal to
* @p false.
*/
- void reinit (const CompressedSparsityPattern &sparsity_pattern,
- const bool preset_nonzero_locations = false);
+ template <typename SparsityType>
+ void reinit (const SparsityType &sparsity_pattern,
+ const bool preset_nonzero_locations = false);
/**
* Return a reference to the MPI
/**
* Same as previous function.
*/
- void do_reinit (const CompressedSparsityPattern &sparsity_pattern,
- const bool preset_nonzero_locations);
+ template <typename SparsityType>
+ void do_reinit (const SparsityType &sparsity_pattern,
+ const bool preset_nonzero_locations);
};
}
#include <lac/petsc_parallel_sparse_matrix.h>
#include <lac/petsc_vector.h>
+#include <lac/sparsity_pattern.h>
+#include <lac/compressed_sparsity_pattern.h>
+#include <lac/compressed_simple_sparsity_pattern.h>
+
#ifdef DEAL_II_USE_PETSC
DEAL_II_NAMESPACE_OPEN
+ template <typename SparsityType>
SparseMatrix::
SparseMatrix (const MPI_Comm &communicator,
- const CompressedSparsityPattern &sparsity_pattern,
+ const SparsityType &sparsity_pattern,
const std::vector<unsigned int> &local_rows_per_process,
const std::vector<unsigned int> &local_columns_per_process,
const unsigned int this_process,
+ template <typename SparsityType>
void
SparseMatrix::
reinit (const MPI_Comm &communicator,
- const CompressedSparsityPattern &sparsity_pattern,
+ const SparsityType &sparsity_pattern,
const std::vector<unsigned int> &local_rows_per_process,
const std::vector<unsigned int> &local_columns_per_process,
const unsigned int this_process,
+ template <typename SparsityType>
void
SparseMatrix::
- do_reinit (const CompressedSparsityPattern &sparsity_pattern,
+ do_reinit (const SparsityType &sparsity_pattern,
const std::vector<unsigned int> &local_rows_per_process,
const std::vector<unsigned int> &local_columns_per_process,
const unsigned int this_process,
//TODO: We should use the appropriate option with MatSetOption here indicating that we do not intend to add any further matrix entries. Maybe this would accelerate some things as well
}
}
+
+
+
+ // explicit instantiations
+ //
+ template
+ SparseMatrix::SparseMatrix (const MPI_Comm &,
+ const SparsityPattern &,
+ const std::vector<unsigned int> &,
+ const std::vector<unsigned int> &,
+ const unsigned int,
+ const bool);
+ template
+ SparseMatrix::SparseMatrix (const MPI_Comm &,
+ const CompressedSparsityPattern &,
+ const std::vector<unsigned int> &,
+ const std::vector<unsigned int> &,
+ const unsigned int,
+ const bool);
+ template
+ SparseMatrix::SparseMatrix (const MPI_Comm &,
+ const CompressedSimpleSparsityPattern &,
+ const std::vector<unsigned int> &,
+ const std::vector<unsigned int> &,
+ const unsigned int,
+ const bool);
+
+ template void
+ SparseMatrix::reinit (const MPI_Comm &,
+ const SparsityPattern &,
+ const std::vector<unsigned int> &,
+ const std::vector<unsigned int> &,
+ const unsigned int,
+ const bool);
+ template void
+ SparseMatrix::reinit (const MPI_Comm &,
+ const CompressedSparsityPattern &,
+ const std::vector<unsigned int> &,
+ const std::vector<unsigned int> &,
+ const unsigned int,
+ const bool);
+ template void
+ SparseMatrix::reinit (const MPI_Comm &,
+ const CompressedSimpleSparsityPattern &,
+ const std::vector<unsigned int> &,
+ const std::vector<unsigned int> &,
+ const unsigned int,
+ const bool);
+
+ template void
+ SparseMatrix::do_reinit (const SparsityPattern &,
+ const std::vector<unsigned int> &,
+ const std::vector<unsigned int> &,
+ const unsigned int ,
+ const bool);
+ template void
+ SparseMatrix::do_reinit (const CompressedSparsityPattern &,
+ const std::vector<unsigned int> &,
+ const std::vector<unsigned int> &,
+ const unsigned int ,
+ const bool);
+ template void
+ SparseMatrix::do_reinit (const CompressedSimpleSparsityPattern &,
+ const std::vector<unsigned int> &,
+ const std::vector<unsigned int> &,
+ const unsigned int ,
+ const bool);
}
}
#include <lac/petsc_sparse_matrix.h>
#include <lac/petsc_vector.h>
+#include <lac/sparsity_pattern.h>
+#include <lac/compressed_sparsity_pattern.h>
+#include <lac/compressed_simple_sparsity_pattern.h>
+
#ifdef DEAL_II_USE_PETSC
DEAL_II_NAMESPACE_OPEN
+ template <typename SparsityType>
SparseMatrix::
- SparseMatrix (const CompressedSparsityPattern &sparsity_pattern,
- const bool preset_nonzero_locations)
+ SparseMatrix (const SparsityType &sparsity_pattern,
+ const bool preset_nonzero_locations)
{
do_reinit (sparsity_pattern, preset_nonzero_locations);
}
}
+
+ template <typename SparsityType>
void
SparseMatrix::
- reinit (const CompressedSparsityPattern &sparsity_pattern,
- const bool preset_nonzero_locations)
+ reinit (const SparsityType &sparsity_pattern,
+ const bool preset_nonzero_locations)
{
// get rid of old matrix and generate a
// new one
+ template <typename SparsityType>
void
- SparseMatrix::do_reinit (const CompressedSparsityPattern &sparsity_pattern,
- const bool preset_nonzero_locations)
+ SparseMatrix::do_reinit (const SparsityType &sparsity_pattern,
+ const bool preset_nonzero_locations)
{
std::vector<unsigned int> row_lengths (sparsity_pattern.n_rows());
for (unsigned int i=0; i<sparsity_pattern.n_rows(); ++i)
compress ();
}
}
+
+
+ // Explicit instantiations
+ //
+ template
+ SparseMatrix::SparseMatrix (const SparsityPattern &,
+ const bool);
+ template
+ SparseMatrix::SparseMatrix (const CompressedSparsityPattern &,
+ const bool);
+ template
+ SparseMatrix::SparseMatrix (const CompressedSimpleSparsityPattern &,
+ const bool);
+
+ template void
+ SparseMatrix::reinit (const SparsityPattern &,
+ const bool);
+ template void
+ SparseMatrix::reinit (const CompressedSparsityPattern &,
+ const bool);
+ template void
+ SparseMatrix::reinit (const CompressedSimpleSparsityPattern &,
+ const bool);
+
+ template void
+ SparseMatrix::do_reinit (const SparsityPattern &,
+ const bool);
+ template void
+ SparseMatrix::do_reinit (const CompressedSparsityPattern &,
+ const bool);
+ template void
+ SparseMatrix::do_reinit (const CompressedSimpleSparsityPattern &,
+ const bool);
}