Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
iwr
amdis
Commits
23eb48b5
Commit
23eb48b5
authored
Jul 09, 2009
by
Thomas Witkowski
Browse files
Cool, the parallelization works. Why, I do not know.
parent
6f81ca98
Changes
1
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/ParallelDomainProblem.cc
View file @
23eb48b5
...
...
@@ -24,7 +24,7 @@ namespace AMDiS {
PetscErrorCode
myKSPMonitor
(
KSP
ksp
,
PetscInt
iter
,
PetscReal
rnorm
,
void
*
)
{
if
(
iter
%
1
==
0
&&
MPI
::
COMM_WORLD
.
Get_rank
()
==
0
)
if
(
iter
%
1
00
==
0
&&
MPI
::
COMM_WORLD
.
Get_rank
()
==
0
)
std
::
cout
<<
" Iteration "
<<
iter
<<
": "
<<
rnorm
<<
std
::
endl
;
return
0
;
...
...
@@ -108,7 +108,6 @@ namespace AMDiS {
updateDofAdmins
();
// === Global refinements. ===
int
globalRefinement
=
0
;
...
...
@@ -579,15 +578,15 @@ namespace AMDiS {
// === Create for all rank owned dofs a new global indexing. ===
// Stores for
all rank owned dofs
a new global index.
DofIndexMap
rank
Owned
DofsNewGlobalIndex
;
// Stores for
dofs in rank
a new global index.
DofIndexMap
rankDofsNewGlobalIndex
;
// Stores for all rank owned dofs a continues local index.
DofIndexMap
rankOwnedDofsNewLocalIndex
;
i
=
0
;
for
(
DofContainer
::
iterator
dofIt
=
rankDOFs
.
begin
();
dofIt
!=
rankDOFs
.
end
();
++
dofIt
)
{
rank
Owned
DofsNewGlobalIndex
[
*
dofIt
]
=
i
+
rstart
;
rankDofsNewGlobalIndex
[
*
dofIt
]
=
i
+
rstart
;
rankOwnedDofsNewLocalIndex
[
*
dofIt
]
=
i
;
i
++
;
}
...
...
@@ -615,10 +614,10 @@ namespace AMDiS {
itRanks
!=
partitionDOFs
[
it
->
first
].
end
();
++
itRanks
)
{
if
(
*
itRanks
!=
mpiRank
)
{
TEST_EXIT_DBG
(
rank
Owned
DofsNewGlobalIndex
.
count
(
it
->
first
)
==
1
)
TEST_EXIT_DBG
(
rankDofsNewGlobalIndex
.
count
(
it
->
first
)
==
1
)
(
"DOF Key not found!
\n
"
);
sendNewDofs
[
*
itRanks
][
it
->
first
]
=
rank
Owned
DofsNewGlobalIndex
[
it
->
first
];
sendNewDofs
[
*
itRanks
][
it
->
first
]
=
rankDofsNewGlobalIndex
[
it
->
first
];
}
}
}
else
{
...
...
@@ -725,7 +724,7 @@ namespace AMDiS {
dofChanged
[
dofIt
->
first
]
=
true
;
recvDofs
[
recvIt
->
first
].
push_back
(
dofIt
->
first
);
rank
Owned
DofsNewGlobalIndex
[
dofIt
->
first
]
=
newGlobalDof
;
rankDofsNewGlobalIndex
[
dofIt
->
first
]
=
newGlobalDof
;
isRankDof
[
rankDofsNewLocalIndex
[
dofIt
->
first
]]
=
false
;
found
=
true
;
...
...
@@ -745,7 +744,7 @@ namespace AMDiS {
for
(
DofIndexMap
::
iterator
dofIt
=
rankDofsNewLocalIndex
.
begin
();
dofIt
!=
rankDofsNewLocalIndex
.
end
();
++
dofIt
)
{
DegreeOfFreedom
localDof
=
dofIt
->
second
;
DegreeOfFreedom
globalDof
=
rank
Owned
DofsNewGlobalIndex
[
dofIt
->
first
];
DegreeOfFreedom
globalDof
=
rankDofsNewGlobalIndex
[
dofIt
->
first
];
*
const_cast
<
DegreeOfFreedom
*>
(
dofIt
->
first
)
=
localDof
;
mapLocalGlobalDOFs
[
localDof
]
=
globalDof
;
...
...
@@ -932,15 +931,13 @@ namespace AMDiS {
mpiComm
.
Allreduce
(
&
nRankDOFs
,
&
nOverallDOFs
,
1
,
MPI_INT
,
MPI_SUM
);
// ===
// Do not change the indices now, but create a new indexing a store it here.
DofIndexMap
rankDofsNewLocalIndex
;
isRankDof
.
clear
();
int
i
=
0
;
for
(
DofContainer
::
iterator
dofIt
=
rankAllDofs
.
begin
();
dofIt
!=
rankAllDofs
.
end
();
++
dofIt
)
{
rankDofsNewLocalIndex
[
*
dofIt
]
=
i
;
// First, we set all dofs in ranks partition to be owend by the rank. Later,
// the dofs in ranks partition that are owned by other rank are set to false.
...
...
@@ -949,14 +946,14 @@ namespace AMDiS {
}
// Stores for all rank owned dofs a new global index.
DofIndexMap
rank
Owned
DofsNewGlobalIndex
;
DofIndexMap
rankDofsNewGlobalIndex
;
// Stores for all rank owned dofs a continues local index.
DofIndexMap
rankOwnedDofsNewLocalIndex
;
i
=
0
;
for
(
DofContainer
::
iterator
dofIt
=
rankDOFs
.
begin
();
dofIt
!=
rankDOFs
.
end
();
++
dofIt
)
{
rank
Owned
DofsNewGlobalIndex
[
*
dofIt
]
=
i
+
rstart
;
rankDofsNewGlobalIndex
[
*
dofIt
]
=
i
+
rstart
;
rankOwnedDofsNewLocalIndex
[
*
dofIt
]
=
i
;
i
++
;
}
...
...
@@ -978,7 +975,7 @@ namespace AMDiS {
int
c
=
0
;
for
(
DofContainer
::
iterator
dofIt
=
sendIt
->
second
.
begin
();
dofIt
!=
sendIt
->
second
.
end
();
++
dofIt
)
sendBuffers
[
i
][
c
++
]
=
rank
Owned
DofsNewGlobalIndex
[
*
dofIt
];
sendBuffers
[
i
][
c
++
]
=
rankDofsNewGlobalIndex
[
*
dofIt
];
request
[
requestCounter
++
]
=
mpiComm
.
Isend
(
sendBuffers
[
i
],
nSendDofs
,
MPI_INT
,
sendIt
->
first
,
0
);
...
...
@@ -1006,14 +1003,15 @@ namespace AMDiS {
for
(
DofContainer
::
iterator
dofIt
=
recvIt
->
second
.
begin
();
dofIt
!=
recvIt
->
second
.
end
();
++
dofIt
)
{
rank
Owned
DofsNewGlobalIndex
[
*
dofIt
]
=
recvBuffers
[
i
][
j
];
isRankDof
[
rank
Owned
DofsNewLocalIndex
[
*
dofIt
]]
=
false
;
rankDofsNewGlobalIndex
[
*
dofIt
]
=
recvBuffers
[
i
][
j
];
isRankDof
[
rankDofsNewLocalIndex
[
*
dofIt
]]
=
false
;
j
++
;
}
delete
[]
recvBuffers
[
i
++
];
}
// === Update list of dofs that must be communicated for solution exchange. ===
sendDofs
=
sendNewDofs
;
...
...
@@ -1023,11 +1021,12 @@ namespace AMDiS {
// === Create now the local to global index, and vice verse, mappings. ===
mapLocalGlobalDOFs
.
clear
();
mapLocalToDofIndex
.
clear
();
for
(
DofIndexMap
::
iterator
dofIt
=
rankDofsNewLocalIndex
.
begin
();
dofIt
!=
rankDofsNewLocalIndex
.
end
();
++
dofIt
)
{
DegreeOfFreedom
localDof
=
dofIt
->
second
;
DegreeOfFreedom
globalDof
=
rank
Owned
DofsNewGlobalIndex
[
dofIt
->
first
];
DegreeOfFreedom
globalDof
=
rankDofsNewGlobalIndex
[
dofIt
->
first
];
*
const_cast
<
DegreeOfFreedom
*>
(
dofIt
->
first
)
=
localDof
;
mapLocalGlobalDOFs
[
localDof
]
=
globalDof
;
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment