diff --git a/FileIO/MeshIO/GMSHAdaptiveMeshDensity.cpp b/FileIO/MeshIO/GMSHAdaptiveMeshDensity.cpp index 13b28ceacb3adc1605a8e12a52d042fe41a1c22c..37f97d53354db32e8873e58c7c684a8557a822fb 100644 --- a/FileIO/MeshIO/GMSHAdaptiveMeshDensity.cpp +++ b/FileIO/MeshIO/GMSHAdaptiveMeshDensity.cpp @@ -20,11 +20,14 @@ // GeoLib #include "Polygon.h" +#ifndef NDEBUG +#include "Polyline.h" +#endif namespace FileIO { GMSHAdaptiveMeshDensity::GMSHAdaptiveMeshDensity(double pnt_density, double station_density, - size_t max_pnts_per_leaf) : + std::size_t max_pnts_per_leaf) : _pnt_density(pnt_density), _station_density(station_density), _max_pnts_per_leaf(max_pnts_per_leaf), _quad_tree(NULL) { @@ -41,12 +44,12 @@ void GMSHAdaptiveMeshDensity::init(std::vector<GeoLib::Point const*> const& pnts DBUG("GMSHAdaptiveMeshDensity::init(): computing axis aligned bounding box (2D) for quadtree."); GeoLib::Point min(pnts[0]->getCoords()), max(pnts[0]->getCoords()); - size_t n_pnts(pnts.size()); - for (size_t k(1); k<n_pnts; k++) { - for (size_t j(0); j < 2; j++) + std::size_t n_pnts(pnts.size()); + for (std::size_t k(1); k<n_pnts; k++) { + for (std::size_t j(0); j < 2; j++) if ((*(pnts[k]))[j] < min[j]) min[j] = (*(pnts[k]))[j]; - for (size_t j(0); j < 2; j++) + for (std::size_t j(0); j < 2; j++) if ((*(pnts[k]))[j] > max[j]) max[j] = (*(pnts[k]))[j]; } @@ -66,9 +69,9 @@ void GMSHAdaptiveMeshDensity::init(std::vector<GeoLib::Point const*> const& pnts void GMSHAdaptiveMeshDensity::addPoints(std::vector<GeoLib::Point const*> const& pnts) { // *** QuadTree - insert points - const size_t n_pnts(pnts.size()); + const std::size_t n_pnts(pnts.size()); DBUG("GMSHAdaptiveMeshDensity::addPoints(): Inserting %d points into quadtree.", n_pnts); - for (size_t k(0); k < n_pnts; k++) + for (std::size_t k(0); k < n_pnts; k++) _quad_tree->addPoint(pnts[k]); DBUG("GMSHAdaptiveMeshDensity::addPoints(): \tok."); _quad_tree->balance(); @@ -85,14 +88,14 @@ double GMSHAdaptiveMeshDensity::getMeshDensityAtStation(GeoLib::Point const* con { GeoLib::Point ll, ur; _quad_tree->getLeaf(*pnt, ll, ur); - return (_station_density * (ur[0] - ll[0])); + return _station_density * (ur[0] - ll[0]); } void GMSHAdaptiveMeshDensity::getSteinerPoints (std::vector<GeoLib::Point*> & pnts, - size_t additional_levels) const + std::size_t additional_levels) const { // get Steiner points - size_t max_depth(0); + std::size_t max_depth(0); _quad_tree->getMaxDepth(max_depth); std::list<GeoLib::QuadTree<GeoLib::Point>*> leaf_list; @@ -107,10 +110,10 @@ void GMSHAdaptiveMeshDensity::getSteinerPoints (std::vector<GeoLib::Point*> & pn if ((*it)->getDepth() + additional_levels > max_depth) { additional_levels = max_depth - (*it)->getDepth(); } - const size_t n_pnts_per_quad_dim (MathLib::fastpow(2, additional_levels)); + const std::size_t n_pnts_per_quad_dim (MathLib::fastpow(2, additional_levels)); const double delta ((ur[0] - ll[0]) / (2 * n_pnts_per_quad_dim)); - for (size_t i(0); i<n_pnts_per_quad_dim; i++) { - for (size_t j(0); j<n_pnts_per_quad_dim; j++) { + for (std::size_t i(0); i<n_pnts_per_quad_dim; i++) { + for (std::size_t j(0); j<n_pnts_per_quad_dim; j++) { pnts.push_back(new GeoLib::Point (ll[0] + (2*i+1) * delta, ll[1] + (2*j+1) * delta, 0.0)); } } @@ -121,7 +124,7 @@ void GMSHAdaptiveMeshDensity::getSteinerPoints (std::vector<GeoLib::Point*> & pn #ifndef NDEBUG void GMSHAdaptiveMeshDensity::getQuadTreeGeometry(std::vector<GeoLib::Point*> &pnts, - std::vector<GeoLib::Polyline*> &plys) const + std::vector<GeoLib::Polyline*> &plys) const { std::list<GeoLib::QuadTree<GeoLib::Point>*> leaf_list; _quad_tree->getLeafs(leaf_list); @@ -131,7 +134,7 @@ void GMSHAdaptiveMeshDensity::getQuadTreeGeometry(std::vector<GeoLib::Point*> &p // fetch corner points from leaf GeoLib::Point *ll(new GeoLib::Point), *ur(new GeoLib::Point); (*it)->getSquarePoints(*ll, *ur); - size_t pnt_offset (pnts.size()); + std::size_t pnt_offset (pnts.size()); pnts.push_back(ll); pnts.push_back(new GeoLib::Point((*ur)[0], (*ll)[1], 0.0)); pnts.push_back(ur); diff --git a/FileIO/MeshIO/GMSHAdaptiveMeshDensity.h b/FileIO/MeshIO/GMSHAdaptiveMeshDensity.h index 8c62eec20153d59f6fcc3bf9badfd45529524fa0..17dd4daa18bd1d2ce49388ed2c07fe14f7df94a8 100644 --- a/FileIO/MeshIO/GMSHAdaptiveMeshDensity.h +++ b/FileIO/MeshIO/GMSHAdaptiveMeshDensity.h @@ -18,27 +18,33 @@ // GeoLib #include "Point.h" #include "QuadTree.h" -#ifndef NDEBUG -#include "Polyline.h" -#endif -namespace GeoLib { +namespace GeoLib +{ class Polygon; +#ifndef NDEBUG +class Polyline; +#endif } -namespace FileIO { - -class GMSHAdaptiveMeshDensity: public GMSHMeshDensityStrategy { +namespace FileIO +{ +class GMSHAdaptiveMeshDensity : public GMSHMeshDensityStrategy +{ public: - GMSHAdaptiveMeshDensity(double pnt_density, double station_density, std::size_t max_pnts_per_leaf); + GMSHAdaptiveMeshDensity(double pnt_density, + double station_density, + std::size_t max_pnts_per_leaf); virtual ~GMSHAdaptiveMeshDensity(); void init(std::vector<GeoLib::Point const*> const& pnts); - double getMeshDensityAtPoint(GeoLib::Point const*const pnt) const; + double getMeshDensityAtPoint(GeoLib::Point const* const pnt) const; void addPoints(std::vector<GeoLib::Point const*> const& pnts); - double getMeshDensityAtStation(GeoLib::Point const*const) const; - void getSteinerPoints (std::vector<GeoLib::Point*> & pnts, std::size_t additional_levels = 0) const; + double getMeshDensityAtStation(GeoLib::Point const* const) const; + void getSteinerPoints (std::vector<GeoLib::Point*> & pnts, + std::size_t additional_levels = 0) const; #ifndef NDEBUG - void getQuadTreeGeometry(std::vector<GeoLib::Point*> &pnts, std::vector<GeoLib::Polyline*> &plys) const; + void getQuadTreeGeometry(std::vector<GeoLib::Point*> &pnts, + std::vector<GeoLib::Polyline*> &plys) const; #endif private: @@ -47,7 +53,6 @@ private: std::size_t _max_pnts_per_leaf; GeoLib::QuadTree<GeoLib::Point> *_quad_tree; }; - } // end namespace FileIO #endif /* GMSHADAPTIVEMESHDENSITY_H_ */