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
43961d40
Commit
43961d40
authored
5 years ago
by
Praetorius, Simon
Browse files
Options
Downloads
Patches
Plain Diff
cleanup wrap_or_share
parent
5327b924
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/amdis/ProblemStat.inc.hpp
+2
-2
2 additions, 2 deletions
src/amdis/ProblemStat.inc.hpp
src/amdis/common/SharedPtr.hpp
+5
-15
5 additions, 15 deletions
src/amdis/common/SharedPtr.hpp
test/ISTLCommTest.cpp
+2
-4
2 additions, 4 deletions
test/ISTLCommTest.cpp
with
9 additions
and
21 deletions
src/amdis/ProblemStat.inc.hpp
+
2
−
2
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
))
...
...
This diff is collapsed.
Click to expand it.
src/amdis/common/SharedPtr.hpp
+
5
−
15
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
));
}
...
...
This diff is collapsed.
Click to expand it.
test/ISTLCommTest.cpp
+
2
−
4
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
());
...
...
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