66{
67 vtkSmartPointer<vtkInformation> outInfo =
68 outputVector->GetInformationObject(0);
69 vtkSmartPointer<vtkUnstructuredGrid> output =
70 vtkUnstructuredGrid::SafeDownCast(
71 outInfo->Get(vtkDataObject::DATA_OBJECT()));
72
73 if (outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER()) >
74 0)
75 {
76 return 1;
77 }
78
79
81
82 vtkSmartPointer<VtkMeshNodalCoordinatesTemplate<double>> nodeCoords =
83 vtkSmartPointer<VtkMeshNodalCoordinatesTemplate<double>>
::New();
85 this->
Points->SetData(nodeCoords);
86 output->SetPoints(this->
Points.GetPointer());
87
88
90 output->Allocate(elems.size());
91 for (auto& cell : elems)
92 {
94
98 vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New();
99 ptIds->SetNumberOfIds(numNodes);
100
101 for (unsigned i = 0; i < numNodes; ++i)
102 {
103 ptIds->SetId(i, nodes[i]->getID());
104 }
105
106 if (cellType == VTK_WEDGE)
107 {
108 for (unsigned i = 0; i < 3; ++i)
109 {
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);
113 }
114 }
115
116 output->InsertNextCell(cellType, ptIds);
117 }
118
119
121 {
122 if (!property->is_for_output)
123 {
124 continue;
125 }
126 if (auto const* p = dynamic_cast<PropertyVector<double>*>(property))
127 {
129 }
130 else if (auto const* p = dynamic_cast<PropertyVector<float>*>(property))
131 {
133 }
134 else if (auto const* p = dynamic_cast<PropertyVector<int>*>(property))
135 {
137 }
138 else if (auto const* p =
139 dynamic_cast<PropertyVector<unsigned>*>(property))
140 {
142 }
143 else if (auto const* p = dynamic_cast<PropertyVector<long>*>(property))
144 {
146 }
147 else if (auto const* p =
148 dynamic_cast<PropertyVector<long long>*>(property))
149 {
151 }
152 else if (auto const* p =
153 dynamic_cast<PropertyVector<unsigned long>*>(property))
154 {
156 }
157 else if (auto const* p =
158 dynamic_cast<PropertyVector<unsigned long long>*>(
159 property))
160 {
162 }
163 else if (auto const* p =
164 dynamic_cast<PropertyVector<std::size_t>*>(property))
165 {
167 }
168 else if (auto const* p = dynamic_cast<PropertyVector<char>*>(property))
169 {
171 }
172 else if (auto const* p =
173 dynamic_cast<PropertyVector<unsigned char>*>(property))
174 {
176 }
177 else if (auto const* p =
178 dynamic_cast<PropertyVector<uint8_t>*>(property))
179 {
181 }
182 else
183 {
185 "Mesh property '{:s}' of unhandled data type '{:s}'. Please "
186 "check the data type of the mesh properties. The available "
187 "data types are:"
188 "\n\t double,"
189 "\n\t float,"
190 "\n\t int,"
191 "\n\t unsigned,"
192 "\n\t long,"
193 "\n\t long long,"
194 "\n\t unsigned long long,"
195 "\n\t char,",
196 "\n\t unsigned char,",
197 "\n\t uint8_t.",
198 property->getPropertyName(),
199 typeid(*property).name());
200 }
201 }
202
203 output->GetPointData()->ShallowCopy(this->
PointData.GetPointer());
204 output->GetCellData()->ShallowCopy(this->
CellData.GetPointer());
205 output->GetFieldData()->ShallowCopy(this->
FieldData.GetPointer());
206 return 1;
207}
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()