6#include <vtkUnstructuredGrid.h>
12 int64_t &node_counter,
18 std::vector<vtkIdType> cell_vids(num_verts);
19 for (
size_t v=0; v<num_verts; v++)
22 std::vector<double> d_node(3);
27 points->InsertPoint(node_counter,d_node.data());
28 cell_vids[v] = node_counter++;
33 ugrid->InsertNextCell(VTK_LINE,
34 static_cast<vtkIdType
>(num_verts),
42 case CellType::POLYGON: vtk_subtype = VTK_POLYGON;
break;
43 case CellType::QUADRILATERAL: vtk_subtype = VTK_QUAD;
break;
44 case CellType::TRIANGLE: vtk_subtype = VTK_TRIANGLE;
break;
45 default: vtk_subtype = VTK_POLYGON;
break;
48 ugrid->InsertNextCell(vtk_subtype,
49 static_cast<vtkIdType
>(num_verts),
55 std::vector<vtkIdType> faces_vids;
57 size_t num_faces = cell.
faces_.size();
58 for (
auto& face : cell.
faces_)
60 size_t num_fverts = face.vertex_ids_.size();
61 std::vector<vtkIdType> face_info(num_fverts);
62 for (
size_t fv=0; fv<num_fverts; fv++)
65 for (
size_t cv=0; cv<num_verts; ++cv)
69 face_info[fv] = cell_vids[v];
72 faces_vids.push_back(
static_cast<vtkIdType
>(num_fverts));
73 for (
auto vid : face_info)
74 faces_vids.push_back(vid);
80 case CellType::POLYHEDRON: vtk_subtype = VTK_POLYHEDRON;
break;
81 case CellType::PYRAMID: vtk_subtype = VTK_PYRAMID;
break;
82 case CellType::WEDGE: vtk_subtype = VTK_WEDGE;
break;
83 case CellType::HEXAHEDRON: vtk_subtype = VTK_HEXAHEDRON;
break;
84 case CellType::TETRAHEDRON: vtk_subtype = VTK_TETRA;
break;
85 default: vtk_subtype = VTK_POLYHEDRON;
break;
88 ugrid->InsertNextCell(vtk_subtype,
89 static_cast<vtkIdType
>(num_verts),
91 static_cast<vtkIdType
>(num_faces),
100 const std::vector<uint64_t>& vertex_map,
105 std::vector<vtkIdType> cell_vids(num_verts);
106 for (
size_t v=0; v<num_verts; v++)
107 cell_vids[v] =
static_cast<vtkIdType
>(vertex_map[cell.
vertex_ids_[v]]);
111 ugrid->InsertNextCell(VTK_LINE,
112 static_cast<vtkIdType
>(num_verts),
120 case CellType::POLYGON: vtk_subtype = VTK_POLYGON;
break;
121 case CellType::QUADRILATERAL: vtk_subtype = VTK_QUAD;
break;
122 case CellType::TRIANGLE: vtk_subtype = VTK_TRIANGLE;
break;
123 default: vtk_subtype = VTK_POLYGON;
break;
126 ugrid->InsertNextCell(vtk_subtype,
127 static_cast<vtkIdType
>(num_verts),
133 std::vector<vtkIdType> faces_vids;
138 case CellType::POLYHEDRON: vtk_subtype = VTK_POLYHEDRON;
break;
139 case CellType::PYRAMID: vtk_subtype = VTK_PYRAMID;
break;
140 case CellType::WEDGE: vtk_subtype = VTK_WEDGE;
break;
141 case CellType::HEXAHEDRON: vtk_subtype = VTK_HEXAHEDRON;
break;
142 case CellType::TETRAHEDRON: vtk_subtype = VTK_TETRA;
break;
143 default: vtk_subtype = VTK_POLYHEDRON;
break;
148 case CellType::POLYHEDRON:
150 size_t num_faces = cell.
faces_.size();
151 for (
auto &face: cell.
faces_)
153 size_t num_fverts = face.vertex_ids_.size();
154 std::vector<vtkIdType> face_info(num_fverts);
155 for (
size_t fv = 0; fv < num_fverts; fv++)
158 for (
size_t cv = 0; cv < num_verts; ++cv)
165 face_info[fv] = cell_vids[v];
168 faces_vids.push_back(
static_cast<vtkIdType
>(num_fverts));
169 for (
auto vid: face_info)
170 faces_vids.push_back(vid);
173 ugrid->InsertNextCell(vtk_subtype,
174 static_cast<vtkIdType
>(num_verts),
176 static_cast<vtkIdType
>(num_faces),
181 ugrid->InsertNextCell(vtk_subtype,
182 static_cast<vtkIdType
>(num_verts),
191 const std::vector<uint64_t>& vertex_map,
194 const size_t num_verts = cell_face.
vertex_ids_.size();
196 std::vector<vtkIdType> cell_vids;
198 cell_vids.push_back(
static_cast<vtkIdType
>(vertex_map[vid]));
202 ugrid->InsertNextCell(VTK_VERTEX,
203 static_cast<vtkIdType
>(num_verts),
208 ugrid->InsertNextCell(VTK_LINE,
209 static_cast<vtkIdType
>(num_verts),
217 case 3: vtk_subtype = VTK_TRIANGLE;
break;
218 case 4: vtk_subtype = VTK_QUAD;
break;
219 default: vtk_subtype = VTK_POLYGON;
break;
222 ugrid->InsertNextCell(vtk_subtype,
223 static_cast<vtkIdType
>(num_verts),
std::vector< uint64_t > vertex_ids_
std::vector< CellFace > faces_
std::vector< uint64_t > vertex_ids_
void UploadFaceGeometry(const chi_mesh::CellFace &cell_face, const std::vector< uint64_t > &vertex_map, vtkNew< vtkUnstructuredGrid > &ugrid)
void UploadCellGeometryContinuous(const chi_mesh::Cell &cell, const std::vector< uint64_t > &vertex_map, vtkNew< vtkUnstructuredGrid > &ugrid)
void UploadCellGeometryDiscontinuous(const chi_mesh::MeshContinuum &grid, const chi_mesh::Cell &cell, int64_t &node_counter, vtkNew< vtkPoints > &points, vtkNew< vtkUnstructuredGrid > &ugrid)