From c4a24f9837feba6e7e34fef18784ec13c6895801 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Sat, 22 Nov 2025 14:52:04 +0100 Subject: [PATCH 01/10] `const` and immutable `struct`s, non-breaking --- .../entropy_bounded_limiter.jl | 2 +- src/callbacks_stage/positivity_zhang_shu.jl | 2 +- src/callbacks_step/alive.jl | 4 +-- src/callbacks_step/analysis.jl | 18 +++++------ src/callbacks_step/save_restart.jl | 2 +- src/callbacks_step/steady_state.jl | 2 +- src/callbacks_step/stepsize.jl | 2 +- src/callbacks_step/time_series.jl | 14 ++++---- src/callbacks_step/visualization.jl | 4 +-- src/equations/ideal_glm_mhd_multiion_2d.jl | 6 ++-- src/equations/ideal_glm_mhd_multiion_3d.jl | 6 ++-- src/meshes/dgmulti_meshes.jl | 4 +-- src/meshes/p4est_mesh.jl | 14 ++++---- src/meshes/structured_mesh.jl | 8 ++--- src/meshes/structured_mesh_view.jl | 12 +++---- src/meshes/t8code_mesh.jl | 10 +++--- src/meshes/unstructured_mesh.jl | 32 +++++++++---------- .../semidiscretization_coupled.jl | 8 ++--- .../semidiscretization_hyperbolic.jl | 8 ++--- src/solvers/dgmulti/dg_parabolic.jl | 2 +- src/solvers/dgsem_p4est/dg_3d.jl | 3 +- src/solvers/dgsem_unstructured/dg_2d.jl | 2 +- .../sort_boundary_conditions.jl | 6 ++-- src/time_integration/methods_2N.jl | 8 ++--- src/time_integration/methods_3Sstar.jl | 4 +-- src/time_integration/methods_SSP.jl | 12 +++---- .../methods_PERK2.jl | 8 ++--- .../methods_PERK3.jl | 8 ++--- .../methods_PERK4.jl | 8 ++--- .../paired_explicit_runge_kutta.jl | 4 +-- .../relaxation_methods/methods_subdiagonal.jl | 6 ++-- .../methods_vanderHouwen.jl | 6 ++-- 32 files changed, 117 insertions(+), 118 deletions(-) diff --git a/src/callbacks_stage/entropy_bounded_limiter.jl b/src/callbacks_stage/entropy_bounded_limiter.jl index 57bc658cf82..7a75030b36b 100644 --- a/src/callbacks_stage/entropy_bounded_limiter.jl +++ b/src/callbacks_stage/entropy_bounded_limiter.jl @@ -5,7 +5,7 @@ @muladd begin #! format: noindent -mutable struct EntropyBoundedLimiter{RealT <: Real} +struct EntropyBoundedLimiter{RealT <: Real} exp_entropy_decrease_max::RealT # < 0 end diff --git a/src/callbacks_stage/positivity_zhang_shu.jl b/src/callbacks_stage/positivity_zhang_shu.jl index 90893faa0f7..a45db8ef4f7 100644 --- a/src/callbacks_stage/positivity_zhang_shu.jl +++ b/src/callbacks_stage/positivity_zhang_shu.jl @@ -64,7 +64,7 @@ end # terminate the type-stable iteration over tuples function limiter_zhang_shu!(u, thresholds::Tuple{}, variables::Tuple{}, mesh, equations, solver, cache) - return nothing + nothing end include("positivity_zhang_shu_dg1d.jl") diff --git a/src/callbacks_step/alive.jl b/src/callbacks_step/alive.jl index fe2234166cd..84225f7f7d8 100644 --- a/src/callbacks_step/alive.jl +++ b/src/callbacks_step/alive.jl @@ -15,8 +15,8 @@ time steps. If `analysis_interval ≂̸ 0`, the output is omitted every """ mutable struct AliveCallback start_time::Float64 - alive_interval::Int - analysis_interval::Int + const alive_interval::Int + const analysis_interval::Int end function AliveCallback(; analysis_interval = 0, diff --git a/src/callbacks_step/analysis.jl b/src/callbacks_step/analysis.jl index b56f49ea9a4..db07ad1cba3 100644 --- a/src/callbacks_step/analysis.jl +++ b/src/callbacks_step/analysis.jl @@ -49,15 +49,15 @@ mutable struct AnalysisCallback{Analyzer, AnalysisIntegrals, InitialStateIntegra start_time_last_analysis::Float64 ncalls_rhs_last_analysis::Int start_gc_time::Float64 - interval::Int - save_analysis::Bool - output_directory::String - analysis_filename::String - analyzer::Analyzer - analysis_errors::Vector{Symbol} - analysis_integrals::AnalysisIntegrals + const interval::Int + const save_analysis::Bool + const output_directory::String + const analysis_filename::String + const analyzer::Analyzer + const analysis_errors::Vector{Symbol} + const analysis_integrals::AnalysisIntegrals initial_state_integrals::InitialStateIntegrals - cache::Cache + const cache::Cache end # TODO: Taal bikeshedding, implement a method with less information and the signature @@ -595,7 +595,7 @@ end # terminate the type-stable iteration over tuples function analyze_integrals(analysis_integrals::Tuple{}, io, du, u, t, semi) - return nothing + nothing end # used for error checks and EOC analysis diff --git a/src/callbacks_step/save_restart.jl b/src/callbacks_step/save_restart.jl index 9f9ca49bc50..b1c653ef09f 100644 --- a/src/callbacks_step/save_restart.jl +++ b/src/callbacks_step/save_restart.jl @@ -12,7 +12,7 @@ Save the current numerical solution in a restart file every `interval` time steps. """ -mutable struct SaveRestartCallback +struct SaveRestartCallback interval::Int save_final_restart::Bool output_directory::String diff --git a/src/callbacks_step/steady_state.jl b/src/callbacks_step/steady_state.jl index 7085d05394f..d7de1dbda01 100644 --- a/src/callbacks_step/steady_state.jl +++ b/src/callbacks_step/steady_state.jl @@ -11,7 +11,7 @@ Terminates the integration when the [`residual_steady_state(du, equations)`](@ref) falls below the threshold specified by `abstol, reltol`. """ -mutable struct SteadyStateCallback{RealT <: Real} +struct SteadyStateCallback{RealT <: Real} abstol::RealT reltol::RealT end diff --git a/src/callbacks_step/stepsize.jl b/src/callbacks_step/stepsize.jl index de820c40590..da984e0b4b8 100644 --- a/src/callbacks_step/stepsize.jl +++ b/src/callbacks_step/stepsize.jl @@ -27,7 +27,7 @@ diffusive CFL number, or a function of time `t` returning a `Real` number. By default, the timestep will be adjusted at every step. For different values of `interval`, the timestep will be adjusted every `interval` steps. """ -mutable struct StepsizeCallback{CflAdvectiveType, CflDiffusiveType} +struct StepsizeCallback{CflAdvectiveType, CflDiffusiveType} cfl_advective::CflAdvectiveType cfl_diffusive::CflDiffusiveType interval::Int diff --git a/src/callbacks_step/time_series.jl b/src/callbacks_step/time_series.jl index d3c9861d33d..aca656490f8 100644 --- a/src/callbacks_step/time_series.jl +++ b/src/callbacks_step/time_series.jl @@ -27,12 +27,12 @@ Currently this callback is only implemented for [`TreeMesh`](@ref) and [`Unstruc """ mutable struct TimeSeriesCallback{RealT <: Real, uEltype <: Real, SolutionVariables, VariableNames, Cache} - interval::Int - solution_variables::SolutionVariables - variable_names::VariableNames - output_directory::String - filename::String - point_coordinates::Array{RealT, 2} + const interval::Int + const solution_variables::SolutionVariables + const variable_names::VariableNames + const output_directory::String + const filename::String + const point_coordinates::Array{RealT, 2} # Point data is stored as a vector of vectors of the solution data type: # * the "outer" `Vector` contains one vector for each point at which a time_series is recorded # * the "inner" `Vector` contains the actual time series for a single point, @@ -42,7 +42,7 @@ mutable struct TimeSeriesCallback{RealT <: Real, uEltype <: Real, SolutionVariab point_data::Vector{Vector{uEltype}} time::Vector{RealT} step::Vector{Int} - time_series_cache::Cache + const time_series_cache::Cache end function Base.show(io::IO, cb::DiscreteCallback{<:Any, <:TimeSeriesCallback}) diff --git a/src/callbacks_step/visualization.jl b/src/callbacks_step/visualization.jl index 367b30bd573..228dabdd23c 100644 --- a/src/callbacks_step/visualization.jl +++ b/src/callbacks_step/visualization.jl @@ -5,8 +5,8 @@ @muladd begin #! format: noindent -mutable struct VisualizationCallback{PlotDataCreator, SolutionVariables, VariableNames, - PlotCreator} +struct VisualizationCallback{PlotDataCreator, SolutionVariables, VariableNames, + PlotCreator} plot_data_creator::PlotDataCreator interval::Int solution_variables::SolutionVariables diff --git a/src/equations/ideal_glm_mhd_multiion_2d.jl b/src/equations/ideal_glm_mhd_multiion_2d.jl index 38b3e52fa49..2d11d49bb0a 100644 --- a/src/equations/ideal_glm_mhd_multiion_2d.jl +++ b/src/equations/ideal_glm_mhd_multiion_2d.jl @@ -82,9 +82,9 @@ References: In case of more than one ion species, the multi-ion GLM-MHD equations should ALWAYS be used with [`source_terms_lorentz`](@ref). """ -mutable struct IdealGlmMhdMultiIonEquations2D{NVARS, NCOMP, RealT <: Real, - ElectronPressure, ElectronTemperature} <: - AbstractIdealGlmMhdMultiIonEquations{2, NVARS, NCOMP} +struct IdealGlmMhdMultiIonEquations2D{NVARS, NCOMP, RealT <: Real, + ElectronPressure, ElectronTemperature} <: + AbstractIdealGlmMhdMultiIonEquations{2, NVARS, NCOMP} gammas::SVector{NCOMP, RealT} # Heat capacity ratios charge_to_mass::SVector{NCOMP, RealT} # Charge to mass ratios gas_constants::SVector{NCOMP, RealT} # Specific gas constants diff --git a/src/equations/ideal_glm_mhd_multiion_3d.jl b/src/equations/ideal_glm_mhd_multiion_3d.jl index f5a88ca4192..26157b61927 100644 --- a/src/equations/ideal_glm_mhd_multiion_3d.jl +++ b/src/equations/ideal_glm_mhd_multiion_3d.jl @@ -38,9 +38,9 @@ References: In case of more than one ion species, the multi-ion GLM-MHD equations should ALWAYS be used with [`source_terms_lorentz`](@ref). """ -mutable struct IdealGlmMhdMultiIonEquations3D{NVARS, NCOMP, RealT <: Real, - ElectronPressure} <: - AbstractIdealGlmMhdMultiIonEquations{3, NVARS, NCOMP} +struct IdealGlmMhdMultiIonEquations3D{NVARS, NCOMP, RealT <: Real, + ElectronPressure} <: + AbstractIdealGlmMhdMultiIonEquations{3, NVARS, NCOMP} gammas::SVector{NCOMP, RealT} # Heat capacity ratios charge_to_mass::SVector{NCOMP, RealT} # Charge to mass ratios electron_pressure::ElectronPressure # Function to compute the electron pressure diff --git a/src/meshes/dgmulti_meshes.jl b/src/meshes/dgmulti_meshes.jl index 70af85ec415..ad747a00f7c 100644 --- a/src/meshes/dgmulti_meshes.jl +++ b/src/meshes/dgmulti_meshes.jl @@ -13,9 +13,9 @@ dispatchable type. This is intended to store geometric data and connectivities f mesh (Cartesian, affine, curved, structured/unstructured). """ mutable struct DGMultiMesh{NDIMS, MeshType, MeshDataT <: MeshData{NDIMS}, BoundaryFaceT} - md::MeshDataT + const md::MeshDataT - boundary_faces::BoundaryFaceT + const boundary_faces::BoundaryFaceT current_filename :: String unsaved_changes :: Bool diff --git a/src/meshes/p4est_mesh.jl b/src/meshes/p4est_mesh.jl index b9ed2915ca3..0ca70429218 100644 --- a/src/meshes/p4est_mesh.jl +++ b/src/meshes/p4est_mesh.jl @@ -24,17 +24,17 @@ mesh for a two-dimensional surface or shell in three-dimensional space. mutable struct P4estMesh{NDIMS, NDIMS_AMBIENT, RealT <: Real, IsParallel, P, Ghost, NDIMSP2, NNODES} <: AbstractMesh{NDIMS} - p4est :: P # Either PointerWrapper{p4est_t} or PointerWrapper{p8est_t} - is_parallel :: IsParallel - ghost :: Ghost # Either PointerWrapper{p4est_ghost_t} or PointerWrapper{p8est_ghost_t} + const p4est::P # Either PointerWrapper{p4est_t} or PointerWrapper{p8est_t} + const is_parallel::IsParallel + ghost::Ghost # Either PointerWrapper{p4est_ghost_t} or PointerWrapper{p8est_ghost_t} # Coordinates at the nodes specified by the tensor product of `nodes` (NDIMS times). # This specifies the geometry interpolation for each tree. - tree_node_coordinates::Array{RealT, NDIMSP2} # [dimension, i, j, k, tree] - nodes::SVector{NNODES, RealT} - boundary_names::Array{Symbol, 2} # [face direction, tree] + const tree_node_coordinates::Array{RealT, NDIMSP2} # [dimension, i, j, k, tree] + const nodes::SVector{NNODES, RealT} + boundary_names::Array{Symbol, 2} # [face direction, tree] current_filename::String unsaved_changes::Bool - p4est_partition_allow_for_coarsening::Bool + const p4est_partition_allow_for_coarsening::Bool function P4estMesh{NDIMS}(p4est, tree_node_coordinates, nodes, boundary_names, current_filename, unsaved_changes, diff --git a/src/meshes/structured_mesh.jl b/src/meshes/structured_mesh.jl index 20d3dbeb84b..488f1ee6ef5 100644 --- a/src/meshes/structured_mesh.jl +++ b/src/meshes/structured_mesh.jl @@ -14,10 +14,10 @@ Different numbers of cells per dimension are possible and arbitrary functions can be used as domain faces. """ mutable struct StructuredMesh{NDIMS, RealT <: Real} <: AbstractMesh{NDIMS} - cells_per_dimension::NTuple{NDIMS, Int} - mapping::Any # Not relevant for performance - mapping_as_string::String - periodicity::NTuple{NDIMS, Bool} + const cells_per_dimension::NTuple{NDIMS, Int} + const mapping::Any # Not relevant for performance + const mapping_as_string::String + const periodicity::NTuple{NDIMS, Bool} current_filename::String unsaved_changes::Bool end diff --git a/src/meshes/structured_mesh_view.jl b/src/meshes/structured_mesh_view.jl index d931d25bbe1..bea6ad7755e 100644 --- a/src/meshes/structured_mesh_view.jl +++ b/src/meshes/structured_mesh_view.jl @@ -11,13 +11,13 @@ A view on a structured curved mesh. """ mutable struct StructuredMeshView{NDIMS, RealT <: Real} <: AbstractMesh{NDIMS} - parent::StructuredMesh{NDIMS, RealT} - cells_per_dimension::NTuple{NDIMS, Int} - mapping::Any # Not relevant for performance - mapping_as_string::String + const parent::StructuredMesh{NDIMS, RealT} + const cells_per_dimension::NTuple{NDIMS, Int} + const mapping::Any # Not relevant for performance + const mapping_as_string::String current_filename::String - indices_min::NTuple{NDIMS, Int} - indices_max::NTuple{NDIMS, Int} + const indices_min::NTuple{NDIMS, Int} + const indices_max::NTuple{NDIMS, Int} unsaved_changes::Bool end diff --git a/src/meshes/t8code_mesh.jl b/src/meshes/t8code_mesh.jl index f2a9b9283c3..3e66891eef7 100644 --- a/src/meshes/t8code_mesh.jl +++ b/src/meshes/t8code_mesh.jl @@ -7,8 +7,8 @@ to manage trees and mesh refinement. """ mutable struct T8codeMesh{NDIMS, RealT <: Real, IsParallel, NDIMSP2, NNODES} <: AbstractMesh{NDIMS} - forest :: T8code.ForestWrapper - is_parallel :: IsParallel + forest::T8code.ForestWrapper + const is_parallel::IsParallel # This specifies the geometry interpolation for each tree. tree_node_coordinates::Array{RealT, NDIMSP2} # [dimension, i, j, k, tree] @@ -16,8 +16,8 @@ mutable struct T8codeMesh{NDIMS, RealT <: Real, IsParallel, NDIMSP2, NNODES} <: # Stores the quadrature nodes. nodes::SVector{NNODES, RealT} - boundary_names :: Array{Symbol, 2} # [face direction, tree] - current_filename :: String + boundary_names::Array{Symbol, 2} # [face direction, tree] + current_filename::String ninterfaces :: Int nmortars :: Int @@ -37,10 +37,10 @@ mutable struct T8codeMesh{NDIMS, RealT <: Real, IsParallel, NDIMSP2, NNODES} <: mesh = new{NDIMS, RealT, typeof(is_parallel), NDIMS + 2, length(nodes)}(T8code.ForestWrapper(forest), is_parallel) + mesh.tree_node_coordinates = tree_node_coordinates mesh.nodes = nodes mesh.boundary_names = boundary_names mesh.current_filename = current_filename - mesh.tree_node_coordinates = tree_node_coordinates mesh.unsaved_changes = true finalizer(mesh) do mesh diff --git a/src/meshes/unstructured_mesh.jl b/src/meshes/unstructured_mesh.jl index fae52f834b3..ec494b9a37d 100644 --- a/src/meshes/unstructured_mesh.jl +++ b/src/meshes/unstructured_mesh.jl @@ -18,22 +18,22 @@ from a mesh file `filename`. mutable struct UnstructuredMesh2D{RealT <: Real, CurvedSurfaceT <: CurvedSurface{RealT}} <: AbstractMesh{2} - filename :: String - n_corners :: Int - n_surfaces :: Int # total number of surfaces - n_interfaces :: Int # number of interior surfaces - n_boundaries :: Int # number of surfaces on the physical boundary - n_elements :: Int - polydeg :: Int - corners :: Array{RealT, 2} # [ndims, n_corners] - neighbour_information :: Array{Int, 2} # [neighbour node/element/edge ids, n_surfaces] - boundary_names :: Array{Symbol, 2} # [local sides, n_elements] - periodicity :: Bool - element_node_ids :: Array{Int, 2} # [node ids, n_elements] - element_is_curved :: Vector{Bool} - surface_curves :: Array{CurvedSurfaceT, 2} # [local sides, n_elements] - current_filename :: String - unsaved_changes :: Bool # if true, the mesh will be saved for plotting + const filename :: String + const n_corners :: Int + const n_surfaces :: Int # total number of surfaces + const n_interfaces :: Int # number of interior surfaces + const n_boundaries :: Int # number of surfaces on the physical boundary + const n_elements :: Int + const polydeg :: Int + const corners :: Array{RealT, 2} # [ndims, n_corners] + const neighbour_information :: Array{Int, 2} # [neighbour node/element/edge ids, n_surfaces] + const boundary_names :: Array{Symbol, 2} # [local sides, n_elements] + const periodicity :: Bool + const element_node_ids :: Array{Int, 2} # [node ids, n_elements] + const element_is_curved :: Vector{Bool} + const surface_curves :: Array{CurvedSurfaceT, 2} # [local sides, n_elements] + current_filename :: String + unsaved_changes :: Bool # if true, the mesh will be saved for plotting end # constructor for an unstructured mesh read in from a file diff --git a/src/semidiscretization/semidiscretization_coupled.jl b/src/semidiscretization/semidiscretization_coupled.jl index 80ac6f236e0..05f14749df2 100644 --- a/src/semidiscretization/semidiscretization_coupled.jl +++ b/src/semidiscretization/semidiscretization_coupled.jl @@ -443,10 +443,10 @@ mutable struct BoundaryConditionCoupled{NDIMS, uEltype <: Real, Indices, CouplingConverter} # NDIMST2M1 == NDIMS * 2 - 1 # Buffer for boundary values: [variable, nodes_i, nodes_j, cell_i, cell_j] - u_boundary :: Array{uEltype, NDIMST2M1} # NDIMS * 2 - 1 - other_orientation :: Int - indices :: Indices - coupling_converter :: CouplingConverter + u_boundary :: Array{uEltype, NDIMST2M1} # NDIMS * 2 - 1 + const other_orientation :: Int + const indices :: Indices + const coupling_converter :: CouplingConverter function BoundaryConditionCoupled(other_semi_index, indices, uEltype, coupling_converter) diff --git a/src/semidiscretization/semidiscretization_hyperbolic.jl b/src/semidiscretization/semidiscretization_hyperbolic.jl index 2a563c02229..b5745247701 100644 --- a/src/semidiscretization/semidiscretization_hyperbolic.jl +++ b/src/semidiscretization/semidiscretization_hyperbolic.jl @@ -20,11 +20,11 @@ mutable struct SemidiscretizationHyperbolic{Mesh, Equations, InitialCondition, # This guy is a bit messy since we abuse it as some kind of "exact solution" # although this doesn't really exist... - initial_condition::InitialCondition + const initial_condition::InitialCondition - boundary_conditions::BoundaryConditions - source_terms::SourceTerms - solver::Solver + const boundary_conditions::BoundaryConditions + const source_terms::SourceTerms + const solver::Solver cache::Cache performance_counter::PerformanceCounter end diff --git a/src/solvers/dgmulti/dg_parabolic.jl b/src/solvers/dgmulti/dg_parabolic.jl index b855326f29d..d7e82c817fc 100644 --- a/src/solvers/dgmulti/dg_parabolic.jl +++ b/src/solvers/dgmulti/dg_parabolic.jl @@ -257,7 +257,7 @@ end function calc_boundary_flux!(flux, u, t, operator_type, boundary_conditions::NamedTuple{(), Tuple{}}, mesh, equations, dg::DGMulti, cache, cache_parabolic) - return nothing + nothing end function calc_single_boundary_flux!(flux_face_values, u_face_values, t, diff --git a/src/solvers/dgsem_p4est/dg_3d.jl b/src/solvers/dgsem_p4est/dg_3d.jl index cdc9cda79b6..515dcec432b 100644 --- a/src/solvers/dgsem_p4est/dg_3d.jl +++ b/src/solvers/dgsem_p4est/dg_3d.jl @@ -26,8 +26,7 @@ function create_cache(mesh::Union{P4estMesh{3}, T8codeMesh{3}}, equations, nnodes(mortar_l2), nnodes(mortar_l2)) for _ in 1:Threads.maxthreadid()] |> VecOfArrays - return (; fstar_primary_threaded, fstar_secondary_threaded, fstar_tmp_threaded, - u_threaded) + (; fstar_primary_threaded, fstar_secondary_threaded, fstar_tmp_threaded, u_threaded) end # index_to_start_step_3d(index::Symbol, index_range) diff --git a/src/solvers/dgsem_unstructured/dg_2d.jl b/src/solvers/dgsem_unstructured/dg_2d.jl index 1c785765d73..60358082d1b 100644 --- a/src/solvers/dgsem_unstructured/dg_2d.jl +++ b/src/solvers/dgsem_unstructured/dg_2d.jl @@ -358,7 +358,7 @@ function calc_boundary_flux_by_type!(cache, t, BCs::Tuple{}, BC_indices::Tuple{} mesh::Union{UnstructuredMesh2D, P4estMesh, T8codeMesh}, equations, surface_integral, dg::DG) - return nothing + nothing end function calc_boundary_flux!(cache, t, boundary_condition::BC, boundary_indexing, diff --git a/src/solvers/dgsem_unstructured/sort_boundary_conditions.jl b/src/solvers/dgsem_unstructured/sort_boundary_conditions.jl index d6cf6e1ce6d..0e5d51a917e 100644 --- a/src/solvers/dgsem_unstructured/sort_boundary_conditions.jl +++ b/src/solvers/dgsem_unstructured/sort_boundary_conditions.jl @@ -8,16 +8,16 @@ """ UnstructuredSortedBoundaryTypes -General container to sort the boundary conditions by type and name for some unstructured meshes/solvers. +General struct to sort the boundary conditions by type and name for some unstructured meshes/solvers. It stores a set of global indices for each boundary condition type and name to expedite computation during the call to `calc_boundary_flux!`. The original dictionary form of the boundary conditions set by the user in the elixir file is also stored for printing. """ mutable struct UnstructuredSortedBoundaryTypes{N, BCs <: NTuple{N, Any}, Vec <: AbstractVector{<:Integer}} - boundary_condition_types::BCs # specific boundary condition type(s), e.g. BoundaryConditionDirichlet + const boundary_condition_types::BCs # specific boundary condition type(s), e.g. BoundaryConditionDirichlet boundary_indices::NTuple{N, Vec} # integer vectors containing global boundary indices - boundary_dictionary::Dict{Symbol, Any} # boundary conditions as set by the user in the elixir file + const boundary_dictionary::Dict{Symbol, Any} # boundary conditions as set by the user in the elixir file boundary_symbol_indices::Dict{Symbol, Vector{Int}} # integer vectors containing global boundary indices per boundary identifier end diff --git a/src/time_integration/methods_2N.jl b/src/time_integration/methods_2N.jl index d115aa366d1..5e791f6bcc1 100644 --- a/src/time_integration/methods_2N.jl +++ b/src/time_integration/methods_2N.jl @@ -77,9 +77,9 @@ end # This struct is needed to fake https://github.com/SciML/OrdinaryDiffEq.jl/blob/0c2048a502101647ac35faabd80da8a5645beac7/src/integrators/type.jl#L1 mutable struct SimpleIntegratorOptions{Callback} callback::Callback # callbacks; used in Trixi.jl - adaptive::Bool # whether the algorithm is adaptive; ignored + const adaptive::Bool # whether the algorithm is adaptive; ignored dtmax::Float64 # ignored - maxiters::Int # maximal number of time steps + const maxiters::Int # maximal number of time steps tstops::Vector{Float64} # tstops from https://diffeq.sciml.ai/v6.8/basics/common_solver_opts/#Output-Control-1; ignored end @@ -104,8 +104,8 @@ mutable struct SimpleIntegrator2N{RealT <: Real, uType <: AbstractVector, iter::Int # current number of time steps (iteration) p::Params # will be the semidiscretization from Trixi.jl sol::Sol # faked - f::F # `rhs!` of the semidiscretization - alg::Alg # SimpleAlgorithm2N + const f::F # `rhs!` of the semidiscretization + const alg::Alg # SimpleAlgorithm2N opts::SimpleIntegratorOptions finalstep::Bool # added for convenience end diff --git a/src/time_integration/methods_3Sstar.jl b/src/time_integration/methods_3Sstar.jl index 31d5e622f1e..f54a599c92b 100644 --- a/src/time_integration/methods_3Sstar.jl +++ b/src/time_integration/methods_3Sstar.jl @@ -143,8 +143,8 @@ mutable struct SimpleIntegrator3Sstar{RealT <: Real, uType <: AbstractVector, iter::Int # current number of time step (iteration) p::Params # will be the semidiscretization from Trixi.jl sol::Sol # faked - f::F # `rhs!` of the semidiscretization - alg::Alg # SimpleAlgorithm3Sstar + const f::F # `rhs!` of the semidiscretization + const alg::Alg # SimpleAlgorithm3Sstar opts::SimpleIntegratorOptions finalstep::Bool # added for convenience end diff --git a/src/time_integration/methods_SSP.jl b/src/time_integration/methods_SSP.jl index 5603009e121..fe6c8fa767f 100644 --- a/src/time_integration/methods_SSP.jl +++ b/src/time_integration/methods_SSP.jl @@ -54,9 +54,9 @@ end # This struct is needed to fake https://github.com/SciML/OrdinaryDiffEq.jl/blob/0c2048a502101647ac35faabd80da8a5645beac7/src/integrators/type.jl#L1 mutable struct SimpleIntegratorSSPOptions{Callback, TStops} callback::Callback # callbacks; used in Trixi - adaptive::Bool # whether the algorithm is adaptive; ignored + const adaptive::Bool # whether the algorithm is adaptive; ignored dtmax::Float64 # ignored - maxiters::Int # maximal number of time steps + const maxiters::Int # maximal number of time steps tstops::TStops # tstops from https://diffeq.sciml.ai/v6.8/basics/common_solver_opts/#Output-Control-1; ignored end @@ -90,12 +90,12 @@ mutable struct SimpleIntegratorSSP{RealT <: Real, uType, iter::Int # current number of time steps (iteration) p::Params # will be the semidiscretization from Trixi sol::Sol # faked - f::F # `rhs!` of the semidiscretization - alg::Alg # SimpleSSPRK33 + const f::F # `rhs!` of the semidiscretization + const alg::Alg # SimpleSSPRK33 opts::SimpleIntegratorSSPOptions finalstep::Bool # added for convenience - dtchangeable::Bool - force_stepfail::Bool + const dtchangeable::Bool + const force_stepfail::Bool end """ diff --git a/src/time_integration/paired_explicit_runge_kutta/methods_PERK2.jl b/src/time_integration/paired_explicit_runge_kutta/methods_PERK2.jl index ad443a7ad47..cc41cf37f65 100644 --- a/src/time_integration/paired_explicit_runge_kutta/methods_PERK2.jl +++ b/src/time_integration/paired_explicit_runge_kutta/methods_PERK2.jl @@ -204,12 +204,12 @@ mutable struct PairedExplicitRK2Integrator{RealT <: Real, uType <: AbstractVecto iter::Int # current number of time steps (iteration) p::Params # will be the semidiscretization from Trixi sol::Sol # faked - f::F # `rhs!` of the semidiscretization - alg::PairedExplicitRK2 + const f::F # `rhs!` of the semidiscretization + const alg::PairedExplicitRK2 opts::PairedExplicitRKOptions finalstep::Bool # added for convenience - dtchangeable::Bool - force_stepfail::Bool + const dtchangeable::Bool + const force_stepfail::Bool # Additional PERK register k1::uType end diff --git a/src/time_integration/paired_explicit_runge_kutta/methods_PERK3.jl b/src/time_integration/paired_explicit_runge_kutta/methods_PERK3.jl index 81169287996..5abaed11056 100644 --- a/src/time_integration/paired_explicit_runge_kutta/methods_PERK3.jl +++ b/src/time_integration/paired_explicit_runge_kutta/methods_PERK3.jl @@ -197,12 +197,12 @@ mutable struct PairedExplicitRK3Integrator{RealT <: Real, uType <: AbstractVecto iter::Int # current number of time steps (iteration) p::Params # will be the semidiscretization from Trixi sol::Sol # faked - f::F # `rhs!` of the semidiscretization - alg::PairedExplicitRK3 + const f::F # `rhs!` of the semidiscretization + const alg::PairedExplicitRK3 opts::PairedExplicitRKOptions finalstep::Bool # added for convenience - dtchangeable::Bool - force_stepfail::Bool + const dtchangeable::Bool + const force_stepfail::Bool # Additional PERK3 registers k1::uType kS1::uType diff --git a/src/time_integration/paired_explicit_runge_kutta/methods_PERK4.jl b/src/time_integration/paired_explicit_runge_kutta/methods_PERK4.jl index d7951651640..4bbebd47c78 100644 --- a/src/time_integration/paired_explicit_runge_kutta/methods_PERK4.jl +++ b/src/time_integration/paired_explicit_runge_kutta/methods_PERK4.jl @@ -198,12 +198,12 @@ mutable struct PairedExplicitRK4Integrator{RealT <: Real, uType <: AbstractVecto iter::Int # current number of time steps (iteration) p::Params # will be the semidiscretization from Trixi sol::Sol # faked - f::F # `rhs!` of the semidiscretization - alg::PairedExplicitRK4 + const f::F # `rhs!` of the semidiscretization + const alg::PairedExplicitRK4 opts::PairedExplicitRKOptions finalstep::Bool # added for convenience - dtchangeable::Bool - force_stepfail::Bool + const dtchangeable::Bool + const force_stepfail::Bool # Additional PERK register k1::uType end diff --git a/src/time_integration/paired_explicit_runge_kutta/paired_explicit_runge_kutta.jl b/src/time_integration/paired_explicit_runge_kutta/paired_explicit_runge_kutta.jl index 333ebc14983..40a6c4d6be5 100644 --- a/src/time_integration/paired_explicit_runge_kutta/paired_explicit_runge_kutta.jl +++ b/src/time_integration/paired_explicit_runge_kutta/paired_explicit_runge_kutta.jl @@ -17,9 +17,9 @@ abstract type AbstractPairedExplicitRKSingle <: AbstractPairedExplicitRK end # This struct is needed to fake https://github.com/SciML/OrdinaryDiffEq.jl/blob/0c2048a502101647ac35faabd80da8a5645beac7/src/integrators/type.jl#L1 mutable struct PairedExplicitRKOptions{Callback, TStops} callback::Callback # callbacks; used in Trixi - adaptive::Bool # whether the algorithm is adaptive (false) + const adaptive::Bool # whether the algorithm is adaptive (false) dtmax::Float64 # ignored - maxiters::Int # maximal number of time steps + const maxiters::Int # maximal number of time steps tstops::TStops # tstops from https://diffeq.sciml.ai/v6.8/basics/common_solver_opts/#Output-Control-1; ignored end diff --git a/src/time_integration/relaxation_methods/methods_subdiagonal.jl b/src/time_integration/relaxation_methods/methods_subdiagonal.jl index 009a8cc5d61..7488c899ecc 100644 --- a/src/time_integration/relaxation_methods/methods_subdiagonal.jl +++ b/src/time_integration/relaxation_methods/methods_subdiagonal.jl @@ -143,15 +143,15 @@ mutable struct SubDiagonalRelaxationIntegrator{RealT <: Real, uType <: AbstractV iter::Int # current number of time steps (iteration) p::Params # will be the semidiscretization from Trixi.jl sol::Sol # faked - f::F # `rhs` of the semidiscretization - alg::Alg # `SubDiagonalRelaxationAlgorithm` + const f::F # `rhs` of the semidiscretization + const alg::Alg # `SubDiagonalRelaxationAlgorithm` opts::SimpleIntegratorOptions finalstep::Bool # added for convenience # Addition for Relaxation methodology direction::uType # RK update, i.e., sum of stages K_i times weights b_i gamma::RealT # Relaxation parameter S_old::RealT # Entropy of previous iterate - relaxation_solver::AbstractRelaxationSolver + const relaxation_solver::AbstractRelaxationSolver # Note: Could add another register which would store the summed-up # dot products ∑ₖ (wₖ ⋅ kₖ) and then integrate only once and not per stage k # Could also add option `recompute_entropy` for entropy-conservative problems diff --git a/src/time_integration/relaxation_methods/methods_vanderHouwen.jl b/src/time_integration/relaxation_methods/methods_vanderHouwen.jl index 852ad27a5a2..099c162612c 100644 --- a/src/time_integration/relaxation_methods/methods_vanderHouwen.jl +++ b/src/time_integration/relaxation_methods/methods_vanderHouwen.jl @@ -177,8 +177,8 @@ mutable struct vanderHouwenRelaxationIntegrator{RealT <: Real, uType <: Abstract iter::Int # current number of time steps (iteration) p::Params # will be the semidiscretization from Trixi.jl sol::Sol # faked - f::F # `rhs` of the semidiscretization - alg::Alg # `vanderHouwenRelaxationAlgorithm` + const f::F # `rhs` of the semidiscretization + const alg::Alg # `vanderHouwenRelaxationAlgorithm` opts::SimpleIntegratorOptions finalstep::Bool # added for convenience # Addition for efficient implementation @@ -187,7 +187,7 @@ mutable struct vanderHouwenRelaxationIntegrator{RealT <: Real, uType <: Abstract direction::uType # RK update, i.e., sum of stages K_i times weights b_i gamma::RealT # Relaxation parameter S_old::RealT # Entropy of previous iterate - relaxation_solver::AbstractRelaxationSolver + const relaxation_solver::AbstractRelaxationSolver # Note: Could add another register which would store the summed-up # dot products ∑ₖ (wₖ ⋅ kₖ) and then integrate only once and not per stage k # Could also add option `recompute_entropy` for entropy-conservative problems From 2d35a898e44c3f28856d03be918da9206b6970cc Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Sat, 22 Nov 2025 14:54:15 +0100 Subject: [PATCH 02/10] try cosnt boundary names --- src/meshes/p4est_mesh.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/meshes/p4est_mesh.jl b/src/meshes/p4est_mesh.jl index 0ca70429218..e1714c4f141 100644 --- a/src/meshes/p4est_mesh.jl +++ b/src/meshes/p4est_mesh.jl @@ -26,12 +26,14 @@ mutable struct P4estMesh{NDIMS, NDIMS_AMBIENT, RealT <: Real, IsParallel, P, Gho AbstractMesh{NDIMS} const p4est::P # Either PointerWrapper{p4est_t} or PointerWrapper{p8est_t} const is_parallel::IsParallel - ghost::Ghost # Either PointerWrapper{p4est_ghost_t} or PointerWrapper{p8est_ghost_t} + # Either PointerWrapper{p4est_ghost_t} or PointerWrapper{p8est_ghost_t}. + # Required for ghost/halo layers in parallel runs, thus mutable. + ghost::Ghost # Coordinates at the nodes specified by the tensor product of `nodes` (NDIMS times). # This specifies the geometry interpolation for each tree. const tree_node_coordinates::Array{RealT, NDIMSP2} # [dimension, i, j, k, tree] const nodes::SVector{NNODES, RealT} - boundary_names::Array{Symbol, 2} # [face direction, tree] + const boundary_names::Array{Symbol, 2} # [face direction, tree] current_filename::String unsaved_changes::Bool const p4est_partition_allow_for_coarsening::Bool From 82c528d77d0759a58fb1e8d5b28c04fbb109556a Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Sat, 22 Nov 2025 14:59:32 +0100 Subject: [PATCH 03/10] fmt --- src/meshes/p4est_mesh.jl | 2 +- src/solvers/dgmulti/dg_parabolic.jl | 2 +- src/solvers/dgsem_p4est/dg_3d.jl | 3 ++- src/solvers/dgsem_unstructured/dg_2d.jl | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/meshes/p4est_mesh.jl b/src/meshes/p4est_mesh.jl index e1714c4f141..1500f36659b 100644 --- a/src/meshes/p4est_mesh.jl +++ b/src/meshes/p4est_mesh.jl @@ -26,7 +26,7 @@ mutable struct P4estMesh{NDIMS, NDIMS_AMBIENT, RealT <: Real, IsParallel, P, Gho AbstractMesh{NDIMS} const p4est::P # Either PointerWrapper{p4est_t} or PointerWrapper{p8est_t} const is_parallel::IsParallel - # Either PointerWrapper{p4est_ghost_t} or PointerWrapper{p8est_ghost_t}. + # Either `PointerWrapper{p4est_ghost_t}` or `PointerWrapper{p8est_ghost_t}`. # Required for ghost/halo layers in parallel runs, thus mutable. ghost::Ghost # Coordinates at the nodes specified by the tensor product of `nodes` (NDIMS times). diff --git a/src/solvers/dgmulti/dg_parabolic.jl b/src/solvers/dgmulti/dg_parabolic.jl index d7e82c817fc..b855326f29d 100644 --- a/src/solvers/dgmulti/dg_parabolic.jl +++ b/src/solvers/dgmulti/dg_parabolic.jl @@ -257,7 +257,7 @@ end function calc_boundary_flux!(flux, u, t, operator_type, boundary_conditions::NamedTuple{(), Tuple{}}, mesh, equations, dg::DGMulti, cache, cache_parabolic) - nothing + return nothing end function calc_single_boundary_flux!(flux_face_values, u_face_values, t, diff --git a/src/solvers/dgsem_p4est/dg_3d.jl b/src/solvers/dgsem_p4est/dg_3d.jl index 515dcec432b..cdc9cda79b6 100644 --- a/src/solvers/dgsem_p4est/dg_3d.jl +++ b/src/solvers/dgsem_p4est/dg_3d.jl @@ -26,7 +26,8 @@ function create_cache(mesh::Union{P4estMesh{3}, T8codeMesh{3}}, equations, nnodes(mortar_l2), nnodes(mortar_l2)) for _ in 1:Threads.maxthreadid()] |> VecOfArrays - (; fstar_primary_threaded, fstar_secondary_threaded, fstar_tmp_threaded, u_threaded) + return (; fstar_primary_threaded, fstar_secondary_threaded, fstar_tmp_threaded, + u_threaded) end # index_to_start_step_3d(index::Symbol, index_range) diff --git a/src/solvers/dgsem_unstructured/dg_2d.jl b/src/solvers/dgsem_unstructured/dg_2d.jl index 60358082d1b..1c785765d73 100644 --- a/src/solvers/dgsem_unstructured/dg_2d.jl +++ b/src/solvers/dgsem_unstructured/dg_2d.jl @@ -358,7 +358,7 @@ function calc_boundary_flux_by_type!(cache, t, BCs::Tuple{}, BC_indices::Tuple{} mesh::Union{UnstructuredMesh2D, P4estMesh, T8codeMesh}, equations, surface_integral, dg::DG) - nothing + return nothing end function calc_boundary_flux!(cache, t, boundary_condition::BC, boundary_indexing, From dbbc0ddabd1aaec8955f1cd3666cbc5b7ce0326a Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Sat, 22 Nov 2025 15:00:35 +0100 Subject: [PATCH 04/10] return --- src/callbacks_stage/positivity_zhang_shu.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/callbacks_stage/positivity_zhang_shu.jl b/src/callbacks_stage/positivity_zhang_shu.jl index a45db8ef4f7..90893faa0f7 100644 --- a/src/callbacks_stage/positivity_zhang_shu.jl +++ b/src/callbacks_stage/positivity_zhang_shu.jl @@ -64,7 +64,7 @@ end # terminate the type-stable iteration over tuples function limiter_zhang_shu!(u, thresholds::Tuple{}, variables::Tuple{}, mesh, equations, solver, cache) - nothing + return nothing end include("positivity_zhang_shu_dg1d.jl") From a2b20698b16631c1f5f00dc6a514f2a8d796214c Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Sat, 22 Nov 2025 15:04:32 +0100 Subject: [PATCH 05/10] try t8code const --- src/meshes/t8code_mesh.jl | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/meshes/t8code_mesh.jl b/src/meshes/t8code_mesh.jl index 3e66891eef7..5226e247625 100644 --- a/src/meshes/t8code_mesh.jl +++ b/src/meshes/t8code_mesh.jl @@ -11,10 +11,10 @@ mutable struct T8codeMesh{NDIMS, RealT <: Real, IsParallel, NDIMSP2, NNODES} <: const is_parallel::IsParallel # This specifies the geometry interpolation for each tree. - tree_node_coordinates::Array{RealT, NDIMSP2} # [dimension, i, j, k, tree] + const tree_node_coordinates::Array{RealT, NDIMSP2} # [dimension, i, j, k, tree] # Stores the quadrature nodes. - nodes::SVector{NNODES, RealT} + const nodes::SVector{NNODES, RealT} boundary_names::Array{Symbol, 2} # [face direction, tree] current_filename::String @@ -35,13 +35,17 @@ mutable struct T8codeMesh{NDIMS, RealT <: Real, IsParallel, NDIMSP2, NNODES} <: is_parallel = mpi_isparallel() ? True() : False() mesh = new{NDIMS, RealT, typeof(is_parallel), NDIMS + 2, length(nodes)}(T8code.ForestWrapper(forest), - is_parallel) - - mesh.tree_node_coordinates = tree_node_coordinates - mesh.nodes = nodes - mesh.boundary_names = boundary_names - mesh.current_filename = current_filename - mesh.unsaved_changes = true + is_parallel, + tree_node_coordinates, + nodes, + boundary_names, + current_filename, + -1, # ninterfaces + -1, # nmortars + -1, # nboundaries + -1, # nmpiinterfaces + -1, # nmpimortars + true) finalizer(mesh) do mesh # In serial mode we can finalize the forest right away. In parallel From d692442481d676a339644d232346bf15e9a3066c Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Sat, 22 Nov 2025 14:52:58 +0000 Subject: [PATCH 06/10] try const eqs --- src/semidiscretization/semidiscretization_hyperbolic.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/semidiscretization/semidiscretization_hyperbolic.jl b/src/semidiscretization/semidiscretization_hyperbolic.jl index b5745247701..df85d6e660f 100644 --- a/src/semidiscretization/semidiscretization_hyperbolic.jl +++ b/src/semidiscretization/semidiscretization_hyperbolic.jl @@ -16,7 +16,7 @@ mutable struct SemidiscretizationHyperbolic{Mesh, Equations, InitialCondition, SourceTerms, Solver, Cache} <: AbstractSemidiscretization mesh::Mesh - equations::Equations + const equations::Equations # This guy is a bit messy since we abuse it as some kind of "exact solution" # although this doesn't really exist... From 6aa65ce9a995ebde6d0c47692e02023a0c0600e1 Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Sat, 22 Nov 2025 15:02:21 +0000 Subject: [PATCH 07/10] p4est mv --- src/meshes/p4est_mesh_view.jl | 4 ++-- src/semidiscretization/semidiscretization_hyperbolic.jl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/meshes/p4est_mesh_view.jl b/src/meshes/p4est_mesh_view.jl index 38493618a69..1d7cea86880 100644 --- a/src/meshes/p4est_mesh_view.jl +++ b/src/meshes/p4est_mesh_view.jl @@ -12,8 +12,8 @@ A view on a [`P4estMesh`](@ref). """ mutable struct P4estMeshView{NDIMS, NDIMS_AMBIENT, RealT <: Real, Parent} <: AbstractMesh{NDIMS} - parent::Parent - cell_ids::Vector{Int} + const parent::Parent + const cell_ids::Vector{Int} unsaved_changes::Bool current_filename::String end diff --git a/src/semidiscretization/semidiscretization_hyperbolic.jl b/src/semidiscretization/semidiscretization_hyperbolic.jl index df85d6e660f..b5745247701 100644 --- a/src/semidiscretization/semidiscretization_hyperbolic.jl +++ b/src/semidiscretization/semidiscretization_hyperbolic.jl @@ -16,7 +16,7 @@ mutable struct SemidiscretizationHyperbolic{Mesh, Equations, InitialCondition, SourceTerms, Solver, Cache} <: AbstractSemidiscretization mesh::Mesh - const equations::Equations + equations::Equations # This guy is a bit messy since we abuse it as some kind of "exact solution" # although this doesn't really exist... From 0700ce29792a14eb59c37d6ef0c44aa0ca3a47d4 Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Sat, 22 Nov 2025 15:04:26 +0000 Subject: [PATCH 08/10] rt --- src/callbacks_step/analysis.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/callbacks_step/analysis.jl b/src/callbacks_step/analysis.jl index db07ad1cba3..79d71882a62 100644 --- a/src/callbacks_step/analysis.jl +++ b/src/callbacks_step/analysis.jl @@ -595,7 +595,7 @@ end # terminate the type-stable iteration over tuples function analyze_integrals(analysis_integrals::Tuple{}, io, du, u, t, semi) - nothing + return nothing end # used for error checks and EOC analysis From 1ccf757eea6629a1032a43bf3caea4db4eccd44f Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Sat, 22 Nov 2025 22:29:44 +0000 Subject: [PATCH 09/10] clean up t8code --- src/meshes/t8code_mesh.jl | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/meshes/t8code_mesh.jl b/src/meshes/t8code_mesh.jl index 5226e247625..a1ec76c1029 100644 --- a/src/meshes/t8code_mesh.jl +++ b/src/meshes/t8code_mesh.jl @@ -15,17 +15,9 @@ mutable struct T8codeMesh{NDIMS, RealT <: Real, IsParallel, NDIMSP2, NNODES} <: # Stores the quadrature nodes. const nodes::SVector{NNODES, RealT} + const boundary_names::Array{Symbol, 2} # [face direction, tree] - boundary_names::Array{Symbol, 2} # [face direction, tree] current_filename::String - - ninterfaces :: Int - nmortars :: Int - nboundaries :: Int - - nmpiinterfaces :: Int - nmpimortars :: Int - unsaved_changes::Bool function T8codeMesh{NDIMS}(forest::Ptr{t8_forest}, tree_node_coordinates, nodes, @@ -40,11 +32,6 @@ mutable struct T8codeMesh{NDIMS, RealT <: Real, IsParallel, NDIMSP2, NNODES} <: nodes, boundary_names, current_filename, - -1, # ninterfaces - -1, # nmortars - -1, # nboundaries - -1, # nmpiinterfaces - -1, # nmpimortars true) finalizer(mesh) do mesh From 130817c6b23298050a173ed3e0454c0d79a14a24 Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Sat, 22 Nov 2025 22:47:09 +0000 Subject: [PATCH 10/10] revert --- src/meshes/t8code_mesh.jl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/meshes/t8code_mesh.jl b/src/meshes/t8code_mesh.jl index a1ec76c1029..bcacedf9c69 100644 --- a/src/meshes/t8code_mesh.jl +++ b/src/meshes/t8code_mesh.jl @@ -18,6 +18,15 @@ mutable struct T8codeMesh{NDIMS, RealT <: Real, IsParallel, NDIMSP2, NNODES} <: const boundary_names::Array{Symbol, 2} # [face direction, tree] current_filename::String + + # These guys are set in `fill_mesh_info` + ninterfaces :: Int + nmortars :: Int + nboundaries :: Int + + nmpiinterfaces :: Int + nmpimortars :: Int + unsaved_changes::Bool function T8codeMesh{NDIMS}(forest::Ptr{t8_forest}, tree_node_coordinates, nodes, @@ -25,13 +34,17 @@ mutable struct T8codeMesh{NDIMS, RealT <: Real, IsParallel, NDIMSP2, NNODES} <: current_filename, RealT = Float64) where {NDIMS} is_parallel = mpi_isparallel() ? True() : False() - mesh = new{NDIMS, RealT, typeof(is_parallel), NDIMS + 2, length(nodes)}(T8code.ForestWrapper(forest), is_parallel, tree_node_coordinates, nodes, boundary_names, current_filename, + -1, # ninterfaces + -1, # nmortars + -1, # nboundaries + -1, # nmpiinterfaces + -1, # nmpimortars true) finalizer(mesh) do mesh