Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
amdis
amdis-core
Commits
43961d40
Commit
43961d40
authored
Oct 11, 2019
by
Praetorius, Simon
Browse files
cleanup wrap_or_share
parent
5327b924
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/amdis/ProblemStat.inc.hpp
View file @
43961d40
...
...
@@ -138,9 +138,9 @@ restore(Flag initFlag)
// restore grid from file
if
(
Dune
::
Capabilities
::
hasBackupRestoreFacilities
<
HostGrid
>::
v
)
adoptGrid
(
Grid
::
instance
(
Dune
::
BackupRestoreFacility
<
HostGrid
>::
restore
(
grid_filename
)));
adoptGrid
(
Grid
::
instance
(
std
::
unique_ptr
<
HostGrid
>
(
Dune
::
BackupRestoreFacility
<
HostGrid
>::
restore
(
grid_filename
)))
)
;
else
adoptGrid
(
Grid
::
instance
(
BackupRestoreByGridFactory
<
HostGrid
>::
restore
(
grid_filename
)));
adoptGrid
(
Grid
::
instance
(
std
::
unique_ptr
<
HostGrid
>
(
BackupRestoreByGridFactory
<
HostGrid
>::
restore
(
grid_filename
)))
)
;
// create fespace
if
(
initFlag
.
isSet
(
INIT_FE_SPACE
)
||
initFlag
.
isSet
(
INIT_SYSTEM
))
...
...
src/amdis/common/SharedPtr.hpp
View file @
43961d40
#pragma once
#include <memory>
#include <type_traits>
#include <utility>
#include <dune/common/shared_ptr.hh>
...
...
@@ -30,15 +31,10 @@ namespace AMDiS
}
template
<
class
T
>
std
::
shared_ptr
<
T
>
wrap_or_share
(
T
*
&
t
)
std
::
shared_ptr
<
T
>
wrap_or_share
(
T
*
t
)
{
return
std
::
shared_ptr
<
T
>
(
t
,
Dune
::
null_deleter
<
T
>
());
}
template
<
class
T
>
std
::
shared_ptr
<
T
>
wrap_or_share
(
T
*&&
t
)
{
return
std
::
shared_ptr
<
T
>
(
t
);
static_assert
(
not
std
::
is_pointer
<
T
*>::
value
,
"Raw pointers must be wrapped into smart pointers or references to clarify ownership"
);
}
template
<
class
T
>
...
...
@@ -48,13 +44,7 @@ namespace AMDiS
}
template
<
class
T
>
std
::
shared_ptr
<
T
>
wrap_or_share
(
std
::
unique_ptr
<
T
>&
t
)
{
return
std
::
shared_ptr
<
T
>
(
t
.
get
(),
Dune
::
null_deleter
<
T
>
());
}
template
<
class
T
>
std
::
shared_ptr
<
T
>
wrap_or_share
(
std
::
unique_ptr
<
T
>&&
t
)
std
::
shared_ptr
<
T
>
wrap_or_share
(
std
::
unique_ptr
<
T
>
t
)
{
return
std
::
shared_ptr
<
T
>
(
std
::
move
(
t
));
}
...
...
test/ISTLCommTest.cpp
View file @
43961d40
...
...
@@ -75,8 +75,7 @@ int main(int argc, char** argv)
int
ovlp
=
1
;
{
auto
hostGrid
=
std
::
make_unique
<
YaspGrid2d
>
(
lower2d
,
upper2d
,
nElements2d
,
std
::
bitset
<
2
>
(),
ovlp
);
YaspGrid2d
hostGrid
(
lower2d
,
upper2d
,
nElements2d
,
std
::
bitset
<
2
>
(),
ovlp
);
auto
grid
=
AdaptiveGrid
<
YaspGrid2d
>::
instance
(
hostGrid
);
auto
l1
=
LagrangeBasis
<
YaspGrid2d
,
1
>::
create
(
grid
->
leafGridView
());
...
...
@@ -86,8 +85,7 @@ int main(int argc, char** argv)
AMDIS_TEST
(
test
(
th
,
"Yasp2d_TH_Ovlp"
));
}
{
auto
hostGrid
=
std
::
make_unique
<
YaspGrid3d
>
(
lower3d
,
upper3d
,
nElements3d
,
std
::
bitset
<
3
>
(),
ovlp
);
YaspGrid3d
hostGrid
(
lower3d
,
upper3d
,
nElements3d
,
std
::
bitset
<
3
>
(),
ovlp
);
auto
grid
=
AdaptiveGrid
<
YaspGrid3d
>::
instance
(
hostGrid
);
auto
l1
=
LagrangeBasis
<
YaspGrid3d
,
1
>::
create
(
grid
->
leafGridView
());
...
...
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