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
18c2ae24
Commit
18c2ae24
authored
6 years ago
by
Oliver Sander
Browse files
Options
Downloads
Patches
Plain Diff
Simplify writeVectorToMatlab
parent
9dbe0d9b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!265
Implement matlab writing for matrices with scalar entries
Pipeline
#15557
passed
6 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/istl/io.hh
+16
-38
16 additions, 38 deletions
dune/istl/io.hh
with
16 additions
and
38 deletions
dune/istl/io.hh
+
16
−
38
View file @
18c2ae24
...
...
@@ -15,13 +15,10 @@
#include
"istlexception.hh"
#include
<dune/common/fvector.hh>
#include
<dune/common/fmatrix.hh>
#include
<dune/common/dynmatrix.hh>
#include
<dune/common/diagonalmatrix.hh>
#include
<dune/common/hybridutilities.hh>
#include
<dune/common/unused.hh>
#include
<dune/istl/matrix.hh>
#include
<dune/istl/scaledidmatrix.hh>
#include
"bcrsmatrix.hh"
#include
<dune/istl/bcrsmatrix.hh>
namespace
Dune
{
...
...
@@ -505,42 +502,23 @@ namespace Dune {
outStream
.
precision
(
oldPrecision
);
}
// Recursively print all the blocks
// Write vector entries to a stream
// TODO: The writeVectorToMatlab method does not actually need this helper anymore:
// As there is no template specialization involved, the code may as well
// be simply folded into writeVectorToMatlab. On the other hand,
// writeVectorToMatlabHelper writes the vector content into a stream,
// which may be useful to some people.
template
<
class
V
>
void
writeVectorToMatlabHelper
(
const
V
&
v
,
std
::
ostream
&
stream
)
{
for
(
const
auto
&
entry
:
v
)
writeVectorToMatlabHelper
(
entry
,
stream
);
}
// Recursively print all the blocks -- specialization for FieldVector
template
<
class
K
,
int
n
>
void
writeVectorToMatlabHelper
(
const
FieldVector
<
K
,
n
>&
v
,
std
::
ostream
&
s
)
{
for
(
const
auto
&
entry
:
v
)
{
s
<<
entry
<<
std
::
endl
;
}
}
// Recursively print all the blocks -- specialization for std::vector
template
<
class
K
>
void
writeVectorToMatlabHelper
(
const
std
::
vector
<
K
>&
v
,
std
::
ostream
&
s
)
{
for
(
const
auto
&
entry
:
v
)
{
s
<<
entry
<<
std
::
endl
;
}
}
// Recursively print all the blocks -- specialization for std::array
template
<
class
K
,
std
::
size_t
n
>
void
writeVectorToMatlabHelper
(
const
std
::
array
<
K
,
n
>&
v
,
std
::
ostream
&
s
)
{
for
(
const
auto
&
entry
:
v
)
{
s
<<
entry
<<
std
::
endl
;
}
Hybrid
::
ifElse
(
IsNumber
<
V
>
(),
[
&
](
auto
id
)
{
stream
<<
id
(
v
)
<<
std
::
endl
;
},
[
&
](
auto
id
)
{
for
(
const
auto
&
entry
:
id
(
v
))
writeVectorToMatlabHelper
(
entry
,
stream
);
});
}
/**
...
...
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