Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/t8_vtk/t8_vtk_writer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ vtk_writer<t8_forest_t>::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)++;

Expand Down
4 changes: 2 additions & 2 deletions src/t8_vtk/t8_vtk_writer.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
19 changes: 11 additions & 8 deletions src/t8_vtk/t8_vtk_writer_helper.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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 <>
Expand Down Expand Up @@ -192,21 +192,24 @@ grid_element_shape<t8_cmesh_t> (const t8_cmesh_t grid, const t8_locidx_t itree,
template <>
void
grid_element_to_coords<t8_forest_t> (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<t8_cmesh_t> (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 <>
Expand Down
6 changes: 2 additions & 4 deletions src/t8_vtk/t8_vtk_writer_helper.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/**
Expand Down Expand Up @@ -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 <typename grid_t>
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.
Expand Down