From 65623623b3f1490949b6a41702b69f3a7ed3799f Mon Sep 17 00:00:00 2001 From: Simon Byrne Date: Mon, 1 Aug 2022 16:53:12 -0700 Subject: [PATCH 1/6] add special cases for projection from Covariant => Contravariant fix tensor conversion fix dispatch --- src/Geometry/axistensors.jl | 13 +++-- src/Geometry/conversions.jl | 108 +++++++++++++++++++++++++++++++++++ test/Geometry/axistensors.jl | 72 +++++++++++++++++++++++ 3 files changed, 188 insertions(+), 5 deletions(-) diff --git a/src/Geometry/axistensors.jl b/src/Geometry/axistensors.jl index b1ac9e8326..691d28cc23 100644 --- a/src/Geometry/axistensors.jl +++ b/src/Geometry/axistensors.jl @@ -286,13 +286,16 @@ const Axis2TensorOrAdj{T, A, S} = # based on 1st dimension const Covariant2Tensor{T, A, S} = - Axis2Tensor{T, A, S} where {A <: Tuple{CovariantAxis, AbstractAxis}} -const Contravariant2Tensor{T, A, S} = - Axis2Tensor{T, A, S} where {A <: Tuple{ContravariantAxis, AbstractAxis}} + Axis2Tensor{T, A, S} where {T, A <: Tuple{CovariantAxis, AbstractAxis}, S} +const Contravariant2Tensor{T, A, S} = Axis2Tensor{ + T, + A, + S, +} where {T, A <: Tuple{ContravariantAxis, AbstractAxis}, S} const Cartesian2Tensor{T, A, S} = - Axis2Tensor{T, A, S} where {A <: Tuple{CartesianAxis, AbstractAxis}} + Axis2Tensor{T, A, S} where {T, A <: Tuple{CartesianAxis, AbstractAxis}, S} const Local2Tensor{T, A, S} = - Axis2Tensor{T, A, S} where {A <: Tuple{LocalAxis, AbstractAxis}} + Axis2Tensor{T, A, S} where {T, A <: Tuple{LocalAxis, AbstractAxis}, S} const CovariantTensor = Union{CovariantVector, Covariant2Tensor} const ContravariantTensor = Union{ContravariantVector, Contravariant2Tensor} diff --git a/src/Geometry/conversions.jl b/src/Geometry/conversions.jl index c184c36c56..d0c5c327c3 100644 --- a/src/Geometry/conversions.jl +++ b/src/Geometry/conversions.jl @@ -333,6 +333,7 @@ for op in (:transform, :project) ) # Covariant <-> Contravariant + #= @inline $op( ax::ContravariantAxis, v::CovariantTensor, @@ -343,6 +344,7 @@ for op in (:transform, :project) local_geometry.∂ξ∂x' * $op(dual(axes(local_geometry.∂ξ∂x, 1)), v), ) + =# @inline $op( ax::CovariantAxis, v::ContravariantTensor, @@ -368,6 +370,112 @@ for op in (:transform, :project) end end +@inline transform( + ax::ContravariantAxis, + v::CovariantTensor, + local_geometry::LocalGeometry, +) = transform( + ax, + local_geometry.∂ξ∂x * + local_geometry.∂ξ∂x' * + transform(dual(axes(local_geometry.∂ξ∂x, 1)), v), +) + +@generated function project( + ax::ContravariantAxis{Ito}, + v::CovariantVector{T, Ifrom}, + local_geometry::LocalGeometry{J}, +) where {T, Ito, Ifrom, J} + Nfrom = length(Ifrom) + Nto = length(Ito) + NJ = length(J) + + vals = [] + for i in Ito + if i ∈ J + # e.g. i = 2, J = (1,2,3) + IJ = intersect(J, Ifrom) + if isempty(IJ) + val = 0 + else + niJ = findfirst(==(i), J) + val = Expr( + :call, + :+, + [ + :( + local_geometry.gⁱʲ[$niJ, $(findfirst(==(j), J))] * v[$(findfirst(==(j), Ifrom))] + ) for j in IJ + ]..., + ) + end + elseif i ∈ Ifrom + # e.g. i = 2, J = (1,3), Ifrom = (2,) + ni = findfirst(==(i), Ifrom) + val = :(v[$ni]) + else + # e.g. i = 2, J = (1,3), Ifrom = (1,) + val = 0 + end + push!(vals, val) + end + quote + Base.@_propagate_inbounds_meta + AxisVector(ContravariantAxis{$Ito}(), SVector{$Nto, $T}($(vals...))) + end +end +@generated function project( + ax::ContravariantAxis{Ito}, + v::Contravariant2Tensor{T, Tuple{CovariantAxis{Ifrom}, A}}, + local_geometry::LocalGeometry{J}, +) where {T, Ito, Ifrom, A, J} + Nfrom = length(Ifrom) + Nto = length(Ito) + NJ = length(J) + NA = length(A.instance) + + vals = [] + for na in 1:NA + for i in Ito + if i ∈ J + # e.g. i = 2, J = (1,2,3) + IJ = intersect(J, Ifrom) + if isempty(IJ) + val = 0 + else + niJ = findfirst(==(i), J) + val = Expr( + :call, + :+, + [ + :( + local_geometry.gⁱʲ[ + $niJ, + $(findfirst(==(j), J)), + ] * v[$(findfirst(==(j), Ifrom)), $na] + ) for j in IJ + ]..., + ) + end + elseif i ∈ Ifrom + # e.g. i = 2, J = (1,3), Ifrom = (2,) + ni = findfirst(==(i), Ifrom) + val = :(v[$ni, $na]) + else + # e.g. i = 2, J = (1,3), Ifrom = (1,) + val = 0 + end + push!(vals, val) + end + end + quote + Base.@_propagate_inbounds_meta + AxisTensor( + (ContravariantAxis{$Ito}(), A.instance), + SMatrix{$Nto, $NA, $T, $(Nto * NA)}($(vals...)), + ) + end +end """ divergence_result_type(V) diff --git a/test/Geometry/axistensors.jl b/test/Geometry/axistensors.jl index 9f93e0d257..839b10bf2d 100644 --- a/test/Geometry/axistensors.jl +++ b/test/Geometry/axistensors.jl @@ -173,3 +173,75 @@ end @test Geometry.UVVector(Geometry._cross(uⁱ, vⁱ, local_geom), local_geom) == Geometry.UVVector(6.0, -3.0) end + + +@testset "project" begin + M = @SMatrix [ + 2.0 0.0 + 0.0 1.0 + ] + J = det(M) + + local_geom = Geometry.LocalGeometry( + Geometry.XYPoint(0.0, 0.0), + J, + J, + Geometry.Axis2Tensor( + (Geometry.UVAxis(), Geometry.Covariant12Axis()), + M, + ), + ) + + @test Geometry.project( + Geometry.Contravariant12Axis(), + Covariant12Vector(1.0, 1.0), + local_geom, + ) == Contravariant12Vector(0.25, 1.0) + @test Geometry.project( + Geometry.Contravariant1Axis(), + Covariant12Vector(1.0, 1.0), + local_geom, + ) == Contravariant1Vector(0.25) + @test Geometry.project( + Geometry.Contravariant2Axis(), + Covariant12Vector(1.0, 1.0), + local_geom, + ) == Contravariant2Vector(1.0) + @test Geometry.project( + Geometry.Contravariant123Axis(), + Covariant12Vector(1.0, 1.0), + local_geom, + ) == Contravariant123Vector(0.25, 1.0, 0.0) + @test Geometry.project( + Geometry.Contravariant123Axis(), + Covariant123Vector(1.0, 1.0, 1.0), + local_geom, + ) == Contravariant123Vector(0.25, 1.0, 1.0) + + + @test Geometry.project( + Geometry.Contravariant12Axis(), + Covariant12Vector(1.0, 1.0) ⊗ Covariant12Vector(2.0, 8.0), + local_geom, + ) == Contravariant12Vector(0.25, 1.0) ⊗ Covariant12Vector(2.0, 8.0) + @test Geometry.project( + Geometry.Contravariant1Axis(), + Covariant12Vector(1.0, 1.0) ⊗ Covariant12Vector(2.0, 8.0), + local_geom, + ) == Contravariant1Vector(0.25) ⊗ Covariant12Vector(2.0, 8.0) + @test Geometry.project( + Geometry.Contravariant2Axis(), + Covariant12Vector(1.0, 1.0) ⊗ Covariant12Vector(2.0, 8.0), + local_geom, + ) == Contravariant2Vector(1.0) ⊗ Covariant12Vector(2.0, 8.0) + @test Geometry.project( + Geometry.Contravariant123Axis(), + Covariant12Vector(1.0, 1.0) ⊗ Covariant12Vector(2.0, 8.0), + local_geom, + ) == Contravariant123Vector(0.25, 1.0, 0.0) ⊗ Covariant12Vector(2.0, 8.0) + @test Geometry.project( + Geometry.Contravariant123Axis(), + Covariant123Vector(1.0, 1.0, 1.0) ⊗ Covariant12Vector(2.0, 8.0), + local_geom, + ) == Contravariant123Vector(0.25, 1.0, 1.0) ⊗ Covariant12Vector(2.0, 8.0) +end From 2b8b947f303d6b92bf5fc77c1fdf22c7451e8241 Mon Sep 17 00:00:00 2001 From: Charles Kawczynski Date: Wed, 3 Aug 2022 16:51:02 -0700 Subject: [PATCH 2/6] Update test flops --- test/Geometry/method_info.jl | 170 +++++++++++++++++------------------ 1 file changed, 85 insertions(+), 85 deletions(-) diff --git a/test/Geometry/method_info.jl b/test/Geometry/method_info.jl index 43a0f16031..42a4d35c1a 100644 --- a/test/Geometry/method_info.jl +++ b/test/Geometry/method_info.jl @@ -2,59 +2,59 @@ function method_info(FT, ::typeof(Geometry.project)) return [ - (ContravariantAxis{(3,)}, Covariant3Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), + (ContravariantAxis{(3,)}, Covariant3Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 1), (ContravariantAxis{(3,)}, Contravariant3Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 0), - (ContravariantAxis{(3,)}, Covariant3Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), + (ContravariantAxis{(3,)}, Covariant3Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 1), (ContravariantAxis{(3,)}, Contravariant3Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 0), (ContravariantAxis{(3,)}, Contravariant123Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 0), - (ContravariantAxis{(1,)}, Covariant123Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), - (ContravariantAxis{(2,)}, Covariant123Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), - (ContravariantAxis{(1,)}, Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), - (ContravariantAxis{(2,)}, Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), - (ContravariantAxis{(3,)}, Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), - (ContravariantAxis{(3,)}, Covariant3Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), + (ContravariantAxis{(1,)}, Covariant123Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 5), + (ContravariantAxis{(2,)}, Covariant123Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 5), + (ContravariantAxis{(1,)}, Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 3), + (ContravariantAxis{(2,)}, Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 3), + (ContravariantAxis{(3,)}, Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 3), + (ContravariantAxis{(3,)}, Covariant3Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 1), (ContravariantAxis{(3,)}, Contravariant3Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 0), - (ContravariantAxis{(1,)}, Covariant123Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), - (ContravariantAxis{(2,)}, Covariant123Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), - (ContravariantAxis{(3,)}, Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), - (ContravariantAxis{(1,)}, Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), - (ContravariantAxis{(2,)}, Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), + (ContravariantAxis{(1,)}, Covariant123Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 5), + (ContravariantAxis{(2,)}, Covariant123Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 5), + (ContravariantAxis{(3,)}, Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 3), + (ContravariantAxis{(1,)}, Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 3), + (ContravariantAxis{(2,)}, Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 3), (ContravariantAxis{(1,)}, UVVector{FT}, LocalGeometry{(1, 2), XYPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 4), (ContravariantAxis{(1,)}, AxisTensor{FT, 2, Tuple{LocalAxis{(1, 2)}, LocalAxis{(1, 2)}}, SMatrix{2, 2, FT, 4}}, LocalGeometry{(1, 2), XYPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), (ContravariantAxis{(2,)}, UVVector{FT}, LocalGeometry{(1, 2), XYPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 4), (ContravariantAxis{(2,)}, AxisTensor{FT, 2, Tuple{LocalAxis{(1, 2)}, LocalAxis{(1, 2)}}, SMatrix{2, 2, FT, 4}}, LocalGeometry{(1, 2), XYPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), - (ContravariantAxis{(1,)}, Covariant12Vector{FT}, LocalGeometry{(1, 2), XYPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), - (ContravariantAxis{(2,)}, Covariant12Vector{FT}, LocalGeometry{(1, 2), XYPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), - (ContravariantAxis{(3,)}, Covariant3Vector{FT}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 2), + (ContravariantAxis{(1,)}, Covariant12Vector{FT}, LocalGeometry{(1, 2), XYPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 3), + (ContravariantAxis{(2,)}, Covariant12Vector{FT}, LocalGeometry{(1, 2), XYPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 3), + (ContravariantAxis{(3,)}, Covariant3Vector{FT}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 1), (ContravariantAxis{(3,)}, WVector{FT}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 1), (ContravariantAxis{(3,)}, Contravariant3Vector{FT}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 0), - (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 3), + (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 2), (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{LocalAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 2), - (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 2), - (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, CovariantAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 3), + (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 1), + (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, CovariantAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 2), (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{ContravariantAxis{(3,)}, CovariantAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 0), (ContravariantAxis{(3,)}, WVector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 9), - (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, CovariantAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 36), + (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, CovariantAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 2), (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{ContravariantAxis{(3,)}, CovariantAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 0), - (ContravariantAxis{(1,)}, Covariant1Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), - (ContravariantAxis{(1,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(1,)}, LocalAxis{(1,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), - (ContravariantAxis{(1,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(1,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), + (ContravariantAxis{(1,)}, Covariant1Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 1), + (ContravariantAxis{(1,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(1,)}, LocalAxis{(1,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 1), + (ContravariantAxis{(1,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(1,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 1), (ContravariantAxis{(3,)}, WVector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 4), (ContravariantAxis{(1,)}, UVector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 4), (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{LocalAxis{(3,)}, LocalAxis{(1,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 4), (ContravariantAxis{(1,)}, AxisTensor{FT, 2, Tuple{LocalAxis{(1,)}, LocalAxis{(1,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 4), (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{LocalAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 4), (ContravariantAxis{(1,)}, AxisTensor{FT, 2, Tuple{LocalAxis{(1,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 4), - (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(1,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), - (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), - (ContravariantAxis{(1,)}, Covariant13Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), - (ContravariantAxis{(3,)}, Covariant1Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), + (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(1,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 1), + (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 1), + (ContravariantAxis{(1,)}, Covariant13Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 3), + (ContravariantAxis{(3,)}, Covariant1Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 1), (ContravariantAxis{(1,)}, Contravariant13Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 0), (ContravariantAxis{(3,)}, Contravariant13Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 0), - (ContravariantAxis{(1,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(1, 2)}, LocalAxis{(1, 2)}}, SMatrix{2, 2, FT, 4}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 36), - (ContravariantAxis{(2,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(1, 2)}, LocalAxis{(1, 2)}}, SMatrix{2, 2, FT, 4}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 36), - (ContravariantAxis{(1,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(1, 2)}, LocalAxis{(3,)}}, SMatrix{2, 1, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), - (ContravariantAxis{(2,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(1, 2)}, LocalAxis{(3,)}}, SMatrix{2, 1, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), + (ContravariantAxis{(1,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(1, 2)}, LocalAxis{(1, 2)}}, SMatrix{2, 2, FT, 4}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 6), + (ContravariantAxis{(2,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(1, 2)}, LocalAxis{(1, 2)}}, SMatrix{2, 2, FT, 4}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 6), + (ContravariantAxis{(1,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(1, 2)}, LocalAxis{(3,)}}, SMatrix{2, 1, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 3), + (ContravariantAxis{(2,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(1, 2)}, LocalAxis{(3,)}}, SMatrix{2, 1, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 3), (ContravariantAxis{(1,)}, UVVector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 9), (ContravariantAxis{(2,)}, UVVector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 9), (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{LocalAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), @@ -63,10 +63,10 @@ function method_info(FT, ::typeof(Geometry.project)) (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{LocalAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 9), (ContravariantAxis{(1,)}, AxisTensor{FT, 2, Tuple{LocalAxis{(1, 2)}, LocalAxis{(3,)}}, SMatrix{2, 1, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 9), (ContravariantAxis{(2,)}, AxisTensor{FT, 2, Tuple{LocalAxis{(1, 2)}, LocalAxis{(3,)}}, SMatrix{2, 1, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 9), - (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 36), - (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), - (ContravariantAxis{(1,)}, Covariant12Vector{FT}, LocalGeometry{(1, 2), LatLongPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), - (ContravariantAxis{(2,)}, Covariant12Vector{FT}, LocalGeometry{(1, 2), LatLongPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), + (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 2), + (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 1), + (ContravariantAxis{(1,)}, Covariant12Vector{FT}, LocalGeometry{(1, 2), LatLongPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 3), + (ContravariantAxis{(2,)}, Covariant12Vector{FT}, LocalGeometry{(1, 2), LatLongPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 3), (ContravariantAxis{(1,)}, UVVector{FT}, LocalGeometry{(1, 2), LatLongPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 4), (ContravariantAxis{(2,)}, UVVector{FT}, LocalGeometry{(1, 2), LatLongPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 4), (ContravariantAxis{(1,)}, Contravariant12Vector{FT}, LocalGeometry{(1, 2), XYPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 0), @@ -236,26 +236,26 @@ end function method_info(FT, ::typeof(Geometry.contravariant1)) return [ (Covariant123Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), - (Covariant123Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), - (Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), - (Covariant123Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), - (Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), + (Covariant123Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 5), + (Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 3), + (Covariant123Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 5), + (Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 3), (UVVector{FT}, LocalGeometry{(1, 2), XYPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 4), (AxisTensor{FT, 2, Tuple{LocalAxis{(1, 2)}, LocalAxis{(1, 2)}}, SMatrix{2, 2, FT, 4}}, LocalGeometry{(1, 2), XYPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), - (Covariant12Vector{FT}, LocalGeometry{(1, 2), XYPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), - (Covariant1Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), - (AxisTensor{FT, 2, Tuple{CovariantAxis{(1,)}, LocalAxis{(1,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), - (AxisTensor{FT, 2, Tuple{CovariantAxis{(1,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), + (Covariant12Vector{FT}, LocalGeometry{(1, 2), XYPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 3), + (Covariant1Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 1), + (AxisTensor{FT, 2, Tuple{CovariantAxis{(1,)}, LocalAxis{(1,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 1), + (AxisTensor{FT, 2, Tuple{CovariantAxis{(1,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 1), (UVector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 4), (AxisTensor{FT, 2, Tuple{LocalAxis{(1,)}, LocalAxis{(1,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 4), (AxisTensor{FT, 2, Tuple{LocalAxis{(1,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 4), - (Covariant13Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), - (AxisTensor{FT, 2, Tuple{CovariantAxis{(1, 2)}, LocalAxis{(1, 2)}}, SMatrix{2, 2, FT, 4}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 36), - (AxisTensor{FT, 2, Tuple{CovariantAxis{(1, 2)}, LocalAxis{(3,)}}, SMatrix{2, 1, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), + (Covariant13Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 3), + (AxisTensor{FT, 2, Tuple{CovariantAxis{(1, 2)}, LocalAxis{(1, 2)}}, SMatrix{2, 2, FT, 4}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 6), + (AxisTensor{FT, 2, Tuple{CovariantAxis{(1, 2)}, LocalAxis{(3,)}}, SMatrix{2, 1, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 3), (UVVector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 9), (AxisTensor{FT, 2, Tuple{LocalAxis{(1, 2)}, LocalAxis{(1, 2)}}, SMatrix{2, 2, FT, 4}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), (AxisTensor{FT, 2, Tuple{LocalAxis{(1, 2)}, LocalAxis{(3,)}}, SMatrix{2, 1, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 9), - (Covariant12Vector{FT}, LocalGeometry{(1, 2), LatLongPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), + (Covariant12Vector{FT}, LocalGeometry{(1, 2), LatLongPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 3), (UVVector{FT}, LocalGeometry{(1, 2), LatLongPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 4), (Contravariant12Vector{FT}, LocalGeometry{(1, 2), XYPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 0), ] @@ -263,19 +263,19 @@ end function method_info(FT, ::typeof(Geometry.contravariant2)) return [ - (Covariant123Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), - (Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), - (Covariant123Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), - (Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), + (Covariant123Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 5), + (Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 3), + (Covariant123Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 5), + (Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 3), (UVVector{FT}, LocalGeometry{(1, 2), XYPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 4), (AxisTensor{FT, 2, Tuple{LocalAxis{(1, 2)}, LocalAxis{(1, 2)}}, SMatrix{2, 2, FT, 4}}, LocalGeometry{(1, 2), XYPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), - (Covariant12Vector{FT}, LocalGeometry{(1, 2), XYPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), - (AxisTensor{FT, 2, Tuple{CovariantAxis{(1, 2)}, LocalAxis{(1, 2)}}, SMatrix{2, 2, FT, 4}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 36), - (AxisTensor{FT, 2, Tuple{CovariantAxis{(1, 2)}, LocalAxis{(3,)}}, SMatrix{2, 1, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), + (Covariant12Vector{FT}, LocalGeometry{(1, 2), XYPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 3), + (AxisTensor{FT, 2, Tuple{CovariantAxis{(1, 2)}, LocalAxis{(1, 2)}}, SMatrix{2, 2, FT, 4}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 6), + (AxisTensor{FT, 2, Tuple{CovariantAxis{(1, 2)}, LocalAxis{(3,)}}, SMatrix{2, 1, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 3), (UVVector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 9), (AxisTensor{FT, 2, Tuple{LocalAxis{(1, 2)}, LocalAxis{(1, 2)}}, SMatrix{2, 2, FT, 4}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), (AxisTensor{FT, 2, Tuple{LocalAxis{(1, 2)}, LocalAxis{(3,)}}, SMatrix{2, 1, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 9), - (Covariant12Vector{FT}, LocalGeometry{(1, 2), LatLongPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), + (Covariant12Vector{FT}, LocalGeometry{(1, 2), LatLongPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 3), (UVVector{FT}, LocalGeometry{(1, 2), LatLongPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 4), (Contravariant12Vector{FT}, LocalGeometry{(1, 2), XYPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 0), ] @@ -283,72 +283,72 @@ end function method_info(FT, ::typeof(Geometry.contravariant3)) return [ - (Covariant3Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), + (Covariant3Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 1), (Contravariant3Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 0), (Covariant12Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), - (Covariant3Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), + (Covariant3Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 1), (Contravariant3Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 0), (Contravariant123Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 0), - (Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), - (Covariant3Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), + (Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 3), + (Covariant3Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 1), (Contravariant3Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 0), - (Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), - (Covariant3Vector{FT}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 2), + (Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 3), + (Covariant3Vector{FT}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 1), (WVector{FT}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 1), (Contravariant3Vector{FT}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 0), - (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 3), + (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 2), (AxisTensor{FT, 2, Tuple{LocalAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 2), - (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 2), - (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, CovariantAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 3), + (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 1), + (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, CovariantAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 2), (AxisTensor{FT, 2, Tuple{ContravariantAxis{(3,)}, CovariantAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 0), (WVector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 9), - (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, CovariantAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 36), + (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, CovariantAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 2), (AxisTensor{FT, 2, Tuple{ContravariantAxis{(3,)}, CovariantAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 0), (WVector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 4), (AxisTensor{FT, 2, Tuple{LocalAxis{(3,)}, LocalAxis{(1,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 4), (AxisTensor{FT, 2, Tuple{LocalAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 4), - (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(1,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), - (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), - (Covariant1Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 8), + (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(1,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 1), + (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 1), + (Covariant1Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 1), (AxisTensor{FT, 2, Tuple{LocalAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), (AxisTensor{FT, 2, Tuple{LocalAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 9), - (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 36), - (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), + (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 2), + (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 1), ] end function method_info(FT, ::typeof(Geometry.Jcontravariant3)) return [ - (Covariant3Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 9), + (Covariant3Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 2), (Contravariant3Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 1), (Covariant12Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 9), - (Covariant3Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 19), + (Covariant3Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 2), (Contravariant3Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 1), - (Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 19), - (Covariant3Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 19), + (Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 4), + (Covariant3Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 2), (Contravariant3Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 1), - (Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 19), - (Covariant3Vector{FT}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 3), + (Covariant12Vector{FT}, LocalGeometry{(1, 2, 3), LatLongZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 4), + (Covariant3Vector{FT}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 2), (Contravariant3Vector{FT}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 1), (WVector{FT}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 2), - (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 5), + (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 4), (AxisTensor{FT, 2, Tuple{LocalAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 4), - (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 3), - (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, CovariantAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 5), + (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 2), + (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, CovariantAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 4), (AxisTensor{FT, 2, Tuple{ContravariantAxis{(3,)}, CovariantAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(3,), ZPoint{FT}, FT, SMatrix{1, 1, FT, 1}}, 2), (WVector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 10), - (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, CovariantAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 38), + (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, CovariantAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 4), (AxisTensor{FT, 2, Tuple{ContravariantAxis{(3,)}, CovariantAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 2), (WVector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 5), (AxisTensor{FT, 2, Tuple{LocalAxis{(3,)}, LocalAxis{(1,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 5), (AxisTensor{FT, 2, Tuple{LocalAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 5), - (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(1,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 9), - (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 9), - (Covariant1Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 9), + (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(1,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 2), + (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 2), + (Covariant1Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 2), (AxisTensor{FT, 2, Tuple{LocalAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 20), (AxisTensor{FT, 2, Tuple{LocalAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 10), - (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 38), - (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 19), + (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 4), + (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 2), ] end From b2f90af729b52bbc3bbd6d3196c7e6f685bb98f6 Mon Sep 17 00:00:00 2001 From: Charles Kawczynski Date: Wed, 3 Aug 2022 20:13:03 -0700 Subject: [PATCH 3/6] Add more specialized project methods --- src/Geometry/conversions.jl | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/Geometry/conversions.jl b/src/Geometry/conversions.jl index d0c5c327c3..2848fb75e5 100644 --- a/src/Geometry/conversions.jl +++ b/src/Geometry/conversions.jl @@ -477,6 +477,44 @@ end end end +# A few other expensive ones: +#! format: off +@inline function project( + ax::ContravariantAxis{(1,)}, + v::AxisTensor{FT,2,Tuple{LocalAxis{(1, 2)},LocalAxis{(1, 2)}},SMatrix{2,2,FT,4}}, + lg::LocalGeometry{(1, 2, 3),XYZPoint{FT},FT,SMatrix{3,3,FT,9}} +) where {FT} + AxisTensor( + (ContravariantAxis{(1,)}(), LocalAxis{(1, 2)}()), + @inbounds @SMatrix [ + lg.∂ξ∂x[1, 1]*v[1, 1]+lg.∂ξ∂x[1, 2]*v[2, 1] lg.∂ξ∂x[1, 1]*v[1, 2]+lg.∂ξ∂x[1, 2]*v[2, 2] + ]) +end +@inline function project( + ax::ContravariantAxis{(2,)}, + v::AxisTensor{FT,2,Tuple{LocalAxis{(1,2)},LocalAxis{(1,2)}},SMatrix{2,2,FT,4}}, + lg::LocalGeometry{(1,2,3),XYZPoint{FT},FT,SMatrix{3,3,FT,9}} +) where {FT} + AxisTensor( + (ContravariantAxis{(2,)}(), LocalAxis{(1, 2)}()), + @inbounds @SMatrix [ + lg.∂ξ∂x[2, 1]*v[1, 1]+lg.∂ξ∂x[2, 2]*v[2, 1] lg.∂ξ∂x[2, 1]*v[1, 2]+lg.∂ξ∂x[2, 2]*v[2, 2] + ] + ) +end +@inline function project( + ax::ContravariantAxis{(3,)}, + v::AxisTensor{FT,2,Tuple{LocalAxis{(3,)},LocalAxis{(1,2)}},SMatrix{1,2,FT,2}}, + lg::LocalGeometry{(1,2,3),XYZPoint{FT},FT,SMatrix{3,3,FT,9}} +) where {FT} + AxisTensor( + (ContravariantAxis{(3,)}(), LocalAxis{(1, 2)}()), + @inbounds @SMatrix [lg.∂ξ∂x[3, 3]*v[1, 1] lg.∂ξ∂x[3, 3]*v[1, 2]] + ) +end +#! format: on + + """ divergence_result_type(V) From 0d709c0141360c96fd97e6ef802302f92fa152cf Mon Sep 17 00:00:00 2001 From: Charles Kawczynski Date: Wed, 3 Aug 2022 20:20:34 -0700 Subject: [PATCH 4/6] Update more test flops --- test/Geometry/method_info.jl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/Geometry/method_info.jl b/test/Geometry/method_info.jl index 42a4d35c1a..0dcd4adf6d 100644 --- a/test/Geometry/method_info.jl +++ b/test/Geometry/method_info.jl @@ -57,9 +57,9 @@ function method_info(FT, ::typeof(Geometry.project)) (ContravariantAxis{(2,)}, AxisTensor{FT, 2, Tuple{CovariantAxis{(1, 2)}, LocalAxis{(3,)}}, SMatrix{2, 1, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 3), (ContravariantAxis{(1,)}, UVVector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 9), (ContravariantAxis{(2,)}, UVVector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 9), - (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{LocalAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), - (ContravariantAxis{(1,)}, AxisTensor{FT, 2, Tuple{LocalAxis{(1, 2)}, LocalAxis{(1, 2)}}, SMatrix{2, 2, FT, 4}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), - (ContravariantAxis{(2,)}, AxisTensor{FT, 2, Tuple{LocalAxis{(1, 2)}, LocalAxis{(1, 2)}}, SMatrix{2, 2, FT, 4}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), + (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{LocalAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 2), + (ContravariantAxis{(1,)}, AxisTensor{FT, 2, Tuple{LocalAxis{(1, 2)}, LocalAxis{(1, 2)}}, SMatrix{2, 2, FT, 4}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 6), + (ContravariantAxis{(2,)}, AxisTensor{FT, 2, Tuple{LocalAxis{(1, 2)}, LocalAxis{(1, 2)}}, SMatrix{2, 2, FT, 4}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 6), (ContravariantAxis{(3,)}, AxisTensor{FT, 2, Tuple{LocalAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 9), (ContravariantAxis{(1,)}, AxisTensor{FT, 2, Tuple{LocalAxis{(1, 2)}, LocalAxis{(3,)}}, SMatrix{2, 1, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 9), (ContravariantAxis{(2,)}, AxisTensor{FT, 2, Tuple{LocalAxis{(1, 2)}, LocalAxis{(3,)}}, SMatrix{2, 1, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 9), @@ -253,7 +253,7 @@ function method_info(FT, ::typeof(Geometry.contravariant1)) (AxisTensor{FT, 2, Tuple{CovariantAxis{(1, 2)}, LocalAxis{(1, 2)}}, SMatrix{2, 2, FT, 4}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 6), (AxisTensor{FT, 2, Tuple{CovariantAxis{(1, 2)}, LocalAxis{(3,)}}, SMatrix{2, 1, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 3), (UVVector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 9), - (AxisTensor{FT, 2, Tuple{LocalAxis{(1, 2)}, LocalAxis{(1, 2)}}, SMatrix{2, 2, FT, 4}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), + (AxisTensor{FT, 2, Tuple{LocalAxis{(1, 2)}, LocalAxis{(1, 2)}}, SMatrix{2, 2, FT, 4}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 6), (AxisTensor{FT, 2, Tuple{LocalAxis{(1, 2)}, LocalAxis{(3,)}}, SMatrix{2, 1, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 9), (Covariant12Vector{FT}, LocalGeometry{(1, 2), LatLongPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 3), (UVVector{FT}, LocalGeometry{(1, 2), LatLongPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 4), @@ -273,7 +273,7 @@ function method_info(FT, ::typeof(Geometry.contravariant2)) (AxisTensor{FT, 2, Tuple{CovariantAxis{(1, 2)}, LocalAxis{(1, 2)}}, SMatrix{2, 2, FT, 4}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 6), (AxisTensor{FT, 2, Tuple{CovariantAxis{(1, 2)}, LocalAxis{(3,)}}, SMatrix{2, 1, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 3), (UVVector{FT}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 9), - (AxisTensor{FT, 2, Tuple{LocalAxis{(1, 2)}, LocalAxis{(1, 2)}}, SMatrix{2, 2, FT, 4}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), + (AxisTensor{FT, 2, Tuple{LocalAxis{(1, 2)}, LocalAxis{(1, 2)}}, SMatrix{2, 2, FT, 4}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 6), (AxisTensor{FT, 2, Tuple{LocalAxis{(1, 2)}, LocalAxis{(3,)}}, SMatrix{2, 1, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 9), (Covariant12Vector{FT}, LocalGeometry{(1, 2), LatLongPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 3), (UVVector{FT}, LocalGeometry{(1, 2), LatLongPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 4), @@ -310,7 +310,7 @@ function method_info(FT, ::typeof(Geometry.contravariant3)) (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(1,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 1), (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 1), (Covariant1Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 1), - (AxisTensor{FT, 2, Tuple{LocalAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 18), + (AxisTensor{FT, 2, Tuple{LocalAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 2), (AxisTensor{FT, 2, Tuple{LocalAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 9), (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 2), (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 1), @@ -345,7 +345,7 @@ function method_info(FT, ::typeof(Geometry.Jcontravariant3)) (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(1,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 2), (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 2), (Covariant1Vector{FT}, LocalGeometry{(1, 3), XZPoint{FT}, FT, SMatrix{2, 2, FT, 4}}, 2), - (AxisTensor{FT, 2, Tuple{LocalAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 20), + (AxisTensor{FT, 2, Tuple{LocalAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 4), (AxisTensor{FT, 2, Tuple{LocalAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 10), (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(1, 2)}}, SMatrix{1, 2, FT, 2}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 4), (AxisTensor{FT, 2, Tuple{CovariantAxis{(3,)}, LocalAxis{(3,)}}, SMatrix{1, 1, FT, 1}}, LocalGeometry{(1, 2, 3), XYZPoint{FT}, FT, SMatrix{3, 3, FT, 9}}, 2), From 5e4a6b76a9fd4030c24651b64ceec540ce6c8502 Mon Sep 17 00:00:00 2001 From: Charles Kawczynski Date: Fri, 5 Aug 2022 15:46:00 -0700 Subject: [PATCH 5/6] Try without bumpers (convert transform to project) Apply formatter Fix inexact tests --- src/Geometry/axistensors.jl | 31 +++++++++++------- src/Geometry/conversions.jl | 52 ++++++++++++++----------------- src/Geometry/globalgeometry.jl | 2 +- src/Operators/finitedifference.jl | 8 ++--- src/Spaces/dss.jl | 4 +-- test/Geometry/axistensors.jl | 2 ++ 6 files changed, 51 insertions(+), 48 deletions(-) diff --git a/src/Geometry/axistensors.jl b/src/Geometry/axistensors.jl index 691d28cc23..127814eed1 100644 --- a/src/Geometry/axistensors.jl +++ b/src/Geometry/axistensors.jl @@ -480,6 +480,9 @@ end x end +#= Set `assert_exact_transform() = true` for debugging=# +assert_exact_transform() = false + @generated function _transform( ato::Ato, x::Axis2Tensor{T, Tuple{Afrom, A2}}, @@ -490,12 +493,14 @@ end } where {Ito, Ifrom, J, T} N = length(Ifrom) M = length(J) - errcond = false - for n in 1:N - i = Ifrom[n] - if i ∉ Ito - for m in 1:M - errcond = :($errcond || x[$n, $m] != zero(T)) + if assert_exact_transform() + errcond = false + for n in 1:N + i = Ifrom[n] + if i ∉ Ito + for m in 1:M + errcond = :($errcond || x[$n, $m] != zero(T)) + end end end end @@ -514,8 +519,10 @@ end end quote Base.@_propagate_inbounds_meta - if $errcond - throw(InexactError(:transform, Ato, x)) + if assert_exact_transform() + if $errcond + throw(InexactError(:transform, Ato, x)) + end end @inbounds Axis2Tensor( (ato, axes(x, 2)), @@ -553,11 +560,11 @@ end )) end -@inline transform(ato::CovariantAxis, v::CovariantTensor) = _transform(ato, v) +@inline transform(ato::CovariantAxis, v::CovariantTensor) = _project(ato, v) @inline transform(ato::ContravariantAxis, v::ContravariantTensor) = - _transform(ato, v) -@inline transform(ato::CartesianAxis, v::CartesianTensor) = _transform(ato, v) -@inline transform(ato::LocalAxis, v::LocalTensor) = _transform(ato, v) + _project(ato, v) +@inline transform(ato::CartesianAxis, v::CartesianTensor) = _project(ato, v) +@inline transform(ato::LocalAxis, v::LocalTensor) = _project(ato, v) @inline project(ato::CovariantAxis, v::CovariantTensor) = _project(ato, v) @inline project(ato::ContravariantAxis, v::ContravariantTensor) = diff --git a/src/Geometry/conversions.jl b/src/Geometry/conversions.jl index 2848fb75e5..db1fc6e5ca 100644 --- a/src/Geometry/conversions.jl +++ b/src/Geometry/conversions.jl @@ -34,13 +34,13 @@ LocalVector( (::Type{<:ContravariantVector{<:Any, I}})( u::ContravariantVector, ::LocalGeometry, -) where {I} = transform(ContravariantAxis{I}(), u) +) where {I} = project(ContravariantAxis{I}(), u) (::Type{<:ContravariantVector{<:Any, I}})( u::AxisVector, local_geometry::LocalGeometry, ) where {I} = - transform(ContravariantAxis{I}(), ContravariantVector(u, local_geometry)) + project(ContravariantAxis{I}(), ContravariantVector(u, local_geometry)) (::Type{<:CovariantVector{<:Any, I}})( u::CovariantVector{<:Any, I}, @@ -50,12 +50,12 @@ LocalVector( (::Type{<:CovariantVector{<:Any, I}})( u::CovariantVector, ::LocalGeometry, -) where {I} = transform(CovariantAxis{I}(), u) +) where {I} = project(CovariantAxis{I}(), u) (::Type{<:CovariantVector{<:Any, I}})( u::AxisVector, local_geometry::LocalGeometry, -) where {I} = transform(CovariantAxis{I}(), CovariantVector(u, local_geometry)) +) where {I} = project(CovariantAxis{I}(), CovariantVector(u, local_geometry)) (::Type{<:LocalVector{<:Any, I}})( u::LocalVector{<:Any, I}, @@ -63,54 +63,48 @@ LocalVector( ) where {I} = u (::Type{<:LocalVector{<:Any, I}})(u::LocalVector, ::LocalGeometry) where {I} = - transform(LocalAxis{I}(), u) + project(LocalAxis{I}(), u) (::Type{<:LocalVector{<:Any, I}})( u::AxisVector, local_geometry::LocalGeometry, -) where {I} = transform(LocalAxis{I}(), LocalVector(u, local_geometry)) +) where {I} = project(LocalAxis{I}(), LocalVector(u, local_geometry)) # Generic N-axis conversion functions, # Convert to specific local geometry dimension then convert vector type LocalVector(u::CovariantVector, local_geometry::LocalGeometry{I}) where {I} = - transform(LocalAxis{I}(), transform(CovariantAxis{I}(), u), local_geometry) + project(LocalAxis{I}(), project(CovariantAxis{I}(), u), local_geometry) LocalVector( u::ContravariantVector, local_geometry::LocalGeometry{I}, -) where {I} = transform( - LocalAxis{I}(), - transform(ContravariantAxis{I}(), u), - local_geometry, -) +) where {I} = + project(LocalAxis{I}(), project(ContravariantAxis{I}(), u), local_geometry) CovariantVector(u::LocalVector, local_geometry::LocalGeometry{I}) where {I} = - transform(CovariantAxis{I}(), transform(LocalAxis{I}(), u), local_geometry) + project(CovariantAxis{I}(), project(LocalAxis{I}(), u), local_geometry) CovariantVector( u::ContravariantVector, local_geometry::LocalGeometry{I}, -) where {I} = transform( +) where {I} = project( CovariantAxis{I}(), - transform(ContravariantAxis{I}(), u), + project(ContravariantAxis{I}(), u), local_geometry, ) ContravariantVector( u::LocalVector, local_geometry::LocalGeometry{I}, -) where {I} = transform( - ContravariantAxis{I}(), - transform(LocalAxis{I}(), u), - local_geometry, -) +) where {I} = + project(ContravariantAxis{I}(), project(LocalAxis{I}(), u), local_geometry) ContravariantVector( u::CovariantVector, local_geometry::LocalGeometry{I}, -) where {I} = transform( +) where {I} = project( ContravariantAxis{I}(), - transform(CovariantAxis{I}(), u), + project(CovariantAxis{I}(), u), local_geometry, ) @@ -172,7 +166,7 @@ Base.@propagate_inbounds Jcontravariant3( ) u₁, v, u₃ = components(vector) vector2 = Covariant13Vector(u₁, u₃) - u, w = components(transform(LocalAxis{(1, 3)}(), vector2, local_geometry)) + u, w = components(project(LocalAxis{(1, 3)}(), vector2, local_geometry)) return UVWVector(u, v, w) end @inline function contravariant1( @@ -181,7 +175,7 @@ end ) u₁, _, u₃ = components(vector) vector2 = Covariant13Vector(u₁, u₃) - return transform(Contravariant13Axis(), vector2, local_geometry).u¹ + return project(Contravariant13Axis(), vector2, local_geometry).u¹ end @inline function contravariant3( vector::CovariantVector{<:Any, (1, 2)}, @@ -189,7 +183,7 @@ end ) u₁, _ = components(vector) vector2 = Covariant13Vector(u₁, zero(u₁)) - return transform(Contravariant13Axis(), vector2, local_geometry).u³ + return project(Contravariant13Axis(), vector2, local_geometry).u³ end @inline function ContravariantVector( vector::CovariantVector{<:Any, (1, 2)}, @@ -197,9 +191,9 @@ end ) u₁, v = components(vector) vector2 = Covariant1Vector(u₁) - vector3 = transform( + vector3 = project( ContravariantAxis{(1, 3)}(), - transform(CovariantAxis{(1, 3)}(), vector2), + project(CovariantAxis{(1, 3)}(), vector2), local_geometry, ) u¹, u³ = components(vector3) @@ -374,11 +368,11 @@ end ax::ContravariantAxis, v::CovariantTensor, local_geometry::LocalGeometry, -) = transform( +) = project( ax, local_geometry.∂ξ∂x * local_geometry.∂ξ∂x' * - transform(dual(axes(local_geometry.∂ξ∂x, 1)), v), + project(dual(axes(local_geometry.∂ξ∂x, 1)), v), ) @generated function project( diff --git a/src/Geometry/globalgeometry.jl b/src/Geometry/globalgeometry.jl index 08c49c69b1..0c5875fb33 100644 --- a/src/Geometry/globalgeometry.jl +++ b/src/Geometry/globalgeometry.jl @@ -13,7 +13,7 @@ Cartesian123Point(pt::AbstractPoint, global_geometry::AbstractGlobalGeometry) = u::AxisVector, global_geometry::AbstractGlobalGeometry, local_geometry::LocalGeometry, -) where {I} = transform( +) where {I} = project( CartesianAxis{I}(), CartesianVector(u, global_geometry, local_geometry), ) diff --git a/src/Operators/finitedifference.jl b/src/Operators/finitedifference.jl index 44f56a757c..881a6e27ca 100644 --- a/src/Operators/finitedifference.jl +++ b/src/Operators/finitedifference.jl @@ -2289,7 +2289,7 @@ boundary_width(::GradientF2C, ::Extrapolate, arg) = 1 ) space = axes(arg) @assert idx == left_center_boundary_idx(arg) - Geometry.transform( + Geometry.project( Geometery.Covariant3Axis(), stencil_interior(op, loc, idx + 1, hidx, arg), Geometry.LocalGeometry(space, idx, hidx), @@ -2305,7 +2305,7 @@ end ) space = axes(arg) @assert idx == right_center_boundary_idx(arg) - Geometry.transform( + Geometry.project( Geometry.Covariant3Axis(), stencil_interior(op, loc, idx - 1, hidx, arg), Geometry.LocalGeometry(space, idx, hidx), @@ -2390,7 +2390,7 @@ boundary_width(::GradientC2F, ::SetGradient, arg) = 1 @assert idx == left_face_boundary_idx(arg) space = axes(arg) # imposed flux boundary condition at left most face - Geometry.transform( + Geometry.project( Geometry.Covariant3Axis(), getidx(bc.val, loc, nothing, hidx), Geometry.LocalGeometry(space, idx, hidx), @@ -2407,7 +2407,7 @@ end @assert idx == right_face_boundary_idx(arg) space = axes(arg) # imposed flux boundary condition at right most face - Geometry.transform( + Geometry.project( Geometry.Covariant3Axis(), getidx(bc.val, loc, nothing, hidx), Geometry.LocalGeometry(space, idx, hidx), diff --git a/src/Spaces/dss.jl b/src/Spaces/dss.jl index 19bf1871a0..7d1e727b61 100644 --- a/src/Spaces/dss.jl +++ b/src/Spaces/dss.jl @@ -105,7 +105,7 @@ end if ax isa Geometry.UWAxis && axfrom isa Geometry.Covariant12Axis # return Geometry.transform(Geometry.UVWAxis(), arg, local_geometry) u₁, v = Geometry.components(arg) - uw_vector = Geometry.transform( + uw_vector = Geometry.project( Geometry.UWAxis(), Geometry.Covariant13Vector(u₁, zero(u₁)), local_geometry, @@ -113,7 +113,7 @@ end u, w = Geometry.components(uw_vector) return Geometry.UVWVector(u, v, w) * weight end - Geometry.transform(ax, arg, local_geometry) * weight + Geometry.project(ax, arg, local_geometry) * weight end """ diff --git a/test/Geometry/axistensors.jl b/test/Geometry/axistensors.jl index 839b10bf2d..e34ac5659a 100644 --- a/test/Geometry/axistensors.jl +++ b/test/Geometry/axistensors.jl @@ -1,6 +1,8 @@ using Test using ClimaCore.Geometry, ClimaCore.DataLayouts using LinearAlgebra, StaticArrays +import ClimaCore +ClimaCore.Geometry.assert_exact_transform() = true @testset "AxisTensors" begin x = Geometry.Covariant12Vector(1.0, 2.0) From 23f494e99bc1dcfeceb80ba1f1e68673faf017f6 Mon Sep 17 00:00:00 2001 From: Charles Kawczynski Date: Thu, 25 Aug 2022 09:36:34 -0700 Subject: [PATCH 6/6] Comment out Inexact error checks, since no longer used --- test/Geometry/axistensors.jl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/Geometry/axistensors.jl b/test/Geometry/axistensors.jl index e34ac5659a..a1c5ac9a79 100644 --- a/test/Geometry/axistensors.jl +++ b/test/Geometry/axistensors.jl @@ -85,10 +85,10 @@ end Geometry.Covariant12Axis(), Geometry.Covariant13Vector(2.0, 0.0), ) == Geometry.Covariant12Vector(2.0, 0.0) - @test_throws InexactError Geometry.transform( - Geometry.Covariant12Axis(), - Geometry.Covariant13Vector(2.0, 2.0), - ) + # @test_throws InexactError Geometry.transform( + # Geometry.Covariant12Axis(), + # Geometry.Covariant13Vector(2.0, 2.0), + # ) @test Geometry.transform( @@ -99,10 +99,10 @@ end Geometry.Covariant12Axis(), Geometry.Covariant13Vector(2.0, 0.0) * Geometry.Cartesian1Vector(1.0)', ) == Geometry.Covariant12Vector(2.0, 0.0) * Geometry.Cartesian1Vector(1.0)' - @test_throws InexactError Geometry.transform( - Geometry.Covariant12Axis(), - Geometry.Covariant13Vector(2.0, 2.0) * Geometry.Cartesian1Vector(1.0)', - ) + # @test_throws InexactError Geometry.transform( + # Geometry.Covariant12Axis(), + # Geometry.Covariant13Vector(2.0, 2.0) * Geometry.Cartesian1Vector(1.0)', + # ) end @testset "project" begin