17 #ifndef __deal2__filtered_matrix_h
18 #define __deal2__filtered_matrix_h
22 #include <deal.II/base/config.h>
23 #include <deal.II/base/smartpointer.h>
24 #include <deal.II/base/thread_management.h>
25 #include <deal.II/base/memory_consumption.h>
26 #include <deal.II/lac/pointer_matrix.h>
27 #include <deal.II/lac/vector_memory.h>
33 template <
typename number>
class Vector;
208 template <
class VECTOR>
231 const size_type
index);
239 size_type
row()
const;
252 double value()
const;
286 const size_type index);
383 template <
class MATRIX>
409 template <
class MATRIX>
461 template <
class Constra
intList>
487 const bool matrix_is_symmetric)
const;
496 void vmult (VECTOR &dst,
497 const VECTOR &src)
const;
508 const VECTOR &src)
const;
523 const VECTOR &src)
const;
538 const VECTOR &src)
const;
612 const IndexValuePair &i2)
const;
620 std_cxx1x::shared_ptr<PointerMatrixBase<VECTOR> >
matrix;
664 template<
class VECTOR>
679 template<
class VECTOR>
684 return matrix->constraints[index].first;
689 template<
class VECTOR>
694 return matrix->constraints[index].first;
699 template<
class VECTOR>
704 return matrix->constraints[index].second;
709 template<
class VECTOR>
721 template<
class VECTOR>
727 accessor(matrix, index)
732 template<
class VECTOR>
742 template <
typename number>
751 template <
typename number>
760 template <
typename number>
771 template <
typename number>
777 return ! (*
this == other);
784 template <
typename number>
793 template <
typename number>
802 template <
class VECTOR>
809 return (i1.first < i2.first);
814 template <
class VECTOR>
815 template <
class MATRIX>
820 matrix.reset (new_pointer_matrix_base(m, VECTOR()));
827 template <
class VECTOR>
834 template <
class VECTOR>
846 template <
class VECTOR>
847 template <
class MATRIX>
857 template <
class VECTOR>
870 template <
class VECTOR>
881 template <
class VECTOR>
882 template <
class Constra
intList>
888 const size_type old_size = constraints.size();
889 constraints.reserve (old_size + new_constraints.size());
890 constraints.insert (constraints.end(),
891 new_constraints.begin(),
892 new_constraints.end());
895 std::inplace_merge (constraints.begin(),
896 constraints.begin()+old_size,
903 template <
class VECTOR>
909 std::vector<IndexValuePair> empty;
910 constraints.swap (empty);
915 template <
class VECTOR>
926 template <
class VECTOR>
935 tmp_vector->reinit(v);
941 (*tmp_vector)(i->first) = -i->second;
947 matrix->vmult_add(v, *tmp_vector);
950 for (i=constraints.begin(); i!=e; ++i)
953 v(i->first) = i->second;
959 template <
class VECTOR>
974 template <
class VECTOR>
987 out(i->first) = in(i->first);
993 template <
class VECTOR>
998 if (!expect_constrained_source)
1001 VECTOR *tmp_vector = mem.
alloc();
1004 tmp_vector->reinit(src,
true);
1006 pre_filter (*tmp_vector);
1008 matrix->vmult (dst, *tmp_vector);
1009 mem.
free(tmp_vector);
1013 matrix->vmult (dst, src);
1017 post_filter (src, dst);
1022 template <
class VECTOR>
1027 if (!expect_constrained_source)
1030 VECTOR *tmp_vector = mem.
alloc();
1033 tmp_vector->reinit(src,
true);
1035 pre_filter (*tmp_vector);
1037 matrix->Tvmult (dst, *tmp_vector);
1038 mem.
free(tmp_vector);
1042 matrix->Tvmult (dst, src);
1046 post_filter (src, dst);
1051 template <
class VECTOR>
1056 if (!expect_constrained_source)
1059 VECTOR *tmp_vector = mem.
alloc();
1062 tmp_vector->reinit(src,
true);
1064 pre_filter (*tmp_vector);
1066 matrix->vmult_add (dst, *tmp_vector);
1067 mem.
free(tmp_vector);
1071 matrix->vmult_add (dst, src);
1075 post_filter (src, dst);
1080 template <
class VECTOR>
1085 if (!expect_constrained_source)
1088 VECTOR *tmp_vector = mem.
alloc();
1091 tmp_vector->reinit(src,
true);
1093 pre_filter (*tmp_vector);
1095 matrix->Tvmult_add (dst, *tmp_vector);
1096 mem.
free(tmp_vector);
1100 matrix->Tvmult_add (dst, src);
1104 post_filter (src, dst);
1109 template <
class VECTOR>
1120 DEAL_II_NAMESPACE_CLOSE
void vmult(VECTOR &dst, const VECTOR &src) const
const_iterator(const FilteredMatrix< VECTOR > *matrix, const size_type index)
std::size_t memory_consumption() const
void add_constraints(const ConstraintList &new_constraints)
bool operator>(const const_iterator &) const
void initialize(const MATRIX &m, bool expect_constrained_source=false)
std::vector< IndexValuePair > constraints
bool is_finite(const double x)
bool expect_constrained_source
FilteredMatrix & operator=(const FilteredMatrix &fm)
const_iterator end() const
unsigned int global_dof_index
void Tvmult(VECTOR &dst, const VECTOR &src) const
#define Assert(cond, exc)
std::size_t memory_consumption(const T &t)
::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
bool operator()(const IndexValuePair &i1, const IndexValuePair &i2) const
void post_filter(const VECTOR &in, VECTOR &out) const
void apply_constraints(VECTOR &v, const bool matrix_is_symmetric) const
std::vector< IndexValuePair >::const_iterator const_index_value_iterator
const FilteredMatrix< VECTOR > * matrix
types::global_dof_index size_type
::ExceptionBase & ExcIteratorPastEnd()
std_cxx1x::shared_ptr< PointerMatrixBase< VECTOR > > matrix
::ExceptionBase & ExcNumberNotFinite()
bool operator<(const const_iterator &) const
void vmult_add(VECTOR &dst, const VECTOR &src) const
const_iterator begin() const
const_iterator & operator++()
void pre_filter(VECTOR &v) const
void add_constraint(const size_type i, const double v)
virtual void free(const VECTOR *const)
bool operator==(const const_iterator &) const
void Tvmult_add(VECTOR &dst, const VECTOR &src) const
bool operator!=(const const_iterator &) const
const Accessor * operator->() const
Accessor(const FilteredMatrix< VECTOR > *matrix, const size_type index)
std::pair< size_type, double > IndexValuePair
const Accessor & operator*() const