WSL/SLF GitLab Repository

Commit 68fc49dc authored by Mathias Bavay's avatar Mathias Bavay
Browse files

a new seter method has been created for the grids: grid.set(grid, init).

parent 3f91fd75
......@@ -321,6 +321,12 @@ void Grid2DObject::set(const double& i_cellsize, const Coords& i_llcorner, const
grid2D = i_grid2D;
}
void Grid2DObject::set(const Grid2DObject& i_grid, const double& init)
{
setValues(i_grid.cellsize, i_grid.llcorner);
grid2D.resize(i_grid.grid2D.getNx(), i_grid.grid2D.getNy(), init);
}
void Grid2DObject::size(size_t& o_ncols, size_t& o_nrows) const {
o_ncols = getNx();
o_nrows = getNy();
......
......@@ -124,6 +124,8 @@ class Grid2DObject {
void set(const size_t& ncols, const size_t& nrows,
const double& cellsize, const Coords& i_llcorner, const double& init);
void set(const Grid2DObject& i_grid, const double& init);
void size(size_t& o_ncols, size_t& o_nrows) const;
size_t getNx() const;
size_t getNy() const;
......
......@@ -340,6 +340,14 @@ void Grid3DObject::set(const double& i_cellsize, const Coords& i_llcorner, const
grid3D = i_grid3D; //copy by value
}
void Grid3DObject::set(const Grid3DObject& i_grid, const double& init)
{
setValues(i_grid.cellsize, i_grid.llcorner);
grid3D.resize(i_grid.grid3D.getNx(), i_grid.grid3D.getNy(), i_grid.grid3D.getNz(), init);
z = i_grid.z;
z_is_absolute = i_grid.z_is_absolute;
}
void Grid3DObject::size(size_t& o_ncols, size_t& o_nrows, size_t& o_ndepths) const
{
o_ncols = grid3D.getNx();
......
......@@ -101,6 +101,8 @@ class Grid3DObject{
void set(const size_t& ncols, const size_t& nrows, const size_t& ndepths,
const double& cellsize, const Coords& i_llcorner, const double& init);
void set(const Grid3DObject& i_grid, const double& init);
void size(size_t& o_ncols, size_t& o_nrows, size_t& o_ndepths) const;
size_t getNx() const;
size_t getNy() const;
......
Supports Markdown
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