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
18063745
Commit
18063745
authored
Jul 4, 2021
by
Stephan Hilb
Browse files
Options
Downloads
Patches
Plain Diff
prevent some allocations
parent
fe512a16
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/operator.jl
+21
-15
21 additions, 15 deletions
src/operator.jl
with
21 additions
and
15 deletions
src/operator.jl
+
21
−
15
View file @
18063745
...
...
@@ -6,6 +6,10 @@ export Poisson, L2Projection, init_point!, assemble, assemble_rhs
abstract type
Operator
end
Base
.
show
(
io
::
IO
,
::
MIME
"text/plain"
,
x
::
Operator
)
=
print
(
"
$
(nameof(typeof(x)))"
)
struct
L2Projection
{
Sp
,
F
}
<:
Operator
space
::
Sp
f
::
F
# target
...
...
@@ -58,6 +62,11 @@ function assemble(op::Operator)
end
end
xhat
=
zeros
(
d
)
phii
=
zeros
(
space
.
size
...
)
dphii
=
zeros
(
space
.
size
...
,
d
)
phij
=
zeros
(
space
.
size
...
)
dphij
=
zeros
(
space
.
size
...
,
d
)
I
=
Float64
[]
J
=
Float64
[]
V
=
Float64
[]
...
...
@@ -78,13 +87,13 @@ function assemble(op::Operator)
# quadrature points
for
k
in
axes
(
qx
,
2
)
xhat
=
qx
[
:
,
k
]
xhat
.
=
qx
[
:
,
k
]
opvalues
=
map
(
f
->
evaluate
(
f
,
xhat
),
opparams
)
phii
=
reshape
(
qphi
[
:
,
k
,
idim
,
ldofi
]
,
space
.
size
)
dphii
=
reshape
(
dqphi
[
:
,
:
,
k
,
idim
,
ldofi
]
*
delmapinv
,
(
space
.
size
...
,
:
))
phij
=
reshape
(
qphi
[
:
,
k
,
jdim
,
ldofj
]
,
space
.
size
)
dphij
=
reshape
(
dqphi
[
:
,
:
,
k
,
jdim
,
ldofj
]
*
delmapinv
,
(
space
.
size
...
,
:
))
phii
.
=
reshape
(
view
(
qphi
,
:
,
k
,
idim
,
ldofi
)
,
space
.
size
)
dphii
.
=
reshape
(
view
(
dqphi
,
:
,
:
,
k
,
idim
,
ldofi
)
*
delmapinv
,
(
space
.
size
...
,
:
))
phij
.
=
reshape
(
view
(
qphi
,
:
,
k
,
jdim
,
ldofj
)
,
space
.
size
)
dphij
.
=
reshape
(
view
(
dqphi
,
:
,
:
,
k
,
jdim
,
ldofj
)
*
delmapinv
,
(
space
.
size
...
,
:
))
gdofv
=
qw
[
k
]
*
a
(
op
,
xhat
,
phii
,
dphii
,
phij
,
dphij
;
opvalues
...
)
*
intel
...
...
@@ -92,12 +101,6 @@ function assemble(op::Operator)
push!
(
J
,
gdofj
)
push!
(
V
,
gdofv
)
#display(phii)
#display(dphii)
#display(phij)
#display(dphij)
#println("$cell, $gdofi, $gdofj, $gdofv")
end
end
end
...
...
@@ -131,7 +134,10 @@ function assemble_rhs(op::Operator)
end
end
b
=
Vector
{
Float64
}(
undef
,
space
.
ndofs
)
xhat
=
zeros
(
d
)
phij
=
zeros
(
space
.
size
...
)
dphij
=
zeros
(
space
.
size
...
,
d
)
b
=
zeros
(
space
.
ndofs
)
gdof
=
LinearIndices
((
nrdims
,
space
.
ndofs
))
for
cell
in
axes
(
mesh
.
cells
,
2
)
for
f
in
opparams
...
...
@@ -147,11 +153,11 @@ function assemble_rhs(op::Operator)
# quadrature points
for
k
in
axes
(
qx
,
2
)
xhat
=
qx
[
:
,
k
]
xhat
.
=
qx
[
:
,
k
]
opvalues
=
map
(
f
->
evaluate
(
f
,
xhat
),
opparams
)
phij
=
reshape
(
qphi
[
:
,
k
,
jdim
,
ldofj
],
space
.
size
)
dphij
=
reshape
(
dqphi
[
:
,
:
,
k
,
jdim
,
ldofj
]
*
delmapinv
,
(
space
.
size
...
,
:
))
phij
.
=
reshape
(
qphi
[
:
,
k
,
jdim
,
ldofj
],
space
.
size
)
dphij
.
=
reshape
(
dqphi
[
:
,
:
,
k
,
jdim
,
ldofj
]
*
delmapinv
,
(
space
.
size
...
,
:
))
gdofv
=
qw
[
k
]
*
l
(
op
,
xhat
,
phij
,
dphij
;
opvalues
...
)
*
intel
...
...
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