Esempio n. 1
0
void
AmrAdv::regrid (int lbase, Real time)
{
    int new_finest;
    Array<BoxArray> new_grids(finest_level+2);
    MakeNewGrids(lbase, time, new_finest, new_grids);

    BL_ASSERT(new_finest <= finest_level+1);

    DistributionMapping::FlushCache();

    for (int lev = lbase+1; lev <= new_finest; ++lev)
    {
	if (lev <= finest_level) // an old level
	{
	    if (new_grids[lev] != grids[lev]) // otherwise nothing
	    {
		DistributionMapping new_dmap(new_grids[lev], ParallelDescriptor::NProcs());
		RemakeLevel(lev, time, new_grids[lev], new_dmap);
	    }
	}
	else  // a new level
	{
	    DistributionMapping new_dmap(new_grids[lev], ParallelDescriptor::NProcs());
	    MakeNewLevel(lev, time, new_grids[lev], new_dmap);
	}
    }
}
Esempio n. 2
0
t_dmap		*compute_dmap(const int x, const int y, const int seed)
{
  const int	size = ODDIFY(pow_two(MAX(x, y)));
  int		nb_iter;
  t_dmap	*dmap;

  dmap = new_dmap(size);
  if (dmap == NULL)
    return (NULL);
  nb_iter = 1;
  srand(seed);
  dmap->map[0][0] = (rand() % RAND_RANGE);
  dmap->map[size - 1][0] = (rand() % RAND_RANGE);
  dmap->map[size - 1][size - 1] = (rand() % RAND_RANGE);
  dmap->map[0][size - 1] = (rand() % RAND_RANGE);
  while (dmap->step > 1)
    {
      do_step(nb_iter, dmap, size);
      dmap->step /= 2;
      nb_iter *= 2;
    }
  return (dmap);
}