Skip to content
Snippets Groups Projects
Commit c9aa8a7c authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Change Change VTK output for general polyhedral meshes

Now the polyhedral connectivity is only stored when needed (that is
when general polyhedrons are present). This improves a lot the
creation of output files.
parent 5d2a53bd
No related branches found
No related tags found
1 merge request!45Feature/diamond dual mesh manager
This commit is part of merge request !45. Comments created here will be created in the context of that merge request.
......@@ -322,6 +322,8 @@ class VTKWriter
{
Array<int8_t> types(mesh->numberOfCells());
const auto& cell_type = mesh->connectivity().cellType();
const auto& cell_to_node_matrix = mesh->connectivity().cellToNodeMatrix();
parallel_for(
mesh->numberOfCells(), PUGS_LAMBDA(CellId j) {
switch (cell_type[j]) {
......@@ -342,7 +344,11 @@ class VTKWriter
break;
}
case CellType::Pyramid: {
types[j] = 14;
if (cell_to_node_matrix[j].size() == 5) {
types[j] = 14; // quadrangle basis
} else {
types[j] = 41; // polygonal basis
}
break;
}
case CellType::Prism: {
......@@ -365,10 +371,16 @@ class VTKWriter
}
});
_write_array(fout, "types", types);
}
if constexpr (MeshType::Dimension == 3) {
const bool has_general_polyhedron = [&] {
for (size_t i = 0; i < types.size(); ++i) {
if (types[i] == 41)
return true;
}
return false;
}();
if (has_general_polyhedron) {
const auto& cell_to_face_matrix = mesh->connectivity().cellToFaceMatrix();
const auto& cell_to_node_matrix = mesh->connectivity().cellToNodeMatrix();
const auto& face_to_node_matrix = mesh->connectivity().faceToNodeMatrix();
const auto& cell_face_is_reversed = mesh->connectivity().cellFaceIsReversed();
......@@ -422,6 +434,9 @@ class VTKWriter
}
fout << "</DataArray>\n";
}
}
}
fout << "</Cells>\n";
fout << "</Piece>\n";
fout << "</UnstructuredGrid>\n";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment