Skip to content
Snippets Groups Projects
Commit 4c749128 authored by Dmitry Yu. Naumov's avatar Dmitry Yu. Naumov
Browse files

[MeL] Other; Update for ptr version.

parent 38f43069
No related branches found
No related tags found
No related merge requests found
......@@ -38,8 +38,8 @@ public:
static std::pair<T, T> const
getValueBounds(MeshLib::Mesh const& mesh, std::string const& name)
{
boost::optional<MeshLib::PropertyVector<T> const&>
data_vec (mesh.getProperties().getPropertyVector<T>(name));
auto const* const data_vec =
mesh.getProperties().getPropertyVector<T>(name);
if (!data_vec)
return {std::numeric_limits<T>::max(), std::numeric_limits<T>::max()};
if (data_vec->empty()) {
......
......@@ -48,24 +48,25 @@ public:
PROPERTY_TYPE const property_value,
std::string const& property_name = "MaterialIDs")
{
boost::optional<MeshLib::PropertyVector<PROPERTY_TYPE> const&> opt_pv(
auto const* const pv =
_mesh.getProperties().getPropertyVector<PROPERTY_TYPE>(
property_name));
if (!opt_pv) {
property_name);
if (!pv)
{
WARN("Property \"%s\" not found in mesh.", property_name.c_str());
return 0;
}
MeshLib::PropertyVector<PROPERTY_TYPE> const& pv(opt_pv.get());
if (pv.getMeshItemType() != MeshLib::MeshItemType::Cell) {
if (pv->getMeshItemType() != MeshLib::MeshItemType::Cell)
{
WARN("The property \"%s\" is not assigned to mesh elements.",
property_name.c_str());
return 0;
}
std::vector<std::size_t> matchedIDs;
for (std::size_t i(0); i < pv.getNumberOfTuples(); ++i) {
if (pv[i] == property_value)
for (std::size_t i(0); i < pv->getNumberOfTuples(); ++i) {
if ((*pv)[i] == property_value)
matchedIDs.push_back(i);
}
......
......@@ -26,8 +26,6 @@
#include <string>
#include <vector>
#include <boost/optional.hpp>
#include <vtkCellData.h>
#include <vtkPointData.h>
#include <vtkNew.h>
......@@ -88,8 +86,7 @@ private:
bool addProperty(MeshLib::Properties const& properties,
std::string const& prop_name) const
{
boost::optional<MeshLib::PropertyVector<T> const &> propertyVector(
properties.getPropertyVector<T>(prop_name));
auto* const propertyVector = properties.getPropertyVector<T>(prop_name);
if(!propertyVector)
return false;
......
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