18 #ifndef __deal2__sparse_decomposition_templates_h
19 #define __deal2__sparse_decomposition_templates_h
22 #include <deal.II/base/memory_consumption.h>
23 #include <deal.II/base/template_constraints.h>
24 #include <deal.II/base/utilities.h>
25 #include <deal.II/lac/sparse_decomposition.h>
31 template<
typename number>
41 template<
typename number>
51 template<
typename number>
58 template<
typename number>
63 std::vector<const size_type *> tmp;
64 tmp.swap (prebuilt_lower_bound);
77 template<
typename number>
78 template <
typename somenumber>
91 (this->m()==matrix.
m()))
101 sparsity_pattern_to_use = &this->get_sparsity_pattern();
106 sparsity_pattern_to_use = &matrix_sparsity;
130 sparsity_pattern_to_use = own_sparsity;
135 typename SparsityPattern::ExcDiagonalNotOptimized());
138 std::vector<const size_type *> tmp;
139 tmp.swap (prebuilt_lower_bound);
145 template<
typename number>
146 template<
typename somenumber>
150 const double strengthen_diagonal)
154 this->strengthen_diagonal = strengthen_diagonal;
155 prebuild_lower_bound ();
162 template <
typename number>
166 typename SparsityPattern::ExcDiagonalNotOptimized());
169 std::vector<const size_type *> tmp;
170 tmp.swap (prebuilt_lower_bound);
177 template<
typename number>
182 column_numbers = this->get_sparsity_pattern().colnums;
183 const std::size_t *
const
184 rowstart_indices = this->get_sparsity_pattern().rowstart;
187 prebuilt_lower_bound.resize (N);
191 prebuilt_lower_bound[row]
193 &column_numbers[rowstart_indices[row+1]],
198 template <
typename number>
199 template <
typename somenumber>
207 const somenumber *input_ptr = matrix.
val;
208 number *this_ptr = this->val;
209 const number *
const end_ptr = this_ptr + this->n_nonzero_elements();
211 std::memcpy (this_ptr, input_ptr, this->n_nonzero_elements()*
sizeof(number));
213 for ( ; this_ptr != end_ptr; ++input_ptr, ++this_ptr)
214 *this_ptr = *input_ptr;
223 for (
size_type row=0; row<this->m(); ++row)
227 in_index = matrix.
begin(row);
228 index->value() = in_index->value();
230 while (index < this->end(row) && in_index < matrix.
end(row))
232 while (index->column() < in_index->column() && index < this->end(row))
234 while (in_index->column() < index->column() && in_index < matrix.
end(row))
237 index->value() = in_index->value();
245 template <
typename number>
249 for (
size_type row=0; row<this->m(); ++row)
255 diagonal_element = this->begin(row);
259 p = diagonal_element + 1;
260 p != this->end(row); ++p)
261 rowsum += std::fabs(p->value());
263 diagonal_element->value() += this->get_strengthen_diagonal (rowsum, row) *
270 template <
typename number>
279 DEAL_II_NAMESPACE_CLOSE
281 #endif // __deal2__sparse_decomposition_templates_h
Iterator lower_bound(Iterator first, Iterator last, const T &val)
bool use_previous_sparsity
virtual void reinit(const SparsityPattern &sparsity)
const SparsityPattern * use_this_sparsity
virtual std::size_t memory_consumption() const
#define Assert(cond, exc)
std::size_t memory_consumption(const T &t)
SparseMatrix< number > & operator=(const SparseMatrix< number > &)
const_iterator end() const
const SparsityPattern & get_sparsity_pattern() const
void decompose(const SparseMatrix< somenumber > &matrix, const double strengthen_diagonal=0.) DEAL_II_DEPRECATED
unsigned int extra_off_diagonals
size_type max_entries_per_row() const
::ExceptionBase & ExcNotImplemented()
void prebuild_lower_bound()
void copy_from(const SparseMatrix< somenumber > &matrix)
void reinit(const SparsityPattern &sparsity) DEAL_II_DEPRECATED
virtual ~SparseLUDecomposition()=0
types::global_dof_index size_type
void initialize(const SparseMatrix< somenumber > &matrix, const AdditionalData parameters)
const_iterator begin() const
virtual void strengthen_diagonal_impl()