6#include <vtkDataArray.h>
16class vtkUnstructuredGrid;
33 vtkUnstructuredGrid* grid,
34 bool const compute_element_neighbors =
false,
35 std::string
const& mesh_name =
"vtkUnstructuredGrid");
42 std::vector<double>
const& elevation,
43 std::vector<int>& node_idx_map,
49 std::vector<double>
const& pix_val,
50 std::vector<bool>
const& pix_vis,
51 std::vector<MeshLib::Node*>
const& nodes,
52 std::vector<int>
const& node_idx_map,
53 std::size_t
const imgHeight,
54 std::size_t
const imgWidth,
74 if (
sizeof(T) != array.GetDataTypeSize())
77 "Trying to convert a vtk array '{:s}' with data type '{:s}' of "
78 "size {:d} to a different sized type '{:s}' of size {:d}.",
79 array.GetName(), array.GetDataTypeAsString(),
83 vtkIdType
const nTuples(array.GetNumberOfTuples());
84 int const nComponents(array.GetNumberOfComponents());
85 char const*
const array_name(array.GetName());
88 array_name, type, nTuples, nComponents);
91 WARN(
"Array {:s} could not be converted to PropertyVector.",
95 auto* data_array =
static_cast<T*
>(array.GetVoidPointer(0));
96 vec->
assign(std::span<T>(data_array, nTuples * nComponents));
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Property manager on mesh items. Class Properties manages scalar, vector or matrix properties....
PropertyVector< T > * createNewPropertyVector(std::string_view name, MeshItemType mesh_item_type, std::size_t n_components=1)
constexpr void assign(R &&r)
Converter for VtkUnstructured Grids to OGS meshes.
static std::vector< MeshLib::Element * > createElementVector(std::vector< double > const &pix_val, std::vector< bool > const &pix_vis, std::vector< MeshLib::Node * > const &nodes, std::vector< int > const &node_idx_map, std::size_t const imgHeight, std::size_t const imgWidth, MeshElemType elem_type)
Creates a mesh element vector based on image data.
static void convertTypedArray(vtkDataArray &array, MeshLib::Properties &properties, MeshLib::MeshItemType type)
static void convertScalarArrays(vtkUnstructuredGrid &grid, MeshLib::Mesh &mesh)
static MeshLib::Mesh * convertUnstructuredGrid(vtkUnstructuredGrid *grid, bool const compute_element_neighbors=false, std::string const &mesh_name="vtkUnstructuredGrid")
Converts a vtkUnstructuredGrid object to a Mesh.
static void convertArray(vtkDataArray &array, MeshLib::Properties &properties, MeshLib::MeshItemType type)
static std::vector< MeshLib::Node * > createNodeVector(std::vector< double > const &elevation, std::vector< int > &node_idx_map, GeoLib::RasterHeader const &header, bool use_elevation)
std::string typeToString()
MeshElemType
Types of mesh elements supported by OpenGeoSys. Values are from VTKCellType enum.