Skip to content

Commit 31a3c2e

Browse files
committed
upgraded to Grassmann v0.8
1 parent bc2c021 commit 31a3c2e

File tree

3 files changed

+39
-12
lines changed

3 files changed

+39
-12
lines changed

Project.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ AbstractTensors = "a8e43f4a-99b7-5565-8bf1-0165161caaea"
1212

1313
[compat]
1414
julia = "1"
15-
AbstractTensors = "0.6"
16-
DirectSum = "0.7"
17-
Grassmann = "0.7"
15+
AbstractTensors = "0.7"
16+
DirectSum = "0.8"
17+
Grassmann = "0.8"
1818

1919
[extras]
2020
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

src/Adapode.jl

+21-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
module Adapode
22

3-
# This file is part of Aadapode.jl. It is licensed under the GPL license
3+
# This file is part of Aadapode.jl
4+
# It is licensed under the GPL license
45
# Adapode Copyright (C) 2019 Michael Reed
6+
# _ _ _
7+
# | | | | | |
8+
# ___| |__ __ _| | ___ __ __ ___ ____ _| | __ _
9+
# / __| '_ \ / _` | |/ / '__/ _` \ \ / / _` | |/ _` |
10+
# | (__| | | | (_| | <| | | (_| |\ V / (_| | | (_| |
11+
# \___|_| |_|\__,_|_|\_\_| \__,_| \_/ \__,_|_|\__,_|
12+
#
13+
# https://github.com/chakravala
14+
# https://crucialflow.com
15+
# _______ __ __
16+
# | _ |.--| |.---.-..-----..-----..--| |.-----.
17+
# | || _ || _ || _ || _ || _ || -__|
18+
# |___|___||_____||___._|| __||_____||_____||_____|
19+
# |__|
520

621
using SparseArrays, LinearAlgebra
722
using AbstractTensors, DirectSum, Grassmann
@@ -43,7 +58,7 @@ function weights(c,fx)
4358
return cfx
4459
end
4560
@pure shift(::Val{m},::Val{k}=Val(1)) where {m,k} = Values{m,Int}(k:m+k-1)
46-
@pure shift(M::Val{m},i) where {m,a} = ((shift(M,Val{0}()).+i).%(m+1)).+1
61+
@pure shift(M::Val{m},i) where m = ((shift(M,Val{0}()).+i).%(m+1)).+1
4762
explicit(x,h,c,fx) = (l=length(c);x+weights(h*c,llength(fx) ? fx[shift(Val(l))] : fx))
4863
explicit(x,h,c,fx,i) = (l=length(c);weights(h*c,llength(fx) ? fx[shift(Val(l),i)] : fx))
4964
improved_heun(x,f,h) = (fx = f(x); x+(h/2)*(fx+f(x+h*fx)))
@@ -175,16 +190,18 @@ function timeloop!(x,t,tmax,::Val{m}=Val(1)) where m
175190
t.s = 0
176191
end
177192
iszero(t.s) && checkstep!(t)
178-
d = tmax-x[t.i][1]
193+
d = tmax-time(x[t.i])
179194
d t.h && (t.h = d)
180195
done = d t.hmax
181196
done && truncate!(x,t.i-1)
182197
return !done
183198
end
184199

200+
time(x) = x[1]
201+
185202
Base.resize!(x,i,h) = length(x)<i+1 && resize!(x,i+h)
186203
truncate!(x,i) = length(x)>i+1 && resize!(x,i)
187204

188-
show_progress(x,t,b) = t.i%75000 == 11 && println(x[t.i][1]," out of ",b)
205+
show_progress(x,t,b) = t.i%75000 == 11 && println(time(x[t.i])," out of ",b)
189206

190207
end # module

src/element.jl

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11

2-
# This file is part of Adapode.jl. It is licensed under the AGPL license
2+
# This file is part of Adapode.jl
3+
# It is licensed under the AGPL license
34
# Adapode Copyright (C) 2019 Michael Reed
5+
# _ _ _
6+
# | | | | | |
7+
# ___| |__ __ _| | ___ __ __ ___ ____ _| | __ _
8+
# / __| '_ \ / _` | |/ / '__/ _` \ \ / / _` | |/ _` |
9+
# | (__| | | | (_| | <| | | (_| |\ V / (_| | | (_| |
10+
# \___|_| |_|\__,_|_|\_\_| \__,_| \_/ \__,_|_|\__,_|
11+
#
12+
# https://github.com/chakravala
13+
# https://crucialflow.com
414

515
export assemble, assembleglobal, assemblestiffness, assembleconvection, assembleSD
616
export assemblemass, assemblefunction, assemblemassfunction, assembledivergence
@@ -107,7 +117,7 @@ function incidence(t,cols=columns(t))
107117
end # node-element incidence, A[i,j]=1 -> i∈t[j]
108118

109119
assemblemassincidence(t,f,m=volumes(t),l=m) = assemblemassincidence(t,iterpts(t,f),iterable(t,m),iterable(t,l))
110-
function assemblemassincidence(t,f::F,m::V,l::T) where {F<:AbstractVector,V<:AbstractVector,T<:AbstractVector,D<:AbstractVector}
120+
function assemblemassincidence(t,f::F,m::V,l::T) where {F<:AbstractVector,V<:AbstractVector,T<:AbstractVector}
111121
np,n = length(points(t)),Val(mdims(Manifold(t)))
112122
M,b,v = spzeros(np,np), zeros(np), f
113123
for k 1:length(t)
@@ -131,11 +141,11 @@ pretni(t,B::SparseMatrixCSC=incidence(t)) = assembleload(t,sparse(B'))
131141
pretni(t,ut,B=pretni(t)) = B*ut #interp(t,ut,B::SparseMatrixCSC) = B*ut
132142

133143
#mass(a,b,::Val{N}) where N = (ones(SMatrix{N,N,Int})+I)/Int(factorial(N+1)/factorial(N-1))
134-
mass(a,b,::Val{N}) where N = (x=SubManifold(N)(∇);outer(x,x)+I)/Int(factorial(N+1)/factorial(N-1))
144+
mass(a,b,::Val{N}) where N = (x=Submanifold(N)(∇);outer(x,x)+I)/Int(factorial(N+1)/factorial(N-1))
135145
assemblemass(t,m=volumes(t)) = assembleglobal(mass,t,iterpts(t,m))
136146

137147
stiffness(c,g::Float64,::Val{2}) = (cg = c*g^2; Chain(Chain(cg,-cg),Chain(-cg,cg)))
138-
stiffness(c,g,::Val{N}) where N = Chain{SubManifold(N),1}(map.(*,c,value(g).⋅Ref(g)))
148+
stiffness(c,g,::Val{N}) where N = Chain{Submanifold(N),1}(map.(*,c,value(g).⋅Ref(g)))
139149
assemblestiffness(t,c=1,m=volumes(t),g=gradienthat(t,m)) = assembleglobal(stiffness,t,m,iterable(c isa Real ? t : means(t),c),g)
140150
# iterable(means(t),c) # mapping of c.(means(t))
141151

@@ -310,7 +320,7 @@ function nedelec(λ,g,v::Val{3})
310320
end
311321

312322
function basisnedelec(p)
313-
M = SubManifold(ℝ^3); V = (M)
323+
M = Submanifold(ℝ^3); V = (M)
314324
Chain{M,1}(
315325
Chain{V,1}(-p[2],p[1]),
316326
Chain{V,1}(-p[2],p[1]-1),

0 commit comments

Comments
 (0)