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

Avoid creation of temporary objects while call isPntInBoundingVolume and isPntInSfc.

parent eb099fcf
No related branches found
No related tags found
No related merge requests found
...@@ -32,9 +32,9 @@ MeshNodesAlongSurface::MeshNodesAlongSurface( ...@@ -32,9 +32,9 @@ MeshNodesAlongSurface::MeshNodesAlongSurface(
// 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];
if (!sfc.isPntInBoundingVolume(node->getCoords())) if (!sfc.isPntInBoundingVolume(*node))
continue; continue;
if (sfc.isPntInSfc(node->getCoords())) { if (sfc.isPntInSfc(*node)) {
_msh_node_ids.push_back(node->getID()); _msh_node_ids.push_back(node->getID());
} }
} }
......
...@@ -41,10 +41,9 @@ LinearInterpolationOnSurface::LinearInterpolationOnSurface( ...@@ -41,10 +41,9 @@ LinearInterpolationOnSurface::LinearInterpolationOnSurface(
double LinearInterpolationOnSurface::operator()(const MathLib::Point3d& pnt) const double LinearInterpolationOnSurface::operator()(const MathLib::Point3d& pnt) const
{ {
const double* coords = pnt.getCoords(); if (!_sfc.isPntInBoundingVolume(pnt))
if (!_sfc.isPntInBoundingVolume(coords))
return _default_value; return _default_value;
auto* tri = _sfc.findTriangle(coords); auto* tri = _sfc.findTriangle(pnt);
if (tri == nullptr) if (tri == nullptr)
return _default_value; return _default_value;
...@@ -58,7 +57,7 @@ double LinearInterpolationOnSurface::operator()(const MathLib::Point3d& pnt) con ...@@ -58,7 +57,7 @@ double LinearInterpolationOnSurface::operator()(const MathLib::Point3d& pnt) con
pnt_values[j] = _default_value; pnt_values[j] = _default_value;
} }
} }
double val = interpolateInTri(*tri, pnt_values.data(), coords); double val = interpolateInTri(*tri, pnt_values.data(), pnt);
return val; return val;
} }
......
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