liveViz support added
authorAbhinav Bhatele <bhatele@illinois.edu>
Fri, 8 Aug 2008 20:49:54 +0000 (20:49 +0000)
committerAbhinav Bhatele <bhatele@illinois.edu>
Fri, 8 Aug 2008 20:49:54 +0000 (20:49 +0000)
examples/charm++/Molecular2D/Compute.C
examples/charm++/Molecular2D/Makefile
examples/charm++/Molecular2D/Patch.C
examples/charm++/Molecular2D/Patch.ci

index ec656eab2f7c99da35d85a60df8cc478ad6bf29e..4eb990247881ebae4580e92f5d1ea85dc27b281e 100644 (file)
@@ -12,7 +12,9 @@
  */
 
 #include "common.h"
-//#include "liveViz.h"
+#ifdef RUN_LIVEVIZ
+  #include "liveViz.h"
+#endif
 #include "Patch.decl.h"
 #include "Compute.h"
 
index 5c2491bbc6683278d93b593dd3b1ed834e2307cf..59af1ace7d6c205f6465dd8164a378dbfac792f3 100644 (file)
@@ -1,10 +1,10 @@
 CHARMC =../../../bin/charmc $(OPTS)
 OPTS   = -O3
 
-all: mol3d
+all: mol2d
 
-mol3d: Patch.o Compute.o
-       $(CHARMC) -language charm++ -o mol3d Patch.o Compute.o
+mol2d: Patch.o Compute.o
+       $(CHARMC) -language charm++ -o mol2d Patch.o Compute.o
 
 Patch.o: Patch.C Patch.h Patch.decl.h common.h
        $(CHARMC) -o Patch.o Patch.C
@@ -16,4 +16,4 @@ Compute.o: Compute.C Compute.h Patch.decl.h common.h
        $(CHARMC) -o Compute.o Compute.C
 
 clean:
-       rm -f *.decl.h *.def.h *.o mol3d charmrun
+       rm -f *.decl.h *.def.h *.o mol2d charmrun
index 15153aa682d592c90b2844a8a548af7e4db0703a..c2df81e32d0c3d086fed7a532f552589fdbf0268 100644 (file)
@@ -76,12 +76,13 @@ void Main::computeCreationDone() {
   computeArray.doneInserting();
   CkPrintf("%d COMPUTES CREATED\n", 5*patchArrayDimX*patchArrayDimY);
 
+#ifdef RUN_LIVEVIZ
   // setup liveviz
-  // CkCallback c(CkIndex_Patch::requestNextFrame(0),patchArray);
-  // liveVizConfig cfg(liveVizConfig::pix_color,true);
-  // liveVizInit(cfg,patchArray,c);
+  CkCallback c(CkIndex_Patch::requestNextFrame(0), patchArray);
+  liveVizConfig cfg(liveVizConfig::pix_color,true);
+  liveVizInit(cfg,patchArray,c);
+#endif
 
-  // sleep(1);
   patchArray.start();
 }
 
@@ -370,8 +371,8 @@ void Patch::requestNextFrame(liveVizRequestMsg *lvmsg) {
   int wdes = lvmsg->req.wid;
   int hdes = lvmsg->req.ht;
    
-  int myWidthPx = wdes / m;
-  int myHeightPx = hdes / n;
+  int myWidthPx = wdes / patchArrayDimX;
+  int myHeightPx = hdes / patchArrayDimY;
   int sx=thisIndex.x*myWidthPx;
   int sy=thisIndex.y*myHeightPx; 
 
@@ -386,8 +387,8 @@ void Patch::requestNextFrame(liveVizRequestMsg *lvmsg) {
   }
 
   for (int i=0; i < particles.length(); i++ ) {
-    int xpos = (int)((particles[i].x /(double) (patchSize*m)) * wdes) - sx;
-    int ypos = (int)((particles[i].y /(double) (patchSize*n)) * hdes) - sy;
+    int xpos = (int)((particles[i].x /(double) (patchSize*patchArrayDimX)) * wdes) - sx;
+    int ypos = (int)((particles[i].y /(double) (patchSize*patchArrayDimY)) * hdes) - sy;
 
     Color c(particles[i].id);
     color_pixel(intensity,myWidthPx,myHeightPx,xpos+1,ypos,c.R,c.B,c.G);
index c3878338879b3b60031bbb7ca5af22c3a5ab6010..05dbca3b80d1bce16c4ef07490a20b4a76c151aa 100644 (file)
@@ -23,6 +23,7 @@ mainmodule Patch {
     entry void createComputes();
     entry void updateForces(CkVec<Particle> particles);
     entry void updateParticles(CkVec<Particle> updates);
+    // entry void requestNextFrame(liveVizRequestMsg *m);
   };
 
   array [4D] Compute {