68{
69 vtkSmartPointer<vtkInformation> outInfo =
70 outputVector->GetInformationObject(0);
71 vtkSmartPointer<vtkUnstructuredGrid> output =
72 vtkUnstructuredGrid::SafeDownCast(
73 outInfo->Get(vtkDataObject::DATA_OBJECT()));
74
75 if (outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER()) >
76 0)
77 {
78 return 1;
79 }
80
81
83
85
86 vtkNew<vtkImplicitArray<MeshNodalCoordinatesBackend>> nodeCoords;
87 nodeCoords->ConstructBackend(backend);
88 nodeCoords->SetNumberOfComponents(3);
90 this->
Points->SetData(nodeCoords);
91 output->SetPoints(this->
Points.GetPointer());
92
93
95 output->Allocate(elems.size());
96 for (auto& cell : elems)
97 {
99
103 vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New();
104 ptIds->SetNumberOfIds(numNodes);
105
106 for (unsigned i = 0; i < numNodes; ++i)
107 {
108 ptIds->SetId(i, nodes[i]->getID());
109 }
110
111 if (cellType == VTK_WEDGE)
112 {
113 for (unsigned i = 0; i < 3; ++i)
114 {
115 const auto prism_swap_id = ptIds->GetId(i);
116 ptIds->SetId(i, ptIds->GetId(i + 3));
117 ptIds->SetId(i + 3, prism_swap_id);
118 }
119 }
120
121 output->InsertNextCell(cellType, ptIds);
122 }
123
124
125 for (
auto [name, property] :
_mesh->getProperties())
126 {
127 if (!property->is_for_output)
128 {
129 continue;
130 }
131 if (auto const* p = dynamic_cast<PropertyVector<double>*>(property))
132 {
134 }
135 else if (auto const* p = dynamic_cast<PropertyVector<float>*>(property))
136 {
138 }
139 else if (auto const* p = dynamic_cast<PropertyVector<int>*>(property))
140 {
142 }
143 else if (auto const* p =
144 dynamic_cast<PropertyVector<unsigned>*>(property))
145 {
147 }
148 else if (auto const* p = dynamic_cast<PropertyVector<long>*>(property))
149 {
151 }
152 else if (auto const* p =
153 dynamic_cast<PropertyVector<long long>*>(property))
154 {
156 }
157 else if (auto const* p =
158 dynamic_cast<PropertyVector<unsigned long>*>(property))
159 {
161 }
162 else if (auto const* p =
163 dynamic_cast<PropertyVector<unsigned long long>*>(
164 property))
165 {
167 }
168 else if (auto const* p =
169 dynamic_cast<PropertyVector<std::size_t>*>(property))
170 {
172 }
173 else if (auto const* p = dynamic_cast<PropertyVector<char>*>(property))
174 {
176 }
177 else if (auto const* p =
178 dynamic_cast<PropertyVector<unsigned char>*>(property))
179 {
181 }
182 else if (auto const* p =
183 dynamic_cast<PropertyVector<uint8_t>*>(property))
184 {
186 }
187 else
188 {
190 "Mesh property '{:s}' of unhandled data type '{:s}'. Please "
191 "check the data type of the mesh properties. The available "
192 "data types are:"
193 "\n\t double,"
194 "\n\t float,"
195 "\n\t int,"
196 "\n\t unsigned,"
197 "\n\t long,"
198 "\n\t long long,"
199 "\n\t unsigned long long,"
200 "\n\t char,",
201 "\n\t unsigned char,",
202 "\n\t uint8_t.",
203 property->getPropertyName(),
204 typeid(*property).name());
205 }
206 }
207
208 output->GetPointData()->ShallowCopy(this->
PointData.GetPointer());
209 output->GetCellData()->ShallowCopy(this->
CellData.GetPointer());
210 output->GetFieldData()->ShallowCopy(this->
FieldData.GetPointer());
211 return 1;
212}
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.
std::size_t getNumberOfNodes() const
Get the number of nodes.
void addProperty(MeshLib::PropertyVector< T > const &property) const
Adds a zero-copy vtk array wrapper.
vtkNew< vtkPoints > Points