Skip to content

Commit 6e0c8f5

Browse files
Make T8CodeMesh fully type general
1 parent e1950ac commit 6e0c8f5

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

src/meshes/t8code_mesh.jl

+5-4
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ mutable struct T8codeMesh{NDIMS, RealT <: Real, IsParallel, NDIMSP2, NNODES} <:
3030

3131
function T8codeMesh{NDIMS}(forest::Ptr{t8_forest}, tree_node_coordinates, nodes,
3232
boundary_names,
33-
current_filename) where {NDIMS}
33+
current_filename,
34+
RealT = Float64) where {NDIMS}
3435
is_parallel = mpi_isparallel() ? True() : False()
3536

36-
mesh = new{NDIMS, Float64, typeof(is_parallel), NDIMS + 2, length(nodes)}(forest,
37-
is_parallel)
37+
mesh = new{NDIMS, RealT, typeof(is_parallel), NDIMS + 2, length(nodes)}(forest,
38+
is_parallel)
3839

3940
mesh.nodes = nodes
4041
mesh.boundary_names = boundary_names
@@ -272,7 +273,7 @@ function T8codeMesh{NDIMS, RealT}(forest::Ptr{t8_forest}, boundary_names; polyde
272273
ntuple(_ -> length(nodes), NDIMS)...,
273274
number_of_trees)
274275

275-
reference_coordinates = Vector{Float64}(undef, 3)
276+
reference_coordinates = Vector{RealT}(undef, 3)
276277

277278
# Calculate node coordinates of reference mesh.
278279
if NDIMS == 2

src/solvers/dgsem_t8code/containers_2d.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

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

40-
element_coords = Array{Float64}(undef, 3)
40+
element_coords = Array{RealT}(undef, 3)
4141
t8_element_vertex_reference_coords(eclass_scheme, element, 0,
4242
pointer(element_coords))
4343

src/solvers/dgsem_t8code/containers_3d.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

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

42-
element_coords = Vector{Float64}(undef, 3)
42+
element_coords = Vector{RealT}(undef, 3)
4343
t8_element_vertex_reference_coords(eclass_scheme, element, 0,
4444
pointer(element_coords))
4545

0 commit comments

Comments
 (0)