]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Laplace code working, cleaned up. Still contains code for data logging and German...
authorschrage <schrage@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 22 Feb 1999 13:05:26 +0000 (13:05 +0000)
committerschrage <schrage@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 22 Feb 1999 13:05:26 +0000 (13:05 +0000)
git-svn-id: https://svn.dealii.org/trunk@871 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/tutorial/chapter-3.laplace/code/func.cc
deal.II/doc/tutorial/chapter-3.laplace/code/functions.h
deal.II/doc/tutorial/chapter-3.laplace/code/laplace.cc
deal.II/doc/tutorial/chapter-3.laplace/code/laplace.h
deal.II/doc/tutorial/chapter-3.laplace/code/main.cc

index 1234028a3afd352fffc5eeabc2922ffcdfb77d7f..a5c558ea79063bec02e3449d5679a4e90ff90b7f 100644 (file)
@@ -7,15 +7,6 @@ const char* funcversion = "Functions: $Revision$";
 
 #include <cmath>
 
-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
index fa55d4aba9924b0d1587e62ea5dd9cc379ffc0d5..d8b592d352517fda89ab641698ee9f8370432fe5 100644 (file)
@@ -4,15 +4,6 @@
 
 #include <base/function.h>
 
-class WeightFunction
-  : public Function<2>
-{
-public:
-  WeightFunction()
-      {}
-  virtual double operator()(const Point<2> &p) const;
-};
-
 class BoundaryFct
   : public Function<2>
 {
index 90e326a2d7396ba07b1de8789d0f0d7de3de413f..0b4d0d5f56f11be061ce3cf7234a0294f619854a 100644 (file)
@@ -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<double> uh(qc_integrate.n_quadrature_points);
-  vector<double> 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<qc_integrate.n_quadrature_points;++k)
-    {
-      s += fevalues.JxW(k)
-          * uh[k] * interior(fevalues.get_quadrature_points()[k]);
-      ergex += fevalues.JxW(k)
-       //  * exact(fevalues.get_quadrature_points()[k])
-              * interior(fevalues.get_quadrature_points()[k]);
-    }
-    // JS.Alle Zellränder.
-    for (unsigned fi=0;fi<GeometryInfo<2>::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<qf_primal.n_quadrature_points;++k)
-      {
-       s += ffvalues.JxW(k)
-            * uf[k] * boundary(ffvalues.get_quadrature_points()[k]);
-      }
-    }
-    erg += s;
-  }
-  deallog << "Results " << setw(18) << setprecision(15) << erg << " " << ergex << endl;
-  return erg;
-}
-
-// JS. Gitter anpassen
-void
-Laplace::adapt()
-{
-  tr.refine_and_coarsen_fixed_fraction(f, .5, 0);
-}
-
 
 
index 95684e73a18ec68d3d07d2515307237f0fdf2b3c..00cc5a017af1e3f7adcf6c60a706b1f60fcf7d0d 100644 (file)
@@ -23,12 +23,10 @@ public:
 
 class Laplace
 {
-  Function<2>& 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;
 };
 
index 7e2181f5f557f4eb90fe067c5dfc24afc2ec9f3f..73a8900e245bb971c78a263ba156efa2931c20aa 100644 (file)
@@ -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ß

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.