]> https://gitweb.dealii.org/ - dealii.git/commitdiff
working on ThetaTimestepping
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Wed, 7 Jul 2010 23:16:09 +0000 (23:16 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Wed, 7 Jul 2010 23:16:09 +0000 (23:16 +0000)
git-svn-id: https://svn.dealii.org/trunk@21459 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/numerics/operator.templates.h
deal.II/examples/doxygen/theta_timestepping.cc

index a2ac9e57f633279129a49e62cf12f73c70d5752d..79d4f5980dfaf4fd2372909e301a92c529065923 100644 (file)
@@ -68,7 +68,7 @@ namespace Algorithms
     }
     else
     {
-      (*os) << ' ' << step;
+      (*os) << ' ' << step << ' ';
       for (unsigned int i=0;i<vectors.size();++i)
         vectors(i)->print(*os);
       (*os) << std::endl;
index a3c9436ef024a075ea9ada5b9b91f1a163017629..ecf62e2d3f6f66acbfa696bb1b4747420c08c18d 100644 (file)
@@ -18,6 +18,9 @@
 
 #include <numerics/operator.h>
 #include <numerics/theta_timestepping.h>
+#include <numerics/operator.h>
+
+#include <iostream>
 
 using namespace dealii;
 using namespace Algorithms;
@@ -58,11 +61,14 @@ class Implicit
 int main()
 {
   FullMatrix<double> matrix(2);
-  matrix(0,0) = -.1;
-  matrix(1,1) = -.1;
+  matrix(0,0) = 0.;
+  matrix(1,1) = 0.;
   matrix(0,1) = 31.4;
   matrix(1,0) = -31.4;
 
+  OutputOperator<Vector<double> > out;
+  out.initialize_stream(std::cout);
+  
   Explicit op_explicit(matrix);
   Implicit op_implicit(matrix);
   ThetaTimestepping<Vector<double> > solver(op_explicit, op_implicit);
@@ -71,10 +77,14 @@ int main()
   solver.notify(Events::initial);
   
   Vector<double> value(2);
+  value(0) = 1.;
+  
   NamedData<Vector<double>*> indata;
   NamedData<Vector<double>*> outdata;
   Vector<double>* p = &value;
   outdata.add(p, "value");
+  solver.set_output(out);
+  
   solver(outdata, indata);
 }
 
@@ -84,7 +94,6 @@ Explicit::Explicit(const FullMatrix<double>& M)
                matrix(&M)
 {
   m.reinit(M.m(), M.n());
-  m = M;
 }
 
 
@@ -98,8 +107,13 @@ Explicit::initialize_timestep_data(const TimestepData& t)
 void
 Explicit::operator() (NamedData<Vector<double>*>& out, const NamedData<Vector<double>*>& in)
 {
-  this->notifications.print(deallog);
-  deallog << std::endl;
+  if (this->notifications.test(Events::initial) || this->notifications.test(Events::new_timestep_size))
+    {
+      m.equ(timestep_data->step, *matrix);
+      for (unsigned int i=0;i<m.m();++i)
+       m(i,i) += 1.;
+      m.print_formatted(std::cerr);
+    }
   this->notifications.clear();
   unsigned int i = in.find("Previous time");
   m.vmult(*out(0), *in(i));
@@ -124,14 +138,13 @@ Implicit::initialize_timestep_data(const TimestepData& t)
 void
 Implicit::operator() (NamedData<Vector<double>*>& out, const NamedData<Vector<double>*>& in)
 {
-  this->notifications.print(deallog);
-  deallog << std::endl;
   if (this->notifications.test(Events::initial) || this->notifications.test(Events::new_timestep_size))
     {
       m.equ(timestep_data->step, *matrix);
       for (unsigned int i=0;i<m.m();++i)
        m(i,i) += 1.;
       m.gauss_jordan();
+      m.print_formatted(std::cerr);
     }
   this->notifications.clear();
   

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.