Skip to content

Commit

Permalink
revised with AbstractReal, AbstractComplex, etc..
Browse files Browse the repository at this point in the history
  • Loading branch information
chakravala committed Aug 13, 2023
1 parent 53c67d9 commit e5ea50e
Show file tree
Hide file tree
Showing 4 changed files with 452 additions and 448 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "TensorFields"
uuid = "86e2b4fd-d9c8-44dc-a03f-e0a387f3b4e6"
authors = ["Michael Reed"]
version = "0.1.1"
version = "0.1.2"

[deps]
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
Expand Down
71 changes: 35 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,32 @@

*TensorField with product topology using [Grassmann.jl](https://github.com/chakravala/Grassmann.jl) element parameters*

[![DOI](https://zenodo.org/badge/223493781.svg)](https://zenodo.org/badge/latestdoi/223493781)
[![DOI](https://zenodo.org/badge/673606851.svg)](https://zenodo.org/badge/latestdoi/673606851)
[![Docs Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://grassmann.crucialflow.com/stable)
[![Docs Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://grassmann.crucialflow.com/dev)
[![Gitter](https://badges.gitter.im/Grassmann-jl/community.svg)](https://gitter.im/Grassmann-jl/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![Build status](https://ci.appveyor.com/api/projects/status/oxi2qutlsaytloap?svg=true)](https://ci.appveyor.com/project/chakravala/tensorfields-jl)
[![Build status](https://ci.appveyor.com/api/projects/status/cuh681med9ijieua?svg=true)](https://ci.appveyor.com/project/chakravala/tensorfields-jl)

Provides `TensorField{R,B,T,N} <: FiberBundle{Section{R,T},N}` implementation for both a local `ProductSpace` topology and the simplicial mesh topologies imported with [Grassmann.jl](https://github.com/chakravala/Grassmann.jl).
Provides `TensorField{B,T,F,N} <: FiberBundle{Section{B,F},N}` implementation for both a local `ProductSpace` topology and the simplicial mesh topologies imported with [Grassmann.jl](https://github.com/chakravala/Grassmann.jl).
Many of these modular methods can work on input meshes or product topologies of any dimension, although there are some methods which are specialized.
Utility package for differential geometry and tensor calculus intended for packages such as [Adapode.jl](https://github.com/chakravala/Adapode.jl).

```Julia
MeshFunction (alias for TensorField{B, T, F, 1} where {B, T<:ChainBundle, F<:Real})
ElementFunction (alias for TensorField{B, T, F, 1} where {B, T<:AbstractVector{B}, F<:Real})
IntervalMap{B} where B<:Real (alias for TensorField{B, T, F, 1} where {B<:Real, T<:AbstractArray{B, 1}, F})
RealFunction (alias for TensorField{B, T, F, 1} where {B<:Real, T<:AbstractVector{B}, F<:Union{Real, Single, Chain{V, G, <:Real, 1} where {V, G}}})
PlaneCurve (alias for TensorField{B, T, F, 1} where {B<:Real, T<:AbstractVector{B}, F<:(Chain{V, G, Q, 2} where {V, G, Q})})
SpaceCurve (alias for TensorField{B, T, F, 1} where {B<:Real, T<:AbstractVector{B}, F<:(Chain{V, G, Q, 3} where {V, G, Q})})
GridSurface (alias for TensorField{B, T, F, 2} where {B, T<:AbstractMatrix{B}, F<:Real})
GridParametric{B} where B (alias for TensorField{B, T, F} where {B, T<:(AbstractArray{B}), F<:Real})
ComplexMapping (alias for TensorField{B, T, F} where {B, T, F<:Complex})
ComplexMap (alias for TensorField{B, T, F} where {B, T, F<:Couple})
MeshFunction (alias for TensorField{B, T, F, 1} where {B, T<:ChainBundle, F<:AbstractReal})
ElementFunction (alias for TensorField{B, T, F, 1} where {B, T<:AbstractVector{B}, F<:AbstractReal})
IntervalMap{B} where B<:AbstractReal (alias for TensorField{B, T, F, 1} where {B<:Union{Real, Single{V, G, B, <:Real} where {V, G, B}, Chain{V, G, <:Real, 1} where {V, G}}, T<:AbstractArray{B, 1}, F})
RealFunction (alias for TensorField{B, T, F, 1} where {B<:AbstractReal, T<:AbstractVector{B}, F<:AbstractReal})
PlaneCurve (alias for TensorField{B, T, F, 1} where {B<:AbstractReal, T<:AbstractVector{B}, F<:(Chain{V, G, Q, 2} where {V, G, Q})})
SpaceCurve (alias for TensorField{B, T, F, 1} where {B<:AbstractReal, T<:AbstractVector{B}, F<:(Chain{V, G, Q, 3} where {V, G, Q})})
SurfaceGrid (alias for TensorField{B, T, F, 2} where {B, T<:AbstractMatrix{B}, F<:AbstractReal})
ScalarGrid (alias for TensorField{B, T, F} where {B, T<:(AbstractArray{B}), F<:AbstractReal})
CliffordField (alias for TensorField{B, T, F} where {B, T, F<:Multivector})
QuaternionField (alias for TensorField{B, T, F} where {B, T, F<:(Quaternion)})
ComplexMap (alias for TensorField{B, T, F} where {B, T, F<:(Union{Complex{T}, Single{V, G, B, Complex{T}} where {V, G, B}, Chain{V, G, Complex{T}, 1} where {V, G}, Couple{V, B, T} where {V, B}} where T<:Real)})
SpinorField (alias for TensorField{B, T, F} where {B, T, F<:AbstractSpinor})
GradedField{G} where G (alias for TensorField{B, T, F} where {G, B, T, F<:(Chain{V, G} where V)})
ScalarField (alias for TensorField{B, T, F} where {B, T, F<:Single})
ScalarField (alias for TensorField{B, T, F} where {B, T, F<:Union{Real, Single{V, G, B, <:Real} where {V, G, B}, Chain{V, G, <:Real, 1} where {V, G}}})
VectorField (alias for TensorField{B, T, F} where {B, T, F<:(Chain{V, 1} where V)})
SpinorField (alias for TensorField{B, T, F} where {B, T, F<:Spinor})
QuaternionField (alias for TensorField{B, T, F} where {B, T, F<:(Quaternion)})
CliffordField (alias for TensorField{B, T, F} where {B, T, F<:Multivector})
BivectorField (alias for TensorField{B, T, F} where {B, T, F<:(Chain{V, 2} where V)})
TrivectorField (alias for TensorField{B, T, F} where {B, T, F<:(Chain{V, 3} where V)})
```
Expand All @@ -50,34 +49,34 @@ julia> using Grassmann, TensorFields, UnicodePlots

julia> dom = (2π:0.01:4π)(0:0.01:2π);

julia> fun(v) = (v[1]-v[2])*cos(v[1]*v[2]/2);
julia> fun(v) = (0.1v[1]-0.3v[2])*cos(v[1]*v[2]/5);

julia> cat = dom fun; # dom → fun.(dom)

julia> typeof(cat)
TensorField{Chain{⟨++⟩, 1, Float64, 2}, ProductSpace{⟨++⟩, Float64, 2, 2, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, Float64, 2}
TensorField{Chain{⟨××⟩, 1, Float64, 2}, ProductSpace{⟨××⟩, Float64, 2, 2, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, Float64, 2}

julia> supertype(ans)
FiberBundle{Section{Chain{⟨++⟩, 1, Float64, 2}, Float64}, 2}
FiberBundle{Section{Chain{⟨××⟩, 1, Float64, 2}, Float64}, 2}

julia> contourplot(cat)
┌────────────────────────────────────────┐ 500
┌────────────────────────────────────────┐ 50
7 │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ ┌──┐
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⠀⠀⠀⠀⠀⠀⠀⠤⣄⡀⠠⢤⣀⠀⠀⠀⠀⠀⠀⠠⠤⠄⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠲⣍⡓⠦⢄⣀⠀⠀⠀⠀⠉⠓⠲⢬⣙⡲⢤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠓⠦⣌⡙⠲⢤⣀⠀⠀⠀⠀⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀⢠⣖⠆⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠘⢿⣒⠦⢤⣀⠀⠀⠀⠀⠀⠀⠙⠒⠦⢭⣓⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠁⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠈⠓⠦⢬⣉⠓⠦⢤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠯⣍⣉⠓⠒⠂⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠓⠒⠮⠽⠶⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣀⣀⡀⠀⠀⠈⠉⠙⠀⠀│ │▄▄│
│⠀⢐⡒⠦⢤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⠲⠤⣄⣉⡉⠉⠓⠒⠲⠄⠀⠀│ │▄▄│
│⠀⠀⠈⠙⠒⠦⠭⢽⣲⣤⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣀⣀⣀⣀⠀⠀⠀⠀⠉⠉⠙⠒⣒⡆⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠓⠲⠤⢤⣀⣈⡉⠉⠉⠓⠒⠒⠲⠤⠭⠇⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠉⢓⣒⣒⣲⣤⣬⡇⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠾⣍⣉⣉⠉⠉⠉⠉⠙⠒⠒⠒⠒⠒⠦⠬⠭⠷⠶⢶⣦⡄⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠉⠓⠒⠒⠒⠒⢦⣤⣤⣤⣼⣿⣿⣯⣭⡅⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣀⣀⣀⡠⠤⠤⠤⠤⣄⣀⣀⣀⣀⣀⣀⣛⣛⣒⣦⣤⣤⣤⣬⣭⣍⡁⠀⠀│ │▄▄│
0 │⠀⠀⠀⠀⠀⠀⠀⠀⠐⠯⢥⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣐⣶⣯⣭⣭⣭⢍⣉⣉⣉⡁⠀⠀│ └──┘
└────────────────────────────────────────┘ -400
│⠀⠀⠀⠀⠀⠀⠠⣄⡀⢤⣀⠠⣄⡀⠀⠀⠀⠀⠀⠀⠀⠠⣄⡀⠀⠤⣄⣀⠀⠀⠀⠀⠀⠀⠀⢀⣀⡀⠀⠀│ │▄▄│
│⠀⠠⣄⡀⠀⠀⠀⠀⠙⠦⣌⠙⠲⣍⡙⠲⠤⣄⣀⡀⠀⠀⠀⠙⢦⠀⠀⠈⠉⠉⠙⠒⠒⠋⠉⠁⠀⠀⠀⠀│ │▄▄│
│⠀⠠⣄⡉⠓⠲⠤⣄⣀⡀⠈⢳⠀⠀⠉⠓⠲⢤⣀⠉⠉⠉⠓⠋⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⢀⡀⠉⠓⠦⣄⣀⠀⠉⠉⠉⠀⠀⠀⠀⠀⠀⠈⠙⠒⠦⣄⡀⠀⠀⠀⠀⠀⠀⢀⣀⡤⠤⠤⠤⠤⠄⠀⠀│ │▄▄│
│⠀⠀⠙⢦⡀⠀⠀⠈⠙⠒⠦⢤⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣈⡷⠀⠀⠀⠀⠸⢭⣀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⢀⣀⣀⡹⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠓⠒⠒⠒⠒⠋⠉⠁⠀⠀⠀⠀⠀⠀⠀⠈⠉⠙⠒⠦⠤⡄⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠆⠀⠀│ │▄▄│
│⠀⢠⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠤⠖⠒⠒⠒⠒⠒⠲⠤⠤⠤⠤⢤⡀⠀⠀│ │▄▄│
│⠀⢀⣨⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠓⠦⠤⣄⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠉⠒⠒⠒⠒⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣀⣀⣀⣀⣀⣀⣠⠄⠀⠀│ │▄▄│
0 │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣒⣒⡋⠉⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └──┘
└────────────────────────────────────────┘ -40
⠀6⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀13⠀
```
Visualizing `TensorField` reperesentations can be standardized in combination with [Makie.jl](https://github.com/MakieOrg/Makie.jl) or [UnicodePlots.jl](https://github.com/JuliaPlots/UnicodePlots.jl).
Expand Down
Loading

2 comments on commit e5ea50e

@chakravala
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/89519

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.2 -m "<description of version>" e5ea50e2c7072567d2139ec057d0375010ae8428
git push origin v0.1.2

Please sign in to comment.