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
bf9d46ec
Commit
bf9d46ec
authored
13 years ago
by
Oliver Sander
Committed by
sander@FU-BERLIN.DE
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Use Functions::interpolate to sample the analytically given Dirichlet values
[[Imported from SVN: r7620]]
parent
0e5038cf
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
harmonicmaps-eoc.cc
+33
-36
33 additions, 36 deletions
harmonicmaps-eoc.cc
with
33 additions
and
36 deletions
harmonicmaps-eoc.cc
+
33
−
36
View file @
bf9d46ec
...
...
@@ -18,6 +18,7 @@
#include
<dune/fufem/assemblers/operatorassembler.hh>
#include
<dune/fufem/assemblers/localassemblers/laplaceassembler.hh>
#include
<dune/fufem/assemblers/localassemblers/massassembler.hh>
#include
<dune/fufem/functiontools/basisinterpolator.hh>
#include
<dune/solvers/solvers/iterativesolver.hh>
#include
<dune/solvers/norms/h1seminorm.hh>
...
...
@@ -39,6 +40,23 @@ const int blocksize = TargetSpace::TangentVector::dimension;
using
namespace
Dune
;
using
std
::
string
;
struct
DirichletFunction
:
public
Dune
::
VirtualFunction
<
FieldVector
<
double
,
dim
>
,
FieldVector
<
double
,
3
>
>
{
void
evaluate
(
const
FieldVector
<
double
,
dim
>&
x
,
FieldVector
<
double
,
3
>&
out
)
const
{
FieldVector
<
double
,
3
>
axis
;
axis
[
0
]
=
x
[
0
];
axis
[
1
]
=
x
[
1
];
axis
[
2
]
=
1
;
Rotation
<
3
,
double
>
rotation
(
axis
,
x
.
two_norm
()
*
M_PI
*
3
);
FieldMatrix
<
double
,
3
,
3
>
rMat
;
rotation
.
matrix
(
rMat
);
out
=
rMat
[
2
];
}
};
template
<
class
GridType
>
void
solve
(
const
shared_ptr
<
GridType
>&
grid
,
SolutionType
&
x
,
...
...
@@ -68,44 +86,23 @@ void solve (const shared_ptr<GridType>& grid,
// Initial solution
// //////////////////////////
x
.
resize
(
grid
->
size
(
dim
));
FieldVector
<
double
,
3
>
yAxis
(
0
);
yAxis
[
1
]
=
1
;
typename
GridType
::
LeafGridView
::
template
Codim
<
dim
>
::
Iterator
vIt
=
grid
->
template
leafbegin
<
dim
>();
typename
GridType
::
LeafGridView
::
template
Codim
<
dim
>
::
Iterator
vEndIt
=
grid
->
template
leafend
<
dim
>();
for
(;
vIt
!=
vEndIt
;
++
vIt
)
{
int
idx
=
grid
->
leafIndexSet
().
index
(
*
vIt
);
FieldVector
<
double
,
3
>
v
;
FieldVector
<
double
,
dim
>
pos
=
vIt
->
geometry
().
corner
(
0
);
FieldVector
<
double
,
3
>
axis
;
axis
[
0
]
=
pos
[
0
];
axis
[
1
]
=
pos
[
1
];
axis
[
2
]
=
1
;
Rotation
<
3
,
double
>
rotation
(
axis
,
pos
.
two_norm
()
*
M_PI
*
3
);
if
(
dirichletNodes
[
idx
][
0
])
{
#if 1
FieldMatrix
<
double
,
3
,
3
>
rMat
;
rotation
.
matrix
(
rMat
);
v
=
rMat
[
2
];
#else
v
[
0
]
=
std
::
sin
(
pos
[
0
]
*
M_PI
);
v
[
1
]
=
0
;
v
[
2
]
=
std
::
cos
(
pos
[
0
]
*
M_PI
);
#endif
}
else
{
v
[
0
]
=
1
;
v
[
1
]
=
0
;
v
[
2
]
=
0
;
}
x
[
idx
]
=
v
;
}
typedef
P1NodalBasis
<
typename
GridType
::
LeafGridView
,
double
>
P1Basis
;
P1Basis
p1Basis
(
grid
->
leafView
());
x
.
resize
(
p1Basis
.
size
());
BlockVector
<
FieldVector
<
double
,
3
>
>
dirichletFunctionValues
;
DirichletFunction
dirichletFunction
;
Functions
::
interpolate
(
p1Basis
,
dirichletFunctionValues
,
dirichletFunction
);
FieldVector
<
double
,
3
>
innerValue
;
innerValue
[
0
]
=
1
;
innerValue
[
1
]
=
0
;
innerValue
[
2
]
=
0
;
for
(
size_t
i
=
0
;
i
<
x
.
size
();
i
++
)
x
[
i
]
=
(
dirichletNodes
[
i
][
0
])
?
dirichletFunctionValues
[
i
]
:
innerValue
;
// ////////////////////////////////////////////////////////////
// Create an assembler for the Harmonic Energy Functional
// ////////////////////////////////////////////////////////////
...
...
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