diff --git a/src/t8_vtk/t8_vtk_writer.cxx b/src/t8_vtk/t8_vtk_writer.cxx index fe813153de..a0106bb450 100644 --- a/src/t8_vtk/t8_vtk_writer.cxx +++ b/src/t8_vtk/t8_vtk_writer.cxx @@ -58,7 +58,7 @@ vtk_writer::t8_grid_tree_to_vtk_cells ( for (t8_locidx_t ielement = 0; ielement < elems_in_tree; ielement++) { const t8_element_t *element = t8_forest_get_leaf_element_in_tree (forest, itree, ielement); T8_ASSERT (element != NULL); - this->t8_grid_element_to_vtk_cell (forest, element, itree, offset, true, *elem_id, point_id, cellTypes, points, + this->t8_grid_element_to_vtk_cell (forest, element, itree, offset, false, *elem_id, point_id, cellTypes, points, cellArray, vtk_treeid, vtk_mpirank, vtk_level, vtk_element_id); (*elem_id)++; diff --git a/src/t8_vtk/t8_vtk_writer.hxx b/src/t8_vtk/t8_vtk_writer.hxx index 763ca192d3..eee60dc440 100644 --- a/src/t8_vtk/t8_vtk_writer.hxx +++ b/src/t8_vtk/t8_vtk_writer.hxx @@ -256,12 +256,12 @@ class vtk_writer { /* Compute the coordinates of the element/tree. */ double *coordinates = T8_ALLOC (double, 3 * num_node); - grid_element_to_coords (grid, itree, element, curved_flag, coordinates, num_node, element_shape); + T8_ASSERT (coordinates != NULL); + grid_element_to_coords (grid, itree, element, curved_flag, coordinates, element_shape); vtkIdType ptId = -1; for (int ivertex = 0; ivertex < num_node; ivertex++, (*point_id)++) { const size_t offset_3d = 3 * ivertex; - /* Insert the point in the points array. */ double vtkCoords[3] = { coordinates[offset_3d], coordinates[offset_3d + 1], coordinates[offset_3d + 2] }; if (mergePoints) { diff --git a/src/t8_vtk/t8_vtk_writer_helper.cxx b/src/t8_vtk/t8_vtk_writer_helper.cxx index a332661dcd..a94c912325 100644 --- a/src/t8_vtk/t8_vtk_writer_helper.cxx +++ b/src/t8_vtk/t8_vtk_writer_helper.cxx @@ -37,15 +37,15 @@ t8_get_number_of_vtk_nodes (const t8_element_shape_t eclass, const int curved_fl } void -t8_forest_vtk_get_element_nodes (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, const int vertex, +t8_forest_vtk_get_element_nodes (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, const int curved_flag, double *out_coords) { const t8_eclass_t tree_class = t8_forest_get_tree_class (forest, ltreeid); const t8_scheme *scheme = t8_forest_get_scheme (forest); const t8_element_shape_t element_shape = scheme->element_get_shape (tree_class, element); - const double *ref_coords = t8_forest_vtk_point_to_element_ref_coords[element_shape][vertex]; - const int num_node = t8_get_number_of_vtk_nodes (element_shape, curved_flag); - t8_forest_element_from_ref_coords (forest, ltreeid, element, ref_coords, num_node, out_coords); + const double *ref_coords = t8_forest_vtk_point_to_element_ref_coords[element_shape][0]; + const int num_nodes = t8_get_number_of_vtk_nodes (element_shape, curved_flag); + t8_forest_element_from_ref_coords (forest, ltreeid, element, ref_coords, num_nodes, out_coords); } template <> @@ -192,21 +192,24 @@ grid_element_shape (const t8_cmesh_t grid, const t8_locidx_t itree, template <> void grid_element_to_coords (const t8_forest_t grid, const t8_locidx_t itree, const t8_element_t *element, - const int curved_flag, double *coordinates, [[maybe_unused]] const int num_node, + const int curved_flag, double *coordinates, [[maybe_unused]] const t8_element_shape_t shape) { - t8_forest_vtk_get_element_nodes (grid, itree, element, 0, curved_flag, coordinates); + t8_forest_vtk_get_element_nodes (grid, itree, element, curved_flag, coordinates); } template <> void grid_element_to_coords (const t8_cmesh_t grid, const t8_locidx_t itree, [[maybe_unused]] const t8_element_t *element, const int curved_flag, - double *coordinates, const int num_node, const t8_element_shape_t shape) + double *coordinates, const t8_element_shape_t shape) { const double *ref_coords = t8_forest_vtk_point_to_element_ref_coords[shape][curved_flag]; const t8_gloidx_t gtree_id = t8_cmesh_get_global_id (grid, itree); - t8_geometry_evaluate (grid, gtree_id, ref_coords, num_node, coordinates); + const t8_eclass_t eclass = t8_cmesh_get_tree_class (grid, itree); + const int num_nodes = t8_get_number_of_vtk_nodes (eclass, curved_flag); + + t8_geometry_evaluate (grid, gtree_id, ref_coords, num_nodes, coordinates); } template <> diff --git a/src/t8_vtk/t8_vtk_writer_helper.hxx b/src/t8_vtk/t8_vtk_writer_helper.hxx index 6564b9fa27..78ef49271a 100644 --- a/src/t8_vtk/t8_vtk_writer_helper.hxx +++ b/src/t8_vtk/t8_vtk_writer_helper.hxx @@ -103,12 +103,11 @@ t8_get_number_of_vtk_nodes (const t8_element_shape_t eclass, const int curved_fl * \param[in] forest The forest of \a element. * \param[in] ltreeid The local id to the tree of \a element. * \param[in] element The element to process. - * \param[in] vertex The id of the vertex to evaluate. * \param[in] curved_flag Flag to tell if we use curved or linear cells. * \param[in, out] out_coords An array to fill with the coordinates of the vertex. */ void -t8_forest_vtk_get_element_nodes (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, const int vertex, +t8_forest_vtk_get_element_nodes (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, const int curved_flag, double *out_coords); /** @@ -226,13 +225,12 @@ grid_element_shape (const grid_t grid, const t8_locidx_t itree, const t8_element * \param[in] element An element in the tree with local id \a itree. If \a grid is cmesh the input is ignored. * \param[in] curved_flag If true, we use quadratic elements to write. * \param[in, out] coordinates An array with enough space to hold 3*num_node doubles. On output filled with the coordinate of the corners of the element/tree - * \param[in] num_node The number of nodes to use to describe the element/tree. * \param[in] shape The shape of the element/tree. */ template void grid_element_to_coords (const grid_t grid, const t8_locidx_t itree, const t8_element_t *element, const int curved_flag, - double *coordinates, const int num_node, const t8_element_shape_t shape); + double *coordinates, const t8_element_shape_t shape); /** * Get the level of an element/tree. If \a grid is a cmesh we always return 0.