void AdvectionProblem<dim>::run ()
{
GridGenerator::hyper_cube (triangulation);
- triangulation.refine_global (2);
+ triangulation.refine_global (4-dim);
// manually refine the first two cells to
// create some hanging nodes
{
typename DoFHandler<dim>::active_cell_iterator cell = dof_handler.begin_active();
cell->set_refine_flag();
- cell++;
+ }
+ triangulation.execute_coarsening_and_refinement();
+ {
+ typename DoFHandler<dim>::active_cell_iterator cell = dof_handler.last();
cell->set_refine_flag();
}
triangulation.execute_coarsening_and_refinement();
DEAL::
DEAL::
-DEAL:: Number of active cells: 22
-DEAL:: Number of degrees of freedom: 228
-DEAL:: Number of constraints : 18
-DEAL:: Reference matrix nonzeros: 6700, actually: 1254
-DEAL:: Test matrix 1 nonzeros: 6700, actually: 1254
+DEAL:: Number of active cells: 28
+DEAL:: Number of degrees of freedom: 298
+DEAL:: Number of constraints : 48
+DEAL:: Reference matrix nonzeros: 9084, actually: 1744
+DEAL:: Test matrix 1 nonzeros: 9084, actually: 1748
DEAL:: Matrix difference norm: 0
DEAL:: RHS difference norm: 0
-DEAL:: Test matrix 2 nonzeros: 6700, actually: 1254
+DEAL:: Test matrix 2 nonzeros: 9084, actually: 1748
DEAL:: Matrix difference norm: 0
DEAL:: RHS difference norm: 0
DEAL::
DEAL::
-DEAL:: Number of active cells: 78
-DEAL:: Number of degrees of freedom: 1856
-DEAL:: Number of constraints : 174
-DEAL:: Reference matrix nonzeros: 189772, actually: 24098
-DEAL:: Test matrix 1 nonzeros: 189772, actually: 24194
+DEAL:: Number of active cells: 64
+DEAL:: Number of degrees of freedom: 1602
+DEAL:: Number of constraints : 288
+DEAL:: Reference matrix nonzeros: 165476, actually: 19180
+DEAL:: Test matrix 1 nonzeros: 165476, actually: 19256
DEAL:: Matrix difference norm: 0
DEAL:: RHS difference norm: 0
-DEAL:: Test matrix 2 nonzeros: 189772, actually: 24108
+DEAL:: Test matrix 2 nonzeros: 165476, actually: 19170
DEAL:: Matrix difference norm: 0
DEAL:: RHS difference norm: 0
template <int dim>
void AdvectionProblem<dim>::run ()
{
- GridGenerator::hyper_cube (triangulation);
- triangulation.refine_global (2);
+ GridGenerator::hyper_ball (triangulation);
+ triangulation.refine_global (3-dim);
- // manually refine the first two cells to
- // create some hanging nodes
+ // manually refine the first two cells
+ // and then one of these cells once again
+ // to create some hanging nodes
{
typename DoFHandler<dim>::active_cell_iterator cell = dof_handler.begin_active();
cell->set_refine_flag();
- cell++;
+ }
+ triangulation.execute_coarsening_and_refinement();
+ {
+ typename DoFHandler<dim>::active_cell_iterator cell = dof_handler.last();
cell->set_refine_flag();
}
triangulation.execute_coarsening_and_refinement();
DEAL::
DEAL::
-DEAL:: Number of active cells: 22
-DEAL:: Number of degrees of freedom: 114
-DEAL:: Number of constraints : 9
-DEAL:: Reference matrix nonzeros: 1618, actually: 627
-DEAL:: Test matrix 1 nonzeros: 1618, actually: 627
+DEAL:: Number of active cells: 32
+DEAL:: Number of degrees of freedom: 159
+DEAL:: Number of constraints : 30
+DEAL:: Reference matrix nonzeros: 2499, actually: 1441
+DEAL:: Test matrix 1 nonzeros: 2499, actually: 1442
DEAL:: Matrix difference norm: 0
DEAL:: RHS difference norm: 0
-DEAL:: Test matrix 2 nonzeros: 1618, actually: 627
+DEAL:: Test matrix 2 nonzeros: 2499, actually: 1440
DEAL:: Matrix difference norm: 0
DEAL:: RHS difference norm: 0
DEAL::
DEAL::
-DEAL:: Number of active cells: 78
-DEAL:: Number of degrees of freedom: 928
-DEAL:: Number of constraints : 87
-DEAL:: Reference matrix nonzeros: 46980, actually: 12049
-DEAL:: Test matrix 1 nonzeros: 46980, actually: 12097
+DEAL:: Number of active cells: 42
+DEAL:: Number of degrees of freedom: 529
+DEAL:: Number of constraints : 234
+DEAL:: Reference matrix nonzeros: 30555, actually: 11223
+DEAL:: Test matrix 1 nonzeros: 30555, actually: 11228
DEAL:: Matrix difference norm: 0
DEAL:: RHS difference norm: 0
-DEAL:: Test matrix 2 nonzeros: 46980, actually: 12054
+DEAL:: Test matrix 2 nonzeros: 30555, actually: 11194
DEAL:: Matrix difference norm: 0
DEAL:: RHS difference norm: 0
#include <lac/solver_bicgstab.h>
#include <lac/precondition.h>
#include <lac/constraint_matrix.h>
-#include <grid/tria.h>
#include <dofs/dof_handler.h>
-#include <grid/tria_accessor.h>
-#include <grid/tria_iterator.h>
-#include <grid/grid_generator.h>
#include <dofs/dof_accessor.h>
#include <dofs/dof_tools.h>
#include <fe/fe_q.h>
#include <fe/fe_values.h>
+#include <grid/tria.h>
+#include <grid/tria_accessor.h>
+#include <grid/tria_iterator.h>
+#include <grid/grid_generator.h>
#include <numerics/vectors.h>
#include <numerics/matrices.h>
#include <numerics/data_out.h>
cell->get_dof_indices (local_dof_indices);
- constraints.distribute_local_to_global(cell_matrix, cell_rhs, local_dof_indices, system_matrix, system_rhs);
- constraints.distribute_local_to_global(cell_rhs, local_dof_indices, test, cell_matrix);
+ // use standard function with matrix and
+ // vector argument
+ constraints.distribute_local_to_global(cell_matrix, cell_rhs,
+ local_dof_indices,
+ system_matrix, system_rhs);
+
+ // now do just the right hand side (with
+ // local matrix for eliminating
+ // inhomogeneities)
+ constraints.distribute_local_to_global(cell_rhs,
+ local_dof_indices,
+ test, cell_matrix);
}
+
+ // and compare whether we really got the
+ // same right hand side vector
test -= system_rhs;
Assert (test.l2_norm() <= 1e-12, ExcInternalError());
}
else
{
GridGenerator::hyper_cube (triangulation, -1, 1);
- triangulation.refine_global (2);
+ triangulation.refine_global (4-dim);
{
typename DoFHandler<dim>::active_cell_iterator cell = dof_handler.begin_active();
cell->set_refine_flag();
- cell++;
+ }
+ triangulation.execute_coarsening_and_refinement();
+ {
+ typename DoFHandler<dim>::active_cell_iterator cell = dof_handler.last();
cell->set_refine_flag();
}
- triangulation.execute_coarsening_and_refinement();
+ triangulation.execute_coarsening_and_refinement();
}
deallog << " Number of active cells: "
DEAL::Cycle 0:
-DEAL:: Number of active cells: 22
-DEAL:: Total number of cells: 29
-DEAL:: Number of degrees of freedom: 34
-DEAL:Bicgstab::Starting value 4.8
-DEAL:Bicgstab::Convergence step 7 value 0
-DEAL:: 7 Bicgstab iterations needed to obtain convergence.
+DEAL:: Number of active cells: 28
+DEAL:: Total number of cells: 37
+DEAL:: Number of degrees of freedom: 43
+DEAL:Bicgstab::Starting value 4.9
+DEAL:Bicgstab::Convergence step 8 value 0
+DEAL:: 8 Bicgstab iterations needed to obtain convergence.
DEAL::Cycle 1:
-DEAL:: Number of active cells: 88
-DEAL:: Total number of cells: 117
-DEAL:: Number of degrees of freedom: 111
-DEAL:Bicgstab::Starting value 6.3
-DEAL:Bicgstab::Convergence step 10 value 0
-DEAL:: 10 Bicgstab iterations needed to obtain convergence.
+DEAL:: Number of active cells: 112
+DEAL:: Total number of cells: 149
+DEAL:: Number of degrees of freedom: 141
+DEAL:Bicgstab::Starting value 6.4
+DEAL:Bicgstab::Convergence step 13 value 0
+DEAL:: 13 Bicgstab iterations needed to obtain convergence.
DEAL::Cycle 2:
-DEAL:: Number of active cells: 352
-DEAL:: Total number of cells: 469
-DEAL:: Number of degrees of freedom: 397
-DEAL:Bicgstab::Starting value 8.7
-DEAL:Bicgstab::Convergence step 18 value 0
-DEAL:: 18 Bicgstab iterations needed to obtain convergence.
+DEAL:: Number of active cells: 448
+DEAL:: Total number of cells: 597
+DEAL:: Number of degrees of freedom: 505
+DEAL:Bicgstab::Starting value 8.9
+DEAL:Bicgstab::Convergence step 21 value 0
+DEAL:: 21 Bicgstab iterations needed to obtain convergence.
DEAL::Cycle 0:
-DEAL:: Number of active cells: 78
-DEAL:: Total number of cells: 89
-DEAL:: Number of degrees of freedom: 158
-DEAL:Bicgstab::Starting value 4.9
-DEAL:Bicgstab::Convergence step 7 value 0
-DEAL:: 7 Bicgstab iterations needed to obtain convergence.
+DEAL:: Number of active cells: 64
+DEAL:: Total number of cells: 73
+DEAL:: Number of degrees of freedom: 137
+DEAL:Bicgstab::Starting value 5.7
+DEAL:Bicgstab::Convergence step 8 value 0
+DEAL:: 8 Bicgstab iterations needed to obtain convergence.
DEAL::Cycle 1:
-DEAL:: Number of active cells: 624
-DEAL:: Total number of cells: 713
-DEAL:: Number of degrees of freedom: 909
-DEAL:Bicgstab::Starting value 4.9
-DEAL:Bicgstab::Convergence step 10 value 0
-DEAL:: 10 Bicgstab iterations needed to obtain convergence.
+DEAL:: Number of active cells: 512
+DEAL:: Total number of cells: 585
+DEAL:: Number of degrees of freedom: 771
+DEAL:Bicgstab::Starting value 4.8
+DEAL:Bicgstab::Convergence step 11 value 0
+DEAL:: 11 Bicgstab iterations needed to obtain convergence.
DEAL::Cycle 2:
-DEAL:: Number of active cells: 4992
-DEAL:: Total number of cells: 5705
-DEAL:: Number of degrees of freedom: 6065
-DEAL:Bicgstab::Starting value 4.9
-DEAL:Bicgstab::Convergence step 16 value 0
-DEAL:: 16 Bicgstab iterations needed to obtain convergence.
+DEAL:: Number of active cells: 4096
+DEAL:: Total number of cells: 4681
+DEAL:: Number of degrees of freedom: 5069
+DEAL:Bicgstab::Starting value 4.8
+DEAL:Bicgstab::Convergence step 18 value 0
+DEAL:: 18 Bicgstab iterations needed to obtain convergence.