From: bangerth Date: Mon, 23 Feb 2009 14:45:30 +0000 (+0000) Subject: Implement the other add() functions needed in the ConstraintMatrix. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ff762dcedbd902cc99dd789ed8e1df4d8a58443;p=dealii-svn.git Implement the other add() functions needed in the ConstraintMatrix. git-svn-id: https://svn.dealii.org/trunk@18415 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/sparse_matrix_ez.h b/deal.II/lac/include/lac/sparse_matrix_ez.h index 1eb56f7593..77164295fd 100644 --- a/deal.II/lac/include/lac/sparse_matrix_ez.h +++ b/deal.II/lac/include/lac/sparse_matrix_ez.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors +// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -472,9 +472,102 @@ class SparseMatrixEZ : public Subscriptor * finite number an exception * is thrown. */ - void add (const unsigned int i, const unsigned int j, + void add (const unsigned int i, + const unsigned int j, const number value); + /** + * Add all elements given in a + * FullMatrix into sparse + * matrix locations given by + * indices. In other words, + * this function adds the elements in + * full_matrix to the + * respective entries in calling + * matrix, using the local-to-global + * indexing specified by + * indices for both the rows + * and the columns of the + * matrix. This function assumes a + * quadratic sparse matrix and a + * quadratic full_matrix, the usual + * situation in FE calculations. + * + * The optional parameter + * elide_zero_values can be + * used to specify whether zero + * values should be added anyway or + * these should be filtered away and + * only non-zero data is added. The + * default value is true, + * i.e., zero values won't be added + * into the matrix. + */ + template + void add (const std::vector &indices, + const FullMatrix &full_matrix, + const bool elide_zero_values = true); + + /** + * Same function as before, but now + * including the possibility to use + * rectangular full_matrices and + * different local-to-global indexing + * on rows and columns, respectively. + */ + template + void add (const std::vector &row_indices, + const std::vector &col_indices, + const FullMatrix &full_matrix, + const bool elide_zero_values = true); + + /** + * Set several elements in the + * specified row of the matrix with + * column indices as given by + * col_indices to the + * respective value. + * + * The optional parameter + * elide_zero_values can be + * used to specify whether zero + * values should be added anyway or + * these should be filtered away and + * only non-zero data is added. The + * default value is true, + * i.e., zero values won't be added + * into the matrix. + */ + template + void add (const unsigned int row, + const std::vector &col_indices, + const std::vector &values, + const bool elide_zero_values = true); + + /** + * Add an array of values given by + * values in the given + * global matrix row at columns + * specified by col_indices in the + * sparse matrix. + * + * The optional parameter + * elide_zero_values can be + * used to specify whether zero + * values should be added anyway or + * these should be filtered away and + * only non-zero data is added. The + * default value is true, + * i.e., zero values won't be added + * into the matrix. + */ + template + void add (const unsigned int row, + const unsigned int n_cols, + const unsigned int *col_indices, + const number2 *values, + const bool elide_zero_values = true); + /** * Copy the given matrix to this * one. The operation throws an @@ -1340,6 +1433,69 @@ void SparseMatrixEZ::add (const unsigned int i, } +template +template +void SparseMatrixEZ::add (const std::vector &indices, + const FullMatrix &full_matrix, + const bool elide_zero_values) +{ +//TODO: This function can surely be made more efficient + for (unsigned int i=0; i +template +void SparseMatrixEZ::add (const std::vector &row_indices, + const std::vector &col_indices, + const FullMatrix &full_matrix, + const bool elide_zero_values) +{ +//TODO: This function can surely be made more efficient + for (unsigned int i=0; i +template +void SparseMatrixEZ::add (const unsigned int row, + const std::vector &col_indices, + const std::vector &values, + const bool elide_zero_values) +{ +//TODO: This function can surely be made more efficient + for (unsigned int j=0; j +template +void SparseMatrixEZ::add (const unsigned int row, + const unsigned int n_cols, + const unsigned int *col_indices, + const number2 *values, + const bool elide_zero_values) +{ +//TODO: This function can surely be made more efficient + for (unsigned int j=0; j inline