Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-istl
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-istl
Commits
4fdd94e1
Commit
4fdd94e1
authored
20 years ago
by
Markus Blatt
Browse files
Options
Downloads
Patches
Plain Diff
Added test for selection.
[[Imported from SVN: r136]]
parent
7a29bbea
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
istl/test/.gitignore
+2
-1
2 additions, 1 deletion
istl/test/.gitignore
istl/test/Makefile.am
+5
-1
5 additions, 1 deletion
istl/test/Makefile.am
istl/test/selectiontest.cc
+89
-0
89 additions, 0 deletions
istl/test/selectiontest.cc
with
96 additions
and
2 deletions
istl/test/.gitignore
+
2
−
1
View file @
4fdd94e1
...
...
@@ -3,4 +3,5 @@ Makefile.in
.deps
.libs
semantic.cache
indicestest
\ No newline at end of file
indicestest
selectiontest
\ No newline at end of file
This diff is collapsed.
Click to expand it.
istl/test/Makefile.am
+
5
−
1
View file @
4fdd94e1
# $Id $
if
MPI
TESTPROGS
=
indicestest
TESTPROGS
=
indicestest
selectiontest
endif
# which tests to run
...
...
@@ -17,3 +17,7 @@ indicestest_SOURCES = indicestest.cc
indicestest_CXXFLAGS
=
$(
MPI_CPPFLAGS
)
indicestest_LDFLAGS
=
$(
MPI_LDFLAGS
)
$(
MPI_LIBS
)
selectiontest_SOURCES
=
selectiontest.cc
selectiontest_CXXFLAGS
=
$(
MPI_CPPFLAGS
)
selectiontest_LDFLAGS
=
$(
MPI_LDFLAGS
)
$(
MPI_LIBS
)
This diff is collapsed.
Click to expand it.
istl/test/selectiontest.cc
0 → 100644
+
89
−
0
View file @
4fdd94e1
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#include
<iostream>
#include
<dune/istl/selection.hh>
#include
<dune/common/timer.hh>
#include
<dune/common/enumset.hh>
#include
<dune/istl/remoteindices.hh>
enum
GridFlags
{
owner
,
overlap
,
border
};
template
<
class
T
>
int
meassure
(
const
T
&
selection
)
{
/*
return meassure<1>(selection);
}
template<int LOOPS, class T>
int meassure(const T& selection)
{*/
typedef
typename
T
::
const_iterator
iterator
;
const
iterator
end
=
selection
.
end
();
int
count
=
0
;
Dune
::
Timer
timer
;
timer
.
reset
();
for
(
int
i
=
0
;
i
<
100
;
i
++
)
for
(
iterator
iter
=
selection
.
begin
();
iter
!=
end
;
++
iter
)
count
+=*
iter
;
std
::
cout
<<
" took "
<<
timer
.
elapsed
()
<<
" seconds"
<<
std
::
endl
;
return
count
;
}
template
<
int
SIZE
>
void
test
()
{
const
int
Nx
=
SIZE
;
const
int
Ny
=
SIZE
;
// Process configuration
Dune
::
IndexSet
<
int
,
Dune
::
ParallelLocalIndex
<
GridFlags
>
>
distIndexSet
;
distIndexSet
.
beginResize
();
for
(
int
y
=
0
,
i
=
0
;
y
<
Ny
;
y
++
)
for
(
int
x
=
0
;
x
<
Nx
;
x
++
,
i
++
)
{
GridFlags
flag
=
owner
;
if
(
x
==
0
||
x
==
Nx
-
1
||
y
==
0
||
y
==
Ny
-
1
)
flag
=
overlap
;
distIndexSet
.
add
(
i
,
Dune
::
ParallelLocalIndex
<
GridFlags
>
(
i
,
flag
,
true
));
}
distIndexSet
.
endResize
();
Dune
::
UncachedSelection
<
Dune
::
EnumItem
<
GridFlags
,
owner
>
,
int
,
Dune
::
ParallelLocalIndex
<
GridFlags
>
>
ownerUncached
(
distIndexSet
);
Dune
::
Selection
<
Dune
::
EnumItem
<
GridFlags
,
owner
>
,
int
,
Dune
::
ParallelLocalIndex
<
GridFlags
>
>
ownerCached
(
distIndexSet
);
Dune
::
UncachedSelection
<
Dune
::
EnumItem
<
GridFlags
,
overlap
>
,
int
,
Dune
::
ParallelLocalIndex
<
GridFlags
>
>
overlapUncached
(
distIndexSet
);
Dune
::
Selection
<
Dune
::
EnumItem
<
GridFlags
,
overlap
>
,
int
,
Dune
::
ParallelLocalIndex
<
GridFlags
>
>
overlapCached
(
distIndexSet
);
int
count
=
0
;
std
::
cout
<<
" Owner selection uncached:"
;
count
+=
meassure
(
ownerUncached
);
std
::
cout
<<
" Owner selection cached:"
;
count
+=
meassure
(
ownerCached
);
std
::
cout
<<
" Overlap selection uncached:"
;
count
+=
meassure
(
overlapUncached
);
std
::
cout
<<
" Overlap selection cached:"
;
count
+=
meassure
(
overlapCached
);
std
::
cout
<<
count
<<
std
::
endl
;
}
int
main
()
{
test
<
1000
>
();
}
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