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
fd3b6585
Commit
fd3b6585
authored
6 years ago
by
Oliver Sander
Browse files
Options
Downloads
Patches
Plain Diff
Also test BlockVector<double> and BlockVector<std::complex<double> >
parent
dbf53070
No related branches found
No related tags found
1 merge request
!240
Allow number types as entries of matrix and vector types
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/istl/test/bvectortest.cc
+20
-13
20 additions, 13 deletions
dune/istl/test/bvectortest.cc
with
20 additions
and
13 deletions
dune/istl/test/bvectortest.cc
+
20
−
13
View file @
fd3b6585
...
...
@@ -21,25 +21,29 @@
#endif
#include
<dune/common/deprecated.hh>
#include
<dune/common/fvector.hh>
#include
<dune/common/hybridutilities.hh>
#include
<dune/common/poolallocator.hh>
#include
<dune/istl/bvector.hh>
#include
<dune/istl/test/vectortest.hh>
template
<
typename
T
,
int
BS
>
void
assign
(
Dune
::
FieldVector
<
T
,
BS
>
&
b
,
const
T
&
i
)
template
<
typename
VectorBlock
,
typename
V
>
void
assign
(
VectorBlock
&
b
,
const
V
&
i
)
{
for
(
int
j
=
0
;
j
<
BS
;
j
++
)
b
[
j
]
=
i
;
Dune
::
Hybrid
::
ifElse
(
Dune
::
IsNumber
<
VectorBlock
>
(),
[
&
](
auto
id
)
{
b
=
i
;
},
[
&
](
auto
id
)
{
for
(
auto
&
entry
:
id
(
b
))
entry
=
i
;
});
}
template
<
int
BS
,
class
A
=
std
::
allocator
<
void
>
>
template
<
class
VectorBlock
,
class
A
=
std
::
allocator
<
void
>
>
int
testVector
()
{
typedef
Dune
::
FieldVector
<
double
,
BS
>
VectorBlock
;
typedef
typename
A
::
template
rebind
<
VectorBlock
>
::
other
Alloc
;
typedef
Dune
::
BlockVector
<
VectorBlock
,
Alloc
>
Vector
;
...
...
@@ -93,7 +97,7 @@ int testVector()
// check the entries
for
(
typename
Vector
::
size_type
i
=
0
;
i
<
v
.
N
();
++
i
)
{
assign
(
b
,
(
typename
VectorBlock
::
field_type
)
i
);
assign
(
b
,
i
);
assert
(
v
[
i
]
==
b
);
}
...
...
@@ -227,17 +231,20 @@ int main()
int
ret
=
0
;
ret
+=
testVector
<
1
>
();
ret
+=
testVector
<
Dune
::
FieldVector
<
double
,
1
>
>
();
// ret += testVector<1, Dune::PoolAllocator<void,1000000> >();
#if HAVE_MPROTECT
ret
+=
testVector
<
1
,
Dune
::
DebugAllocator
<
void
>
>
();
ret
+=
testVector
<
Dune
::
FieldVector
<
double
,
1
>
,
Dune
::
DebugAllocator
<
void
>
>
();
#endif
ret
+=
testVector
<
3
>
();
ret
+=
testVector
<
Dune
::
FieldVector
<
double
,
3
>
>
();
// ret += testVector<3, Dune::PoolAllocator<void,1000000> >();
#if HAVE_MPROTECT
ret
+=
testVector
<
3
,
Dune
::
DebugAllocator
<
void
>
>
();
ret
+=
testVector
<
Dune
::
FieldVector
<
double
,
1
>
,
Dune
::
DebugAllocator
<
void
>
>
();
#endif
ret
+=
testVector
<
double
>
();
ret
+=
testVector
<
std
::
complex
<
double
>
>
();
testCapacity
();
return
ret
;
...
...
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