Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-matrix-vector
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
agnumpde
dune-matrix-vector
Commits
04a5698c
Commit
04a5698c
authored
10 years ago
by
Max Kahnt
Browse files
Options
Downloads
Patches
Plain Diff
Add some reworked genericvectortools for writeBinary method.
parent
2301ac4b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/matrix-vector/genericvectortools.hh
+59
-0
59 additions, 0 deletions
dune/matrix-vector/genericvectortools.hh
with
59 additions
and
0 deletions
dune/matrix-vector/genericvectortools.hh
0 → 100644
+
59
−
0
View file @
04a5698c
// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=8 sw=4 sts=4:
#ifndef DUNE_MATRIX_VECTOR_GENERICVECTORTOOLS_HH
#define DUNE_MATRIX_VECTOR_GENERICVECTORTOOLS_HH
/** \file
\brief Various tools for working with istl vectors of arbitrary nesting depth
*/
#include
<iostream>
#include
<dune/common/fvector.hh>
/** \brief Various tools for working with istl vectors of arbitrary nesting depth
*/
namespace
Dune
{
namespace
MatrixVector
{
namespace
Generic
{
// TODO change namespace name
template
<
class
Vector
>
struct
Helper
;
//! Write vector to given stream
template
<
class
Vector
>
void
writeBinary
(
std
::
ostream
&
s
,
const
Vector
&
v
)
{
Dune
::
MatrixVector
::
Generic
::
Helper
<
Vector
>::
writeBinary
(
s
,
v
);
}
template
<
class
Vector
>
struct
Helper
{
static
void
writeBinary
(
std
::
ostream
&
s
,
const
Vector
&
v
)
{
typename
Vector
::
const_iterator
it
=
v
.
begin
();
typename
Vector
::
const_iterator
end
=
v
.
end
();
for
(;
it
!=
end
;
++
it
)
Helper
<
typename
Vector
::
block_type
>::
writeBinary
(
s
,
*
it
);
}
};
template
<
class
Field
,
int
n
>
struct
Helper
<
Dune
::
FieldVector
<
Field
,
n
>>
{
static
void
writeBinary
(
std
::
ostream
&
s
,
const
Dune
::
FieldVector
<
Field
,
n
>&
v
)
{
typedef
typename
Dune
::
FieldVector
<
Field
,
n
>
Vector
;
typename
Vector
::
const_iterator
it
=
v
.
begin
();
typename
Vector
::
const_iterator
end
=
v
.
end
();
for
(;
it
!=
end
;
++
it
)
s
.
write
(
reinterpret_cast
<
const
char
*>
(
&
(
*
it
)),
sizeof
(
Field
));
}
};
}
// end namespace Generic
}
// end namespace MatrixVector
}
// end namespace Dune
#endif // DUNE_MATRIX_VECTOR_GENERICVECTORTOOLS_HH
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