From 500db958c8fad5777ac9e3e7e605510484a6b147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Rueda-Ram=C3=ADrez?= Date: Fri, 8 Dec 2023 11:08:59 +0100 Subject: [PATCH] Improved initialization of P4estElementContainer --- src/solvers/dgsem_p4est/containers.jl | 30 +++++++++++++-------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/solvers/dgsem_p4est/containers.jl b/src/solvers/dgsem_p4est/containers.jl index ede056c0a51..c8cd69c66b5 100644 --- a/src/solvers/dgsem_p4est/containers.jl +++ b/src/solvers/dgsem_p4est/containers.jl @@ -6,14 +6,16 @@ #! format: noindent mutable struct P4estElementContainer{NDIMS, RealT <: Real, uEltype <: Real, NDIMSP1, - NDIMSP2, NDIMSP3, R, S, X, O} <: AbstractContainer + NDIMSP2, NDIMSP3, + ContravariantVectors <: + AbstractArray{RealT, NDIMSP3}} <: AbstractContainer # Physical coordinates at each node node_coordinates::Array{RealT, NDIMSP2} # [orientation, node_i, node_j, node_k, element] # Jacobian matrix of the transformation # [jacobian_i, jacobian_j, node_i, node_j, node_k, element] where jacobian_i is the first index of the Jacobian matrix,... jacobian_matrix::Array{RealT, NDIMSP3} # Contravariant vectors, scaled by J, in Kopriva's blue book called Ja^i_n (i index, n dimension) - contravariant_vectors::PtrArray{RealT, NDIMSP3, R, S, X, O} # [dimension, index, node_i, node_j, node_k, element] + contravariant_vectors::ContravariantVectors # [dimension, index, node_i, node_j, node_k, element] # 1/J where J is the Jacobian determinant (determinant of Jacobian matrix) inverse_jacobian::Array{RealT, NDIMSP1} # [node_i, node_j, node_k, element] # Buffer for calculated surface flux @@ -125,20 +127,16 @@ function init_elements(mesh::Union{P4estMesh{NDIMS, RealT}, T8codeMesh{NDIMS, Re NDIMS * 2, nelements)) elements = P4estElementContainer{NDIMS, RealT, uEltype, NDIMS + 1, NDIMS + 2, - NDIMS + 3, ntuple(@inline(i->i), NDIMS + 3), - Tuple{StaticInt{ndims_spa}, - ntuple(i -> Int64, NDIMS + 2)... - }, NTuple{NDIMS + 3, Nothing}, - NTuple{NDIMS + 3, StaticInt{1}}}(node_coordinates, - jacobian_matrix, - contravariant_vectors, - inverse_jacobian, - surface_flux_values, - _node_coordinates, - _jacobian_matrix, - _contravariant_vectors, - _inverse_jacobian, - _surface_flux_values) + NDIMS + 3, typeof(contravariant_vectors)}(node_coordinates, + jacobian_matrix, + contravariant_vectors, + inverse_jacobian, + surface_flux_values, + _node_coordinates, + _jacobian_matrix, + _contravariant_vectors, + _inverse_jacobian, + _surface_flux_values) init_elements!(elements, mesh, basis) return elements