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
9fe4f696
Commit
9fe4f696
authored
5 years ago
by
Robert K
Browse files
Options
Downloads
Patches
Plain Diff
[bugfix][MCMGMapper] added contains == subIndex for blocksize > 1.
parent
34d32f2f
No related branches found
No related tags found
1 merge request
!351
fix bug a bug in the MCMGMapper contains method for blocksize > 1
Pipeline
#22561
passed
5 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/grid/common/test/CMakeLists.txt
+1
-3
1 addition, 3 deletions
dune/grid/common/test/CMakeLists.txt
dune/grid/common/test/mcmgmappertest.cc
+55
-4
55 additions, 4 deletions
dune/grid/common/test/mcmgmappertest.cc
with
56 additions
and
7 deletions
dune/grid/common/test/CMakeLists.txt
+
1
−
3
View file @
9fe4f696
dune_add_test
(
SOURCES scsgmappertest.cc
)
dune_add_test
(
SOURCES mcmgmappertest.cc
CMAKE_GUARD dune-uggrid_FOUND
)
dune_add_test
(
SOURCES mcmgmappertest.cc
)
This diff is collapsed.
Click to expand it.
dune/grid/common/test/mcmgmappertest.cc
+
55
−
4
View file @
9fe4f696
...
...
@@ -12,8 +12,12 @@
#include
<dune/common/parallel/mpihelper.hh>
#include
<dune/grid/common/mcmgmapper.hh>
#include
<dune/grid/yaspgrid.hh>
#include
<dune/grid/utility/structuredgridfactory.hh>
#if HAVE_DUNE_UGGRID
#include
<dune/grid/uggrid.hh>
#include
"../../../../doc/grids/gridfactory/hybridtestgrids.hh"
#endif
using
namespace
Dune
;
...
...
@@ -37,6 +41,7 @@ struct MCMGElementEdgeLayout
}
};
/*!
* \brief Check whether the index created for element data is unique,
* consecutive and starting from zero.
...
...
@@ -75,16 +80,26 @@ void checkVertexDataMapper(const Mapper& mapper, const GridView& gridView)
{
const
size_t
dim
=
GridView
::
dimension
;
size_t
min
=
1
;
size_t
max
=
0
;
std
::
set
<
int
>
indices
;
typedef
typename
Mapper
::
Index
Index
;
Index
min
=
1
;
Index
max
=
0
;
std
::
set
<
Index
>
indices
;
for
(
const
auto
&
element
:
elements
(
gridView
))
{
size_t
numVertices
=
element
.
subEntities
(
dim
);
for
(
size_t
curVertex
=
0
;
curVertex
<
numVertices
;
++
curVertex
)
{
size_t
index
=
mapper
.
subIndex
(
element
,
curVertex
,
dim
);
Index
testIdx
=
Index
(
-
1
);
bool
contains
=
mapper
.
contains
(
element
,
curVertex
,
dim
,
testIdx
);
Index
index
=
mapper
.
subIndex
(
element
,
curVertex
,
dim
);
if
(
contains
&&
(
index
!=
testIdx
)
)
{
DUNE_THROW
(
GridError
,
"subIndex and contains do not return the same index!"
);
}
min
=
std
::
min
(
min
,
index
);
max
=
std
::
max
(
max
,
index
);
indices
.
insert
(
index
);
...
...
@@ -160,6 +175,15 @@ void checkMixedDataMapper(const Mapper& mapper, const GridView& gridView)
max
=
std
::
max
(
max
,
*
(
block
.
end
())
-
1
);
for
(
Index
i
:
block
)
indices
.
insert
(
i
);
Index
testIdx
=
Index
(
-
1
);
const
bool
contains
=
mapper
.
contains
(
element
,
curEdge
,
dim
-
1
,
testIdx
);
const
Index
index
=
mapper
.
subIndex
(
element
,
curEdge
,
dim
-
1
);
if
(
contains
&&
(
index
!=
testIdx
)
)
{
DUNE_THROW
(
GridError
,
"subIndex and contains do not return the same index!"
);
}
}
}
...
...
@@ -199,6 +223,7 @@ void checkGrid(const Grid& grid)
leafMCMGMapper
(
grid
,
MCMGElementLayout
<
dim
>
());
checkElementDataMapper
(
leafMCMGMapper
,
grid
.
leafGridView
());
}
DUNE_NO_DEPRECATED_END
{
LeafMultipleCodimMultipleGeomTypeMapper
<
Grid
>
...
...
@@ -325,6 +350,7 @@ try
// Check grids with more than one element type.
// So far only UGGrid does this, so we use it to test the mappers.
#if HAVE_DUNE_UGGRID
// Do the test for a 2d UGGrid
{
typedef
UGGrid
<
2
>
Grid
;
...
...
@@ -350,6 +376,31 @@ try
checkGrid
(
*
grid
);
}
#endif
// Do the test for a 2d YaspGrid
{
Dune
::
FieldVector
<
double
,
2
>
lower
(
0
);
Dune
::
FieldVector
<
double
,
2
>
upper
(
1
);
std
::
array
<
unsigned
int
,
2
>
elements
=
{{
4
,
4
}};
typedef
Dune
::
YaspGrid
<
2
>
Grid
;
auto
grid
=
Dune
::
StructuredGridFactory
<
Grid
>::
createCubeGrid
(
lower
,
upper
,
elements
);
// create hybrid grid
checkGrid
(
*
grid
);
}
// Do the test for a 3d YaspGrid
{
Dune
::
FieldVector
<
double
,
3
>
lower
(
0
);
Dune
::
FieldVector
<
double
,
3
>
upper
(
1
);
std
::
array
<
unsigned
int
,
3
>
elements
=
{{
4
,
4
,
4
}};
typedef
Dune
::
YaspGrid
<
3
>
Grid
;
auto
grid
=
Dune
::
StructuredGridFactory
<
Grid
>::
createCubeGrid
(
lower
,
upper
,
elements
);
// create hybrid grid
checkGrid
(
*
grid
);
}
return
EXIT_SUCCESS
;
...
...
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