#include <base/smartpointer.h>
#include <lac/forward-declarations.h>
-#include <vector>
+#include <bvector.h>
/**
* Point-wise Vanka preconditioning.
{
public:
/**
- * Constructor.
- * Take a vector of the indices
- * of the Lagrange multiplier as
- * argument. A reference to this
- * vector will be stored, so it
- * must persist longer than the
- * Vanka object. The same is true
- * for the matrix.
+ * Constructor. Gets the matrix
+ * for preconditioning and a bit
+ * vector with entries #true# for
+ * all rows to be updated. A
+ * reference to this vector will
+ * be stored, so it must persist
+ * longer than the Vanka
+ * object. The same is true for
+ * the matrix.
*/
SparseVanka(const SparseMatrix<number>& M,
- const vector<int>& indices);
+ const bit_vector& selected);
/**
* Do the preconditioning. This
* function contains a dispatch
* Indices of Lagrange
* multipliers.
*/
- const vector<int>& indices;
+ const bit_vector& selected;
};
template<typename number>
template<typename number>
SparseVanka<number>::SparseVanka(const SparseMatrix<number>& M,
- const vector<int>& indices)
+ const bit_vector& selected)
:
- matrix(&M), indices(indices)
+ matrix(&M), selected(selected)
{}
template<typename number>
SparseVanka<number>::forward(Vector<number2>& dst,
const Vector<number2>& src) const
{
- for (unsigned int global_i=0; global_i<indices.size() ; ++global_i)
+ for (unsigned int row=0; row< matrix->m() ; ++row)
{
- unsigned int row = indices[global_i];
+ if (!selected[row])
+ continue;
+
const SparseMatrixStruct& structure = matrix->get_sparsity_pattern();
unsigned int n = structure.row_length(row);
- FullMatrix<number> A(n);
- Vector<number> b(n);
- Vector<number> x(n);
+ FullMatrix<float> A(n);
+ Vector<float> b(n);
+ Vector<float> x(n);
map<unsigned int, unsigned int> local_index;