changeset 46:1ff029128e08

Use the VTK plotter on the shallow water problem
author Jordi Gutiérrez Hermoso <jordigh@gmail.com>
date Tue, 23 Mar 2010 18:12:42 -0600
parents 330d2813788b
children 6cdad791f16f
files src/main-sw-rk4.cpp src/main.cpp
diffstat 2 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/main-sw-rk4.cpp
+++ b/src/main-sw-rk4.cpp
@@ -15,6 +15,7 @@
 #include "include/diff_op.hpp"
 #include "include/interpolator.hpp"
 #include "include/func.hpp"
+#include "include/vtkplot.hpp"
 
 using namespace kwantix;
 
@@ -160,10 +161,16 @@
     f_v.set_dt(dt);
     f_h.set_dt(dt);
 
+    vtkplot plotter(u0,0,0.2);
+    plotter.set_view_direction(0,1,1);
+    plotter.begin_interaction();
+
     //main loop, timestepping with RK4.
-    size_t maxiter = 1000;
+    size_t maxiter = 20;
     for(size_t i = 1; i <= maxiter; i++){ 
       cout << "Now on iteration #" << i << endl;
+      plotter.update_values(u0.at());
+      plotter.plot();
       if(i % 10 == 0){
         save_interp(Omega,u0,i,"u");
         save_interp(Omega,v0,i,"v");
@@ -351,7 +358,7 @@
 template<typename RBF>
 void set_bdry_conds(interpolator<RBF> & u, interpolator<RBF> & v)
 {
-  kwantix::bdry_values &u_bdry(u.at()), &v_bdry(v.at());
+  kwantix::bdry_values u_bdry(u.at()), v_bdry(v.at());
   kwantix::normals N=u.get_normals(), M=v.get_normals();
   if(N != M){
     failure exc;
@@ -367,5 +374,3 @@
   u.set_bdry_values(u_bdry_new);
   v.set_bdry_values(v_bdry_new);
 }
-
-
new file mode 120000
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,1 @@
+main-sw-rk4.cpp
\ No newline at end of file