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

Added GenericAssemblyStrategy #655

Merged
merged 4 commits into from
Sep 6, 2021
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: 4 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added
- `GenericAssemblyStrategy`. Since PR [#655](https://github.com/gridap/Gridap.jl/pull/655).
- Additional high level API assembly functions. Since PR [#652](https://github.com/gridap/Gridap.jl/pull/652).

### Fixed
- Inheritance relationship for DiscreteModelPortion. Since PR [#645](https://github.com/gridap/Gridap.jl/pull/645).
- Optimization to RT FEs. Since PR [#638](https://github.com/gridap/Gridap.jl/pull/638).

### Added
- Additional high level API assembly functions. Since PR [#652](https://github.com/gridap/Gridap.jl/pull/652).

## [0.16.4] - 2021-08-17

### Added
Expand Down
15 changes: 15 additions & 0 deletions src/FESpaces/Assemblers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,21 @@ map_cell_rows(strategy::DefaultAssemblyStrategy,cell_ids) = cell_ids

map_cell_cols(strategy::DefaultAssemblyStrategy,cell_ids) = cell_ids

struct GenericAssemblyStrategy{A,B,C,D} <: AssemblyStrategy
row_map::A
col_map::B
row_mask::C
col_mask::D
end

row_map(a::GenericAssemblyStrategy,row) = a.row_map(row)

col_map(a::GenericAssemblyStrategy,col) = a.col_map(col)

row_mask(a::GenericAssemblyStrategy,row) = a.row_mask(row)

col_mask(a::GenericAssemblyStrategy,col) = a.col_mask(col)

"""
"""
abstract type Assembler <: GridapType end
Expand Down
1 change: 1 addition & 0 deletions src/FESpaces/FESpaces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export col_map
export row_mask
export col_mask
export DefaultAssemblyStrategy
export GenericAssemblyStrategy
export get_test
export get_trial
export get_rows
Expand Down
10 changes: 3 additions & 7 deletions test/FESpacesTests/SparseMatrixAssemblersTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@ term_to_rows = [rows, brows, b0rows]
term_to_cols = [cols, bcols, b0cols]
term_to_cellmatvec = [ cellmatvec, bcellmatvec, b0cellmatvec ]

struct AssemblyStrategyMock <: AssemblyStrategy end
FESpaces.row_map(a::AssemblyStrategyMock,row) = row
FESpaces.col_map(a::AssemblyStrategyMock,col) = col
FESpaces.row_mask(a::AssemblyStrategyMock,row) = true
FESpaces.col_mask(a::AssemblyStrategyMock,col) = true

mtypes = [
SparseMatrixCSC{Float64,Int},
SparseMatrixCSR{0,Float64,Int},
Expand All @@ -102,7 +96,9 @@ for T in mtypes
assem = SparseMatrixAssembler(T,Vector{Float64},U,V)
test_sparse_matrix_assembler(assem,matdata,vecdata,data)

assem2 = SparseMatrixAssembler(T,Vector{Float64},U,V,AssemblyStrategyMock())
strategy = GenericAssemblyStrategy(row->row,col->col,row->true,col->true)

assem2 = SparseMatrixAssembler(T,Vector{Float64},U,V,strategy)
test_sparse_matrix_assembler(assem2,matdata,vecdata,data)

matdata = ([cellmat],[rows],[cols])
Expand Down