WSL/SLF GitLab Repository

Commit 501cd06c authored by Mathias Bavay's avatar Mathias Bavay
Browse files

Making the grid operators "const" when possible. Type casting in the << and >>...

Making the grid operators "const" when possible. Type casting in the << and >> operators of the Arrays to please clang...
parent 427c838e
......@@ -119,24 +119,24 @@ template<class T> class Array1D {
Array1D<T>& operator =(const T& value);
Array1D<T>& operator+=(const T& rhs);
const Array1D<T> operator+(const T& rhs);
const Array1D<T> operator+(const T& rhs) const;
Array1D<T>& operator+=(const Array1D<T>& rhs);
const Array1D<T> operator+(const Array1D<T>& rhs);
const Array1D<T> operator+(const Array1D<T>& rhs) const;
Array1D<T>& operator-=(const T& rhs);
const Array1D<T> operator-(const T& rhs);
const Array1D<T> operator-(const T& rhs) const;
Array1D<T>& operator-=(const Array1D<T>& rhs);
const Array1D<T> operator-(const Array1D<T>& rhs);
const Array1D<T> operator-(const Array1D<T>& rhs) const;
Array1D<T>& operator*=(const T& rhs);
const Array1D<T> operator*(const T& rhs);
const Array1D<T> operator*(const T& rhs) const;
Array1D<T>& operator*=(const Array1D<T>& rhs);
const Array1D<T> operator*(const Array1D<T>& rhs);
const Array1D<T> operator*(const Array1D<T>& rhs) const;
Array1D<T>& operator/=(const T& rhs);
const Array1D<T> operator/(const T& rhs);
const Array1D<T> operator/(const T& rhs) const;
Array1D<T>& operator/=(const Array1D<T>& rhs);
const Array1D<T> operator/(const Array1D<T>& rhs);
const Array1D<T> operator/(const Array1D<T>& rhs) const;
bool operator==(const Array1D<T>&) const; ///<Operator that tests for equality
bool operator!=(const Array1D<T>&) const; ///<Operator that tests for inequality
......@@ -249,7 +249,7 @@ template<class T> const std::string Array1D<T>::toString() const {
template<class P> std::iostream& operator<<(std::iostream& os, const Array1D<P>& array) {
os.write(reinterpret_cast<const char*>(&array.keep_nodata), sizeof(array.keep_nodata));
os.write(reinterpret_cast<const char*>(&array.nx), sizeof(array.nx));
os.write(reinterpret_cast<const char*>(&array.vecData[0]), array.nx*sizeof(P));
os.write(reinterpret_cast<const char*>(&array.vecData[0]), static_cast<std::streamsize>(array.nx*sizeof(P)));
return os;
}
......@@ -257,7 +257,7 @@ template<class P> std::iostream& operator>>(std::iostream& is, Array1D<P>& array
is.read(reinterpret_cast<char*>(&array.keep_nodata), sizeof(array.keep_nodata));
is.read(reinterpret_cast<char*>(&array.nx), sizeof(array.nx));
array.vecData.resize(array.nx);
is.read(reinterpret_cast<char*>(&array.vecData[0]), array.nx*sizeof(P)); //30 times faster than assign() or copy()
is.read(reinterpret_cast<char*>(&array.vecData[0]), static_cast<std::streamsize>(array.nx*sizeof(P))); //30 times faster than assign() or copy()
return is;
}
......@@ -440,7 +440,7 @@ template<class T> Array1D<T>& Array1D<T>::operator+=(const Array1D<T>& rhs)
return *this;
}
template<class T> const Array1D<T> Array1D<T>::operator+(const Array1D<T>& rhs)
template<class T> const Array1D<T> Array1D<T>::operator+(const Array1D<T>& rhs) const
{
Array1D<T> result(*this); //make a copy
result += rhs; //already implemented
......@@ -465,7 +465,7 @@ template<class T> Array1D<T>& Array1D<T>::operator+=(const T& rhs)
return *this;
}
template<class T> const Array1D<T> Array1D<T>::operator+(const T& rhs)
template<class T> const Array1D<T> Array1D<T>::operator+(const T& rhs) const
{
Array1D<T> result(*this);
result += rhs; //already implemented
......@@ -500,7 +500,7 @@ template<class T> Array1D<T>& Array1D<T>::operator-=(const Array1D<T>& rhs)
return *this;
}
template<class T> const Array1D<T> Array1D<T>::operator-(const Array1D<T>& rhs)
template<class T> const Array1D<T> Array1D<T>::operator-(const Array1D<T>& rhs) const
{
Array1D<T> result(*this); //make a copy
result -= rhs; //already implemented
......@@ -514,7 +514,7 @@ template<class T> Array1D<T>& Array1D<T>::operator-=(const T& rhs)
return *this;
}
template<class T> const Array1D<T> Array1D<T>::operator-(const T& rhs)
template<class T> const Array1D<T> Array1D<T>::operator-(const T& rhs) const
{
Array1D<T> result(*this);
result += -rhs; //already implemented
......@@ -548,7 +548,7 @@ template<class T> Array1D<T>& Array1D<T>::operator*=(const Array1D<T>& rhs)
return *this;
}
template<class T> const Array1D<T> Array1D<T>::operator*(const Array1D<T>& rhs)
template<class T> const Array1D<T> Array1D<T>::operator*(const Array1D<T>& rhs) const
{
Array1D<T> result(*this); //make a copy
result *= rhs; //already implemented
......@@ -573,7 +573,7 @@ template<class T> Array1D<T>& Array1D<T>::operator*=(const T& rhs)
return *this;
}
template<class T> const Array1D<T> Array1D<T>::operator*(const T& rhs)
template<class T> const Array1D<T> Array1D<T>::operator*(const T& rhs) const
{
Array1D<T> result(*this);
result *= rhs; //already implemented
......@@ -607,7 +607,7 @@ template<class T> Array1D<T>& Array1D<T>::operator/=(const Array1D<T>& rhs)
return *this;
}
template<class T> const Array1D<T> Array1D<T>::operator/(const Array1D<T>& rhs)
template<class T> const Array1D<T> Array1D<T>::operator/(const Array1D<T>& rhs) const
{
Array1D<T> result(*this); //make a copy
result /= rhs; //already implemented
......@@ -621,7 +621,7 @@ template<class T> Array1D<T>& Array1D<T>::operator/=(const T& rhs)
return *this;
}
template<class T> const Array1D<T> Array1D<T>::operator/(const T& rhs)
template<class T> const Array1D<T> Array1D<T>::operator/(const T& rhs) const
{
Array1D<T> result(*this);
result *= 1./rhs; //already implemented
......
......@@ -196,24 +196,24 @@ template<class T> class Array2D {
Array2D<T>& operator =(const T& value);
Array2D<T>& operator+=(const T& rhs);
const Array2D<T> operator+(const T& rhs);
const Array2D<T> operator+(const T& rhs) const;
Array2D<T>& operator+=(const Array2D<T>& rhs);
const Array2D<T> operator+(const Array2D<T>& rhs);
const Array2D<T> operator+(const Array2D<T>& rhs) const;
Array2D<T>& operator-=(const T& rhs);
const Array2D<T> operator-(const T& rhs);
const Array2D<T> operator-(const T& rhs) const;
Array2D<T>& operator-=(const Array2D<T>& rhs);
const Array2D<T> operator-(const Array2D<T>& rhs);
const Array2D<T> operator-(const Array2D<T>& rhs) const;
Array2D<T>& operator*=(const T& rhs);
const Array2D<T> operator*(const T& rhs);
const Array2D<T> operator*(const T& rhs) const;
Array2D<T>& operator*=(const Array2D<T>& rhs);
const Array2D<T> operator*(const Array2D<T>& rhs);
const Array2D<T> operator*(const Array2D<T>& rhs) const;
Array2D<T>& operator/=(const T& rhs);
const Array2D<T> operator/(const T& rhs);
const Array2D<T> operator/(const T& rhs) const;
Array2D<T>& operator/=(const Array2D<T>& rhs);
const Array2D<T> operator/(const Array2D<T>& rhs);
const Array2D<T> operator/(const Array2D<T>& rhs) const;
bool operator==(const Array2D<T>&) const; ///<Operator that tests for equality
bool operator!=(const Array2D<T>&) const; ///<Operator that tests for inequality
......@@ -419,7 +419,7 @@ template<class P> std::iostream& operator<<(std::iostream& os, const Array2D<P>&
os.write(reinterpret_cast<const char*>(&array.keep_nodata), sizeof(array.keep_nodata));
os.write(reinterpret_cast<const char*>(&array.nx), sizeof(array.nx));
os.write(reinterpret_cast<const char*>(&array.ny), sizeof(array.ny));
os.write(reinterpret_cast<const char*>(&array.vecData[0]), (array.nx*array.ny)*sizeof(P));
os.write(reinterpret_cast<const char*>(&array.vecData[0]), static_cast<std::streamsize>(array.nx*array.ny*sizeof(P)));
return os;
}
......@@ -428,7 +428,7 @@ template<class P> std::iostream& operator>>(std::iostream& is, Array2D<P>& array
is.read(reinterpret_cast<char*>(&array.nx), sizeof(array.nx));
is.read(reinterpret_cast<char*>(&array.ny), sizeof(array.ny));
array.vecData.resize(array.nx*array.ny);
is.read(reinterpret_cast<char*>(&array.vecData[0]), (array.nx*array.ny)*sizeof(P)); //30 times faster than assign() or copy()
is.read(reinterpret_cast<char*>(&array.vecData[0]), static_cast<std::streamsize>(array.nx*array.ny*sizeof(P))); //30 times faster than assign() or copy()
return is;
}
......@@ -551,7 +551,7 @@ template<class T> bool Array2D<T>::checkEpsilonEquality(const Array2D<double>& r
return true;
}
template<class T> bool Array2D<T>::checkEpsilonEquality(const Array2D<double>& rhs1, const Array2D<double>& rhs2, const double& epsilon) {
template<class T> bool Array2D<T>::checkEpsilonEquality(const Array2D<double>& rhs1, const Array2D<double>& rhs2, const double& epsilon) { //static
return rhs1.checkEpsilonEquality(rhs2, epsilon);
}
......@@ -597,7 +597,7 @@ template<class T> Array2D<T>& Array2D<T>::operator+=(const Array2D<T>& rhs)
return *this;
}
template<class T> const Array2D<T> Array2D<T>::operator+(const Array2D<T>& rhs)
template<class T> const Array2D<T> Array2D<T>::operator+(const Array2D<T>& rhs) const
{
Array2D<T> result(*this); //make a copy
result += rhs; //already implemented
......@@ -623,7 +623,7 @@ template<class T> Array2D<T>& Array2D<T>::operator+=(const T& rhs)
return *this;
}
template<class T> const Array2D<T> Array2D<T>::operator+(const T& rhs)
template<class T> const Array2D<T> Array2D<T>::operator+(const T& rhs) const
{
Array2D<T> result(*this);
result += rhs; //already implemented
......@@ -658,7 +658,7 @@ template<class T> Array2D<T>& Array2D<T>::operator-=(const Array2D<T>& rhs)
return *this;
}
template<class T> const Array2D<T> Array2D<T>::operator-(const Array2D<T>& rhs)
template<class T> const Array2D<T> Array2D<T>::operator-(const Array2D<T>& rhs) const
{
Array2D<T> result(*this); //make a copy
result -= rhs; //already implemented
......@@ -672,7 +672,7 @@ template<class T> Array2D<T>& Array2D<T>::operator-=(const T& rhs)
return *this;
}
template<class T> const Array2D<T> Array2D<T>::operator-(const T& rhs)
template<class T> const Array2D<T> Array2D<T>::operator-(const T& rhs) const
{
Array2D<T> result(*this);
result += -rhs; //already implemented
......@@ -707,7 +707,7 @@ template<class T> Array2D<T>& Array2D<T>::operator*=(const Array2D<T>& rhs)
return *this;
}
template<class T> const Array2D<T> Array2D<T>::operator*(const Array2D<T>& rhs)
template<class T> const Array2D<T> Array2D<T>::operator*(const Array2D<T>& rhs) const
{
Array2D<T> result(*this); //make a copy
result *= rhs; //already implemented
......@@ -733,7 +733,7 @@ template<class T> Array2D<T>& Array2D<T>::operator*=(const T& rhs)
return *this;
}
template<class T> const Array2D<T> Array2D<T>::operator*(const T& rhs)
template<class T> const Array2D<T> Array2D<T>::operator*(const T& rhs) const
{
Array2D<T> result(*this);
result *= rhs; //already implemented
......@@ -768,7 +768,7 @@ template<class T> Array2D<T>& Array2D<T>::operator/=(const Array2D<T>& rhs)
return *this;
}
template<class T> const Array2D<T> Array2D<T>::operator/(const Array2D<T>& rhs)
template<class T> const Array2D<T> Array2D<T>::operator/(const Array2D<T>& rhs) const
{
Array2D<T> result(*this); //make a copy
result /= rhs; //already implemented
......@@ -782,7 +782,7 @@ template<class T> Array2D<T>& Array2D<T>::operator/=(const T& rhs)
return *this;
}
template<class T> const Array2D<T> Array2D<T>::operator/(const T& rhs)
template<class T> const Array2D<T> Array2D<T>::operator/(const T& rhs) const
{
Array2D<T> result(*this);
result *= (1./rhs); //already implemented
......
......@@ -229,24 +229,24 @@ template<class T> class Array3D {
Array3D<T>& operator =(const T& value);
Array3D<T>& operator+=(const T& rhs);
const Array3D<T> operator+(const T& rhs);
const Array3D<T> operator+(const T& rhs) const;
Array3D<T>& operator+=(const Array3D<T>& rhs);
const Array3D<T> operator+(const Array3D<T>& rhs);
const Array3D<T> operator+(const Array3D<T>& rhs) const;
Array3D<T>& operator-=(const T& rhs);
const Array3D<T> operator-(const T& rhs);
const Array3D<T> operator-(const T& rhs) const;
Array3D<T>& operator-=(const Array3D<T>& rhs);
const Array3D<T> operator-(const Array3D<T>& rhs);
const Array3D<T> operator-(const Array3D<T>& rhs) const;
Array3D<T>& operator*=(const T& rhs);
const Array3D<T> operator*(const T& rhs);
const Array3D<T> operator*(const T& rhs) const;
Array3D<T>& operator*=(const Array3D<T>& rhs);
const Array3D<T> operator*(const Array3D<T>& rhs);
const Array3D<T> operator*(const Array3D<T>& rhs) const;
Array3D<T>& operator/=(const T& rhs);
const Array3D<T> operator/(const T& rhs);
const Array3D<T> operator/(const T& rhs) const;
Array3D<T>& operator/=(const Array3D<T>& rhs);
const Array3D<T> operator/(const Array3D<T>& rhs);
const Array3D<T> operator/(const Array3D<T>& rhs) const;
bool operator==(const Array3D<T>&) const; ///<Operator that tests for equality
bool operator!=(const Array3D<T>&) const; ///<Operator that tests for inequality
......@@ -490,7 +490,7 @@ template<class P> std::iostream& operator<<(std::iostream& os, const Array3D<P>&
os.write(reinterpret_cast<const char*>(&array.nx), sizeof(array.nx));
os.write(reinterpret_cast<const char*>(&array.ny), sizeof(array.ny));
os.write(reinterpret_cast<const char*>(&array.nz), sizeof(array.nz));
os.write(reinterpret_cast<const char*>(&array.vecData[0]), array.nx*array.ny*array.nz*sizeof(P));
os.write(reinterpret_cast<const char*>(&array.vecData[0]), static_cast<std::streamsize>(array.nx*array.ny*array.nz*sizeof(P)));
return os;
}
......@@ -500,7 +500,7 @@ template<class P> std::iostream& operator>>(std::iostream& is, Array3D<P>& array
is.read(reinterpret_cast<char*>(&array.ny), sizeof(array.ny));
is.read(reinterpret_cast<char*>(&array.nz), sizeof(array.nz));
array.vecData.resize(array.nx*array.ny*array.nz);
is.read(reinterpret_cast<char*>(&array.vecData[0]), array.nx*array.ny*array.nz*sizeof(P)); //30 times faster than assign() or copy()
is.read(reinterpret_cast<char*>(&array.vecData[0]), static_cast<std::streamsize>(array.nx*array.ny*array.nz*sizeof(P))); //30 times faster than assign() or copy()
return is;
}
......@@ -670,7 +670,7 @@ template<class T> Array3D<T>& Array3D<T>::operator+=(const Array3D<T>& rhs)
return *this;
}
template<class T> const Array3D<T> Array3D<T>::operator+(const Array3D<T>& rhs)
template<class T> const Array3D<T> Array3D<T>::operator+(const Array3D<T>& rhs) const
{
Array3D<T> result(*this); //make a copy
result += rhs; //already implemented
......@@ -696,7 +696,7 @@ template<class T> Array3D<T>& Array3D<T>::operator+=(const T& rhs)
return *this;
}
template<class T> const Array3D<T> Array3D<T>::operator+(const T& rhs)
template<class T> const Array3D<T> Array3D<T>::operator+(const T& rhs) const
{
Array3D<T> result(*this);
result += rhs; //already implemented
......@@ -731,7 +731,7 @@ template<class T> Array3D<T>& Array3D<T>::operator-=(const Array3D<T>& rhs)
return *this;
}
template<class T> const Array3D<T> Array3D<T>::operator-(const Array3D<T>& rhs)
template<class T> const Array3D<T> Array3D<T>::operator-(const Array3D<T>& rhs) const
{
Array3D<T> result(*this); //make a copy
result -= rhs; //already implemented
......@@ -745,7 +745,7 @@ template<class T> Array3D<T>& Array3D<T>::operator-=(const T& rhs)
return *this;
}
template<class T> const Array3D<T> Array3D<T>::operator-(const T& rhs)
template<class T> const Array3D<T> Array3D<T>::operator-(const T& rhs) const
{
Array3D<T> result(*this);
result += -rhs; //already implemented
......@@ -780,7 +780,7 @@ template<class T> Array3D<T>& Array3D<T>::operator*=(const Array3D<T>& rhs)
return *this;
}
template<class T> const Array3D<T> Array3D<T>::operator*(const Array3D<T>& rhs)
template<class T> const Array3D<T> Array3D<T>::operator*(const Array3D<T>& rhs) const
{
Array3D<T> result(*this); //make a copy
result *= rhs; //already implemented
......@@ -806,7 +806,7 @@ template<class T> Array3D<T>& Array3D<T>::operator*=(const T& rhs)
return *this;
}
template<class T> const Array3D<T> Array3D<T>::operator*(const T& rhs)
template<class T> const Array3D<T> Array3D<T>::operator*(const T& rhs) const
{
Array3D<T> result(*this);
result *= rhs; //already implemented
......@@ -841,7 +841,7 @@ template<class T> Array3D<T>& Array3D<T>::operator/=(const Array3D<T>& rhs)
return *this;
}
template<class T> const Array3D<T> Array3D<T>::operator/(const Array3D<T>& rhs)
template<class T> const Array3D<T> Array3D<T>::operator/(const Array3D<T>& rhs) const
{
Array3D<T> result(*this); //make a copy
result /= rhs; //already implemented
......@@ -855,7 +855,7 @@ template<class T> Array3D<T>& Array3D<T>::operator/=(const T& rhs)
return *this;
}
template<class T> const Array3D<T> Array3D<T>::operator/(const T& rhs)
template<class T> const Array3D<T> Array3D<T>::operator/(const T& rhs) const
{
Array3D<T> result(*this);
result *= (1./rhs); //already implemented
......
......@@ -173,24 +173,24 @@ template<class T> class Array4D {
Array4D<T>& operator =(const T& value);
Array4D<T>& operator+=(const T& rhs);
const Array4D<T> operator+(const T& rhs);
const Array4D<T> operator+(const T& rhs) const;
Array4D<T>& operator+=(const Array4D<T>& rhs);
const Array4D<T> operator+(const Array4D<T>& rhs);
const Array4D<T> operator+(const Array4D<T>& rhs) const;
Array4D<T>& operator-=(const T& rhs);
const Array4D<T> operator-(const T& rhs);
const Array4D<T> operator-(const T& rhs) const;
Array4D<T>& operator-=(const Array4D<T>& rhs);
const Array4D<T> operator-(const Array4D<T>& rhs);
const Array4D<T> operator-(const Array4D<T>& rhs) const;
Array4D<T>& operator*=(const T& rhs);
const Array4D<T> operator*(const T& rhs);
const Array4D<T> operator*(const T& rhs) const;
Array4D<T>& operator*=(const Array4D<T>& rhs);
const Array4D<T> operator*(const Array4D<T>& rhs);
const Array4D<T> operator*(const Array4D<T>& rhs) const;
Array4D<T>& operator/=(const T& rhs);
const Array4D<T> operator/(const T& rhs);
const Array4D<T> operator/(const T& rhs) const;
Array4D<T>& operator/=(const Array4D<T>& rhs);
const Array4D<T> operator/(const Array4D<T>& rhs);
const Array4D<T> operator/(const Array4D<T>& rhs) const;
bool operator==(const Array4D<T>&) const; ///<Operator that tests for equality
bool operator!=(const Array4D<T>&) const; ///<Operator that tests for inequality
......@@ -427,7 +427,7 @@ template<class P> std::iostream& operator<<(std::iostream& os, const Array4D<P>&
os.write(reinterpret_cast<const char*>(&array.ny), sizeof(array.ny));
os.write(reinterpret_cast<const char*>(&array.nz), sizeof(array.nz));
os.write(reinterpret_cast<const char*>(&array.nw), sizeof(array.nw));
os.write(reinterpret_cast<const char*>(&array.vecData[0]), array.nx*array.ny*array.nz*array.nw*sizeof(P));
os.write(reinterpret_cast<const char*>(&array.vecData[0]), static_cast<std::streamsize>(array.nx*array.ny*array.nz*array.nw*sizeof(P)));
return os;
}
......@@ -438,7 +438,7 @@ template<class P> std::iostream& operator>>(std::iostream& is, Array4D<P>& array
is.read(reinterpret_cast<char*>(&array.nz), sizeof(array.nz));
is.read(reinterpret_cast<char*>(&array.nw), sizeof(array.nw));
array.vecData.resize(array.nx*array.ny*array.nz*array.nw);
is.read(reinterpret_cast<char*>(&array.vecData[0]), array.nx*array.ny*array.nz*array.nw*sizeof(P)); //30 times faster than assign() or copy()
is.read(reinterpret_cast<char*>(&array.vecData[0]), static_cast<std::streamsize>(array.nx*array.ny*array.nz*array.nw*sizeof(P))); //30 times faster than assign() or copy()
return is;
}
......@@ -611,7 +611,7 @@ template<class T> Array4D<T>& Array4D<T>::operator+=(const Array4D<T>& rhs)
return *this;
}
template<class T> const Array4D<T> Array4D<T>::operator+(const Array4D<T>& rhs)
template<class T> const Array4D<T> Array4D<T>::operator+(const Array4D<T>& rhs) const
{
Array4D<T> result(*this); //make a copy
result += rhs; //already implemented
......@@ -637,7 +637,7 @@ template<class T> Array4D<T>& Array4D<T>::operator+=(const T& rhs)
return *this;
}
template<class T> const Array4D<T> Array4D<T>::operator+(const T& rhs)
template<class T> const Array4D<T> Array4D<T>::operator+(const T& rhs) const
{
Array4D<T> result(*this);
result += rhs; //already implemented
......@@ -672,7 +672,7 @@ template<class T> Array4D<T>& Array4D<T>::operator-=(const Array4D<T>& rhs)
return *this;
}
template<class T> const Array4D<T> Array4D<T>::operator-(const Array4D<T>& rhs)
template<class T> const Array4D<T> Array4D<T>::operator-(const Array4D<T>& rhs) const
{
Array4D<T> result(*this); //make a copy
result -= rhs; //already implemented
......@@ -686,7 +686,7 @@ template<class T> Array4D<T>& Array4D<T>::operator-=(const T& rhs)
return *this;
}
template<class T> const Array4D<T> Array4D<T>::operator-(const T& rhs)
template<class T> const Array4D<T> Array4D<T>::operator-(const T& rhs) const
{
Array4D<T> result(*this);
result += -rhs; //already implemented
......@@ -721,7 +721,7 @@ template<class T> Array4D<T>& Array4D<T>::operator*=(const Array4D<T>& rhs)
return *this;
}
template<class T> const Array4D<T> Array4D<T>::operator*(const Array4D<T>& rhs)
template<class T> const Array4D<T> Array4D<T>::operator*(const Array4D<T>& rhs) const
{
Array4D<T> result(*this); //make a copy
result *= rhs; //already implemented
......@@ -747,7 +747,7 @@ template<class T> Array4D<T>& Array4D<T>::operator*=(const T& rhs)
return *this;
}
template<class T> const Array4D<T> Array4D<T>::operator*(const T& rhs)
template<class T> const Array4D<T> Array4D<T>::operator*(const T& rhs) const
{
Array4D<T> result(*this);
result *= rhs; //already implemented
......@@ -782,7 +782,7 @@ template<class T> Array4D<T>& Array4D<T>::operator/=(const Array4D<T>& rhs)
return *this;
}
template<class T> const Array4D<T> Array4D<T>::operator/(const Array4D<T>& rhs)
template<class T> const Array4D<T> Array4D<T>::operator/(const Array4D<T>& rhs) const
{
Array4D<T> result(*this); //make a copy
result /= rhs; //already implemented
......@@ -796,7 +796,7 @@ template<class T> Array4D<T>& Array4D<T>::operator/=(const T& rhs)
return *this;
}
template<class T> const Array4D<T> Array4D<T>::operator/(const T& rhs)
template<class T> const Array4D<T> Array4D<T>::operator/(const T& rhs) const
{
Array4D<T> result(*this);
result *= (1./rhs); //already implemented
......
......@@ -1110,7 +1110,7 @@ DEMObject& DEMObject::operator+=(const double& rhs) {
return *this;
}
const DEMObject DEMObject::operator+(const double& rhs) {
const DEMObject DEMObject::operator+(const double& rhs) const {
DEMObject result = *this;
result.grid2D += rhs;
result.updateAllMinMax();
......@@ -1125,7 +1125,7 @@ DEMObject& DEMObject::operator+=(const Grid2DObject& rhs) {
return *this;
}
const DEMObject DEMObject::operator+(const Grid2DObject& rhs) {
const DEMObject DEMObject::operator+(const Grid2DObject& rhs) const {
if (!isSameGeolocalization(rhs))
throw InvalidArgumentException("[E] grids must have the same geolocalization in order to do arithmetic operations!", AT);
DEMObject result(*this);
......@@ -1140,7 +1140,7 @@ DEMObject& DEMObject::operator-=(const double& rhs) {
return *this;
}
const DEMObject DEMObject::operator-(const double& rhs) {
const DEMObject DEMObject::operator-(const double& rhs) const {
DEMObject result(*this);
result.grid2D -= rhs;
result.updateAllMinMax();
......@@ -1155,7 +1155,7 @@ DEMObject& DEMObject::operator-=(const Grid2DObject& rhs) {
return *this;
}
const DEMObject DEMObject::operator-(const Grid2DObject& rhs) {
const DEMObject DEMObject::operator-(const Grid2DObject& rhs) const {
if (!isSameGeolocalization(rhs))
throw InvalidArgumentException("[E] grids must have the same geolocalization in order to do arithmetic operations!", AT);
DEMObject result(*this);
......@@ -1170,7 +1170,7 @@ DEMObject& DEMObject::operator*=(const double& rhs) {
return *this;
}
const DEMObject DEMObject::operator*(const double& rhs) {
const DEMObject DEMObject::operator*(const double& rhs) const {
DEMObject result(*this);
result.grid2D *= rhs;
result.update();
......@@ -1185,7 +1185,7 @@ DEMObject& DEMObject::operator*=(const Grid2DObject& rhs) {
return *this;
}
const DEMObject DEMObject::operator*(const Grid2DObject& rhs) {
const DEMObject DEMObject::operator*(const Grid2DObject& rhs) const {
if (!isSameGeolocalization(rhs))
throw InvalidArgumentException("[E] grids must have the same geolocalization in order to do arithmetic operations!", AT);
DEMObject result(*this);
......@@ -1200,7 +1200,7 @@ DEMObject& DEMObject::operator/=(const double& rhs) {
return *this;
}
const DEMObject DEMObject::operator/(const double& rhs) {
const DEMObject DEMObject::operator/(const double& rhs) const {
DEMObject result(*this);
result.grid2D /= rhs;
result.update();
......@@ -1215,7 +1215,7 @@ DEMObject& DEMObject::operator/=(const Grid2DObject& rhs) {
return *this;
}
const DEMObject DEMObject::operator/(const Grid2DObject& rhs) {
const DEMObject DEMObject::operator/(const Grid2DObject& rhs) const {
if (!isSameGeolocalization(rhs))
throw InvalidArgumentException("[E] grids must have the same geolocalization in order to do arithmetic operations!", AT);
DEMObject result(*this);
......
......@@ -107,24 +107,24 @@ class DEMObject : public Grid2DObject {
DEMObject& operator=(const double& value); ///<Assignement operator
DEMObject& operator+=(const double& rhs);
const DEMObject operator+(const double& rhs);
const DEMObject operator+(const double& rhs) const;
DEMObject& operator+=(const Grid2DObject& rhs);
const DEMObject operator+(const Grid2DObject& rhs);
const DEMObject operator+(const Grid2DObject& rhs) const;
DEMObject& operator-=(const double& rhs);
const DEMObject operator-(const double& rhs);
const DEMObject operator-(const double& rhs) const;
DEMObject& operator-=(const Grid2DObject& rhs);
const DEMObject operator-(const Grid2DObject& rhs);
const DEMObject operator-(const Grid2DObject& rhs) const;
DEMObject& operator*=(const double& rhs);