Skip to content

Commit

Permalink
Merge branch 'main' into dev_dual_support
Browse files Browse the repository at this point in the history
  • Loading branch information
ghislainb committed May 13, 2024
2 parents 3e46162 + da8542d commit 1fb75e1
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/cellfunction/meshdata.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,24 @@ function LazyOperators.materialize(data::MeshData{CellData}, cInfo::CellInfo)
return _wrap_value(value)
end

function LazyOperators.materialize(
data::MeshData{CellData},
side::Side⁻{Nothing, <:Tuple{<:FaceInfo}},
)
fInfo = get_args(side)[1]
cInfo_n = get_cellinfo_n(fInfo)
return materialize(data, cInfo_n)
end

function LazyOperators.materialize(
data::MeshData{CellData},
side::Side⁺{Nothing, <:Tuple{<:FaceInfo}},
)
fInfo = get_args(side)[1]
cInfo_p = get_cellinfo_p(fInfo)
return materialize(data, cInfo_p)
end

function LazyOperators.materialize(
data::MeshData{FaceData},
side::AbstractSide{Nothing, <:Tuple{<:FaceInfo}},
Expand Down
10 changes: 10 additions & 0 deletions src/function_space/function_space.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
"""
Abstract structure for the different types of function space, for
instance the Lagrange function space, the Taylor function space etc.
# Devs notes
All subtypes should implement the following functions:
* `ndofs(::AbstractFunctionSpace, ::AbstractShape)`
* `_scalar_shape_functions(::AbstractFunctionSpace, ::AbstractShape, ξ)`
* `idof_by_vertex(::AbstractFunctionSpace, ::AbstractShape)`
* `idof_by_edge(::AbstractFunctionSpace, ::AbstractShape)`
* `idof_by_edge_with_bounds(::AbstractFunctionSpace, ::AbstractShape)`
* `idof_by_face(::AbstractFunctionSpace, ::AbstractShape)`
* `idof_by_face_with_bounds(::AbstractFunctionSpace, ::AbstractShape)`
"""
abstract type AbstractFunctionSpaceType end

Expand Down
15 changes: 15 additions & 0 deletions src/function_space/lagrange.jl
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,21 @@ function idof_by_face_with_bounds(::FunctionSpace{<:Lagrange, 1}, shape::Prism)
(SA[1, 2, 5, 4], SA[2, 3, 6, 5], SA[3, 1, 4, 6], SA[1, 3, 2], SA[4, 5, 6])
end

# Pyramid
function idof_by_edge(::FunctionSpace{<:Lagrange, 1}, shape::Pyramid)
ntuple(i -> SA[], nedges(shape))
end
function idof_by_edge_with_bounds(::FunctionSpace{<:Lagrange, 1}, shape::Pyramid)
(SA[1, 2], SA[2, 3], SA[3, 4], SA[4, 1], SA[1, 5], SA[2, 5], SA[3, 5], SA[4, 5])
end

function idof_by_face(::FunctionSpace{<:Lagrange, 1}, shape::Pyramid)
ntuple(i -> SA[], nfaces(shape))
end
function idof_by_face_with_bounds(::FunctionSpace{<:Lagrange, 1}, shape::Pyramid)
(SA[1, 4, 3, 2], SA[1, 2, 5], SA[2, 3, 5], SA[3, 4, 5], SA[4, 1, 5])
end

# Generic versions for Lagrange 0 and 1 (any shape)
get_coords(::FunctionSpace{<:Lagrange, 0}, shape::AbstractShape) = (center(shape),)
get_coords(::FunctionSpace{<:Lagrange, 1}, shape::AbstractShape) = get_coords(shape)
Expand Down
7 changes: 7 additions & 0 deletions test/dof/test_meshdata.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
_cellFuncs = Bcube.materialize(cellFuncs, cInfo)
@test Bcube.materialize(_cellFuncs, cPointRef) == funcs[i](cPointPhy)
end

#--- Test 3, MeshCellData in face integration
mesh = rectangle_mesh(2, 2; xmin = 0, xmax = 3, ymin = -1, ymax = 1)
data = MeshCellData(ones(ncells(mesh)))
= Measure(BoundaryFaceDomain(mesh), 1)
values = nonzeros(Bcube.compute((side_n(data))dΓ))
@test isapprox_arrays(values, [3.0, 2.0, 3.0, 2.0])
end

@testset "FaceData" begin
Expand Down

0 comments on commit 1fb75e1

Please sign in to comment.