From 28bd060a82e7976eea55747c0fc4d78c02d31ce5 Mon Sep 17 00:00:00 2001 From: guido Date: Tue, 12 Feb 2002 12:42:44 +0000 Subject: [PATCH] matrix is long double git-svn-id: https://svn.dealii.org/trunk@5509 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/contrib/utilities/Makefile.in | 22 ++++---- deal.II/contrib/utilities/embedding.cc | 78 ++++++++++++++++---------- deal.II/contrib/utilities/simplify.pl | 8 +++ 3 files changed, 67 insertions(+), 41 deletions(-) create mode 100644 deal.II/contrib/utilities/simplify.pl diff --git a/deal.II/contrib/utilities/Makefile.in b/deal.II/contrib/utilities/Makefile.in index 72c1a97141..2a7bf3a21d 100644 --- a/deal.II/contrib/utilities/Makefile.in +++ b/deal.II/contrib/utilities/Makefile.in @@ -1,6 +1,6 @@ ############################################################ # $Id$ -# Copyright (C) 2000, 2001 by the deal.II authors +# Copyright (C) 2000, 2001, 2002 by the deal.II authors ############################################################ ############################################################ @@ -9,31 +9,31 @@ D = @DEAL2_DIR@ include $D/common/Make.global_options -debug-mode = on +debug-mode = off -libraries = $(lib-deal2-1d.g) \ - $(lib-deal2-2d.g) \ - $(lib-deal2-3d.g) \ - $(lib-lac.g) \ - $(lib-base.g) +libraries = $(lib-deal2-1d.o) \ + $(lib-deal2-2d.o) \ + $(lib-deal2-3d.o) \ + $(lib-lac.o) \ + $(lib-base.o) ############################################################ # First how to create executables, including all necessary # flags: ############################################################ -flags = $(CXXFLAGS.g) +flags = $(CXXFLAGS.o) ifeq ($(findstring gcc,$(GXX_VERSION)),gcc) flags += -Wno-missing-noreturn endif -%.o : %.cc Makefile - @echo =====optimized===== $< - @$(CXX) $(CXXFLAGS.o) -c $< -o $@ %.g.o : %.cc Makefile @echo =====debug========= $< @$(CXX) $(CXXFLAGS.g) -c $< -o $@ +%.o : %.cc Makefile + @echo =====optimized===== $< + @$(CXX) $(CXXFLAGS.o) -c $< -o $@ %.exe : @echo =====linking======= $@ @$(CXX) $(LDFLAGS) -o $@ $^ $(LIBS) diff --git a/deal.II/contrib/utilities/embedding.cc b/deal.II/contrib/utilities/embedding.cc index f04b20bf23..1cbc34ed10 100644 --- a/deal.II/contrib/utilities/embedding.cc +++ b/deal.II/contrib/utilities/embedding.cc @@ -14,8 +14,9 @@ #include #include #include +#include #include -#include +#include #include #include #include @@ -23,22 +24,32 @@ #include #include +/* + * Enter name of the finite element family here. + */ + +#define ELNAME "FE_DGP" +#define PUSH(k) FE_DGP q ## k (k);\ + elements.push_back (ElPair(&q ## k, "dgp" # k)) + + template -void compute_embedding (Triangulation& tr_coarse, +void compute_embedding (unsigned int degree, + Triangulation& tr_coarse, Triangulation& tr_fine, const FiniteElement& fe_coarse, const FiniteElement& fe_fine, const char* name) { - cerr << name << '<' << dim << '>' << endl; + deallog.push(name); DoFHandler dof_coarse(tr_coarse); dof_coarse.distribute_dofs(fe_coarse); DoFHandler dof_fine(tr_fine); dof_fine.distribute_dofs(fe_fine); - FullMatrix A(dof_fine.n_dofs()); + FullMatrix A(dof_fine.n_dofs()); Vector f(dof_fine.n_dofs()); Vector u(dof_fine.n_dofs()); vector > > @@ -50,8 +61,8 @@ void compute_embedding (Triangulation& tr_coarse, = dof_coarse.begin_active(); vector indices(fe_fine.dofs_per_cell); - MappingQ1 mapping; - QGauss q_fine(12); + MappingCartesian mapping; + QGauss q_fine(degree+1); FEValues fine (mapping, fe_fine, q_fine, update_q_points @@ -98,7 +109,7 @@ void compute_embedding (Triangulation& tr_coarse, // A.print_formatted(cout, 2, false, 4, "~", 9); FullMatrix P(A.n()); P.invert(A); - SolverControl control (100, 1.e-20, true, false); + SolverControl control (100, 1.e-24, true, false); PrimitiveVectorMemory > mem; SolverRichardson > solver(control, mem); solver.solve(A,u,f,P); @@ -117,10 +128,9 @@ void compute_embedding (Triangulation& tr_coarse, for (unsigned int cell=0;cell q ## k (k);\ - elements.push_back (ElPair(&q ## k, "q" # k)) - -#define PUSH_DGQ(k) FE_DGQ dgq ## k(k);\ - elements.push_back (ElPair(&dgq ## k, "dgq" # k)) template void loop () { + char prefix[3]; + sprintf(prefix, "%dd", dim); + deallog.push(prefix); + + cout << "namespace " << ELNAME << "_" << dim << "d\n{"; + Triangulation tr_coarse; Triangulation tr_fine; GridGenerator::hyper_cube (tr_coarse, 0, 1); @@ -151,37 +163,43 @@ void loop () typedef pair*, const char*> ElPair ; vector elements(0); - PUSH_DGQ(0); - PUSH_DGQ(1); - PUSH_DGQ(2); -// PUSH_DGQ(3); - PUSH_DGQ(5); - PUSH_DGQ(6); - PUSH_DGQ(7); - // PUSH_Q(0); - PUSH_Q(1); - PUSH_Q(2); - PUSH_Q(3); - PUSH_Q(4); + /* + * List element degrees for + * computation here. + */ + PUSH(0); + PUSH(1); + PUSH(2); + PUSH(3); + PUSH(4); + PUSH(5); + PUSH(6); char* name = new char[100]; - // Embed all lower spaces into higher + // Embed all lower spaces into + // higher or just the same degree + // on different grids. + bool same_degree_only = true; + unsigned int n = elements.size(); for (unsigned int i=0;i