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
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
Patrick Jaap
dune-istl
Commits
d0abc043
Commit
d0abc043
authored
1 year ago
by
Lisa Julia Nebel
Browse files
Options
Downloads
Patches
Plain Diff
Add printSparseMatrix method for ScaledIdentityMatrix
parent
497d5223
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/istl/io.hh
+25
-4
25 additions, 4 deletions
dune/istl/io.hh
with
25 additions
and
4 deletions
dune/istl/io.hh
+
25
−
4
View file @
d0abc043
...
...
@@ -267,13 +267,13 @@ namespace Dune {
* @param width The number of nonzero blocks to print in one line.
* @param precision The precision to use when printing the numbers.
*/
template
<
class
B
,
int
n
,
int
m
,
class
A
>
template
<
class
A
,
class
InnerMatrixType
>
void
printSparseMatrix
(
std
::
ostream
&
s
,
const
BCRSMatrix
<
Field
Matrix
<
B
,
n
,
m
>
,
A
>&
mat
,
const
BCRSMatrix
<
Inner
Matrix
Type
,
A
>&
mat
,
std
::
string
title
,
std
::
string
rowtext
,
int
width
=
3
,
int
precision
=
2
)
{
typedef
BCRSMatrix
<
Field
Matrix
<
B
,
n
,
m
>
,
A
>
Matrix
;
typedef
BCRSMatrix
<
Inner
Matrix
Type
,
A
>
Matrix
;
// remember old flags
std
::
ios_base
::
fmtflags
oldflags
=
s
.
flags
();
// set the output format
...
...
@@ -290,6 +290,8 @@ namespace Dune {
typedef
typename
Matrix
::
ConstRowIterator
Row
;
int
n
=
InnerMatrixType
::
rows
;
int
m
=
InnerMatrixType
::
cols
;
for
(
Row
row
=
mat
.
begin
();
row
!=
mat
.
end
();
++
row
)
{
int
skipcols
=
0
;
bool
reachedEnd
=
false
;
...
...
@@ -323,7 +325,7 @@ namespace Dune {
}
for
(
int
innercol
=
0
;
innercol
<
m
;
++
innercol
)
{
s
.
width
(
9
);
s
<<
(
*
col
)[
innerrow
][
innercol
]
<<
" "
;
printInnerMatrixElement
(
s
,
*
col
,
innerrow
,
innercol
)
;
}
s
<<
"|"
;
...
...
@@ -344,6 +346,25 @@ namespace Dune {
s
.
precision
(
oldprec
);
}
template
<
class
B
,
int
n
>
void
printInnerMatrixElement
(
std
::
ostream
&
s
,
const
ScaledIdentityMatrix
<
B
,
n
>
innerMatrixElement
,
int
innerrow
,
int
innercol
)
{
if
(
innerrow
==
innercol
)
s
<<
innerMatrixElement
.
scalar
()
<<
" "
;
else
s
<<
"-"
;
}
template
<
class
B
,
int
n
,
int
m
,
class
A
>
void
printInnerMatrixElement
(
std
::
ostream
&
s
,
const
FieldMatrix
<
B
,
n
,
m
>
innerMatrixElement
,
int
innerrow
,
int
innercol
)
{
s
<<
innerMatrixElement
[
innerrow
][
innercol
]
<<
" "
;
}
namespace
{
template
<
typename
T
>
...
...
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