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);
115 else if (cellType == VTK_QUADRATIC_WEDGE)
117 std::array<vtkIdType, 15> ogs_nodeIds{};
118 for (
unsigned i = 0; i < 15; ++i)
120 ogs_nodeIds[i] = ptIds->GetId(i);
122 for (
unsigned i = 0; i < 3; ++i)
124 ptIds->SetId(i, ogs_nodeIds[i + 3]);
125 ptIds->SetId(i + 3, ogs_nodeIds[i]);
127 for (
unsigned i = 0; i < 3; ++i)
129 ptIds->SetId(6 + i, ogs_nodeIds[8 - i]);
131 for (
unsigned i = 0; i < 3; ++i)
133 ptIds->SetId(9 + i, ogs_nodeIds[14 - i]);
135 ptIds->SetId(12, ogs_nodeIds[9]);
136 ptIds->SetId(13, ogs_nodeIds[11]);
137 ptIds->SetId(14, ogs_nodeIds[10]);
140 output->InsertNextCell(cellType, ptIds);
146 if (
auto p =
dynamic_cast<PropertyVector<double>*
>(property))
150 else if (
auto p =
dynamic_cast<PropertyVector<float>*
>(property))
154 else if (
auto p =
dynamic_cast<PropertyVector<int>*
>(property))
158 else if (
auto p =
dynamic_cast<PropertyVector<unsigned>*
>(property))
162 else if (
auto p =
dynamic_cast<PropertyVector<long>*
>(property))
166 else if (
auto p =
dynamic_cast<PropertyVector<long long>*
>(property))
171 dynamic_cast<PropertyVector<unsigned long>*
>(property))
175 else if (
auto p =
dynamic_cast<PropertyVector<unsigned long long>*
>(
180 else if (
auto p =
dynamic_cast<PropertyVector<std::size_t>*
>(property))
184 else if (
auto p =
dynamic_cast<PropertyVector<char>*
>(property))
189 dynamic_cast<PropertyVector<unsigned char>*
>(property))
196 "Mesh property '{:s}' of unhandled data type '{:s}'. Please "
197 "check the data type of the mesh properties. The available "
205 "\n\t unsigned long long,"
207 "\n\t unsigned char.",
208 property->getPropertyName(),
209 typeid(*property).name());
213 output->GetPointData()->ShallowCopy(this->
PointData.GetPointer());
214 output->GetCellData()->ShallowCopy(this->
CellData.GetPointer());
215 output->GetFieldData()->ShallowCopy(this->
FieldData.GetPointer());
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()
void addProperty(MeshLib::PropertyVector< T > const &property) const
Adds a zero-copy vtk array wrapper.
vtkNew< vtkPoints > Points
static VtkMappedMeshSource * New()