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
3b89852e
Commit
3b89852e
authored
18 years ago
by
Christian Engwer
Browse files
Options
Downloads
Patches
Plain Diff
fvector test
[[Imported from SVN: r4811]]
parent
b27411d3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/test/Makefile.am
+4
-1
4 additions, 1 deletion
common/test/Makefile.am
common/test/fvectortest.cc
+92
-0
92 additions, 0 deletions
common/test/fvectortest.cc
with
96 additions
and
1 deletion
common/test/Makefile.am
+
4
−
1
View file @
3b89852e
# $Id$
TESTPROGS
=
parsetest test-stack arraylisttest smartpointertest
\
sllisttest iteratorfacadetest tuplestest fmatrixtest
\
sllisttest iteratorfacadetest tuplestest
fvectortest
fmatrixtest
\
poolallocatortest settest gcdlcdtest streamtest
\
bigunsignedinttest mpihelpertest singletontest mpicollcomm
...
...
@@ -43,6 +43,9 @@ iteratorfacadetest_SOURCES = iteratorfacadetest.cc iteratorfacadetest.hh \
iteratortest.hh
iteratorfacadetest_DEPENDENCIES
=
$(
LOCAL_LIBS
)
fvectortest_SOURCES
=
fvectortest.cc
fvectortest_DEPENDENCIES
=
$(
LOCAL_LIBS
)
fmatrixtest_SOURCES
=
fmatrixtest.cc
fmatrixtest_DEPENDENCIES
=
$(
LOCAL_LIBS
)
...
...
This diff is collapsed.
Click to expand it.
common/test/fvectortest.cc
0 → 100644
+
92
−
0
View file @
3b89852e
// -*- 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/fvector.hh>
#include
<dune/common/exceptions.hh>
#include
<iostream>
using
Dune
::
FieldVector
;
template
<
class
ct
,
int
d
>
class
FieldVectorMainTest
{
protected:
FieldVectorMainTest
()
{
FieldVector
<
ct
,
1
>
v
(
1
);
FieldVector
<
ct
,
1
>
w
(
2
);
bool
b
;
(
w
+
v
).
two_norm
();
(
w
+
v
).
two_norm2
();
(
w
+
v
).
one_norm
();
b
=
(
w
!=
v
);
b
=
(
w
==
v
);
}
};
template
<
class
ct
,
int
d
>
class
FieldVectorTest
:
public
FieldVectorMainTest
<
ct
,
d
>
{
public:
FieldVectorTest
()
:
FieldVectorMainTest
<
ct
,
d
>
()
{}
};
template
<
class
ct
>
class
FieldVectorTest
<
ct
,
1
>:
public
FieldVectorMainTest
<
ct
,
1
>
{
public:
FieldVectorTest
()
:
FieldVectorMainTest
<
ct
,
1
>
()
{
ct
a
=
1
;
FieldVector
<
ct
,
1
>
v
(
2
);
bool
b
;
v
=
a
;
a
=
v
;
b
=
(
v
==
a
);
b
=
(
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
;
}
};
int
main
()
{
try
{
FieldVectorTest
<
int
,
1
>
();
FieldVectorTest
<
int
,
2
>
();
FieldVectorTest
<
int
,
3
>
();
FieldVectorTest
<
float
,
1
>
();
FieldVectorTest
<
float
,
2
>
();
FieldVectorTest
<
float
,
3
>
();
FieldVectorTest
<
double
,
1
>
();
FieldVectorTest
<
double
,
2
>
();
FieldVectorTest
<
double
,
3
>
();
}
catch
(
Dune
::
Exception
&
e
)
{
std
::
cerr
<<
e
<<
std
::
endl
;
return
1
;
}
catch
(...)
{
std
::
cerr
<<
"Generic exception!"
<<
std
::
endl
;
return
2
;
}
}
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