diff --git a/src/meshes/structured_mesh.jl b/src/meshes/structured_mesh.jl index 155bad8464a..9e58782ec22 100644 --- a/src/meshes/structured_mesh.jl +++ b/src/meshes/structured_mesh.jl @@ -23,7 +23,8 @@ mutable struct StructuredMesh{NDIMS, RealT <: Real} <: AbstractMesh{NDIMS} end """ - StructuredMesh(cells_per_dimension, mapping; RealT=Float64, unsaved_changes=true, mapping_as_string=mapping2string(mapping, length(cells_per_dimension))) + StructuredMesh(cells_per_dimension, mapping; RealT=Float64, unsaved_changes=true, + mapping_as_string=mapping2string(mapping, length(cells_per_dimension), RealT=Float64)) Create a StructuredMesh of the given size and shape that uses `RealT` as coordinate type. @@ -46,7 +47,8 @@ Create a StructuredMesh of the given size and shape that uses `RealT` as coordin function StructuredMesh(cells_per_dimension, mapping; RealT = Float64, periodicity = true, unsaved_changes = true, mapping_as_string = mapping2string(mapping, - length(cells_per_dimension))) + length(cells_per_dimension), + RealT)) NDIMS = length(cells_per_dimension) # Convert periodicity to a Tuple of a Bool for every dimension @@ -95,7 +97,7 @@ function StructuredMesh(cells_per_dimension, faces::Tuple; RealT = Float64, mapping = transfinite_mapping(faces) # Collect definitions of face functions in one string (separated by semicolons) - face2substring(face) = code_string(face, ntuple(_ -> Float64, NDIMS - 1)) + face2substring(face) = code_string(face, ntuple(_ -> RealT, NDIMS - 1)) join_newline(strings) = join(strings, "\n") faces_definition = faces .|> face2substring .|> string |> join_newline @@ -141,8 +143,8 @@ function StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max; end # Extract a string of the code that defines the mapping function -function mapping2string(mapping, ndims) - string(code_string(mapping, ntuple(_ -> Float64, ndims))) +function mapping2string(mapping, ndims, RealT = Float64) + string(code_string(mapping, ntuple(_ -> RealT, ndims))) end # An internal function wrapping `CodeTracking.code_string` with additional