Skip to content

Commit

Permalink
Merge pull request #94 from bcube-project/materialize_mesh_data
Browse files Browse the repository at this point in the history
Materialize `MeshCellData` on face / Side
  • Loading branch information
ghislainb authored May 13, 2024
2 parents 4004e9f + b051d68 commit da8542d
Show file tree
Hide file tree
Showing 2 changed files with 25 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
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 da8542d

Please sign in to comment.