From d5acb156e884c416a2d4ef1316c58bdf3d392b5b Mon Sep 17 00:00:00 2001 From: "Alberto F. Martin" Date: Wed, 11 Feb 2026 14:38:40 +1100 Subject: [PATCH 1/4] Adding the isconsistent optional argument to interpolate functions --- NEWS.md | 1 + src/FESpaces.jl | 48 +++++++++++++++++++++++++++--------------------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/NEWS.md b/NEWS.md index 278ff36..b8d7dba 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - New overloads for the `TrialFESpace` constructor where the data to be imposed is passed as a `DistributedCellField`. Since PR[#185](https://github.com/gridap/GridapDistributed.jl/pull/185). - Added missing `FESpace` constructors for distributed triangulations specialized for the RT FEs case. Since PR[#188](https://github.com/gridap/GridapDistributed.jl/pull/188) +- Added optional argument isconsistent to interpolate functions. Since PR[#XXX]((https://github.com/gridap/GridapDistributed.jl/pull/XXX). ## [0.4.10] - 2025-09-29 diff --git a/src/FESpaces.jl b/src/FESpaces.jl index 5871692..0be7e08 100644 --- a/src/FESpaces.jl +++ b/src/FESpaces.jl @@ -456,77 +456,83 @@ function generate_gids( generate_gids(cell_gids,cell_to_ldofs,nldofs) end -function FESpaces.interpolate(u,f::DistributedSingleFieldFESpace) - free_values = zero_free_values(f) - interpolate!(u,free_values,f) +function FESpaces.interpolate(u,f::GridapDistributed.DistributedSingleFieldFESpace, isconsistent=false) + free_values = GridapDistributed.zero_free_values(f) + interpolate!(u,free_values,f,isconsistent) end function FESpaces.interpolate!( - u,free_values::AbstractVector,f::DistributedSingleFieldFESpace) + u, + free_values::AbstractVector, + f::GridapDistributed.DistributedSingleFieldFESpace, + isconsistent=false) map(f.spaces,local_views(free_values)) do V,vec interpolate!(u,vec,V) end - FEFunction(f,free_values) + FEFunction(f,free_values,isconsistent) end function FESpaces.interpolate!( - u::DistributedCellField,free_values::AbstractVector,f::DistributedSingleFieldFESpace) - map(local_views(u),f.spaces,local_views(free_values)) do ui,V,vec - interpolate!(ui,vec,V) + u::GridapDistributed.DistributedCellField, + free_values::AbstractVector, + f::GridapDistributed.DistributedSingleFieldFESpace, + isconsistent=false) + map(local_views(u),f.spaces,local_views(free_values)) do u, V,vec + interpolate!(u,vec,V) end - FEFunction(f,free_values) + FEFunction(f,free_values,isconsistent) end -function FESpaces.interpolate_dirichlet(u, f::DistributedSingleFieldFESpace) +function FESpaces.interpolate_dirichlet(u, f::DistributedSingleFieldFESpace, isconsistent=false) free_values = zero_free_values(f) dirichlet_values = get_dirichlet_dof_values(f) - interpolate_dirichlet!(u,free_values,dirichlet_values,f) + interpolate_dirichlet!(u,free_values,dirichlet_values,f,isconsistent) end function FESpaces.interpolate_dirichlet!( u, free_values::AbstractVector, dirichlet_values::AbstractArray{<:AbstractVector}, - f::DistributedSingleFieldFESpace) + f::DistributedSingleFieldFESpace, isconsistent=false) map(f.spaces,local_views(free_values),dirichlet_values) do V,fvec,dvec interpolate_dirichlet!(u,fvec,dvec,V) end - FEFunction(f,free_values,dirichlet_values) + FEFunction(f,free_values,dirichlet_values,isconsistent) end function FESpaces.interpolate_dirichlet!( u::DistributedCellField, free_values::AbstractVector, dirichlet_values::AbstractArray{<:AbstractVector}, - f::DistributedSingleFieldFESpace) + f::DistributedSingleFieldFESpace, isconsistent=false) map(local_views(u), f.spaces,local_views(free_values),dirichlet_values) do u,V,fvec,dvec interpolate_dirichlet!(u,fvec,dvec,V) end - FEFunction(f,free_values,dirichlet_values) + FEFunction(f,free_values,dirichlet_values,isconsistent) end -function FESpaces.interpolate_everywhere(u, f::DistributedSingleFieldFESpace) +function FESpaces.interpolate_everywhere(u, f::DistributedSingleFieldFESpace, isconsistent=false) free_values = zero_free_values(f) dirichlet_values = get_dirichlet_dof_values(f) - interpolate_everywhere!(u,free_values,dirichlet_values,f) + interpolate_everywhere!(u,free_values,dirichlet_values,f,isconsistent) end function FESpaces.interpolate_everywhere!( u, free_values::AbstractVector, dirichlet_values::AbstractArray{<:AbstractVector}, - f::DistributedSingleFieldFESpace) + f::DistributedSingleFieldFESpace, isconsistent=false) map(f.spaces,local_views(free_values),dirichlet_values) do V,fvec,dvec interpolate_everywhere!(u,fvec,dvec,V) end - FEFunction(f,free_values,dirichlet_values) + FEFunction(f,free_values,dirichlet_values,isconsistent) end function FESpaces.interpolate_everywhere!( u::DistributedCellField, free_values::AbstractVector, dirichlet_values::AbstractArray{<:AbstractVector}, - f::DistributedSingleFieldFESpace) + f::DistributedSingleFieldFESpace, isconsistent=false) map(local_views(u),f.spaces,local_views(free_values),dirichlet_values) do ui,V,fvec,dvec interpolate_everywhere!(ui,fvec,dvec,V) end - FEFunction(f,free_values,dirichlet_values) + FEFunction(f,free_values,dirichlet_values,isconsistent) end # Factories From 7cbb0d7ad3480747352134660e5f1fb6ed1b806a Mon Sep 17 00:00:00 2001 From: "Alberto F. Martin" Date: Wed, 11 Feb 2026 14:41:53 +1100 Subject: [PATCH 2/4] * Updated NEWS with the proper PR number * Removed the unneeded GridapDistributed. qualifier from some of the interpolate methods. --- NEWS.md | 2 +- src/FESpaces.jl | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/NEWS.md b/NEWS.md index b8d7dba..5ea0558 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - New overloads for the `TrialFESpace` constructor where the data to be imposed is passed as a `DistributedCellField`. Since PR[#185](https://github.com/gridap/GridapDistributed.jl/pull/185). - Added missing `FESpace` constructors for distributed triangulations specialized for the RT FEs case. Since PR[#188](https://github.com/gridap/GridapDistributed.jl/pull/188) -- Added optional argument isconsistent to interpolate functions. Since PR[#XXX]((https://github.com/gridap/GridapDistributed.jl/pull/XXX). +- Added optional argument isconsistent to interpolate functions. Since PR[#190]((https://github.com/gridap/GridapDistributed.jl/pull/190). ## [0.4.10] - 2025-09-29 diff --git a/src/FESpaces.jl b/src/FESpaces.jl index 0be7e08..4e537b4 100644 --- a/src/FESpaces.jl +++ b/src/FESpaces.jl @@ -456,15 +456,15 @@ function generate_gids( generate_gids(cell_gids,cell_to_ldofs,nldofs) end -function FESpaces.interpolate(u,f::GridapDistributed.DistributedSingleFieldFESpace, isconsistent=false) - free_values = GridapDistributed.zero_free_values(f) +function FESpaces.interpolate(u,f::DistributedSingleFieldFESpace, isconsistent=false) + free_values = zero_free_values(f) interpolate!(u,free_values,f,isconsistent) end function FESpaces.interpolate!( u, free_values::AbstractVector, - f::GridapDistributed.DistributedSingleFieldFESpace, + f::DistributedSingleFieldFESpace, isconsistent=false) map(f.spaces,local_views(free_values)) do V,vec interpolate!(u,vec,V) @@ -473,9 +473,9 @@ function FESpaces.interpolate!( end function FESpaces.interpolate!( - u::GridapDistributed.DistributedCellField, + u::DistributedCellField, free_values::AbstractVector, - f::GridapDistributed.DistributedSingleFieldFESpace, + f::DistributedSingleFieldFESpace, isconsistent=false) map(local_views(u),f.spaces,local_views(free_values)) do u, V,vec interpolate!(u,vec,V) From 4ba7fc4b39a08cd1cbc792863ca59c2c42df9697 Mon Sep 17 00:00:00 2001 From: "Alberto F. Martin" <38347633+amartinhuertas@users.noreply.github.com> Date: Wed, 11 Feb 2026 14:48:56 +1100 Subject: [PATCH 3/4] Update NEWS.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 5ea0558..c1b4cb4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - New overloads for the `TrialFESpace` constructor where the data to be imposed is passed as a `DistributedCellField`. Since PR[#185](https://github.com/gridap/GridapDistributed.jl/pull/185). - Added missing `FESpace` constructors for distributed triangulations specialized for the RT FEs case. Since PR[#188](https://github.com/gridap/GridapDistributed.jl/pull/188) -- Added optional argument isconsistent to interpolate functions. Since PR[#190]((https://github.com/gridap/GridapDistributed.jl/pull/190). +- Added optional argument `isconsistent` to interpolate functions. Since PR[#190](https://github.com/gridap/GridapDistributed.jl/pull/190). ## [0.4.10] - 2025-09-29 From 8841ef05ea0c5c0d9740c8420c40463de21ba56b Mon Sep 17 00:00:00 2001 From: "Alberto F. Martin" Date: Wed, 11 Feb 2026 15:08:47 +1100 Subject: [PATCH 4/4] Fixed signature of interpolate! for the DistributedZeroMeanSpace case (the isconsistent optional argument was missing) --- src/FESpaces.jl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/FESpaces.jl b/src/FESpaces.jl index 4e537b4..2b4cb31 100644 --- a/src/FESpaces.jl +++ b/src/FESpaces.jl @@ -883,13 +883,15 @@ end # which does not properly interpolate the function provided. # With this change, we are interpolating in the unconstrained space and then # substracting the mean. -function FESpaces.interpolate!(u,free_values::AbstractVector,f::DistributedZeroMeanFESpace) +function FESpaces.interpolate!(u,free_values::AbstractVector, + f::DistributedZeroMeanFESpace, isconsistent=false) dirichlet_values = get_dirichlet_dof_values(f) - interpolate_everywhere!(u,free_values,dirichlet_values,f) + interpolate_everywhere!(u,free_values,dirichlet_values,f,isconsistent) end -function FESpaces.interpolate!(u::DistributedCellField,free_values::AbstractVector,f::DistributedZeroMeanFESpace) +function FESpaces.interpolate!(u::DistributedCellField,free_values::AbstractVector, + f::DistributedZeroMeanFESpace, isconsistent=false) dirichlet_values = get_dirichlet_dof_values(f) - interpolate_everywhere!(u,free_values,dirichlet_values,f) + interpolate_everywhere!(u,free_values,dirichlet_values,f,isconsistent) end function _compute_new_distributed_fixedval(