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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stephan Hilb
SemiSmoothNewton.jl
Commits
68edb2a9
Commit
68edb2a9
authored
Nov 27, 2021
by
Stephan Hilb
Browse files
Options
Downloads
Patches
Plain Diff
rework image projection
parent
e40cc4c0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/operator.jl
+12
-17
12 additions, 17 deletions
src/operator.jl
with
12 additions
and
17 deletions
src/operator.jl
+
12
−
17
View file @
68edb2a9
...
@@ -132,7 +132,7 @@ function quadrature_composite_lagrange_midpoint(p)
...
@@ -132,7 +132,7 @@ function quadrature_composite_lagrange_midpoint(p)
for
I
in
Iterators
.
product
(
ntuple
(
_
->
0
:
p
,
d_
)
...
)
for
I
in
Iterators
.
product
(
ntuple
(
_
->
0
:
p
,
d_
)
...
)
sum
(
Tuple
(
I
))
>
p
&&
continue
sum
(
Tuple
(
I
))
>
p
&&
continue
k
+=
1
k
+=
1
weights
[
k
]
=
1
/
n
weights
[
k
]
=
1
/
n
/
factorial
(
d_
)
points
[
1
,
k
]
=
I
[
1
]
/
p
points
[
1
,
k
]
=
I
[
1
]
/
p
points
[
2
,
k
]
=
I
[
2
]
/
p
points
[
2
,
k
]
=
I
[
2
]
/
p
end
end
...
@@ -237,25 +237,20 @@ function project_img2!(u::FeFunction, img)
...
@@ -237,25 +237,20 @@ function project_img2!(u::FeFunction, img)
space
=
u
.
space
space
=
u
.
space
mesh
=
space
.
mesh
mesh
=
space
.
mesh
f
=
ImageFunction
(
mesh
,
img
)
f
=
ImageFunction
(
mesh
,
img
)
nrdims
=
prod
(
space
.
size
)
# number of element dofs (i.e. local dofs not counting range dimensions)
nldofs
=
ndofs
(
space
.
element
)
u
.
data
.=
0
# count contributions to respective dof for subsequent averaging
# count contributions to respective dof for subsequent averaging
gdofcount
=
zeros
(
Int
,
size
(
u
.
data
))
gdofcount
=
zeros
(
Int
,
size
(
u
.
data
))
area_refel
=
0.5
# mesh cells
u
.
data
.=
zero
(
eltype
(
u
.
data
))
for
cell
in
cells
(
mesh
)
for
cell
in
cells
(
mesh
)
bind!
(
f
,
cell
)
bind!
(
f
,
cell
)
# size: nrdims × nldofs
# TODO: should be statically sized
gdofs
=
u
.
space
.
dofmap
[
:
,
:
,
cell
]
p
=
ceil
(
Int
,
diam
(
mesh
,
cell
))
p
=
ceil
(
Int
,
diam
(
mesh
,
cell
))
# we actually only use the lagrange lattice points
qw
,
qx
=
quadrature_composite_lagrange_midpoint
(
p
)
qw
,
qx
=
quadrature_composite_lagrange_midpoint
(
p
)
nqpts
=
length
(
qw
)
# number of quadrature points
qphi
=
zeros
(
nldofs
,
nqpts
)
for
k
in
axes
(
qx
,
2
)
for
k
in
axes
(
qx
,
2
)
xhat
=
SVector
{
d
}(
view
(
qx
,
:
,
k
))
xhat
=
SVector
{
d
}(
view
(
qx
,
:
,
k
))
x
=
elmap
(
mesh
,
cell
)(
xhat
)
x
=
elmap
(
mesh
,
cell
)(
xhat
)
...
@@ -265,11 +260,11 @@ function project_img2!(u::FeFunction, img)
...
@@ -265,11 +260,11 @@ function project_img2!(u::FeFunction, img)
# size: nldofs
# size: nldofs
phix
=
evaluate_basis
(
space
.
element
,
xhat
)
phix
=
evaluate_basis
(
space
.
element
,
xhat
)
# size: nrdims × nldofs
# no integration element used
gdofs
=
u
.
space
.
dofmap
[
:
,
:
,
cell
]
u
.
data
[
gdofs
]
.+=
qw
[
k
]
./
area_refel
.*
3
.*
value
*
phix
'
u
.
data
[
gdofs
]
.+=
value
*
(
12
.*
phix
'
.-
3
)
#u.data[gdofs] .+= qw[k] ./ area_refel * value * (12 .* phix' .- 3)
gdofcount
[
gdofs
]
.+=
1
end
end
gdofcount
[
gdofs
]
.+=
1
end
end
u
.
data
./=
gdofcount
u
.
data
./=
gdofcount
return
u
return
u
...
...
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