Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DG1d.jl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DG
DG1d.jl
Commits
97ba9217
Commit
97ba9217
authored
2 years ago
by
Florian Atteneder
Browse files
Options
Downloads
Patches
Plain Diff
wip
parent
955d5258
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/dg1d.jl
+2
-1
2 additions, 1 deletion
src/dg1d.jl
src/mwe.jl
+97
-4
97 additions, 4 deletions
src/mwe.jl
src/tensorbasis.jl
+5
-2
5 additions, 2 deletions
src/tensorbasis.jl
with
104 additions
and
7 deletions
src/dg1d.jl
+
2
−
1
View file @
97ba9217
...
...
@@ -58,8 +58,9 @@ module dg1d
include
(
"tensorbasis.jl"
)
include
(
"box.jl"
)
include
(
"tree.jl"
)
include
(
"cache.jl"
)
include
(
"grid.jl"
)
include
(
"callbacks.jl"
)
include
(
"numericalflux.jl"
)
...
...
This diff is collapsed.
Click to expand it.
src/mwe.jl
+
97
−
4
View file @
97ba9217
using
StructArrays
function
connected_matrix
(
Nx
,
Ny
)
M
=
zeros
(
Int64
,
Nx
,
Ny
)
NN
=
length
(
M
)
ix
,
iy
=
1
,
1
ix_dir
=
1
n
=
1
while
n
<=
NN
M
[
ix
,
iy
]
=
n
n
+=
1
x
,
y
,
z
=
[
randn
(
5
)
for
_
=
1
:
3
]
if
ix_dir
>
0
if
ix
<
Nx
ix
+=
1
else
iy
+=
1
ix_dir
*=
-
1
end
else
if
ix
>
1
ix
-=
1
else
iy
+=
1
ix_dir
*=
-
1
end
end
end
return
M
end
Vf
=
Vector
{
Float64
}
soa
=
StructArray
{
Tuple
{
Tuple
{
Vf
,
Vf
},
Vf
}}(((
x
,
y
),
z
))
function
connected_matrix
(
Nx
,
Ny
,
Nz
)
M
=
zeros
(
Int64
,
Nx
,
Ny
,
Nz
)
ijks
=
NTuple
{
3
,
Int64
}[]
NN
=
length
(
M
)
ix
,
iy
,
iz
=
1
,
1
,
1
ix_dir
,
iy_dir
=
1
,
1
n
=
1
while
n
<=
NN
M
[
ix
,
iy
,
iz
]
=
n
push!
(
ijks
,
(
ix
,
iy
,
iz
))
n
+=
1
if
ix_dir
>
0
if
ix
<
Nx
ix
+=
1
else
if
iy_dir
>
0
if
iy
<
Ny
iy
+=
1
else
iz
+=
1
iy_dir
*=
-
1
end
else
if
iy
>
1
iy
-=
1
else
iz
+=
1
iy_dir
*=
-
1
end
end
ix_dir
*=
-
1
end
else
if
ix
>
1
ix
-=
1
else
if
iy_dir
>
0
if
iy
<
Ny
iy
+=
1
else
iz
+=
1
iy_dir
*=
-
1
end
else
if
iy
>
1
iy
-=
1
else
iz
+=
1
iy_dir
*=
-
1
end
end
ix_dir
*=
-
1
end
end
end
return
M
,
ijks
end
M2d
=
connected_matrix
(
10
,
10
)
display
(
M2d
)
M3d
,
ijks
=
connected_matrix
(
4
,
4
,
4
)
display
(
ijks
)
# display(M3d)
# for mijk in M3d
# println(mijk)
# end
This diff is collapsed.
Click to expand it.
src/tensorbasis.jl
+
5
−
2
View file @
97ba9217
...
...
@@ -19,6 +19,9 @@ const TensorBasis1d = TensorBasis{1}
const
TensorBasis2d
=
TensorBasis
{
2
}
const
TensorBasis3d
=
TensorBasis
{
3
}
TensorBasis
(
se
::
SpectralElement
...
)
=
TensorBasis
{
length
(
se
)}(
se
...
)
Base
.
getindex
(
b
::
TensorBasis
,
idx
::
Int
)
=
b
.
basis
[
idx
]
# avoid bounds check with enums
# can we generalize Cart1d,Cart2d,Cart3d based on dimensions for other corodinates?
...
...
@@ -53,10 +56,10 @@ end
function
range_volume
(
tb
::
TensorBasis
,
offset
=
1
)
return
range
(
offset
,
offset
+
n_points
(
tb
)
-
1
)
return
Base
.
range
(
offset
,
length
=
offset
+
n_points
(
tb
)
-
1
)
end
function
range_boundary
(
tb
::
TensorBasis
,
offset
=
1
)
return
range
(
offset
,
offset
+
n_points_boundary
(
tb
))
return
Base
.
range
(
offset
,
length
=
offset
+
n_points_boundary
(
tb
))
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment