From 9bd60e55e9f2dc70a60c731daaef0e837d4aa756 Mon Sep 17 00:00:00 2001 From: t Date: Thu, 5 Nov 2026 19:45:00 +0000 Subject: [PATCH] Use Ferrite.task_local_copy for per-task values copies when available Ferrite master deprecates copy(::CellValues) in favour of task_local_copy. Registered Ferrite 1.7.0 has no task_local_copy, so fall back to copy there. Agent-Harness: Claude Code 2.1.318 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code --- src/operators.jl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/operators.jl b/src/operators.jl index f1f5dddc..619112b6 100644 --- a/src/operators.jl +++ b/src/operators.jl @@ -60,11 +60,14 @@ end (op::NonlinearOperator)(r, u, p, t) = residual!(r, op, u, p, t) +# Ferrite releases before `task_local_copy` (1.7.0) only have `copy`; newer ones deprecate it. +const _values_copy = isdefined(Ferrite, :task_local_copy) ? Ferrite.task_local_copy : copy + # `reinit!` mutates CellValues and FacetValues, so each load evaluation gets its own copies and # concurrent solves of one problem's remakes share no mutable state. function _fresh_values(ctx::AssemblyContext{NF, DH, CV, FV}) where {NF, DH, CV, FV} return AssemblyContext{NF, DH, CV, FV}( - ctx.dh, ctx.fields, map(copy, ctx.cellvalues), map(copy, ctx.facetvalues), ctx.facetsets, ctx.facetcells + ctx.dh, ctx.fields, map(_values_copy, ctx.cellvalues), map(_values_copy, ctx.facetvalues), ctx.facetsets, ctx.facetcells ) end