@@ -67,7 +67,6 @@ function StructuredMesh(cells_per_dimension, mapping;
6767 # Default case if periodicity is an iterable
6868 periodicity = Tuple (periodicity)
6969 end
70-
7170 return StructuredMesh {NDIMS, RealT} (Tuple (cells_per_dimension), mapping,
7271 mapping_as_string, periodicity, " " ,
7372 unsaved_changes)
@@ -106,17 +105,13 @@ function StructuredMesh(cells_per_dimension, faces::Tuple;
106105
107106 # Collect definitions of face functions in one string (separated by semicolons)
108107 face2substring (face) = code_string (face, ntuple (_ -> RealT, NDIMS - 1 ))
109- join_newline (strings) = join (strings, " \n " )
108+ join_newline (strings) = join (strings, " ; " )
110109
111110 faces_definition = faces .| > face2substring .| > string |> join_newline
112111
113112 # Include faces definition in `mapping_as_string` to allow for evaluation
114113 # without knowing the face functions
115- mapping_as_string = """
116- $faces_definition
117- faces = $(string (faces))
118- mapping = transfinite_mapping(faces)
119- """
114+ mapping_as_string = """ $faces_definition ;faces = $(string (faces)) ;mapping = transfinite_mapping(faces)"""
120115
121116 return StructuredMesh (cells_per_dimension, mapping; RealT = RealT,
122117 periodicity = periodicity,
@@ -143,11 +138,8 @@ function StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max;
143138 coordinates_min_max_check (coordinates_min, coordinates_max)
144139
145140 mapping = coordinates2mapping (coordinates_min, coordinates_max)
146- mapping_as_string = """
147- coordinates_min = $coordinates_min
148- coordinates_max = $coordinates_max
149- mapping = coordinates2mapping(coordinates_min, coordinates_max)
150- """
141+
142+ mapping_as_string = """ coordinates_min = $coordinates_min ;coordinates_max = $coordinates_max ;mapping = coordinates2mapping(coordinates_min, coordinates_max)"""
151143 return StructuredMesh (cells_per_dimension, mapping; RealT = RealT,
152144 periodicity = periodicity,
153145 mapping_as_string = mapping_as_string)
@@ -363,12 +355,31 @@ function Base.show(io::IO, ::MIME"text/plain", mesh::StructuredMesh)
363355 " StructuredMesh{" * string (ndims (mesh)) * " , " *
364356 string (real (mesh)) * " }" )
365357 summary_line (io, " size" , size (mesh))
366-
367- summary_line (io, " mapping" , " " )
368358 # Print code lines of mapping_as_string
369- mapping_lines = split (mesh. mapping_as_string, " ;" )
370- for i in eachindex (mapping_lines)
371- summary_line (increment_indent (io), " line $i " , strip (mapping_lines[i]))
359+ if occursin (" \n " , mesh. mapping_as_string)
360+ mapping_lines = replace (mesh. mapping_as_string, ' \n ' => ' ;' )
361+ else
362+ mapping_lines = mesh. mapping_as_string
363+ end
364+
365+ mapping_lines = split (mapping_lines, " ;" )
366+
367+ if occursin (" coordinates" , mesh. mapping_as_string)
368+ summary_line (io, " mapping" , " linear" )
369+ coordinates_min = eval (Meta. parse (split (mapping_lines[1 ], " = " )[2 ]))
370+ coordinates_max = eval (Meta. parse (split (mapping_lines[2 ], " = " )[2 ]))
371+ dims = length (coordinates_max)
372+ summary_line (increment_indent (io), " domain" ,
373+ join ([" [$(coordinates_min[i]) , $(coordinates_max[i]) ]"
374+ for i in 1 : dims], " x" ))
375+ elseif occursin (" mapping" , mesh. mapping_as_string)
376+ summary_line (io, " mapping" , " custom mapping" )
377+ else
378+ # At the moment this is not being used
379+ summary_line (io, " mapping" , " " )
380+ for i in eachindex (mapping_lines)
381+ summary_line (increment_indent (io), " line $i " , strip (mapping_lines[i]))
382+ end
372383 end
373384 summary_footer (io)
374385 end
0 commit comments