Skip to content

Commit 4cf9e8a

Browse files
authored
Merge pull request #987 from gridap/fixes_evaluation_cellstate
Fixes evaluation cellstate
2 parents 92f38a2 + df86051 commit 4cf9e8a

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

src/CellData/CellFields.jl

+7
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ function get_cell_points(trian::Triangulation)
5757
CellPoint(cell_ref_coords,cell_phys_coords,trian,ReferenceDomain())
5858
end
5959

60+
function Base.:(==)(a::CellPoint,b::CellPoint)
61+
a.trian == b.trian &&
62+
a.cell_ref_point == b.cell_ref_point &&
63+
a.cell_phys_point == b.cell_phys_point &&
64+
a.domain_style == b.domain_style
65+
end
66+
6067
"""
6168
"""
6269
abstract type CellField <: CellDatum end

src/CellData/CellStates.jl

+3-1
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ end
5252
get_triangulation(f::CellState) = get_triangulation(f.points)
5353
DomainStyle(::Type{CellState{T,P}}) where {T,P} = DomainStyle(P)
5454

55+
_get_cell_points(a::CellState) = a.points
56+
5557
function evaluate!(cache,f::CellState,x::CellPoint)
56-
if f.points === x
58+
if f.points == x
5759
f.values
5860
else
5961
@unreachable """\n

test/CellDataTests/CellStatesTests.jl

+12
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,16 @@ r = r1*r2*h
5858
#using Gridap.Visualization
5959
#writevtk(x,"x",cellfields=["f"=>f,"g"=>g])
6060

61+
# Test for evaluating operations involving cellstates
62+
model = CartesianDiscreteModel((0.0,1.0,0,1.0,0,1),(2,1,1))
63+
Ω = Interior(model,[1,2])
64+
Γ = Boundary(Ω)
65+
= Measure(Ω,0)
66+
= Measure(Γ,0)
67+
a = CellState(1.0,dΩ)
68+
b = CellState(1.0,dΓ)
69+
id(z)=z
70+
@test sum(((ida))dΩ) == sum((a)dΩ)
71+
@test sum(((idb))dΓ) == sum((b)dΓ)
72+
6173
end # module

0 commit comments

Comments
 (0)