Consider a loop, e.g.
for (int d=0; d<2; d++) {
  b0(grid,d) = Dirichlet;
  b1(grid,d) = Dirichlet;
}

For a parallel implementation, this would have to be
for (int d=0; d<2; d++) {
  if (b0(grid,d)==g0(grid,d))
    b0(grid,d) = Dirichlet;
  if (b1(grid,d)==g1(grid,d))
    b1(grid,d) = Dirichlet;
}