16#include <vtkCellType.h>
17#include <vtkDemandDrivenPipeline.h>
18#include <vtkInformation.h>
19#include <vtkInformationVector.h>
20#include <vtkSmartPointer.h>
21#include <vtkStreamingDemandDrivenPipeline.h>
36 this->Superclass::PrintSelf(os, indent);
43 this->SetNumberOfInputPorts(0);
47 vtkInformationVector** inputVector,
48 vtkInformationVector* outputVector)
50 if (request->Has(vtkDemandDrivenPipeline::REQUEST_DATA()))
52 return this->
RequestData(request, inputVector, outputVector);
55 if (request->Has(vtkDemandDrivenPipeline::REQUEST_INFORMATION()))
60 return this->Superclass::ProcessRequest(request, inputVector, outputVector);
64 vtkInformationVector** ,
65 vtkInformationVector* outputVector)
67 vtkSmartPointer<vtkInformation> outInfo =
68 outputVector->GetInformationObject(0);
69 vtkSmartPointer<vtkUnstructuredGrid> output =
70 vtkUnstructuredGrid::SafeDownCast(
71 outInfo->Get(vtkDataObject::DATA_OBJECT()));
73 if (outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER()) >
82 vtkSmartPointer<VtkMeshNodalCoordinatesTemplate<double>> nodeCoords =
83 vtkSmartPointer<VtkMeshNodalCoordinatesTemplate<double>>
::New();
85 this->
Points->SetData(nodeCoords);
86 output->SetPoints(this->
Points.GetPointer());
90 output->Allocate(elems.size());
91 for (
auto& cell : elems)
98 vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New();
99 ptIds->SetNumberOfIds(numNodes);
101 for (
unsigned i = 0; i < numNodes; ++i)
103 ptIds->SetId(i, nodes[i]->getID());
106 if (cellType == VTK_WEDGE)
108 for (
unsigned i = 0; i < 3; ++i)
110 const auto prism_swap_id = ptIds->GetId(i);
111 ptIds->SetId(i, ptIds->GetId(i + 3));
112 ptIds->SetId(i + 3, prism_swap_id);
116 output->InsertNextCell(cellType, ptIds);
122 if (!property->is_for_output)
138 else if (
auto const* p =
147 else if (
auto const* p =
152 else if (
auto const* p =
157 else if (
auto const* p =
163 else if (
auto const* p =
172 else if (
auto const* p =
177 else if (
auto const* p =
185 "Mesh property '{:s}' of unhandled data type '{:s}'. Please "
186 "check the data type of the mesh properties. The available "
194 "\n\t unsigned long long,"
196 "\n\t unsigned char,",
198 property->getPropertyName(),
199 typeid(*property).name());
203 output->GetPointData()->ShallowCopy(this->
PointData.GetPointer());
204 output->GetCellData()->ShallowCopy(this->
CellData.GetPointer());
205 output->GetFieldData()->ShallowCopy(this->
FieldData.GetPointer());
211 vtkInformationVector** ,
212 vtkInformationVector* )
224 vtkNew<vtkAOSDataArrayTemplate<T>> dataArray;
225 const bool hasArrayOwnership =
false;
226 dataArray->SetArray(
const_cast<T*
>(property.data()),
227 static_cast<vtkIdType
>(property.
size()),
228 static_cast<int>(!hasArrayOwnership));
234 this->
PointData->AddArray(dataArray.GetPointer());
238 this->
CellData->AddArray(dataArray.GetPointer());
243 this->
FieldData->AddArray(dataArray.GetPointer());
Definition of the Element class.
Definition of the Mesh class.
VtkMappedMeshSource is a source class to transform OGS meshes into complete vtkUnstructuredGrids....
VtkMeshNodalCoordinatesTemplate is a adapter for node coordinates of OGS meshes to VTK unstructured g...
int OGSToVtkCellType(MeshLib::CellType ogs)
virtual unsigned getNumberOfNodes() const =0
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Properties & getProperties()
const std::string getName() const
Get name of the mesh.
std::size_t getNumberOfNodes() const
Get the number of nodes.
MeshItemType getMeshItemType() const
int getNumberOfGlobalComponents() const
std::string const & getPropertyName() const
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
void addProperty(MeshLib::PropertyVector< T > const &property) const
Adds a zero-copy vtk array wrapper.
vtkNew< vtkPoints > Points
vtkNew< vtkPointData > PointData
static VtkMappedMeshSource * New()
int ProcessRequest(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
const MeshLib::Mesh * _mesh
vtkNew< vtkFieldData > FieldData
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
vtkNew< vtkCellData > CellData
void PrintSelf(std::ostream &os, vtkIndent indent) override
vtkStandardNewMacro(VtkMappedMeshSource) void VtkMappedMeshSource