9 #ifndef NCWRITEHELPER_HPP_
10 #define NCWRITEHELPER_HPP_
44 std::vector< std::string >& desired_names,
57 std::vector< int >& tstep_nums ) = 0;
87 for(
unsigned int i = 0; i < 6; i++ )
105 template <
typename T >
106 void jik_to_kji(
size_t ni,
size_t nj,
size_t nk, T* dest, T* source )
108 size_t nik = ni * nk, nij = ni * nj;
109 for( std::size_t k = 0; k != nk; k++ )
110 for( std::size_t j = 0; j != nj; j++ )
111 for( std::size_t i = 0; i != ni; i++ )
112 dest[k * nij + j * ni + i] = source[j * nik + i * nk + k];
136 template <
typename T >
139 std::size_t idxInSource = 0;
144 std::size_t size_range = pair_iter->second - pair_iter->first + 1;
145 std::size_t nik = size_range * nk, nij = size_range * nj;
146 for( std::size_t k = 0; k != nk; k++ )
147 for( std::size_t j = 0; j != nj; j++ )
148 for( std::size_t i = 0; i != size_range; i++ )
149 dest[idxInSource + k * nij + j * size_range + i] = source[idxInSource + j * nik + i * nk + k];
150 idxInSource += ( size_range * nj * nk );