From fdd01d1b4480c4db63c598c658c6e8616f7deb05 Mon Sep 17 00:00:00 2001 From: wolf Date: Tue, 14 Aug 2001 14:19:46 +0000 Subject: [PATCH] Remove the template argument from the MatrixTools and MatrixCreator classes. This also requires to make the IteratorRange arguments to the threaded functions be passed by value rather than by reference since they are generated as a temporary now. git-svn-id: https://svn.dealii.org/trunk@4882 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/fe/fe.h | 1 - deal.II/deal.II/include/numerics/matrices.h | 125 ++- deal.II/deal.II/source/grid/grid_generator.cc | 2 +- .../numerics/matrices.all_dimensions.cc | 526 ++++++++++ deal.II/deal.II/source/numerics/matrices.cc | 905 +++++------------- deal.II/deal.II/source/numerics/vectors.cc | 14 +- deal.II/doc/news/2001/c-3-1.html | 10 + deal.II/examples/step-3/step-3.cc | 8 +- deal.II/examples/step-4/step-4.cc | 8 +- deal.II/examples/step-5/step-5.cc | 8 +- deal.II/examples/step-6/step-6.cc | 8 +- deal.II/examples/step-7/step-7.cc | 8 +- deal.II/examples/step-8/step-8.cc | 8 +- tests/deal.II/block_matrices.cc | 8 +- tests/deal.II/filtered_matrix.cc | 2 +- tests/deal.II/matrices.cc | 6 +- tests/deal.II/wave-test-3.cc | 24 +- 17 files changed, 909 insertions(+), 762 deletions(-) create mode 100644 deal.II/deal.II/source/numerics/matrices.all_dimensions.cc diff --git a/deal.II/deal.II/include/fe/fe.h b/deal.II/deal.II/include/fe/fe.h index dd0a4d48bc..34ae55012c 100644 --- a/deal.II/deal.II/include/fe/fe.h +++ b/deal.II/deal.II/include/fe/fe.h @@ -23,7 +23,6 @@ template class FEValues; template class FEFaceValues; template class FESubfaceValues; template class FESystem; -template class MatrixCreator; /** diff --git a/deal.II/deal.II/include/numerics/matrices.h b/deal.II/deal.II/include/numerics/matrices.h index d723e3011d..91435db479 100644 --- a/deal.II/deal.II/include/numerics/matrices.h +++ b/deal.II/deal.II/include/numerics/matrices.h @@ -12,6 +12,7 @@ #include #include +#include #include @@ -29,7 +30,6 @@ template class Mapping; template class DoFHandler; template class MGDoFHandler; template class FEValues; -template class FunctionMap; @@ -183,8 +183,6 @@ template class FunctionMap; * * @author Wolfgang Bangerth, 1998, Ralf Hartmann, 2001 */ -//TODO: [WB] remove template arg and make functions static once FunctionMap is globalized -template class MatrixCreator { public: @@ -200,6 +198,7 @@ class MatrixCreator * See the general doc of this class * for more information. */ + template static void create_mass_matrix (const Mapping &mapping, const DoFHandler &dof, const Quadrature &q, @@ -211,6 +210,7 @@ class MatrixCreator * function, see above, with * @p{mapping=MappingQ1()}. */ + template static void create_mass_matrix (const DoFHandler &dof, const Quadrature &q, SparseMatrix &matrix, @@ -229,6 +229,7 @@ class MatrixCreator * See the general doc of this * class for more information. */ + template static void create_mass_matrix (const Mapping &mapping, const DoFHandler &dof, const Quadrature &q, @@ -242,6 +243,7 @@ class MatrixCreator * function, see above, with * @p{mapping=MappingQ1()}. */ + template static void create_mass_matrix (const DoFHandler &dof, const Quadrature &q, SparseMatrix &matrix, @@ -269,22 +271,38 @@ class MatrixCreator * See the general doc of this * class for more information. */ + template static void create_boundary_mass_matrix (const Mapping &mapping, const DoFHandler &dof, const Quadrature &q, SparseMatrix &matrix, - const typename FunctionMap::type &boundary_functions, + const typename FunctionMap::type &boundary_functions, Vector &rhs_vector, std::vector&dof_to_boundary_mapping, const Function * const a = 0); + /** + * Same function, but for 1d. + */ + static + void create_boundary_mass_matrix (const Mapping<1> &mapping, + const DoFHandler<1> &dof, + const Quadrature<0> &q, + SparseMatrix &matrix, + const FunctionMap<1>::type &boundary_functions, + Vector &rhs_vector, + std::vector&dof_to_boundary_mapping, + const Function<1> * const a = 0); + + /** * Calls the * @p{create_boundary_mass_matrix} * function, see above, with * @p{mapping=MappingQ1()}. */ + template static void create_boundary_mass_matrix (const DoFHandler &dof, const Quadrature &q, @@ -307,6 +325,7 @@ class MatrixCreator * See the general doc of this * class for more information. */ + template static void create_laplace_matrix (const Mapping &mapping, const DoFHandler &dof, const Quadrature &q, @@ -318,6 +337,7 @@ class MatrixCreator * function, see above, with * @p{mapping=MappingQ1()}. */ + template static void create_laplace_matrix (const DoFHandler &dof, const Quadrature &q, SparseMatrix &matrix, @@ -330,6 +350,7 @@ class MatrixCreator * See the general doc of this * class for more information. */ + template static void create_level_laplace_matrix (unsigned int level, const MGDoFHandler& dof, const Quadrature& q, @@ -350,6 +371,7 @@ class MatrixCreator * See the general doc of this * class for more information. */ + template static void create_laplace_matrix (const Mapping &mapping, const DoFHandler &dof, const Quadrature &q, @@ -363,6 +385,7 @@ class MatrixCreator * function, see above, with * @p{mapping=MappingQ1()}. */ + template static void create_laplace_matrix (const DoFHandler &dof, const Quadrature &q, SparseMatrix &matrix, @@ -378,17 +401,50 @@ class MatrixCreator private: /** * Convenience abbreviation for - * DoF handler cell iterators. - */ - typedef typename DoFHandler::active_cell_iterator active_cell_iterator; - - /** - * Pair of iterators denoting a - * half-open range. + * pairs of DoF handler cell + * iterators. This type works + * just like a + * @p{std::pair} + * but is templatized on the + * space dimension. */ - typedef std::pair IteratorRange; + template + struct IteratorRange + { + /** + * Typedef for the iterator type. + */ + typedef typename DoFHandler::active_cell_iterator active_cell_iterator; + + /** + * Abbreviation for a pair of + * iterators. + */ + typedef typename std::pair iterator_pair; + + /** + * Constructor. Initialize + * the two values by the + * given values. + */ + IteratorRange (const active_cell_iterator &first, + const active_cell_iterator &second); + + /** + * Constructor taking a pair + * of values for + * initialization. + */ + IteratorRange (const iterator_pair &ip); + + /** + * Pair of iterators denoting + * a half-open range. + */ + active_cell_iterator first, second; + }; + - /** * Version of the same function * (without suffix @p{_1}) with @@ -399,13 +455,14 @@ class MatrixCreator * used to synchronise access to * the matrix. */ + template static void create_mass_matrix_1 (const Mapping &mapping, const DoFHandler &dof, const Quadrature &q, SparseMatrix &matrix, const Function * const a, - const IteratorRange &range, + const IteratorRange range, Threads::ThreadMutex &mutex); /** @@ -418,6 +475,7 @@ class MatrixCreator * used to synchronise access to * the matrix. */ + template static void create_mass_matrix_2 (const Mapping &mapping, const DoFHandler &dof, @@ -426,7 +484,7 @@ class MatrixCreator const Function &rhs, Vector &rhs_vector, const Function * const a, - const IteratorRange &range, + const IteratorRange range, Threads::ThreadMutex &mutex); /** @@ -439,13 +497,14 @@ class MatrixCreator * used to synchronise access to * the matrix. */ + template static void create_laplace_matrix_1 (const Mapping &mapping, const DoFHandler &dof, const Quadrature &q, SparseMatrix &matrix, const Function * const a, - const IteratorRange &range, + const IteratorRange range, Threads::ThreadMutex &mutex); /** @@ -458,6 +517,7 @@ class MatrixCreator * used to synchronise access to * the matrix. */ + template static void create_laplace_matrix_2 (const Mapping &mapping, const DoFHandler &dof, @@ -466,7 +526,7 @@ class MatrixCreator const Function &rhs, Vector &rhs_vector, const Function * const a, - const IteratorRange &range, + const IteratorRange range, Threads::ThreadMutex &mutex); /** @@ -479,6 +539,7 @@ class MatrixCreator * used to synchronise access to * the matrix. */ + template static void create_boundary_mass_matrix_1 (const Mapping &mapping, const DoFHandler &dof, @@ -488,36 +549,11 @@ class MatrixCreator Vector &rhs_vector, std::vector&dof_to_boundary_mapping, const Function * const a, - const IteratorRange &range, + const IteratorRange range, Threads::ThreadMutex &mutex); }; -/* -------------- declaration of explicit specializations ------------- */ - - -template <> void MatrixCreator<1>::create_boundary_mass_matrix ( - const Mapping<1> &, - const DoFHandler<1> &, - const Quadrature<0> &, - SparseMatrix &, - const FunctionMap<1>::type&, - Vector &, - std::vector &, - const Function<1> * const); - -template <> void MatrixCreator<1>::create_boundary_mass_matrix_1 ( - const Mapping<1> &, - const DoFHandler<1> &, - const Quadrature<0> &, - SparseMatrix &, - const FunctionMap<1>::type&, - Vector &, - std::vector &, - const Function<1> * const , - const IteratorRange &, - Threads::ThreadMutex &); - /** * Provide a collection of functions operating on matrices. These include @@ -628,8 +664,7 @@ template <> void MatrixCreator<1>::create_boundary_mass_matrix_1 ( * * @author Wolfgang Bangerth, 1998, 2000 */ -template -class MatrixTools : public MatrixCreator +class MatrixTools : public MatrixCreator { public: /** diff --git a/deal.II/deal.II/source/grid/grid_generator.cc b/deal.II/deal.II/source/grid/grid_generator.cc index bbe0106d2a..1d80986179 100644 --- a/deal.II/deal.II/source/grid/grid_generator.cc +++ b/deal.II/deal.II/source/grid/grid_generator.cc @@ -757,7 +757,7 @@ void GridGenerator::laplace_transformation (Triangulation &tria, QGauss4 quadrature; - MatrixCreator::create_laplace_matrix(mapping_q1, dof_handler, quadrature, S); + MatrixCreator::create_laplace_matrix(mapping_q1, dof_handler, quadrature, S); // set up the boundary values for // the laplace problem diff --git a/deal.II/deal.II/source/numerics/matrices.all_dimensions.cc b/deal.II/deal.II/source/numerics/matrices.all_dimensions.cc new file mode 100644 index 0000000000..c712281486 --- /dev/null +++ b/deal.II/deal.II/source/numerics/matrices.all_dimensions.cc @@ -0,0 +1,526 @@ +//---------------------------- matrices.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 1998, 1999, 2000, 2001 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- matrices.cc --------------------------- + + +#include +#include +#include +#include +#include + +#include + + + +template +void +MatrixTools::apply_boundary_values (const std::map &boundary_values, + SparseMatrix &matrix, + Vector &solution, + Vector &right_hand_side, + const bool preserve_symmetry) +{ + Assert (matrix.n() == matrix.m(), + ExcDimensionsDontMatch(matrix.n(), matrix.m())); + Assert (matrix.n() == right_hand_side.size(), + ExcDimensionsDontMatch(matrix.n(), right_hand_side.size())); + Assert (matrix.n() == solution.size(), + ExcDimensionsDontMatch(matrix.n(), solution.size())); + // if no boundary values are to be applied + // simply return + if (boundary_values.size() == 0) + return; + + + std::map::const_iterator dof = boundary_values.begin(), + endd = boundary_values.end(); + const unsigned int n_dofs = matrix.m(); + const SparsityPattern &sparsity = matrix.get_sparsity_pattern(); + const unsigned int *sparsity_rowstart = sparsity.get_rowstart_indices(); + const unsigned int *sparsity_colnums = sparsity.get_column_numbers(); + + // if a diagonal entry is zero + // later, then we use another + // number instead. take it to be + // the first nonzero diagonal + // element of the matrix, or 1 if + // there is no such thing + number first_nonzero_diagonal_entry = 1; + for (unsigned int i=0; ifirst < n_dofs, ExcInternalError()); + + const unsigned int dof_number = dof->first; + // for each boundary dof: + + // set entries of this line + // to zero except for the diagonal + // entry. Note that the diagonal + // entry is always the first one + // for square matrices, i.e. + // we shall not set + // matrix.global_entry( + // sparsity_rowstart[dof.first]) + const unsigned int last = sparsity_rowstart[dof_number+1]; + for (unsigned int j=sparsity_rowstart[dof_number]+1; jsecond * matrix.diag_element(dof_number); + else + { + // use the SparseMatrix:: + // to work around a bug in + // egcs + matrix.SparseMatrix::set (dof_number, dof_number, + first_nonzero_diagonal_entry); + new_rhs = right_hand_side(dof_number) + = dof->second * first_nonzero_diagonal_entry; + }; + + + // if the user wants to have + // the symmetry of the matrix + // preserved, and if the + // sparsity pattern is + // symmetric, then do a Gauss + // elimination step with the + // present row + if (preserve_symmetry) + { + // store the only nonzero entry + // of this line for the Gauss + // elimination step + const number diagonal_entry = matrix.diag_element(dof_number); + + // we have to loop over all + // rows of the matrix which + // have a nonzero entry in + // the column which we work + // in presently. if the + // sparsity pattern is + // symmetric, then we can + // get the positions of + // these rows cheaply by + // looking at the nonzero + // column numbers of the + // present row. we need not + // look at the first entry, + // since that is the + // diagonal element and + // thus the present row + for (unsigned int j=sparsity_rowstart[dof_number]+1; jsecond; + }; +}; + + + + + +void +MatrixTools::apply_boundary_values (const std::map &boundary_values, + BlockSparseMatrix &matrix, + BlockVector &solution, + BlockVector &right_hand_side, + const bool preserve_symmetry) +{ + const unsigned int blocks = matrix.n_block_rows(); + + Assert (matrix.n() == matrix.m(), + ExcDimensionsDontMatch(matrix.n(), matrix.m())); + Assert (matrix.n() == right_hand_side.size(), + ExcDimensionsDontMatch(matrix.n(), right_hand_side.size())); + Assert (matrix.n() == solution.size(), + ExcDimensionsDontMatch(matrix.n(), solution.size())); + Assert (matrix.n_block_rows() == matrix.n_block_cols(), + ExcMatrixNotBlockSquare()); + Assert (matrix.get_sparsity_pattern().get_row_indices() == + matrix.get_sparsity_pattern().get_column_indices(), + ExcMatrixNotBlockSquare()); + Assert (matrix.get_sparsity_pattern().get_column_indices() == + solution.get_block_indices (), + ExcBlocksDontMatch ()); + Assert (matrix.get_sparsity_pattern().get_row_indices() == + right_hand_side.get_block_indices (), + ExcBlocksDontMatch ()); + + + // if no boundary values are to be applied + // simply return + if (boundary_values.size() == 0) + return; + + + std::map::const_iterator dof = boundary_values.begin(), + endd = boundary_values.end(); + const unsigned int n_dofs = matrix.m(); + const BlockSparsityPattern & + sparsity_pattern = matrix.get_sparsity_pattern(); + + // if a diagonal entry is zero + // later, then we use another + // number instead. take it to be + // the first nonzero diagonal + // element of the matrix, or 1 if + // there is no such thing + double first_nonzero_diagonal_entry = 0; + for (unsigned int diag_block=0; diag_blockfirst < n_dofs, ExcInternalError()); + + // get global index and index + // in the block in which this + // dof is located + const unsigned int dof_number = dof->first; + const std::pair + block_index = index_mapping.global_to_local (dof_number); + + // for each boundary dof: + + // set entries of this line + // to zero except for the diagonal + // entry. Note that the diagonal + // entry is always the first one + // for square matrices, i.e. + // we shall not set + // matrix.global_entry( + // sparsity_rowstart[dof.first]) + // of the diagonal block + for (unsigned int block_col=0; block_colsecond * + matrix.block(block_index.first, block_index.first) + .diag_element(block_index.second); + else + { + matrix.block(block_index.first, block_index.first) + .diag_element(block_index.second) + = first_nonzero_diagonal_entry; + new_rhs = dof->second * first_nonzero_diagonal_entry; + }; + right_hand_side.block(block_index.first)(block_index.second) + = new_rhs; + + + // if the user wants to have + // the symmetry of the matrix + // preserved, and if the + // sparsity pattern is + // symmetric, then do a Gauss + // elimination step with the + // present row. this is a + // little more complicated for + // block matrices. + if (preserve_symmetry) + { + // store the only nonzero entry + // of this line for the Gauss + // elimination step + const double diagonal_entry + = matrix.block(block_index.first,block_index.first) + .diag_element(block_index.second); + + // we have to loop over all + // rows of the matrix which + // have a nonzero entry in + // the column which we work + // in presently. if the + // sparsity pattern is + // symmetric, then we can + // get the positions of + // these rows cheaply by + // looking at the nonzero + // column numbers of the + // present row. + // + // note that if we check + // whether row @p{row} in + // block (r,c) is non-zero, + // then we have to check + // for the existence of + // column @p{row} in block + // (c,r), i.e. of the + // transpose block + for (unsigned int block_row=0; block_rowsecond; + }; +}; + + + + +// explicit instantiations + +template +void +MatrixTools::apply_boundary_values (const std::map &boundary_values, + SparseMatrix &matrix, + Vector &solution, + Vector &right_hand_side, + const bool preserve_symmetry); +template +void +MatrixTools::apply_boundary_values (const std::map &boundary_values, + SparseMatrix &matrix, + Vector &solution, + Vector &right_hand_side, + const bool preserve_symmetry); + diff --git a/deal.II/deal.II/source/numerics/matrices.cc b/deal.II/deal.II/source/numerics/matrices.cc index a9ceafe83d..8d59abe53d 100644 --- a/deal.II/deal.II/source/numerics/matrices.cc +++ b/deal.II/deal.II/source/numerics/matrices.cc @@ -13,6 +13,7 @@ #include +#include #include #include #include @@ -42,20 +43,44 @@ using namespace std; template -void MatrixCreator::create_mass_matrix (const Mapping &mapping, - const DoFHandler &dof, - const Quadrature &q, - SparseMatrix &matrix, - const Function * const coefficient) +inline +MatrixCreator::IteratorRange:: +IteratorRange (const active_cell_iterator &first, + const active_cell_iterator &second) + : + first (first), + second (second) +{}; + + + +template +inline +MatrixCreator::IteratorRange::IteratorRange (const iterator_pair &ip) + : + first (ip.first), + second (ip.second) +{}; + + + + +template +void MatrixCreator::create_mass_matrix (const Mapping &mapping, + const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function * const coefficient) { const unsigned int n_threads = multithread_info.n_default_threads; Threads::ThreadManager thread_manager; // define starting and end point // for each thread - std::vector thread_ranges - = Threads::split_range (dof.begin_active(), - dof.end(), n_threads); + typedef typename DoFHandler::active_cell_iterator active_cell_iterator; + const std::vector > + thread_ranges = Threads::split_range (dof.begin_active(), + dof.end(), n_threads); // mutex to synchronise access to // the matrix @@ -64,7 +89,7 @@ void MatrixCreator::create_mass_matrix (const Mapping &mapping, // then assemble in parallel for (unsigned int thread=0; thread::create_mass_matrix_1) + Threads::encapsulate(&MatrixCreator::template create_mass_matrix_1) .collect_args (mapping, dof, q, matrix, coefficient, thread_ranges[thread], mutex)); thread_manager.wait (); @@ -74,13 +99,13 @@ void MatrixCreator::create_mass_matrix (const Mapping &mapping, // TODO:[RH] extend this function to use vector valued coefficient functions for system elements. template -void MatrixCreator::create_mass_matrix_1 (const Mapping &mapping, - const DoFHandler &dof, - const Quadrature &q, - SparseMatrix &matrix, - const Function * const coefficient, - const IteratorRange &range, - Threads::ThreadMutex &mutex) +void MatrixCreator::create_mass_matrix_1 (const Mapping &mapping, + const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function * const coefficient, + const IteratorRange range, + Threads::ThreadMutex &mutex) { UpdateFlags update_flags = UpdateFlags(update_values | update_JxW_values); if (coefficient != 0) @@ -151,10 +176,10 @@ void MatrixCreator::create_mass_matrix_1 (const Mapping &mapping template -void MatrixCreator::create_mass_matrix (const DoFHandler &dof, - const Quadrature &q, - SparseMatrix &matrix, - const Function * const coefficient) +void MatrixCreator::create_mass_matrix (const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function * const coefficient) { Assert (DEAL_II_COMPAT_MAPPING, ExcCompatibility("mapping")); static const MappingQ1 mapping; @@ -163,20 +188,21 @@ void MatrixCreator::create_mass_matrix (const DoFHandler &dof, template -void MatrixCreator::create_mass_matrix (const Mapping &mapping, - const DoFHandler &dof, - const Quadrature &q, - SparseMatrix &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function * const coefficient) +void MatrixCreator::create_mass_matrix (const Mapping &mapping, + const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function * const coefficient) { const unsigned int n_threads = multithread_info.n_default_threads; Threads::ThreadManager thread_manager; // define starting and end point // for each thread - std::vector thread_ranges + typedef typename DoFHandler::active_cell_iterator active_cell_iterator; + std::vector > thread_ranges = Threads::split_range (dof.begin_active(), dof.end(), n_threads); @@ -187,8 +213,8 @@ void MatrixCreator::create_mass_matrix (const Mapping &mapping, // then assemble in parallel for (unsigned int thread=0; thread:: - create_mass_matrix_2) + Threads::encapsulate(&MatrixCreator::template + create_mass_matrix_2) .collect_args (mapping, dof, q, matrix, rhs, rhs_vector, coefficient, thread_ranges[thread], mutex)); @@ -200,15 +226,15 @@ void MatrixCreator::create_mass_matrix (const Mapping &mapping, // TODO:[RH] extend this function to use vector valued coefficient functions for system elements. template void -MatrixCreator::create_mass_matrix_2 (const Mapping &mapping, - const DoFHandler &dof, - const Quadrature &q, - SparseMatrix &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function * const coefficient, - const IteratorRange &range, - Threads::ThreadMutex &mutex) +MatrixCreator::create_mass_matrix_2 (const Mapping &mapping, + const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function * const coefficient, + const IteratorRange range, + Threads::ThreadMutex &mutex) { UpdateFlags update_flags = UpdateFlags(update_values | update_q_points | @@ -297,12 +323,12 @@ MatrixCreator::create_mass_matrix_2 (const Mapping &mapping, template -void MatrixCreator::create_mass_matrix (const DoFHandler &dof, - const Quadrature &q, - SparseMatrix &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function * const coefficient) +void MatrixCreator::create_mass_matrix (const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function * const coefficient) { Assert (DEAL_II_COMPAT_MAPPING, ExcCompatibility("mapping")); static const MappingQ1 mapping; @@ -312,18 +338,17 @@ void MatrixCreator::create_mass_matrix (const DoFHandler &dof, #if deal_II_dimension == 1 -template <> -void MatrixCreator<1>::create_boundary_mass_matrix (const Mapping<1> &, - const DoFHandler<1> &, - const Quadrature<0> &, - SparseMatrix &, - const FunctionMap<1>::type&, - Vector &, - std::vector &, - const Function<1> * const) +void MatrixCreator::create_boundary_mass_matrix (const Mapping<1> &, + const DoFHandler<1> &, + const Quadrature<0> &, + SparseMatrix &, + const FunctionMap<1>::type&, + Vector &, + std::vector &, + const Function<1> * const) { // what would that be in 1d? the - // identity matrix on tehe boundary + // identity matrix on the boundary // dofs? Assert (false, ExcNotImplemented()); }; @@ -335,21 +360,22 @@ void MatrixCreator<1>::create_boundary_mass_matrix (const Mapping<1> &, // TODO:[RH] extend this function to use vector valued coefficient functions for system elements. template void -MatrixCreator::create_boundary_mass_matrix (const Mapping &mapping, - const DoFHandler &dof, - const Quadrature &q, - SparseMatrix &matrix, - const typename FunctionMap::type &boundary_functions, - Vector &rhs_vector, - std::vector &dof_to_boundary_mapping, - const Function * const a) +MatrixCreator::create_boundary_mass_matrix (const Mapping &mapping, + const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const typename FunctionMap::type &boundary_functions, + Vector &rhs_vector, + std::vector &dof_to_boundary_mapping, + const Function * const a) { const unsigned int n_threads = multithread_info.n_default_threads; Threads::ThreadManager thread_manager; // define starting and end point // for each thread - std::vector thread_ranges + typedef typename DoFHandler::active_cell_iterator active_cell_iterator; + std::vector > thread_ranges = Threads::split_range (dof.begin_active(), dof.end(), n_threads); @@ -360,8 +386,8 @@ MatrixCreator::create_boundary_mass_matrix (const Mapping &mapp // then assemble in parallel for (unsigned int thread=0; thread:: - create_boundary_mass_matrix_1) + Threads::encapsulate(&MatrixCreator::template + create_boundary_mass_matrix_1) .collect_args (mapping, dof, q, matrix, boundary_functions, rhs_vector, dof_to_boundary_mapping, a, @@ -370,31 +396,10 @@ MatrixCreator::create_boundary_mass_matrix (const Mapping &mapp }; -#if deal_II_dimension == 1 - -template <> -void -MatrixCreator<1>:: -create_boundary_mass_matrix_1 (const Mapping<1> &, - const DoFHandler<1> &, - const Quadrature<0> &, - SparseMatrix &, - const FunctionMap<1>::type&, - Vector &, - std::vector &, - const Function<1> * const , - const IteratorRange &, - Threads::ThreadMutex &) -{ - Assert (false, ExcNotImplemented()); -}; - -#endif - template void -MatrixCreator:: +MatrixCreator:: create_boundary_mass_matrix_1 (const Mapping &mapping, const DoFHandler &dof, const Quadrature &q, @@ -403,7 +408,7 @@ create_boundary_mass_matrix_1 (const Mapping &mapping, Vector &rhs_vector, std::vector &dof_to_boundary_mapping, const Function * const a, - const IteratorRange &range, + const IteratorRange range, Threads::ThreadMutex &mutex) { const FiniteElement &fe = dof.get_fe(); @@ -678,8 +683,8 @@ create_boundary_mass_matrix_1 (const Mapping &mapping, rhs_vector(dof_to_boundary_mapping[dofs[j]]) += cell_vector(j); else { - // compare here for relative - // smallness + // compare here for relative + // smallness Assert (std::fabs(cell_vector(j)) <= 1e-10 * max_diag_entry, ExcInternalError()); }; @@ -689,13 +694,13 @@ create_boundary_mass_matrix_1 (const Mapping &mapping, template -void MatrixCreator::create_boundary_mass_matrix (const DoFHandler &dof, - const Quadrature &q, - SparseMatrix &matrix, - const typename FunctionMap::type &rhs, - Vector &rhs_vector, - std::vector &dof_to_boundary_mapping, - const Function * const a) +void MatrixCreator::create_boundary_mass_matrix (const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const typename FunctionMap::type &rhs, + Vector &rhs_vector, + std::vector &dof_to_boundary_mapping, + const Function * const a) { Assert (DEAL_II_COMPAT_MAPPING, ExcCompatibility("mapping")); static const MappingQ1 mapping; @@ -706,18 +711,19 @@ void MatrixCreator::create_boundary_mass_matrix (const DoFHandler template -void MatrixCreator::create_laplace_matrix (const Mapping &mapping, - const DoFHandler &dof, - const Quadrature &q, - SparseMatrix &matrix, - const Function * const coefficient) +void MatrixCreator::create_laplace_matrix (const Mapping &mapping, + const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function * const coefficient) { const unsigned int n_threads = multithread_info.n_default_threads; Threads::ThreadManager thread_manager; // define starting and end point // for each thread - std::vector thread_ranges + typedef typename DoFHandler::active_cell_iterator active_cell_iterator; + std::vector > thread_ranges = Threads::split_range (dof.begin_active(), dof.end(), n_threads); @@ -728,7 +734,8 @@ void MatrixCreator::create_laplace_matrix (const Mapping &mappin // then assemble in parallel for (unsigned int thread=0; thread::create_laplace_matrix_1) + Threads::encapsulate(&MatrixCreator::template + create_laplace_matrix_1) .collect_args (mapping, dof, q, matrix, coefficient, thread_ranges[thread], mutex)); thread_manager.wait (); @@ -738,13 +745,13 @@ void MatrixCreator::create_laplace_matrix (const Mapping &mappin // TODO:[RH] extend this function to use vector valued coefficient functions for system elements. template -void MatrixCreator::create_laplace_matrix_1 (const Mapping &mapping, - const DoFHandler &dof, - const Quadrature &q, - SparseMatrix &matrix, - const Function * const coefficient, - const IteratorRange &range, - Threads::ThreadMutex &mutex) +void MatrixCreator::create_laplace_matrix_1 (const Mapping &mapping, + const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function * const coefficient, + const IteratorRange range, + Threads::ThreadMutex &mutex) { UpdateFlags update_flags = UpdateFlags(update_JxW_values | update_gradients); @@ -818,10 +825,10 @@ void MatrixCreator::create_laplace_matrix_1 (const Mapping &mapp template -void MatrixCreator::create_laplace_matrix (const DoFHandler &dof, - const Quadrature &q, - SparseMatrix &matrix, - const Function * const coefficient) +void MatrixCreator::create_laplace_matrix (const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function * const coefficient) { Assert (DEAL_II_COMPAT_MAPPING, ExcCompatibility("mapping")); static const MappingQ1 mapping; @@ -832,55 +839,56 @@ void MatrixCreator::create_laplace_matrix (const DoFHandler &dof, //TODO:[GK,RH] maybe recreate this function /* -template -void MatrixCreator::create_level_laplace_matrix (unsigned int level, - const MGDoFHandler &dof, - const Quadrature &q, - SparseMatrix &matrix, - const Function * const a) -{ + template + void MatrixCreator::create_level_laplace_matrix (unsigned int level, + const MGDoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function * const a) + { Vector dummy; // no entries, should give an error if accessed UpdateFlags update_flags = UpdateFlags(update_gradients | - update_JxW_values); + update_JxW_values); if (a != 0) - update_flags = UpdateFlags(update_flags | update_q_points); + update_flags = UpdateFlags(update_flags | update_q_points); const Assembler::AssemblerData data (dof, - true, false, // assemble matrix but not rhs - matrix, dummy, - q, update_flags); + true, false, // assemble matrix but not rhs + matrix, dummy, + q, update_flags); TriaIterator > - assembler (const_cast*>(&dof.get_tria()), - dof.get_tria().begin(level)->level(), - dof.get_tria().begin(level)->index(), - &data); + assembler (const_cast*>(&dof.get_tria()), + dof.get_tria().begin(level)->level(), + dof.get_tria().begin(level)->index(), + &data); LaplaceMatrix equation (0, a); do - { - assembler->assemble (equation); - ++assembler - } + { + assembler->assemble (equation); + ++assembler + } while ( (assembler.state()==valid) && (assembler->level() == level) ); -}; + }; */ template -void MatrixCreator::create_laplace_matrix (const Mapping &mapping, - const DoFHandler &dof, - const Quadrature &q, - SparseMatrix &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function * const coefficient) +void MatrixCreator::create_laplace_matrix (const Mapping &mapping, + const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function * const coefficient) { const unsigned int n_threads = multithread_info.n_default_threads; Threads::ThreadManager thread_manager; // define starting and end point // for each thread - std::vector thread_ranges + typedef typename DoFHandler::active_cell_iterator active_cell_iterator; + std::vector > thread_ranges = Threads::split_range (dof.begin_active(), dof.end(), n_threads); @@ -891,8 +899,8 @@ void MatrixCreator::create_laplace_matrix (const Mapping &mappin // then assemble in parallel for (unsigned int thread=0; thread:: - create_laplace_matrix_2) + Threads::encapsulate(&MatrixCreator::template + create_laplace_matrix_2) .collect_args (mapping, dof, q, matrix, rhs, rhs_vector, coefficient, thread_ranges[thread], mutex)); @@ -904,15 +912,15 @@ void MatrixCreator::create_laplace_matrix (const Mapping &mappin // TODO:[RH] extend this function to use vector valued coefficient functions for system elements. template void -MatrixCreator::create_laplace_matrix_2 (const Mapping &mapping, - const DoFHandler &dof, - const Quadrature &q, - SparseMatrix &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function * const coefficient, - const IteratorRange &range, - Threads::ThreadMutex &mutex) +MatrixCreator::create_laplace_matrix_2 (const Mapping &mapping, + const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function * const coefficient, + const IteratorRange range, + Threads::ThreadMutex &mutex) { UpdateFlags update_flags = UpdateFlags(update_values | update_gradients | @@ -1005,12 +1013,12 @@ MatrixCreator::create_laplace_matrix_2 (const Mapping &mapping, template -void MatrixCreator::create_laplace_matrix (const DoFHandler &dof, - const Quadrature &q, - SparseMatrix &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function * const coefficient) +void MatrixCreator::create_laplace_matrix (const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function * const coefficient) { Assert (DEAL_II_COMPAT_MAPPING, ExcCompatibility("mapping")); static const MappingQ1 mapping; @@ -1019,517 +1027,86 @@ void MatrixCreator::create_laplace_matrix (const DoFHandler &dof, -template -template -void -MatrixTools::apply_boundary_values (const std::map &boundary_values, - SparseMatrix &matrix, - Vector &solution, - Vector &right_hand_side, - const bool preserve_symmetry) -{ - Assert (matrix.n() == matrix.m(), - ExcDimensionsDontMatch(matrix.n(), matrix.m())); - Assert (matrix.n() == right_hand_side.size(), - ExcDimensionsDontMatch(matrix.n(), right_hand_side.size())); - Assert (matrix.n() == solution.size(), - ExcDimensionsDontMatch(matrix.n(), solution.size())); - // if no boundary values are to be applied - // simply return - if (boundary_values.size() == 0) - return; - - - std::map::const_iterator dof = boundary_values.begin(), - endd = boundary_values.end(); - const unsigned int n_dofs = matrix.m(); - const SparsityPattern &sparsity = matrix.get_sparsity_pattern(); - const unsigned int *sparsity_rowstart = sparsity.get_rowstart_indices(); - const unsigned int *sparsity_colnums = sparsity.get_column_numbers(); - - // if a diagonal entry is zero - // later, then we use another - // number instead. take it to be - // the first nonzero diagonal - // element of the matrix, or 1 if - // there is no such thing - number first_nonzero_diagonal_entry = 1; - for (unsigned int i=0; ifirst < n_dofs, ExcInternalError()); - - const unsigned int dof_number = dof->first; - // for each boundary dof: - - // set entries of this line - // to zero except for the diagonal - // entry. Note that the diagonal - // entry is always the first one - // for square matrices, i.e. - // we shall not set - // matrix.global_entry( - // sparsity_rowstart[dof.first]) - const unsigned int last = sparsity_rowstart[dof_number+1]; - for (unsigned int j=sparsity_rowstart[dof_number]+1; jsecond * matrix.diag_element(dof_number); - else - { - // use the SparseMatrix:: - // to work around a bug in - // egcs - matrix.SparseMatrix::set (dof_number, dof_number, - first_nonzero_diagonal_entry); - new_rhs = right_hand_side(dof_number) - = dof->second * first_nonzero_diagonal_entry; - }; - - - // if the user wants to have - // the symmetry of the matrix - // preserved, and if the - // sparsity pattern is - // symmetric, then do a Gauss - // elimination step with the - // present row - if (preserve_symmetry) - { - // store the only nonzero entry - // of this line for the Gauss - // elimination step - const number diagonal_entry = matrix.diag_element(dof_number); - - // we have to loop over all - // rows of the matrix which - // have a nonzero entry in - // the column which we work - // in presently. if the - // sparsity pattern is - // symmetric, then we can - // get the positions of - // these rows cheaply by - // looking at the nonzero - // column numbers of the - // present row. we need not - // look at the first entry, - // since that is the - // diagonal element and - // thus the present row - for (unsigned int j=sparsity_rowstart[dof_number]+1; jsecond; - }; -}; - - - - - -template -void -MatrixTools::apply_boundary_values (const std::map &boundary_values, - BlockSparseMatrix &matrix, - BlockVector &solution, - BlockVector &right_hand_side, - const bool preserve_symmetry) -{ - const unsigned int blocks = matrix.n_block_rows(); - - Assert (matrix.n() == matrix.m(), - ExcDimensionsDontMatch(matrix.n(), matrix.m())); - Assert (matrix.n() == right_hand_side.size(), - ExcDimensionsDontMatch(matrix.n(), right_hand_side.size())); - Assert (matrix.n() == solution.size(), - ExcDimensionsDontMatch(matrix.n(), solution.size())); - Assert (matrix.n_block_rows() == matrix.n_block_cols(), - ExcMatrixNotBlockSquare()); - Assert (matrix.get_sparsity_pattern().get_row_indices() == - matrix.get_sparsity_pattern().get_column_indices(), - ExcMatrixNotBlockSquare()); - Assert (matrix.get_sparsity_pattern().get_column_indices() == - solution.get_block_indices (), - ExcBlocksDontMatch ()); - Assert (matrix.get_sparsity_pattern().get_row_indices() == - right_hand_side.get_block_indices (), - ExcBlocksDontMatch ()); - - - // if no boundary values are to be applied - // simply return - if (boundary_values.size() == 0) - return; - - - std::map::const_iterator dof = boundary_values.begin(), - endd = boundary_values.end(); - const unsigned int n_dofs = matrix.m(); - const BlockSparsityPattern & - sparsity_pattern = matrix.get_sparsity_pattern(); - - // if a diagonal entry is zero - // later, then we use another - // number instead. take it to be - // the first nonzero diagonal - // element of the matrix, or 1 if - // there is no such thing - double first_nonzero_diagonal_entry = 0; - for (unsigned int diag_block=0; diag_blockfirst < n_dofs, ExcInternalError()); - - // get global index and index - // in the block in which this - // dof is located - const unsigned int dof_number = dof->first; - const std::pair - block_index = index_mapping.global_to_local (dof_number); - - // for each boundary dof: - - // set entries of this line - // to zero except for the diagonal - // entry. Note that the diagonal - // entry is always the first one - // for square matrices, i.e. - // we shall not set - // matrix.global_entry( - // sparsity_rowstart[dof.first]) - // of the diagonal block - for (unsigned int block_col=0; block_colsecond * - matrix.block(block_index.first, block_index.first) - .diag_element(block_index.second); - else - { - matrix.block(block_index.first, block_index.first) - .diag_element(block_index.second) - = first_nonzero_diagonal_entry; - new_rhs = dof->second * first_nonzero_diagonal_entry; - }; - right_hand_side.block(block_index.first)(block_index.second) - = new_rhs; - - - // if the user wants to have - // the symmetry of the matrix - // preserved, and if the - // sparsity pattern is - // symmetric, then do a Gauss - // elimination step with the - // present row. this is a - // little more complicated for - // block matrices. - if (preserve_symmetry) - { - // store the only nonzero entry - // of this line for the Gauss - // elimination step - const double diagonal_entry - = matrix.block(block_index.first,block_index.first) - .diag_element(block_index.second); - - // we have to loop over all - // rows of the matrix which - // have a nonzero entry in - // the column which we work - // in presently. if the - // sparsity pattern is - // symmetric, then we can - // get the positions of - // these rows cheaply by - // looking at the nonzero - // column numbers of the - // present row. - // - // note that if we check - // whether row @p{row} in - // block (r,c) is non-zero, - // then we have to check - // for the existence of - // column @p{row} in block - // (c,r), i.e. of the - // transpose block - for (unsigned int block_row=0; block_rowsecond; - }; -}; - - // explicit instantiations -template class MatrixCreator; -template class MatrixTools; - - +template +void MatrixCreator::create_mass_matrix (const Mapping &mapping, + const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function * const coefficient); +template +void MatrixCreator::create_mass_matrix (const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function * const coefficient); +template +void MatrixCreator::create_mass_matrix (const Mapping &mapping, + const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function * const coefficient); +template +void MatrixCreator::create_mass_matrix (const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function * const coefficient); + +#if deal_II_dimension != 1 template void -MatrixTools:: -apply_boundary_values (const std::map &boundary_values, - SparseMatrix &matrix, - Vector &solution, - Vector &right_hand_side, - const bool preserve_symmetry); +MatrixCreator::create_boundary_mass_matrix (const Mapping &mapping, + const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const FunctionMap::type &boundary_functions, + Vector &rhs_vector, + std::vector &dof_to_boundary_mapping, + const Function * const a); +#endif template -void -MatrixTools:: -apply_boundary_values (const std::map &boundary_values, - SparseMatrix &matrix, - Vector &solution, - Vector &right_hand_side, - const bool preserve_symmetry); +void MatrixCreator::create_boundary_mass_matrix (const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const FunctionMap::type &rhs, + Vector &rhs_vector, + std::vector &dof_to_boundary_mapping, + const Function * const a); +template +void MatrixCreator::create_laplace_matrix (const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function * const coefficient); + +template +void MatrixCreator::create_laplace_matrix (const Mapping &mapping, + const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function * const coefficient); +template +void MatrixCreator::create_laplace_matrix (const Mapping &mapping, + const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function * const coefficient); +template +void MatrixCreator::create_laplace_matrix (const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function * const coefficient); diff --git a/deal.II/deal.II/source/numerics/vectors.cc b/deal.II/deal.II/source/numerics/vectors.cc index ca905bcf16..6893354929 100644 --- a/deal.II/deal.II/source/numerics/vectors.cc +++ b/deal.II/deal.II/source/numerics/vectors.cc @@ -400,16 +400,16 @@ void VectorTools::project (const Mapping &mapping, SparseMatrix mass_matrix (sparsity); Vector tmp (mass_matrix.n()); - MatrixCreator::create_mass_matrix (mapping, dof, quadrature, mass_matrix); + MatrixCreator::create_mass_matrix (mapping, dof, quadrature, mass_matrix); VectorTools::create_right_hand_side (mapping, dof, quadrature, function, tmp); constraints.condense (mass_matrix); constraints.condense (tmp); if (boundary_values.size() != 0) - MatrixTools::apply_boundary_values (boundary_values, - mass_matrix, vec, tmp, - true); + MatrixTools::apply_boundary_values (boundary_values, + mass_matrix, vec, tmp, + true); SolverControl control(1000,1e-16); PrimitiveVectorMemory<> memory; @@ -876,9 +876,9 @@ VectorTools::project_boundary_values (const Mapping &mapping, Vector rhs(sparsity.n_rows()); - MatrixCreator::create_boundary_mass_matrix (mapping, dof, q, - mass_matrix, boundary_functions, - rhs, dof_to_boundary_mapping); + MatrixCreator::create_boundary_mass_matrix (mapping, dof, q, + mass_matrix, boundary_functions, + rhs, dof_to_boundary_mapping); // same thing as above: if dim>=3 we need // to consider constraints diff --git a/deal.II/doc/news/2001/c-3-1.html b/deal.II/doc/news/2001/c-3-1.html index 0ca7cf63de..e195ea91b1 100644 --- a/deal.II/doc/news/2001/c-3-1.html +++ b/deal.II/doc/news/2001/c-3-1.html @@ -531,6 +531,16 @@ documentation, etc.

