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
e9c78f36
Commit
e9c78f36
authored
19 years ago
by
Markus Blatt
Browse files
Options
Downloads
Patches
Plain Diff
Moved helper classes into anonymous namespace.
[[Imported from SVN: r580]]
parent
2c81aebc
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
istl/matrixutils.hh
+28
-23
28 additions, 23 deletions
istl/matrixutils.hh
with
28 additions
and
23 deletions
istl/matrixutils.hh
+
28
−
23
View file @
e9c78f36
...
...
@@ -17,37 +17,42 @@ namespace Dune
* @brief Some handy generic functions for ISTL matrices.
* @author Markus Blatt
*/
template
<
int
i
>
struct
NonZeroCounter
namespace
{
template
<
class
M
>
static
typename
M
::
size_type
count
(
const
M
&
matrix
)
template
<
int
i
>
struct
NonZeroCounter
{
typedef
typename
M
::
ConstRowIterator
RowIterator
;
template
<
class
M
>
static
typename
M
::
size_type
count
(
const
M
&
matrix
)
{
typedef
typename
M
::
ConstRowIterator
RowIterator
;
RowIterator
endRow
=
matrix
.
end
();
typename
M
::
size_type
nonZeros
=
0
;
RowIterator
endRow
=
matrix
.
end
();
typename
M
::
size_type
nonZeros
=
0
;
for
(
RowIterator
row
=
matrix
.
begin
();
row
!=
endRow
;
++
row
)
{
typedef
typename
M
::
ConstColIterator
Entry
;
Entry
endEntry
=
row
->
end
();
for
(
Entry
entry
=
row
->
begin
();
entry
!=
endEntry
;
++
entry
)
{
nonZeros
+=
NonZeroCounter
<
i
-
1
>::
count
(
*
entry
);
for
(
RowIterator
row
=
matrix
.
begin
();
row
!=
endRow
;
++
row
)
{
typedef
typename
M
::
ConstColIterator
Entry
;
Entry
endEntry
=
row
->
end
();
for
(
Entry
entry
=
row
->
begin
();
entry
!=
endEntry
;
++
entry
)
{
nonZeros
+=
NonZeroCounter
<
i
-
1
>::
count
(
*
entry
);
}
}
return
nonZeros
;
}
return
nonZeros
;
}
};
};
template
<
>
struct
NonZeroCounter
<
1
>
{
template
<
class
M
>
static
typename
M
::
size_type
count
(
const
M
&
matrix
)
template
<
>
struct
NonZeroCounter
<
1
>
{
return
matrix
.
N
()
*
matrix
.
M
();
}
};
template
<
class
M
>
static
typename
M
::
size_type
count
(
const
M
&
matrix
)
{
return
matrix
.
N
()
*
matrix
.
M
();
}
};
}
/**
* @brief Get the number of nonzero fields in the matrix.
...
...
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