Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
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
Timo Koch
dune-common
Commits
42f3ff3e
Commit
42f3ff3e
authored
20 years ago
by
Markus Blatt
Browse files
Options
Downloads
Patches
Plain Diff
Use a set for the connected vertices.
[[Imported from SVN: r1899]]
parent
acd853e4
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
istl/paamg/galerkin.hh
+48
-8
48 additions, 8 deletions
istl/paamg/galerkin.hh
with
48 additions
and
8 deletions
istl/paamg/galerkin.hh
+
48
−
8
View file @
42f3ff3e
...
...
@@ -5,6 +5,7 @@
#define DUNE_GALERKIN_HH
#include
"aggregates.hh"
#include
<set>
namespace
Dune
{
...
...
@@ -33,8 +34,8 @@ namespace Dune
* be stored
*/
template
<
class
M
,
class
G
,
class
I
,
class
A
,
class
Set
>
void
build
(
const
M
&
fine
,
const
G
&
fineGraph
,
const
I
&
fineIndices
,
const
A
aggregates
,
M
&
coarse
,
const
Set
&
overlap
);
M
*
build
(
const
M
&
fine
,
const
G
&
fineGraph
,
const
I
&
fineIndices
,
const
A
aggregates
,
const
Set
&
overlap
);
private:
...
...
@@ -111,7 +112,7 @@ namespace Dune
* @param aggregates The mapping of the vertices onto the aggregates.
* @param connected The set to added the connected aggregates to.
*/
ConnectedBuilder
(
const
AggregatesMap
<
Vertex
>&
aggregates
,
Set
&
connected
);
ConnectedBuilder
(
const
AggregatesMap
<
Vertex
>&
aggregates
,
Graph
&
graph
,
Set
&
connected
);
/**
* @brief Process an edge pointing to another aggregate.
...
...
@@ -124,6 +125,9 @@ namespace Dune
* @brief The mapping of the vertices onto the aggregates.
*/
const
AggregatesMap
<
Vertex
>&
aggregates_
;
Graph
&
graph_
;
/**
* @brief The set to add the connected vertices to.
*/
...
...
@@ -176,7 +180,7 @@ namespace Dune
const
AggregatesMap
<
typename
G
::
VertexDescriptor
>&
aggregates
,
const
typename
G
::
VertexDescriptor
&
seed
)
{
connected
.
pu
t
(
aggregates
[
seed
]);
connected
.
inser
t
(
aggregates
[
seed
]);
ConnectedBuilder
<
G
,
S
>
conBuilder
(
aggregates
,
connected
);
aggregates
.
breadthFirstSearch
(
seed
,
aggregates
[
seed
],
graph
,
conBuilder
);
}
...
...
@@ -187,7 +191,7 @@ namespace Dune
const
OverlapVertex
<
typename
G
::
VertexDescriptor
>*
seed
)
{
const
typename
G
::
VertexDescriptor
aggregate
=
seed
.
aggregate
;
connected
.
pu
t
(
aggregate
);
connected
.
inser
t
(
aggregate
);
ConnectedBuilder
<
G
,
S
>
conBuilder
(
aggregates
,
connected
);
while
(
aggregate
!=
seed
.
aggregate
)
{
// Walk over all neighbours and add them to the connected array.
...
...
@@ -199,14 +203,16 @@ namespace Dune
}
template
<
class
G
,
class
S
>
GalerkinProduct
::
ConnectedBuilder
<
G
,
S
>::
ConnectedBuilder
(
const
AggregatesMap
<
Vertex
>&
aggregates
,
Set
&
connected
)
:
aggregates_
(
aggregates
),
connected_
(
connected
)
GalerkinProduct
::
ConnectedBuilder
<
G
,
S
>::
ConnectedBuilder
(
const
AggregatesMap
<
Vertex
>&
aggregates
,
Graph
&
graph
,
Set
&
connected
)
:
aggregates_
(
aggregates
),
graph_
(
graph
),
connected_
(
connected
)
{}
template
<
class
G
,
class
S
>
void
GalerkinProduct
::
ConnectedBuilder
<
G
,
S
>::
operator
()(
const
ConstEdgeIterator
&
edge
)
{
graph_
.
getVertextProperties
(
edge
.
target
()).
setVisited
();
connected_
.
put
(
edge
.
target
());
}
...
...
@@ -268,6 +274,7 @@ namespace Dune
typedef
typename
I
::
const_iterator
IndexIterator
;
const
IndexIterator
end
=
indices
.
end
();
int
nonzeros
=
0
;
int
unknowns
=
0
;
for
(
IndexIterator
index
=
indices
.
begin
();
index
!=
end
;
++
index
)
{
connected
.
clear
();
...
...
@@ -280,12 +287,45 @@ namespace Dune
constructConnectivity
(
connected
,
graph
,
aggregates
,
index
);
}
nonzeros
+=
connected
.
size
();
++
unknowns
;
}
}
connected
.
clear
();
return
nonzeros
;
// Reset the visited flags of all vertices.
typedef
typename
G
::
iterator
Vertex
;
Vertex
vend
=
graph
.
end
();
for
(
Vertex
vertex
=
graph
.
begin
();
vertex
!=
vend
;
++
vertex
)
vertex
.
properties
().
resetVisited
();
return
std
::
make_pair
(
unknowns
,
nonzeros
);
}
template
<
class
M
,
class
G
,
class
I
,
class
A
,
class
Set
>
M
*
GalerkinProduct
::
build
(
const
M
&
fine
,
const
G
&
fineGraph
,
const
I
&
fineIndices
,
const
A
aggregates
,
const
Set
&
overlap
)
{
typedef
OverlapVertex
<
typename
G
::
VertexDescriptor
>
OverlapVertex
;
std
::
set
<
typename
G
::
VertexDescriptor
>
connected
;
OverlapVertex
*
overlapVertices
=
buildOverlapVertices
(
fineGraph
,
fineIndices
,
aggregates
,
overlap
);
int
nonZeros
,
unknowns
;
std
::
pair
<
int
&
,
int
&>
res
(
nonZeros
,
unknowns
);
res
=
countNonZeros
(
connected
,
fineGraph
,
fineIndices
,
aggregates
,
overlap
,
overlapVertices
);
M
*
coarseMatrix
=
new
M
(
unknowns
,
unknowns
,
nonZeros
,
M
::
row_wise
);
return
coarseMatrix
;
}
}
// namespace Amg
}
// namespace Dune
#endif
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