Skip to content
Snippets Groups Projects
Commit f1c10909 authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

[PL] PV: Use findElementOrError() for mesh search.

parent 9b83db59
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,7 @@
#include <utility>
#include <logog/include/logog.hpp>
#include "BaseLib/Algorithm.h"
#include "MeshGeoToolsLib/ConstructMeshesFromGeometries.h"
#include "MeshLib/Mesh.h"
#include "ProcessLib/BoundaryCondition/BoundaryCondition.h"
......@@ -69,19 +70,13 @@ MeshLib::Mesh const& findMeshInConfig(
//
// Find and extract mesh from the list of meshes.
//
auto const mesh_it = std::find_if(
begin(meshes), end(meshes), [&mesh_name](auto const& mesh) {
auto const& mesh = *BaseLib::findElementOrError(
begin(meshes), end(meshes),
[&mesh_name](auto const& mesh) {
assert(mesh != nullptr);
return mesh->getName() == mesh_name;
});
if (mesh_it == end(meshes))
{
OGS_FATAL("Required mesh with name '%s' not found.",
mesh_name.c_str());
}
auto const& mesh = **mesh_it;
},
"Required mesh with name '" + mesh_name + "' not found.");
DBUG("Found mesh '%s' with id %d.", mesh.getName().c_str(), mesh.getID());
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