diff --git a/src/cellfunction/meshdata.jl b/src/cellfunction/meshdata.jl index e557c9732..48dde0a00 100644 --- a/src/cellfunction/meshdata.jl +++ b/src/cellfunction/meshdata.jl @@ -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}}, diff --git a/src/function_space/function_space.jl b/src/function_space/function_space.jl index 62fa6e6a4..e633fac2f 100644 --- a/src/function_space/function_space.jl +++ b/src/function_space/function_space.jl @@ -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 diff --git a/src/function_space/lagrange.jl b/src/function_space/lagrange.jl index bd134f926..6f809fc1d 100644 --- a/src/function_space/lagrange.jl +++ b/src/function_space/lagrange.jl @@ -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) diff --git a/test/dof/test_meshdata.jl b/test/dof/test_meshdata.jl index ecc9c0b23..da85ed7d4 100644 --- a/test/dof/test_meshdata.jl +++ b/test/dof/test_meshdata.jl @@ -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))) + dΓ = 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