157
157
# Base.size(m::Global) = m.n
158
158
Base. getindex (m:: Global ,i:: Vararg{Int} ) = m. v
159
159
Base. getindex (t:: Global ,i:: CartesianIndex ) = m. v
160
+ Base. resize! (t:: Global ,i) = t
160
161
@pure Base. eltype (:: Type{<:Global{T}} ) where T = T
161
162
162
163
Base. IndexStyle (:: Global ) = IndexCartesian ()
@@ -630,6 +631,7 @@ for bundle ∈ (:TensorField,:GlobalSection)
630
631
$ bundle (dom:: AbstractArray ,fun:: AbstractRange ) = $ bundle (dom, collect (fun))
631
632
$ bundle (dom:: AbstractArray ,fun:: RealRegion ) = $ bundle (dom, collect (fun))
632
633
$ bundle (dom:: AbstractArray ,fun:: Function ) = $ bundle (dom, fun .(dom))
634
+ $ bundle (dom:: AbstractArray ) = $ bundle (dom, dom)
633
635
$ bundle (dom:: ChainBundle ,fun:: Function ) = $ bundle (dom, fun .(value (points (dom))))
634
636
basetype (:: $bundle{B} ) where B = B
635
637
basetype (:: Type{<:$bundle{B}} ) where B = B
@@ -655,6 +657,8 @@ fibertype(::GlobalSection{B,F} where B) where F = F
655
657
fibertype (:: Type{<:GlobalSection{B,F} where B} ) where F = F
656
658
fibertype (:: TensorField{B,F} where B) where F = F
657
659
fibertype (:: Type{<:TensorField{B,F} where B} ) where F = F
660
+ PointCloud (t:: TensorField ) = PointCloud (base (t))
661
+ Grassmann. grade (:: GradedField{G} ) where G = G
658
662
659
663
@pure Base. eltype (:: Type{<:GridFrameBundle{P,G}} ) where {P,G} = Coordinate{P,G}
660
664
Base. getindex (m:: GridFrameBundle ,i:: Vararg{Int} ) = Coordinate (getindex (points (m),i... ), getindex (metrictensor (m),i... ))
720
724
Base. getindex (m:: TensorField ,i:: Vararg{Int} ) = LocalTensor (getindex (domain (m),i... ), getindex (codomain (m),i... ))
721
725
# Base.setindex!(m::TensorField{B,F,1,<:Interval},s::LocalTensor,i::Vararg{Int}) where {B,F} = setindex!(codomain(m),fiber(s),i...)
722
726
Base. setindex! (m:: TensorField{B,Fm} where Fm,s:: F ,i:: Vararg{Int} ) where {B,F} = setindex! (codomain (m),s,i... )
727
+ function Base. setindex! (m:: TensorField{B,F,N,<:IntervalRange} where {B,F,N},s:: LocalTensor ,i:: Vararg{Int} )
728
+ setindex! (codomain (m),fiber (s),i... )
729
+ return s
730
+ end
723
731
function Base. setindex! (m:: TensorField ,s:: LocalTensor ,i:: Vararg{Int} )
724
732
setindex! (domain (m),base (s),i... )
725
733
setindex! (codomain (m),fiber (s),i... )
@@ -791,6 +799,8 @@ find_gs(::Tuple{}) = nothing
791
799
find_gs (a:: GlobalSection , rest) = a
792
800
find_gs (:: Any , rest) = find_gs (rest)
793
801
802
+ (m:: TensorField{B,F,N,<:SimplexFrameBundle} where {B,F,N})(i:: ImmersedTopology ) = TensorField (PointCloud (m)(i),fiber (m)[vertices (i)])
803
+
794
804
linterp (x,x1,x2,f1,f2) = f1 + (f2- f1)* (x- x1)/ (x2- x1)
795
805
function bilinterp (x,y,x1,x2,y1,y2,f11,f21,f12,f22)
796
806
f1 = linterp (x,x1,x2,f11,f21)
@@ -804,21 +814,26 @@ function trilinterp(x,y,z,x1,x2,y1,y2,z1,z2,f111,f211,f121,f221,f112,f212,f122,f
804
814
end
805
815
806
816
(m:: IntervalMap )(s:: LocalTensor ) = LocalTensor (base (s), m (fiber (s)))
807
- function (m:: IntervalMap )(t)
808
- i = searchsortedfirst (domain (m) ,t[1 ])- 1
809
- linterp (t[1 ],m . dom [i],m . dom [i+ 1 ],m. cod[i],m. cod[i+ 1 ])
817
+ function (m:: IntervalMap )(t); p = points (m)
818
+ i = searchsortedfirst (p ,t[1 ])- 1
819
+ linterp (t[1 ],p [i],p [i+ 1 ],m. cod[i],m. cod[i+ 1 ])
810
820
end
811
821
function (m:: IntervalMap )(t:: Vector ,d= diff (m. cod)./ diff (m. dom))
812
822
[parametric (i,m,d) for i ∈ t]
813
823
end
814
824
function parametric (t,m,d= diff (codomain (m))./ diff (domain (m)))
815
- i = searchsortedfirst (domain (m),t)- 1
816
- codomain (m)[i]+ (t- domain (m)[i])* d[i]
825
+ p = points (m)
826
+ i = searchsortedfirst (p,t)- 1
827
+ codomain (m)[i]+ (t- p[i])* d[i]
817
828
end
818
829
819
- function (m:: TensorField{B,F,N,<:SimplexFrameBundle} where {B,F,N})(t)
820
- i = immersion (m)[findfirst (t,domain (m))]
821
- Chain (codomain (m)[i])⋅ (Chain (points (domain (m))[i])/ t)
830
+ (m:: TensorField )(t:: TensorField ) = TensorField (base (t),m .(fiber (t)))
831
+ (m:: GridFrameBundle )(t:: TensorField ) = GridFrameBundle (base (t),TensorField (base (m),fiber (m)).(fiber (t)))
832
+
833
+ function (m:: TensorField{B,F,N,<:SimplexFrameBundle} where {B,N})(t) where F
834
+ j = findfirst (t,domain (m)); iszero (j) && (return zero (F))
835
+ i = immersion (m)[j]
836
+ Chain (codomain (m)[i])⋅ (Chain (points (domain (m))[i])\ t)
822
837
end
823
838
824
839
(m:: TensorField{B,F,N,<:RealSpace{2}} where {B,F,N})(x,y) = m (Chain (x,y))
@@ -967,7 +982,7 @@ function __init__()
967
982
x,y = points (t),value .(codomain (t))
968
983
yi = Real .(getindex .(y,1 ))
969
984
display (Makie.$ fun (x. v... ,yi;color= Real .(abs .(codomain (gradient_fast (x→ yi)))),args... ))
970
- for i ∈ 2 : binomial (mdims (eltype (codomain (t))),G )
985
+ for i ∈ 2 : binomial (mdims (eltype (codomain (t))),grade (t) )
971
986
yi = Real .(getindex .(y,i))
972
987
Makie.$ (funsym (fun))(x. v... ,yi;color= Real .(abs .(codomain (gradient_fast (x→ yi)))),args... )
973
988
end
@@ -1040,8 +1055,6 @@ function __init__()
1040
1055
Makie. linesegments! (e:: SimplexFrameBundle ;args... ) = (p= points (e); Makie. linesegments! (Grassmann. pointpair .(e[ImmersedTopology (e)],↓ (Manifold (p)));args... ))
1041
1056
Makie. wireframe (t:: SimplexFrameBundle ;args... ) = Makie. linesegments (t (edges (t));args... )
1042
1057
Makie. wireframe! (t:: SimplexFrameBundle ;args... ) = Makie. linesegments! (t (edges (t));args... )
1043
- Makie. mesh (M:: SimplexFrameBundle ;args... ) = Makie. mesh (points (M),ImmersedTopology (M);args... )
1044
- Makie. mesh! (M:: SimplexFrameBundle ;args... ) = Makie. mesh! (points (M),ImmersedTopology (M);args... )
1045
1058
for fun ∈ (:mesh ,:mesh! ,:wireframe ,:wireframe! )
1046
1059
@eval Makie.$ fun (M:: GridFrameBundle ;args... ) = Makie.$ fun (GeometryBasics. Mesh (M);args... )
1047
1060
end
@@ -1056,7 +1069,7 @@ function __init__()
1056
1069
Makie. mesh (submesh (M),array (ImmersedTopology (M));args... )
1057
1070
end
1058
1071
end
1059
- function Makie. mesh! (M:: SimplexFrameBundle ,t ;args... )
1072
+ function Makie. mesh! (M:: SimplexFrameBundle ;args... )
1060
1073
if mdims (points (M)) == 2
1061
1074
sm = submesh (M)[:,1 ]
1062
1075
Makie. lines! (sm,args[:color ])
0 commit comments