From 0c5573417b71a720be8332d055033899bee94f75 Mon Sep 17 00:00:00 2001 From: David Wells Date: Sun, 18 Oct 2015 21:49:36 -0400 Subject: [PATCH] Use SP, not SparsityPattern, as a template type. This commit also exchanges 'SparsityPatternBase' for 'SP' for consistency. --- include/deal.II/dofs/dof_tools.h | 34 +++---- include/deal.II/lac/block_sparsity_pattern.h | 70 +++++++-------- include/deal.II/multigrid/mg_tools.h | 36 ++++---- source/dofs/dof_tools_sparsity.cc | 95 ++++++++++---------- source/multigrid/mg_tools.cc | 51 +++++------ 5 files changed, 140 insertions(+), 146 deletions(-) diff --git a/include/deal.II/dofs/dof_tools.h b/include/deal.II/dofs/dof_tools.h index 162e777101..26997f95e1 100644 --- a/include/deal.II/dofs/dof_tools.h +++ b/include/deal.II/dofs/dof_tools.h @@ -395,10 +395,10 @@ namespace DoFTools * * @ingroup constraints */ - template + template void make_sparsity_pattern (const DH &dof, - SparsityPattern &sparsity_pattern, + SP &sparsity_pattern, const ConstraintMatrix &constraints = ConstraintMatrix(), const bool keep_constrained_dofs = true, const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id); @@ -484,11 +484,11 @@ namespace DoFTools * * @ingroup constraints */ - template + template void make_sparsity_pattern (const DH &dof, const Table<2, Coupling> &coupling, - SparsityPattern &sparsity_pattern, + SP &sparsity_pattern, const ConstraintMatrix &constraints = ConstraintMatrix(), const bool keep_constrained_dofs = true, const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id); @@ -513,11 +513,11 @@ namespace DoFTools * whereas the ones that correspond to columns come from the second * DoFHandler. */ - template + template void make_sparsity_pattern (const DH &dof_row, const DH &dof_col, - SparsityPattern &sparsity); + SP &sparsity); /** * Create the sparsity pattern for boundary matrices. See the general @@ -529,11 +529,11 @@ namespace DoFTools * class that satisfies similar requirements. It is assumed that the size of * the sparsity pattern is already correct. */ - template + template void make_boundary_sparsity_pattern (const DH &dof, const std::vector &dof_to_boundary_mapping, - SparsityPattern &sparsity_pattern); + SP &sparsity_pattern); /** * Write the sparsity structure of the matrix composed of the basis @@ -551,12 +551,12 @@ namespace DoFTools * * For the type of the sparsity pattern, the same holds as said above. */ - template + template void make_boundary_sparsity_pattern (const DH &dof, const typename FunctionMap::type &boundary_ids, const std::vector &dof_to_boundary_mapping, - SparsityPattern &sparsity); + SP &sparsity); /** * Generate sparsity pattern for fluxes, i.e. formulations of the discrete @@ -566,10 +566,10 @@ namespace DoFTools * neighboring elements, the normal couplings and these extra matrix entries * are considered. */ - template + template void - make_flux_sparsity_pattern (const DH &dof_handler, - SparsityPattern &sparsity_pattern); + make_flux_sparsity_pattern (const DH &dof_handler, + SP &sparsity_pattern); /** * This function does the same as the other with the same name, but it gets @@ -578,10 +578,10 @@ namespace DoFTools * * @ingroup constraints */ - template + template void make_flux_sparsity_pattern (const DH &dof_handler, - SparsityPattern &sparsity_pattern, + SP &sparsity_pattern, const ConstraintMatrix &constraints, const bool keep_constrained_dofs = true, const types::subdomain_id subdomain_id = numbers::invalid_unsigned_int); @@ -597,10 +597,10 @@ namespace DoFTools * * @todo Not implemented for hp::DoFHandler. */ - template + template void make_flux_sparsity_pattern (const DH &dof, - SparsityPattern &sparsity, + SP &sparsity, const Table<2,Coupling> &int_mask, const Table<2,Coupling> &flux_mask); diff --git a/include/deal.II/lac/block_sparsity_pattern.h b/include/deal.II/lac/block_sparsity_pattern.h index 06c3868dfb..6c88fb7683 100644 --- a/include/deal.II/lac/block_sparsity_pattern.h +++ b/include/deal.II/lac/block_sparsity_pattern.h @@ -79,7 +79,7 @@ namespace TrilinosWrappers * @ref GlossBlockLA "Block (linear algebra)" * @author Wolfgang Bangerth, 2000, 2001 */ -template +template class BlockSparsityPatternBase : public Subscriptor { public: @@ -160,7 +160,7 @@ public: /** * Access the block with the given coordinates. */ - SparsityPatternBase & + SP & block (const size_type row, const size_type column); @@ -169,7 +169,7 @@ public: * Access the block with the given coordinates. Version for constant * objects. */ - const SparsityPatternBase & + const SP & block (const size_type row, const size_type column) const; @@ -338,7 +338,7 @@ protected: /** * Array of sparsity patterns. */ - Table<2,SmartPointer > > sub_objects; + Table<2,SmartPointer > > sub_objects; /** * Object storing and managing the transformation of row indices to indices @@ -749,11 +749,11 @@ namespace TrilinosWrappers -template +template inline -SparsityPatternBase & -BlockSparsityPatternBase::block (const size_type row, - const size_type column) +SP & +BlockSparsityPatternBase::block (const size_type row, + const size_type column) { Assert (row::block (const size_type row, -template +template inline -const SparsityPatternBase & -BlockSparsityPatternBase::block (const size_type row, - const size_type column) const +const SP & +BlockSparsityPatternBase::block (const size_type row, + const size_type column) const { Assert (row::block (const size_type row, -template +template inline const BlockIndices & -BlockSparsityPatternBase::get_row_indices () const +BlockSparsityPatternBase::get_row_indices () const { return row_indices; } -template +template inline const BlockIndices & -BlockSparsityPatternBase::get_column_indices () const +BlockSparsityPatternBase::get_column_indices () const { return column_indices; } -template +template inline void -BlockSparsityPatternBase::add (const size_type i, - const size_type j) +BlockSparsityPatternBase::add (const size_type i, + const size_type j) { // if you get an error here, are // you sure you called @@ -813,13 +813,13 @@ BlockSparsityPatternBase::add (const size_type i, -template +template template void -BlockSparsityPatternBase::add_entries (const size_type row, - ForwardIterator begin, - ForwardIterator end, - const bool indices_are_sorted) +BlockSparsityPatternBase::add_entries (const size_type row, + ForwardIterator begin, + ForwardIterator end, + const bool indices_are_sorted) { // Resize scratch arrays if (block_column_indices.size() < this->n_block_cols()) @@ -900,11 +900,11 @@ BlockSparsityPatternBase::add_entries (const size_type row, -template +template inline bool -BlockSparsityPatternBase::exists (const size_type i, - const size_type j) const +BlockSparsityPatternBase::exists (const size_type i, + const size_type j) const { // if you get an error here, are // you sure you called @@ -918,10 +918,10 @@ BlockSparsityPatternBase::exists (const size_type i, -template +template inline unsigned int -BlockSparsityPatternBase:: +BlockSparsityPatternBase:: row_length (const size_type row) const { const std::pair @@ -937,20 +937,20 @@ row_length (const size_type row) const -template +template inline -typename BlockSparsityPatternBase::size_type -BlockSparsityPatternBase::n_block_cols () const +typename BlockSparsityPatternBase::size_type +BlockSparsityPatternBase::n_block_cols () const { return columns; } -template +template inline -typename BlockSparsityPatternBase::size_type -BlockSparsityPatternBase::n_block_rows () const +typename BlockSparsityPatternBase::size_type +BlockSparsityPatternBase::n_block_rows () const { return rows; } diff --git a/include/deal.II/multigrid/mg_tools.h b/include/deal.II/multigrid/mg_tools.h index 7d21e6a88f..346ee4c430 100644 --- a/include/deal.II/multigrid/mg_tools.h +++ b/include/deal.II/multigrid/mg_tools.h @@ -81,11 +81,11 @@ namespace MGTools * There is no need to consider hanging nodes here, since only one level is * considered. */ - template + template void - make_sparsity_pattern (const DH &dof_handler, - SparsityPattern &sparsity, - const unsigned int level); + make_sparsity_pattern (const DH &dof_handler, + SP &sparsity, + const unsigned int level); /** * Make a sparsity pattern including fluxes of discontinuous Galerkin @@ -95,11 +95,11 @@ namespace MGTools * and * @ref DoFTools */ - template + template void make_flux_sparsity_pattern (const DoFHandler &dof_handler, - SparsityPattern &sparsity, - const unsigned int level); + SP &sparsity, + const unsigned int level); /** * Create sparsity pattern for the fluxes at refinement edges. The matrix @@ -107,11 +107,11 @@ namespace MGTools * * make_flux_sparsity_pattern() */ - template + template void make_flux_sparsity_pattern_edge (const DoFHandler &dof_handler, - SparsityPattern &sparsity, - const unsigned int level); + SP &sparsity, + const unsigned int level); /** * This function does the same as the other with the same name, but it gets * two additional coefficient matrices. A matrix entry will only be @@ -121,11 +121,11 @@ namespace MGTools * There is one matrix for couplings in a cell and one for the couplings * occurring in fluxes. */ - template + template void - make_flux_sparsity_pattern (const DoFHandler &dof, - SparsityPattern &sparsity, - const unsigned int level, + make_flux_sparsity_pattern (const DoFHandler &dof, + SP &sparsity, + const unsigned int level, const Table<2,DoFTools::Coupling> &int_mask, const Table<2,DoFTools::Coupling> &flux_mask); @@ -137,11 +137,11 @@ namespace MGTools * * make_flux_sparsity_pattern() */ - template + template void - make_flux_sparsity_pattern_edge (const DoFHandler &dof_handler, - SparsityPattern &sparsity, - const unsigned int level, + make_flux_sparsity_pattern_edge (const DoFHandler &dof_handler, + SP &sparsity, + const unsigned int level, const Table<2,DoFTools::Coupling> &flux_mask); /** diff --git a/source/dofs/dof_tools_sparsity.cc b/source/dofs/dof_tools_sparsity.cc index fcccfa68ca..d5de0b6878 100644 --- a/source/dofs/dof_tools_sparsity.cc +++ b/source/dofs/dof_tools_sparsity.cc @@ -50,13 +50,13 @@ DEAL_II_NAMESPACE_OPEN namespace DoFTools { - template + template void - make_sparsity_pattern (const DH &dof, - SparsityPattern &sparsity, - const ConstraintMatrix &constraints, - const bool keep_constrained_dofs, - const types::subdomain_id subdomain_id) + make_sparsity_pattern (const DH &dof, + SP &sparsity, + const ConstraintMatrix &constraints, + const bool keep_constrained_dofs, + const types::subdomain_id subdomain_id) { const types::global_dof_index n_dofs = dof.n_dofs(); (void)n_dofs; @@ -109,14 +109,14 @@ namespace DoFTools - template + template void - make_sparsity_pattern (const DH &dof, - const Table<2,Coupling> &couplings, - SparsityPattern &sparsity, - const ConstraintMatrix &constraints, - const bool keep_constrained_dofs, - const types::subdomain_id subdomain_id) + make_sparsity_pattern (const DH &dof, + const Table<2,Coupling> &couplings, + SP &sparsity, + const ConstraintMatrix &constraints, + const bool keep_constrained_dofs, + const types::subdomain_id subdomain_id) { const types::global_dof_index n_dofs = dof.n_dofs(); (void)n_dofs; @@ -224,12 +224,11 @@ namespace DoFTools - template + template void - make_sparsity_pattern ( - const DH &dof_row, - const DH &dof_col, - SparsityPattern &sparsity) + make_sparsity_pattern (const DH &dof_row, + const DH &dof_col, + SP &sparsity) { const types::global_dof_index n_dofs_row = dof_row.n_dofs(); const types::global_dof_index n_dofs_col = dof_col.n_dofs(); @@ -328,12 +327,12 @@ namespace DoFTools - template + template void - make_boundary_sparsity_pattern ( - const DH &dof, - const std::vector &dof_to_boundary_mapping, - SparsityPattern &sparsity) + make_boundary_sparsity_pattern + (const DH &dof, + const std::vector &dof_to_boundary_mapping, + SP &sparsity) { if (DH::dimension == 1) { @@ -342,10 +341,10 @@ namespace DoFTools typename DH::FunctionMap boundary_ids; boundary_ids[0] = 0; boundary_ids[1] = 0; - make_boundary_sparsity_pattern (dof, - boundary_ids, - dof_to_boundary_mapping, - sparsity); + make_boundary_sparsity_pattern (dof, + boundary_ids, + dof_to_boundary_mapping, + sparsity); return; } @@ -397,12 +396,12 @@ namespace DoFTools - template - void make_boundary_sparsity_pattern ( - const DH &dof, - const typename FunctionMap::type &boundary_ids, - const std::vector &dof_to_boundary_mapping, - SparsityPattern &sparsity) + template + void make_boundary_sparsity_pattern + (const DH &dof, + const typename FunctionMap::type &boundary_ids, + const std::vector &dof_to_boundary_mapping, + SP &sparsity) { if (DH::dimension == 1) { @@ -485,13 +484,13 @@ namespace DoFTools - template + template void make_flux_sparsity_pattern (const DH &dof, - SparsityPattern &sparsity, + SP &sparsity, const ConstraintMatrix &constraints, - const bool keep_constrained_dofs, - const types::subdomain_id subdomain_id) + const bool keep_constrained_dofs, + const types::subdomain_id subdomain_id) // TODO: QA: reduce the indentation level of this method..., Maier 2012 @@ -635,10 +634,10 @@ namespace DoFTools - template + template void - make_flux_sparsity_pattern (const DH &dof, - SparsityPattern &sparsity) + make_flux_sparsity_pattern (const DH &dof, + SP &sparsity) { ConstraintMatrix constraints; make_flux_sparsity_pattern (dof, sparsity, constraints); @@ -711,10 +710,10 @@ namespace DoFTools // implementation of the same function in namespace DoFTools for // non-hp DoFHandlers - template + template void make_flux_sparsity_pattern (const DH &dof, - SparsityPattern &sparsity, + SP &sparsity, const Table<2,Coupling> &int_mask, const Table<2,Coupling> &flux_mask) { @@ -943,12 +942,12 @@ namespace DoFTools // implementation of the same function in namespace DoFTools for // non-hp DoFHandlers - template + template void make_flux_sparsity_pattern (const dealii::hp::DoFHandler &dof, - SparsityPattern &sparsity, - const Table<2,Coupling> &int_mask, - const Table<2,Coupling> &flux_mask) + SP &sparsity, + const Table<2,Coupling> &int_mask, + const Table<2,Coupling> &flux_mask) { // while the implementation above is quite optimized and caches a // lot of data (see e.g. the int/flux_dof_mask tables), this is no @@ -1132,10 +1131,10 @@ namespace DoFTools - template + template void make_flux_sparsity_pattern (const DH &dof, - SparsityPattern &sparsity, + SP &sparsity, const Table<2,Coupling> &int_mask, const Table<2,Coupling> &flux_mask) { diff --git a/source/multigrid/mg_tools.cc b/source/multigrid/mg_tools.cc index 583410e078..7e34e6f5dc 100644 --- a/source/multigrid/mg_tools.cc +++ b/source/multigrid/mg_tools.cc @@ -535,11 +535,10 @@ namespace MGTools - template - void make_sparsity_pattern ( - const DH &dof, - SparsityPattern &sparsity, - const unsigned int level) + template + void make_sparsity_pattern (const DH &dof, + SP &sparsity, + const unsigned int level) { const types::global_dof_index n_dofs = dof.n_dofs(level); (void)n_dofs; @@ -568,12 +567,11 @@ namespace MGTools - template + template void - make_flux_sparsity_pattern ( - const DoFHandler &dof, - SparsityPattern &sparsity, - const unsigned int level) + make_flux_sparsity_pattern (const DoFHandler &dof, + SP &sparsity, + const unsigned int level) { const types::global_dof_index n_dofs = dof.n_dofs(level); (void)n_dofs; @@ -637,12 +635,11 @@ namespace MGTools - template + template void - make_flux_sparsity_pattern_edge ( - const DoFHandler &dof, - SparsityPattern &sparsity, - const unsigned int level) + make_flux_sparsity_pattern_edge (const DoFHandler &dof, + SP &sparsity, + const unsigned int level) { Assert ((level>=1) && (level + template void - make_flux_sparsity_pattern ( - const DoFHandler &dof, - SparsityPattern &sparsity, - const unsigned int level, - const Table<2,DoFTools::Coupling> &int_mask, - const Table<2,DoFTools::Coupling> &flux_mask) + make_flux_sparsity_pattern (const DoFHandler &dof, + SP &sparsity, + const unsigned int level, + const Table<2,DoFTools::Coupling> &int_mask, + const Table<2,DoFTools::Coupling> &flux_mask) { const FiniteElement &fe = dof.get_fe(); const types::global_dof_index n_dofs = dof.n_dofs(level); @@ -881,13 +877,12 @@ namespace MGTools - template + template void - make_flux_sparsity_pattern_edge ( - const DoFHandler &dof, - SparsityPattern &sparsity, - const unsigned int level, - const Table<2,DoFTools::Coupling> &flux_mask) + make_flux_sparsity_pattern_edge (const DoFHandler &dof, + SP &sparsity, + const unsigned int level, + const Table<2,DoFTools::Coupling> &flux_mask) { const FiniteElement &fe = dof.get_fe(); const unsigned int n_comp = fe.n_components(); -- 2.39.5