Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-implement ZeroMeanFESpace #155

Merged
merged 19 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
## [0.4.4] 2024-08-14

### Added

- Added kwargs for VTK encoding options. Since PR[#156](https://github.com/gridap/GridapDistributed.jl/pull/156).
- Reimplemented distributed ZeroMeanFESpaces. Since PR[#155](https://github.com/gridap/GridapDistributed.jl/pull/155).

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "GridapDistributed"
uuid = "f9701e48-63b3-45aa-9a63-9bc6c271f355"
authors = ["S. Badia <[email protected]>", "A. F. Martin <[email protected]>", "F. Verdugo <[email protected]>"]
version = "0.4.3"
version = "0.4.4"

[deps]
BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e"
Expand Down
20 changes: 20 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 Expand Up @@ -336,6 +351,11 @@ function LinearAlgebra.dot(x::BlockPVector,y::BlockPVector)
end

function LinearAlgebra.norm(v::BlockPVector,p::Real=2)
if p == 2
# More accurate, I think, given the fact we are not
# repeating the sqrt(square(sqrt...)) process in every block and every processor
return sqrt(dot(v,v))
end
block_norms = map(vi->norm(vi,p),blocks(v))
return sum(block_norms.^p)^(1/p)
end
Expand Down
Loading
Loading