From: guido Date: Wed, 14 Jun 2006 14:02:42 +0000 (+0000) Subject: example for CompressedBlockSparsityPattern X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e4c9a77e330a2ac0016ef32e64519f0550e8c81;p=dealii-svn.git example for CompressedBlockSparsityPattern git-svn-id: https://svn.dealii.org/trunk@13245 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/doxygen/.cvsignore b/deal.II/examples/doxygen/.cvsignore index 243b7093ad..043cff5be1 100644 --- a/deal.II/examples/doxygen/.cvsignore +++ b/deal.II/examples/doxygen/.cvsignore @@ -1,3 +1,4 @@ Makefile.dep block_matrix_array product_matrix +compressed_block_sparsity_pattern diff --git a/deal.II/examples/doxygen/Makefile b/deal.II/examples/doxygen/Makefile index 6ea5575bf6..422270a3e2 100644 --- a/deal.II/examples/doxygen/Makefile +++ b/deal.II/examples/doxygen/Makefile @@ -2,7 +2,7 @@ # $Id$ # Version: $Name$ # -# Copyright (C) 1998 - 2005 by the deal.II authors +# Copyright (C) 1998 - 2006 by the deal.II authors # # This file is subject to QPL and may not be distributed # without copyright and license information. Please refer @@ -12,7 +12,8 @@ ########################################################################### include ../../common/Make.global_options -all: product_matrix$(EXEEXT) block_matrix_array$(EXEEXT) +all: product_matrix$(EXEEXT) block_matrix_array$(EXEEXT) \ + compressed_block_sparsity_pattern$(EXEEXT) ###################################################################### # Compilation of source code @@ -34,6 +35,10 @@ product_matrix$(EXEEXT): product_matrix.$(OBJEXT) $(lib-lac.g) $(lib-base.g) @echo =====linking====$(MT)== $< @$(CXX) $(CXXFLAGS.g) $(LDFLAGS) -o $@ $^ $(LIBS) +compressed_block_sparsity_pattern$(EXEEXT): compressed_block_sparsity_pattern.$(OBJEXT) $(lib-deal2-2d.g) $(lib-lac.g) $(lib-base.g) + @echo =====linking====$(MT)== $< + @$(CXX) $(CXXFLAGS.g) $(LDFLAGS) -o $@ $^ $(LIBS) + ###################################################################### # Pseudo target for cleaning directory ###################################################################### diff --git a/deal.II/examples/doxygen/compressed_block_sparsity_pattern.cc b/deal.II/examples/doxygen/compressed_block_sparsity_pattern.cc new file mode 100644 index 0000000000..540215bf8b --- /dev/null +++ b/deal.II/examples/doxygen/compressed_block_sparsity_pattern.cc @@ -0,0 +1,67 @@ +//--------------------------------------------------------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2006 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. +// +//--------------------------------------------------------------------------- + +// See documentation of CompressedBlockSparsityPattern for documentation of this example + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +int main() +{ + Triangulation<2> tr; + GridGenerator::subdivided_hyper_cube(tr, 3); + tr.begin_active()->set_refine_flag(); + tr.execute_coarsening_and_refinement(); + + FE_Q<2> fe1(1); + FE_Q<2> fe2(2); + FESystem<2> fe(fe1, 2, fe2, 1); + + DoFHandler<2> dof(tr); + dof.distribute_dofs(fe); + ConstraintMatrix constraints; + DoFTools::make_hanging_node_constraints(dof, constraints); + constraints.close(); + + std::vector dofs_per_block(fe.n_blocks()); + DoFTools::count_dofs_per_block(dof, dofs_per_block); + + CompressedBlockSparsityPattern c_sparsity(fe.n_blocks(), fe.n_blocks()); + for (unsigned int i=0;i