Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Core Modules
dune-common
Commits
1fa3c501
Commit
1fa3c501
authored
15 years ago
by
Oliver Sander
Browse files
Options
Downloads
Patches
Plain Diff
replace SmartPointer by shared_ptr
[[Imported from SVN: r5631]]
parent
a6c0f71a
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
common/arraylist.hh
+5
-5
5 additions, 5 deletions
common/arraylist.hh
common/mpicollectivecommunication.hh
+7
-7
7 additions, 7 deletions
common/mpicollectivecommunication.hh
common/test/smartpointertest.cc
+4
-4
4 additions, 4 deletions
common/test/smartpointertest.cc
with
16 additions
and
16 deletions
common/arraylist.hh
+
5
−
5
View file @
1fa3c501
...
...
@@ -7,7 +7,7 @@
#include
<cassert>
#include
<vector>
#include
"s
m
ar
tpointe
r.hh"
#include
"s
h
ar
ed_pt
r.hh"
#include
"array.hh"
#include
"iteratorfacades.hh"
...
...
@@ -199,7 +199,7 @@ namespace Dune
/**
* @brief The allocators for the fixed array.
*/
typedef
typename
A
::
template
rebind
<
SmartPointe
r
<
array
<
MemberType
,
chunkSize_
>
>
>::
other
typedef
typename
A
::
template
rebind
<
shared_pt
r
<
array
<
MemberType
,
chunkSize_
>
>
>::
other
SmartPointerAllocator
;
/**
...
...
@@ -209,7 +209,7 @@ namespace Dune
friend
class
ConstArrayListIterator
<
T
,
N
,
A
>
;
/** @brief the data chunks of our list. */
std
::
vector
<
SmartPointe
r
<
array
<
MemberType
,
chunkSize_
>
>
,
std
::
vector
<
shared_pt
r
<
array
<
MemberType
,
chunkSize_
>
>
,
SmartPointerAllocator
>
chunks_
;
/** @brief The current data capacity. */
size_type
capacity_
;
...
...
@@ -491,7 +491,7 @@ namespace Dune
size_t
index
=
start_
+
size_
;
if
(
index
==
capacity_
)
{
chunks_
.
push_back
(
SmartPointe
r
<
array
<
MemberType
,
chunkSize_
>
>
());
chunks_
.
push_back
(
shared_pt
r
<
array
<
MemberType
,
chunkSize_
>
>
());
capacity_
+=
chunkSize_
;
}
elementAt
(
index
)
=
entry
;
...
...
@@ -557,7 +557,7 @@ namespace Dune
// Number of chunks with entries in it;
size_t
chunks
=
((
start_
%
chunkSize_
+
size_
)
/
chunkSize_
);
typedef
typename
std
::
vector
<
SmartPointe
r
<
array
<
MemberType
,
typedef
typename
std
::
vector
<
shared_pt
r
<
array
<
MemberType
,
chunkSize_
>
>
>::
iterator
iterator
;
// Copy chunks to the left.
...
...
This diff is collapsed.
Click to expand it.
common/mpicollectivecommunication.hh
+
7
−
7
View file @
1fa3c501
...
...
@@ -11,7 +11,7 @@
#include
"exceptions.hh"
#include
"collectivecommunication.hh"
#include
"binaryfunctions.hh"
#include
"s
m
ar
tpointe
r.hh"
#include
"s
h
ar
ed_pt
r.hh"
#if HAVE_MPI
// MPI header
...
...
@@ -34,7 +34,7 @@ namespace Dune
{
if
(
type
.
operator
->
()
==
0
)
{
type
=
SmartPointe
r
<
MPI_Datatype
>
(
new
MPI_Datatype
);
type
=
shared_pt
r
<
MPI_Datatype
>
(
new
MPI_Datatype
);
MPI_Type_contiguous
(
sizeof
(
T
),
MPI_BYTE
,
type
.
operator
->
());
MPI_Type_commit
(
type
.
operator
->
());
}
...
...
@@ -43,11 +43,11 @@ namespace Dune
private
:
Generic_MPI_Datatype
()
{}
Generic_MPI_Datatype
(
const
Generic_MPI_Datatype
&
)
{}
static
SmartPointe
r
<
MPI_Datatype
>
type
;
static
shared_pt
r
<
MPI_Datatype
>
type
;
};
template
<
typename
T
>
SmartPointe
r
<
MPI_Datatype
>
Generic_MPI_Datatype
<
T
>::
type
=
SmartPointe
r
<
MPI_Datatype
>
(
0
);
shared_pt
r
<
MPI_Datatype
>
Generic_MPI_Datatype
<
T
>::
type
=
shared_pt
r
<
MPI_Datatype
>
(
0
);
// A Macro for defining traits for the primitive data types
#define ComposeMPITraits(p,m) \
...
...
@@ -88,7 +88,7 @@ namespace Dune
{
if
(
op
.
operator
->
()
==
0
)
{
op
=
SmartPointe
r
<
MPI_Op
>
(
new
MPI_Op
);
op
=
shared_pt
r
<
MPI_Op
>
(
new
MPI_Op
);
MPI_Op_create
((
void
(
*
)(
void
*
,
void
*
,
int
*
,
MPI_Datatype
*
))
&
operation
,
true
,
op
.
operator
->
());
}
return
*
op
;
...
...
@@ -106,12 +106,12 @@ namespace Dune
}
Generic_MPI_Op
()
{}
Generic_MPI_Op
(
const
Generic_MPI_Op
&
)
{}
static
SmartPointe
r
<
MPI_Op
>
op
;
static
shared_pt
r
<
MPI_Op
>
op
;
};
template
<
typename
Type
,
typename
BinaryFunction
>
SmartPointe
r
<
MPI_Op
>
Generic_MPI_Op
<
Type
,
BinaryFunction
>::
op
=
SmartPointe
r
<
MPI_Op
>
(
0
);
shared_pt
r
<
MPI_Op
>
Generic_MPI_Op
<
Type
,
BinaryFunction
>::
op
=
shared_pt
r
<
MPI_Op
>
(
0
);
#define ComposeMPIOp(type,func,op) \
template<> \
...
...
This diff is collapsed.
Click to expand it.
common/test/smartpointertest.cc
+
4
−
4
View file @
1fa3c501
...
...
@@ -5,7 +5,7 @@
#include
"config.h"
#endif
#include
<dune/common/s
m
ar
tpointe
r.hh>
#include
<dune/common/s
h
ar
ed_pt
r.hh>
#include
<iostream>
#include
<vector>
#include
<cstdlib>
...
...
@@ -14,9 +14,9 @@ int main(){
using
namespace
Dune
;
int
ret
=
0
;
{
SmartPointe
r
<
double
>
b
;
shared_pt
r
<
double
>
b
;
{
SmartPointe
r
<
double
>
d
(
b
);
shared_pt
r
<
double
>
d
(
b
);
*
b
=
7
;
}
if
(
b
.
count
()
!=
1
)
{
...
...
@@ -25,7 +25,7 @@ int main(){
ret
=
1
;
}
{
SmartPointe
r
<
double
>
c
(
b
);
shared_pt
r
<
double
>
c
(
b
);
if
(
*
b
!=*
c
)
{
std
::
cerr
<<
"References do not match! "
<<
__LINE__
<<
":"
<<
...
...
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