Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskawczynski committed Jun 23, 2024
1 parent 54cd8dd commit 30df952
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
10 changes: 2 additions & 8 deletions src/Geometry/axistensors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,7 @@ struct AxisTensor{
T,
N,
A <: NTuple{N, AbstractAxis},
S <: Union{
SimpleSymmetric{N, T},
StaticArray{<:Tuple, T, N},
},
S <: Union{SimpleSymmetric{N, T}, StaticArray{<:Tuple, T, N}},
} <: AbstractArray{T, N}
axes::A
components::S
Expand All @@ -150,10 +147,7 @@ AxisTensor(
components::S,
) where {
A <: Tuple{Vararg{AbstractAxis}},
S <: Union{
SimpleSymmetric{N, T},
StaticArray{<:Tuple, T, N},
},
S <: Union{SimpleSymmetric{N, T}, StaticArray{<:Tuple, T, N}},
} where {T, N} = AxisTensor{T, N, A, S}(axes, components)

AxisTensor(axes::Tuple{Vararg{AbstractAxis}}, components) =
Expand Down
11 changes: 10 additions & 1 deletion src/Geometry/localgeometry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,16 @@ struct LocalGeometry{I, C <: AbstractPoint, FT, S, N, L}
gᵢⱼ = SimpleSymmetric(gᵢⱼ₀)
L = triangular_nonzeros(S)
N = size(components(gⁱʲ₀), 1)
return new{I, C, FT, S, N, L}(coordinates, J, WJ, Jinv, ∂x∂ξ, ∂ξ∂x, gⁱʲ, gᵢⱼ)
return new{I, C, FT, S, N, L}(
coordinates,
J,
WJ,
Jinv,
∂x∂ξ,
∂ξ∂x,
gⁱʲ,
gᵢⱼ,
)
end
end

Expand Down
3 changes: 2 additions & 1 deletion src/Geometry/simple_symmetric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ StaticArrays.check_parameters(

triangular_nonzeros(::SMatrix{N}) where {N} = Int(N * (N + 1) / 2)
triangular_nonzeros(::Type{<:SMatrix{N}}) where {N} = Int(N * (N + 1) / 2)
tail_params(::Type{S}) where {N,T, S<:SMatrix{N,N,T}} = (T, S, N, triangular_nonzeros(S))
tail_params(::Type{S}) where {N, T, S <: SMatrix{N, N, T}} =
(T, S, N, triangular_nonzeros(S))

# function SimpleSymmetric(A::SMatrix)
# @assert size(A, 1) == size(A, 2)
Expand Down
9 changes: 5 additions & 4 deletions test/Geometry/unit_simple_symmetric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ simple_symmetric(A::Matrix) = SimpleSymmetric(SMatrix{size(A)..., eltype(A)}(A))
A = @SMatrix [1 2; 2 4]
@test SimpleSymmetric(A) / 2 === SimpleSymmetric(A / 2)
@test_opt SimpleSymmetric(A)
@test Geometry.tail_params(typeof(@SMatrix Float32[1 2; 2 4])) == (Float32, SMatrix{2, 2, Float32, 4}, 2, 3)
@test Geometry.tail_params(typeof(@SMatrix Float32[1 2; 2 4])) ==
(Float32, SMatrix{2, 2, Float32, 4}, 2, 3)
end

@testset "sizs" begin
for N in (1,2,3,5,8,10)
simple_symmetric(rand(N,N)) # pass in non-symmetric matrix
end
for N in (1, 2, 3, 5, 8, 10)
simple_symmetric(rand(N, N)) # pass in non-symmetric matrix
end
end

0 comments on commit 30df952

Please sign in to comment.