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
55b9a0a0
Commit
55b9a0a0
authored
14 years ago
by
Christian Engwer
Browse files
Options
Downloads
Patches
Plain Diff
test scalar interface of fieldmatrix<1,1>
[[Imported from SVN: r6187]]
parent
826f31d6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/common/test/fmatrixtest.cc
+74
-0
74 additions, 0 deletions
dune/common/test/fmatrixtest.cc
with
74 additions
and
0 deletions
dune/common/test/fmatrixtest.cc
+
74
−
0
View file @
55b9a0a0
...
...
@@ -9,8 +9,23 @@
#include
<algorithm>
#include
<vector>
#ifdef __GNUC__
#include
<cxxabi.h>
#endif
using
namespace
Dune
;
template
<
class
T
>
std
::
string
className
(
T
&
t
)
{
#ifdef __GNUC__
int
status
;
return
abi
::
__cxa_demangle
(
typeid
(
t
).
name
(),
0
,
0
,
&
status
);
#else
return
typeid
(
t
).
name
();
#endif
};
template
<
typename
T
,
std
::
size_t
n
>
int
test_invert_solve
(
T
A_data
[
n
*
n
],
T
inv_data
[
n
*
n
],
T
x_data
[
n
],
T
b_data
[
n
])
...
...
@@ -370,11 +385,70 @@ int test_determinant()
return
0
;
}
template
<
class
ft
>
struct
ScalarOperatorTest
{
ScalarOperatorTest
()
{
ft
a
=
1
;
ft
c
=
2
;
FieldMatrix
<
ft
,
1
,
1
>
v
(
2
);
FieldMatrix
<
ft
,
1
,
1
>
w
(
2
);
bool
b
;
std
::
cout
<<
__func__
<<
"
\t
( "
<<
className
(
v
)
<<
" )"
<<
std
::
endl
;
a
=
a
*
c
;
a
=
a
+
c
;
a
=
a
/
c
;
a
=
a
-
c
;
v
=
a
;
v
=
w
=
v
;
a
=
v
;
a
=
v
+
a
;
a
=
v
-
a
;
a
=
v
*
a
;
a
=
v
/
a
;
v
=
v
+
a
;
v
=
v
-
a
;
v
=
v
*
a
;
v
=
v
/
a
;
a
=
a
+
v
;
a
=
a
-
v
;
a
=
a
*
v
;
a
=
a
/
v
;
v
=
a
+
v
;
v
=
a
-
v
;
v
=
a
*
v
;
v
=
a
/
v
;
v
-=
v
;
v
-=
a
;
v
+=
v
;
v
+=
a
;
v
*=
a
;
v
/=
a
;
b
=
(
v
==
a
);
b
=
(
v
!=
a
);
b
=
(
a
==
v
);
b
=
(
a
!=
v
);
}
};
int
main
()
{
try
{
test_matrix
<
float
,
1
,
1
>
();
ScalarOperatorTest
<
float
>
();
test_matrix
<
double
,
1
,
1
>
();
ScalarOperatorTest
<
double
>
();
test_matrix
<
int
,
10
,
5
>
();
test_matrix
<
double
,
5
,
10
>
();
test_determinant
();
...
...
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