Skip to content
Snippets Groups Projects
Commit 126d0898 authored by Max Kahnt's avatar Max Kahnt
Browse files

Use resize from dune-matrix-vector module.

parent 631447e5
Branches
No related tags found
1 merge request!19Feature/resize in matrix vector
......@@ -22,6 +22,7 @@
#include <dune/istl/bvector.hh>
#include <dune/matrix-vector/genericvectortools.hh>
#include <dune/matrix-vector/resize.hh>
#include <dune/solvers/operators/sumoperator.hh>
......@@ -49,44 +50,12 @@ struct GenericVector
//! Resize vector recursivly to size of given vector/matrix
template <class VectorTypeA, class VectorTypeB>
DUNE_DEPRECATED_MSG("Please use Dune::MatrixVector::resize instead.")
static void resize(VectorTypeA& a, const VectorTypeB& b)
{
a.resize(b.size());
typename VectorTypeB::const_iterator it = b.begin();
typename VectorTypeB::const_iterator end = b.end();
for(; it!=end; ++it)
GenericVector::resize(a[it.index()], *it);
Dune::MatrixVector::resize(a, b);
}
template <class VectorTypeA, class T, class A>
static void resize(VectorTypeA& a, const Dune::BCRSMatrix<T,A>& b)
{
a.resize(b.N());
typedef typename Dune::BCRSMatrix<T,A> VectorTypeB;
typename VectorTypeB::const_iterator it = b.begin();
typename VectorTypeB::const_iterator end = b.end();
for(; it!=end; ++it)
GenericVector::resize(a[it.index()], *(it->begin()));
}
template <class VectorTypeA, class SparseMatrixType, class LowRankMatrixType>
static void resize(VectorTypeA& a, const SumOperator<SparseMatrixType, LowRankMatrixType>& b)
{
a.resize(b.N());
typename SparseMatrixType::const_iterator it = b.sparseMatrix().begin();
typename SparseMatrixType::const_iterator end = b.sparseMatrix().end();
for(; it!=end; ++it)
GenericVector::resize(a[it.index()], *(it->begin()));
}
template <class field_type, int n, class VectorTypeB>
static void resize(Dune::FieldVector<field_type,n>& a DUNE_UNUSED, const VectorTypeB& b DUNE_UNUSED)
{}
template <int n, class VectorTypeB>
static void resize(std::bitset<n>& a DUNE_UNUSED, const VectorTypeB& b DUNE_UNUSED)
{}
//! Set vector to zero at indices that are true in bitvector recursivly
template <class VectorType, class BitVectorType>
DUNE_DEPRECATED_MSG("Please use Dune::MatrixVector::Generic::truncate instead.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment