Skip to content

Commit

Permalink
Specific implementation of pair_arrays for CompressedArray
Browse files Browse the repository at this point in the history
  • Loading branch information
fverdugo committed Feb 21, 2020
1 parent 4c0c9cb commit 9bf4f04
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
10 changes: 10 additions & 0 deletions src/Arrays/ArrayPairs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ function pair_arrays(a::AbstractArray,b::AbstractArray)
ArrayPair(a,b)
end

function pair_arrays(a::CompressedArray,b::CompressedArray)
if (a.ptrs === b.ptrs) || (a.ptrs == b.ptrs)
values = [ (ai,bi) for (ai,bi) in zip(a.values,b.values) ]
ptrs = a.ptrs
return CompressedArray(values,ptrs)
else
return ArrayPair(a,b)
end
end

struct ArrayPair{T,N,A,B} <:AbstractArray{T,N}
a::A
b::B
Expand Down
8 changes: 0 additions & 8 deletions src/Geometry/CellQuadratures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@ function CellQuadrature(degree,polytopes::Vector{<:Polytope}, cell_types::Abstra
CellQuadrature(array)
end

function CellQuadrature(degree,polytopes::Vector{<:Polytope}, cell_types::Fill)
ctype = cell_types.value
p = polytopes[ctype]
quad = Quadrature(p,degree)
array = Fill(quad,length(cell_types))
CellQuadrature(array)
end

"""
get_array(quad::CellQuadrature)
"""
Expand Down

0 comments on commit 9bf4f04

Please sign in to comment.