WSL/SLF GitLab Repository

Commit 0b6fde06 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

Added the grid() operator to 2D and 3D grids (basically, calling the same...

Added the grid() operator to 2D and 3D grids (basically, calling the same operator on array2D and array3D).

Fixed a parameter reading bug in PNGIO (reading the number of levels).
parent c7564158
......@@ -273,6 +273,14 @@ double Grid2DObject::operator()(const unsigned int& ix, const unsigned int& iy)
return grid2D(ix,iy);
}
double& Grid2DObject::operator()(const unsigned int& i) {
return grid2D(i);
}
double Grid2DObject::operator()(const unsigned int& i) const {
return grid2D(i);
}
std::ostream& operator<<(std::ostream& os, const Grid2DObject& grid)
{
os << "<Grid2DObject>\n";
......
......@@ -62,6 +62,8 @@ class Grid2DObject {
Grid2DObject& operator=(const Grid2DObject&); ///<Assignement operator
double& operator ()(const unsigned int& ix, const unsigned int& iy);
double operator ()(const unsigned int& ix, const unsigned int& iy) const;
double& operator ()(const unsigned int& i);
double operator ()(const unsigned int& i) const;
friend std::ostream& operator<<(std::ostream& os, const Grid2DObject& grid);
......
......@@ -272,6 +272,14 @@ double Grid3DObject::operator()(const unsigned int& ix, const unsigned int& iy,
return grid3D(ix,iy,iz);
}
double& Grid3DObject::operator()(const unsigned int& i) {
return grid3D(i);
}
double Grid3DObject::operator()(const unsigned int& i) const {
return grid3D(i);
}
std::ostream& operator<<(std::ostream& os, const Grid3DObject& grid)
{
os << "<Grid3DObject>\n";
......
......@@ -56,6 +56,8 @@ class Grid3DObject{
Grid3DObject& operator=(const Grid3DObject&); ///<Assignement operator
double& operator ()(const unsigned int& ix, const unsigned int& iy, const unsigned int& iz);
double operator ()(const unsigned int& ix, const unsigned int& iy, const unsigned int& iz) const;
double& operator ()(const unsigned int& i);
double operator ()(const unsigned int& i) const;
friend std::ostream& operator<<(std::ostream& os, const Grid3DObject& grid);
......
......@@ -146,12 +146,12 @@ void PNGIO::setOptions()
optimize_for_speed = true;
cfg.getValue("PNG_SPEED_OPTIMIZE", "Output", optimize_for_speed, Config::nothrow);
nr_levels = 30;
unsigned int tmp=0;
unsigned int tmp=IOUtils::unodata;
cfg.getValue("PNG_NR_LEVELS", "Output", tmp, Config::nothrow);
if(tmp>255 || tmp<5) {
if(tmp!=IOUtils::unodata && (tmp>255 || tmp<5)) {
throw InvalidFormatException("PNG_NR_LEVELS must be between 5 and 255!", AT);
}
if(tmp>0) nr_levels=static_cast<unsigned char>(tmp);
if(tmp!=IOUtils::unodata) nr_levels=static_cast<unsigned char>(tmp);
}
void PNGIO::parse_size(const std::string& size_spec, unsigned int& width, unsigned int& height)
......
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