From: wolf Date: Mon, 3 Sep 2001 16:51:57 +0000 (+0000) Subject: DoFTools::make_flux_sparsity_pattern for 1d. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a18e446389680f28b8a1b90ac0603a48711057c;p=dealii-svn.git DoFTools::make_flux_sparsity_pattern for 1d. git-svn-id: https://svn.dealii.org/trunk@4944 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/dofs/dof_tools.h b/deal.II/deal.II/include/dofs/dof_tools.h index 8a315a0aa9..af78450873 100644 --- a/deal.II/deal.II/include/dofs/dof_tools.h +++ b/deal.II/deal.II/include/dofs/dof_tools.h @@ -430,6 +430,13 @@ class DoFTools make_flux_sparsity_pattern (const DoFHandler &dof_handler, SparsityPattern &sparsity_pattern); + /** + * Same function, but for 1d. + */ + static void + make_flux_sparsity_pattern (const DoFHandler<1> &dof_handler, + SparsityPattern &sparsity_pattern); + /** * This function does the same as * the other with the same name, diff --git a/deal.II/deal.II/source/dofs/dof_tools.cc b/deal.II/deal.II/source/dofs/dof_tools.cc index a9c93175e6..b6850748c3 100644 --- a/deal.II/deal.II/source/dofs/dof_tools.cc +++ b/deal.II/deal.II/source/dofs/dof_tools.cc @@ -289,6 +289,7 @@ void DoFTools::make_boundary_sparsity_pattern (const DoFHandler& dof, }; + template void DoFTools::make_flux_sparsity_pattern (const DoFHandler &dof, @@ -382,6 +383,54 @@ DoFTools::make_flux_sparsity_pattern (const DoFHandler &dof, } +#if deal_II_dimension == 1 + +void +DoFTools::make_flux_sparsity_pattern (const DoFHandler<1> &dof, + SparsityPattern &sparsity) +{ + typedef DoFHandler<1>::cell_iterator cell_iterator; + typedef DoFHandler<1>::active_cell_iterator active_cell_iterator; + + const unsigned int dofs_per_cell = dof.get_fe().dofs_per_cell; + std::vector local_dof_indices (dofs_per_cell); + std::vector neighbor_dof_indices (dofs_per_cell); + + active_cell_iterator cell = dof.begin_active(), + endc = dof.end(); + for (; cell!=endc; ++cell) + { + // first do couplings of dofs + // locally on this cell + cell->get_dof_indices (local_dof_indices); + for (unsigned int i=0; iat_boundary(nb)) + { + // find active neighbor + cell_iterator neighbor = cell->neighbor(nb); + while (neighbor->has_children()) + neighbor = neighbor->child(nb==0 ? 1 : 0); + + // get dofs on it + neighbor->get_dof_indices (neighbor_dof_indices); + + // compute couplings + for (unsigned int i=0; i void diff --git a/deal.II/doc/news/2001/c-3-1.html b/deal.II/doc/news/2001/c-3-1.html index a5eb46a2bd..0fecf43917 100644 --- a/deal.II/doc/news/2001/c-3-1.html +++ b/deal.II/doc/news/2001/c-3-1.html @@ -581,6 +581,13 @@ documentation, etc.

deal.II

    +
  1. + New: DoFTools::make_flux_sparsity_pattern + now exists also for 1d. +
    + (WB 2001/09/03) +

    +
  2. New: There are now two functions