Skip to content
Snippets Groups Projects
Commit 6f8009ef authored by Tom Fischer's avatar Tom Fischer
Browse files

[MGTL] Rm default args.; Use enum SearchAllNodes.

parent da0722fe
No related branches found
No related tags found
No related merge requests found
...@@ -53,7 +53,9 @@ std::unique_ptr<MeshLib::Mesh> appendLinesAlongPolylines( ...@@ -53,7 +53,9 @@ std::unique_ptr<MeshLib::Mesh> appendLinesAlongPolylines(
const GeoLib::Polyline* ply = (*ply_vec.getVector())[k]; const GeoLib::Polyline* ply = (*ply_vec.getVector())[k];
// search nodes on the polyline // search nodes on the polyline
MeshGeoToolsLib::MeshNodesAlongPolyline mshNodesAlongPoly(mesh, *ply, mesh.getMinEdgeLength()*0.5); MeshGeoToolsLib::MeshNodesAlongPolyline mshNodesAlongPoly(
mesh, *ply, mesh.getMinEdgeLength() * 0.5,
MeshGeoToolsLib::SearchAllNodes::Yes);
auto &vec_nodes_on_ply = mshNodesAlongPoly.getNodeIDs(); auto &vec_nodes_on_ply = mshNodesAlongPoly.getNodeIDs();
if (vec_nodes_on_ply.empty()) { if (vec_nodes_on_ply.empty()) {
std::string ply_name; std::string ply_name;
......
...@@ -109,7 +109,7 @@ MeshNodesOnPoint& MeshNodeSearcher::getMeshNodesOnPoint( ...@@ -109,7 +109,7 @@ MeshNodesOnPoint& MeshNodeSearcher::getMeshNodesOnPoint(
_mesh_grid, _mesh_grid,
pnt, pnt,
_search_length_algorithm.getSearchLength(), _search_length_algorithm.getSearchLength(),
_search_all_nodes == SearchAllNodes::Yes)); _search_all_nodes));
return *_mesh_nodes_on_points.back(); return *_mesh_nodes_on_points.back();
} }
...@@ -127,7 +127,7 @@ MeshNodesAlongPolyline& MeshNodeSearcher::getMeshNodesAlongPolyline( ...@@ -127,7 +127,7 @@ MeshNodesAlongPolyline& MeshNodeSearcher::getMeshNodesAlongPolyline(
// compute nodes (and supporting points) along polyline // compute nodes (and supporting points) along polyline
_mesh_nodes_along_polylines.push_back(new MeshNodesAlongPolyline( _mesh_nodes_along_polylines.push_back(new MeshNodesAlongPolyline(
_mesh, ply, _search_length_algorithm.getSearchLength(), _mesh, ply, _search_length_algorithm.getSearchLength(),
_search_all_nodes == SearchAllNodes::Yes)); _search_all_nodes));
return *_mesh_nodes_along_polylines.back(); return *_mesh_nodes_along_polylines.back();
} }
...@@ -147,7 +147,7 @@ MeshNodesAlongSurface& MeshNodeSearcher::getMeshNodesAlongSurface( ...@@ -147,7 +147,7 @@ MeshNodesAlongSurface& MeshNodeSearcher::getMeshNodesAlongSurface(
new MeshNodesAlongSurface(_mesh, new MeshNodesAlongSurface(_mesh,
sfc, sfc,
_search_length_algorithm.getSearchLength(), _search_length_algorithm.getSearchLength(),
_search_all_nodes == SearchAllNodes::Yes)); _search_all_nodes));
return *_mesh_nodes_along_surfaces.back(); return *_mesh_nodes_along_surfaces.back();
} }
......
...@@ -22,15 +22,16 @@ ...@@ -22,15 +22,16 @@
namespace MeshGeoToolsLib namespace MeshGeoToolsLib
{ {
MeshNodesAlongPolyline::MeshNodesAlongPolyline( MeshNodesAlongPolyline::MeshNodesAlongPolyline(MeshLib::Mesh const& mesh,
MeshLib::Mesh const& mesh, GeoLib::Polyline const& ply,
GeoLib::Polyline const& ply, double epsilon_radius,
double epsilon_radius, SearchAllNodes search_all_nodes)
bool search_all_nodes) : : _mesh(mesh), _ply(ply)
_mesh(mesh), _ply(ply)
{ {
assert(epsilon_radius > 0); assert(epsilon_radius > 0);
const std::size_t n_nodes (search_all_nodes ? _mesh.getNumberOfNodes() : _mesh.getNumberOfBaseNodes()); const std::size_t n_nodes(search_all_nodes == SearchAllNodes::Yes
? _mesh.getNumberOfNodes()
: _mesh.getNumberOfBaseNodes());
auto &mesh_nodes = _mesh.getNodes(); auto &mesh_nodes = _mesh.getNodes();
// loop over all nodes // loop over all nodes
for (std::size_t i = 0; i < n_nodes; i++) { for (std::size_t i = 0; i < n_nodes; i++) {
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include <vector> #include <vector>
#include "MeshGeoToolsLib/SearchAllNodes.h"
namespace GeoLib namespace GeoLib
{ {
class Polyline; class Polyline;
...@@ -45,9 +47,10 @@ public: ...@@ -45,9 +47,10 @@ public:
* @param search_all_nodes switch between searching all mesh nodes and * @param search_all_nodes switch between searching all mesh nodes and
* searching the base nodes. * searching the base nodes.
*/ */
MeshNodesAlongPolyline(MeshLib::Mesh const& mesh, MeshNodesAlongPolyline(
GeoLib::Polyline const& ply, double epsilon_radius, MeshLib::Mesh const& mesh, GeoLib::Polyline const& ply,
bool search_all_nodes = true); double epsilon_radius,
SearchAllNodes search_all_nodes);
/// return the mesh object /// return the mesh object
MeshLib::Mesh const& getMesh() const; MeshLib::Mesh const& getMesh() const;
......
...@@ -22,16 +22,16 @@ ...@@ -22,16 +22,16 @@
namespace MeshGeoToolsLib namespace MeshGeoToolsLib
{ {
MeshNodesAlongSurface::MeshNodesAlongSurface(MeshLib::Mesh const& mesh,
MeshNodesAlongSurface::MeshNodesAlongSurface( GeoLib::Surface const& sfc,
MeshLib::Mesh const& mesh, double epsilon_radius,
GeoLib::Surface const& sfc, SearchAllNodes search_all_nodes)
double epsilon_radius, : _mesh(mesh), _sfc(sfc)
bool search_all_nodes) :
_mesh(mesh), _sfc(sfc)
{ {
auto& mesh_nodes = _mesh.getNodes(); auto& mesh_nodes = _mesh.getNodes();
const std::size_t n_nodes (search_all_nodes ? _mesh.getNumberOfNodes() : _mesh.getNumberOfBaseNodes()); const std::size_t n_nodes(search_all_nodes == SearchAllNodes::Yes
? _mesh.getNumberOfNodes()
: _mesh.getNumberOfBaseNodes());
// loop over all nodes // loop over all nodes
for (std::size_t i = 0; i < n_nodes; i++) { for (std::size_t i = 0; i < n_nodes; i++) {
auto* node = mesh_nodes[i]; auto* node = mesh_nodes[i];
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include <vector> #include <vector>
#include "MeshGeoToolsLib/SearchAllNodes.h"
namespace GeoLib namespace GeoLib
{ {
class Surface; class Surface;
...@@ -44,7 +46,7 @@ public: ...@@ -44,7 +46,7 @@ public:
* searching the base nodes. * searching the base nodes.
*/ */
MeshNodesAlongSurface(MeshLib::Mesh const& mesh, GeoLib::Surface const& sfc, MeshNodesAlongSurface(MeshLib::Mesh const& mesh, GeoLib::Surface const& sfc,
double epsilon, bool search_all_nodes = true); double epsilon, SearchAllNodes search_all_nodes);
/// return the mesh object /// return the mesh object
MeshLib::Mesh const& getMesh() const; MeshLib::Mesh const& getMesh() const;
......
...@@ -12,13 +12,14 @@ ...@@ -12,13 +12,14 @@
namespace MeshGeoToolsLib namespace MeshGeoToolsLib
{ {
MeshNodesOnPoint::MeshNodesOnPoint(
MeshNodesOnPoint::MeshNodesOnPoint(MeshLib::Mesh const& mesh, GeoLib::Grid<MeshLib::Node> const &mesh_grid, MeshLib::Mesh const& mesh, GeoLib::Grid<MeshLib::Node> const& mesh_grid,
GeoLib::Point const& pnt, double epsilon_radius, bool search_all_nodes) GeoLib::Point const& pnt, double epsilon_radius,
: _mesh(mesh), _pnt(pnt) SearchAllNodes search_all_nodes)
: _mesh(mesh), _pnt(pnt)
{ {
std::vector<std::size_t> vec_ids(mesh_grid.getPointsInEpsilonEnvironment(pnt, epsilon_radius)); std::vector<std::size_t> vec_ids(mesh_grid.getPointsInEpsilonEnvironment(pnt, epsilon_radius));
if (search_all_nodes) if (search_all_nodes == SearchAllNodes::Yes)
_msh_node_ids = vec_ids; _msh_node_ids = vec_ids;
else { else {
for (auto id : vec_ids) for (auto id : vec_ids)
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#include "GeoLib/Point.h" #include "GeoLib/Point.h"
#include "GeoLib/Grid.h" #include "GeoLib/Grid.h"
#include "MeshGeoToolsLib/SearchAllNodes.h"
#include "MeshLib/Node.h" #include "MeshLib/Node.h"
namespace MeshLib namespace MeshLib
...@@ -35,10 +37,12 @@ public: ...@@ -35,10 +37,12 @@ public:
* @param mesh_grid Grid object constructed with mesh nodes * @param mesh_grid Grid object constructed with mesh nodes
* @param pnt a point * @param pnt a point
* @param epsilon_radius Search radius * @param epsilon_radius Search radius
* @param search_all_nodes whether this shearches all nodes or only base nodes * @param search_all_nodes whether this searches all nodes or only base nodes
*/ */
MeshNodesOnPoint(MeshLib::Mesh const& mesh, GeoLib::Grid<MeshLib::Node> const &mesh_grid, MeshNodesOnPoint(MeshLib::Mesh const& mesh,
GeoLib::Point const& pnt, double epsilon_radius, bool search_all_nodes = true); GeoLib::Grid<MeshLib::Node> const& mesh_grid,
GeoLib::Point const& pnt, double epsilon_radius,
SearchAllNodes search_all_nodes);
/// return the mesh object /// return the mesh object
MeshLib::Mesh const& getMesh() const { return _mesh; } MeshLib::Mesh const& getMesh() const { return _mesh; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment