Skip to content

Commit

Permalink
Minor bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
JordiManyer committed Nov 15, 2024
1 parent c74c61a commit fc307df
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
9 changes: 7 additions & 2 deletions scripts/Embedded/Bugs/change_domain_bug.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ dΓ = Measure(Γ,2order)
(vh)dΓ
(2vh)dΓ

Γ = DifferentiableTriangulation(EmbeddedBoundary(cutgeo))

= EmbeddedBoundary(cutgeo)
Γ = DifferentiableTriangulation(_Γ)
= Measure(Γ,2order)
(vh)dΓ
(2vh)dΓ
(2vh)dΓ

cf = CellField(1,_Γ)
change_domain(cf,Γ,ReferenceDomain())
29 changes: 28 additions & 1 deletion src/Embedded/DifferentiableTriangulations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ end

function CellData.get_cell_points(ttrian::DifferentiableTriangulation)
if isnothing(ttrian.cell_values)
return get_cell_points(ttrian.trian)
pts = get_cell_points(ttrian.trian)
return CellPoint(CellData.get_data(pts),ttrian,DomainStyle(pts))
end
c = ttrian.caches
cell_values = ttrian.cell_values
Expand Down Expand Up @@ -127,6 +128,32 @@ function Geometry.get_glue(ttrian::DifferentiableTriangulation,val::Val{D}) wher
)
end

function Geometry.is_change_possible(
strian::A,ttrian::DifferentiableTriangulation{Dc,Dp,A}
) where {Dc,Dp,A <: Union{SubCellTriangulation,SubFacetTriangulation}}
return strian === ttrian.trian
end

function Geometry.best_target(
strian::A,ttrian::DifferentiableTriangulation{Dc,Dp,A}
) where {Dc,Dp,A <: Union{SubCellTriangulation,SubFacetTriangulation}}
return ttrian
end

for tdomain in (:ReferenceDomain,:PhysicalDomain)
for sdomain in (:ReferenceDomain,:PhysicalDomain)
@eval begin
function CellData.change_domain(
a::CellField,strian::A,::$sdomain,ttrian::DifferentiableTriangulation{Dc,Dp,A},::$tdomain
) where {Dc,Dp,A <: Union{SubCellTriangulation,SubFacetTriangulation}}
@assert is_change_possible(strian,ttrian)
b = change_domain(a,$(tdomain)())
return CellData.similar_cell_field(a,CellData.get_data(b),ttrian,$(tdomain)())
end
end
end
end

function FESpaces.get_cell_fe_data(fun,f,ttrian::DifferentiableTriangulation)
FESpaces.get_cell_fe_data(fun,f,ttrian.trian)
end
Expand Down

0 comments on commit fc307df

Please sign in to comment.