Esempio n. 1
0
/*
   Redessine la carte, les joueurs, les effets, ...
*/
void paint(SDL_Renderer *s,map_t *m) {
     // Efface le rendu (on repart d'un écran noir)
    SDL_RenderClear(s);

    // Calcul des informations sur la fenetre d'affichage : vecteur de déplacement et cases du plateau à afficher
    int x, y; // Vecteur de déplacement
    int i_min, i_max, j_min, j_max; // Cases min et max à afficher en hauteur (i) et en largeur (j)
    calcul_infos_fenetre(m, &x, &y, &i_min, &i_max, &j_min, &j_max);


    // AFFICHE LE DÉCOR
    decor(s, m, x, y, i_min, i_max, j_min, j_max);

    // Affiche les bonus
    affiche_bonus(s,m, x, y);

    // AFFICHE LES TANKS
    animation_deplacement(s,m, x, y);

    // Affiche les obus
    animation_deplacement_obus(s, m, x, y) ;

    if(m->brouillard) {
        brouillard(s,m, x, y, i_min, i_max, j_min, j_max);
    }

    // Tableau de bord
    texte(s,m);

    // Affiche le tout à l'écran
    SDL_RenderPresent(s);
}
Esempio n. 2
0
void GaugeField::smearing_hyp(const ssize_t t,
                              const double alpha_1,
                              const double alpha_2,
                              const ssize_t iter) {
  // temporal timeslice twice the size for decorated links
  array_3cd_d2_eigen dec_timeslice(boost::extents[V3][6]);

  // temporal timeslice from decorated links
  array_3cd_d2_eigen eigen_timeslice_ts(boost::extents[V3][3]);
  // temporal integers holding directions for decorated smearing
  int mu, nu, eta;
  for (ssize_t run = 0; run < iter; ++run) {
    // calculate inner staple from original timeslice, store in dec_timeslice each link
    // can get smeared in two planes
    for (int vol = 0; vol < V3; ++vol) {
      for (int dir = 0; dir < 3; ++dir) {
        // inner staple
        Eigen::Matrix3cd inner_staple = Eigen::Matrix3cd::Zero();
        std::array<Eigen::Matrix3cd, 2> tmp_staples;
        std::array<int, 2> perpendics = get_dirs(dir);
        for (auto it_perp_dir = perpendics.begin(); it_perp_dir != perpendics.end();
             ++it_perp_dir) {
          int perp_dir = *it_perp_dir;
          // up-type smearing_indices
          mu = iup[vol][perp_dir];
          nu = iup[mu][dir];
          eta = iup[vol][dir];
          // product of up matrices
          inner_staple =
              tslices.at(t)[vol][perp_dir] *
              (tslices.at(t)[mu][dir] * (tslices.at(t)[eta][perp_dir].adjoint()));
          // down-type smearing indices
          mu = idown[vol][perp_dir];
          nu = iup[mu][dir];
          // eta is same endpoint no adjoint necessary here
          // product of down matrices
          inner_staple += (tslices.at(t)[mu][perp_dir].adjoint()) *
                          (tslices.at(t)[mu][dir] * tslices.at(t)[nu][perp_dir]);
          // Careful placement of decorated links in dec_timeslices:
          // dir=0 has placement in dec_dir = 0 (smeared in 1 plane)
          //                       dec_dir = 3 (smeared in 2 plane)
          // dir=1 has placement in dec_dir = 1 (smeared in 0 plane)
          //                       dec_dir = 4 (smeared in 2 plane)
          // dir=2 has placement in dec_dir = 2 (smeared in 0 plane)
          //                       dec_dir = 5 (smeared in 1 plane)
          Eigen::Matrix3cd stac =
              (tslices.at(t)[vol][dir] * (1 - alpha_2)) + (inner_staple * alpha_2 / 2.);
          int n_el = it_perp_dir - perpendics.begin();
          tmp_staples.at(n_el) = proj_to_su3_imp(stac);
        }

        // staple link in direction dir in non participating and negative directions
        dec_timeslice[vol][dir] = tmp_staples.at(0);
        dec_timeslice[vol][dir + 3] = tmp_staples.at(1);
      }
    }
    // calculate outer staple from dec_timeslice as modified ape-smearing

    for (int i = 0; i < V3; ++i) {
      for (int dir = 0; dir < 3; ++dir) {
        Eigen::Matrix3cd outer_staple =
            Eigen::Matrix3cd::Zero();  // Holding all smearing matrices for one link

        // filling each element of smearer using 3 links
        // debugging link
        Eigen::Matrix3cd outer_staple_test;
        for (int not_dir = 0; not_dir < 3; ++not_dir) {
          if (dir != not_dir) {
            // calculate plane in which was smeared
            int plane = ((dir + 1) ^ (not_dir + 1)) - 1;
            mu = iup[i][not_dir];
            nu = iup[mu][dir];
            eta = idown[nu][not_dir];

            // Staples in positive direction
            // replace directions by appropriate decor
            int a, b;
            a = decor(not_dir, plane);
            b = decor(dir, plane);
            outer_staple += dec_timeslice[i][a] *
                            (dec_timeslice[mu][b] * (dec_timeslice[eta][a].adjoint()));
            mu = idown[i][not_dir];
            nu = iup[mu][dir];

            // Staples in negative direction
            outer_staple += (dec_timeslice[mu][a].adjoint()) *
                            (dec_timeslice[mu][b] *
                             dec_timeslice[nu][a]);  // structure has to be a_dag, b, a
          }
        }
        eigen_timeslice_ts[i][dir] =
            (tslices.at(t)[i][dir] * (1. - alpha_1)) + (outer_staple * alpha_1 / 4.);
      }
    }
    for (int i = 0; i < V3; ++i) {
      for (int mu = 0; mu < 3; ++mu) {
        tslices.at(t)[i][mu] = proj_to_su3_imp(eigen_timeslice_ts[i][mu]);
      }
    }
  }
  // clean up
}