Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

Remove occursin piracy #362

Merged
merged 1 commit into from
Mar 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions src/MOLFiniteDifference/MOL_discretization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function SciMLBase.symbolic_discretize(pdesys::ModelingToolkit.PDESystem,discret
# Replace Differential terms in the bc lhs with the symbolic spatially discretized terms
# TODO: Fix Neumann and Robin on higher dimension
lhs = length(nottime) == 1 ? substitute(bc.lhs,depvarderivmaps[i]) : bc.lhs

# Replace symbol in the bc lhs with the spatial discretized term
lhs = substitute(lhs,depvarmaps[i])
rhs = substitute.((bc.rhs,),edgemaps[i])
Expand Down Expand Up @@ -140,20 +140,3 @@ function SciMLBase.discretize(pdesys::ModelingToolkit.PDESystem,discretization::
simpsys = structural_simplify(sys)
prob = ODEProblem(simpsys,Pair[],tspan)
end

# Piracy, to be deleted when https://github.com/JuliaSymbolics/SymbolicUtils.jl/pull/251
# merges
Base.occursin(needle::ModelingToolkit.SymbolicUtils.Symbolic, haystack::ModelingToolkit.SymbolicUtils.Symbolic) = _occursin(needle, haystack)
Base.occursin(needle, haystack::ModelingToolkit.SymbolicUtils.Symbolic) = _occursin(needle, haystack)
Base.occursin(needle::ModelingToolkit.SymbolicUtils.Symbolic, haystack) = _occursin(needle, haystack)
function _occursin(needle, haystack)
isequal(needle, haystack) && return true

if istree(haystack)
args = arguments(haystack)
for arg in args
occursin(needle, arg) && return true
end
end
return false
end