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
0d13fc73
Commit
0d13fc73
authored
18 years ago
by
Oliver Sander
Browse files
Options
Downloads
Patches
Plain Diff
beginning of a unit test for dynamic matrices
[[Imported from SVN: r643]]
parent
156327bc
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
istl/test/Makefile.am
+3
-1
3 additions, 1 deletion
istl/test/Makefile.am
istl/test/matrixtest.cc
+64
-0
64 additions, 0 deletions
istl/test/matrixtest.cc
with
67 additions
and
1 deletion
istl/test/Makefile.am
+
3
−
1
View file @
0d13fc73
...
...
@@ -7,7 +7,7 @@ if MPI
endif
# which tests where program to build and run are equal
NORMALTESTS
=
matrixutilstest bvectortest indexsettest
$(
SELECTPROG
)
NORMALTESTS
=
matrixutilstest
matrixtest
bvectortest indexsettest
$(
SELECTPROG
)
# list of tests to run (indicestest is special case)
TESTS
=
$(
NORMALTESTS
)
$(
DUNE_COMMON_ROOT
)
/bin/perhapsstartmpi
$(
INDEXRUN
)
$(
DUNE_COMMON_ROOT
)
/bin/perhapsstopmpi
...
...
@@ -23,6 +23,8 @@ bvectortest_SOURCES = bvectortest.cc
matrixutilstest_SOURCES
=
matrixutilstest.cc laplacian.hh
#matrixutilstest_DEPENDENCIES = $(LOCAL_LIBS)
matrixtest_SOURCES
=
matrixtest.cc
indicestest_SOURCES
=
indicestest.cc
indicestest_CXXFLAGS
=
$(
MPI_CPPFLAGS
)
indicestest_LDFLAGS
=
$(
MPI_LDFLAGS
)
$(
MPI_LIBS
)
...
...
This diff is collapsed.
Click to expand it.
istl/test/matrixtest.cc
0 → 100644
+
64
−
0
View file @
0d13fc73
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
/** \file
\brief Unit tests for the different dynamic matrices provided by ISTL
*/
#include
<dune/common/fmatrix.hh>
#include
<dune/istl/bcrsmatrix.hh>
#include
<dune/istl/matrix.hh>
#include
<dune/istl/bdmatrix.hh>
using
namespace
Dune
;
template
<
class
MatrixType
>
void
testMatrix
(
MatrixType
&
matrix
)
{
// ////////////////////////////////////////////////////////
// Count number of rows, columns, and nonzero entries
// ////////////////////////////////////////////////////////
typename
MatrixType
::
RowIterator
rowIt
=
matrix
.
begin
();
typename
MatrixType
::
RowIterator
rowEndIt
=
matrix
.
end
();
int
numRows
=
0
,
numEntries
=
0
;
for
(;
rowIt
!=
rowEndIt
;
++
rowIt
)
{
typename
MatrixType
::
ColIterator
colIt
=
rowIt
->
begin
();
typename
MatrixType
::
ColIterator
colEndIt
=
rowIt
->
end
();
for
(;
colIt
!=
colEndIt
;
++
colIt
)
numEntries
++
;
numRows
++
;
}
assert
(
numRows
==
matrix
.
N
());
// test assignment from scalar
matrix
=
0
;
}
int
main
()
{
// ////////////////////////////////////////////////////////////
// Test the Matrix class -- a dense dynamic matrix
// ////////////////////////////////////////////////////////////
Matrix
<
FieldMatrix
<
double
,
3
,
3
>
>
matrix
(
10
,
10
);
for
(
int
i
=
0
;
i
<
10
;
i
++
)
for
(
int
j
=
0
;
j
<
10
;
j
++
)
for
(
int
k
=
0
;
k
<
3
;
k
++
)
for
(
int
l
=
0
;
l
<
3
;
l
++
)
matrix
[
i
][
j
][
k
][
l
]
=
(
i
+
j
)
/
((
double
)(
k
*
l
));
// just anything
testMatrix
(
matrix
);
}
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