Re: Concurrent processes



One key question is, does the parameter change need to cause a
calculation restart?  I would presume so, unless the computation was
convergence-based.  In that case, you'll presumably need to modify
isingflip() whatever approach you take.

if you previously had:
isingflip()
{
  /* setup loop code */
  while(not_done)
    {
       /* Do calc iteration */
    }
  /* cleanup loop code */
  /* output results code */
}

You could change it to be:
isingflip()
{
  /* setup loop code */
  while( not_done && variables_unchanged)
    {
       iter = 0;
       while( not_done && (iter < N) )
         {
            iter++;
            /* Do calc iteration */
         }
       /* Allow operator interaction */
       while(gtk_events_pending())
        {
           /* This loop is wrong, search archives for example */
           gtk_main_loop_iteration();
        }
    }

  if(not_done)
    {
       /* cleanup and terminate, wait for operator to hit "Simulation"
again? */
    }
  else
    {
       /* cleanup and output results */
    }
}


And, finally, the callback for changing the variables need to also clear
the variables_unchanged flag, and the Simulate button needs to set it.

Tune N to trade off responsiveness vs. increased calculation time.



Eric




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]