diff --git a/fsgrid.hpp b/fsgrid.hpp index bd4a25d..bbf89a1 100644 --- a/fsgrid.hpp +++ b/fsgrid.hpp @@ -908,6 +908,22 @@ template 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 getCenterCoords(int x, int y, int z) { + std::array 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