Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-gfe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Sander, Oliver
dune-gfe
Commits
d8aadbfd
Commit
d8aadbfd
authored
13 years ago
by
Oliver Sander
Committed by
sander@FU-BERLIN.DE
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
test a few mixed derivatives as well
[[Imported from SVN: r7372]]
parent
fb8a3c52
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/localgeodesicfestiffnesstest.cc
+13
-25
13 additions, 25 deletions
test/localgeodesicfestiffnesstest.cc
with
13 additions
and
25 deletions
test/localgeodesicfestiffnesstest.cc
+
13
−
25
View file @
d8aadbfd
...
@@ -21,7 +21,7 @@ using namespace Dune;
...
@@ -21,7 +21,7 @@ using namespace Dune;
/** \brief A special energy functional of which I happen to be able to compute the Hessian */
template
<
class
GridView
,
class
TargetSpace
>
template
<
class
GridView
,
class
TargetSpace
>
class
TestEnergyLocalStiffness
class
TestEnergyLocalStiffness
:
public
LocalGeodesicFEStiffness
<
GridView
,
TargetSpace
>
:
public
LocalGeodesicFEStiffness
<
GridView
,
TargetSpace
>
...
@@ -43,15 +43,6 @@ public:
...
@@ -43,15 +43,6 @@ public:
RT
energy
(
const
Entity
&
e
,
RT
energy
(
const
Entity
&
e
,
const
std
::
vector
<
TargetSpace
>&
localSolution
)
const
;
const
std
::
vector
<
TargetSpace
>&
localSolution
)
const
;
TestEnergyLocalStiffness
(
TargetSpace
anchor
,
int
idx
)
:
anchor_
(
anchor
),
idx_
(
idx
)
{}
TargetSpace
anchor_
;
int
idx_
;
};
};
template
<
class
GridView
,
class
TargetSpace
>
template
<
class
GridView
,
class
TargetSpace
>
...
@@ -59,7 +50,8 @@ typename TestEnergyLocalStiffness<GridView, TargetSpace>::RT TestEnergyLocalStif
...
@@ -59,7 +50,8 @@ typename TestEnergyLocalStiffness<GridView, TargetSpace>::RT TestEnergyLocalStif
energy
(
const
Entity
&
element
,
energy
(
const
Entity
&
element
,
const
std
::
vector
<
TargetSpace
>&
localSolution
)
const
const
std
::
vector
<
TargetSpace
>&
localSolution
)
const
{
{
return
TargetSpace
::
distance
(
anchor_
,
localSolution
[
idx_
])
*
TargetSpace
::
distance
(
anchor_
,
localSolution
[
idx_
]);
return
TargetSpace
::
distance
(
localSolution
[
0
],
localSolution
[
1
])
*
TargetSpace
::
distance
(
localSolution
[
0
],
localSolution
[
1
]);
}
}
...
@@ -111,10 +103,7 @@ void testUnitVector3d()
...
@@ -111,10 +103,7 @@ void testUnitVector3d()
int
nTestPoints
=
testPoints
.
size
();
int
nTestPoints
=
testPoints
.
size
();
TargetSpace
anchor
=
testPoints
[
0
];
TestEnergyLocalStiffness
<
typename
GridType
::
LeafGridView
,
TargetSpace
>
assembler
;
int
idx
=
0
;
TestEnergyLocalStiffness
<
typename
GridType
::
LeafGridView
,
TargetSpace
>
assembler
(
anchor
,
idx
);
// Set up elements of S^2
// Set up elements of S^2
std
::
vector
<
TargetSpace
>
coefficients
(
domainDim
+
1
);
std
::
vector
<
TargetSpace
>
coefficients
(
domainDim
+
1
);
...
@@ -136,8 +125,13 @@ void testUnitVector3d()
...
@@ -136,8 +125,13 @@ void testUnitVector3d()
std
::
cout
<<
"fdHessian:
\n
"
;
std
::
cout
<<
"fdHessian:
\n
"
;
printmatrix
(
std
::
cout
,
fdHessian
,
"fdHessian"
,
"--"
);
printmatrix
(
std
::
cout
,
fdHessian
,
"fdHessian"
,
"--"
);
FieldMatrix
<
double
,
3
,
3
>
embeddedHessian
=
TargetSpace
::
secondDerivativeOfDistanceSquaredWRTSecondArgument
(
anchor
,
coefficients
[
idx
]);
Matrix
<
FieldMatrix
<
double
,
3
,
3
>
>
embeddedHessian
(
nDofs
,
nDofs
);
FieldMatrix
<
double
,
2
,
2
>
hessian
;
for
(
size_t
j
=
0
;
j
<
nDofs
;
j
++
)
for
(
size_t
k
=
0
;
k
<
nDofs
;
k
++
)
embeddedHessian
[
j
][
k
]
=
TargetSpace
::
secondDerivativeOfDistanceSquaredWRTSecondArgument
(
coefficients
[
j
],
coefficients
[
j
]);
Matrix
<
FieldMatrix
<
double
,
2
,
2
>
>
hessian
(
nDofs
,
nDofs
);
// transform to local tangent space bases
// transform to local tangent space bases
const
int
blocksize
=
2
;
const
int
blocksize
=
2
;
...
@@ -154,7 +148,6 @@ void testUnitVector3d()
...
@@ -154,7 +148,6 @@ void testUnitVector3d()
}
}
#if 0
for
(
size_t
j
=
0
;
j
<
nDofs
;
j
++
)
for
(
size_t
j
=
0
;
j
<
nDofs
;
j
++
)
for
(
size_t
k
=
0
;
k
<
nDofs
;
k
++
)
{
for
(
size_t
k
=
0
;
k
<
nDofs
;
k
++
)
{
...
@@ -163,14 +156,9 @@ void testUnitVector3d()
...
@@ -163,14 +156,9 @@ void testUnitVector3d()
hessian
[
j
][
k
]
=
tmp
.
rightmultiplyany
(
orthonormalFramesTransposed
[
k
]);
hessian
[
j
][
k
]
=
tmp
.
rightmultiplyany
(
orthonormalFramesTransposed
[
k
]);
}
}
#else
Dune
::
FieldMatrix
<
double
,
blocksize
,
embeddedBlocksize
>
tmp
;
Dune
::
FMatrixHelp
::
multMatrix
(
orthonormalFrames
[
idx
],
embeddedHessian
,
tmp
);
hessian
=
tmp
.
rightmultiplyany
(
orthonormalFramesTransposed
[
idx
]);
#endif
std
::
cout
<<
"hessian:
\n
"
<<
hessian
<<
std
::
endl
;
std
::
cout
<<
"hessian:"
<<
std
::
endl
;
printmatrix
(
std
::
cout
,
hessian
,
"hessian"
,
"--"
);
}
}
...
...
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