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
d85f4695
Commit
d85f4695
authored
5 years ago
by
Praetorius, Simon
Browse files
Options
Downloads
Patches
Plain Diff
make capabilities a compile-time test whether backup-restore functionality can be used
parent
c2cb20a7
No related branches found
No related tags found
1 merge request
!64
make capabilities a compile-time test whether backup-restore functionality can be used
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/amdis/ProblemStat.inc.hpp
+31
-11
31 additions, 11 deletions
src/amdis/ProblemStat.inc.hpp
with
31 additions
and
11 deletions
src/amdis/ProblemStat.inc.hpp
+
31
−
11
View file @
d85f4695
...
...
@@ -479,16 +479,26 @@ writeFiles(AdaptInfo& adaptInfo, bool force)
}
template
<
class
Grid
,
class
GridView
,
class
=
decltype
(
Dune
::
BackupRestoreFacility
<
Grid
>
::
backup
(
std
::
declval
<
Grid
>
(),
std
::
string
(
""
)))
>
void
backup_impl
(
Grid
const
&
grid
,
GridView
const
&
gv
,
std
::
string
filename
,
std
::
true_type
)
{
Dune
::
BackupRestoreFacility
<
Grid
>::
backup
(
grid
,
filename
);
}
template
<
class
Grid
,
class
GridView
,
bool
B
,
class
=
decltype
(
BackupRestoreByGridFactory
<
Grid
>
::
backup
(
std
::
declval
<
GridView
>
(),
std
::
string
(
""
)))
>
void
backup_impl
(
Grid
const
&
grid
,
GridView
const
&
gv
,
std
::
string
filename
,
bool_t
<
B
>
)
{
warning
(
"Falling back to backup of gridview."
);
BackupRestoreByGridFactory
<
Grid
>::
backup
(
gv
,
filename
);
}
template
<
class
Traits
>
void
ProblemStat
<
Traits
>::
backup
(
std
::
string
const
&
filename
)
const
{
if
(
Dune
::
Capabilities
::
hasBackupRestoreFacilities
<
Grid
>::
v
)
Dune
::
BackupRestoreFacility
<
Grid
>::
backup
(
*
grid_
,
filename
);
else
{
warning
(
"Falling back to backup of gridview."
);
BackupRestoreByGridFactory
<
Grid
>::
backup
(
gridView
(),
filename
);
}
backup_impl
(
*
grid_
,
gridView
(),
filename
,
bool_t
<
Dune
::
Capabilities
::
hasBackupRestoreFacilities
<
Grid
>::
v
>
{});
}
...
...
@@ -510,16 +520,26 @@ backup(AdaptInfo& adaptInfo)
}
template
<
class
Grid
,
class
=
decltype
(
Dune
::
BackupRestoreFacility
<
Grid
>
::
restore
(
std
::
string
(
""
)))
>
auto
restore_impl
(
std
::
string
filename
,
std
::
true_type
)
{
return
Dune
::
BackupRestoreFacility
<
Grid
>::
restore
(
filename
);
}
template
<
class
Grid
,
bool
B
,
class
=
decltype
(
BackupRestoreByGridFactory
<
Grid
>
::
restore
(
std
::
string
(
""
)))
>
auto
restore_impl
(
std
::
string
filename
,
bool_t
<
B
>
)
{
return
BackupRestoreByGridFactory
<
Grid
>::
restore
(
filename
);
}
template
<
class
Traits
>
auto
ProblemStat
<
Traits
>::
restore
(
std
::
string
const
&
filename
)
{
// restore grid from file
std
::
unique_ptr
<
Grid
>
grid
;
if
(
Dune
::
Capabilities
::
hasBackupRestoreFacilities
<
Grid
>::
v
)
grid
.
reset
(
Dune
::
BackupRestoreFacility
<
Grid
>::
restore
(
filename
));
else
grid
.
reset
(
BackupRestoreByGridFactory
<
Grid
>::
restore
(
filename
));
std
::
unique_ptr
<
Grid
>
grid
(
restore_impl
<
Grid
>
(
filename
,
bool_t
<
Dune
::
Capabilities
::
hasBackupRestoreFacilities
<
Grid
>::
v
>
{}));
return
std
::
move
(
grid
);
}
...
...
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