Skip to content

Commit

Permalink
Merge pull request #104 from gridap/fixing_misc_issues
Browse files Browse the repository at this point in the history
Fixing misc issues
  • Loading branch information
fverdugo authored Sep 19, 2019
2 parents a90fb1e + 64681cf commit 98e33b0
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/FESpaces/FEBases.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,15 @@ function CellBasis(
fun::Function,
b::FEBasis,
u...) where {D,Z}
basis = CellBasis(trian,fun,b.cellbasis,u...)
_u = [_prepare_cellbasis(ui) for ui in u]
basis = CellBasis(trian,fun,b.cellbasis,_u...)
FEBasis(basis,trian)
end

_prepare_cellbasis(ui) = ui

_prepare_cellbasis(ui::FEBasis) = ui.cellbasis

function restrict(feb::FEBasis,trian::BoundaryTriangulation)
cb = restrict(feb.cellbasis,trian)
FEBasis(cb,trian)
Expand Down
8 changes: 7 additions & 1 deletion src/MultiField/MultiFEBases.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,16 @@ function CellBasis(
b::FEBasisWithFieldId,
u...) where {D,Z}

febasis = CellBasis(trian,fun,b.febasis,u...)
_u = [_prepare_febasis(ui) for ui in u]

febasis = CellBasis(trian,fun,b.febasis,_u...)
FEBasisWithFieldId(febasis,b.fieldid)
end

_prepare_febasis(ui) = ui

_prepare_febasis(ui::FEBasisWithFieldId) = ui.febasis

for op in (:+,:-,:(gradient),:(symmetric_gradient),:(div),:(trace),:(curl))
@eval begin
function ($op)(a::FEBasisWithFieldId)
Expand Down
12 changes: 12 additions & 0 deletions src/MultiField/MultiFEOperators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,16 @@ function NonLinearFEOperator(
NonLinearFEOperator(V,U,assem,terms...)
end

function NonLinearFEOperator(
testfesp::Vector{<:FESpaceWithDirichletData},
trialfesp::Vector{<:FESpaceWithDirichletData},
terms::Vararg{<:FETerm})

assem = SparseMatrixAssembler(testfesp,trialfesp)

V = MultiFESpace(testfesp)
U = MultiFESpace(trialfesp)
NonLinearFEOperator(V,U,assem,terms...)
end

end # module MultiFEOperators
8 changes: 8 additions & 0 deletions test/MultiFieldTests/MultiNonLinearFEOperatorsTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,12 @@ e2h1 = sqrt(sum( integrate(h1(e2),trian,quad) ))
@test e2l2 < 1.e-8
@test e2h1 < 1.e-8

# Further tests

t_Ω = NonLinearFETerm(res,jac,trian,quad)
op = NonLinearFEOperator(V,U,t_Ω)

uh = solve(solver,op)


end

0 comments on commit 98e33b0

Please sign in to comment.