Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
amdis-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
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
amdis
amdis-core
Commits
01ddd2b7
Commit
01ddd2b7
authored
6 years ago
by
Müller, Felix
Committed by
Praetorius, Simon
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
*Marker replaced with shared_ptr<Marker>, removed unneccessary line breaks in output
parent
53f1571d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/amdis/Marker.cpp
+21
-21
21 additions, 21 deletions
src/amdis/Marker.cpp
src/amdis/Marker.hpp
+7
-7
7 additions, 7 deletions
src/amdis/Marker.hpp
src/amdis/ProblemStat.hpp
+1
-1
1 addition, 1 deletion
src/amdis/ProblemStat.hpp
src/amdis/ProblemStat.inc.hpp
+8
-7
8 additions, 7 deletions
src/amdis/ProblemStat.inc.hpp
with
37 additions
and
36 deletions
src/amdis/Marker.cpp
+
21
−
21
View file @
01ddd2b7
...
...
@@ -9,35 +9,34 @@ namespace AMDiS {
using
std
::
pow
;
template
<
class
Traits
>
Marker
<
Traits
>
*
Marker
<
Traits
>::
createMarker
(
std
::
string
name
,
std
::
string
component
,
const
EstType
&
est
,
Grid
*
grid
)
std
::
shared_ptr
<
Marker
<
Traits
>
>
Marker
<
Traits
>::
createMarker
(
std
::
string
name
,
std
::
string
component
,
const
EstType
&
est
,
std
::
shared_ptr
<
Grid
>
grid
)
{
int
strategy
=
0
;
Parameters
::
get
(
name
+
"->strategy"
,
strategy
);
Marker
*
marker
=
NULL
;
std
::
shared_ptr
<
Marker
<
Traits
>
>
marker
;
switch
(
strategy
)
{
case
0
:
// no refinement/coarsening
marker
=
NULL
;
break
;
case
1
:
msg
(
"Creating global refinement (GR) marker
\n
"
);
marker
=
new
GRMarker
<
Traits
>
(
name
,
component
,
est
,
grid
);
msg
(
"Creating global refinement (GR) marker"
);
marker
=
std
::
make_shared
<
GRMarker
<
Traits
>
>
(
name
,
component
,
est
,
grid
);
break
;
case
2
:
msg
(
"Creating maximum strategy (MS) marker
\n
"
);
marker
=
new
MSMarker
<
Traits
>
(
name
,
component
,
est
,
grid
);
msg
(
"Creating maximum strategy (MS) marker"
);
marker
=
std
::
make_shared
<
MSMarker
<
Traits
>
>
(
name
,
component
,
est
,
grid
);
break
;
case
3
:
msg
(
"Creating equidistribution strategy (ES) marker
\n
"
);
marker
=
new
ESMarker
<
Traits
>
(
name
,
component
,
est
,
grid
);
msg
(
"Creating equidistribution strategy (ES) marker"
);
marker
=
std
::
make_shared
<
ESMarker
<
Traits
>
>
(
name
,
component
,
est
,
grid
);
break
;
case
4
:
msg
(
"Creating guaranteed error reduction strategy (GERS) marker
\n
"
);
marker
=
new
GERSMarker
<
Traits
>
(
name
,
component
,
est
,
grid
);
msg
(
"Creating guaranteed error reduction strategy (GERS) marker"
);
marker
=
std
::
make_shared
<
GERSMarker
<
Traits
>
>
(
name
,
component
,
est
,
grid
);
break
;
default:
error_exit
(
"invalid strategy
\n
"
);
error_exit
(
"invalid strategy"
);
}
return
marker
;
...
...
@@ -61,8 +60,8 @@ namespace AMDiS {
template
<
class
Traits
>
void
Marker
<
Traits
>::
finishMarking
(
AdaptInfo
&
adaptInfo
)
{
msg
(
elMarkRefine
,
" elements marked for refinement
\n
"
);
msg
(
elMarkCoarsen
,
" elements marked for coarsening
\n
"
);
msg
(
elMarkRefine
,
" elements marked for refinement"
);
msg
(
elMarkCoarsen
,
" elements marked for coarsening"
);
}
...
...
@@ -91,7 +90,8 @@ namespace AMDiS {
template
<
class
Traits
>
Flag
Marker
<
Traits
>::
markGrid
(
AdaptInfo
&
adaptInfo
)
{
test_exit
(
grid
,
"No grid!
\n
"
);
if
(
!
(
grid
))
error_exit
(
"No grid!"
);
initMarking
(
adaptInfo
);
...
...
@@ -126,7 +126,7 @@ namespace AMDiS {
this
->
markRLimit
=
MSGammaP
*
adaptInfo
.
getEstMax
(
this
->
component
);
this
->
markCLimit
=
MSGammaCP
*
adaptInfo
.
getEstMax
(
this
->
component
);
msg
(
"start max_est: "
,
adaptInfo
.
getEstMax
(
this
->
component
),
", mark_limits: "
,
this
->
markRLimit
,
", "
,
this
->
markCLimit
,
"
\n
"
);
msg
(
"start max_est: "
,
adaptInfo
.
getEstMax
(
this
->
component
),
", mark_limits: "
,
this
->
markRLimit
,
", "
,
this
->
markCLimit
);
}
...
...
@@ -147,7 +147,7 @@ namespace AMDiS {
this
->
markRLimit
=
ESThetaP
*
epsP
/
nLeaves
;
this
->
markCLimit
=
ESThetaCP
*
epsP
/
nLeaves
;
msg
(
"start mark_limits: "
,
this
->
markRLimit
,
", "
,
this
->
markCLimit
,
"; nt = "
,
nLeaves
,
"
\n
"
);
msg
(
"start mark_limits: "
,
this
->
markRLimit
,
", "
,
this
->
markCLimit
,
"; nt = "
,
nLeaves
);
}
...
...
@@ -173,7 +173,7 @@ namespace AMDiS {
if
(
redfac
<
1.0
)
{
LTheta
*=
redfac
;
msg
(
"GERS: use extrapolated theta_star = "
,
pow
(
LTheta
,
1.0
/
this
->
p
)
,
"
\n
"
);
msg
(
"GERS: use extrapolated theta_star = "
,
pow
(
LTheta
,
1.0
/
this
->
p
));
}
}
...
...
@@ -193,7 +193,7 @@ namespace AMDiS {
}
while
((
GERSGamma
>
0
)
&&
(
GERSSum
<
LTheta
*
this
->
estSum
));
}
msg
(
"GERS refinement with gamma = "
,
GERSGamma
,
"
\n
"
);
msg
(
"GERS refinement with gamma = "
,
GERSGamma
);
}
if
(
this
->
coarsenAllowed
)
{
...
...
@@ -208,10 +208,10 @@ namespace AMDiS {
for
(
const
auto
&
elem
:
Dune
::
elements
(
this
->
grid
->
leafGridView
()))
markElementForCoarsening
(
adaptInfo
,
elem
);
msg
(
"coarse loop: gamma = "
,
GERSGamma
,
", sum = "
,
GERSSum
,
", limit = "
,
LTheta
,
"
\n
"
);
msg
(
"coarse loop: gamma = "
,
GERSGamma
,
", sum = "
,
GERSSum
,
", limit = "
,
LTheta
);
}
while
(
GERSSum
>
LTheta
);
msg
(
"GERS coarsening with gamma = "
,
GERSGamma
,
"
\n
"
);
msg
(
"GERS coarsening with gamma = "
,
GERSGamma
);
}
Marker
<
Traits
>::
finishMarking
(
adaptInfo
);
...
...
This diff is collapsed.
Click to expand it.
src/amdis/Marker.hpp
+
7
−
7
View file @
01ddd2b7
...
...
@@ -32,7 +32,7 @@ namespace AMDiS {
Marker
()
{}
/// Constructor.
Marker
(
std
::
string
name_
,
std
::
string
component_
,
const
EstType
&
est_
,
Grid
*
grid_
)
Marker
(
std
::
string
name_
,
std
::
string
component_
,
const
EstType
&
est_
,
std
::
shared_ptr
<
Grid
>
grid_
)
:
name
(
name_
),
component
(
component_
),
grid
(
grid_
),
...
...
@@ -116,7 +116,7 @@ namespace AMDiS {
}
/// Creates a scalar marker depending on the strategy set in parameters.
static
Marker
<
Traits
>
*
createMarker
(
std
::
string
name
,
std
::
string
component_
,
const
EstType
&
est_
,
Grid
*
grid_
);
static
std
::
shared_ptr
<
Marker
<
Traits
>
>
createMarker
(
std
::
string
name
,
std
::
string
component_
,
const
EstType
&
est_
,
std
::
shared_ptr
<
Grid
>
grid_
);
protected
:
/// Name of the scalar marker.
...
...
@@ -126,7 +126,7 @@ namespace AMDiS {
std
::
string
component
;
/// Pointer to the grid
Grid
*
grid
;
std
::
shared_ptr
<
Grid
>
grid
;
/// Pointer to the local error estimates
EstType
est
;
...
...
@@ -191,7 +191,7 @@ namespace AMDiS {
public:
/// Constructor.
GRMarker
(
std
::
string
name_
,
std
::
string
component_
,
const
EstType
&
est_
,
Grid
*
grid_
)
GRMarker
(
std
::
string
name_
,
std
::
string
component_
,
const
EstType
&
est_
,
std
::
shared_ptr
<
Grid
>
grid_
)
:
Marker
<
Traits
>
(
name_
,
component_
,
est_
,
grid_
)
{}
...
...
@@ -223,7 +223,7 @@ namespace AMDiS {
public:
/// Constructor.
MSMarker
(
std
::
string
name_
,
std
::
string
component_
,
const
EstType
&
est_
,
Grid
*
grid_
)
MSMarker
(
std
::
string
name_
,
std
::
string
component_
,
const
EstType
&
est_
,
std
::
shared_ptr
<
Grid
>
grid_
)
:
Marker
<
Traits
>
(
name_
,
component_
,
est_
,
grid_
),
MSGamma
(
0.5
),
MSGammaC
(
0.1
)
...
...
@@ -263,7 +263,7 @@ namespace AMDiS {
public:
/// Constructor.
ESMarker
(
std
::
string
name_
,
std
::
string
component_
,
const
EstType
&
est_
,
Grid
*
grid_
)
ESMarker
(
std
::
string
name_
,
std
::
string
component_
,
const
EstType
&
est_
,
std
::
shared_ptr
<
Grid
>
grid_
)
:
Marker
<
Traits
>
(
name_
,
component_
,
est_
,
grid_
),
ESTheta
(
0.9
),
ESThetaC
(
0.2
)
...
...
@@ -303,7 +303,7 @@ namespace AMDiS {
public:
/// Constructor.
GERSMarker
(
std
::
string
name_
,
std
::
string
component_
,
const
EstType
&
est_
,
Grid
*
grid_
)
GERSMarker
(
std
::
string
name_
,
std
::
string
component_
,
const
EstType
&
est_
,
std
::
shared_ptr
<
Grid
>
grid_
)
:
Marker
<
Traits
>
(
name_
,
component_
,
est_
,
grid_
),
oldErrSum
(
0.0
),
GERSThetaStar
(
0.6
),
...
...
This diff is collapsed.
Click to expand it.
src/amdis/ProblemStat.hpp
+
1
−
1
View file @
01ddd2b7
...
...
@@ -390,7 +390,7 @@ namespace AMDiS
std
::
list
<
std
::
shared_ptr
<
FileWriterInterface
>>
filewriter_
;
/// Pointer to the adaptation markers
std
::
list
<
Marker
<
Traits
>
*
>
marker
;
std
::
list
<
std
::
shared_ptr
<
Marker
<
Traits
>
>
>
marker
;
/// Pointer to the estimators for this problem
// std::vector<Estimator*> estimator;
...
...
This diff is collapsed.
Click to expand it.
src/amdis/ProblemStat.inc.hpp
+
8
−
7
View file @
01ddd2b7
...
...
@@ -143,11 +143,12 @@ void ProblemStat<Traits>::createMarker()
int
i
=
std
::
stoi
(
to_string
(
treePath
));
// TODO: To be removed
// replace i with treePath once supported
auto
marker_
=
Marker
<
Traits
>::
createMarker
(
componentName
,
std
::
to_string
(
i
),
estimates
[
std
::
to_string
(
i
)],
componentGrids
[
i
]);
if
(
marker_
)
marker
.
push_back
(
marker_
);
auto
newMarker
=
Marker
<
Traits
>::
createMarker
(
componentName
,
std
::
to_string
(
i
),
estimates
[
std
::
to_string
(
i
)],
grid
);
if
(
newMarker
)
{
marker
.
push_back
(
std
::
move
(
newMarker
));
}
// If there is more than one marker, and all components are defined
// on the same grid, the maximum marking has to be enabled.
// TODO: What about two markers each for two grids?
...
...
@@ -363,8 +364,8 @@ Flag ProblemStat<Traits>::markElements(AdaptInfo& adaptInfo)
Dune
::
Timer
t
;
Flag
markFlag
=
0
;
for
(
auto
m
arker
_
:
marker
)
markFlag
|=
m
arker
_
->
markGrid
(
adaptInfo
);
for
(
auto
currentM
arker
:
marker
)
markFlag
|=
currentM
arker
->
markGrid
(
adaptInfo
);
msg
(
"markElements needed "
,
t
.
elapsed
(),
" seconds"
);
...
...
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