Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # --------------------------------------------------------------------------------------------
- ### code from star_maker8.C and star_maker9.C to assign initial positions for new particles
- xpos = *xstart + ((float) i - 0.5)*(*dx);
- ypos = *ystart + ((float) j - 0.5)*(*dx);
- zpos = *zstart + ((float) k - 0.5)*(*dx);
- # ---------------------------------------------------------------------------------------------
- #
- # analogous Fortran code looks the same, using (i - 0.5)*dx ...
- # However, I believe the C code should be using (i + 0.5)*dx
- # instead because of the offset in the loop counters as copied below:
- # -----------------------------------------------------------------------------
- ### the for loops looping over grid cells in star_maker8.C and star_maker9.C
- ### indices start at ibuff
- for (k = *ibuff; k < *nz-*ibuff; k++) {
- for (j = *ibuff; j < *ny-*ibuff; j++) {
- index = (k * (*ny) + j) * (*nx) + (*ibuff);
- for (i = *ibuff; i < *nx-*ibuff; i++, index++)
- # --------------------------------------------------------------------------------
- # -----------------------------------------------------------------------------------
- ### corresponding code from one of the Fortran star_maker codes.
- ### indices start at ibuff + 1
- do k=1+ibuff,nz-ibuff
- do j=1+ibuff,ny-ibuff
- do i=1+ibuff,nx-ibuff
- # --------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement