Exemplo n.º 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;
}
Exemplo n.º 2
0
const void SandPile::printLattice() {
	printLattice("sandPile.dat");
}