Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SemiSmoothNewton.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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Stephan Hilb
SemiSmoothNewton.jl
Commits
0e70536c
Commit
0e70536c
authored
3 years ago
by
Stephan Hilb
Browse files
Options
Downloads
Patches
Plain Diff
fix cosmetic stuff
parent
f6c2db7e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/function.jl
+6
-3
6 additions, 3 deletions
src/function.jl
src/image.jl
+1
-0
1 addition, 0 deletions
src/image.jl
src/operator.jl
+1
-1
1 addition, 1 deletion
src/operator.jl
with
8 additions
and
4 deletions
src/function.jl
+
6
−
3
View file @
0e70536c
...
@@ -13,7 +13,6 @@ ndofs(::P1) = 3
...
@@ -13,7 +13,6 @@ ndofs(::P1) = 3
ndofs
(
::
DP0
)
=
1
ndofs
(
::
DP0
)
=
1
ndofs
(
::
DP1
)
=
3
ndofs
(
::
DP1
)
=
3
# FIXME: should be static vectors
# evaluate all (1-dim) local basis functions against x
# evaluate all (1-dim) local basis functions against x
evaluate_basis
(
::
P1
,
x
)
=
SA
[
1
-
x
[
1
]
-
x
[
2
],
x
[
1
],
x
[
2
]]
evaluate_basis
(
::
P1
,
x
)
=
SA
[
1
-
x
[
1
]
-
x
[
2
],
x
[
1
],
x
[
2
]]
evaluate_basis
(
::
DP0
,
x
)
=
SA
[
1
]
evaluate_basis
(
::
DP0
,
x
)
=
SA
[
1
]
...
@@ -29,6 +28,8 @@ struct FeSpace{M, Fe, S}
...
@@ -29,6 +28,8 @@ struct FeSpace{M, Fe, S}
ndofs
::
Int
# = maximum(dofmap)
ndofs
::
Int
# = maximum(dofmap)
end
end
# TODO: size should probably be a type argument to make the constructor type
# safe
function
FeSpace
(
mesh
,
el
::
P1
,
size_
=
(
1
,))
function
FeSpace
(
mesh
,
el
::
P1
,
size_
=
(
1
,))
# special case for P1: dofs correspond to vertices
# special case for P1: dofs correspond to vertices
rdims
=
prod
(
size_
)
rdims
=
prod
(
size_
)
...
@@ -321,6 +322,7 @@ end
...
@@ -321,6 +322,7 @@ end
bind!
(
f
::
FacetDivergence
,
cell
)
=
f
.
cell
[]
=
cell
bind!
(
f
::
FacetDivergence
,
cell
)
=
f
.
cell
[]
=
cell
# TODO: get rid of this hack as soon as we use size=() for scalar functions
function
sample
(
f
::
FeFunction
)
function
sample
(
f
::
FeFunction
)
out
=
_sample
(
f
)
out
=
_sample
(
f
)
return
f
.
space
.
size
==
(
1
,)
?
return
f
.
space
.
size
==
(
1
,)
?
...
@@ -444,14 +446,15 @@ function save_csv(path, f::FeFunction)
...
@@ -444,14 +446,15 @@ function save_csv(path, f::FeFunction)
throw
(
ArgumentError
(
"non-scalar functions unsupported"
))
throw
(
ArgumentError
(
"non-scalar functions unsupported"
))
mesh
=
f
.
space
.
mesh
mesh
=
f
.
space
.
mesh
df
=
DataFrame
()
df
=
DataFrame
()
X
=
SA
[
0
1
0
;
0
0
1
]
X
=
SA
[
0
1
0
;
0
0
1
]
# corners in local coordinates
for
cell
in
cells
(
mesh
)
for
cell
in
cells
(
mesh
)
bind!
(
f
,
cell
)
bind!
(
f
,
cell
)
A
=
SArray
{
Tuple
{
ndims_space
(
mesh
),
nvertices_cell
(
mesh
)}}(
A
=
SArray
{
Tuple
{
ndims_space
(
mesh
),
nvertices_cell
(
mesh
)}}(
view
(
mesh
.
vertices
,
:
,
view
(
mesh
.
cells
,
:
,
cell
)))
view
(
mesh
.
vertices
,
:
,
view
(
mesh
.
cells
,
:
,
cell
)))
for
k
in
axes
(
A
,
2
)
for
k
in
axes
(
A
,
2
)
push!
(
df
,
(
x
=
A
[
1
,
k
],
y
=
A
[
2
,
k
],
c
=
evaluate
(
f
,
X
[
:
,
k
])[
1
]))
push!
(
df
,
(
x
=
A
[
1
,
k
],
y
=
A
[
2
,
k
],
f_xy
=
evaluate
(
f
,
X
[
:
,
k
])[
1
]))
end
end
end
end
CSV
.
write
(
path
,
df
)
CSV
.
write
(
path
,
df
)
...
...
This diff is collapsed.
Click to expand it.
src/image.jl
+
1
−
0
View file @
0e70536c
...
@@ -2,6 +2,7 @@ export interpolate_bilinear, halve, warp_backwards
...
@@ -2,6 +2,7 @@ export interpolate_bilinear, halve, warp_backwards
eval_neumann
(
img
,
x
)
=
img
[
clamp
.
(
Tuple
(
x
),
axes
(
img
))
...
]
eval_neumann
(
img
,
x
)
=
img
[
clamp
.
(
Tuple
(
x
),
axes
(
img
))
...
]
# uses native array indexing, i.e. 1:n
function
interpolate_bilinear
(
img
,
x
)
function
interpolate_bilinear
(
img
,
x
)
x0
=
floor
.
(
Int
,
x
)
x0
=
floor
.
(
Int
,
x
)
x1
=
x0
.+
1
x1
=
x0
.+
1
...
...
This diff is collapsed.
Click to expand it.
src/operator.jl
+
1
−
1
View file @
0e70536c
...
@@ -261,7 +261,7 @@ function project_img2!(u::FeFunction, img)
...
@@ -261,7 +261,7 @@ function project_img2!(u::FeFunction, img)
# size: nrdims
# size: nrdims
value
=
evaluate
(
f
,
xhat
)
value
=
evaluate
(
f
,
xhat
)
# size: nldofs
# size: nldofs
phix
=
evaluate_basis
(
space
.
element
,
SVector
{
d
}(
view
(
qx
,
:
,
k
))
)
phix
=
evaluate_basis
(
space
.
element
,
xhat
)
# size: nrdims × nldofs
# size: nrdims × nldofs
gdofs
=
u
.
space
.
dofmap
[
:
,
:
,
cell
]
gdofs
=
u
.
space
.
dofmap
[
:
,
:
,
cell
]
...
...
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