15 #ifndef GEOSX_MESHUTILITIES_STRUCTUREDGRIDUTILITIES_HPP 16 #define GEOSX_MESHUTILITIES_STRUCTUREDGRIDUTILITIES_HPP 35 template<>
inline int dimpower< 1 >(
int n ) {
return n; }
36 template<>
inline int dimpower< 2 >(
int n ) {
return n*n; }
37 template<>
inline int dimpower< 3 >(
int n ) {
return n*n*n; }
53 std::vector< int > & indices );
59 void map_index< 1 >(
const int index,
61 std::vector< int > & indices )
70 void map_index< 2 >(
const int index,
72 std::vector< int > & indices )
75 indices[0] = index % nnx;
76 indices[1] = index / nnx;
81 void map_index< 3 >(
const int index,
83 std::vector< int > & indices )
86 indices[0] = index % nnx;
87 indices[1] = (index / nnx) % nnx;
88 indices[2] = index / (nnx*nnx);
#define GEOSX_ASSERT_GT(lhs, rhs)
Assert that one value compares greater than the other in debug builds.
void map_index(const int index, const int nnx, std::vector< int > &indices)
Given a lexicographical index, map back to the original i,j,k indices of the point. The first variation here assumes a uniform number of points nnx in all coordinate directions.
#define GEOSX_DEBUG_VAR(...)
Mark a debug variable and silence compiler warnings.
int dimpower(int n)
Given n, compute n^d, where d is the spatial dimension.