Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Timo Koch
dune-common
Commits
4773d50a
Commit
4773d50a
authored
12 years ago
by
Oliver Sander
Browse files
Options
Downloads
Patches
Plain Diff
Copy the test for DiagonalMatrix from dune-istl to here
[[Imported from SVN: r6997]]
parent
a11d8fa5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dune/common/test/.gitignore
+1
-0
1 addition, 0 deletions
dune/common/test/.gitignore
dune/common/test/Makefile.am
+3
-0
3 additions, 0 deletions
dune/common/test/Makefile.am
dune/common/test/diagonalmatrixtest.cc
+64
-0
64 additions, 0 deletions
dune/common/test/diagonalmatrixtest.cc
with
68 additions
and
0 deletions
dune/common/test/.gitignore
+
1
−
0
View file @
4773d50a
...
...
@@ -3,6 +3,7 @@ Makefile.in
.deps
.libs
semantic.cache
diagonalmatrixtest
dynvectortest
fvectortest
mpicollectivecommunication
...
...
This diff is collapsed.
Click to expand it.
dune/common/test/Makefile.am
+
3
−
0
View file @
4773d50a
...
...
@@ -8,6 +8,7 @@ TESTPROGS = \
bitsetvectortest
\
check_fvector_size
\
conversiontest
\
diagonalmatrixtest
\
dynmatrixtest
\
dynvectortest
\
enumsettest
\
...
...
@@ -98,6 +99,8 @@ parametertreetest_SOURCES = parametertreetest.cc
bitsetvectortest_SOURCES
=
bitsetvectortest.cc
diagonalmatrixtest_SOURCES
=
diagonalmatrixtest.cc
nullptr_test_SOURCES
=
nullptr-test.cc nullptr-test2.cc
nullptr_test_fail_SOURCES
=
nullptr-test.cc
nullptr_test_fail_CPPFLAGS
=
$(
AM_CPPFLAGS
)
-DFAIL
...
...
This diff is collapsed.
Click to expand it.
dune/common/test/diagonalmatrixtest.cc
0 → 100644
+
64
−
0
View file @
4773d50a
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#include
"config.h"
#include
<dune/common/diagonalmatrix.hh>
#include
<iostream>
#include
<algorithm>
#include
<dune/common/fvector.hh>
#include
<dune/common/exceptions.hh>
using
namespace
Dune
;
template
<
class
K
,
int
n
>
void
test_matrix
()
{
typedef
typename
DiagonalMatrix
<
K
,
n
>::
size_type
size_type
;
DiagonalMatrix
<
K
,
n
>
A
(
1
);
FieldVector
<
K
,
n
>
f
;
FieldVector
<
K
,
n
>
v
;
// assign matrix
A
=
2
;
// assign vector
f
=
1
;
v
=
2
;
// matrix vector product
A
.
umv
(
v
,
f
);
// test norms
A
.
frobenius_norm
();
A
.
frobenius_norm2
();
A
.
infinity_norm
();
A
.
infinity_norm_real
();
std
::
sort
(
v
.
begin
(),
v
.
end
());
// print matrix
std
::
cout
<<
A
<<
std
::
endl
;
// print vector
std
::
cout
<<
f
<<
std
::
endl
;
// assign to FieldMatrix
FieldMatrix
<
K
,
n
,
n
>
AFM
=
FieldMatrix
<
K
,
n
,
n
>
(
A
);
}
int
main
()
{
try
{
test_matrix
<
float
,
1
>
();
test_matrix
<
double
,
1
>
();
test_matrix
<
double
,
5
>
();
}
catch
(
Dune
::
Exception
&
e
)
{
std
::
cerr
<<
"Exception: "
<<
e
<<
std
::
endl
;
}
}
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