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
cdab8df6
Commit
cdab8df6
authored
14 years ago
by
Oliver Sander
Committed by
sander@PCPOOL.MI.FU-BERLIN.DE
14 years ago
Browse files
Options
Downloads
Patches
Plain Diff
bugfix: dFdq may not be invertible
[[Imported from SVN: r5804]]
parent
4f5ebc7c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/localgeodesicfefunction.hh
+38
-2
38 additions, 2 deletions
src/localgeodesicfefunction.hh
with
38 additions
and
2 deletions
src/localgeodesicfefunction.hh
+
38
−
2
View file @
cdab8df6
...
...
@@ -9,6 +9,8 @@
#include
<dune/src/averagedistanceassembler.hh>
#include
<dune/src/targetspacertrsolver.hh>
#include
<dune/src/svd.hh>
/** \brief A geodesic function from the reference element to a manifold
\tparam dim Dimension of the reference element
...
...
@@ -20,6 +22,7 @@ class LocalGeodesicFEFunction
{
typedef
typename
TargetSpace
::
EmbeddedTangentVector
EmbeddedTangentVector
;
static
const
int
targetDim
=
EmbeddedTangentVector
::
size
;
public:
...
...
@@ -48,7 +51,34 @@ private:
}
return
result
;
}
static
Dune
::
FieldMatrix
<
double
,
targetDim
,
targetDim
>
pseudoInverse
(
const
Dune
::
FieldMatrix
<
double
,
targetDim
,
targetDim
>&
A
)
{
Dune
::
FieldMatrix
<
double
,
targetDim
,
targetDim
>
U
=
A
;
Dune
::
FieldVector
<
double
,
targetDim
>
W
;
Dune
::
FieldMatrix
<
double
,
targetDim
,
targetDim
>
V
;
svdcmp
(
U
,
W
,
V
);
// pseudoInv = V W^{-1} U^T
Dune
::
FieldMatrix
<
double
,
targetDim
,
targetDim
>
UT
;
for
(
int
i
=
0
;
i
<
targetDim
;
i
++
)
for
(
int
j
=
0
;
j
<
targetDim
;
j
++
)
UT
[
i
][
j
]
=
U
[
j
][
i
];
for
(
int
i
=
0
;
i
<
targetDim
;
i
++
)
{
if
(
std
::
abs
(
W
[
i
])
>
1e-12
)
// Diagonal may be zero, that's why we're using the pseudo inverse
UT
[
i
]
/=
W
[
i
];
else
UT
[
i
]
=
0
;
}
Dune
::
FieldMatrix
<
double
,
targetDim
,
targetDim
>
pseudoInv
;
Dune
::
FMatrixHelp
::
multMatrix
(
V
,
UT
,
pseudoInv
);
return
pseudoInv
;
}
/** \brief The coefficient vector */
std
::
vector
<
TargetSpace
>
coefficients_
;
...
...
@@ -104,7 +134,7 @@ evaluateDerivative(const Dune::FieldVector<ctype, dim>& local)
// Hence we need to solve a small system of linear equations.
// ////////////////////////////////////////////////////////////////////////
// the function value at the point where we are evaluati
o
n the derivative
// the function value at the point where we are evaluatin
g
the derivative
TargetSpace
q
=
evaluate
(
local
);
// the matrix that turns coordinates on the reference simplex into coordinates on the standard simplex
...
...
@@ -139,13 +169,19 @@ evaluateDerivative(const Dune::FieldVector<ctype, dim>& local)
// solve the system
// ////////////////////////////////////
// dFDq is not invertible, if the target space is embedded into a higher-dimensional
// Euclidean space. Therefore we use its pseudo inverse. I don't think that is the
// best way, though.
Dune
::
FieldMatrix
<
ctype
,
targetDim
,
targetDim
>
dFdqPseudoInv
=
pseudoInverse
(
dFdq
);
for
(
int
i
=
0
;
i
<
dim
;
i
++
)
{
Dune
::
FieldVector
<
ctype
,
targetDim
>
rhs
,
x
;
for
(
int
j
=
0
;
j
<
targetDim
;
j
++
)
rhs
[
j
]
=
RHS
[
j
][
i
];
dFdq
.
solve
(
x
,
rhs
);
//dFdq.solve(x, rhs);
dFdqPseudoInv
.
mv
(
rhs
,
x
);
for
(
int
j
=
0
;
j
<
targetDim
;
j
++
)
result
[
j
][
i
]
=
x
[
j
];
...
...
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