Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the posibility to plot 2D surfaces in 3D #82

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 3 additions & 2 deletions src/vtktools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,9 @@ end
function calc_node_coordinates(mesh::P4estMesh, nodes, n_visnodes)
# Extract number of spatial dimensions
ndims_ = ndims(mesh)
ndims_spa = size(mesh.tree_node_coordinates,1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment explaining why we need this convoluted way and cannot just use ndims_.

Also, please be consistent with our formatting conventions (space after comma).

Finally, please do not use abbreviations in variable/type/function names that are not absolutely clear to everyone in the community (unless you are really referring to the town in Belgium).

Copy link
Member

@tristanmontoya tristanmontoya Oct 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that trixi-framework/Trixi.jl#2068 is merged, instead of doing this, we can just extract NDIMS and NDIMS_AMBIENT (this is the same as the variable ndims_spa here) from the type parameters of the mesh.


node_coordinates = Array{Float64, ndims_+2}(undef, ndims_,
node_coordinates = Array{Float64, ndims_+2}(undef, ndims_spa,
ntuple(_ -> n_visnodes, ndims_)...,
Trixi.ncells(mesh))

Expand Down Expand Up @@ -580,7 +581,7 @@ function calc_vtk_points_cells(node_coordinates::AbstractArray{<:Any,4})
linear_indices = LinearIndices(size_[2:end])

# Use lagrange nodes as VTK points
vtk_points = reshape(node_coordinates, (2, n_points))
vtk_points = reshape(node_coordinates, (size(node_coordinates, 1), n_points))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As before, please leave a short comment explaining this seemingly overcomplex way of setting the number of dimensions.

vtk_cells = Vector{MeshCell}(undef, n_elements)

# Create cell for each element
Expand Down
Loading