Skip to content

Commit

Permalink
Fixed bug in the definition of init_elements and added nelements(). e…
Browse files Browse the repository at this point in the history
…ltype() and ndims() functions for new struct
  • Loading branch information
amrueda committed Jul 26, 2024
1 parent ca44965 commit 8ec3e9c
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions src/solvers/dgsem_p4est/containers_2d_manifold_in_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,29 @@ mutable struct P4estElementContainerPtrArray{NDIMS, RealT <: Real, uEltype <: Re
_surface_flux_values::Vector{uEltype}
end

@inline function nelements(elements::P4estElementContainerPtrArray)
size(elements.node_coordinates, ndims(elements) + 2)

Check warning on line 32 in src/solvers/dgsem_p4est/containers_2d_manifold_in_3d.jl

View check run for this annotation

Codecov / codecov/patch

src/solvers/dgsem_p4est/containers_2d_manifold_in_3d.jl#L31-L32

Added lines #L31 - L32 were not covered by tests
end
@inline Base.ndims(::P4estElementContainerPtrArray{NDIMS}) where {NDIMS} = NDIMS
@inline function Base.eltype(::P4estElementContainerPtrArray{NDIMS, RealT, uEltype}) where {

Check warning on line 35 in src/solvers/dgsem_p4est/containers_2d_manifold_in_3d.jl

View check run for this annotation

Codecov / codecov/patch

src/solvers/dgsem_p4est/containers_2d_manifold_in_3d.jl#L34-L35

Added lines #L34 - L35 were not covered by tests
NDIMS,
RealT,
uEltype
}
uEltype

Check warning on line 40 in src/solvers/dgsem_p4est/containers_2d_manifold_in_3d.jl

View check run for this annotation

Codecov / codecov/patch

src/solvers/dgsem_p4est/containers_2d_manifold_in_3d.jl#L40

Added line #L40 was not covered by tests
end

# Create element container and initialize element data.
# This function dispatches on the dimensions of the mesh and the equation (AbstractEquations{3})
function Trixi.init_elements(mesh::Union{P4estMesh{2, RealT},

Check warning on line 45 in src/solvers/dgsem_p4est/containers_2d_manifold_in_3d.jl

View check run for this annotation

Codecov / codecov/patch

src/solvers/dgsem_p4est/containers_2d_manifold_in_3d.jl#L45

Added line #L45 was not covered by tests
T8codeMesh{2, RealT}},
equations::AbstractEquations{3},
basis,
::Type{uEltype}) where {NDIMS, RealT <: Real,
::Type{uEltype}) where {RealT <: Real,
uEltype <: Real}
nelements = Trixi.ncells(mesh)

Check warning on line 51 in src/solvers/dgsem_p4est/containers_2d_manifold_in_3d.jl

View check run for this annotation

Codecov / codecov/patch

src/solvers/dgsem_p4est/containers_2d_manifold_in_3d.jl#L51

Added line #L51 was not covered by tests

NDIMS = 2 #Dimension of the manifold
ndims_spa = size(mesh.tree_node_coordinates, 1)

Check warning on line 54 in src/solvers/dgsem_p4est/containers_2d_manifold_in_3d.jl

View check run for this annotation

Codecov / codecov/patch

src/solvers/dgsem_p4est/containers_2d_manifold_in_3d.jl#L53-L54

Added lines #L53 - L54 were not covered by tests

_node_coordinates = Vector{RealT}(undef,

Check warning on line 56 in src/solvers/dgsem_p4est/containers_2d_manifold_in_3d.jl

View check run for this annotation

Codecov / codecov/patch

src/solvers/dgsem_p4est/containers_2d_manifold_in_3d.jl#L56

Added line #L56 was not covered by tests
Expand Down Expand Up @@ -148,11 +161,13 @@ function calc_node_coordinates_2d_shell!(node_coordinates,
# We use `StrideArray`s here since these buffers are used in performance-critical
# places and the additional information passed to the compiler makes them faster
# than native `Array`s.
tmp1 = StrideArray(undef, real(mesh),
Trixi.StaticInt(size(mesh.tree_node_coordinates, 1)),
Trixi.static_length(nodes), Trixi.static_length(mesh.nodes))
matrix1 = StrideArray(undef, real(mesh),
Trixi.static_length(nodes), Trixi.static_length(mesh.nodes))
tmp1 = Trixi.StrideArray(undef, real(mesh),

Check warning on line 164 in src/solvers/dgsem_p4est/containers_2d_manifold_in_3d.jl

View check run for this annotation

Codecov / codecov/patch

src/solvers/dgsem_p4est/containers_2d_manifold_in_3d.jl#L164

Added line #L164 was not covered by tests
Trixi.StaticInt(size(mesh.tree_node_coordinates, 1)),
Trixi.static_length(nodes),
Trixi.static_length(mesh.nodes))
matrix1 = Trixi.StrideArray(undef, real(mesh),

Check warning on line 168 in src/solvers/dgsem_p4est/containers_2d_manifold_in_3d.jl

View check run for this annotation

Codecov / codecov/patch

src/solvers/dgsem_p4est/containers_2d_manifold_in_3d.jl#L168

Added line #L168 was not covered by tests
Trixi.static_length(nodes),
Trixi.static_length(mesh.nodes))
matrix2 = similar(matrix1)
baryweights_in = Trixi.barycentric_weights(mesh.nodes)

Check warning on line 172 in src/solvers/dgsem_p4est/containers_2d_manifold_in_3d.jl

View check run for this annotation

Codecov / codecov/patch

src/solvers/dgsem_p4est/containers_2d_manifold_in_3d.jl#L171-L172

Added lines #L171 - L172 were not covered by tests

Expand Down

0 comments on commit 8ec3e9c

Please sign in to comment.