OGS
VoxelGridFromMesh.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include <vtkSmartPointer.h>
7#include <vtkUnstructuredGrid.h>
8
9#include <array>
10#include <memory>
11
12namespace MeshLib
13{
14class Mesh;
15}
16
17namespace MathLib
18{
19class Point3d;
20}
22{
23static std::string const cell_id_name = "CellIds";
24
31std::array<std::size_t, 3> getNumberOfVoxelPerDimension(
32 std::array<double, 3> const& ranges, std::array<double, 3> const& cellsize);
33
34std::vector<int> assignCellIds(vtkSmartPointer<vtkUnstructuredGrid> const& mesh,
35 MathLib::Point3d const& min,
36 std::array<std::size_t, 3> const& dims,
37 std::array<double, 3> const& cellsize);
38
39// grid has to contain a PropertyVector with the name 'CellIds'
40bool removeUnusedGridCells(vtkSmartPointer<vtkUnstructuredGrid> const& mesh,
41 std::unique_ptr<MeshLib::Mesh>& grid);
42// map the cell data of mesh to voxelgrid
43void mapMeshArraysOntoGrid(vtkSmartPointer<vtkUnstructuredGrid> const& mesh,
44 std::unique_ptr<MeshLib::Mesh> const& grid);
45} // namespace MeshToolsLib::MeshGenerator::VoxelGridFromMesh
std::vector< int > assignCellIds(vtkSmartPointer< vtkUnstructuredGrid > const &mesh, MathLib::Point3d const &min, std::array< std::size_t, 3 > const &dims, std::array< double, 3 > const &cellsize)
void mapMeshArraysOntoGrid(vtkSmartPointer< vtkUnstructuredGrid > const &mesh, std::unique_ptr< MeshLib::Mesh > const &grid)
bool removeUnusedGridCells(vtkSmartPointer< vtkUnstructuredGrid > const &mesh, std::unique_ptr< MeshLib::Mesh > &grid)
std::array< std::size_t, 3 > getNumberOfVoxelPerDimension(std::array< double, 3 > const &ranges, std::array< double, 3 > const &cellsize)