From 2b5f3eaf76fe1d30ff31c3c1c4f68afb89855301 Mon Sep 17 00:00:00 2001 From: schrage Date: Mon, 22 Feb 1999 13:05:26 +0000 Subject: [PATCH] Laplace code working, cleaned up. Still contains code for data logging and German comments. git-svn-id: https://svn.dealii.org/trunk@871 0785d39b-7218-0410-832d-ea1e28bc413d --- .../tutorial/chapter-3.laplace/code/func.cc | 9 --- .../chapter-3.laplace/code/functions.h | 9 --- .../chapter-3.laplace/code/laplace.cc | 60 +------------------ .../tutorial/chapter-3.laplace/code/laplace.h | 10 +--- .../tutorial/chapter-3.laplace/code/main.cc | 8 +-- 5 files changed, 4 insertions(+), 92 deletions(-) diff --git a/deal.II/doc/tutorial/chapter-3.laplace/code/func.cc b/deal.II/doc/tutorial/chapter-3.laplace/code/func.cc index 1234028a3a..a5c558ea79 100644 --- a/deal.II/doc/tutorial/chapter-3.laplace/code/func.cc +++ b/deal.II/doc/tutorial/chapter-3.laplace/code/func.cc @@ -7,15 +7,6 @@ const char* funcversion = "Functions: $Revision$"; #include -double -WeightFunction::operator() (const Point<2>& p) const -{ - // double r = p(0)*p(0) + p(1) * p(1); - //if (r>=.8) return 0.; - //return 1.-r*(2.-r); - return 1.; - -} double BoundaryFct::operator ()(const Point<2> &p) const diff --git a/deal.II/doc/tutorial/chapter-3.laplace/code/functions.h b/deal.II/doc/tutorial/chapter-3.laplace/code/functions.h index fa55d4aba9..d8b592d352 100644 --- a/deal.II/doc/tutorial/chapter-3.laplace/code/functions.h +++ b/deal.II/doc/tutorial/chapter-3.laplace/code/functions.h @@ -4,15 +4,6 @@ #include -class WeightFunction - : public Function<2> -{ -public: - WeightFunction() - {} - virtual double operator()(const Point<2> &p) const; -}; - class BoundaryFct : public Function<2> { diff --git a/deal.II/doc/tutorial/chapter-3.laplace/code/laplace.cc b/deal.II/doc/tutorial/chapter-3.laplace/code/laplace.cc index 90e326a2d7..0b4d0d5f56 100644 --- a/deal.II/doc/tutorial/chapter-3.laplace/code/laplace.cc +++ b/deal.II/doc/tutorial/chapter-3.laplace/code/laplace.cc @@ -86,7 +86,7 @@ Laplace::remesh(unsigned int steps) // JS.Primales Problem zusammenstellen. void -Laplace::assemble_primal(const Function<2>&,const Function<2>&) +Laplace::assemble_primal() { deallog << "Assembling primal problem" << endl; // JS. Platz für neue Matrix mit (?) (2x = quadratisch) Anzahl der Zellen, @@ -221,63 +221,5 @@ void Laplace::write_data(const char* name) } -// JS. Ergebnis zurückgeben. Wie funktioniert das ? -double -Laplace::result(const Function<2>& interior, const Function<2>& boundary) -{ - double erg = 0., ergex = 0.; - FEValues<2> fevalues(fe_primal, qc_integrate, - UpdateFlags(update_q_points | update_JxW_values)); - FEFaceValues<2> ffvalues(fe_primal, qf_integrate, - UpdateFlags(update_q_points | update_JxW_values)); - vector uh(qc_integrate.n_quadrature_points); - vector uf(qf_integrate.n_quadrature_points); - - // JS.Alle Zellen durch. - for (DoFHandler<2>::active_cell_iterator c = dof_primal.begin_active() - ; c != dof_primal.end() ; ++c) - { - double s = 0.; - fevalues.reinit(c, stb); - - fevalues.get_function_values(u, uh); - - for (unsigned int k=0;k::faces_per_cell;++fi) - { - DoFHandler<2>::face_iterator f = c->face(fi); - unsigned char bi = f->boundary_indicator(); - if (bi == 0xFF) continue; - ffvalues.reinit(c, fi, stb); - ffvalues.get_function_values(u, uf); - - // JS.??? Integrationspunkte ??? - for (unsigned k=0;k& exact; protected: Point<2> direction; Triangulation<2> tr; DoFHandler<2> dof_primal; -// DoFHandler<2> dof_dual; dSMatrixStruct matrix_structure; AdvMatrix A; @@ -48,15 +46,9 @@ public: ~Laplace(); void remesh(unsigned int global_refine = 0); - void assemble_primal(const Function<2>& boundary, const Function<2>& rhs); + void assemble_primal(); void solve_primal(); - double result(const Function<2>& interior, const Function<2>& boundary); - - void adapt(); - void write_data(const char* name); - - void fill_vector(dVector& v, const Function<2>& f) const; }; diff --git a/deal.II/doc/tutorial/chapter-3.laplace/code/main.cc b/deal.II/doc/tutorial/chapter-3.laplace/code/main.cc index 7e2181f5f5..73a8900e24 100644 --- a/deal.II/doc/tutorial/chapter-3.laplace/code/main.cc +++ b/deal.II/doc/tutorial/chapter-3.laplace/code/main.cc @@ -32,8 +32,6 @@ main(int argc, char** argv) deallog << "Firstgrid " << firstgrid << endl; // JS.Benötigte Funktionen zur Lösung des Problems - WeightFunction weight; - BoundaryFct boundary; Laplace lap; // JS.Logstream ist ein stack, ab hier wird "Adaptive:" vor jede Zeile @@ -50,22 +48,20 @@ main(int argc, char** argv) lap.remesh(firstgrid); else { -//JS. lap.adapt(); lap.remesh(1); } deallog.push("Primal"); // JS.exakte Lösung mit 0 auf der rechten Seite - lap.assemble_primal(boundary,zero); + lap.assemble_primal(); lap.solve_primal(); // JS.ab hier kein "Adaptive:" mehr deallog.pop(); sprintf(fname,"T%02d",step); - // JS.Daten zurückschreiben. Aber welche ? - lap.result(weight,boundary); + // JS.Daten zurückschreiben. lap.write_data(fname); } // JS.Logfile sauber abschließen und Schluß -- 2.39.5