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
9fd2afec
Commit
9fd2afec
authored
Jul 14, 2021
by
Stephan Hilb
Browse files
Options
Downloads
Patches
Plain Diff
fix derivative
we embarrassingly missed out the transformation
parent
576b9f12
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/function.jl
+14
-4
14 additions, 4 deletions
src/function.jl
with
14 additions
and
4 deletions
src/function.jl
+
14
−
4
View file @
9fd2afec
using
Statistics
:
mean
using
Statistics
:
mean
using
StaticArrays
:
SA
,
SArray
,
MVector
using
StaticArrays
:
SA
,
SArray
,
MVector
,
MMatrix
export
FeSpace
,
Mapper
,
FeFunction
,
P1
,
DP0
,
DP1
export
FeSpace
,
Mapper
,
FeFunction
,
P1
,
DP0
,
DP1
export
interpolate!
,
sample
,
bind!
,
evaluate
,
nabla
export
interpolate!
,
sample
,
bind!
,
evaluate
,
nabla
...
@@ -198,18 +198,28 @@ bind!(c, cell) = c
...
@@ -198,18 +198,28 @@ bind!(c, cell) = c
evaluate
(
c
,
xloc
)
=
c
evaluate
(
c
,
xloc
)
=
c
# TODO: inherit from some abstract function type
# TODO: inherit from some abstract function type
struct
Derivative
{
F
}
struct
Derivative
{
F
,
M
}
f
::
F
f
::
F
delmapinv
::
M
end
end
Base
.
show
(
io
::
IO
,
::
MIME
"text/plain"
,
x
::
Derivative
)
=
Base
.
show
(
io
::
IO
,
::
MIME
"text/plain"
,
x
::
Derivative
)
=
print
(
"
$
(nameof(typeof(x))) of
$
(typeof(x.f))"
)
print
(
"
$
(nameof(typeof(x))) of
$
(typeof(x.f))"
)
nabla
(
f
)
=
Derivative
(
f
)
function
nabla
(
f
)
d
=
ndims_domain
(
f
.
space
.
mesh
)
Derivative
(
f
,
zero
(
MMatrix
{
d
,
d
,
Float64
}))
end
bind!
(
df
::
Derivative
,
cell
)
=
bind!
(
df
.
f
,
cell
)
function
bind!
(
df
::
Derivative
,
cell
)
bind!
(
df
.
f
,
cell
)
delmap
=
jacobian
(
elmap
(
df
.
f
.
space
.
mesh
,
cell
),
SA
[
0.
,
0.
])
df
.
delmapinv
.=
inv
(
delmap
)
end
function
evaluate
(
df
::
Derivative
,
x
)
function
evaluate
(
df
::
Derivative
,
x
)
# size: (:, d)
jac
=
jacobian
(
x
->
evaluate
(
df
.
f
.
space
,
df
.
f
.
ldata
,
x
),
x
)
jac
=
jacobian
(
x
->
evaluate
(
df
.
f
.
space
,
df
.
f
.
ldata
,
x
),
x
)
jac
*=
df
.
delmapinv
return
SArray
{
Tuple
{
df
.
f
.
space
.
size
...
,
length
(
x
)}}(
jac
)
return
SArray
{
Tuple
{
df
.
f
.
space
.
size
...
,
length
(
x
)}}(
jac
)
end
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