OGS
VtkMappedMeshSource.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 <string>
7
8#include <vtkAOSDataArrayTemplate.h>
9#include <vtkCellData.h>
10#include <vtkFieldData.h>
11#include <vtkNew.h>
12#include <vtkPointData.h>
13#include <vtkUnstructuredGrid.h>
14#include <vtkUnstructuredGridAlgorithm.h>
15
16#include "MeshLib/Properties.h"
18
19
20
21namespace MeshLib {
22
23class Mesh;
24
34class VtkMappedMeshSource final : public vtkUnstructuredGridAlgorithm
35{
36public:
38 vtkTypeMacro(VtkMappedMeshSource, vtkUnstructuredGridAlgorithm);
39 void PrintSelf(std::ostream& os, vtkIndent indent) override;
40
42 void operator=(const VtkMappedMeshSource&) = delete;
43
45 void SetMesh(const MeshLib::Mesh* mesh)
46 {
47 this->_mesh = mesh;
48 this->Modified();
49 }
50
52 const MeshLib::Mesh* GetMesh() const { return _mesh; }
53
54protected:
56
57 int ProcessRequest(vtkInformation* request,
58 vtkInformationVector** inputVector,
59 vtkInformationVector* outputVector) override;
60 int RequestData(vtkInformation* /*request*/,
61 vtkInformationVector** /*inputVector*/,
62 vtkInformationVector* /*outputVector*/) override;
63 int RequestInformation(vtkInformation* /*request*/,
64 vtkInformationVector** /*inputVector*/,
65 vtkInformationVector* /*outputVector*/) override;
66
67private:
69 template <typename T>
70 void addProperty(MeshLib::PropertyVector<T> const& property) const;
71
73
76
77 vtkNew<vtkPoints> Points;
78 vtkNew<vtkPointData> PointData;
79 vtkNew<vtkCellData> CellData;
80 vtkNew<vtkFieldData> FieldData;
81};
82
83} // Namespace MeshLib
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
void addProperty(MeshLib::PropertyVector< T > const &property) const
Adds a zero-copy vtk array wrapper.
vtkTypeMacro(VtkMappedMeshSource, vtkUnstructuredGridAlgorithm)
vtkNew< vtkPointData > PointData
static VtkMappedMeshSource * New()
int ProcessRequest(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
void SetMesh(const MeshLib::Mesh *mesh)
Sets the mesh. Calling is mandatory.
vtkNew< vtkFieldData > FieldData
void operator=(const VtkMappedMeshSource &)=delete
const MeshLib::Mesh * GetMesh() const
Returns the mesh.
VtkMappedMeshSource(const VtkMappedMeshSource &)=delete
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
void PrintSelf(std::ostream &os, vtkIndent indent) override