Skip to content
Snippets Groups Projects
Unverified Commit 4ac17b72 authored by Tom Fischer's avatar Tom Fischer Committed by GitHub
Browse files

Merge pull request #2716 from TomFischer/ImproveErrorMessage

Improve error message in MeshNodeSearcher
parents 26d00075 8aac3cc3
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "MeshNodeSearcher.h" #include "MeshNodeSearcher.h"
#include <typeinfo> #include <typeinfo>
#include <sstream>
#include "HeuristicSearchLength.h" #include "HeuristicSearchLength.h"
#include "MeshNodesAlongPolyline.h" #include "MeshNodesAlongPolyline.h"
...@@ -109,12 +110,21 @@ std::vector<std::size_t> MeshNodeSearcher::getMeshNodeIDs( ...@@ -109,12 +110,21 @@ std::vector<std::size_t> MeshNodeSearcher::getMeshNodeIDs(
} }
if (ids.size() != 1) if (ids.size() != 1)
{ {
std::stringstream ss;
auto const& bulk_nodes = _mesh.getNodes();
for (auto const id : ids)
{
ss << "- bulk node: " << (*bulk_nodes[id]) << ", distance: "
<< std::sqrt(MathLib::sqrDist(bulk_nodes[id]->getCoords(),
p.getCoords()))
<< "\n";
}
OGS_FATAL( OGS_FATAL(
"Found %d nodes in the mesh for point %d : (%g, %g, %g) in %g " "Found %d nodes in the mesh for point %d : (%g, %g, %g) in %g "
"epsilon radius in the mesh '%s'. Expected to find exactly one " "epsilon radius in the mesh '%s'. Expected to find exactly one "
"node.", "node.\n%s",
ids.size(), p.getID(), p[0], p[1], p[2], epsilon_radius, ids.size(), p.getID(), p[0], p[1], p[2], epsilon_radius,
_mesh.getName().c_str()); _mesh.getName().c_str(), ss.str().c_str());
} }
node_ids.push_back(ids.front()); node_ids.push_back(ids.front());
} }
...@@ -228,9 +238,4 @@ MeshNodeSearcher const& MeshNodeSearcher::getMeshNodeSearcher( ...@@ -228,9 +238,4 @@ MeshNodeSearcher const& MeshNodeSearcher::getMeshNodeSearcher(
return *_mesh_node_searchers[mesh_id]; return *_mesh_node_searchers[mesh_id];
} }
std::size_t MeshNodeSearcher::getMeshId() const
{
return _mesh.getID();
}
} // end namespace MeshGeoToolsLib } // end namespace MeshGeoToolsLib
...@@ -140,11 +140,6 @@ public: ...@@ -140,11 +140,6 @@ public:
MeshNodesAlongSurface& getMeshNodesAlongSurface( MeshNodesAlongSurface& getMeshNodesAlongSurface(
GeoLib::Surface const& sfc) const; GeoLib::Surface const& sfc) const;
/**
* Get the mesh this searcher operates on.
*/
std::size_t getMeshId() const;
/** /**
* Returns a (possibly new) mesh node searcher for the mesh. * Returns a (possibly new) mesh node searcher for the mesh.
* A new one will be created, if it does not already exists. * A new one will be created, if it does not already exists.
......
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