25 #include <fast_methods/ndgridmap/ndgridmap.hpp>
46 template <
class T,
size_t ndims>
50 ofs.open (filename, std::ofstream::out | std::ofstream::trunc);
52 ofs << grid.
getCell(0).type() <<
'\n';
55 std::array<unsigned int, ndims> dimsize = grid.
getDimSizes();
56 for (
unsigned int i = 0; i < ndims; ++i)
57 ofs <<
'\n' << dimsize[i] <<
"\t";
59 for (
unsigned int i = 0; i < grid.
size(); ++i)
60 ofs <<
'\n' << grid.
getCell(i).getValue();
80 template <
class T,
size_t ndims>
84 ofs.open (filename, std::ofstream::out | std::ofstream::trunc);
86 ofs << grid.
getCell(0).type() <<
'\n';
89 std::array<unsigned int, ndims> dimsize = grid.
getDimSizes();
90 for (
unsigned int i = 0; i < ndims; ++i)
91 ofs <<
'\n' << dimsize[i] <<
"\t";
93 for (
unsigned int i = 0; i < grid.
size(); ++i)
94 ofs <<
'\n' << grid.
getCell(i).getVelocity();
110 template <
class T,
size_t ndims>
114 ofs.open (filename, std::ofstream::out | std::ofstream::trunc);
118 std::array<unsigned int, ndims> dimsize = grid.
getDimSizes();
119 for (
unsigned int i = 0; i < ndims; ++i)
120 ofs <<
'\n'<< dimsize[i] <<
"\t";
122 for (
unsigned int i = 0; i < path.size(); ++i) {
124 for (
unsigned int j = 0; j < ndims; ++j)
125 ofs << path[i][j] <<
"\t" ;
142 template <
class T,
size_t ndims>
144 (
const char * filename,
nDGridMap<T, ndims> & grid, std::vector< std::array<double,ndims> > & path, std::vector <double> path_velocity) {
146 ofs.open (filename, std::ofstream::out | std::ofstream::trunc);
150 std::array<unsigned int, ndims> dimsize = grid.
getDimSizes();
151 for (
unsigned int i = 0; i < ndims; ++i)
152 ofs <<
'\n' << dimsize[i];
154 for (
unsigned int i = 0; i < path.size(); ++i) {
156 for (
unsigned int j = 0; j < ndims; ++j)
157 ofs << path[i][j] <<
"\t" ;
158 ofs << path_velocity[i];
static void savePathVelocity(const char *filename, nDGridMap< T, ndims > &grid, std::vector< std::array< double, ndims > > &path, std::vector< double > path_velocity)
Saves the 2D path with velocity values in an ASCII file with the following format: ...
static void saveGridValues(const char *filename, nDGridMap< T, ndims > &grid)
Saves grid values in ASCII format into the specified file.
Auxiliar class which helps to save nDGridMaps into text files.
Templated class which represents a n-dimensional grid map. Its cells are assumed to be cubic...
T & getCell(unsigned int idx)
Returns the cell with index idx.
std::array< unsigned int, ndims > getDimSizes() const
Returns the size of each dimension.
static void saveVelocities(const char *filename, nDGridMap< T, ndims > &grid)
Saves grid velocities in ASCII format into the specified file.
unsigned int size() const
Returns number of cells in the grid.
static void savePath(const char *filename, nDGridMap< T, ndims > &grid, std::vector< std::array< double, ndims > > &path)
Saves the 2D path in an ASCII file with the following format:
double getLeafSize() const
Returns the leaf size of the grid.