Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-metagrid
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
Container Registry
Model registry
Operate
Environments
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
extensions
dune-metagrid
Commits
41f2c460
Commit
41f2c460
authored
3 years ago
by
Robert K
Browse files
Options
Downloads
Patches
Plain Diff
[bugfix][SphereGrid] Use shared_ptr to store host grid.
parent
b668aaef
No related branches found
No related tags found
1 merge request
!1
Update to 2.8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dune/grid/spheregrid/dgfparser.hh
+3
-3
3 additions, 3 deletions
dune/grid/spheregrid/dgfparser.hh
dune/grid/spheregrid/grid.hh
+24
-24
24 additions, 24 deletions
dune/grid/spheregrid/grid.hh
python/dune/CMakeLists.txt
+1
-1
1 addition, 1 deletion
python/dune/CMakeLists.txt
with
28 additions
and
28 deletions
dune/grid/spheregrid/dgfparser.hh
+
3
−
3
View file @
41f2c460
...
@@ -39,10 +39,10 @@ namespace Dune
...
@@ -39,10 +39,10 @@ namespace Dune
:
dgfHostFactory_
(
filename
,
comm
),
:
dgfHostFactory_
(
filename
,
comm
),
grid_
(
0
)
grid_
(
0
)
{
{
HostGrid
*
hostGrid
=
dgfHostFactory_
.
grid
();
std
::
shared_ptr
<
HostGrid
>
hostGrid
(
dgfHostFactory_
.
grid
()
)
;
assert
(
hostGrid
!=
0
);
assert
(
hostGrid
);
std
::
ifstream
input
(
filename
.
c_str
()
);
std
::
ifstream
input
(
filename
.
c_str
()
);
grid_
=
new
Grid
(
*
hostGrid
);
grid_
=
new
Grid
(
hostGrid
);
}
}
Grid
*
grid
()
const
Grid
*
grid
()
const
...
...
This diff is collapsed.
Click to expand it.
dune/grid/spheregrid/grid.hh
+
24
−
24
View file @
41f2c460
#ifndef DUNE_SPHEREGRID_GRID_HH
#ifndef DUNE_SPHEREGRID_GRID_HH
#define DUNE_SPHEREGRID_GRID_HH
#define DUNE_SPHEREGRID_GRID_HH
#include
<dune/common/shared_ptr.hh>
#include
<dune/grid/common/grid.hh>
#include
<dune/grid/common/grid.hh>
#include
<dune/grid/common/hostgridinoutstreams.hh>
#include
<dune/grid/common/hostgridinoutstreams.hh>
...
@@ -253,24 +254,26 @@ namespace Dune
...
@@ -253,24 +254,26 @@ namespace Dune
* The references to host grid and coordinate function are stored in the
* The references to host grid and coordinate function are stored in the
* grid. Therefore, they must remain valid until the grid is destroyed.
* grid. Therefore, they must remain valid until the grid is destroyed.
*
*
* \param[in] hostGrid reference to the grid to wrap
* \param[in] hostGrid reference to the grid to wrap
, memory managed elsewhere
*/
*/
explicit
SphereGrid
(
HostGrid
&
hostGrid
,
MapToSphere
mapToSphere
=
MapToSphere
()
)
explicit
SphereGrid
(
HostGrid
&
hostGrid
,
MapToSphere
mapToSphere
=
MapToSphere
()
)
:
hostGrid_
(
&
hostGrid
),
:
hostGrid
Ptr
_
(
&
hostGrid
,
Dune
::
null_deleter
<
HostGrid
>
()
),
mapToSphere_
(
mapToSphere
),
mapToSphere_
(
mapToSphere
),
levelIndexSets_
(
hostGrid
.
maxLevel
()
+
1
,
nullptr
)
levelIndexSets_
(
hostGrid
.
maxLevel
()
+
1
)
{}
{}
/** \brief destructor
/** \brief constructor
*
* The references to host grid and coordinate function are stored in the
* grid. Therefore, they must remain valid until the grid is destroyed.
*
* \param[in] hostGrid shared_ptr to the grid to wrap (memory managed here)
*/
*/
~
SphereGrid
()
explicit
SphereGrid
(
const
std
::
shared_ptr
<
HostGrid
>&
hostGridPtr
,
MapToSphere
mapToSphere
=
MapToSphere
()
)
{
:
hostGridPtr_
(
hostGridPtr
),
for
(
unsigned
int
i
=
0
;
i
<
levelIndexSets_
.
size
();
++
i
)
mapToSphere_
(
mapToSphere
),
{
levelIndexSets_
(
hostGrid
().
maxLevel
()
+
1
)
if
(
levelIndexSets_
[
i
]
)
{}
delete
(
levelIndexSets_
[
i
]
);
}
}
/** \} */
/** \} */
...
@@ -428,9 +431,9 @@ namespace Dune
...
@@ -428,9 +431,9 @@ namespace Dune
<<
" requested."
);
<<
" requested."
);
}
}
LevelIndexSet
*&
levelIndexSet
=
levelIndexSets_
[
level
];
auto
&
levelIndexSet
=
levelIndexSets_
[
level
];
if
(
!
levelIndexSet
)
if
(
!
levelIndexSet
)
levelIndexSet
=
new
LevelIndexSet
(
hostGrid
().
levelIndexSet
(
level
)
);
levelIndexSet
.
reset
(
new
LevelIndexSet
(
hostGrid
().
levelIndexSet
(
level
)
)
);
assert
(
levelIndexSet
);
assert
(
levelIndexSet
);
return
*
levelIndexSet
;
return
*
levelIndexSet
;
}
}
...
@@ -674,8 +677,8 @@ namespace Dune
...
@@ -674,8 +677,8 @@ namespace Dune
/** \name Miscellaneous Methods
/** \name Miscellaneous Methods
* \{ */
* \{ */
const
HostGrid
&
hostGrid
()
const
{
return
*
hostGrid_
;
}
const
HostGrid
&
hostGrid
()
const
{
assert
(
hostGridPtr_
);
return
*
hostGrid
Ptr
_
;
}
HostGrid
&
hostGrid
()
{
return
*
hostGrid_
;
}
HostGrid
&
hostGrid
()
{
assert
(
hostGridPtr_
);
return
*
hostGrid
Ptr
_
;
}
const
MapToSphere
&
mapToSphere
()
const
{
return
mapToSphere_
;
}
const
MapToSphere
&
mapToSphere
()
const
{
return
mapToSphere_
;
}
...
@@ -692,12 +695,8 @@ namespace Dune
...
@@ -692,12 +695,8 @@ namespace Dune
const
int
newNumLevels
=
maxLevel
()
+
1
;
const
int
newNumLevels
=
maxLevel
()
+
1
;
const
int
oldNumLevels
=
levelIndexSets_
.
size
();
const
int
oldNumLevels
=
levelIndexSets_
.
size
();
for
(
int
i
=
newNumLevels
;
i
<
oldNumLevels
;
++
i
)
levelIndexSets_
.
clear
();
{
levelIndexSets_
.
resize
(
newNumLevels
);
if
(
!
levelIndexSets_
[
i
]
)
delete
levelIndexSets_
[
i
];
}
levelIndexSets_
.
resize
(
newNumLevels
,
nullptr
);
}
}
/** \} */
/** \} */
...
@@ -711,9 +710,10 @@ namespace Dune
...
@@ -711,9 +710,10 @@ namespace Dune
}
}
protected
:
protected
:
HostGrid
*
const
hostGrid_
;
std
::
shared_ptr
<
HostGrid
>
hostGridPtr_
;
MapToSphere
mapToSphere_
;
MapToSphere
mapToSphere_
;
mutable
std
::
vector
<
LevelIndexSet
*
>
levelIndexSets_
;
mutable
std
::
vector
<
std
::
unique_ptr
<
LevelIndexSet
>
>
levelIndexSets_
;
mutable
LeafIndexSet
leafIndexSet_
;
mutable
LeafIndexSet
leafIndexSet_
;
mutable
GlobalIdSet
globalIdSet_
;
mutable
GlobalIdSet
globalIdSet_
;
mutable
LocalIdSet
localIdSet_
;
mutable
LocalIdSet
localIdSet_
;
...
...
This diff is collapsed.
Click to expand it.
python/dune/CMakeLists.txt
+
1
−
1
View file @
41f2c460
add_subdirectory
(
alu
grid
)
add_subdirectory
(
meta
grid
)
add_python_targets
(
dune
add_python_targets
(
dune
__init__
__init__
...
...
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