Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-grid
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
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
Core Modules
dune-grid
Commits
a9cb06e5
There was a problem fetching the pipeline summary.
Commit
a9cb06e5
authored
8 years ago
by
Ansgar Burchardt
Browse files
Options
Downloads
Plain Diff
Merge branch 'cherry-pick-
ec8c5491
' into 'releases/2.5'
Merge branch 'bugfix/gridinfo' into 'master' See merge request
!161
parents
1872ba3d
00bbd5e4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!161
Merge branch 'bugfix/gridinfo' into 'master'
Pipeline
#
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dune/grid/common/gridinfo.hh
+35
-55
35 additions, 55 deletions
dune/grid/common/gridinfo.hh
dune/grid/test/CMakeLists.txt
+2
-0
2 additions, 0 deletions
dune/grid/test/CMakeLists.txt
dune/grid/test/test-gridinfo.cc
+36
-0
36 additions, 0 deletions
dune/grid/test/test-gridinfo.cc
with
73 additions
and
55 deletions
dune/grid/common/gridinfo.hh
+
35
−
55
View file @
a9cb06e5
...
...
@@ -75,9 +75,6 @@ namespace Dune
}
}
std
::
cout
<<
")"
<<
std
::
endl
;
return
;
}
...
...
@@ -92,11 +89,6 @@ namespace Dune
// type used for coordinates in the grid
typedef
typename
G
::
ctype
ct
;
// the grid has an iterator providing the access to
// all elements (better codim 0 entities) on a grid level
// Note the use of the typename and template keywords.
typedef
typename
G
::
Traits
::
template
Codim
<
0
>
::
LevelIterator
LevelIterator
;
// print info about this level
std
::
cout
<<
prefix
<<
"level="
<<
level
<<
" dim="
<<
dim
...
...
@@ -112,39 +104,36 @@ namespace Dune
std
::
cout
<<
")"
<<
std
::
endl
;
// print info about each element on given level
LevelIterator
eendit
=
grid
.
levelGridView
(
level
).
template
end
<
0
>();
for
(
LevelIterator
it
=
grid
.
levelGridView
(
level
).
template
begin
<
0
>();
it
!=
eendit
;
++
it
)
for
(
const
auto
&
element
:
elements
(
levelGridView
(
grid
,
level
)))
{
std
::
cout
<<
prefix
<<
"level="
<<
it
->
level
()
<<
" "
<<
it
->
type
()
<<
"["
<<
dim
<<
"]"
<<
" index="
<<
grid
.
levelIndexSet
(
level
).
index
(
*
it
)
<<
" gid="
<<
grid
.
globalIdSet
().
template
id
<
0
>(
*
it
)
<<
" leaf="
<<
it
->
isLeaf
()
<<
" partition="
<<
PartitionName
(
it
->
partitionType
())
const
auto
&
geometry
=
element
.
geometry
();
std
::
cout
<<
prefix
<<
"level="
<<
element
.
level
()
<<
" "
<<
element
.
type
()
<<
"["
<<
dim
<<
"]"
<<
" index="
<<
grid
.
levelIndexSet
(
level
).
index
(
element
)
<<
" gid="
<<
grid
.
globalIdSet
().
template
id
<
0
>(
element
)
<<
" leaf="
<<
element
.
isLeaf
()
<<
" partition="
<<
PartitionName
(
element
.
partitionType
())
<<
" center=("
<<
it
->
geometry
()
.
global
(
Dune
::
ReferenceElements
<
ct
,
dim
>::
general
(
it
->
type
()).
position
(
0
,
0
))
<<
geometry
.
global
(
Dune
::
ReferenceElements
<
ct
,
dim
>::
general
(
element
.
type
()).
position
(
0
,
0
))
<<
")"
<<
" first=("
<<
it
->
geometry
()
.
corner
(
0
)
<<
")"
<<
" first=("
<<
geometry
.
corner
(
0
)
<<
")"
<<
std
::
endl
;
std
::
cout
<<
prefix
<<
"codim "
<<
dim
<<
" subindex"
;
for
(
int
i
=
0
;
i
<
it
->
template
count
<
dim
>(
);
i
++
)
for
(
int
i
=
0
;
i
<
element
.
subEntities
(
dim
);
i
++
)
{
std
::
cout
<<
" "
<<
i
<<
":"
<<
grid
.
levelIndexSet
(
level
).
subIndex
(
*
i
t
,
i
,
dim
);
std
::
cout
<<
" "
<<
i
<<
":"
<<
grid
.
levelIndexSet
(
level
).
subIndex
(
elemen
t
,
i
,
dim
);
}
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
prefix
<<
"codim "
<<
dim
-
1
<<
" subindex"
;
for
(
int
i
=
0
;
i
<
it
->
template
count
<
dim
-
1
>(
);
i
++
)
for
(
int
i
=
0
;
i
<
element
.
subEntities
(
dim
-
1
);
i
++
)
{
std
::
cout
<<
" "
<<
i
<<
":"
<<
grid
.
levelIndexSet
(
level
).
subIndex
(
*
i
t
,
i
,
dim
-
1
);
std
::
cout
<<
" "
<<
i
<<
":"
<<
grid
.
levelIndexSet
(
level
).
subIndex
(
elemen
t
,
i
,
dim
-
1
);
}
std
::
cout
<<
std
::
endl
;
}
return
;
}
...
...
@@ -159,12 +148,6 @@ namespace Dune
// type used for coordinates in the grid
typedef
typename
G
::
ctype
ct
;
// the grid has an iterator providing the access to
// all elements (better codim 0 entities) on a grid level
// Note the use of the typename and template keywords.
typedef
typename
G
::
Traits
::
template
Codim
<
0
>
::
LeafIterator
LeafIterator
;
typedef
typename
G
::
Traits
::
template
Codim
<
dim
>
::
LeafIterator
VLeafIterator
;
// print info about the leaf grid
std
::
cout
<<
prefix
<<
"leaf"
<<
" dim="
<<
dim
...
...
@@ -184,51 +167,48 @@ namespace Dune
std
::
cout
<<
")"
<<
std
::
endl
;
// print info about nodes in leaf grid
VLeafIterator
veendit
=
grid
.
template
leafend
<
dim
>();
for
(
VLeafIterator
it
=
grid
.
template
leafbegin
<
dim
>();
it
!=
veendit
;
++
it
)
for
(
const
auto
&
vertex
:
vertices
(
leafGridView
(
grid
)))
{
std
::
cout
<<
prefix
<<
"level="
<<
it
->
level
()
<<
" "
<<
it
->
type
()
<<
"["
<<
dim
<<
"]"
<<
" index="
<<
grid
.
leafIndexSet
().
index
(
*
it
)
<<
" gid="
<<
grid
.
globalIdSet
().
template
id
<
dim
>(
*
it
)
<<
" partition="
<<
PartitionName
(
it
->
partitionType
())
<<
" pos=("
<<
it
->
geometry
().
corner
(
0
)
<<
")"
std
::
cout
<<
prefix
<<
"level="
<<
vertex
.
level
()
<<
" "
<<
vertex
.
type
()
<<
"["
<<
dim
<<
"]"
<<
" index="
<<
grid
.
leafIndexSet
().
index
(
vertex
)
<<
" gid="
<<
grid
.
globalIdSet
().
template
id
<
dim
>(
vertex
)
<<
" partition="
<<
PartitionName
(
vertex
.
partitionType
())
<<
" pos=("
<<
vertex
.
geometry
().
corner
(
0
)
<<
")"
<<
std
::
endl
;
}
// print info about each element in leaf grid
LeafIterator
eendit
=
grid
.
template
leafend
<
0
>();
for
(
LeafIterator
it
=
grid
.
template
leafbegin
<
0
>();
it
!=
eendit
;
++
it
)
for
(
const
auto
&
element
:
elements
(
leafGridView
(
grid
)))
{
std
::
cout
<<
prefix
<<
"level="
<<
it
->
level
()
<<
" "
<<
it
->
type
()
<<
"["
<<
dim
<<
"]"
<<
" index="
<<
grid
.
leafIndexSet
().
index
(
*
it
)
<<
" gid="
<<
grid
.
globalIdSet
().
template
id
<
0
>(
*
it
)
<<
" leaf="
<<
it
->
isLeaf
()
<<
" partition="
<<
PartitionName
(
it
->
partitionType
())
const
auto
&
geometry
=
element
.
geometry
();
std
::
cout
<<
prefix
<<
"level="
<<
element
.
level
()
<<
" "
<<
element
.
type
()
<<
"["
<<
dim
<<
"]"
<<
" index="
<<
grid
.
leafIndexSet
().
index
(
element
)
<<
" gid="
<<
grid
.
globalIdSet
().
template
id
<
0
>(
element
)
<<
" leaf="
<<
element
.
isLeaf
()
<<
" partition="
<<
PartitionName
(
element
.
partitionType
())
<<
" center=("
<<
it
->
geometry
()
.
global
(
Dune
::
ReferenceElements
<
ct
,
dim
>::
general
(
it
->
type
()).
position
(
0
,
0
))
<<
geometry
.
global
(
Dune
::
ReferenceElements
<
ct
,
dim
>::
general
(
element
.
type
()).
position
(
0
,
0
))
<<
")"
<<
" first=("
<<
it
->
geometry
()
.
corner
(
0
)
<<
")"
<<
" first=("
<<
geometry
.
corner
(
0
)
<<
")"
<<
std
::
endl
;
std
::
cout
<<
prefix
<<
"codim "
<<
dim
<<
" subindex"
;
for
(
int
i
=
0
;
i
<
it
->
template
count
<
dim
>(
);
i
++
)
for
(
int
i
=
0
;
i
<
element
.
subEntities
(
dim
);
i
++
)
{
std
::
cout
<<
" "
<<
i
<<
":"
<<
grid
.
leafIndexSet
().
subIndex
(
*
i
t
,
i
,
dim
);
std
::
cout
<<
" "
<<
i
<<
":"
<<
grid
.
leafIndexSet
().
subIndex
(
elemen
t
,
i
,
dim
);
}
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
prefix
<<
"codim "
<<
dim
-
1
<<
" subindex"
;
for
(
int
i
=
0
;
i
<
it
->
template
count
<
dim
-
1
>(
);
i
++
)
for
(
int
i
=
0
;
i
<
element
.
subEntities
(
dim
-
1
);
i
++
)
{
std
::
cout
<<
" "
<<
i
<<
":"
<<
grid
.
leafIndexSet
().
subIndex
(
*
i
t
,
i
,
dim
-
1
);
std
::
cout
<<
" "
<<
i
<<
":"
<<
grid
.
leafIndexSet
().
subIndex
(
elemen
t
,
i
,
dim
-
1
);
}
std
::
cout
<<
std
::
endl
;
}
return
;
}
...
...
This diff is collapsed.
Click to expand it.
dune/grid/test/CMakeLists.txt
+
2
−
0
View file @
a9cb06e5
...
...
@@ -19,6 +19,8 @@ dune_add_test(NAME test-geogrid-uggrid
GRIDTYPE=Dune::UGGrid<2>
CMAKE_GUARD UG_FOUND
)
dune_add_test
(
SOURCES test-gridinfo.cc
)
dune_add_test
(
SOURCES test-identitygrid.cc
)
dune_add_test
(
SOURCES test-oned.cc
...
...
This diff is collapsed.
Click to expand it.
dune/grid/test/test-gridinfo.cc
0 → 100644
+
36
−
0
View file @
a9cb06e5
#include
"config.h"
#include
<dune/common/parallel/mpihelper.hh>
#include
<dune/grid/common/gridinfo.hh>
#include
<dune/grid/yaspgrid.hh>
template
<
typename
Grid
>
bool
test_gridinfo
(
const
Grid
&
grid
)
{
Dune
::
gridinfo
(
grid
);
for
(
int
level
=
0
;
level
<=
grid
.
maxLevel
();
++
level
)
Dune
::
gridlevellist
(
grid
,
level
,
"gridlevellist"
);
Dune
::
gridleaflist
(
grid
,
"gridleaflist"
);
return
true
;
}
int
main
(
int
argc
,
char
**
argv
)
{
Dune
::
MPIHelper
::
instance
(
argc
,
argv
);
{
Dune
::
YaspGrid
<
2
>
grid
({
1.
,
1.
},
{
4
,
4
});
grid
.
globalRefine
(
2
);
test_gridinfo
(
grid
);
}
{
Dune
::
YaspGrid
<
3
>
grid
({
1.
,
1.
,
1.
},
{
4
,
4
,
4
});
grid
.
globalRefine
(
2
);
test_gridinfo
(
grid
);
}
return
0
;
}
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