Skip to content

Commit 6fc11d5

Browse files
committed
use readdlm instead of read_file
1 parent a1506a0 commit 6fc11d5

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

src/auxiliary/auxiliary.jl

-14
Original file line numberDiff line numberDiff line change
@@ -346,20 +346,6 @@ function register_error_hints()
346346
return nothing
347347
end
348348

349-
function read_file(file_path::AbstractString, data_type::Type = Float64)
350-
@assert isfile(file_path) "Couldn't find file"
351-
data = zeros(data_type, 0)
352-
open(file_path, "r") do file
353-
while !eof(file)
354-
line_content = readline(file)
355-
append!(data, parse(data_type, line_content))
356-
end
357-
end
358-
num_lines = length(data)
359-
360-
return num_lines, data
361-
end
362-
363349
"""
364350
Trixi.download(src_url, file_path)
365351

src/time_integration/paired_explicit_runge_kutta/methods_PERK2.jl

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# Since these FMAs can increase the performance of many numerical algorithms,
33
# we need to opt-in explicitly.
44
# See https://ranocha.de/blog/Optimizing_EC_Trixi for further details.
5+
using DelimitedFiles
6+
57
@muladd begin
68
#! format: noindent
79

@@ -78,7 +80,10 @@ function compute_PERK2_butcher_tableau(num_stages, base_path_mon_coeffs::Abstrac
7880
a_matrix[:, 1] = c[3:end]
7981

8082
path_mon_coeffs = base_path_mon_coeffs * "gamma_" * string(num_stages) * ".txt"
81-
num_mon_coeffs, mon_coeffs = read_file(path_mon_coeffs, Float64)
83+
@assert isfile(path_mon_coeffs) "Couldn't find file"
84+
mon_coeffs = readdlm(path_mon_coeffs, Float64)
85+
num_mon_coeffs = size(mon_coeffs, 1)
86+
8287
@assert num_mon_coeffs == coeffs_max
8388
A = compute_a_coeffs(num_stages, bc_factors, mon_coeffs)
8489

@@ -281,7 +286,7 @@ function solve!(integrator::PERK2Integrator)
281286
end
282287

283288
# Higher stages
284-
for stage in 3:alg.num_stages
289+
for stage in 3:(alg.num_stages)
285290
# Construct current state
286291
@threaded for i in eachindex(integrator.du)
287292
integrator.u_tmp[i] = integrator.u[i] +

0 commit comments

Comments
 (0)