diff --git a/GeoLib/GeoObject.h b/GeoLib/GeoObject.h index e7dd2f988a3da5ed2614c2ab10599ac48c2bf2bf..a923d983a703f01b1b5fad77a2cf76b2645843ef 100644 --- a/GeoLib/GeoObject.h +++ b/GeoLib/GeoObject.h @@ -23,6 +23,9 @@ namespace GeoLib class GeoObject { public: + GeoObject() = default; + GeoObject(GeoObject const&) = default; + GeoObject& operator=(GeoObject const&) = default; virtual ~GeoObject() = default; /// return a geometry type virtual GEOTYPE getGeoType() const = 0; diff --git a/GeoLib/Polyline.cpp b/GeoLib/Polyline.cpp index f43566a00a6e3d5ab69023730a3328eecf1153a6..d02555d59efdc4404ad708c7d837be1c205dab06 100644 --- a/GeoLib/Polyline.cpp +++ b/GeoLib/Polyline.cpp @@ -94,7 +94,9 @@ void Polyline::insertPoint(std::size_t pos, std::size_t pnt_id) } } - std::vector<std::size_t>::iterator it(_ply_pnt_ids.begin() + pos); + std::vector<std::size_t>::difference_type const pos_dt( + static_cast<std::vector<std::size_t>::difference_type>(pos)); + std::vector<std::size_t>::iterator it(_ply_pnt_ids.begin() + pos_dt); _ply_pnt_ids.insert(it, pnt_id); if (_ply_pnt_ids.size() > 1) { @@ -117,7 +119,8 @@ void Polyline::insertPoint(std::size_t pos, std::size_t pnt_id) if (_ply_pnt_ids.size() > 2) dist_until_now = _length[_ply_pnt_ids.size() - 2]; - _length.insert(_length.begin() + pos, dist_until_now + act_dist); + _length.insert(_length.begin() + pos_dt, + dist_until_now + act_dist); } else { // insert at arbitrary position within the vector double dist_until_now (0.0); @@ -132,10 +135,11 @@ void Polyline::insertPoint(std::size_t pos, std::size_t pnt_id) double update_dist( len_seg0 + len_seg1 - (_length[pos] - dist_until_now)); _length[pos] = dist_until_now + len_seg0; - std::vector<double>::iterator it(_length.begin() + pos + 1); - _length.insert(it, _length[pos] + len_seg1); - for (it = _length.begin() + pos + 2; it != _length.end(); ++it) - *it += update_dist; + std::vector<double>::iterator it1(_length.begin() + pos_dt + 1); + _length.insert(it1, _length[pos] + len_seg1); + for (it1 = _length.begin() + pos_dt + 2; it1 != _length.end(); + ++it1) + *it1 += update_dist; } } } @@ -146,11 +150,13 @@ void Polyline::removePoint(std::size_t pos) if (pos >= _ply_pnt_ids.size()) return; - _ply_pnt_ids.erase(_ply_pnt_ids.begin() + pos); + std::vector<std::size_t>::difference_type const pos_dt( + static_cast<std::vector<std::size_t>::difference_type>(pos)); + _ply_pnt_ids.erase(_ply_pnt_ids.begin() + pos_dt); if (pos == _ply_pnt_ids.size()) { - _length.erase(_length.begin() + pos); + _length.erase(_length.begin() + pos_dt); return; } @@ -163,7 +169,7 @@ void Polyline::removePoint(std::size_t pos) } else { const double len_seg0(_length[pos] - _length[pos - 1]); const double len_seg1(_length[pos + 1] - _length[pos]); - _length.erase(_length.begin() + pos); + _length.erase(_length.begin() + pos_dt); const double len_new_seg(std::sqrt(MathLib::sqrDist(*_ply_pnts[_ply_pnt_ids[pos - 1]], *_ply_pnts[_ply_pnt_ids[pos]]))); double seg_length_diff(len_new_seg - len_seg0 - len_seg1); @@ -396,18 +402,18 @@ void Polyline::updatePointIDs(const std::vector<std::size_t> &pnt_ids) double Polyline::getDistanceAlongPolyline(const MathLib::Point3d& pnt, const double epsilon_radius) const { - double dist, lambda; + double dist(-1.0), lambda; bool found = false; // loop over all line segments of the polyline - for (std::size_t k = 0; k < this->getNumberOfPoints() - 1; k++) { + for (std::size_t k = 0; k < getNumberOfPoints() - 1; k++) { // is the orthogonal projection of the j-th node to the // line g(lambda) = _ply->getPoint(k) + lambda * (_ply->getPoint(k+1) - _ply->getPoint(k)) // at the k-th line segment of the polyline, i.e. 0 <= lambda <= 1? if (MathLib::calcProjPntToLineAndDists(pnt.getCoords(), - (this->getPoint(k))->getCoords(), (this->getPoint(k + 1))->getCoords(), + (getPoint(k))->getCoords(), (getPoint(k + 1))->getCoords(), lambda, dist) <= epsilon_radius) { - double act_length_of_ply(this->getLength(k)); + double act_length_of_ply(getLength(k)); double seg_length (getLength(k+1)-getLength(k)); double lower_lambda (- epsilon_radius / seg_length); double upper_lambda (1 + epsilon_radius / seg_length); @@ -420,7 +426,9 @@ double Polyline::getDistanceAlongPolyline(const MathLib::Point3d& pnt, } } // end line segment loop - return found ? dist : -1; + if (! found) + dist = -1.0; + return dist; } std::ostream& operator<< (std::ostream &os, const Polyline &pl) diff --git a/MathLib/TemplatePoint.h b/MathLib/TemplatePoint.h index 328ba9344e5abc2882d3145966cb6b5a1157e595..d3ad057b1b84ba9601225b19b69580a7a87ff2c7 100644 --- a/MathLib/TemplatePoint.h +++ b/MathLib/TemplatePoint.h @@ -46,7 +46,10 @@ public: explicit TemplatePoint(std::array<T,DIM> const& x); /** virtual destructor */ - virtual ~TemplatePoint() {} + virtual ~TemplatePoint() = default; + + TemplatePoint(TemplatePoint const& other) = default; + TemplatePoint& operator=(TemplatePoint const&) = default; /** \brief const access operator * The access to the point coordinates is like the access to a field. Code example: diff --git a/MathLib/Vector3.h b/MathLib/Vector3.h index 1b98887e2069c13a517312003e3f90cb52df9939..7d9f0307fda9ddd0d902353ef901f48a6507d2b9 100644 --- a/MathLib/Vector3.h +++ b/MathLib/Vector3.h @@ -35,7 +35,7 @@ public: /** * Default constructor. All coordinates are set to zero. */ - TemplateVector3() : TemplatePoint<T>() {} + TemplateVector3() = default; TemplateVector3(T x0, T x1, T x2) { @@ -47,9 +47,8 @@ public: /** * Copy constructor. */ - TemplateVector3(TemplateVector3<T> const& v) : - TemplatePoint<T>(v) - {} + TemplateVector3(TemplateVector3<T> const& v) = default; + TemplateVector3<T>& operator=(TemplateVector3<T> const& v) = default; /** * Construct Vector3 from TemplatePoint. @@ -69,8 +68,6 @@ public: this->_x[2] = b[2] - a[2]; } - ~TemplateVector3() {} - // vector arithmetic TemplateVector3 operator+(TemplateVector3 const& v) const { diff --git a/MeshGeoToolsLib/SearchLength.h b/MeshGeoToolsLib/SearchLength.h index 5c5d470ad611321a7eca171a325d2837dd39a456..6caf37d6035a0e42151eb51814b6d8215cf39804 100644 --- a/MeshGeoToolsLib/SearchLength.h +++ b/MeshGeoToolsLib/SearchLength.h @@ -27,6 +27,9 @@ public: explicit SearchLength(double search_length = 1e-9) : _search_length(search_length) {} + SearchLength(SearchLength const&) = default; + SearchLength& operator=(SearchLength const&) = default; + virtual ~SearchLength() = default; virtual double getSearchLength() const diff --git a/MeshLib/MeshQuality/ElementErrorCode.h b/MeshLib/MeshQuality/ElementErrorCode.h index cceb0435096890762f560bd2de7d5ac7bf78df44..258df63039e653780e88b9344eeccf17297bc4c5 100644 --- a/MeshLib/MeshQuality/ElementErrorCode.h +++ b/MeshLib/MeshQuality/ElementErrorCode.h @@ -34,12 +34,6 @@ enum class ElementErrorFlag class ElementErrorCode : public std::bitset<static_cast<std::size_t>(ElementErrorFlag::MaxValue)> { public: - ElementErrorCode() {} - //ElementErrorCode(std::bitset< static_cast<std::size_t>(ElementErrorFlag::MaxValue) > error_flags) - // : _errors(error_flags) {} - - ~ElementErrorCode() {} - /// Get value for a specific flag bool get(ElementErrorFlag e) const { return test(static_cast<std::size_t>(e)); } /// Set a specific flag