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

[MeL] MeshGenerators; Update for ptr version.

parent 06bf8fa5
No related branches found
No related tags found
No related merge requests found
......@@ -57,10 +57,9 @@ LayeredMeshGenerator::getMesh(std::string const& mesh_name) const
MeshLib::Properties properties;
if (_materials.size() == _elements.size())
{
boost::optional<MeshLib::PropertyVector<int>&> materials =
properties.createNewPropertyVector<int>(
"MaterialIDs", MeshLib::MeshItemType::Cell);
assert(materials != boost::none);
auto* const materials = properties.createNewPropertyVector<int>(
"MaterialIDs", MeshLib::MeshItemType::Cell);
assert(materials != nullptr);
materials->reserve(_materials.size());
std::copy(_materials.cbegin(),
_materials.cend(),
......
......@@ -60,9 +60,8 @@ MeshLib::Mesh* MeshLayerMapper::createStaticLayers(MeshLib::Mesh const& mesh, st
std::vector<MeshLib::Element*> new_elems;
new_elems.reserve(nElems * nLayers);
MeshLib::Properties properties;
boost::optional<PropertyVector<int>&> materials =
properties.createNewPropertyVector<int>("MaterialIDs",
MeshLib::MeshItemType::Cell);
auto* const materials = properties.createNewPropertyVector<int>(
"MaterialIDs", MeshLib::MeshItemType::Cell);
if (!materials)
{
ERR("Could not create PropertyVector object \"MaterialIDs\".");
......
......@@ -147,14 +147,14 @@ MeshLib::Mesh* RasterToMesh::constructMesh(
MeshLib::Properties properties;
if (intensity_type == MeshLib::UseIntensityAs::MATERIALS)
{
boost::optional< MeshLib::PropertyVector<int>& > prop_vec =
properties.createNewPropertyVector<int>("MaterialIDs", MeshLib::MeshItemType::Cell, 1);
auto* const prop_vec = properties.createNewPropertyVector<int>(
"MaterialIDs", MeshLib::MeshItemType::Cell, 1);
fillPropertyVector<int>(*prop_vec, pix_val, pix_vis, header.n_rows, header.n_cols, elem_type);
}
else if (intensity_type == MeshLib::UseIntensityAs::DATAVECTOR)
{
boost::optional< MeshLib::PropertyVector<double>& > prop_vec =
properties.createNewPropertyVector<double>(array_name, MeshLib::MeshItemType::Cell, 1);
auto* const prop_vec = properties.createNewPropertyVector<double>(
array_name, MeshLib::MeshItemType::Cell, 1);
fillPropertyVector<double>(*prop_vec, pix_val, pix_vis, header.n_rows, header.n_cols, elem_type);
}
......
......@@ -11,14 +11,12 @@
#ifndef RASTERTOMESH_H
#define RASTERTOMESH_H
#include <boost/optional.hpp>
#include <logog/include/logog.hpp>
#include "GeoLib/Raster.h"
#include "MeshLib/Location.h"
#include "MeshLib/MeshEnums.h"
#include "MeshLib/Properties.h"
#include "MeshLib/PropertyVector.h"
class vtkImageData; // For conversion from Image to QuadMesh
......@@ -27,6 +25,8 @@ namespace MeshLib {
class Mesh;
class Node;
class Element;
template <typename T>
class PropertyVector;
/**
* \brief Converts raster data into an OGS mesh.
......
......@@ -16,7 +16,6 @@
#ifndef VTKMESHCONVERTER_H
#define VTKMESHCONVERTER_H
#include <boost/optional.hpp>
#include <vtkDataArray.h>
#include <vtkType.h>
......@@ -105,8 +104,8 @@ private:
int const nComponents (array.GetNumberOfComponents());
char const*const array_name (array.GetName());
boost::optional<MeshLib::PropertyVector<T> &> vec
(properties.createNewPropertyVector<T>(array_name, type, nComponents));
auto* const vec = properties.createNewPropertyVector<T>(
array_name, type, nComponents);
if (!vec)
{
WARN("Array %s could not be converted to PropertyVector.", array_name);
......
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