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
d38b93c9
Commit
d38b93c9
authored
12 years ago
by
Oliver Sander
Browse files
Options
Downloads
Patches
Plain Diff
Use size_t instead of int for all variables holding sizes.
Thanks to Uli Sack for the Patch. [[Imported from SVN: r1544]]
parent
750c040c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/istl/matrixindexset.hh
+16
-15
16 additions, 15 deletions
dune/istl/matrixindexset.hh
with
16 additions
and
15 deletions
dune/istl/matrixindexset.hh
+
16
−
15
View file @
d38b93c9
...
...
@@ -14,43 +14,44 @@ namespace Dune {
{
public:
typedef
size_t
size_type
;
/** \brief Default constructor */
MatrixIndexSet
()
:
rows_
(
0
),
cols_
(
0
)
{}
/** \brief Constructor setting the matrix size */
MatrixIndexSet
(
int
rows
,
int
cols
)
:
rows_
(
rows
),
cols_
(
cols
)
{
MatrixIndexSet
(
size_type
rows
,
size_type
cols
)
:
rows_
(
rows
),
cols_
(
cols
)
{
indices_
.
resize
(
rows_
);
}
/** \brief Reset the size of an index set */
void
resize
(
int
rows
,
int
cols
)
{
void
resize
(
size_type
rows
,
size_type
cols
)
{
rows_
=
rows
;
cols_
=
cols
;
indices_
.
resize
(
rows_
);
}
/** \brief Add an index to the index set */
void
add
(
int
i
,
int
j
)
{
void
add
(
size_type
i
,
size_type
j
)
{
indices_
[
i
].
insert
(
j
);
}
/** \brief Return the number of entries */
int
size
()
const
{
int
entries
=
0
;
for
(
int
i
=
0
;
i
<
rows_
;
i
++
)
size_type
size
()
const
{
size_type
entries
=
0
;
for
(
size_type
i
=
0
;
i
<
rows_
;
i
++
)
entries
+=
indices_
[
i
].
size
();
return
entries
;
}
/** \brief Return the number of rows */
int
rows
()
const
{
return
rows_
;}
size_type
rows
()
const
{
return
rows_
;}
/** \brief Return the number of entries in a given row */
int
rowsize
(
int
row
)
const
{
return
indices_
[
row
].
size
();}
size_type
rowsize
(
size_type
row
)
const
{
return
indices_
[
row
].
size
();}
/** \brief Import all nonzero entries of a sparse matrix into the index set
\tparam MatrixType Needs to be BCRSMatrix<...>
...
...
@@ -59,12 +60,12 @@ namespace Dune {
\param colOffset don't write to cols<colOffset
*/
template
<
class
MatrixType
>
void
import
(
const
MatrixType
&
m
,
int
rowOffset
=
0
,
int
colOffset
=
0
)
{
void
import
(
const
MatrixType
&
m
,
size_type
rowOffset
=
0
,
size_type
colOffset
=
0
)
{
typedef
typename
MatrixType
::
row_type
RowType
;
typedef
typename
RowType
::
ConstIterator
ColumnIterator
;
for
(
int
rowIdx
=
0
;
rowIdx
<
m
.
N
();
rowIdx
++
)
{
for
(
size_type
rowIdx
=
0
;
rowIdx
<
m
.
N
();
rowIdx
++
)
{
const
RowType
&
row
=
m
[
rowIdx
];
...
...
@@ -89,14 +90,14 @@ namespace Dune {
matrix
.
setSize
(
rows_
,
cols_
);
matrix
.
setBuildMode
(
MatrixType
::
random
);
for
(
int
i
=
0
;
i
<
rows_
;
i
++
)
for
(
size_type
i
=
0
;
i
<
rows_
;
i
++
)
matrix
.
setrowsize
(
i
,
indices_
[
i
].
size
());
matrix
.
endrowsizes
();
for
(
int
i
=
0
;
i
<
rows_
;
i
++
)
{
for
(
size_type
i
=
0
;
i
<
rows_
;
i
++
)
{
typename
std
::
set
<
unsigned
int
>::
iterator
it
=
indices_
[
i
].
begin
();
typename
std
::
set
<
size_type
>::
iterator
it
=
indices_
[
i
].
begin
();
for
(;
it
!=
indices_
[
i
].
end
();
++
it
)
matrix
.
addindex
(
i
,
*
it
);
...
...
@@ -108,9 +109,9 @@ namespace Dune {
private
:
std
::
vector
<
std
::
set
<
unsigned
int
>
>
indices_
;
std
::
vector
<
std
::
set
<
size_type
>
>
indices_
;
int
rows_
,
cols_
;
size_type
rows_
,
cols_
;
};
...
...
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