-
Notifications
You must be signed in to change notification settings - Fork 97
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
Wrote additional high level API assembly functions #652
Changes from 2 commits
dd8b9f9
00a8d3e
296ff28
2e7c92c
3455363
1cc0816
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -270,44 +270,88 @@ function assemble_matrix(f::Function,a::Assembler,U::FESpace,V::FESpace) | |
assemble_matrix(a,collect_cell_matrix(U,V,f(u,v))) | ||
end | ||
|
||
function assemble_matrix!(A,f::Function,a::Assembler,U::FESpace,V::FESpace) | ||
v = get_fe_basis(V) | ||
u = get_trial_fe_basis(U) | ||
assemble_matrix!(A,a,collect_cell_matrix(U,V,f(u,v))) | ||
end | ||
|
||
function assemble_vector(f::Function,a::Assembler,V::FESpace) | ||
v = get_fe_basis(V) | ||
assemble_vector(a,collect_cell_vector(V,f(v))) | ||
end | ||
|
||
function assemble_vector!(b,f::Function,a::Assembler,V::FESpace) | ||
v = get_fe_basis(V) | ||
assemble_vector!(b,a,collect_cell_vector(V,f(v))) | ||
end | ||
|
||
function assemble_matrix_and_vector(f::Function,b::Function,a::Assembler,U::FESpace,V::FESpace) | ||
v = get_fe_basis(V) | ||
u = get_trial_fe_basis(U) | ||
assemble_matrix_and_vector(a,collect_cell_matrix_and_vector(U,V,f(u,v),b(v))) | ||
end | ||
|
||
function assemble_matrix_and_vector!(M,r,f::Function,b::Function,a::Assembler,U::FESpace,V::FESpace) | ||
v = get_fe_basis(V) | ||
u = get_trial_fe_basis(U) | ||
assemble_matrix_and_vector!(M,r,a,collect_cell_matrix_and_vector(U,V,f(u,v),b(v))) | ||
end | ||
|
||
function assemble_matrix(f,a::Assembler,U::FESpace,V::FESpace) | ||
assemble_matrix(a,collect_cell_matrix(U,V,f)) | ||
end | ||
|
||
function assemble_matrix!(A,f,a::Assembler,U::FESpace,V::FESpace) | ||
assemble_matrix!(A,a,collect_cell_matrix(U,V,f)) | ||
end | ||
|
||
function assemble_vector(f,a::Assembler,V::FESpace) | ||
assemble_vector(a,collect_cell_vector(V,f)) | ||
end | ||
|
||
function assemble_vector!(b,f,a::Assembler,V::FESpace) | ||
assemble_vector!(b,a,collect_cell_vector(V,f)) | ||
end | ||
|
||
function assemble_matrix_and_vector(f,b,a::Assembler,U::FESpace,V::FESpace) | ||
assemble_matrix_and_vector(a,collect_cell_matrix_and_vector(U,V,f,b)) | ||
end | ||
|
||
function assemble_matrix_and_vector!(M,r,f,b,a::Assembler,U::FESpace,V::FESpace) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and here (and type-annotate array inputs) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oops ... I forgot this one There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. f is not a function, isnt? |
||
assemble_matrix_and_vector!(M,r,a,collect_cell_matrix_and_vector(U,V,f,b)) | ||
end | ||
|
||
function assemble_matrix(f,U::FESpace,V::FESpace) | ||
a = SparseMatrixAssembler(U,V) | ||
assemble_matrix(f,a,U,V) | ||
end | ||
|
||
function assemble_matrix!(A,f,U::FESpace,V::FESpace) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and here |
||
a = SparseMatrixAssembler(U,V) | ||
assemble_matrix!(A,f,a,U,V) | ||
end | ||
|
||
function assemble_vector(f,V::FESpace) | ||
a = SparseMatrixAssembler(V,V) | ||
assemble_vector(f,a,V) | ||
end | ||
|
||
function assemble_vector!(b,f,V::FESpace) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and here |
||
a = SparseMatrixAssembler(V,V) | ||
assemble_vector!(b,f,a,V) | ||
end | ||
|
||
function assemble_matrix_and_vector(f,b,U::FESpace,V::FESpace) | ||
a = SparseMatrixAssembler(U,V) | ||
assemble_matrix_and_vector(f,b,a,U,V) | ||
end | ||
|
||
function assemble_matrix_and_vector!(M,r,f,b,U::FESpace,V::FESpace) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and here |
||
a = SparseMatrixAssembler(U,V) | ||
assemble_matrix_and_vector!(M,r,f,b,a,U,V) | ||
end | ||
|
||
# Abstract interface for computing the data to be sent to the assembler | ||
|
||
function collect_cell_matrix(trial::FESpace,test::FESpace,mat_contributions) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Start the argument list with ::Function objects so that we can use do-block syntax. Also type-annotate the new array arguments, I.e.
Apply this minor changes to all new introduced assembly functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I though that the parameters that are modified in a
!
-like function should appear first in the list of parameters by convention. From your comment, I guess this is not strictly necessary, right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, see e.g.
broadcast