Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Praetorius, Simon
dune-amdis
Commits
b661c013
Commit
b661c013
authored
Feb 15, 2019
by
Praetorius, Simon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add function globalRefine and globalCoarsen to ProblemStat
parent
32e77c49
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
0 deletions
+76
-0
src/amdis/ProblemInstatBase.hpp
src/amdis/ProblemInstatBase.hpp
+12
-0
src/amdis/ProblemStat.hpp
src/amdis/ProblemStat.hpp
+5
-0
src/amdis/ProblemStat.inc.hpp
src/amdis/ProblemStat.inc.hpp
+51
-0
src/amdis/ProblemStatBase.hpp
src/amdis/ProblemStatBase.hpp
+8
-0
No files found.
src/amdis/ProblemInstatBase.hpp
View file @
b661c013
...
...
@@ -58,6 +58,18 @@ namespace AMDiS
return
0
;
}
/// Implementation of \ref ProblemStatBase::globalCoarsen().
virtual
Flag
globalCoarsen
(
int
n
)
override
{
return
0
;
}
/// Implementation of \ref ProblemStatBase::globalRefine().
virtual
Flag
globalRefine
(
int
n
)
override
{
return
0
;
}
/// Implementation of \ref ProblemTimeInterface::closeTimestep().
virtual
void
closeTimestep
(
AdaptInfo
&
)
override
{
/* do nothing */
}
...
...
src/amdis/ProblemStat.hpp
View file @
b661c013
...
...
@@ -429,6 +429,11 @@ namespace AMDiS
/// Implementation of \ref ProblemStatBase::markElements.
virtual
Flag
markElements
(
AdaptInfo
&
adaptInfo
)
override
;
/// Uniform global grid coarsening by up to n level
virtual
Flag
globalCoarsen
(
int
n
)
override
;
/// Uniform global refinement by n level
virtual
Flag
globalRefine
(
int
n
)
override
;
private:
/// Name of this problem.
...
...
src/amdis/ProblemStat.inc.hpp
View file @
b661c013
...
...
@@ -354,6 +354,57 @@ markElements(AdaptInfo& adaptInfo)
}
template
<
class
Traits
>
Flag
ProblemStat
<
Traits
>::
globalCoarsen
(
int
n
)
{
Dune
::
Timer
t
;
bool
adapted
=
false
;
for
(
int
i
=
0
;
i
<
n
;
++
i
)
{
// mark all entities for grid refinement
for
(
const
auto
&
element
:
elements
(
grid_
->
leafGridView
()))
grid_
->
mark
(
-
1
,
element
);
adapted
|=
GridTransferManager
::
adapt
(
*
grid_
);
globalBasis_
->
update
(
gridView
());
}
msg
(
"globalCoarsen needed {} seconds"
,
t
.
elapsed
());
return
adapted
?
MESH_ADAPTED
:
Flag
(
0
);
}
// grid has globalRefine(int, AdaptDataHandleInterface&)
template
<
class
G
>
using
HasGlobalRefineADHI
=
decltype
(
std
::
declval
<
G
>
().
globalRefine
(
1
,
std
::
declval
<
GridTransfer
<
G
>&>
()));
template
<
class
Traits
>
Flag
ProblemStat
<
Traits
>::
globalRefine
(
int
refCount
)
{
Dune
::
Timer
t
;
bool
adapted
=
false
;
Dune
::
Hybrid
::
ifElse
(
Dune
::
Std
::
is_detected
<
HasGlobalRefineADHI
,
Grid
>
{},
/*then*/
[
&
](
auto
id
)
{
id
(
grid_
)
->
globalRefine
(
refCount
,
GridTransferManager
::
gridTransfer
(
*
grid_
));
globalBasis_
->
update
(
this
->
gridView
());
},
/*else*/
[
&
](
auto
id
)
{
for
(
int
i
=
0
;
i
<
refCount
;
++
i
)
{
// mark all entities for grid refinement
for
(
const
auto
&
element
:
elements
(
grid_
->
leafGridView
()))
grid_
->
mark
(
1
,
element
);
adapted
|=
GridTransferManager
::
adapt
(
*
id
(
grid_
));
globalBasis_
->
update
(
this
->
gridView
());
}
});
msg
(
"globalRefine needed {} seconds"
,
t
.
elapsed
());
return
adapted
?
MESH_ADAPTED
:
Flag
(
0
);
}
template
<
class
Traits
>
Flag
ProblemStat
<
Traits
>::
adaptGrid
(
AdaptInfo
&
adaptInfo
)
...
...
src/amdis/ProblemStatBase.hpp
View file @
b661c013
...
...
@@ -74,6 +74,14 @@ namespace AMDiS
/// Refinement/coarsening of the grid.
virtual
Flag
adaptGrid
(
AdaptInfo
&
adaptInfo
)
=
0
;
/// Uniform global grid coarsening by up to n level.
/// Returns MESH_ADAPTED if grid was changed
virtual
Flag
globalCoarsen
(
int
n
)
=
0
;
/// Uniform global refinement by n level
/// Returns MESH_ADAPTED if grid was changed
virtual
Flag
globalRefine
(
int
n
)
=
0
;
/** \brief
* Solves the assembled system. The result is an approximative solution.
* The last two boolean arguments can be used to controll successive
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment