Skip to content

Commit

Permalink
Merge pull request #374 from gridap/multifield_refactoring
Browse files Browse the repository at this point in the history
Multifield refactoring
  • Loading branch information
fverdugo authored Aug 21, 2020
2 parents 3e65a2a + ed8d3bf commit ed86dd3
Show file tree
Hide file tree
Showing 144 changed files with 5,554 additions and 5,383 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ language: julia
os:
- linux
julia:
- 1.0
- 1.4
- 1.3
- 1.5
notifications:
email:
on_success: never
Expand Down
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ version = "0.14.0"
[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
BSON = "fbb218c0-5317-5bc6-957e-2ee96dd4b1f0"
BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e"
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
FastGaussQuadrature = "442a2c76-b920-505d-bb47-c5924d526838"
Expand All @@ -26,6 +27,7 @@ WriteVTK = "64499a7a-5c06-52f2-abe2-ccb03c286192"
[compat]
AbstractTrees = "0.3.3"
BSON = "0.2.5"
BlockArrays = "0.12.12"
Combinatorics = "1.0.0"
DocStringExtensions = "0.8.1"
FastGaussQuadrature = "0.4.2"
Expand All @@ -39,7 +41,7 @@ NLsolve = "4.3.0"
QuadGK = "2.3.1"
StaticArrays = "0.12.1"
WriteVTK = "1.7"
julia = "1.0"
julia = "1.3"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
4 changes: 2 additions & 2 deletions bench/FieldsBenchs/FieldApplyBenchs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ function bench1(n)
v = 3.0
d = 2
f = MockField{d}(v)
g = apply_kernel_to_field(bcast(+),f,v)
g = operate_fields(+,f,v)
cg = field_cache(g,x)
@time repeat(n,evaluate!,cg,g,x)
∇g = gradient(g)
∇cg = field_cache(∇g,x)
@time repeat(n,evaluate!,∇cg,∇g,x)
h = apply_kernel_to_field(bcast(+),f,f)
h = operate_fields(+,f,f)
ch = field_cache(h,x)
@time repeat(n,evaluate!,ch,h,x)
end
Expand Down
8 changes: 4 additions & 4 deletions bench/FieldsBenchs/FieldArraysBenchs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function bench1(n)
afx = evaluate(af,ax)
cafx = array_cache(afx)
@time loop(afx,cafx)
ag = apply_to_field_array(bcast(+),af,af)
ag = operate_arrays_of_fields(+,af,af)
cag = array_cache(ag)
@time loop(ag,cag)
agx = evaluate(ag,ax)
Expand All @@ -58,7 +58,7 @@ function bench2(n)
afx = evaluate(af,ax)
cafx = array_cache(afx)
@time loop(afx,cafx)
_ag = apply_to_field_array(bcast(+),af,af)
_ag = operate_arrays_of_fields(+,af,af)
ag = gradient(_ag)
cag = array_cache(ag)
@time loop(ag,cag)
Expand All @@ -85,7 +85,7 @@ function bench2a(n)
afx = evaluate(af,ax)
cafx = array_cache(afx)
@time loop(afx,cafx)
_ag = apply_to_field_array(bcast(+),af,av)
_ag = operate_arrays_of_fields(+,af,av)
ag = gradient(_ag)
cag = array_cache(ag)
@time loop(ag,cag)
Expand Down Expand Up @@ -115,7 +115,7 @@ function bench3(n)
afx = evaluate(af,ax)
cafx = array_cache(afx)
@time loop(afx,cafx)
ag = apply_to_field_array(bcast(+),af,aw)
ag = operate_arrays_of_fields(+,af,aw)
cag = array_cache(ag)
@time loop(ag,cag)
agx = evaluate(ag,ax)
Expand Down
12 changes: 6 additions & 6 deletions bench/FieldsBenchs/FieldOperationsBenchs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@ function bench1(n)
aba = Fill(ba,l)
abb = Fill(bb,l)

ag_ff = field_array_operation(inner,afa,afb)
ag_ff = operate_arrays_of_fields(inner,afa,afb)
agx_ff = evaluate(ag_ff,ax)
cagx_ff = array_cache(agx_ff)
@time loop(agx_ff,cagx_ff)

ag_bf = field_array_operation(inner,aba,afb)
ag_bf = operate_arrays_of_fields(inner,aba,afb)
agx_bf = evaluate(ag_bf,ax)
cagx_bf = array_cache(agx_bf)
@time loop(agx_bf,cagx_bf)

ag_bb = field_array_operation(inner,aba,abb)
agx_bb = evaluate(ag_bb,ax)
cagx_bb = array_cache(agx_bb)
@time loop(agx_bb,cagx_bb)
#ag_bb = operate_arrays_of_fields(inner,aba,abb)
#agx_bb = evaluate(ag_bb,ax)
#cagx_bb = array_cache(agx_bb)
#@time loop(agx_bb,cagx_bb)

end

Expand Down
4 changes: 2 additions & 2 deletions bench/FieldsBenchs/IntegrateBenchs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ function bench3(n)
ar = Fill(r,l)
ab = attachmap(ar,aϕ)

fmass = field_array_operation(inner,ab,ab)
fmass = operate_arrays_of_fields(inner,ab,ab)
mmass = integrate(fmass,ax,aw,aj)

cmmass = array_cache(mmass)
@time loop(mmass,cmmass)

fstif = field_array_operation(inner,(ab),(ab))
fstif = operate_arrays_of_fields(inner,(ab),(ab))
mstif = integrate(fstif,ax,aw,aj)

cmstif = array_cache(mstif)
Expand Down
13 changes: 0 additions & 13 deletions docs/src/Geometry.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,19 +340,6 @@ RestrictedDiscreteModel

## CellFields

### CellFieldLike interface
```@docs
CellFieldLike
get_array(cf::CellFieldLike)
get_cell_map(cf::CellFieldLike)
similar_object(cf::CellFieldLike,array::AbstractArray)
similar_object(cf1::CellFieldLike,cf2::CellFieldLike,array::AbstractArray)
gradient(cf::CellFieldLike)
grad2curl(cf::CellFieldLike)
test_cell_field_like
evaluate(cf::CellFieldLike,x)
length(cf::CellFieldLike)
```
### CellField interface

```@docs
Expand Down
24 changes: 24 additions & 0 deletions src/Arrays/Arrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,28 @@ module Arrays

using Gridap.Helpers
using Gridap.Inference
using Gridap.Algebra

using DocStringExtensions
using Test
using FillArrays
using Base: @propagate_inbounds
using LinearAlgebra
using ForwardDiff
using BlockArrays

export BlockArrayCoo
export BlockVectorCoo
export BlockMatrixCoo
export is_zero_block
export is_nonzero_block
export enumerateblocks
export eachblockindex
export VectorOfBlockArrayCoo
export VectorOfBlockVectorCoo
export VectorOfBlockMatrixCoo
export zeros_like
export TwoLevelBlockedUnitRange

export array_cache
export getindex!
Expand All @@ -37,6 +52,7 @@ export CachedArray
export CachedMatrix
export CachedVector
export setsize!
export setaxes!

export CompressedArray
export LocalToGlobalArray
Expand All @@ -52,6 +68,8 @@ export test_kernel
export bcast
export elem
export contract
export MulKernel
export MulAddKernel
export kernel_return_type
export kernel_return_types
export kernel_testitem
Expand Down Expand Up @@ -103,8 +121,12 @@ import Base: IndexStyle
import Gridap.Io: to_dict
import Gridap.Io: from_dict

import Gridap.Algebra: scale_entries!

include("Interface.jl")

include("BlockArraysCoo.jl")

include("CachedArrays.jl")

include("Kernels.jl")
Expand All @@ -131,6 +153,8 @@ include("ArrayPairs.jl")

include("AppendedArrays.jl")

include("VectorsOfBlockArrayCoo.jl")

include("Autodiff.jl")

end # module
Loading

0 comments on commit ed86dd3

Please sign in to comment.