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

Make T8CodeMesh fully type general #2154

Merged
merged 1 commit into from
Nov 11, 2024
Merged
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
9 changes: 5 additions & 4 deletions src/meshes/t8code_mesh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ mutable struct T8codeMesh{NDIMS, RealT <: Real, IsParallel, NDIMSP2, NNODES} <:

function T8codeMesh{NDIMS}(forest::Ptr{t8_forest}, tree_node_coordinates, nodes,
boundary_names,
current_filename) where {NDIMS}
current_filename,
RealT = Float64) where {NDIMS}
is_parallel = mpi_isparallel() ? True() : False()

mesh = new{NDIMS, Float64, typeof(is_parallel), NDIMS + 2, length(nodes)}(forest,
is_parallel)
mesh = new{NDIMS, RealT, typeof(is_parallel), NDIMS + 2, length(nodes)}(forest,
is_parallel)

mesh.nodes = nodes
mesh.boundary_names = boundary_names
Expand Down Expand Up @@ -272,7 +273,7 @@ function T8codeMesh{NDIMS, RealT}(forest::Ptr{t8_forest}, boundary_names; polyde
ntuple(_ -> length(nodes), NDIMS)...,
number_of_trees)

reference_coordinates = Vector{Float64}(undef, 3)
reference_coordinates = Vector{RealT}(undef, 3)

# Calculate node coordinates of reference mesh.
if NDIMS == 2
Expand Down
6 changes: 3 additions & 3 deletions src/solvers/dgsem_t8code/containers_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

# Interpolate tree_node_coordinates to each quadrant at the specified nodes.
function calc_node_coordinates!(node_coordinates,
mesh::T8codeMesh{2},
nodes::AbstractVector)
mesh::T8codeMesh{2, RealT},
nodes::AbstractVector) where {RealT <: Real}
# We use `StrideArray`s here since these buffers are used in performance-critical
# places and the additional information passed to the compiler makes them faster
# than native `Array`s.
Expand Down Expand Up @@ -37,7 +37,7 @@ function calc_node_coordinates!(node_coordinates,
# "integer" length to a float in relation to the unit interval [0,1].
element_length = t8_quad_len(element_level) / t8_quad_root_len

element_coords = Array{Float64}(undef, 3)
element_coords = Array{RealT}(undef, 3)
t8_element_vertex_reference_coords(eclass_scheme, element, 0,
pointer(element_coords))

Expand Down
6 changes: 3 additions & 3 deletions src/solvers/dgsem_t8code/containers_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

# Interpolate tree_node_coordinates to each quadrant at the specified nodes
function calc_node_coordinates!(node_coordinates,
mesh::T8codeMesh{3},
nodes::AbstractVector)
mesh::T8codeMesh{3, RealT},
nodes::AbstractVector) where {RealT <: Real}
# We use `StrideArray`s here since these buffers are used in performance-critical
# places and the additional information passed to the compiler makes them faster
# than native `Array`s.
Expand Down Expand Up @@ -39,7 +39,7 @@ function calc_node_coordinates!(node_coordinates,
# "integer" length to a float in relation to the unit interval [0,1].
element_length = t8_hex_len(element_level) / t8_hex_root_len

element_coords = Vector{Float64}(undef, 3)
element_coords = Vector{RealT}(undef, 3)
t8_element_vertex_reference_coords(eclass_scheme, element, 0,
pointer(element_coords))

Expand Down
Loading