diff --git a/GeoLib/AnalyticalGeometry-impl.h b/GeoLib/AnalyticalGeometry-impl.h index 89773700dffd35449c828662d93ea43342e20e20..3c9f8a276014a8bceee03a02955f23f3eec76c3c 100644 --- a/GeoLib/AnalyticalGeometry-impl.h +++ b/GeoLib/AnalyticalGeometry-impl.h @@ -18,7 +18,7 @@ void getNewellPlane (const std::vector<T_POINT*>& pnts, d = 0; MathLib::Vector3 centroid; std::size_t n_pnts(pnts.size()); - for (size_t i(n_pnts - 1), j(0); j < n_pnts; i = j, j++) { + for (std::size_t i(n_pnts - 1), j(0); j < n_pnts; i = j, j++) { plane_normal[0] += ((*(pnts[i]))[1] - (*(pnts[j]))[1]) * ((*(pnts[i]))[2] + (*(pnts[j]))[2]); // projection on yz plane_normal[1] += ((*(pnts[i]))[2] - (*(pnts[j]))[2]) diff --git a/GeoLib/AnalyticalGeometry.cpp b/GeoLib/AnalyticalGeometry.cpp index 67b5f1d6e0f4f1c3e246110d56efd4fe258203dd..33ba8391632a2a3d1a5c9dbdbecd31940e119ec1 100644 --- a/GeoLib/AnalyticalGeometry.cpp +++ b/GeoLib/AnalyticalGeometry.cpp @@ -175,11 +175,11 @@ bool lineSegmentIntersect( } bool lineSegmentsIntersect(const GeoLib::Polyline* ply, - size_t &idx0, - size_t &idx1, + std::size_t &idx0, + std::size_t &idx1, GeoLib::Point& intersection_pnt) { - size_t n_segs(ply->getNumberOfPoints() - 1); + std::size_t n_segs(ply->getNumberOfPoints() - 1); /** * computing the intersections of all possible pairs of line segments of the given polyline * as follows: @@ -187,8 +187,8 @@ bool lineSegmentsIntersect(const GeoLib::Polyline* ply, * of the polyline and segment \f$s_2 = (C,B)\f$ defined by \f$j\f$-th and * \f$j+1\f$-st point of the polyline, \f$j>k+1\f$ */ - for (size_t k(0); k < n_segs - 2; k++) { - for (size_t j(k + 2); j < n_segs; j++) { + for (std::size_t k(0); k < n_segs - 2; k++) { + for (std::size_t j(k + 2); j < n_segs; j++) { if (k != 0 || j < n_segs - 1) { if (lineSegmentIntersect(*(ply->getPoint(k)), *(ply->getPoint(k + 1)), *(ply->getPoint(j)), *(ply->getPoint(j + 1)), diff --git a/GeoLib/Polyline.cpp b/GeoLib/Polyline.cpp index 56688a179abd82f2fe11c1dab7b14994ff6e4456..8fa1bd522e060163bd2533e7f088fc18ea5009da 100644 --- a/GeoLib/Polyline.cpp +++ b/GeoLib/Polyline.cpp @@ -403,7 +403,7 @@ double Polyline::getDistanceAlongPolyline(const MathLib::Point3d& pnt, double dist, lambda; bool found = false; // loop over all line segments of the polyline - for (size_t k = 0; k < this->getNumberOfPoints() - 1; k++) { + for (std::size_t k = 0; k < this->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? diff --git a/GeoLib/PolylineWithSegmentMarker.cpp b/GeoLib/PolylineWithSegmentMarker.cpp index 6cf489969360d1d808efcf083b63626b571d640b..81503c54152b2f291211594c748b9ca2970bddac 100644 --- a/GeoLib/PolylineWithSegmentMarker.cpp +++ b/GeoLib/PolylineWithSegmentMarker.cpp @@ -19,9 +19,9 @@ namespace GeoLib { PolylineWithSegmentMarker::PolylineWithSegmentMarker(GeoLib::Polyline const& polyline) : GeoLib::Polyline(polyline) { - const size_t n_pnts(getNumberOfPoints()); + const std::size_t n_pnts(getNumberOfPoints()); _marker.resize(n_pnts); - for (size_t k(0); k<n_pnts; k++) { + for (std::size_t k(0); k<n_pnts; k++) { _marker[k] = false; } } @@ -30,22 +30,22 @@ PolylineWithSegmentMarker::~PolylineWithSegmentMarker() {} -void PolylineWithSegmentMarker::markSegment(size_t seg_num, bool mark_val) +void PolylineWithSegmentMarker::markSegment(std::size_t seg_num, bool mark_val) { _marker[seg_num] = mark_val; } -bool PolylineWithSegmentMarker::isSegmentMarked(size_t seg_num) const +bool PolylineWithSegmentMarker::isSegmentMarked(std::size_t seg_num) const { return _marker[seg_num]; } -void PolylineWithSegmentMarker::addPoint(size_t pnt_id) +void PolylineWithSegmentMarker::addPoint(std::size_t pnt_id) { Polyline::addPoint(pnt_id); _marker.push_back(false); } -void PolylineWithSegmentMarker::insertPoint(size_t pos, size_t pnt_id) +void PolylineWithSegmentMarker::insertPoint(std::size_t pos, std::size_t pnt_id) { Polyline::insertPoint(pos, pnt_id); _marker.insert(_marker.begin()+pos, _marker[pos]); diff --git a/GeoLib/Raster.cpp b/GeoLib/Raster.cpp index 10bdd72a8d8c0696553a5c91c4b72e4512412696..38e481b6c031fe28abd39589ab77847f6d4461f7 100644 --- a/GeoLib/Raster.cpp +++ b/GeoLib/Raster.cpp @@ -30,9 +30,9 @@ void Raster::refineRaster(std::size_t scaling) for (std::size_t row(0); row<_n_rows; row++) { for (std::size_t col(0); col<_n_cols; col++) { - const size_t idx(row*_n_cols+col); + const std::size_t idx(row*_n_cols+col); for (std::size_t new_row(row*scaling); new_row<(row+1)*scaling; new_row++) { - const size_t idx0(new_row*_n_cols*scaling); + const std::size_t idx0(new_row*_n_cols*scaling); for (std::size_t new_col(col*scaling); new_col<(col+1)*scaling; new_col++) { new_raster_data[idx0+new_col] = _raster_data[idx]; } @@ -73,14 +73,14 @@ Raster* Raster::getRasterFromSurface(Surface const& sfc, double cell_size, doubl MathLib::Point3d const& ll(sfc.getAABB().getMinPoint()); MathLib::Point3d const& ur(sfc.getAABB().getMaxPoint()); - const std::size_t n_cols = static_cast<size_t>(std::fabs(ur[0]-ll[0]) / cell_size)+1; - const std::size_t n_rows = static_cast<size_t>(std::fabs(ur[1]-ll[1]) / cell_size)+1; - const size_t n_triangles (sfc.getNTriangles()); + const std::size_t n_cols = static_cast<std::size_t>(std::fabs(ur[0]-ll[0]) / cell_size)+1; + const std::size_t n_rows = static_cast<std::size_t>(std::fabs(ur[1]-ll[1]) / cell_size)+1; + const std::size_t n_triangles (sfc.getNTriangles()); double *z_vals (new double[n_cols*n_rows]); - size_t k(0); + std::size_t k(0); - for (size_t r(0); r < n_cols; r++) { - for (size_t c(0); c < n_rows; c++) { + for (std::size_t r(0); r < n_cols; r++) { + for (std::size_t c(0); c < n_rows; c++) { const double test_pnt[3] = { ll[0] + r*cell_size, ll[1] + c*cell_size, 0}; for (k=0; k<n_triangles; k++) { if (sfc[k]->containsPoint2D(test_pnt)) { diff --git a/GeoLib/SensorData.cpp b/GeoLib/SensorData.cpp index 28121cd3b4a69dd0535294725a2d5a0bf5b30777..44cdc197d237a924cfa0827d77d5950daef3cc99 100644 --- a/GeoLib/SensorData.cpp +++ b/GeoLib/SensorData.cpp @@ -30,17 +30,17 @@ SensorData::SensorData(const std::string &file_name) this->readDataFromFile(file_name); } -SensorData::SensorData(std::vector<size_t> time_steps) +SensorData::SensorData(std::vector<std::size_t> time_steps) : _start(time_steps[0]), _end(time_steps[time_steps.size()-1]), _step_size(0), _time_unit(TimeStepType::NONE), _time_steps(time_steps) { - for (size_t i=1; i<time_steps.size(); i++) + for (std::size_t i=1; i<time_steps.size(); i++) { if (time_steps[i-1]>=time_steps[i]) ERR("Error in SensorData() - Time series has no order!"); } } -SensorData::SensorData(size_t first_timestep, size_t last_timestep, size_t step_size) +SensorData::SensorData(std::size_t first_timestep, std::size_t last_timestep, std::size_t step_size) : _start(first_timestep), _end(last_timestep), _step_size(step_size), _time_unit(TimeStepType::NONE) { } @@ -76,7 +76,7 @@ void SensorData::addTimeSeries(SensorDataType data_name, std::vector<float> *dat const std::vector<float>* SensorData::getTimeSeries(SensorDataType time_series_name) const { - for (size_t i=0; i<_vec_names.size(); i++) + for (std::size_t i=0; i<_vec_names.size(); i++) { if (time_series_name == _vec_names[i]) return _data_vecs[i]; @@ -87,7 +87,7 @@ const std::vector<float>* SensorData::getTimeSeries(SensorDataType time_series_n std::string SensorData::getDataUnit(SensorDataType time_series_name) const { - for (size_t i=0; i<_vec_names.size(); i++) + for (std::size_t i=0; i<_vec_names.size(); i++) { if (time_series_name == _vec_names[i]) return _data_unit_string[i]; @@ -112,15 +112,15 @@ int SensorData::readDataFromFile(const std::string &file_name) getline(in, line); std::list<std::string> fields = BaseLib::splitString(line, '\t'); std::list<std::string>::const_iterator it (fields.begin()); - size_t nFields = fields.size(); + std::size_t nFields = fields.size(); if (nFields<2) return 0; - size_t nDataArrays(nFields-1); + std::size_t nDataArrays(nFields-1); //create vectors necessary to hold the data - for (size_t i=0; i<nDataArrays; i++) + for (std::size_t i=0; i<nDataArrays; i++) { this->_vec_names.push_back(SensorData::convertString2SensorDataType(*++it)); this->_data_unit_string.push_back(""); @@ -135,11 +135,11 @@ int SensorData::readDataFromFile(const std::string &file_name) if (nFields == fields.size()) { it = fields.begin(); - size_t pos(it->rfind(".")); - size_t current_time_step = (pos == std::string::npos) ? atoi((it++)->c_str()) : BaseLib::strDate2int(*it++); + std::size_t pos(it->rfind(".")); + std::size_t current_time_step = (pos == std::string::npos) ? atoi((it++)->c_str()) : BaseLib::strDate2int(*it++); this->_time_steps.push_back(current_time_step); - for (size_t i=0; i<nDataArrays; i++) + for (std::size_t i=0; i<nDataArrays; i++) this->_data_vecs[i]->push_back(static_cast<float>(strtod((it++)->c_str(), 0))); } else diff --git a/GeoLib/StationBorehole.cpp b/GeoLib/StationBorehole.cpp index efa3e29a4bbd8da2b38a7b8bc3102cc208b5837b..e836f4f5b0d5027bda911709f0cc1f3eea1a1467 100644 --- a/GeoLib/StationBorehole.cpp +++ b/GeoLib/StationBorehole.cpp @@ -48,14 +48,14 @@ StationBorehole::~StationBorehole(void) { // deletes profile vector of borehole, starting at layer 1 // the first point is NOT deleted as it points to the station object itself - for (size_t k(1); k < _profilePntVec.size(); k++) + for (std::size_t k(1); k < _profilePntVec.size(); k++) delete _profilePntVec[k]; } int StationBorehole::find(const std::string &str) { - size_t size = _soilName.size(); - for (size_t i = 0; i < size; i++) + std::size_t size = _soilName.size(); + for (std::size_t i = 0; i < size; i++) if (_soilName[i].find(str) == 0) return 1; return 0; @@ -89,14 +89,14 @@ int StationBorehole::addStratigraphy(const std::string &path, StationBorehole* b std::vector<std::list<std::string> > data; if (readStratigraphyFile(path, data)) { - size_t size = data.size(); - for (size_t i = 0; i < size; i++) + std::size_t size = data.size(); + for (std::size_t i = 0; i < size; i++) addLayer(data[i], borehole); // check if a layer is missing size = borehole->_soilName.size(); INFO("StationBorehole::addStratigraphy ToDo"); - // for (size_t i=0; i<size; i++) + // for (std::size_t i=0; i<size; i++) // { // if ((borehole->_soilLayerThickness[i] == -1) ||(borehole->_soilName[i].compare("") == 0)) // { @@ -145,8 +145,8 @@ int StationBorehole::addStratigraphy(const std::vector<Point*> &profile, const s if (((profile.size()-1) == soil_names.size()) && (soil_names.size()>0)) { this->_profilePntVec.push_back(profile[0]); - size_t nLayers = soil_names.size(); - for (size_t i=0; i<nLayers; i++) + std::size_t nLayers = soil_names.size(); + for (std::size_t i=0; i<nLayers; i++) { this->_profilePntVec.push_back(profile[i+1]); this->_soilName.push_back(soil_names[i]); @@ -166,9 +166,9 @@ int StationBorehole::addStratigraphies(const std::string &path, std::vector<Poin { std::string name; - size_t it = 0; - size_t nBoreholes = data.size(); - for (size_t i = 0; i < nBoreholes; i++) + std::size_t it = 0; + std::size_t nBoreholes = data.size(); + for (std::size_t i = 0; i < nBoreholes; i++) { std::list<std::string> fields = data[i]; @@ -256,8 +256,8 @@ StationBorehole* StationBorehole::createStation(const std::string &name, void StationBorehole::createSurrogateStratigraphies(std::vector<Point*>* boreholes) { - size_t nBoreholes = boreholes->size(); - for (size_t i = 0; i < nBoreholes; i++) + std::size_t nBoreholes = boreholes->size(); + for (std::size_t i = 0; i < nBoreholes; i++) { StationBorehole* bore = static_cast<StationBorehole*>((*boreholes)[i]); bore->addSoilLayer(bore->getDepth(), "depth"); @@ -271,7 +271,7 @@ void StationBorehole::addSoilLayer ( double thickness, const std::string &soil_n if (_profilePntVec.empty()) addSoilLayer ((*this)[0], (*this)[1], (*this)[2]-thickness, soil_name); else { - size_t idx (_profilePntVec.size()); + std::size_t idx (_profilePntVec.size()); // read coordinates from last above double x((*_profilePntVec[idx-1])[0]); double y((*_profilePntVec[idx-1])[1]); @@ -284,7 +284,7 @@ void StationBorehole::addSoilLayer ( double thickness, const std::string &soil_n if (_profilePntVec.empty()) addSoilLayer ((*this)[0], (*this)[1], (*this)[2], ""); - size_t idx (_profilePntVec.size()); + std::size_t idx (_profilePntVec.size()); double x((*_profilePntVec[idx - 1])[0]); double y((*_profilePntVec[idx - 1])[1]); double z((*_profilePntVec[0])[2] - thickness); diff --git a/GeoLib/Triangle.cpp b/GeoLib/Triangle.cpp index b7809f52bda475470bfebe98246f19a0d6142b91..214719674934a1cc22561c53b06d414b51328119 100644 --- a/GeoLib/Triangle.cpp +++ b/GeoLib/Triangle.cpp @@ -28,12 +28,13 @@ namespace GeoLib { Triangle::Triangle (std::vector<Point *> const &pnt_vec) : _pnts(pnt_vec), _initialized (false), _longest_edge (0.0) { - _pnt_ids[0] = std::numeric_limits<size_t>::max(); - _pnt_ids[1] = std::numeric_limits<size_t>::max(); - _pnt_ids[2] = std::numeric_limits<size_t>::max(); + _pnt_ids[0] = std::numeric_limits<std::size_t>::max(); + _pnt_ids[1] = std::numeric_limits<std::size_t>::max(); + _pnt_ids[2] = std::numeric_limits<std::size_t>::max(); } -Triangle::Triangle (std::vector<Point *> const &pnt_vec, size_t pnt_a, size_t pnt_b, size_t pnt_c) : +Triangle::Triangle (std::vector<Point *> const &pnt_vec, + std::size_t pnt_a, std::size_t pnt_b, std::size_t pnt_c) : _pnts(pnt_vec), _initialized (true), _longest_edge (0.0) { _pnt_ids[0] = pnt_a; @@ -47,7 +48,7 @@ Triangle::Triangle (std::vector<Point *> const &pnt_vec, size_t pnt_a, size_t pn _longest_edge = sqrt (_longest_edge); } -void Triangle::setTriangle (size_t pnt_a, size_t pnt_b, size_t pnt_c) +void Triangle::setTriangle (std::size_t pnt_a, std::size_t pnt_b, std::size_t pnt_c) { assert (pnt_a < _pnts.size() && pnt_b < _pnts.size() && pnt_c < _pnts.size()); _pnt_ids[0] = pnt_a;