Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tnl-dev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
TNL
tnl-dev
Commits
50191569
There was an error fetching the commit references. Please try again later.
Commit
50191569
authored
8 years ago
by
Jakub Klinkovský
Browse files
Options
Downloads
Patches
Plain Diff
Fixed MatrixWriter class
parent
5b487573
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
src/TNL/Matrices/MatrixWriter.h
+9
-7
9 additions, 7 deletions
src/TNL/Matrices/MatrixWriter.h
src/TNL/Matrices/MatrixWriter_impl.h
+19
-16
19 additions, 16 deletions
src/TNL/Matrices/MatrixWriter_impl.h
with
28 additions
and
23 deletions
src/TNL/Matrices/MatrixWriter.h
+
9
−
7
View file @
50191569
...
...
@@ -11,6 +11,7 @@
#pragma once
#include
<ostream>
#include
<iostream>
namespace
TNL
{
namespace
Matrices
{
...
...
@@ -23,26 +24,27 @@ class MatrixWriter
typedef
typename
Matrix
::
IndexType
IndexType
;
typedef
typename
Matrix
::
RealType
RealType
;
static
bool
writeToGnuplot
(
std
::
ostream
str
,
static
bool
writeToGnuplot
(
std
::
ostream
&
str
,
const
Matrix
&
matrix
,
bool
verbose
=
false
);
static
bool
writeToEps
(
std
::
ostream
str
,
static
bool
writeToEps
(
std
::
ostream
&
str
,
const
Matrix
&
matrix
,
bool
verbose
=
false
);
protected:
static
bool
writeEpsHeader
(
std
::
ostream
str
,
static
bool
writeEpsHeader
(
std
::
ostream
&
str
,
const
Matrix
&
matrix
,
const
int
elementSize
);
static
bool
writeEpsBody
(
std
::
ostream
str
,
static
bool
writeEpsBody
(
std
::
ostream
&
str
,
const
Matrix
&
matrix
,
const
int
elementSize
);
const
int
elementSize
,
bool
verbose
);
};
}
// namespace Matrices
}
// namespace TNL
#include
<TNL/Matrices/MatrixWriter_impl.h>
This diff is collapsed.
Click to expand it.
src/TNL/Matrices/MatrixWriter_impl.h
+
19
−
16
View file @
50191569
...
...
@@ -10,21 +10,23 @@
#pragma once
#include
<TNL/Matrices/MatrixWriter.h>
namespace
TNL
{
namespace
Matrices
{
template
<
typename
Matrix
>
bool
MatrixWriter
<
Matrix
>::
writeToGnuplot
(
std
::
ostream
str
,
const
Matrix
&
matrix
,
bool
verbose
)
bool
MatrixWriter
<
Matrix
>::
writeToGnuplot
(
std
::
ostream
&
str
,
const
Matrix
&
matrix
,
bool
verbose
)
{
for
(
IndexType
row
=
0
;
row
<
matrix
.
getRows
();
row
++
)
{
for
(
IndexType
column
=
0
;
column
<
matrix
.
getColumns
();
column
++
)
{
RealType
elementValue
=
ma
y
trix
.
getElement
(
row
,
column
);
RealType
elementValue
=
matrix
.
getElement
(
row
,
column
);
if
(
elementValue
!=
(
RealType
)
0.0
)
str
<<
column
<<
" "
<<
getSize
()
-
row
<<
" "
<<
elementValue
<<
std
::
endl
;
str
<<
column
<<
" "
<<
row
<<
" "
<<
elementValue
<<
std
::
endl
;
}
if
(
verbose
)
std
::
cout
<<
"Drawing the row "
<<
row
<<
"
\r
"
<<
std
::
flush
;
...
...
@@ -35,9 +37,9 @@ bool MatrixWriter< Matrix >::writeToGnuplot( std::ostream str,
}
template
<
typename
Matrix
>
bool
MatrixWriter
<
Matrix
>::
writeToEps
(
std
::
ostream
str
,
const
Matrix
&
matrix
,
bool
verbose
)
bool
MatrixWriter
<
Matrix
>::
writeToEps
(
std
::
ostream
&
str
,
const
Matrix
&
matrix
,
bool
verbose
)
{
const
int
elementSize
=
10
;
if
(
!
writeEpsHeader
(
str
,
matrix
,
elementSize
)
)
...
...
@@ -54,9 +56,9 @@ bool MatrixWriter< Matrix >::writeToEps( std::ostream str,
}
template
<
typename
Matrix
>
bool
MatrixWriter
<
Matrix
>::
writeEpsHeader
(
std
::
ostream
str
,
const
Marix
&
matrix
,
const
int
elementSize
)
bool
MatrixWriter
<
Matrix
>::
writeEpsHeader
(
std
::
ostream
&
str
,
const
Ma
t
rix
&
matrix
,
const
int
elementSize
)
{
const
double
scale
=
elementSize
*
max
(
matrix
.
getRows
(),
matrix
.
getColumns
()
);
str
<<
"%!PS-Adobe-2.0 EPSF-2.0"
<<
std
::
endl
;
...
...
@@ -69,14 +71,15 @@ bool MatrixWriter< Matrix >::writeEpsHeader( std::ostream str,
}
template
<
typename
Matrix
>
bool
MatrixWriter
<
Matrix
>::
writeEpsBody
(
std
::
ostream
str
,
const
Marix
&
matrix
,
const
int
elementSize
)
bool
MatrixWriter
<
Matrix
>::
writeEpsBody
(
std
::
ostream
&
str
,
const
Matrix
&
matrix
,
const
int
elementSize
,
bool
verbose
)
{
IndexType
lastRow
(
0
),
lastColumn
(
0
);
for
(
IndexType
row
=
0
;
row
<
getSize
();
row
++
)
for
(
IndexType
row
=
0
;
row
<
matrix
.
getRows
();
row
++
)
{
for
(
IndexType
column
=
0
;
column
<
getSize
();
column
++
)
for
(
IndexType
column
=
0
;
column
<
matrix
.
getColumns
();
column
++
)
{
RealType
elementValue
=
getElement
(
row
,
column
);
if
(
elementValue
!=
(
RealType
)
0.0
)
...
...
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