deal.II

    +
  1. + Changed: The MatrixCreator and MatrixTools class have lost their template + arguments. Rather, the individual functions now are templated + on their own, so the compiler can pick out the correct space + dimension on its own. +
    + (WB 2001/08/15) +

    +
  2. Extended: ConstraintMatrix::merge can now handle arguments which further constrain the present object. diff --git a/deal.II/examples/step-3/step-3.cc b/deal.II/examples/step-3/step-3.cc index f1f7379396..3bbc06d8fe 100644 --- a/deal.II/examples/step-3/step-3.cc +++ b/deal.II/examples/step-3/step-3.cc @@ -669,10 +669,10 @@ void LaplaceProblem::assemble_system () // system of equations // accordingly. This is done by the // following function call: - MatrixTools<2>::apply_boundary_values (boundary_values, - system_matrix, - solution, - system_rhs); + MatrixTools::apply_boundary_values (boundary_values, + system_matrix, + solution, + system_rhs); }; diff --git a/deal.II/examples/step-4/step-4.cc b/deal.II/examples/step-4/step-4.cc index 1998d4dfc2..7ab1d213f1 100644 --- a/deal.II/examples/step-4/step-4.cc +++ b/deal.II/examples/step-4/step-4.cc @@ -468,10 +468,10 @@ void LaplaceProblem::assemble_system () 0, BoundaryValues(), boundary_values); - MatrixTools::apply_boundary_values (boundary_values, - system_matrix, - solution, - system_rhs); + MatrixTools::apply_boundary_values (boundary_values, + system_matrix, + solution, + system_rhs); }; diff --git a/deal.II/examples/step-5/step-5.cc b/deal.II/examples/step-5/step-5.cc index dbe1414ac9..8397c531a4 100644 --- a/deal.II/examples/step-5/step-5.cc +++ b/deal.II/examples/step-5/step-5.cc @@ -571,10 +571,10 @@ void LaplaceProblem::assemble_system () 0, ZeroFunction(), boundary_values); - MatrixTools::apply_boundary_values (boundary_values, - system_matrix, - solution, - system_rhs); + MatrixTools::apply_boundary_values (boundary_values, + system_matrix, + solution, + system_rhs); }; diff --git a/deal.II/examples/step-6/step-6.cc b/deal.II/examples/step-6/step-6.cc index 71bbe914e6..e44207b5b0 100644 --- a/deal.II/examples/step-6/step-6.cc +++ b/deal.II/examples/step-6/step-6.cc @@ -578,10 +578,10 @@ void LaplaceProblem::assemble_system () 0, ZeroFunction(), boundary_values); - MatrixTools::apply_boundary_values (boundary_values, - system_matrix, - solution, - system_rhs); + MatrixTools::apply_boundary_values (boundary_values, + system_matrix, + solution, + system_rhs); }; diff --git a/deal.II/examples/step-7/step-7.cc b/deal.II/examples/step-7/step-7.cc index 8059b4162e..0f1ea66874 100644 --- a/deal.II/examples/step-7/step-7.cc +++ b/deal.II/examples/step-7/step-7.cc @@ -1020,10 +1020,10 @@ void LaplaceProblem::assemble_system () 0, Solution(), boundary_values); - MatrixTools::apply_boundary_values (boundary_values, - system_matrix, - solution, - system_rhs); + MatrixTools::apply_boundary_values (boundary_values, + system_matrix, + solution, + system_rhs); }; diff --git a/deal.II/examples/step-8/step-8.cc b/deal.II/examples/step-8/step-8.cc index 9605840eab..d2980f1311 100644 --- a/deal.II/examples/step-8/step-8.cc +++ b/deal.II/examples/step-8/step-8.cc @@ -732,10 +732,10 @@ void ElasticProblem::assemble_system () 0, ZeroFunction(dim), boundary_values); - MatrixTools::apply_boundary_values (boundary_values, - system_matrix, - solution, - system_rhs); + MatrixTools::apply_boundary_values (boundary_values, + system_matrix, + solution, + system_rhs); }; diff --git a/tests/deal.II/block_matrices.cc b/tests/deal.II/block_matrices.cc index 6334b73511..7fea52e91d 100644 --- a/tests/deal.II/block_matrices.cc +++ b/tests/deal.II/block_matrices.cc @@ -309,10 +309,10 @@ void LaplaceProblem::assemble_system () 0, ZeroFunction<2>(), boundary_values); - MatrixTools<2>::apply_boundary_values (boundary_values, - system_matrix, - solution, - system_rhs); + MatrixTools::apply_boundary_values (boundary_values, + system_matrix, + solution, + system_rhs); }; diff --git a/tests/deal.II/filtered_matrix.cc b/tests/deal.II/filtered_matrix.cc index e5fdd1a6eb..0946cbabb3 100644 --- a/tests/deal.II/filtered_matrix.cc +++ b/tests/deal.II/filtered_matrix.cc @@ -79,7 +79,7 @@ solve_eliminated (std::map &bv, Vector &u, Vector &f) { - MatrixTools::apply_boundary_values (bv, A, u, f); + MatrixTools::apply_boundary_values (bv, A, u, f); SolverControl control (1000, 1.e-10, false, false); PrimitiveVectorMemory > mem; diff --git a/tests/deal.II/matrices.cc b/tests/deal.II/matrices.cc index eb794d44b1..9816d8eb6a 100644 --- a/tests/deal.II/matrices.cc +++ b/tests/deal.II/matrices.cc @@ -82,7 +82,7 @@ check_boundary (const DoFHandler &dof, matrix.reinit (sparsity); Vector rhs (dof.n_boundary_dofs(function_map)); - MatrixTools:: + MatrixTools:: create_boundary_mass_matrix (mapping, dof, face_quadrature, matrix, function_map, rhs, @@ -168,12 +168,12 @@ check () switch (test) { case 0: - MatrixTools:: + MatrixTools:: create_mass_matrix (mapping, dof, quadrature, matrix, &coefficient); break; case 1: - MatrixTools:: + MatrixTools:: create_laplace_matrix (mapping, dof, quadrature, matrix, &coefficient); break; diff --git a/tests/deal.II/wave-test-3.cc b/tests/deal.II/wave-test-3.cc index 2d5d2b7526..7110281a81 100644 --- a/tests/deal.II/wave-test-3.cc +++ b/tests/deal.II/wave-test-3.cc @@ -5321,9 +5321,9 @@ void TimeStep_Dual::do_timestep () VectorTools::interpolate_boundary_values (*dof_handler, 0, boundary_values, boundary_value_list); - MatrixTools::apply_boundary_values (boundary_value_list, - system_matrix, v, - right_hand_side1); + MatrixTools::apply_boundary_values (boundary_value_list, + system_matrix, v, + right_hand_side1); }; const unsigned int solver_steps1 = solve (system_matrix, v, right_hand_side1); @@ -5338,9 +5338,9 @@ void TimeStep_Dual::do_timestep () }; constraints.condense (right_hand_side2); if (dim != 1) - MatrixTools::apply_boundary_values (boundary_value_list, - system_matrix, u, - right_hand_side2); + MatrixTools::apply_boundary_values (boundary_value_list, + system_matrix, u, + right_hand_side2); if (parameters.extrapolate_old_solutions) { @@ -7095,9 +7095,9 @@ assemble_vectors (right_hand_side1, right_hand_side2); VectorTools::interpolate_boundary_values (*dof_handler, 0, *(parameters.boundary_values_u), boundary_value_list); - MatrixTools::apply_boundary_values (boundary_value_list, - system_matrix, u, - right_hand_side1); + MatrixTools::apply_boundary_values (boundary_value_list, + system_matrix, u, + right_hand_side1); }; const unsigned int solver_steps1 = solve (system_matrix, u, right_hand_side1); @@ -7119,9 +7119,9 @@ assemble_vectors (right_hand_side1, right_hand_side2); VectorTools::interpolate_boundary_values (*dof_handler, 0, *(parameters.boundary_values_v), boundary_value_list); - MatrixTools::apply_boundary_values (boundary_value_list, - system_matrix, v, - right_hand_side2); + MatrixTools::apply_boundary_values (boundary_value_list, + system_matrix, v, + right_hand_side2); }; -- 2.39.5