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
db4eb4a9
Commit
db4eb4a9
authored
6 years ago
by
Müller, Felix
Browse files
Options
Downloads
Patches
Plain Diff
overload for treepath added in AdaptInfo
parent
ebd19296
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/amdis/AdaptInfo.hpp
+128
-0
128 additions, 0 deletions
src/amdis/AdaptInfo.hpp
src/amdis/utility/TreePath.hpp
+7
-4
7 additions, 4 deletions
src/amdis/utility/TreePath.hpp
with
135 additions
and
4 deletions
src/amdis/AdaptInfo.hpp
+
128
−
0
View file @
db4eb4a9
...
...
@@ -11,7 +11,9 @@
// AMDiS includes
#include
<amdis/Output.hpp>
#include
<amdis/common/ConceptsBase.hpp>
#include
<amdis/common/Math.hpp>
#include
<amdis/utility/TreePath.hpp>
namespace
AMDiS
{
...
...
@@ -101,6 +103,12 @@ namespace AMDiS
return
true
;
}
template
<
class
TP
,
REQUIRES
(
Concepts
::
PreTreePath
<
TP
>
)
>
bool
spaceToleranceReached
(
TP
&
tp
)
const
{
return
spaceToleranceReached
(
to_string
(
tp
));
}
/// Returns whether time tolerance is reached.
virtual
bool
timeToleranceReached
()
const
{
...
...
@@ -120,6 +128,12 @@ namespace AMDiS
return
true
;
}
template
<
class
TP
,
REQUIRES
(
Concepts
::
PreTreePath
<
TP
>
)
>
bool
timeToleranceReached
(
TP
&
tp
)
const
{
return
timeToleranceReached
(
to_string
(
tp
));
}
/// Returns whether time error is under its lower bound.
virtual
bool
timeErrorLow
()
const
{
...
...
@@ -129,6 +143,7 @@ namespace AMDiS
return
true
;
}
/// Returns the time estimation as a combination
/// of maximal and integral time error
double
getTimeEstCombined
(
std
::
string
key
)
const
...
...
@@ -138,6 +153,11 @@ namespace AMDiS
scalContents
.
at
(
key
)
->
est_t_sum
*
scalContents
.
at
(
key
)
->
fac_sum
;
}
template
<
class
TP
,
REQUIRES
(
Concepts
::
PreTreePath
<
TP
>
)
>
double
getTimeEstCombined
(
TP
&
tp
)
const
{
return
getTimeEstCombined
(
to_string
(
tp
));
}
/// Print debug information about time error and its bound.
void
printTimeErrorLowInfo
()
const
;
...
...
@@ -268,24 +288,48 @@ namespace AMDiS
scalContents
.
at
(
key
)
->
est_sum
=
e
;
}
template
<
class
TP
,
REQUIRES
(
Concepts
::
PreTreePath
<
TP
>
)
>
void
setEstSum
(
double
e
,
TP
&
tp
)
{
setEstSum
(
e
,
to_string
(
tp
));
}
/// Sets \ref est_max.
void
setEstMax
(
double
e
,
std
::
string
key
)
{
scalContents
.
at
(
key
)
->
est_max
=
e
;
}
template
<
class
TP
,
REQUIRES
(
Concepts
::
PreTreePath
<
TP
>
)
>
void
setEstMax
(
double
e
,
TP
&
tp
)
{
setEstMax
(
e
,
to_string
(
tp
));
}
/// Sets \ref est_max.
void
setTimeEstMax
(
double
e
,
std
::
string
key
)
{
scalContents
.
at
(
key
)
->
est_t_max
=
e
;
}
template
<
class
TP
,
REQUIRES
(
Concepts
::
PreTreePath
<
TP
>
)
>
void
setTimeEstMax
(
double
e
,
TP
&
tp
)
{
setTimeEstMax
(
e
,
to_string
(
tp
));
}
/// Sets \ref est_t_sum.
void
setTimeEstSum
(
double
e
,
std
::
string
key
)
{
scalContents
.
at
(
key
)
->
est_t_sum
=
e
;
}
template
<
class
TP
,
REQUIRES
(
Concepts
::
PreTreePath
<
TP
>
)
>
void
setTimeEstSum
(
double
e
,
TP
&
tp
)
{
setTimeEstSum
(
e
,
to_string
(
tp
));
}
/// Returns \ref est_sum.
double
getEstSum
(
std
::
string
key
)
const
{
...
...
@@ -295,12 +339,24 @@ namespace AMDiS
return
scalContents
.
at
(
key
)
->
est_sum
;
}
template
<
class
TP
,
REQUIRES
(
Concepts
::
PreTreePath
<
TP
>
)
>
double
getEstSum
(
TP
&
tp
)
{
return
getEstSum
(
to_string
(
tp
));
}
/// Returns \ref est_t_sum.
double
getEstTSum
(
std
::
string
key
)
const
{
return
scalContents
.
at
(
key
)
->
est_t_sum
;
}
template
<
class
TP
,
REQUIRES
(
Concepts
::
PreTreePath
<
TP
>
)
>
double
getEstTSum
(
TP
&
tp
)
{
return
getEstTSum
(
to_string
(
tp
));
}
/// Returns \ref est_max.
double
getEstMax
(
std
::
string
key
)
const
{
...
...
@@ -310,18 +366,36 @@ namespace AMDiS
return
scalContents
.
at
(
key
)
->
est_max
;
}
template
<
class
TP
,
REQUIRES
(
Concepts
::
PreTreePath
<
TP
>
)
>
double
getEstMax
(
TP
&
tp
)
{
return
getEstMax
(
to_string
(
tp
));
}
/// Returns \ref est_max.
double
getTimeEstMax
(
std
::
string
key
)
const
{
return
scalContents
.
at
(
key
)
->
est_t_max
;
}
template
<
class
TP
,
REQUIRES
(
Concepts
::
PreTreePath
<
TP
>
)
>
double
getTimeEstmax
(
TP
&
tp
)
{
return
getTimeEstMax
(
to_string
(
tp
));
}
/// Returns \ref est_t_sum.
double
getTimeEstSum
(
std
::
string
key
)
const
{
return
scalContents
.
at
(
key
)
->
est_t_sum
;
}
template
<
class
TP
,
REQUIRES
(
Concepts
::
PreTreePath
<
TP
>
)
>
double
getTimeEstSum
(
TP
&
tp
)
{
return
getTimeEstSum
(
to_string
(
tp
));
}
/// Returns \ref est_t the estimated overall time error
double
getTimeEst
()
const
{
...
...
@@ -339,24 +413,48 @@ namespace AMDiS
return
scalContents
.
at
(
key
)
->
spaceTolerance
;
}
template
<
class
TP
,
REQUIRES
(
Concepts
::
PreTreePath
<
TP
>
)
>
double
getSpaceTolerance
(
TP
&
tp
)
{
return
getSpaceTolerance
(
to_string
(
tp
));
}
/// Sets \ref spaceTolerance.
void
setSpaceTolerance
(
std
::
string
key
,
double
tol
)
{
scalContents
.
at
(
key
)
->
spaceTolerance
=
tol
;
}
template
<
class
TP
,
REQUIRES
(
Concepts
::
PreTreePath
<
TP
>
)
>
void
setSpaceTolerance
(
TP
&
tp
,
double
tol
)
{
return
setSpaceTolerance
(
to_string
(
tp
),
tol
);
}
/// Returns \ref timeTolerance.
double
getTimeTolerance
(
std
::
string
key
)
const
{
return
scalContents
.
at
(
key
)
->
timeTolerance
;
}
template
<
class
TP
,
REQUIRES
(
Concepts
::
PreTreePath
<
TP
>
)
>
double
getTimeTolerance
(
TP
&
tp
)
{
return
getTimeTolerance
(
to_string
(
tp
));
}
/// Returns \ref timeRelativeTolerance.
double
getTimeRelativeTolerance
(
std
::
string
key
)
const
{
return
scalContents
.
at
(
key
)
->
timeRelativeTolerance
;
}
template
<
class
TP
,
REQUIRES
(
Concepts
::
PreTreePath
<
TP
>
)
>
double
getTimeRelativeTolerance
(
TP
&
tp
)
{
return
getTimeRelativeTolerance
(
to_string
(
tp
));
}
/// Sets \ref time
double
setTime
(
double
t
)
{
...
...
@@ -481,30 +579,60 @@ namespace AMDiS
return
scalContents
.
at
(
key
)
->
timeErrLow
;
}
template
<
class
TP
,
REQUIRES
(
Concepts
::
PreTreePath
<
TP
>
)
>
double
getTimeErrLow
(
TP
&
tp
)
{
return
getTimeErrLow
(
to_string
(
tp
));
}
/// Returns whether coarsening is allowed or not.
bool
isCoarseningAllowed
(
std
::
string
key
)
const
{
return
(
scalContents
.
at
(
key
)
->
coarsenAllowed
==
1
);
}
template
<
class
TP
,
REQUIRES
(
Concepts
::
PreTreePath
<
TP
>
)
>
bool
isCoarseningAllowed
(
TP
&
tp
)
{
return
isCoarseningAllowed
(
to_string
(
tp
));
}
/// Returns whether coarsening is allowed or not.
bool
isRefinementAllowed
(
std
::
string
key
)
const
{
return
(
scalContents
.
at
(
key
)
->
refinementAllowed
==
1
);
}
template
<
class
TP
,
REQUIRES
(
Concepts
::
PreTreePath
<
TP
>
)
>
bool
isRefinementAllowed
(
TP
&
tp
)
{
return
isRefinementAllowed
(
to_string
(
tp
));
}
///
void
allowRefinement
(
bool
allow
,
std
::
string
key
)
{
scalContents
.
at
(
key
)
->
refinementAllowed
=
allow
;
}
template
<
class
TP
,
REQUIRES
(
Concepts
::
PreTreePath
<
TP
>
)
>
void
allowRefinement
(
bool
allow
,
TP
&
tp
)
{
return
allowRefinement
(
allow
,
to_string
(
tp
));
}
///
void
allowCoarsening
(
bool
allow
,
std
::
string
key
)
{
scalContents
.
at
(
key
)
->
coarsenAllowed
=
allow
;
}
template
<
class
TP
,
REQUIRES
(
Concepts
::
PreTreePath
<
TP
>
)
>
void
allowCoarsening
(
bool
allow
,
TP
&
tp
)
{
return
allowCoarsening
(
allow
,
to_string
(
tp
));
}
int
getSize
()
const
{
return
int
(
scalContents
.
size
());
...
...
This diff is collapsed.
Click to expand it.
src/amdis/utility/TreePath.hpp
+
7
−
4
View file @
db4eb4a9
...
...
@@ -2,11 +2,14 @@
#include
<sstream>
#include
<string>
#include
<type_traits>
#include
<dune/common/std/apply.hh>
#include
<dune/typetree/treepath.hh>
#include
<dune/typetree/typetraits.hh>
#include
<amdis/common/Mpl.hpp>
namespace
AMDiS
{
...
...
@@ -79,9 +82,9 @@ namespace AMDiS
#else // DOXYGEN
auto
makeTreePath
(
int
i
)
{
return
Dune
::
TypeTree
::
hybridTreePath
(
std
::
size_t
(
i
));
}
auto
makeTreePath
(
std
::
size_t
i
)
{
return
Dune
::
TypeTree
::
hybridTreePath
(
i
);
}
auto
makeTreePath
(
RootTreePath
)
{
return
Dune
::
TypeTree
::
hybridTreePath
();
}
inline
auto
makeTreePath
(
int
i
)
{
return
Dune
::
TypeTree
::
hybridTreePath
(
std
::
size_t
(
i
));
}
inline
auto
makeTreePath
(
std
::
size_t
i
)
{
return
Dune
::
TypeTree
::
hybridTreePath
(
i
);
}
inline
auto
makeTreePath
(
RootTreePath
)
{
return
Dune
::
TypeTree
::
hybridTreePath
();
}
template
<
int
I
>
...
...
@@ -140,7 +143,7 @@ namespace AMDiS
return
ss
.
str
();
}
std
::
string
to_string
(
Dune
::
TypeTree
::
HybridTreePath
<>
const
&
tp
)
inline
std
::
string
to_string
(
Dune
::
TypeTree
::
HybridTreePath
<>
const
&
tp
)
{
return
""
;
}
...
...
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