Skip to content

Commit

Permalink
Added proper comparisions between BlockPRanges
Browse files Browse the repository at this point in the history
  • Loading branch information
JordiManyer committed Aug 14, 2024
1 parent 5f6cd9a commit 0f51e06
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
15 changes: 15 additions & 0 deletions src/BlockPartitionedArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@ function Base.getindex(a::BlockPRange,inds::Block{1})
a.ranges[inds.n...]
end

function PartitionedArrays.matching_local_indices(a::BlockPRange,b::BlockPRange)
c = map(PartitionedArrays.matching_local_indices,blocks(a),blocks(b))
reduce(&,c,init=true)
end

function PartitionedArrays.matching_own_indices(a::BlockPRange,b::BlockPRange)
c = map(PartitionedArrays.matching_own_indices,blocks(a),blocks(b))
reduce(&,c,init=true)
end

function PartitionedArrays.matching_ghost_indices(a::BlockPRange,b::BlockPRange)
c = map(PartitionedArrays.matching_ghost_indices,blocks(a),blocks(b))
reduce(&,c,init=true)
end

"""
struct BlockPArray{V,T,N,A,B} <: BlockArrays.AbstractBlockArray{T,N}
"""
Expand Down
4 changes: 2 additions & 2 deletions src/MultiField.jl
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ end

function FESpaces.interpolate!(objects,free_values::AbstractVector,space::DistributedMultiFieldFESpace)
msg = "free_values and FESpace have incompatible index partitions."
@check partition(axes(free_values,1)) === partition(space.gids) msg
@check PartitionedArrays.matching_local_indices(axes(free_values,1),get_free_dof_ids(space)) msg

# Interpolate each field
field_fe_fun = DistributedSingleFieldFEFunction[]
Expand Down Expand Up @@ -219,7 +219,7 @@ function FESpaces.interpolate_everywhere!(
space::DistributedMultiFieldFESpace
)
msg = "free_values and FESpace have incompatible index partitions."
@check partition(axes(free_values,1)) === partition(space.gids) msg
@check PartitionedArrays.matching_local_indices(axes(free_values,1),get_free_dof_ids(space)) msg

# Interpolate each field
field_fe_fun = DistributedSingleFieldFEFunction[]
Expand Down
1 change: 0 additions & 1 deletion test/MultiFieldTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ function main(distribute, parts, mfs)

domain = (0,4,0,4)
cells = (4,4)
model = CartesianDiscreteModel(domain,cells)
model = CartesianDiscreteModel(ranks,parts,domain,cells)
Ω = Triangulation(model)

Expand Down

0 comments on commit 0f51e06

Please sign in to comment.