diff --git a/Applications/FileIO/Gmsh/GMSHLineLoop.h b/Applications/FileIO/Gmsh/GMSHLineLoop.h index d6e1522f60473a10eb33395a10fa7c2eb60ca36f..38df94f28d48acc12272643d70de9838d640bfee 100644 --- a/Applications/FileIO/Gmsh/GMSHLineLoop.h +++ b/Applications/FileIO/Gmsh/GMSHLineLoop.h @@ -26,7 +26,7 @@ public: virtual ~GMSHLineLoop(); bool isSurface() const { return _is_sfc; } void setSurface(bool is_sfc) { _is_sfc = is_sfc; } - void write(std::ostream& os, std::size_t offset, + void write(std::ostream& os, std::size_t line_offset, std::size_t sfc_offset = 0) const; private: diff --git a/Applications/FileIO/PetrelInterface.h b/Applications/FileIO/PetrelInterface.h index 6606bdc70909c3957ebf7e0224be3fcac1b71190..3324b079e700b7261ba27159fe101d2150db2707 100644 --- a/Applications/FileIO/PetrelInterface.h +++ b/Applications/FileIO/PetrelInterface.h @@ -37,7 +37,7 @@ public: PetrelInterface(std::list<std::string> &sfc_fnames, std::list<std::string> &well_path_fnames, std::string &unique_model_name, - GeoLib::GEOObjects* obj); + GeoLib::GEOObjects* geo_obj); PetrelInterface(PetrelInterface const& other) = delete; PetrelInterface(PetrelInterface&& other) = delete; diff --git a/GeoLib/GEOObjects.cpp b/GeoLib/GEOObjects.cpp index c6830eeae007e13d72f4cae98fd4f1ba6c0b6b79..d45a6eb65a5351fbac3d355e165ce6d4eb2ba524 100644 --- a/GeoLib/GEOObjects.cpp +++ b/GeoLib/GEOObjects.cpp @@ -415,8 +415,8 @@ std::string GEOObjects::getElementNameByID(const std::string& geometry_name, return name; } -int GEOObjects::mergeGeometries (std::vector<std::string> const & geo_names, - std::string &merged_geo_name) +int GEOObjects::mergeGeometries(std::vector<std::string> const& geo_names, + std::string& merged_geo_name) { const std::size_t n_geo_names(geo_names.size()); @@ -538,7 +538,8 @@ void GEOObjects::mergeSurfaces(std::vector<std::string> const& geo_names, const std::size_t n_geo_names(geo_names.size()); std::vector<std::size_t> sfc_offsets(n_geo_names, 0); auto merged_sfcs = std::make_unique<std::vector<GeoLib::Surface*>>(); - std::unique_ptr<std::map<std::string, std::size_t>> merged_sfc_names; + auto merged_sfc_names = + std::make_unique<std::map<std::string, std::size_t>>(); for (std::size_t j(0); j < n_geo_names; j++) { const std::vector<GeoLib::Surface*>* sfcs (this->getSurfaceVec(geo_names[j])); if (sfcs) { diff --git a/GeoLib/GEOObjects.h b/GeoLib/GEOObjects.h index a9ff7b3f3c729bfa31180a5518325747897aa3d3..7ef08bc47d8ca057688088adc6ab2233c8fd3453 100644 --- a/GeoLib/GEOObjects.h +++ b/GeoLib/GEOObjects.h @@ -242,11 +242,12 @@ public: /** * Method mergeGeometries merges the geometries that are given by the names in the vector. * Stations points are not included in the resulting merged geometry. - * @param names the names of the geometries that are to be merged + * @param geo_names the names of the geometries that are to be merged * @param merged_geo_name the name of the resulting geometry * @return 0 if success, 1 if no point-list is found for at least one of the geometries and 2 if the mergelist only contains less than two geometry */ - int mergeGeometries(std::vector<std::string> const & names, std::string &merged_geo_name); + int mergeGeometries(std::vector<std::string> const& geo_names, + std::string& merged_geo_name); /// Renames an existing geometry, i.e. renames the internal PointVec, /// PolylineVec and the SurfaceVec objects from \c old_name to \c new_name. diff --git a/GeoLib/Grid.h b/GeoLib/Grid.h index f5eebc3bb82f58d593e307e7c065fb6d155b98a6..5a56cbab60e746947ba9a696eb701c132f33704d 100644 --- a/GeoLib/Grid.h +++ b/GeoLib/Grid.h @@ -404,18 +404,24 @@ std::array<std::size_t,3> Grid<POINT>::getGridCoords(T const& pnt) const template <typename POINT> template <typename P> -std::array<double,6> Grid<POINT>::getPointCellBorderDistances(P const& p, +std::array<double,6> Grid<POINT>::getPointCellBorderDistances(P const& pnt, std::array<std::size_t,3> const& coords) const { std::array<double,6> dists{}; - dists[0] = std::abs(p[2]-_min_pnt[2] + coords[2]*_step_sizes[2]); // bottom - dists[5] = std::abs(p[2]-_min_pnt[2] + (coords[2]+1)*_step_sizes[2]); // top - - dists[1] = std::abs(p[1]-_min_pnt[1] + coords[1]*_step_sizes[1]); // front - dists[3] = std::abs(p[1]-_min_pnt[1] + (coords[1]+1)*_step_sizes[1]); // back - - dists[4] = std::abs(p[0]-_min_pnt[0] + coords[0]*_step_sizes[0]); // left - dists[2] = std::abs(p[0]-_min_pnt[0] + (coords[0]+1)*_step_sizes[0]); // right + dists[0] = + std::abs(pnt[2] - _min_pnt[2] + coords[2] * _step_sizes[2]); // bottom + dists[5] = std::abs(pnt[2] - _min_pnt[2] + + (coords[2] + 1) * _step_sizes[2]); // top + + dists[1] = + std::abs(pnt[1] - _min_pnt[1] + coords[1] * _step_sizes[1]); // front + dists[3] = std::abs(pnt[1] - _min_pnt[1] + + (coords[1] + 1) * _step_sizes[1]); // back + + dists[4] = + std::abs(pnt[0] - _min_pnt[0] + coords[0] * _step_sizes[0]); // left + dists[2] = std::abs(pnt[0] - _min_pnt[0] + + (coords[0] + 1) * _step_sizes[0]); // right return dists; } diff --git a/GeoLib/OctTree-impl.h b/GeoLib/OctTree-impl.h index 42cc4583dada32e2a5b7a8c43b53c8b059327040..7319743b3bcd703d582e9e7126f8300d39d1e655 100644 --- a/GeoLib/OctTree-impl.h +++ b/GeoLib/OctTree-impl.h @@ -72,14 +72,14 @@ bool OctTree<POINT, MAX_POINTS>::addPoint(POINT * pnt, POINT *& ret_pnt) MathLib::Point3d max( std::array<double,3>{{(*pnt)[0]+_eps, (*pnt)[1]+_eps, (*pnt)[2]+_eps}}); getPointsInRange(min, max, query_pnts); - if (! query_pnts.empty()) { - // check Euclidean norm - for (auto p : query_pnts) { - if (MathLib::sqrDist(*p, *pnt) <= _eps*_eps) { - ret_pnt = p; - return false; - } - } + auto const it = std::find_if( + query_pnts.begin(), query_pnts.end(), [pnt, this](auto const* p) { + return MathLib::sqrDist(*p, *pnt) < _eps * _eps; + }); + if (it != query_pnts.end()) + { + ret_pnt = *it; + return false; } // the point pnt is not yet in the OctTree diff --git a/GeoLib/Polygon.cpp b/GeoLib/Polygon.cpp index 29f495cb372de68e591027b118b9d4771f108f88..5c55877ec65acaf42e070521a15c6ed3279096d9 100644 --- a/GeoLib/Polygon.cpp +++ b/GeoLib/Polygon.cpp @@ -244,12 +244,13 @@ bool Polygon::isPartOfPolylineInPolygon(const Polyline& ply) const } bool Polygon::getNextIntersectionPointPolygonLine( - GeoLib::LineSegment const& seg, GeoLib::Point & intersection, + GeoLib::LineSegment const& seg, GeoLib::Point& intersection_pnt, std::size_t& seg_num) const { if (_simple_polygon_list.size() == 1) { for (auto seg_it(begin()+seg_num); seg_it != end(); ++seg_it) { - if (GeoLib::lineSegmentIntersect(*seg_it, seg, intersection)) { + if (GeoLib::lineSegmentIntersect(*seg_it, seg, intersection_pnt)) + { seg_num = seg_it.getSegmentNumber(); return true; } @@ -260,7 +261,9 @@ bool Polygon::getNextIntersectionPointPolygonLine( for (auto seg_it(polygon->begin()); seg_it != polygon->end(); ++seg_it) { - if (GeoLib::lineSegmentIntersect(*seg_it, seg, intersection)) { + if (GeoLib::lineSegmentIntersect(*seg_it, seg, + intersection_pnt)) + { seg_num = seg_it.getSegmentNumber(); return true; } diff --git a/GeoLib/QuadTree.h b/GeoLib/QuadTree.h index b9cbdef9563dbbee13ab5b7a2892917f8755ca43..f61095755da3c19e92b9d01bc9ad13a7451595a9 100644 --- a/GeoLib/QuadTree.h +++ b/GeoLib/QuadTree.h @@ -54,18 +54,10 @@ public: : _father(nullptr), _ll(std::move(ll)), _ur(std::move(ur)), - _depth(0), - _is_leaf(true), _max_points_per_leaf(max_points_per_leaf) { assert (_max_points_per_leaf > 0); - // init children - for (auto& child : _children) - { - child = nullptr; - } - if ((_ur[0] - _ll[0]) > (_ur[1] - _ll[1])) { _ur[1] = _ll[1] + _ur[0] - _ll[0]; @@ -508,14 +500,8 @@ private: _ll(std::move(ll)), _ur(std::move(ur)), _depth(depth), - _is_leaf(true), _max_points_per_leaf(max_points_per_leaf) { - // init children - for (auto& child : _children) - { - child = nullptr; - } } void splitNode () @@ -643,7 +629,8 @@ private: * _children[2] is south west child * _children[3] is south east child */ - QuadTree<POINT>* _children[4]; + std::array<QuadTree<POINT>*, 4> _children = {nullptr, nullptr, nullptr, + nullptr}; /** * lower left point of the square */ @@ -652,9 +639,9 @@ private: * upper right point of the square */ POINT _ur; - std::size_t _depth; + std::size_t _depth = 0; std::vector<POINT const*> _pnts; - bool _is_leaf; + bool _is_leaf = true; /** * maximum number of points per leaf */ diff --git a/GeoLib/SurfaceGrid.cpp b/GeoLib/SurfaceGrid.cpp index 85992e8a028d014bc3e7ae056dbc831eb24f7d93..3f66c58e6ad2f9113c395a160936924f62e56ea6 100644 --- a/GeoLib/SurfaceGrid.cpp +++ b/GeoLib/SurfaceGrid.cpp @@ -201,9 +201,11 @@ SurfaceGrid::getGridCellCoordinates(MathLib::Point3d const& p) const return boost::optional<std::array<std::size_t, 3>>(coords); } -bool SurfaceGrid::isPointInSurface(MathLib::Point3d const& p, double eps) const +bool SurfaceGrid::isPointInSurface(MathLib::Point3d const& pnt, + double eps) const { - boost::optional<std::array<std::size_t,3>> optional_c(getGridCellCoordinates(p)); + boost::optional<std::array<std::size_t, 3>> optional_c( + getGridCellCoordinates(pnt)); if (!optional_c) { return false; } @@ -211,15 +213,11 @@ bool SurfaceGrid::isPointInSurface(MathLib::Point3d const& p, double eps) const std::size_t const grid_cell_idx(c[0]+c[1]*_n_steps[0]+c[2]*_n_steps[0]*_n_steps[1]); std::vector<Triangle const*> const& triangles(_triangles_in_grid_box[grid_cell_idx]); - bool nfound(true); - const std::size_t n_triangles(triangles.size()); - for (std::size_t k(0); k < n_triangles && nfound; k++) { - if (triangles[k]->containsPoint(p, eps)) { - nfound = false; - } - } - - return !nfound; + auto const it = std::find_if(triangles.begin(), triangles.end(), + [eps, pnt](auto const* triangle) { + return triangle->containsPoint(pnt, eps); + }); + return it != triangles.end(); } } // end namespace GeoLib diff --git a/MeshLib/MeshEditing/Mesh2MeshPropertyInterpolation.h b/MeshLib/MeshEditing/Mesh2MeshPropertyInterpolation.h index 456ced78ac2008fa1b02315541babb5754d1cbc2..a21574193217575c0e3d54a44c55c7083d44c02e 100644 --- a/MeshLib/MeshEditing/Mesh2MeshPropertyInterpolation.h +++ b/MeshLib/MeshEditing/Mesh2MeshPropertyInterpolation.h @@ -41,11 +41,11 @@ public: /** * Calculates entries for the property vector and sets appropriate indices * in the mesh elements. - * @param mesh the mesh the property information will be calculated and set - * via weighted interpolation + * @param dest_mesh the mesh the property information will be calculated and + * set via weighted interpolation * @return true if the operation was successful, false on error */ - bool setPropertiesForMesh(Mesh& mesh) const; + bool setPropertiesForMesh(Mesh& dest_mesh) const; private: /** diff --git a/MeshLib/MeshSearch/MeshElementGrid.cpp b/MeshLib/MeshSearch/MeshElementGrid.cpp index 8e45f5c60fc54f1fa326ab6fc7044abd36ed76f0..0aa33c7554d144958547a50a731861ce8151b4d1 100644 --- a/MeshLib/MeshSearch/MeshElementGrid.cpp +++ b/MeshLib/MeshSearch/MeshElementGrid.cpp @@ -21,11 +21,11 @@ #include "GeoLib/GEOObjects.h" -namespace MeshLib { - -MeshElementGrid::MeshElementGrid(MeshLib::Mesh const& sfc_mesh) : - _aabb{sfc_mesh.getNodes().cbegin(), sfc_mesh.getNodes().cend()}, - _n_steps({{1,1,1}}) +namespace MeshLib +{ +MeshElementGrid::MeshElementGrid(MeshLib::Mesh const& mesh) + : _aabb{mesh.getNodes().cbegin(), mesh.getNodes().cend()}, + _n_steps({{1, 1, 1}}) { auto getDimensions = [](MathLib::Point3d const& min, MathLib::Point3d const& max) @@ -49,7 +49,7 @@ MeshElementGrid::MeshElementGrid(MeshLib::Mesh const& sfc_mesh) : std::array<double, 3> delta{{ max_pnt[0] - min_pnt[0], max_pnt[1] - min_pnt[1], max_pnt[2] - min_pnt[2] }}; - const std::size_t n_eles(sfc_mesh.getNumberOfElements()); + const std::size_t n_eles(mesh.getNumberOfElements()); const std::size_t n_eles_per_cell(100); // *** condition: n_eles / n_cells < n_eles_per_cell @@ -98,7 +98,7 @@ MeshElementGrid::MeshElementGrid(MeshLib::Mesh const& sfc_mesh) : } _elements_in_grid_box.resize(_n_steps[0]*_n_steps[1]*_n_steps[2]); - sortElementsInGridCells(sfc_mesh); + sortElementsInGridCells(mesh); } MathLib::Point3d const& MeshElementGrid::getMinPoint() const @@ -111,9 +111,10 @@ MathLib::Point3d const& MeshElementGrid::getMaxPoint() const return _aabb.getMaxPoint(); } -void MeshElementGrid::sortElementsInGridCells(MeshLib::Mesh const& sfc_mesh) +void MeshElementGrid::sortElementsInGridCells(MeshLib::Mesh const& mesh) { - for (auto const element : sfc_mesh.getElements()) { + for (auto const element : mesh.getElements()) + { if (! sortElementInGridCells(*element)) { OGS_FATAL("Sorting element (id={:d}) into mesh element grid.", element->getID()); diff --git a/MeshLib/MeshSearch/MeshElementGrid.h b/MeshLib/MeshSearch/MeshElementGrid.h index caae5852840bce90d50641432eb640e438be3bcb..bd546ffee627db920d944a78963c9a250d03b607 100644 --- a/MeshLib/MeshSearch/MeshElementGrid.h +++ b/MeshLib/MeshSearch/MeshElementGrid.h @@ -75,7 +75,7 @@ public: MathLib::Point3d const& getMaxPoint() const; private: - void sortElementsInGridCells(MeshLib::Mesh const& sfc_mesh); + void sortElementsInGridCells(MeshLib::Mesh const& mesh); bool sortElementInGridCells(MeshLib::Element const& element); GeoLib::AABB _aabb; diff --git a/ProcessLib/GroundwaterFlow/CMakeLists.txt b/ProcessLib/GroundwaterFlow/CMakeLists.txt deleted file mode 100644 index ec13ffc725965b9eedfe4c4882a52a334ad132eb..0000000000000000000000000000000000000000 --- a/ProcessLib/GroundwaterFlow/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -append_source_files(SOURCES) - -ogs_add_library(GroundwaterFlow ${SOURCES}) - -target_link_libraries(GroundwaterFlow PUBLIC ProcessLib PRIVATE ParameterLib) - -if(BUILD_TESTING) - include(Tests.cmake) -endif()