Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /branches/vis15/src/tests/vis15-bugs/gst2d.diderot
ViewVC logotype

View of /branches/vis15/src/tests/vis15-bugs/gst2d.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4497 - (download) (annotate)
Sat Sep 3 14:12:36 2016 UTC (2 years, 8 months ago) by jhr
File size: 1221 byte(s)
  working on merge: updating tests with new version 2 syntax
#version 2

/*
Compiling the attached program generates an error:

[gst2d.diderot:32.22-32] Error: "stabilize" statment outside of initially/update method

The stabilize is inside an update, but its the global update not the strand update.

Being able to stabilize all strands from the global update, as a consequence of some
computation done in the global update, is a natural way to express the convergence of
particle systems.  Also, this was part of Lamont's branch, and it was used in Fig 2 of
the Vis'15 paper, so I hope that the merge will include this important capability.

*/
/*const*/ int N = 10;
real target = 0.0;

strand S (int i) {
  output real e = i;
  int iter = 0;

  update {
    iter += 1;
    real delta = (target - e)/2 + iter;
    print (i, "(", iter, "): e = ", e, ", delta = ", delta, "\n");
    // if (target > 10) { stabilize; } // works, but ugly
    if (|delta| < 0.001) {
	stabilize;
    } else {
	e += delta;
    }
  }

}

create_collection { S(i) | i in 1..N }

start {
  target = mean { p.e | p in S.all };
  print("initially: target = ", target, "\n");
}

update {
  target = sum { p.e | p in S.all } / N;
  print("update: target = ", target, "\n");
  if (target > 10) { stabilize; }
}

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0