Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a method for extracting cell center coords #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions fsgrid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,22 @@ template <typename T, int stencil> class FsGrid : public FsGridTools{
return coords;
}

/*! Get the cell-center coordinates in the global simulation space
* for the given cell.
*
* \param x local x-Coordinate, in cells
* \param y local y-Coordinate, in cells
* \param z local z-Coordinate, in cells
*/
std::array<double, 3> getCenterCoords(int x, int y, int z) {
std::array<double, 3> coords;
coords[0] = physicalGlobalStart[0] + (localStart[0]+x+0.5)*DX;
coords[1] = physicalGlobalStart[1] + (localStart[1]+y+0.5)*DY;
coords[2] = physicalGlobalStart[2] + (localStart[2]+z+0.5)*DZ;

return coords;
}

/*! Debugging output helper function. Allows for nicely formatted printing
* of grid contents. Since the grid data format is varying, the actual
* printing should be done in a lambda passed to this function. Example usage
Expand Down