Commit 47e793dc authored by kicici's avatar kicici

`BlockInfo::pos` that returns an `std::array`.

parent 044c9e0f
......@@ -8,6 +8,7 @@
*/
#pragma once
#include <array>
#include <cstdlib>
#include "MeshMap.h"
......@@ -70,6 +71,24 @@ struct BlockInfo
}
}
// Return the position as an `std::array<>`,
// as opposed to returning it via a pointer argument.
template <typename T>
inline std::array<T, 2> pos(int ix, int iy) const
{
std::array<T, 2> result;
pos(result.data(), ix, iy);
return result;
}
template <typename T>
inline std::array<T, 3> pos(int ix, int iy, int iz) const
{
std::array<T, 3> result;
pos(result.data(), ix, iy, iz);
return result;
}
// Return grid spacing dx in all dimensions for cell {ix, iy, iz}
template <typename T> // 2D
inline void spacing(T dx[2], int ix, int iy) const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment