6#include <vtkPointData.h>
7#include <vtkCellData.h>
8#include <vtkUnstructuredGrid.h>
9#include <vtkUnsignedIntArray.h>
11#include <vtkXMLUnstructuredGridWriter.h>
12#include <vtkXMLPUnstructuredGridWriter.h>
30 points->SetDataType(VTK_DOUBLE);
33 material_array->SetName(
"Material");
34 partition_id_array->SetName(
"Partition");
36 std::vector<uint64_t> vertex_map;
37 if (not discontinuous)
41 for (
size_t v = 0; v < num_verts; ++v)
46 int64_t node_count = 0;
51 grid, cell, node_count, points, ugrid);
54 for (uint64_t vid : cell.vertex_ids_)
56 const auto& vertex = grid.
vertices[vid];
57 points->InsertNextPoint(vertex.x, vertex.y, vertex.z);
58 vertex_map[vid] = node_count;
64 material_array->InsertNextValue(cell.material_id_);
65 partition_id_array->InsertNextValue(cell.partition_id_);
67 ugrid->SetPoints(points);
69 ugrid->GetCellData()->AddArray(material_array);
70 ugrid->GetCellData()->AddArray(partition_id_array);
78 const std::string& file_base_name)
81 std::string base_filename = std::string(file_base_name);
82 std::string location_filename = base_filename + std::string(
"_") +
83 std::to_string(
Chi::mpi.location_id) +
89 std::string pvtu_file_name = base_filename + std::string(
".pvtu");
93 pgrid_writer->EncodeAppendedDataOff();
94 pgrid_writer->SetFileName(pvtu_file_name.c_str());
95 pgrid_writer->SetNumberOfPieces(
Chi::mpi.process_count);
96 pgrid_writer->SetStartPiece(
Chi::mpi.location_id);
97 pgrid_writer->SetEndPiece(
Chi::mpi.process_count - 1);
98 pgrid_writer->SetInputData(ugrid);
100 pgrid_writer->Write();
107 grid_writer->SetInputData(ugrid);
108 grid_writer->SetFileName(location_filename.c_str());
110 grid_writer->Write();
static chi::MPI_Info & mpi
LocalCellHandler local_cells
uint64_t GetGlobalVertexCount() const
vtkNew< vtkUnstructuredGrid > PrepareVtkUnstructuredGrid(const chi_mesh::MeshContinuum &grid, bool discontinuous=true)
void UploadCellGeometryContinuous(const chi_mesh::Cell &cell, const std::vector< uint64_t > &vertex_map, vtkNew< vtkUnstructuredGrid > &ugrid)
void WritePVTUFiles(vtkNew< vtkUnstructuredGrid > &ugrid, const std::string &file_base_name)
void UploadCellGeometryDiscontinuous(const chi_mesh::MeshContinuum &grid, const chi_mesh::Cell &cell, int64_t &node_counter, vtkNew< vtkPoints > &points, vtkNew< vtkUnstructuredGrid > &ugrid)