예제 #1
0
int main(int argc, char **argv) {
  int lattice[N][N];
  int iter=1000000;
  int printstep=100;
  int nanoseconds=100000;
  timespec sleepPeriod = { 0, nanoseconds };
  timespec unusedPeriod;

  srandom(1);
    
  // Start Ising: 
  double T=1;
  randLattice(lattice);

  for (int k = 0; k < iter; ++k) {
    if (k%printstep==0) {
      nanosleep(&sleepPeriod, &unusedPeriod);
      system("clear");
      std::cout << "Iteration: " << k << std::endl;
      printLattice(lattice);      
    }
    flipSpinR(lattice,&T,k);
    if (k%printstep==0) 
      std::cout << "Temperature: " << T << std::endl;
  }
  

  return 0;
}
예제 #2
0
const void SandPile::printLattice() {
	printLattice("sandPile.dat");
}