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
615cea8c
Commit
615cea8c
authored
9 years ago
by
Oliver Sander
Committed by
sander
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Clean up/fix transfer operator setup code
[[Imported from SVN: r10125]]
parent
a30a2634
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
dune/gfe/trustregionsolver.cc
+39
-21
39 additions, 21 deletions
dune/gfe/trustregionsolver.cc
with
39 additions
and
21 deletions
dune/gfe/trustregionsolver.cc
+
39
−
21
View file @
615cea8c
...
...
@@ -3,10 +3,14 @@
#include
<dune/istl/io.hh>
#include
<dune/functions/functionspacebases/pq1nodalbasis.hh>
#include
<dune/functions/functionspacebases/pqknodalbasis.hh>
#include
<dune/fufem/functionspacebases/p1nodalbasis.hh>
#include
<dune/fufem/assemblers/operatorassembler.hh>
#include
<dune/fufem/assemblers/localassemblers/laplaceassembler.hh>
#include
<dune/fufem/assemblers/localassemblers/massassembler.hh>
#include
<dune/fufem/assemblers/basisinterpolationmatrixassembler.hh>
// Using a monotone multigrid as the inner solver
#include
<dune/solvers/iterationsteps/trustregiongsstep.hh>
...
...
@@ -143,37 +147,51 @@ setup(const typename BasisType::GridView::Grid& grid,
for
(
size_t
k
=
0
;
k
<
mmgStep
->
mgTransfer_
.
size
();
k
++
)
delete
(
mmgStep
->
mgTransfer_
[
k
]);
mmgStep
->
mgTransfer_
.
resize
(
numLevels
-
1
);
#if defined THIRD_ORDER || defined SECOND_ORDER
if
(
numLevels
>
1
)
{
////////////////////////////////////////////////////////////////////////
// The P1 space (actually P1/Q1, depending on the grid) is special:
// If we work in such a space, then the multigrid hierarchy of spaces
// is constructed in the usual way. For all other space, there is
// an additional restriction operator on the top of the hierarchy, which
// restricts the FE space to the P1/Q1 space on the same grid.
// On the lower grid levels a hierarchy of P1/Q1 spaces is used again.
////////////////////////////////////////////////////////////////////////
typedef
BasisType
Basis
;
bool
isP1Basis
=
std
::
is_same
<
Basis
,
DuneFunctionsBasis
<
Dune
::
Functions
::
PQ1NodalBasis
<
typename
Basis
::
GridView
>
>
>::
value
||
std
::
is_same
<
Basis
,
DuneFunctionsBasis
<
Dune
::
Functions
::
PQKNodalBasis
<
typename
Basis
::
GridView
,
1
>
>
>::
value
;
if
(
isP1Basis
)
mmgStep
->
mgTransfer_
.
resize
(
numLevels
-
1
);
else
mmgStep
->
mgTransfer_
.
resize
(
numLevels
);
// Here we set up the restriction of the leaf grid space into the leaf grid P1/Q1 space
if
(
not
isP1Basis
)
{
typedef
typename
TruncatedCompressedMGTransfer
<
CorrectionType
>::
TransferOperatorType
TransferOperatorType
;
P1NodalBasis
<
typename
GridType
::
LeafGridView
,
double
>
p1Basis
(
grid_
->
leafGridView
());
PKtoP1MGTransfer
<
CorrectionType
>*
topTransferOp
=
new
PKtoP1MGTransfer
<
CorrectionType
>
;
topTransferOp
->
setup
(
basis
,
p1Basis
);
mmgStep
->
mgTransfer_
.
back
()
=
topTransferOp
;
for
(
int
i
=
0
;
i
<
mmgStep
->
mgTransfer_
.
size
()
-
1
;
i
++
){
// Construct the local multigrid transfer matrix
TruncatedCompressedMGTransfer
<
CorrectionType
>*
newTransferOp
=
new
TruncatedCompressedMGTransfer
<
CorrectionType
>
;
newTransferOp
->
setup
(
*
grid_
,
i
+
1
,
i
+
2
);
mmgStep
->
mgTransfer_
[
i
]
=
newTransferOp
;
}
TransferOperatorType
pkToP1TransferMatrix
;
assembleBasisInterpolationMatrix
<
TransferOperatorType
,
P1NodalBasis
<
typename
GridType
::
LeafGridView
,
double
>
,
BasisType
>
(
pkToP1TransferMatrix
,
p1Basis
,
basis
);
mmgStep
->
mgTransfer_
.
back
()
=
new
TruncatedCompressedMGTransfer
<
CorrectionType
>
;
Dune
::
shared_ptr
<
TransferOperatorType
>
topTransferOperator
=
Dune
::
make_shared
<
TransferOperatorType
>
(
pkToP1TransferMatrix
);
dynamic_cast
<
TruncatedCompressedMGTransfer
<
CorrectionType
>*>
(
mmgStep
->
mgTransfer_
.
back
())
->
setMatrix
(
topTransferOperator
);
}
#else
for
(
size_
t
i
=
0
;
i
<
mmgStep
->
mgTransfer_
.
size
()
;
i
++
){
// Now the P1/Q1 restriction operators for the remaining levels
for
(
in
t
i
=
0
;
i
<
numLevels
-
1
;
i
++
)
{
// Construct the local multigrid transfer matrix
TruncatedCompressedMGTransfer
<
CorrectionType
>*
newTransferOp
=
new
TruncatedCompressedMGTransfer
<
CorrectionType
>
;
newTransferOp
->
setup
(
*
grid_
,
i
,
i
+
1
);
mmgStep
->
mgTransfer_
[
i
]
=
newTransferOp
;;
typedef
typename
TruncatedCompressedMGTransfer
<
CorrectionType
>::
TransferOperatorType
TransferOperatorType
;
mmgStep
->
mgTransfer_
[
i
]
=
new
TruncatedCompressedMGTransfer
<
CorrectionType
>
;
std
::
shared_ptr
<
TransferOperatorType
>
transferOperatorMatrix
=
Dune
::
make_shared
<
TransferOperatorType
>
(
newTransferOp
->
getMatrix
());
dynamic_cast
<
TruncatedCompressedMGTransfer
<
CorrectionType
>*>
(
mmgStep
->
mgTransfer_
[
i
])
->
setMatrix
(
transferOperatorMatrix
);
}
#endif
// //////////////////////////////////////////////////////////
// Create obstacles
...
...
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